| 1 |
- import{o as $,a as w,e as k,G as F,r as H,c as E,m as dt,B as T,z as wt,Y as Ht,q as N,k as Yt,n as _t,N as nt,F as lt,X as vt,p as tt,J as Ct,u as gt,y as J,W as it,V as Lt}from"./vue-vendor-B2yM2jt_.js";import Tt from"./LayoutExperience-D4tPJFSw.js";import xt from"./ContentContainer-CZH6CIgc.js";import{C as It}from"./ChatAsideMenu-Cio04i0h.js";/* empty css */import{R as Ot}from"./index-sUP7tXBR.js";/* empty css */import{S as $t}from"./index-Bu5jldT_.js";import{_ as G}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{c as ft,g as At,a as jt,j as Mt,u as Nt,M as zt,b as Bt,l as Dt,d as Et,B as Vt,e as Wt}from"./index-DnTunbJs.js";import{M as ht}from"./index-CBqvezdJ.js";import"./index-DpAIyTtw.js";import{D as Rt,a as Ft,E as Ut}from"./index-CPr5VJXZ.js";/* empty css *//* empty css */import{a as qt}from"./api-conversation-board-HyRZD71p.js";import{u as Jt}from"./use-all-agents-HCgOcWPp.js";import{g as mt}from"./icon-map-MpRwWyE4.js";import"./Header-K4Npu_Xy.js";import"./index-DgeuyNu5.js";import"./use-logout-DopKSTI5.js";import"./use-current-user-Cs-IbK0_.js";import"./login-nLVJInxy.js";/* empty css */import"./index-CVqxzIG_.js";import"./index-Wws5lv8X.js";var St={exports:{}};(function(s,l){(function(i,r){s.exports=r()})(ft,function(){var i=1e3,r=6e4,y=36e5,D="millisecond",d="second",f="minute",_="hour",a="day",g="week",S="month",x="quarter",u="year",Y="date",A="Invalid Date",U=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,K=/\[([^\]]+)]|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(c){var n=["th","st","nd","rd"],t=c%100;return"["+c+(n[(t-20)%10]||n[t]||n[0])+"]"}},W=function(c,n,t){var o=String(c);return!o||o.length>=n?c:""+Array(n+1-o.length).join(t)+c},V={s:W,z:function(c){var n=-c.utcOffset(),t=Math.abs(n),o=Math.floor(t/60),e=t%60;return(n<=0?"+":"-")+W(o,2,"0")+":"+W(e,2,"0")},m:function c(n,t){if(n.date()<t.date())return-c(t,n);var o=12*(t.year()-n.year())+(t.month()-n.month()),e=n.clone().add(o,S),h=t-e<0,m=n.clone().add(o+(h?-1:1),S);return+(-(o+(t-e)/(h?e-m:m-e))||0)},a:function(c){return c<0?Math.ceil(c)||0:Math.floor(c)},p:function(c){return{M:S,y:u,w:g,d:a,D:Y,h:_,m:f,s:d,ms:D,Q:x}[c]||String(c||"").toLowerCase().replace(/s$/,"")},u:function(c){return c===void 0}},P="en",R={};R[P]=q;var ct="$isDayjsObject",rt=function(c){return c instanceof z||!(!c||!c[ct])},C=function c(n,t,o){var e;if(!n)return P;if(typeof n=="string"){var h=n.toLowerCase();R[h]&&(e=h),t&&(R[h]=t,e=h);var m=n.split("-");if(!e&&m.length>1)return c(m[0])}else{var M=n.name;R[M]=n,e=M}return!o&&e&&(P=e),e||!o&&P},v=function(c,n){if(rt(c))return c.clone();var t=typeof n=="object"?n:{};return t.date=c,t.args=arguments,new z(t)},p=V;p.l=C,p.i=rt,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=C(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(o){var e=o.date,h=o.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 m=e.match(U);if(m){var M=m[2]-1||0,b=(m[7]||"0").substring(0,3);return h?new Date(Date.UTC(m[1],M,m[3]||1,m[4]||0,m[5]||0,m[6]||0,b)):new Date(m[1],M,m[3]||1,m[4]||0,m[5]||0,m[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()!==A},n.isSame=function(t,o){var e=v(t);return this.startOf(o)<=e&&e<=this.endOf(o)},n.isAfter=function(t,o){return v(t)<this.startOf(o)},n.isBefore=function(t,o){return this.endOf(o)<v(t)},n.$g=function(t,o,e){return p.u(t)?this[o]:this.set(e,t)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(t,o){var e=this,h=!!p.u(o)||o,m=p.p(t),M=function(X,j){var Z=p.w(e.$u?Date.UTC(e.$y,j,X):new Date(e.$y,j,X),e);return h?Z:Z.endOf(a)},b=function(X,j){return p.w(e.toDate()[X].apply(e.toDate("s"),(h?[0,0,0,0]:[23,59,59,999]).slice(j)),e)},L=this.$W,O=this.$M,B=this.$D,et="set"+(this.$u?"UTC":"");switch(m){case u:return h?M(1,0):M(31,11);case S:return h?M(1,O):M(0,O+1);case g:var Q=this.$locale().weekStart||0,ot=(L<Q?L+7:L)-Q;return M(h?B-ot:B+(6-ot),O);case a:case Y:return b(et+"Hours",0);case _:return b(et+"Minutes",1);case f: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,o){var e,h=p.p(t),m="set"+(this.$u?"UTC":""),M=(e={},e[a]=m+"Date",e[Y]=m+"Date",e[S]=m+"Month",e[u]=m+"FullYear",e[_]=m+"Hours",e[f]=m+"Minutes",e[d]=m+"Seconds",e[D]=m+"Milliseconds",e)[h],b=h===a?this.$D+(o-this.$W):o;if(h===S||h===u){var L=this.clone().set(Y,1);L.$d[M](b),L.init(),this.$d=L.set(Y,Math.min(this.$D,L.daysInMonth())).$d}else M&&this.$d[M](b);return this.init(),this},n.set=function(t,o){return this.clone().$set(t,o)},n.get=function(t){return this[p.p(t)]()},n.add=function(t,o){var e,h=this;t=Number(t);var m=p.p(o),M=function(O){var B=v(h);return p.w(B.date(B.date()+Math.round(O*t)),h)};if(m===S)return this.set(S,this.$M+t);if(m===u)return this.set(u,this.$y+t);if(m===a)return M(1);if(m===g)return M(7);var b=(e={},e[f]=r,e[_]=y,e[d]=i,e)[m]||1,L=this.$d.getTime()+t*b;return p.w(L,this)},n.subtract=function(t,o){return this.add(-1*t,o)},n.format=function(t){var o=this,e=this.$locale();if(!this.isValid())return e.invalidDate||A;var h=t||"YYYY-MM-DDTHH:mm:ssZ",m=p.z(this),M=this.$H,b=this.$m,L=this.$M,O=e.weekdays,B=e.months,et=e.meridiem,Q=function(j,Z,at,ut){return j&&(j[Z]||j(o,h))||at[Z].slice(0,ut)},ot=function(j){return p.s(M%12||12,j,"0")},X=et||function(j,Z,at){var ut=j<12?"AM":"PM";return at?ut.toLowerCase():ut};return h.replace(K,function(j,Z){return Z||function(at){switch(at){case"YY":return String(o.$y).slice(-2);case"YYYY":return p.s(o.$y,4,"0");case"M":return L+1;case"MM":return p.s(L+1,2,"0");case"MMM":return Q(e.monthsShort,L,B,3);case"MMMM":return Q(B,L);case"D":return o.$D;case"DD":return p.s(o.$D,2,"0");case"d":return String(o.$W);case"dd":return Q(e.weekdaysMin,o.$W,O,2);case"ddd":return Q(e.weekdaysShort,o.$W,O,3);case"dddd":return O[o.$W];case"H":return String(M);case"HH":return p.s(M,2,"0");case"h":return ot(1);case"hh":return ot(2);case"a":return X(M,b,!0);case"A":return X(M,b,!1);case"m":return String(b);case"mm":return p.s(b,2,"0");case"s":return String(o.$s);case"ss":return p.s(o.$s,2,"0");case"SSS":return p.s(o.$ms,3,"0");case"Z":return m}return null}(j)||m.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(t,o,e){var h,m=this,M=p.p(o),b=v(t),L=(b.utcOffset()-this.utcOffset())*r,O=this-b,B=function(){return p.m(m,b)};switch(M){case u:h=B()/12;break;case S:h=B();break;case x:h=B()/3;break;case g:h=(O-L)/6048e5;break;case a:h=(O-L)/864e5;break;case _:h=O/y;break;case f:h=O/r;break;case d:h=O/i;break;default:h=O}return e?h:p.a(h)},n.daysInMonth=function(){return this.endOf(S).$D},n.$locale=function(){return R[this.$L]},n.locale=function(t,o){if(!t)return this.$L;var e=this.clone(),h=C(t,o,!0);return h&&(e.$L=h),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}(),I=z.prototype;return v.prototype=I,[["$ms",D],["$s",d],["$m",f],["$H",_],["$W",a],["$M",S],["$y",u],["$D",Y]].forEach(function(c){I[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=C,v.isDayjs=rt,v.unix=function(c){return v(1e3*c)},v.en=R[P],v.Ls=R,v.p={},v})})(St);var kt=St.exports;const st=At(kt);var Pt={exports:{}};(function(s,l){(function(i,r){s.exports=r(kt)})(ft,function(i){function r(d){return d&&typeof d=="object"&&"default"in d?d:{default:d}}var y=r(i),D={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,f){return f==="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,f){var _=100*d+f;return _<600?"凌晨":_<900?"早上":_<1100?"上午":_<1300?"中午":_<1800?"下午":"晚上"}};return y.default.locale(D,null,!0),D})})(Pt);const Zt={},Gt={class:"conversation-history-title"};function Kt(s,l){return $(),w("div",Gt,[k("div",null,F(s.$t("conversation.chat_history")),1)])}const Qt=G(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"],re={__name:"HistorySearchInput",emits:["search"],setup(s,{emit:l}){const i=l,r=H(""),y=E(()=>r.value.length!==0),D=a=>{r.value=a.target.value},d=a=>{r.value=a.target.value},f=a=>{a.keyCode===13&&i("search",r.value)},_=()=>{r.value="",i("search",r.value)};return(a,g)=>{const S=dt("icon-search"),x=dt("icon-close");return $(),w("div",Xt,[k("div",te,[k("div",ee,[T(S)]),k("div",ne,[wt(k("input",{type:"text",class:"search-input",placeholder:a.$t("conversation.search_history"),"onUpdate:modelValue":g[0]||(g[0]=u=>r.value=u),onInput:D,onChange:d,onKeyup:f},null,40,se),[[Ht,r.value]])]),y.value?($(),w("div",{key:0,class:"search-input-icon icon-clear",onClick:_},[T(x)])):N("",!0),Yt(a.$slots,"default",{},void 0,!0)])])}}},oe=G(re,[["__scopeId","data-v-f3dff79d"]]);var ae={exports:{}};(function(s,l){(function(i,r){s.exports=r()})(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 r=["th","st","nd","rd"],y=i%100;return"["+i+(r[(y-20)%10]||r[y]||r[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,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 i=`/api/agent/${l}/sessions`,r={};return"per_page"in s&&(r.limit=s.per_page/1),"page"in s&&(r.page=s.page/1),"search"in s&&s.search&&(r.keyword=s.search),jt({url:i,method:"get",params:r})},he=s=>(Mt({conversation_ids:[s]}),new Promise((i,r)=>{setTimeout(()=>{i({code:200,data:!0,msg:""})},1e3)})),me={__name:"BtnHistoryItemDelete",props:{target_id:String},emits:["deleteSuccess"],setup(s,{emit:l}){const i=s,r=l,y=Nt();H(1),H("");const D=()=>{const f=y.t("conversation.are_you_sure");y.t("conversation.btn_yes"),y.t("conversation.btn_no"),zt.warning({title:f,hideCancel:!1,"modal-class":"history-chat-remove-modal",onOk(_){},async onBeforeOk(){try{return await d()===200}catch{return!1}},onCancel(){}})},d=()=>new Promise((f,_)=>{he(i.target_id).then(a=>{if(a.code/1===200){const g=y.t("conversation.del_success");ht.success(g),r("deleteSuccess"),f(200)}else ht.warning(a.msg)}).catch(a=>{ht.warning(a.msg),_(a)})});return(f,_)=>{const a=dt("icon-delete");return $(),w("span",{onClick:D,class:"btn-delete"},[T(a)])}}},fe=G(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 i=s,r=l,y=H(!1),D=Bt(),d=E(()=>i.history.client_field_content_type==="label"),f=E(()=>i.history.client_field_content_type==="content"),_=E(()=>f.value&&!y.value),a=E(()=>{const u={"conversation-history-item":!0};return u[`item-${i.index}`]=!0,u[`item-${i.history.id}`]=!0,u[i.history.client_field_timestamp_type]=!0,d.value&&(u["conversation-history-section-title"]=!0),f.value&&(u["conversation-history-section-data"]=!0),u}),g=E(()=>{const u=i.history.client_field_timestamp_type,Y=i.history.create_time,A=D.value;return u==="today"?de(Y,A):u==="month"||u==="earlier"?pt(Y,A):""}),S=()=>{r("active",i.history.id)},x=()=>{y.value=!0};return(u,Y)=>($(),w(nt,null,[d.value?($(),w("div",{key:0,class:_t([a.value,"history-block-title"])},[s.history.client_field_timestamp_type==="today"?($(),w(nt,{key:0},[lt(F(u.$t("conversation.history_today")),1)],64)):N("",!0),s.history.client_field_timestamp_type==="month"?($(),w(nt,{key:1},[lt(F(u.$t("conversation.history_month")),1)],64)):N("",!0),s.history.client_field_timestamp_type==="earlier"?($(),w(nt,{key:2},[lt(F(u.$t("conversation.history_earlier")),1)],64)):N("",!0)],2)):N("",!0),_.value?($(),w("div",{key:1,class:_t(a.value)},[k("div",{class:"history-item-icon",onClick:S},[k("img",{src:s.agent_icon},null,8,pe)]),k("div",ye,[k("div",{class:"history-item-intro-title",onClick:S},F(s.history.name),1)]),k("div",ve,[k("span",ge,F(g.value),1),k("span",$e,[T(fe,{target_id:s.history.id,onDeleteSuccess:x},null,8,["target_id"])])])],2)):N("",!0)],64))}},De=G(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 i=s,r=l,y=E(()=>{const d={"conversation-history-item":!0};return d["load-more"]=!0,d}),D=()=>{i.can_loadmore&&r("loadmore")};return(d,f)=>($(),w("div",{class:_t(y.value),onClick:D},[s.can_loadmore?($(),w("div",Se,F(d.$t("conversation.history_loadmore")),1)):N("",!0)],2))}},be=G(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:l}){const i=l,r=E(()=>"conversation-history-list"),y=f=>{i("active",f)},D=f=>{i("delete",f)},d=()=>{i("loadmore")};return(f,_)=>($(),w("div",we,[k("div",{class:_t(r.value)},[($(!0),w(nt,null,vt(s.list,(a,g)=>($(),tt(De,{key:a.id,history:a,index:g,agent_icon:s.agent_icon,onActive:y,onDelete:D},null,8,["history","index","agent_icon"]))),128)),T(be,{can_loadmore:s.can_loadmore,onLoadmore:d},null,8,["can_loadmore"])],2)]))}},Ye=G(He,[["__scopeId","data-v-4bed9682"]]);function Ce(s){const l=H(1),i=H(""),r=H([]),y=Jt(),D=()=>({});return{getAgentList:()=>{const f=y.agents;if(f.length!==0){typeof s=="function"&&s(f),r.value=f;return}const _=D();l.value=2,i.value="",qt(_).then(a=>{if(a.code/1===200){const g=a.data;g.length!==0&&typeof s=="function"&&s(g),r.value=g,y.setList(g),l.value=3,i.value="success"}else l.value=4,i.value=err.message}).catch(a=>{console.log(a),l.value=5,i.value=a.msg})},api_status:l,api_message:i,list_agents:r}}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=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"},je=["src"],Ne={class:"dropdown-item-text"},ze={__name:"HistoryTypeDropdown",props:{list_status:Number},emits:["typeSelected"],setup(s,{emit:l}){const i=s,r=Te(),{api_status:y,api_message:D,list_agents:d,getAgentList:f}=Ce(u=>{var Y;if(r.search_type){const A=((Y=r.search_type)==null?void 0:Y.id)||"";let U=null;const K=u.length;for(let q=0;q<K;q++){const W=u[q];if(W.id===A){U=W;break}}x(U||u[0])}else x(u[0])}),_=l,a=E(()=>{var u;return((u=r==null?void 0:r.search_type)==null?void 0:u.name)||""}),g=E(()=>r.search_type&&r.search_type.icon?mt(r.search_type.icon):""),S=E(()=>i.list_status===2),x=u=>{r.setType(u),_("typeSelected",u)};return gt(()=>{f()}),(u,Y)=>{const A=dt("icon-down"),U=Vt,K=$t,q=Rt,W=Ft;return $(),tt(W,{trigger:"hover",defaultValue:a.value},{content:J(()=>[($(!0),w(nt,null,vt(it(d),(V,P)=>($(),tt(q,{key:V.id,disabled:S.value,value:V.name,onClick:R=>x(V)},{default:J(()=>[k("div",Ae,[k("img",{src:it(mt)(V.icon),class:"agent-icon-img"},null,8,je),k("span",Ne,F(V.name),1)])]),_:2},1032,["disabled","value","onClick"]))),128))]),default:J(()=>[it(y)===1||it(y)===3?($(),tt(U,{key:0,class:"history-type-btn",type:"text"},{default:J(()=>[k("img",{src:g.value,class:"agent-icon-img"},null,8,xe),k("span",Ie,F(a.value),1),k("span",Oe,[T(A,{class:"arrow-down"})])]),_:1})):N("",!0),it(y)===2?($(),tt(U,{key:1,class:"history-type-btn",type:"text"},{default:J(()=>[T(K,{size:16})]),_:1})):N("",!0)]),_:1},8,["defaultValue"])}}},Be=G(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"},qe={__name:"ConversationHistoryContainer",emits:["historyActive"],setup(s,{emit:l}){const i=l,r=H(1),y=H(50),D=H(""),d=H(""),f=H(!0),_=H(1),a=H(""),g=H([]),S=H(0),x=H(0),u=H(0),Y=H(""),A=le(),K=A-bt-ue;function q(C){C.forEach((v,p)=>{let z=null;const I=v,n=new Date(I.create_date).getTime();let t=null;if(isNaN(n)){const e=new Date(I.updated_time).getTime();isNaN(e)?t=Date.now():t=e}else t=n;I.create_time=t,t>=A?(S.value===0&&(z={client_field_content_type:"label",client_field_timestamp_type:"today",id:"today"}),I.client_field_timestamp_type="today",I.client_field_content_type="content",S.value=S.value+1):t<A&&t>K?(x.value===0&&(z={client_field_content_type:"label",client_field_timestamp_type:"month",id:"month"}),I.client_field_timestamp_type="month",I.client_field_content_type="content",x.value=x.value+1):(u.value===0&&(z={client_field_content_type:"label",client_field_timestamp_type:"earlier",id:"earlier"}),I.client_field_timestamp_type="earlier",I.client_field_content_type="content",u.value=u.value+1),z&&g.value.push(z),g.value.push(I)})}const W=()=>({search:D.value,page:r.value,per_page:y.value,agent_id:d.value}),V=()=>{const C=W();_.value=2,a.value="",_e(C).then(v=>{if(v.code/1===200){const p=v.data;p.length<y.value?f.value=!1:f.value=!0,q(p),_.value=3,a.value="success"}else _.value=4,a.value=v.msg}).catch(v=>{_.value=5,a.value=v.message})},P=()=>{_.value!==2&&f.value&&(r.value=r.value+1,V())},R=C=>{i("historyActive",{agent_id:d.value,target_id:C})},ct=C=>{_.value!==2&&(D.value=C,r.value=1,g.value=[],V())},rt=C=>{_.value!==2&&C&&(S.value=0,x.value=0,u.value=0,Y.value=mt(C.icon),d.value=C.id,r.value=1,g.value=[],V())};return gt(()=>{}),(C,v)=>{const p=$t,z=Ut,I=Ot;return $(),w("div",Ee,[v[1]||(v[1]=k("div",{class:"conversation-history-left"},null,-1)),k("div",Ve,[T(Qt),T(oe,{onSearch:ct},{default:J(()=>[T(Be,{onTypeSelected:rt,list_status:_.value},null,8,["list_status"])]),_:1}),g.value.length!==0?($(),tt(Ye,{key:0,list:g.value,can_loadmore:f.value,agent_icon:Y.value,onLoadmore:P,onActive:R},null,8,["list","can_loadmore","agent_icon"])):N("",!0),_.value===1||_.value===2?($(),w("div",We,[T(p,{size:32})])):N("",!0),_.value===3&&g.value.length===0?($(),w("div",Re,[T(z,null,{default:J(()=>[lt(F(C.$t("conversation.history_empty")),1)]),_:1})])):N("",!0),_.value===4?($(),w("div",Fe,[T(I,{status:"warning",title:a.value},null,8,["title"])])):N("",!0),_.value===5?($(),w("div",Ue,[T(I,{status:"error",title:a.value},null,8,["title"])])):N("",!0),v[0]||(v[0]=k("div",{class:"conversation-history-placeholder"},null,-1))]),v[2]||(v[2]=k("div",{class:"conversation-history-right"},null,-1))])}}},Je=G(qe,[["__scopeId","data-v-ad3d0ba8"]]),Pe="/assets/history-bg-Cuh6wzmt.png",Dn={__name:"ConversationHistory",setup(s){const l=Lt(),i=Wt(),r=E(()=>i.value==="light"?{backgroundImage:`url(${Pe})`,backgroundRepeat:"no-repeat",backgroundSize:"cover"}:{}),y=({target_id:D,agent_id:d})=>{l.push({path:"/chat/qa",query:{session:D,agent:d}})};return(D,d)=>($(),tt(Tt,null,{default:J(()=>[T(xt,{containerStyle:r.value,id:"fjkdsdajfklgjsklfjskdlf"},{default:J(()=>[T(It),T(Je,{onHistoryActive:y})]),_:1},8,["containerStyle"])]),_:1}))}};export{Dn as default};
|