| 1 |
- import{c as H,o as $,a as w,G as W,f as C,e as E,l as dt,m as N,k as bt,B as I,z as Ht,$ as Ct,b as _t,P as nt,F as lt,X as vt,p as Q,J as Yt,u as gt,y as U,V as it,W as Lt}from"./vue-vendor-bEvCrXZa.js";import Tt from"./LayoutExperience-Cp_zxTRa.js";import xt from"./ContentContainer-uE68UcSr.js";import{C as It}from"./ChatAsideMenu-D-CJPzdy.js";/* empty css */import{R as Ot}from"./index-ByGaGh16.js";/* empty css */import{S as $t}from"./index-BeS2Ppql.js";import{_ as Z}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{g as At,w as ft,x as jt,z as Mt,u as Nt,M as zt,A as Bt,C as Dt,D as Et,B as Vt,E as Wt}from"./index-CSfNVY9x.js";import{M as ht}from"./index-BTCv57tJ.js";import"./index-KDxWQSei.js";import{D as Rt,a as Ft,E as Ut}from"./index-ZoU3FSSc.js";/* empty css *//* empty css */import{a as Jt}from"./api-conversation-board-DQv7K74w.js";import{u as qt}from"./use-all-agents-O9YM_Z-H.js";import{g as mt}from"./icon-map-MpRwWyE4.js";import"./Header-DFkLwA7q.js";import"./index-BZR4cZsO.js";import"./use-logout-BhxpaCVg.js";import"./use-current-user-BBjDZ3xV.js";import"./login-BdaqfucN.js";/* empty css */import"./index-Cktc58K-.js";import"./index-TbfTfkzj.js";var St={exports:{}};(function(s,l){(function(a,o){s.exports=o()})(ft,function(){var a=1e3,o=6e4,y=36e5,M="millisecond",d="second",m="minute",u="hour",i="day",g="week",D="month",k="quarter",f="year",Y="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,J={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(c){var n=["th","st","nd","rd"],t=c%100;return"["+c+(n[(t-20)%10]||n[t]||n[0])+"]"}},V=function(c,n,t){var r=String(c);return!r||r.length>=n?c:""+Array(n+1-r.length).join(t)+c},tt={s:V,z:function(c){var n=-c.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 c(n,t){if(n.date()<t.date())return-c(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(c){return c<0?Math.ceil(c)||0:Math.floor(c)},p:function(c){return{M:D,y:f,w:g,d:i,D:Y,h:u,m,s:d,ms:M,Q:k}[c]||String(c||"").toLowerCase().replace(/s$/,"")},u:function(c){return c===void 0}},q="en",F={};F[q]=J;var ct="$isDayjsObject",ot=function(c){return c instanceof z||!(!c||!c[ct])},L=function c(n,t,r){var e;if(!n)return q;if(typeof n=="string"){var _=n.toLowerCase();F[_]&&(e=_),t&&(F[_]=t,e=_);var h=n.split("-");if(!e&&h.length>1)return c(h[0])}else{var S=n.name;F[S]=n,e=S}return!r&&e&&(q=e),e||!r&&q},v=function(c,n){if(ot(c))return c.clone();var t=typeof n=="object"?n:{};return t.date=c,t.args=arguments,new z(t)},p=tt;p.l=L,p.i=ot,p.w=function(c,n){return v(c,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var z=function(){function c(t){this.$L=L(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[ct]=!0}var n=c.prototype;return n.parse=function(t){this.$d=function(r){var e=r.date,_=r.utc;if(e===null)return new Date(NaN);if(p.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 p},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 p.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,_=!!p.u(r)||r,h=p.p(t),S=function(K,j){var P=p.w(e.$u?Date.UTC(e.$y,j,K):new Date(e.$y,j,K),e);return _?P:P.endOf(i)},b=function(K,j){return p.w(e.toDate()[K].apply(e.toDate("s"),(_?[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(h){case f: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 Y:return b(et+"Hours",0);case u:return b(et+"Minutes",1);case m:return b(et+"Seconds",2);case d: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,_=p.p(t),h="set"+(this.$u?"UTC":""),S=(e={},e[i]=h+"Date",e[Y]=h+"Date",e[D]=h+"Month",e[f]=h+"FullYear",e[u]=h+"Hours",e[m]=h+"Minutes",e[d]=h+"Seconds",e[M]=h+"Milliseconds",e)[_],b=_===i?this.$D+(r-this.$W):r;if(_===D||_===f){var T=this.clone().set(Y,1);T.$d[S](b),T.init(),this.$d=T.set(Y,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[p.p(t)]()},n.add=function(t,r){var e,_=this;t=Number(t);var h=p.p(r),S=function(A){var B=v(_);return p.w(B.date(B.date()+Math.round(A*t)),_)};if(h===D)return this.set(D,this.$M+t);if(h===f)return this.set(f,this.$y+t);if(h===i)return S(1);if(h===g)return S(7);var b=(e={},e[m]=o,e[u]=y,e[d]=a,e)[h]||1,T=this.$d.getTime()+t*b;return p.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=p.z(this),S=this.$H,b=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,_))||at[P].slice(0,ut)},rt=function(j){return p.s(S%12||12,j,"0")},K=et||function(j,P,at){var ut=j<12?"AM":"PM";return at?ut.toLowerCase():ut};return _.replace(R,function(j,P){return P||function(at){switch(at){case"YY":return String(r.$y).slice(-2);case"YYYY":return p.s(r.$y,4,"0");case"M":return T+1;case"MM":return p.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 p.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 p.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 p.s(b,2,"0");case"s":return String(r.$s);case"ss":return p.s(r.$s,2,"0");case"SSS":return p.s(r.$ms,3,"0");case"Z":return h}return null}(j)||h.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(t,r,e){var _,h=this,S=p.p(r),b=v(t),T=(b.utcOffset()-this.utcOffset())*o,A=this-b,B=function(){return p.m(h,b)};switch(S){case f:_=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 u:_=A/y;break;case m:_=A/o;break;case d:_=A/a;break;default:_=A}return e?_:p.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 p.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()},c}(),O=z.prototype;return v.prototype=O,[["$ms",M],["$s",d],["$m",m],["$H",u],["$W",i],["$M",D],["$y",f],["$D",Y]].forEach(function(c){O[c[1]]=function(n){return this.$g(n,c[0],c[1])}}),v.extend=function(c,n){return c.$i||(c(n,z,v),c.$i=!0),v},v.locale=L,v.isDayjs=ot,v.unix=function(c){return v(1e3*c)},v.en=F[q],v.Ls=F,v.p={},v})})(St);var kt=St.exports;const st=At(kt);var Pt={exports:{}};(function(s,l){(function(a,o){s.exports=o(kt)})(ft,function(a){function o(d){return d&&typeof d=="object"&&"default"in d?d:{default:d}}var y=o(a),M={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(d,m){return m==="W"?d+"周":d+"日"},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(d,m){var u=100*d+m;return u<600?"凌晨":u<900?"早上":u<1100?"上午":u<1300?"中午":u<1800?"下午":"晚上"}};return y.default.locale(M,null,!0),M})})(Pt);const Zt={},Gt={class:"conversation-history-title"};function Kt(s,l){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:l}){const a=l,o=C(""),y=E(()=>o.value.length!==0),M=i=>{o.value=i.target.value},d=i=>{o.value=i.target.value},m=i=>{i.keyCode===13&&a("search",o.value)},u=()=>{o.value="",a("search",o.value)};return(i,g)=>{const D=dt("icon-search"),k=dt("icon-close");return $(),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]=f=>o.value=f),onInput:M,onChange:d,onKeyup:m},null,40,se),[[Ct,o.value]])]),y.value?($(),H("div",{key:0,class:"search-input-icon icon-clear",onClick:u},[I(k)])):N("",!0),bt(i.$slots,"default",{},void 0,!0)])])}}},re=Z(oe,[["__scopeId","data-v-f3dff79d"]]);var ae={exports:{}};(function(s,l){(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"],y=a%100;return"["+a+(o[(y-20)%10]||o[y]||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,l)=>{if(!l)return st(s).format("HH:mm");if(l==="zh")return st(s).locale("zh-cn").format("HH:mm");if(l==="en")return st(s).format("HH:mm")},pt=(s,l)=>l&&l==="zh"?st(s).locale("zh-cn").format("MM-DD"):st(s).format("MM-DD"),_e=s=>{const l=s.agent_id;if(!l)return Promise.reject(new Error("前端异常:Invalid Agent ID"));const a=`/api/agent/${l}/sessions`,o={};return"per_page"in s&&(o.limit=s.per_page/1),"page"in s&&(o.page=s.page/1),"search"in s&&s.search&&(o.keyword=s.search),jt({url:a,method:"get",params:o})},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:l}){const a=s,o=l,y=Nt();C(1),C("");const M=()=>{const m=y.t("conversation.are_you_sure");y.t("conversation.btn_yes"),y.t("conversation.btn_no"),zt.warning({title:m,hideCancel:!1,"modal-class":"history-chat-remove-modal",onOk(u){},async onBeforeOk(){try{return await d()===200}catch{return!1}},onCancel(){}})},d=()=>new Promise((m,u)=>{he(a.target_id).then(i=>{if(i.code/1===200){const g=y.t("conversation.del_success");ht.success(g),o("deleteSuccess"),m(200)}else ht.warning(i.msg)}).catch(i=>{ht.warning(i.msg),u(i)})});return(m,u)=>{const i=dt("icon-delete");return $(),H("span",{onClick:M,class:"btn-delete"},[I(i)])}}},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:l}){const a=s,o=l,y=C(!1),M=Bt(),d=E(()=>a.history.client_field_content_type==="label"),m=E(()=>a.history.client_field_content_type==="content"),u=E(()=>m.value&&!y.value),i=E(()=>{const f={"conversation-history-item":!0};return f[`item-${a.index}`]=!0,f[`item-${a.history.id}`]=!0,f[a.history.client_field_timestamp_type]=!0,d.value&&(f["conversation-history-section-title"]=!0),m.value&&(f["conversation-history-section-data"]=!0),f}),g=E(()=>{const f=a.history.client_field_timestamp_type,Y=a.history.create_time,x=M.value;return f==="today"?de(Y,x):f==="month"||f==="earlier"?pt(Y,x):""}),D=()=>{o("active",a.history.id)},k=()=>{y.value=!0};return(f,Y)=>($(),H(nt,null,[d.value?($(),H("div",{key:0,class:_t([i.value,"history-block-title"])},[s.history.client_field_timestamp_type==="today"?($(),H(nt,{key:0},[lt(W(f.$t("conversation.history_today")),1)],64)):N("",!0),s.history.client_field_timestamp_type==="month"?($(),H(nt,{key:1},[lt(W(f.$t("conversation.history_month")),1)],64)):N("",!0),s.history.client_field_timestamp_type==="earlier"?($(),H(nt,{key:2},[lt(W(f.$t("conversation.history_earlier")),1)],64)):N("",!0)],2)):N("",!0),u.value?($(),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",ye,[w("div",{class:"history-item-intro-title",onClick:D},W(s.history.name),1)]),w("div",ve,[w("span",ge,W(g.value),1),w("span",$e,[I(fe,{target_id:s.history.id,onDeleteSuccess:k},null,8,["target_id"])])])],2)):N("",!0)],64))}},De=Z(Me,[["__scopeId","data-v-f032bf4d"]]),Se={key:0,class:"history-item-icon can-loadmore"},ke={__name:"HistoryLoadMore",props:{can_loadmore:Boolean},emits:["loadmore"],setup(s,{emit:l}){const a=s,o=l,y=E(()=>{const d={"conversation-history-item":!0};return d["load-more"]=!0,d}),M=()=>{a.can_loadmore&&o("loadmore")};return(d,m)=>($(),H("div",{class:_t(y.value),onClick:M},[s.can_loadmore?($(),H("div",Se,W(d.$t("conversation.history_loadmore")),1)):N("",!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:l}){const a=l,o=E(()=>"conversation-history-list"),y=m=>{a("active",m)},M=m=>{a("delete",m)},d=()=>{a("loadmore")};return(m,u)=>($(),H("div",be,[w("div",{class:_t(o.value)},[($(!0),H(nt,null,vt(s.list,(i,g)=>($(),Q(De,{key:i.id,history:i,index:g,agent_icon:s.agent_icon,onActive:y,onDelete:M},null,8,["history","index","agent_icon"]))),128)),I(we,{can_loadmore:s.can_loadmore,onLoadmore:d},null,8,["can_loadmore"])],2)]))}},Ce=Z(He,[["__scopeId","data-v-4bed9682"]]);function Ye(s){const l=C(1),a=C(""),o=C([]),y=qt(),M=()=>({});return{getAgentList:()=>{const m=y.agents;if(m.length!==0){typeof s=="function"&&s(m),o.value=m;return}const u=M();l.value=2,a.value="",Jt(u).then(i=>{if(i.code/1===200){const g=i.data;g.length!==0&&typeof s=="function"&&s(g),o.value=g,y.setList(g),l.value=3,a.value="success"}else l.value=4,a.value=err.message}).catch(i=>{console.log(i),l.value=5,a.value=i.msg})},api_status:l,api_message:a,list_agents:o}}function Le(s){const l=Mt(s);Dt.setItem(l)}function yt(){const s=Dt.getItem(),l=Et(s);return l===null?null:l}const Te=Yt("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"},je=["src"],Ne={class:"dropdown-item-text"},ze={__name:"HistoryTypeDropdown",props:{list_status:Number},emits:["typeSelected"],setup(s,{emit:l}){const a=s,o=Te(),{api_status:y,list_agents:M,getAgentList:d}=Ye(k=>{var f;if(o.search_type){const Y=((f=o.search_type)==null?void 0:f.id)||"";let x=null;const X=k.length;for(let R=0;R<X;R++){const J=k[R];if(J.id===Y){x=J;break}}D(x||k[0])}else D(k[0])}),m=l,u=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(()=>{d()}),(k,f)=>{const Y=dt("icon-down"),x=Vt,X=$t,R=Rt,J=Ft;return $(),Q(J,{trigger:"hover",defaultValue:u.value},{content:U(()=>[($(!0),H(nt,null,vt(it(M),(V,tt)=>($(),Q(R,{key:V.id,disabled:g.value,value:V.name,onClick:q=>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(y)===1||it(y)===3?($(),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(u.value),1),w("span",Oe,[I(Y,{class:"arrow-down"})])]),_:1})):N("",!0),it(y)===2?($(),Q(x,{key:1,class:"history-type-btn",type:"text"},{default:U(()=>[I(X,{size:16})]),_:1})):N("",!0)]),_:1},8,["defaultValue"])}}},Be=Z(ze,[["__scopeId","data-v-7e0d55ff"]]),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"},Je={__name:"ConversationHistoryContainer",emits:["historyActive"],setup(s,{emit:l}){const a=l,o=C(1),y=C(50),M=C(""),d=C(""),m=C(!0),u=C(1),i=C(""),g=C([]),D=C(0),k=C(0),f=C(0),Y=C(""),x=le(),R=x-wt-ue;function J(L){L.forEach((v,p)=>{let z=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&&(z={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&&(z={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):(f.value===0&&(z={client_field_content_type:"label",client_field_timestamp_type:"earlier",id:"earlier"}),O.client_field_timestamp_type="earlier",O.client_field_content_type="content",f.value=f.value+1),z&&g.value.push(z),g.value.push(O)})}const V=()=>({search:M.value,page:o.value,per_page:y.value,agent_id:d.value}),tt=()=>{const L=V();u.value=2,i.value="",_e(L).then(v=>{if(v.code/1===200){const p=v.data;p.length<y.value?m.value=!1:m.value=!0,J(p),u.value=3,i.value="success"}else u.value=4,i.value=v.msg}).catch(v=>{u.value=5,i.value=v.message})},q=()=>{u.value!==2&&m.value&&(o.value=o.value+1,tt())},F=L=>{a("historyActive",{agent_id:d.value,target_id:L})},ct=L=>{u.value!==2&&(M.value=L,o.value=1,g.value=[],tt())},ot=L=>{u.value!==2&&L&&(D.value=0,k.value=0,f.value=0,Y.value=mt(L.icon),d.value=L.id,o.value=1,g.value=[],tt())};return gt(()=>{}),(L,v)=>{const p=$t,z=Ut,O=Ot;return $(),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:u.value},null,8,["list_status"])]),_:1}),g.value.length!==0?($(),Q(Ce,{key:0,list:g.value,can_loadmore:m.value,agent_icon:Y.value,onLoadmore:q,onActive:F},null,8,["list","can_loadmore","agent_icon"])):N("",!0),u.value===1||u.value===2?($(),H("div",We,[I(p,{size:32})])):N("",!0),u.value===3&&g.value.length===0?($(),H("div",Re,[I(z,null,{default:U(()=>[lt(W(L.$t("conversation.history_empty")),1)]),_:1})])):N("",!0),u.value===4?($(),H("div",Fe,[I(O,{status:"warning",title:i.value},null,8,["title"])])):N("",!0),u.value===5?($(),H("div",Ue,[I(O,{status:"error",title:i.value},null,8,["title"])])):N("",!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))])}}},qe=Z(Je,[["__scopeId","data-v-ad3d0ba8"]]),Pe="/assets/history-bg-Cuh6wzmt.png",Dn={__name:"ConversationHistory",setup(s){const l=Lt(),a=Wt(),o=E(()=>a.value==="light"?{backgroundImage:`url(${Pe})`,backgroundRepeat:"no-repeat",backgroundSize:"cover"}:{}),y=({target_id:M,agent_id:d})=>{l.push({path:"/chat/qa",query:{session:M,agent:d}})};return(M,d)=>($(),Q(Tt,null,{default:U(()=>[I(xt,{containerStyle:o.value,id:"fjkdsdajfklgjsklfjskdlf"},{default:U(()=>[I(It),I(qe,{onHistoryActive:y})]),_:1},8,["containerStyle"])]),_:1}))}};export{Dn as default};
|