| 1 |
- import{c as H,o as $,a as w,J as W,j as C,e as E,p as dt,q as z,m as bt,D as I,B as Ht,a2 as Ct,b as _t,F as nt,I as lt,_ as vt,s as Q,M as Tt,x as gt,A as U,P as it,Z as Yt}from"./vue-vendor-BOX7Kenj.js";import Lt from"./LayoutExperience-D6yoiMh6.js";import xt from"./ContentContainer-DTYObT5L.js";import{C as It}from"./ChatAsideMenu-C-shzSsG.js";/* empty css */import{R as Ot}from"./index-bj4xFXb1.js";/* empty css */import{S as $t}from"./index-DhKoY12H.js";import{k as At,G as ft,_ as Z,H as Nt,K as Mt,u as jt,M as zt,L as Bt,N as Dt,O as Et,B as Vt,P as Wt}from"./index-_atq84Ji.js";import{M as ht}from"./index-ugL_7kbA.js";import"./index-BgDRZce_.js";import"./index-B3rE5vt3.js";/* empty css *//* empty css */import{a as Rt}from"./api-conversation-board-DAbGckM4.js";import{u as Ft}from"./use-all-agents-CZkOEwaY.js";import{g as mt}from"./icon-map-MpRwWyE4.js";import{D as Ut,a as qt,E as Jt}from"./index-BlAITTqL.js";import"./Header-yzyZK0DX.js";import"./index-BHTmVRE6.js";import"./use-platform-information-GvgnOcMD.js";import"./use-logout-Ba_afPHl.js";import"./use-current-user-CN6jUr4a.js";import"./login-QSRFfQ9t.js";/* empty css */import"./index-B4JT3Sd4.js";import"./index-C38sh2pa.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",T="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+)?$/,R=/\[([^\]]+)]|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:T,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",F={};F[J]=q;var ct="$isDayjsObject",ot=function(u){return u instanceof N||!(!u||!u[ct])},Y=function u(n,t,r){var e;if(!n)return J;if(typeof n=="string"){var d=n.toLowerCase();F[d]&&(e=d),t&&(F[d]=t,e=d);var _=n.split("-");if(!e&&_.length>1)return u(_[0])}else{var D=n.name;F[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=Y,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=Y(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,b=(_[7]||"0").substring(0,3);return d?new Date(Date.UTC(_[1],D,_[3]||1,_[4]||0,_[5]||0,_[6]||0,b)):new Date(_[1],D,_[3]||1,_[4]||0,_[5]||0,_[6]||0,b)}}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)},b=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)},L=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=(L<G?L+7:L)-G;return D(d?B-rt:B+(6-rt),A);case m:case T:return b(et+"Hours",0);case c:return b(et+"Minutes",1);case l:return b(et+"Seconds",2);case a:return b(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[T]=_+"Date",e[M]=_+"Month",e[p]=_+"FullYear",e[c]=_+"Hours",e[l]=_+"Minutes",e[a]=_+"Seconds",e[g]=_+"Milliseconds",e)[d],b=d===m?this.$D+(r-this.$W):r;if(d===M||d===p){var L=this.clone().set(T,1);L.$d[D](b),L.init(),this.$d=L.set(T,Math.min(this.$D,L.daysInMonth())).$d}else D&&this.$d[D](b);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 b=(e={},e[l]=o,e[c]=f,e[a]=i,e)[_]||1,L=this.$d.getTime()+t*b;return v.w(L,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,b=this.$m,L=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(R,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 L+1;case"MM":return v.s(L+1,2,"0");case"MMM":return G(e.monthsShort,L,B,3);case"MMMM":return G(B,L);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,b,!0);case"A":return K(D,b,!1);case"m":return String(b);case"mm":return v.s(b,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),b=y(t),L=(b.utcOffset()-this.utcOffset())*o,A=this-b,B=function(){return v.m(_,b)};switch(D){case p:d=B()/12;break;case M:d=B();break;case k:d=B()/3;break;case S:d=(A-L)/6048e5;break;case m:d=(A-L)/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 F[this.$L]},n.locale=function(t,r){if(!t)return this.$L;var e=this.clone(),d=Y(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",T]].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=Y,y.isDayjs=ot,y.unix=function(u){return y(1e3*u)},y.en=F[J],y.Ls=F,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,[w("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=C(""),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,[w("div",te,[w("div",ee,[I(M)]),w("div",ne,[Ht(w("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),[[Ct,o.value]])]),f.value?($(),H("div",{key:0,class:"search-input-icon icon-clear",onClick:c},[I(k)])):z("",!0),bt(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,wt=ce*24,ue=wt*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=>(Mt({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();C(1),C("");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=C(!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,T=i.history.create_time,x=g.value;return p==="today"?de(T,x):p==="month"||p==="earlier"?pt(T,x):""}),M=()=>{o("active",i.history.session_id)},k=()=>{f.value=!0};return(p,T)=>($(),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)},[w("div",{class:"history-item-icon",onClick:M},[w("img",{src:s.agent_icon},null,8,pe)]),w("div",ye,[w("div",{class:"history-item-intro-title",onClick:M},W(s.history.name),1)]),w("div",ve,[w("span",ge,W(S.value),1),w("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))}},we=Z(ke,[["__scopeId","data-v-01b3fb14"]]),be={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",be,[w("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(we,{can_loadmore:s.can_loadmore,onLoadmore:a},null,8,["can_loadmore"])],2)]))}},Ce=Z(He,[["__scopeId","data-v-4bed9682"]]);function Te(s){const h=C(1),i=C(""),o=C([]);Ft();const f=()=>({});return{getAgentList:()=>{const a=f();h.value=2,i.value="",Rt(a).then(l=>{if(l.code/1===200){const c=l.data;c.length!==0&&typeof s=="function"&&s(c),c.unshift({id:"",name:"全部"}),o.value=c,console.log(o.value),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 Ye(s){const h=Mt(s);Dt.setItem(h)}function yt(){const s=Dt.getItem(),h=Et(s);return h===null?null:h}const Le=Tt("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,Ye(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=Le(),{api_status:f,list_agents:g,getAgentList:a}=Te(k=>{var p;if(o.search_type){const T=((p=o.search_type)==null?void 0:p.id)||"";let x=null;const X=k.length;for(let R=0;R<X;R++){const q=k[R];if(q.id===T){x=q;break}}M(x||k[0])}else M(k[0])}),l=h,c=E(()=>{var k;return console.log("recentSearchType.search_type",o.search_type),((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 T=dt("icon-down"),x=Vt,X=$t,R=Ut,q=qt;return $(),Q(q,{trigger:"hover",defaultValue:c.value},{content:U(()=>[($(!0),H(nt,null,vt(it(g),(V,tt)=>($(),Q(R,{key:V.id,disabled:S.value,value:V.name,onClick:J=>M(V)},{default:U(()=>[w("div",Ae,[w("img",{src:it(mt)(V.icon),class:"agent-icon-img"},null,8,Ne),w("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(()=>[w("img",{src:m.value,class:"agent-icon-img"},null,8,xe),w("span",Ie,W(c.value),1),w("span",Oe,[I(T,{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-cb594c2a"]]),Ee={class:"conversation-history-container"},Ve={class:"conversation-history-main"},We={key:1,class:"infomations-container"},Re={key:2,class:"infomations-container"},Fe={key:3,class:"infomations-container"},Ue={key:4,class:"infomations-container"},qe={__name:"ConversationHistoryContainer",emits:["historyActive"],setup(s,{emit:h}){const i=h,o=C(1),f=C(50),g=C(""),a=C(""),l=C(!0),c=C(1),m=C(""),S=C([]),M=C(0),k=C(0),p=C(0),T=C(""),x=le(),R=x-wt-ue;function q(Y){Y.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>R?(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 Y=V();c.value=2,m.value="",_e(Y).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())},F=Y=>{i("historyActive",{agent_id:a.value,target_id:Y})},ct=Y=>{c.value!==2&&(g.value=Y,o.value=1,S.value=[],tt())},ot=Y=>{c.value!==2&&Y&&(M.value=0,k.value=0,p.value=0,T.value=mt(Y.icon),a.value=Y.id,o.value=1,S.value=[],tt())};return gt(()=>{}),(Y,y)=>{const v=$t,N=Jt,O=Ot;return $(),H("div",Ee,[y[1]||(y[1]=w("div",{class:"conversation-history-left"},null,-1)),w("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(Ce,{key:0,list:S.value,can_loadmore:l.value,agent_icon:T.value,onLoadmore:J,onActive:F},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",Re,[I(N,null,{default:U(()=>[lt(W(Y.$t("conversation.history_empty")),1)]),_:1})])):z("",!0),c.value===4?($(),H("div",Fe,[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]=w("div",{class:"conversation-history-placeholder"},null,-1))]),y[2]||(y[2]=w("div",{class:"conversation-history-right"},null,-1))])}}},Je=Z(qe,[["__scopeId","data-v-f10b2a3a"]]),Pe="/assets/history-bg-Cuh6wzmt.png",Sn={__name:"ConversationHistory",setup(s){const h=Yt(),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};a&&(l.agent=a),h.push({path:"/chat/qa",query:l})};return(g,a)=>($(),Q(Lt,null,{default:U(()=>[I(xt,{containerStyle:o.value,id:"fjkdsdajfklgjsklfjskdlf"},{default:U(()=>[I(It),I(Je,{onHistoryActive:f})]),_:1},8,["containerStyle"])]),_:1}))}};export{Sn as default};
|