| 1 |
- import{c as H,o as M,a as w,J as W,j as Y,e as E,p as dt,q as z,m as bt,D as I,B as Ht,a1 as Yt,b as _t,F as nt,I as lt,Z as yt,s as Q,M as Ct,x as gt,A as U,X as it,Y as Lt}from"./vue-vendor-BSLWZmNt.js";import Tt from"./LayoutExperience-BU8WDEZO.js";import xt from"./ContentContainer-CPOaIsIi.js";import{C as It}from"./ChatAsideMenu-vnTecBHS.js";/* empty css */import{R as Ot}from"./index-nNwEcB8j.js";/* empty css */import{S as $t}from"./index-B_ys0vW3.js";import{k as At,G as ft,_ as Z,H as jt,K as Mt,u as Nt,M as zt,L as Bt,N as Dt,O as Et,B as Vt,P as Wt}from"./index-B7WpovAa.js";import{M as ht}from"./index-ojQ-xsQ4.js";import"./index-CmsgRgCZ.js";import"./index-BLUbl52F.js";/* empty css *//* empty css */import{a as Rt}from"./api-conversation-board-BgtmZTsR.js";import{u as Ft}from"./use-all-agents-GozIXVQa.js";import{g as mt}from"./icon-map-MpRwWyE4.js";import{D as Ut,a as qt,E as Jt}from"./index-CUV5GPF_.js";import"./Header-eTMSn7Nh.js";import"./index-BySI26Co.js";import"./use-platform-information-Tmg_jBsj.js";import"./use-logout-2Fcl-Z1Q.js";import"./use-current-user-CNN4qS6Y.js";import"./login-Dt_a5vuo.js";/* empty css */import"./index-CmJw2um-.js";import"./index-BTRB_zm6.js";var St={exports:{}};(function(s,d){(function(a,o){s.exports=o()})(ft,function(){var a=1e3,o=6e4,f=36e5,$="millisecond",c="second",m="minute",l="hour",i="day",g="week",D="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+)?$/,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,D),_=t-e<0,h=n.clone().add(r+(_?-1:1),D);return+(-(r+(t-e)/(_?e-h:h-e))||0)},a:function(u){return u<0?Math.ceil(u)||0:Math.floor(u)},p:function(u){return{M:D,y:p,w:g,d:i,D:C,h:l,m,s:c,ms:$,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 j||!(!u||!u[ct])},L=function u(n,t,r){var e;if(!n)return J;if(typeof n=="string"){var _=n.toLowerCase();F[_]&&(e=_),t&&(F[_]=t,e=_);var h=n.split("-");if(!e&&h.length>1)return u(h[0])}else{var S=n.name;F[S]=n,e=S}return!r&&e&&(J=e),e||!r&&J},v=function(u,n){if(ot(u))return u.clone();var t=typeof n=="object"?n:{};return t.date=u,t.args=arguments,new j(t)},y=tt;y.l=L,y.i=ot,y.w=function(u,n){return v(u,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var j=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,_=r.utc;if(e===null)return new Date(NaN);if(y.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var h=e.match(X);if(h){var S=h[2]-1||0,b=(h[7]||"0").substring(0,3);return _?new Date(Date.UTC(h[1],S,h[3]||1,h[4]||0,h[5]||0,h[6]||0,b)):new Date(h[1],S,h[3]||1,h[4]||0,h[5]||0,h[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 y},n.isValid=function(){return this.$d.toString()!==x},n.isSame=function(t,r){var e=v(t);return this.startOf(r)<=e&&e<=this.endOf(r)},n.isAfter=function(t,r){return v(t)<this.startOf(r)},n.isBefore=function(t,r){return this.endOf(r)<v(t)},n.$g=function(t,r,e){return y.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,_=!!y.u(r)||r,h=y.p(t),S=function(K,N){var P=y.w(e.$u?Date.UTC(e.$y,N,K):new Date(e.$y,N,K),e);return _?P:P.endOf(i)},b=function(K,N){return y.w(e.toDate()[K].apply(e.toDate("s"),(_?[0,0,0,0]:[23,59,59,999]).slice(N)),e)},T=this.$W,A=this.$M,B=this.$D,et="set"+(this.$u?"UTC":"");switch(h){case p:return _?S(1,0):S(31,11);case D:return _?S(1,A):S(0,A+1);case g:var G=this.$locale().weekStart||0,rt=(T<G?T+7:T)-G;return S(_?B-rt:B+(6-rt),A);case i:case C:return b(et+"Hours",0);case l:return b(et+"Minutes",1);case m:return b(et+"Seconds",2);case c: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,_=y.p(t),h="set"+(this.$u?"UTC":""),S=(e={},e[i]=h+"Date",e[C]=h+"Date",e[D]=h+"Month",e[p]=h+"FullYear",e[l]=h+"Hours",e[m]=h+"Minutes",e[c]=h+"Seconds",e[$]=h+"Milliseconds",e)[_],b=_===i?this.$D+(r-this.$W):r;if(_===D||_===p){var T=this.clone().set(C,1);T.$d[S](b),T.init(),this.$d=T.set(C,Math.min(this.$D,T.daysInMonth())).$d}else S&&this.$d[S](b);return this.init(),this},n.set=function(t,r){return this.clone().$set(t,r)},n.get=function(t){return this[y.p(t)]()},n.add=function(t,r){var e,_=this;t=Number(t);var h=y.p(r),S=function(A){var B=v(_);return y.w(B.date(B.date()+Math.round(A*t)),_)};if(h===D)return this.set(D,this.$M+t);if(h===p)return this.set(p,this.$y+t);if(h===i)return S(1);if(h===g)return S(7);var b=(e={},e[m]=o,e[l]=f,e[c]=a,e)[h]||1,T=this.$d.getTime()+t*b;return y.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 _=t||"YYYY-MM-DDTHH:mm:ssZ",h=y.z(this),S=this.$H,b=this.$m,T=this.$M,A=e.weekdays,B=e.months,et=e.meridiem,G=function(N,P,at,ut){return N&&(N[P]||N(r,_))||at[P].slice(0,ut)},rt=function(N){return y.s(S%12||12,N,"0")},K=et||function(N,P,at){var ut=N<12?"AM":"PM";return at?ut.toLowerCase():ut};return _.replace(R,function(N,P){return P||function(at){switch(at){case"YY":return String(r.$y).slice(-2);case"YYYY":return y.s(r.$y,4,"0");case"M":return T+1;case"MM":return y.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 y.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(S);case"HH":return y.s(S,2,"0");case"h":return rt(1);case"hh":return rt(2);case"a":return K(S,b,!0);case"A":return K(S,b,!1);case"m":return String(b);case"mm":return y.s(b,2,"0");case"s":return String(r.$s);case"ss":return y.s(r.$s,2,"0");case"SSS":return y.s(r.$ms,3,"0");case"Z":return h}return null}(N)||h.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(t,r,e){var _,h=this,S=y.p(r),b=v(t),T=(b.utcOffset()-this.utcOffset())*o,A=this-b,B=function(){return y.m(h,b)};switch(S){case p:_=B()/12;break;case D:_=B();break;case k:_=B()/3;break;case g:_=(A-T)/6048e5;break;case i:_=(A-T)/864e5;break;case l:_=A/f;break;case m:_=A/o;break;case c:_=A/a;break;default:_=A}return e?_:y.a(_)},n.daysInMonth=function(){return this.endOf(D).$D},n.$locale=function(){return F[this.$L]},n.locale=function(t,r){if(!t)return this.$L;var e=this.clone(),_=L(t,r,!0);return _&&(e.$L=_),e},n.clone=function(){return y.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=j.prototype;return v.prototype=O,[["$ms",$],["$s",c],["$m",m],["$H",l],["$W",i],["$M",D],["$y",p],["$D",C]].forEach(function(u){O[u[1]]=function(n){return this.$g(n,u[0],u[1])}}),v.extend=function(u,n){return u.$i||(u(n,j,v),u.$i=!0),v},v.locale=L,v.isDayjs=ot,v.unix=function(u){return v(1e3*u)},v.en=F[J],v.Ls=F,v.p={},v})})(St);var kt=St.exports;const st=At(kt);var Pt={exports:{}};(function(s,d){(function(a,o){s.exports=o(kt)})(ft,function(a){function o(c){return c&&typeof c=="object"&&"default"in c?c:{default:c}}var f=o(a),$={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(c,m){return m==="W"?c+"周":c+"日"},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(c,m){var l=100*c+m;return l<600?"凌晨":l<900?"早上":l<1100?"上午":l<1300?"中午":l<1800?"下午":"晚上"}};return f.default.locale($,null,!0),$})})(Pt);const Zt={},Gt={class:"conversation-history-title"};function Kt(s,d){return M(),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:d}){const a=d,o=Y(""),f=E(()=>o.value.length!==0),$=i=>{o.value=i.target.value},c=i=>{o.value=i.target.value},m=i=>{i.keyCode===13&&a("search",o.value)},l=()=>{o.value="",a("search",o.value)};return(i,g)=>{const D=dt("icon-search"),k=dt("icon-close");return M(),H("div",Xt,[w("div",te,[w("div",ee,[I(D)]),w("div",ne,[Ht(w("input",{type:"text",class:"search-input",placeholder:i.$t("conversation.search_history"),"onUpdate:modelValue":g[0]||(g[0]=p=>o.value=p),onInput:$,onChange:c,onKeyup:m},null,40,se),[[Yt,o.value]])]),f.value?(M(),H("div",{key:0,class:"search-input-icon icon-clear",onClick:l},[I(k)])):z("",!0),bt(i.$slots,"default",{},void 0,!0)])])}}},re=Z(oe,[["__scopeId","data-v-f3dff79d"]]);var ae={exports:{}};(function(s,d){(function(a,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(a){var o=["th","st","nd","rd"],f=a%100;return"["+a+(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,d)=>{if(!d)return st(s).format("HH:mm");if(d==="zh")return st(s).locale("zh-cn").format("HH:mm");if(d==="en")return st(s).format("HH:mm")},pt=(s,d)=>d&&d==="zh"?st(s).locale("zh-cn").format("MM-DD"):st(s).format("MM-DD"),_e=s=>{const d=s.agent_id;if(!d)return Promise.reject(new Error("前端异常:Invalid Agent ID"));const a="/api/v1/chat/sessions",o={chatId:d};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,$)=>{jt({url:a,method:"get",params:o}).then(c=>{f({code:200,data:c})}).catch(c=>{$(c)})})},he=s=>(Mt({conversation_ids:[s]}),new Promise((a,o)=>{setTimeout(()=>{a({code:200,data:!0,msg:""})},1e3)})),me={__name:"BtnHistoryItemDelete",props:{target_id:String},emits:["deleteSuccess"],setup(s,{emit:d}){const a=s,o=d,f=Nt();Y(1),Y("");const $=()=>{const m=f.t("conversation.are_you_sure");f.t("conversation.btn_yes"),f.t("conversation.btn_no"),zt.warning({title:m,hideCancel:!1,"modal-class":"history-chat-remove-modal",onOk(l){},async onBeforeOk(){try{return await c()===200}catch{return!1}},onCancel(){}})},c=()=>new Promise((m,l)=>{he(a.target_id).then(i=>{if(i.code/1===200){const g=f.t("conversation.del_success");ht.success(g),o("deleteSuccess"),m(200)}else ht.warning(i.msg)}).catch(i=>{ht.warning(i.msg),l(i)})});return(m,l)=>{const i=dt("icon-delete");return M(),H("span",{onClick:$,class:"btn-delete"},[I(i)])}}},fe=Z(me,[["__scopeId","data-v-f9e9d87d"]]),pe=["src"],ve={class:"history-item-intro"},ye={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:d}){const a=s,o=d,f=Y(!1),$=Bt(),c=E(()=>a.history.client_field_content_type==="label"),m=E(()=>a.history.client_field_content_type==="content"),l=E(()=>m.value&&!f.value),i=E(()=>{const p={"conversation-history-item":!0};return p[`item-${a.index}`]=!0,p[`item-${a.history.session_id}`]=!0,p[a.history.client_field_timestamp_type]=!0,c.value&&(p["conversation-history-section-title"]=!0),m.value&&(p["conversation-history-section-data"]=!0),p}),g=E(()=>{const p=a.history.client_field_timestamp_type,C=a.history.create_time,x=$.value;return p==="today"?de(C,x):p==="month"||p==="earlier"?pt(C,x):""}),D=()=>{o("active",a.history.session_id)},k=()=>{f.value=!0};return(p,C)=>(M(),H(nt,null,[c.value?(M(),H("div",{key:0,class:_t([i.value,"history-block-title"])},[s.history.client_field_timestamp_type==="today"?(M(),H(nt,{key:0},[lt(W(p.$t("conversation.history_today")),1)],64)):z("",!0),s.history.client_field_timestamp_type==="month"?(M(),H(nt,{key:1},[lt(W(p.$t("conversation.history_month")),1)],64)):z("",!0),s.history.client_field_timestamp_type==="earlier"?(M(),H(nt,{key:2},[lt(W(p.$t("conversation.history_earlier")),1)],64)):z("",!0)],2)):z("",!0),l.value?(M(),H("div",{key:1,class:_t(i.value)},[w("div",{class:"history-item-icon",onClick:D},[w("img",{src:s.agent_icon},null,8,pe)]),w("div",ve,[w("div",{class:"history-item-intro-title",onClick:D},W(s.history.name),1)]),w("div",ye,[w("span",ge,W(g.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:d}){const a=s,o=d,f=E(()=>{const c={"conversation-history-item":!0};return c["load-more"]=!0,c}),$=()=>{a.can_loadmore&&o("loadmore")};return(c,m)=>(M(),H("div",{class:_t(f.value),onClick:$},[s.can_loadmore?(M(),H("div",Se,W(c.$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:d}){const a=d,o=E(()=>"conversation-history-list"),f=m=>{a("active",m)},$=m=>{a("delete",m)},c=()=>{a("loadmore")};return(m,l)=>(M(),H("div",be,[w("div",{class:_t(o.value)},[(M(!0),H(nt,null,yt(s.list,(i,g)=>(M(),Q(De,{key:i.id,history:i,index:g,agent_icon:s.agent_icon,onActive:f,onDelete:$},null,8,["history","index","agent_icon"]))),128)),I(we,{can_loadmore:s.can_loadmore,onLoadmore:c},null,8,["can_loadmore"])],2)]))}},Ye=Z(He,[["__scopeId","data-v-4bed9682"]]);function Ce(s){const d=Y(1),a=Y(""),o=Y([]),f=Ft(),$=()=>({});return{getAgentList:()=>{const m=f.agents;if(m.length!==0){typeof s=="function"&&s(m),o.value=m;return}const l=$();d.value=2,a.value="",Rt(l).then(i=>{if(i.code/1===200){const g=i.data;g.length!==0&&typeof s=="function"&&s(g),o.value=g,f.setList(g),d.value=3,a.value="success"}else d.value=4,a.value=err.message}).catch(i=>{console.log(i),d.value=5,a.value=i.msg})},api_status:d,api_message:a,list_agents:o}}function Le(s){const d=Mt(s);Dt.setItem(d)}function vt(){const s=Dt.getItem(),d=Et(s);return d===null?null:d}const Te=Ct("recent_history_search_type",{state:()=>({search_type:vt()}),actions:{getType(){return this.search_type.length===0?(this.search_type=vt(),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"},je=["src"],Ne={class:"dropdown-item-text"},ze={__name:"HistoryTypeDropdown",props:{list_status:Number},emits:["typeSelected"],setup(s,{emit:d}){const a=s,o=Te(),{api_status:f,list_agents:$,getAgentList:c}=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 R=0;R<X;R++){const q=k[R];if(q.id===C){x=q;break}}D(x||k[0])}else D(k[0])}),m=d,l=E(()=>{var k;return((k=o==null?void 0:o.search_type)==null?void 0:k.name)||""}),i=E(()=>o.search_type&&o.search_type.icon?mt(o.search_type.icon):""),g=E(()=>a.list_status===2),D=k=>{o.setType(k),m("typeSelected",k)};return gt(()=>{c()}),(k,p)=>{const C=dt("icon-down"),x=Vt,X=$t,R=Ut,q=qt;return M(),Q(q,{trigger:"hover",defaultValue:l.value},{content:U(()=>[(M(!0),H(nt,null,yt(it($),(V,tt)=>(M(),Q(R,{key:V.id,disabled:g.value,value:V.name,onClick:J=>D(V)},{default:U(()=>[w("div",Ae,[w("img",{src:it(mt)(V.icon),class:"agent-icon-img"},null,8,je),w("span",Ne,W(V.name),1)])]),_:2},1032,["disabled","value","onClick"]))),128))]),default:U(()=>[it(f)===1||it(f)===3?(M(),Q(x,{key:0,class:"history-type-btn",type:"text"},{default:U(()=>[w("img",{src:i.value,class:"agent-icon-img"},null,8,xe),w("span",Ie,W(l.value),1),w("span",Oe,[I(C,{class:"arrow-down"})])]),_:1})):z("",!0),it(f)===2?(M(),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-e5429750"]]),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:d}){const a=d,o=Y(1),f=Y(50),$=Y(""),c=Y(""),m=Y(!0),l=Y(1),i=Y(""),g=Y([]),D=Y(0),k=Y(0),p=Y(0),C=Y(""),x=le(),R=x-wt-ue;function q(L){L.forEach((v,y)=>{let j=null;const O=v,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?(D.value===0&&(j={client_field_content_type:"label",client_field_timestamp_type:"today",id:"today"}),O.client_field_timestamp_type="today",O.client_field_content_type="content",D.value=D.value+1):t<x&&t>R?(k.value===0&&(j={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&&(j={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),j&&g.value.push(j),g.value.push(O)})}const V=()=>({search:$.value,page:o.value,per_page:f.value,agent_id:c.value}),tt=()=>{const L=V();l.value=2,i.value="",_e(L).then(v=>{if(v.code/1===200){const j=v.data.rows;j.length<f.value?m.value=!1:m.value=!0,q(j),l.value=3,i.value="success"}else l.value=4,i.value=v.msg}).catch(v=>{l.value=5,i.value=v.message})},J=()=>{l.value!==2&&m.value&&(o.value=o.value+1,tt())},F=L=>{a("historyActive",{agent_id:c.value,target_id:L})},ct=L=>{l.value!==2&&($.value=L,o.value=1,g.value=[],tt())},ot=L=>{l.value!==2&&L&&(D.value=0,k.value=0,p.value=0,C.value=mt(L.icon),c.value=L.id,o.value=1,g.value=[],tt())};return gt(()=>{}),(L,v)=>{const y=$t,j=Jt,O=Ot;return M(),H("div",Ee,[v[1]||(v[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:l.value},null,8,["list_status"])]),_:1}),g.value.length!==0?(M(),Q(Ye,{key:0,list:g.value,can_loadmore:m.value,agent_icon:C.value,onLoadmore:J,onActive:F},null,8,["list","can_loadmore","agent_icon"])):z("",!0),l.value===1||l.value===2?(M(),H("div",We,[I(y,{size:32})])):z("",!0),l.value===3&&g.value.length===0?(M(),H("div",Re,[I(j,null,{default:U(()=>[lt(W(L.$t("conversation.history_empty")),1)]),_:1})])):z("",!0),l.value===4?(M(),H("div",Fe,[I(O,{status:"warning",title:i.value},null,8,["title"])])):z("",!0),l.value===5?(M(),H("div",Ue,[I(O,{status:"error",title:i.value},null,8,["title"])])):z("",!0),v[0]||(v[0]=w("div",{class:"conversation-history-placeholder"},null,-1))]),v[2]||(v[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 d=Lt(),a=Wt(),o=E(()=>a.value==="light"?{backgroundImage:`url(${Pe})`,backgroundRepeat:"no-repeat",backgroundSize:"cover"}:{}),f=({target_id:$,agent_id:c})=>{d.push({path:"/chat/qa",query:{session:$,agent:c}})};return($,c)=>(M(),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{Sn as default};
|