| 1 |
- import{c as H,o as $,a as b,J as W,j as Y,e as E,p as dt,q as z,m as wt,D as I,B as Ht,a1 as Yt,b as _t,F as nt,I as lt,Z as vt,s as Q,M as Ct,x as gt,A as U,X as it,Y as Lt}from"./vue-vendor-BdC0yijC.js";import Tt from"./LayoutExperience-6xU79BkX.js";import xt from"./ContentContainer-D6x71VtJ.js";import{C as It}from"./ChatAsideMenu-LvlRzrKT.js";/* empty css */import{R as Ot}from"./index-BoSfQS0R.js";/* empty css *//* empty css */import{k as At,G as ft,_ as Z,H as Nt,K as $t,u as jt,M as zt,L as Bt,N as Mt,O as Et,B as Vt,P as Wt}from"./index-h-JKU4Nj.js";/* empty css */import"./index-C01Wp_Qp.js";import{M as ht}from"./index-yUNGsRBX.js";import"./index-CKrjqYdd.js";/* empty css *//* empty css */import{a as Ft}from"./api-conversation-board-DF2j02i1.js";import{u as Rt}from"./use-all-agents-CrTDpnvC.js";import{g as mt}from"./icon-map-D83d39Ln.js";import{S as Dt}from"./index-iskbd4uP.js";import{D as Ut,a as qt,E as Jt}from"./index-CKaxmMJS.js";import"./Header-DqEFDg8Y.js";import"./index-VSP4qxHb.js";import"./use-platform-information-CCFvVYoR.js";import"./use-logout-LlEvK0q5.js";import"./use-current-user-B_reGFTv.js";import"./login-T2wGHZQQ.js";/* empty css */import"./index-dPpvPy7n.js";import"./index-DZDMbtkj.js";var St={exports:{}};(function(s,h){(function(i,o){s.exports=o()})(ft,function(){var i=1e3,o=6e4,f=36e5,g="millisecond",a="second",l="minute",c="hour",m="day",S="week",M="month",k="quarter",p="year",C="date",x="Invalid Date",X=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,F=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,q={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(u){var n=["th","st","nd","rd"],t=u%100;return"["+u+(n[(t-20)%10]||n[t]||n[0])+"]"}},V=function(u,n,t){var r=String(u);return!r||r.length>=n?u:""+Array(n+1-r.length).join(t)+u},tt={s:V,z:function(u){var n=-u.utcOffset(),t=Math.abs(n),r=Math.floor(t/60),e=t%60;return(n<=0?"+":"-")+V(r,2,"0")+":"+V(e,2,"0")},m:function u(n,t){if(n.date()<t.date())return-u(t,n);var r=12*(t.year()-n.year())+(t.month()-n.month()),e=n.clone().add(r,M),d=t-e<0,_=n.clone().add(r+(d?-1:1),M);return+(-(r+(t-e)/(d?e-_:_-e))||0)},a:function(u){return u<0?Math.ceil(u)||0:Math.floor(u)},p:function(u){return{M,y:p,w:S,d:m,D:C,h:c,m:l,s:a,ms:g,Q:k}[u]||String(u||"").toLowerCase().replace(/s$/,"")},u:function(u){return u===void 0}},J="en",R={};R[J]=q;var ct="$isDayjsObject",ot=function(u){return u instanceof N||!(!u||!u[ct])},L=function u(n,t,r){var e;if(!n)return J;if(typeof n=="string"){var d=n.toLowerCase();R[d]&&(e=d),t&&(R[d]=t,e=d);var _=n.split("-");if(!e&&_.length>1)return u(_[0])}else{var D=n.name;R[D]=n,e=D}return!r&&e&&(J=e),e||!r&&J},y=function(u,n){if(ot(u))return u.clone();var t=typeof n=="object"?n:{};return t.date=u,t.args=arguments,new N(t)},v=tt;v.l=L,v.i=ot,v.w=function(u,n){return y(u,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var N=function(){function u(t){this.$L=L(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[ct]=!0}var n=u.prototype;return n.parse=function(t){this.$d=function(r){var e=r.date,d=r.utc;if(e===null)return new Date(NaN);if(v.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var _=e.match(X);if(_){var D=_[2]-1||0,w=(_[7]||"0").substring(0,3);return d?new Date(Date.UTC(_[1],D,_[3]||1,_[4]||0,_[5]||0,_[6]||0,w)):new Date(_[1],D,_[3]||1,_[4]||0,_[5]||0,_[6]||0,w)}}return new Date(e)}(t),this.init()},n.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},n.$utils=function(){return v},n.isValid=function(){return this.$d.toString()!==x},n.isSame=function(t,r){var e=y(t);return this.startOf(r)<=e&&e<=this.endOf(r)},n.isAfter=function(t,r){return y(t)<this.startOf(r)},n.isBefore=function(t,r){return this.endOf(r)<y(t)},n.$g=function(t,r,e){return v.u(t)?this[r]:this.set(e,t)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(t,r){var e=this,d=!!v.u(r)||r,_=v.p(t),D=function(K,j){var P=v.w(e.$u?Date.UTC(e.$y,j,K):new Date(e.$y,j,K),e);return d?P:P.endOf(m)},w=function(K,j){return v.w(e.toDate()[K].apply(e.toDate("s"),(d?[0,0,0,0]:[23,59,59,999]).slice(j)),e)},T=this.$W,A=this.$M,B=this.$D,et="set"+(this.$u?"UTC":"");switch(_){case p:return d?D(1,0):D(31,11);case M:return d?D(1,A):D(0,A+1);case S:var G=this.$locale().weekStart||0,rt=(T<G?T+7:T)-G;return D(d?B-rt:B+(6-rt),A);case m:case C:return w(et+"Hours",0);case c:return w(et+"Minutes",1);case l:return w(et+"Seconds",2);case a:return w(et+"Milliseconds",3);default:return this.clone()}},n.endOf=function(t){return this.startOf(t,!1)},n.$set=function(t,r){var e,d=v.p(t),_="set"+(this.$u?"UTC":""),D=(e={},e[m]=_+"Date",e[C]=_+"Date",e[M]=_+"Month",e[p]=_+"FullYear",e[c]=_+"Hours",e[l]=_+"Minutes",e[a]=_+"Seconds",e[g]=_+"Milliseconds",e)[d],w=d===m?this.$D+(r-this.$W):r;if(d===M||d===p){var T=this.clone().set(C,1);T.$d[D](w),T.init(),this.$d=T.set(C,Math.min(this.$D,T.daysInMonth())).$d}else D&&this.$d[D](w);return this.init(),this},n.set=function(t,r){return this.clone().$set(t,r)},n.get=function(t){return this[v.p(t)]()},n.add=function(t,r){var e,d=this;t=Number(t);var _=v.p(r),D=function(A){var B=y(d);return v.w(B.date(B.date()+Math.round(A*t)),d)};if(_===M)return this.set(M,this.$M+t);if(_===p)return this.set(p,this.$y+t);if(_===m)return D(1);if(_===S)return D(7);var w=(e={},e[l]=o,e[c]=f,e[a]=i,e)[_]||1,T=this.$d.getTime()+t*w;return v.w(T,this)},n.subtract=function(t,r){return this.add(-1*t,r)},n.format=function(t){var r=this,e=this.$locale();if(!this.isValid())return e.invalidDate||x;var d=t||"YYYY-MM-DDTHH:mm:ssZ",_=v.z(this),D=this.$H,w=this.$m,T=this.$M,A=e.weekdays,B=e.months,et=e.meridiem,G=function(j,P,at,ut){return j&&(j[P]||j(r,d))||at[P].slice(0,ut)},rt=function(j){return v.s(D%12||12,j,"0")},K=et||function(j,P,at){var ut=j<12?"AM":"PM";return at?ut.toLowerCase():ut};return d.replace(F,function(j,P){return P||function(at){switch(at){case"YY":return String(r.$y).slice(-2);case"YYYY":return v.s(r.$y,4,"0");case"M":return T+1;case"MM":return v.s(T+1,2,"0");case"MMM":return G(e.monthsShort,T,B,3);case"MMMM":return G(B,T);case"D":return r.$D;case"DD":return v.s(r.$D,2,"0");case"d":return String(r.$W);case"dd":return G(e.weekdaysMin,r.$W,A,2);case"ddd":return G(e.weekdaysShort,r.$W,A,3);case"dddd":return A[r.$W];case"H":return String(D);case"HH":return v.s(D,2,"0");case"h":return rt(1);case"hh":return rt(2);case"a":return K(D,w,!0);case"A":return K(D,w,!1);case"m":return String(w);case"mm":return v.s(w,2,"0");case"s":return String(r.$s);case"ss":return v.s(r.$s,2,"0");case"SSS":return v.s(r.$ms,3,"0");case"Z":return _}return null}(j)||_.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(t,r,e){var d,_=this,D=v.p(r),w=y(t),T=(w.utcOffset()-this.utcOffset())*o,A=this-w,B=function(){return v.m(_,w)};switch(D){case p:d=B()/12;break;case M:d=B();break;case k:d=B()/3;break;case S:d=(A-T)/6048e5;break;case m:d=(A-T)/864e5;break;case c:d=A/f;break;case l:d=A/o;break;case a:d=A/i;break;default:d=A}return e?d:v.a(d)},n.daysInMonth=function(){return this.endOf(M).$D},n.$locale=function(){return R[this.$L]},n.locale=function(t,r){if(!t)return this.$L;var e=this.clone(),d=L(t,r,!0);return d&&(e.$L=d),e},n.clone=function(){return v.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},u}(),O=N.prototype;return y.prototype=O,[["$ms",g],["$s",a],["$m",l],["$H",c],["$W",m],["$M",M],["$y",p],["$D",C]].forEach(function(u){O[u[1]]=function(n){return this.$g(n,u[0],u[1])}}),y.extend=function(u,n){return u.$i||(u(n,N,y),u.$i=!0),y},y.locale=L,y.isDayjs=ot,y.unix=function(u){return y(1e3*u)},y.en=R[J],y.Ls=R,y.p={},y})})(St);var kt=St.exports;const st=At(kt);var Pt={exports:{}};(function(s,h){(function(i,o){s.exports=o(kt)})(ft,function(i){function o(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var f=o(i),g={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(a,l){return l==="W"?a+"周":a+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(a,l){var c=100*a+l;return c<600?"凌晨":c<900?"早上":c<1100?"上午":c<1300?"中午":c<1800?"下午":"晚上"}};return f.default.locale(g,null,!0),g})})(Pt);const Zt={},Gt={class:"conversation-history-title"};function Kt(s,h){return $(),H("div",Gt,[b("div",null,W(s.$t("conversation.chat_history")),1)])}const Qt=Z(Zt,[["render",Kt],["__scopeId","data-v-eacdf319"]]),Xt={class:"conversation-search-input"},te={class:"search-input-content"},ee={class:"search-input-icon icon-search"},ne={class:"search-input-container"},se=["placeholder"],oe={__name:"HistorySearchInput",emits:["search"],setup(s,{emit:h}){const i=h,o=Y(""),f=E(()=>o.value.length!==0),g=m=>{o.value=m.target.value},a=m=>{o.value=m.target.value},l=m=>{m.keyCode===13&&i("search",o.value)},c=()=>{o.value="",i("search",o.value)};return(m,S)=>{const M=dt("icon-search"),k=dt("icon-close");return $(),H("div",Xt,[b("div",te,[b("div",ee,[I(M)]),b("div",ne,[Ht(b("input",{type:"text",class:"search-input",placeholder:m.$t("conversation.search_history"),"onUpdate:modelValue":S[0]||(S[0]=p=>o.value=p),onInput:g,onChange:a,onKeyup:l},null,40,se),[[Yt,o.value]])]),f.value?($(),H("div",{key:0,class:"search-input-icon icon-clear",onClick:c},[I(k)])):z("",!0),wt(m.$slots,"default",{},void 0,!0)])])}}},re=Z(oe,[["__scopeId","data-v-f3dff79d"]]);var ae={exports:{}};(function(s,h){(function(i,o){s.exports=o()})(ft,function(){return{name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(i){var o=["th","st","nd","rd"],f=i%100;return"["+i+(o[(f-20)%10]||o[f]||o[0])+"]"}}})})(ae);const ie=1e3*60,ce=ie*60,bt=ce*24,ue=bt*30,le=()=>{const s=new Date;return s.setHours(0,0,0,0),s.getTime()},de=(s,h)=>{if(!h)return st(s).format("HH:mm");if(h==="zh")return st(s).locale("zh-cn").format("HH:mm");if(h==="en")return st(s).format("HH:mm")},pt=(s,h)=>h&&h==="zh"?st(s).locale("zh-cn").format("MM-DD"):st(s).format("MM-DD"),_e=s=>{const h=s.agent_id,i="/api/v1/chat/sessions",o={chatId:h};return"per_page"in s&&(o.pageSize=s.per_page/1),"page"in s&&(o.current=s.page/1),"search"in s&&s.search&&(o.keyword=s.search),new Promise((f,g)=>{Nt({url:i,method:"get",params:o}).then(a=>{f({code:200,data:a})}).catch(a=>{g(a)})})},he=s=>($t({conversation_ids:[s]}),new Promise((i,o)=>{setTimeout(()=>{i({code:200,data:!0,msg:""})},1e3)})),me={__name:"BtnHistoryItemDelete",props:{target_id:String},emits:["deleteSuccess"],setup(s,{emit:h}){const i=s,o=h,f=jt();Y(1),Y("");const g=()=>{const l=f.t("conversation.are_you_sure");f.t("conversation.btn_yes"),f.t("conversation.btn_no"),zt.warning({title:l,hideCancel:!1,"modal-class":"history-chat-remove-modal",onOk(c){},async onBeforeOk(){try{return await a()===200}catch{return!1}},onCancel(){}})},a=()=>new Promise((l,c)=>{he(i.target_id).then(m=>{if(m.code/1===200){const S=f.t("conversation.del_success");ht.success(S),o("deleteSuccess"),l(200)}else ht.warning(m.msg)}).catch(m=>{ht.warning(m.msg),c(m)})});return(l,c)=>{const m=dt("icon-delete");return $(),H("span",{onClick:g,class:"btn-delete"},[I(m)])}}},fe=Z(me,[["__scopeId","data-v-f9e9d87d"]]),pe=["src"],ye={class:"history-item-intro"},ve={class:"history-item-actions"},ge={class:"history-item-time"},$e={class:"history-item-delete"},Me={__name:"HistoryItem",props:{history:Object,index:Number,agent_icon:String},emits:["active","delete"],setup(s,{emit:h}){const i=s,o=h,f=Y(!1),g=Bt(),a=E(()=>i.history.client_field_content_type==="label"),l=E(()=>i.history.client_field_content_type==="content"),c=E(()=>l.value&&!f.value),m=E(()=>{const p={"conversation-history-item":!0};return p[`item-${i.index}`]=!0,p[`item-${i.history.session_id}`]=!0,p[i.history.client_field_timestamp_type]=!0,a.value&&(p["conversation-history-section-title"]=!0),l.value&&(p["conversation-history-section-data"]=!0),p}),S=E(()=>{const p=i.history.client_field_timestamp_type,C=i.history.create_time,x=g.value;return p==="today"?de(C,x):p==="month"||p==="earlier"?pt(C,x):""}),M=()=>{o("active",i.history.session_id)},k=()=>{f.value=!0};return(p,C)=>($(),H(nt,null,[a.value?($(),H("div",{key:0,class:_t([m.value,"history-block-title"])},[s.history.client_field_timestamp_type==="today"?($(),H(nt,{key:0},[lt(W(p.$t("conversation.history_today")),1)],64)):z("",!0),s.history.client_field_timestamp_type==="month"?($(),H(nt,{key:1},[lt(W(p.$t("conversation.history_month")),1)],64)):z("",!0),s.history.client_field_timestamp_type==="earlier"?($(),H(nt,{key:2},[lt(W(p.$t("conversation.history_earlier")),1)],64)):z("",!0)],2)):z("",!0),c.value?($(),H("div",{key:1,class:_t(m.value)},[b("div",{class:"history-item-icon",onClick:M},[b("img",{src:s.agent_icon},null,8,pe)]),b("div",ye,[b("div",{class:"history-item-intro-title",onClick:M},W(s.history.name),1)]),b("div",ve,[b("span",ge,W(S.value),1),b("span",$e,[I(fe,{target_id:s.history.id,onDeleteSuccess:k},null,8,["target_id"])])])],2)):z("",!0)],64))}},De=Z(Me,[["__scopeId","data-v-9c2477a8"]]),Se={key:0,class:"history-item-icon can-loadmore"},ke={__name:"HistoryLoadMore",props:{can_loadmore:Boolean},emits:["loadmore"],setup(s,{emit:h}){const i=s,o=h,f=E(()=>{const a={"conversation-history-item":!0};return a["load-more"]=!0,a}),g=()=>{i.can_loadmore&&o("loadmore")};return(a,l)=>($(),H("div",{class:_t(f.value),onClick:g},[s.can_loadmore?($(),H("div",Se,W(a.$t("conversation.history_loadmore")),1)):z("",!0)],2))}},be=Z(ke,[["__scopeId","data-v-01b3fb14"]]),we={class:"conversation-history-list-section"},He={__name:"HistoryList",props:{list:Array,can_loadmore:Boolean,agent_icon:String},emits:["active","delete","loadmore"],setup(s,{emit:h}){const i=h,o=E(()=>"conversation-history-list"),f=l=>{i("active",l)},g=l=>{i("delete",l)},a=()=>{i("loadmore")};return(l,c)=>($(),H("div",we,[b("div",{class:_t(o.value)},[($(!0),H(nt,null,vt(s.list,(m,S)=>($(),Q(De,{key:m.id,history:m,index:S,agent_icon:s.agent_icon,onActive:f,onDelete:g},null,8,["history","index","agent_icon"]))),128)),I(be,{can_loadmore:s.can_loadmore,onLoadmore:a},null,8,["can_loadmore"])],2)]))}},Ye=Z(He,[["__scopeId","data-v-4bed9682"]]);function Ce(s){const h=Y(1),i=Y(""),o=Y([]);Rt();const f=()=>({});return{getAgentList:()=>{const a=f();h.value=2,i.value="",Ft(a).then(l=>{if(l.code/1===200){const c=l.data;c.length!==0&&(c.unshift({id:"",name:"全部",icon:"intelligentFrame1"}),typeof s=="function"&&s(c)),o.value=c,h.value=3,i.value="success"}else h.value=4,i.value=err.message}).catch(l=>{console.log(l),h.value=5,i.value=l.msg})},api_status:h,api_message:i,list_agents:o}}function Le(s){const h=$t(s);Mt.setItem(h)}function yt(){const s=Mt.getItem(),h=Et(s);return h===null?null:h}const Te=Ct("recent_history_search_type",{state:()=>({search_type:yt()}),actions:{getType(){return this.search_type.length===0?(this.search_type=yt(),this.search_type):this.search_type},setType(s){this.search_type=s,Le(s)}}}),xe=["src"],Ie={class:"label-text"},Oe={class:"nav-item-icon arrow-down"},Ae={class:"dropdown-container"},Ne=["src"],je={class:"dropdown-item-text"},ze={__name:"HistoryTypeDropdown",props:{list_status:Number},emits:["typeSelected"],setup(s,{emit:h}){const i=s,o=Te(),{api_status:f,list_agents:g,getAgentList:a}=Ce(k=>{var p;if(o.search_type){const C=((p=o.search_type)==null?void 0:p.id)||"";let x=null;const X=k.length;for(let F=0;F<X;F++){const q=k[F];if(q.id===C){x=q;break}}M(x||k[0])}else M(k[0])}),l=h,c=E(()=>{var k;return((k=o==null?void 0:o.search_type)==null?void 0:k.name)||""}),m=E(()=>o.search_type&&o.search_type.icon?mt(o.search_type.icon):""),S=E(()=>i.list_status===2),M=k=>{o.setType(k),l("typeSelected",k)};return gt(()=>{a()}),(k,p)=>{const C=dt("icon-down"),x=Vt,X=Dt,F=Ut,q=qt;return $(),Q(q,{trigger:"hover",defaultValue:c.value},{content:U(()=>[($(!0),H(nt,null,vt(it(g),(V,tt)=>($(),Q(F,{key:V.id,disabled:S.value,value:V.name,onClick:J=>M(V)},{default:U(()=>[b("div",Ae,[b("img",{src:it(mt)(V.icon),class:"agent-icon-img"},null,8,Ne),b("span",je,W(V.name),1)])]),_:2},1032,["disabled","value","onClick"]))),128))]),default:U(()=>[it(f)===1||it(f)===3?($(),Q(x,{key:0,class:"history-type-btn",type:"text"},{default:U(()=>[b("img",{src:m.value,class:"agent-icon-img"},null,8,xe),b("span",Ie,W(c.value),1),b("span",Oe,[I(C,{class:"arrow-down"})])]),_:1})):z("",!0),it(f)===2?($(),Q(x,{key:1,class:"history-type-btn",type:"text"},{default:U(()=>[I(X,{size:16})]),_:1})):z("",!0)]),_:1},8,["defaultValue"])}}},Be=Z(ze,[["__scopeId","data-v-167b3b63"]]),Ee={class:"conversation-history-container"},Ve={class:"conversation-history-main"},We={key:1,class:"infomations-container"},Fe={key:2,class:"infomations-container"},Re={key:3,class:"infomations-container"},Ue={key:4,class:"infomations-container"},qe={__name:"ConversationHistoryContainer",emits:["historyActive"],setup(s,{emit:h}){const i=h,o=Y(1),f=Y(50),g=Y(""),a=Y(""),l=Y(!0),c=Y(1),m=Y(""),S=Y([]),M=Y(0),k=Y(0),p=Y(0),C=Y(""),x=le(),F=x-bt-ue;function q(L){L.forEach((y,v)=>{let N=null;const O=y,n=new Date(O.create_date).getTime();let t=null;if(isNaN(n)){const e=new Date(O.updated_time).getTime();isNaN(e)?t=Date.now():t=e}else t=n;O.create_time=t,t>=x?(M.value===0&&(N={client_field_content_type:"label",client_field_timestamp_type:"today",id:"today"}),O.client_field_timestamp_type="today",O.client_field_content_type="content",M.value=M.value+1):t<x&&t>F?(k.value===0&&(N={client_field_content_type:"label",client_field_timestamp_type:"month",id:"month"}),O.client_field_timestamp_type="month",O.client_field_content_type="content",k.value=k.value+1):(p.value===0&&(N={client_field_content_type:"label",client_field_timestamp_type:"earlier",id:"earlier"}),O.client_field_timestamp_type="earlier",O.client_field_content_type="content",p.value=p.value+1),N&&S.value.push(N),S.value.push(O)})}const V=()=>({search:g.value,page:o.value,per_page:f.value,agent_id:a.value}),tt=()=>{const L=V();c.value=2,m.value="",_e(L).then(y=>{if(y.code/1===200){const N=y.data.rows;N.length<f.value?l.value=!1:l.value=!0,q(N),c.value=3,m.value="success"}else c.value=4,m.value=y.msg}).catch(y=>{c.value=5,m.value=y.message})},J=()=>{c.value!==2&&l.value&&(o.value=o.value+1,tt())},R=L=>{i("historyActive",{agent_id:a.value,target_id:L})},ct=L=>{c.value!==2&&(g.value=L,o.value=1,S.value=[],tt())},ot=L=>{c.value!==2&&L&&(M.value=0,k.value=0,p.value=0,C.value=mt(L.icon),a.value=L.id,o.value=1,S.value=[],tt())};return gt(()=>{}),(L,y)=>{const v=Dt,N=Jt,O=Ot;return $(),H("div",Ee,[y[1]||(y[1]=b("div",{class:"conversation-history-left"},null,-1)),b("div",Ve,[I(Qt),I(re,{onSearch:ct},{default:U(()=>[I(Be,{onTypeSelected:ot,list_status:c.value},null,8,["list_status"])]),_:1}),S.value.length!==0?($(),Q(Ye,{key:0,list:S.value,can_loadmore:l.value,agent_icon:C.value,onLoadmore:J,onActive:R},null,8,["list","can_loadmore","agent_icon"])):z("",!0),c.value===1||c.value===2?($(),H("div",We,[I(v,{size:32})])):z("",!0),c.value===3&&S.value.length===0?($(),H("div",Fe,[I(N,null,{default:U(()=>[lt(W(L.$t("conversation.history_empty")),1)]),_:1})])):z("",!0),c.value===4?($(),H("div",Re,[I(O,{status:"warning",title:m.value},null,8,["title"])])):z("",!0),c.value===5?($(),H("div",Ue,[I(O,{status:"error",title:m.value},null,8,["title"])])):z("",!0),y[0]||(y[0]=b("div",{class:"conversation-history-placeholder"},null,-1))]),y[2]||(y[2]=b("div",{class:"conversation-history-right"},null,-1))])}}},Je=Z(qe,[["__scopeId","data-v-f10b2a3a"]]),Pe="/assets/history-bg-Cuh6wzmt.png",bn={__name:"ConversationHistory",setup(s){const h=Lt(),i=Wt(),o=E(()=>i.value==="light"?{backgroundImage:`url(${Pe})`,backgroundRepeat:"no-repeat",backgroundSize:"cover"}:{}),f=({target_id:g,agent_id:a})=>{const l={session:g,history:"history"};a&&(l.agent=a),h.push({path:"/chat/qa",query:l})};return(g,a)=>($(),Q(Tt,null,{default:U(()=>[I(xt,{containerStyle:o.value,id:"fjkdsdajfklgjsklfjskdlf"},{default:U(()=>[I(It),I(Je,{onHistoryActive:f})]),_:1},8,["containerStyle"])]),_:1}))}};export{bn as default};
|