| 1 |
- import{c as Y,o as M,a as w,u as W,j as C,e as E,p as dt,s as z,m as bt,v as O,G as Ht,a1 as Yt,b as _t,F as nt,t as lt,Z as yt,q as Q,M as Ct,B as gt,w as U,Y as it,N as Lt}from"./vue-vendor-CBGUFTsF.js";import Tt from"./LayoutExperience-CR3QnEuP.js";import xt from"./ContentContainer-Dst4bqY3.js";import{C as Ot}from"./ChatAsideMenu-DS9T5hq9.js";import{k as It,H as ft,_ as Z,J as At,L as $t,u as Nt,M as jt,N as zt,O as Mt,P as Bt,B as Et,Q as Vt}from"./index-CVDyAB5E.js";import{R as Wt}from"./index-mYeLtivx.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./index-DogcpJwz.js";import{M as ht}from"./index-CmhLXlYR.js";/* empty css *//* empty css *//* empty css */import{a as Ft}from"./api-conversation-board-CBTi01TP.js";import{u as Rt}from"./use-all-agents-XHS-a0Oc.js";import{g as mt}from"./icon-map-D83d39Ln.js";import{S as Dt}from"./index-91EZoapZ.js";import{D as Ut,a as qt,E as Jt}from"./index-BNRgXl_1.js";import"./Header-BFxxGGUL.js";import"./index-2XQQv03h.js";import"./logo-CxXS7KxG.js";import"./use-platform-information-BwI-Z1kC.js";import"./use-logout-CKeIp0jA.js";import"./use-current-user-CdQObYyO.js";import"./login-CXnkx0pX.js";/* empty css */import"./index-CfpSx18r.js";import"./index-BbumWpdU.js";import"./index-B6BdE4l3.js";var St={exports:{}};(function(s,m){(function(c,o){s.exports=o()})(ft,function(){var c=1e3,o=6e4,f=36e5,g="millisecond",i="second",l="minute",a="hour",d="day",S="week",$="month",k="quarter",p="year",L="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,$),_=t-e<0,h=n.clone().add(r+(_?-1:1),$);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:$,y:p,w:S,d,D:L,h:a,m:l,s:i,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])},b=function u(n,t,r){var e;if(!n)return J;if(typeof n=="string"){var _=n.toLowerCase();R[_]&&(e=_),t&&(R[_]=t,e=_);var h=n.split("-");if(!e&&h.length>1)return u(h[0])}else{var D=n.name;R[D]=n,e=D}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 N(t)},y=tt;y.l=b,y.i=ot,y.w=function(u,n){return v(u,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var N=function(){function u(t){this.$L=b(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 D=h[2]-1||0,H=(h[7]||"0").substring(0,3);return _?new Date(Date.UTC(h[1],D,h[3]||1,h[4]||0,h[5]||0,h[6]||0,H)):new Date(h[1],D,h[3]||1,h[4]||0,h[5]||0,h[6]||0,H)}}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),D=function(K,j){var P=y.w(e.$u?Date.UTC(e.$y,j,K):new Date(e.$y,j,K),e);return _?P:P.endOf(d)},H=function(K,j){return y.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 p:return _?D(1,0):D(31,11);case $:return _?D(1,A):D(0,A+1);case S:var G=this.$locale().weekStart||0,rt=(T<G?T+7:T)-G;return D(_?B-rt:B+(6-rt),A);case d:case L:return H(et+"Hours",0);case a:return H(et+"Minutes",1);case l:return H(et+"Seconds",2);case i:return H(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":""),D=(e={},e[d]=h+"Date",e[L]=h+"Date",e[$]=h+"Month",e[p]=h+"FullYear",e[a]=h+"Hours",e[l]=h+"Minutes",e[i]=h+"Seconds",e[g]=h+"Milliseconds",e)[_],H=_===d?this.$D+(r-this.$W):r;if(_===$||_===p){var T=this.clone().set(L,1);T.$d[D](H),T.init(),this.$d=T.set(L,Math.min(this.$D,T.daysInMonth())).$d}else D&&this.$d[D](H);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),D=function(A){var B=v(_);return y.w(B.date(B.date()+Math.round(A*t)),_)};if(h===$)return this.set($,this.$M+t);if(h===p)return this.set(p,this.$y+t);if(h===d)return D(1);if(h===S)return D(7);var H=(e={},e[l]=o,e[a]=f,e[i]=c,e)[h]||1,T=this.$d.getTime()+t*H;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),D=this.$H,H=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 y.s(D%12||12,j,"0")},K=et||function(j,P,at){var ut=j<12?"AM":"PM";return at?ut.toLowerCase():ut};return _.replace(F,function(j,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(D);case"HH":return y.s(D,2,"0");case"h":return rt(1);case"hh":return rt(2);case"a":return K(D,H,!0);case"A":return K(D,H,!1);case"m":return String(H);case"mm":return y.s(H,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}(j)||h.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(t,r,e){var _,h=this,D=y.p(r),H=v(t),T=(H.utcOffset()-this.utcOffset())*o,A=this-H,B=function(){return y.m(h,H)};switch(D){case p:_=B()/12;break;case $:_=B();break;case k:_=B()/3;break;case S:_=(A-T)/6048e5;break;case d:_=(A-T)/864e5;break;case a:_=A/f;break;case l:_=A/o;break;case i:_=A/c;break;default:_=A}return e?_:y.a(_)},n.daysInMonth=function(){return this.endOf($).$D},n.$locale=function(){return R[this.$L]},n.locale=function(t,r){if(!t)return this.$L;var e=this.clone(),_=b(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}(),I=N.prototype;return v.prototype=I,[["$ms",g],["$s",i],["$m",l],["$H",a],["$W",d],["$M",$],["$y",p],["$D",L]].forEach(function(u){I[u[1]]=function(n){return this.$g(n,u[0],u[1])}}),v.extend=function(u,n){return u.$i||(u(n,N,v),u.$i=!0),v},v.locale=b,v.isDayjs=ot,v.unix=function(u){return v(1e3*u)},v.en=R[J],v.Ls=R,v.p={},v})})(St);var kt=St.exports;const st=It(kt);var Pt={exports:{}};(function(s,m){(function(c,o){s.exports=o(kt)})(ft,function(c){function o(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var f=o(c),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(i,l){return l==="W"?i+"周":i+"日"},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(i,l){var a=100*i+l;return a<600?"凌晨":a<900?"早上":a<1100?"上午":a<1300?"中午":a<1800?"下午":"晚上"}};return f.default.locale(g,null,!0),g})})(Pt);const Zt={},Gt={class:"conversation-history-title"};function Kt(s,m){return M(),Y("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:m}){const c=m,o=C(""),f=E(()=>o.value.length!==0),g=d=>{o.value=d.target.value},i=d=>{o.value=d.target.value},l=d=>{d.keyCode===13&&c("search",o.value)},a=()=>{o.value="",c("search",o.value)};return(d,S)=>{const $=dt("icon-search"),k=dt("icon-close");return M(),Y("div",Xt,[w("div",te,[w("div",ee,[O($)]),w("div",ne,[Ht(w("input",{type:"text",class:"search-input",placeholder:d.$t("conversation.search_history"),"onUpdate:modelValue":S[0]||(S[0]=p=>o.value=p),onInput:g,onChange:i,onKeyup:l},null,40,se),[[Yt,o.value]])]),f.value?(M(),Y("div",{key:0,class:"search-input-icon icon-clear",onClick:a},[O(k)])):z("",!0),bt(d.$slots,"default",{},void 0,!0)])])}}},re=Z(oe,[["__scopeId","data-v-f3dff79d"]]);var ae={exports:{}};(function(s,m){(function(c,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(c){var o=["th","st","nd","rd"],f=c%100;return"["+c+(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,m)=>{if(!m)return st(s).format("HH:mm");if(m==="zh")return st(s).locale("zh-cn").format("HH:mm");if(m==="en")return st(s).format("HH:mm")},pt=(s,m)=>m&&m==="zh"?st(s).locale("zh-cn").format("MM-DD"):st(s).format("MM-DD"),_e=s=>{const m=s.agent_id,c="/api/v1/chat/sessions",o={chatId:m};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)=>{At({url:c,method:"get",params:o}).then(i=>{f({code:200,data:i})}).catch(i=>{g(i)})})},he=s=>($t({conversation_ids:[s]}),new Promise((c,o)=>{setTimeout(()=>{c({code:200,data:!0,msg:""})},1e3)})),me={__name:"BtnHistoryItemDelete",props:{target_id:String},emits:["deleteSuccess"],setup(s,{emit:m}){const c=s,o=m,f=Nt();C(1),C("");const g=()=>{const l=f.t("conversation.are_you_sure");f.t("conversation.btn_yes"),f.t("conversation.btn_no"),jt.warning({title:l,hideCancel:!1,"modal-class":"history-chat-remove-modal",onOk(a){},async onBeforeOk(){try{return await i()===200}catch{return!1}},onCancel(){}})},i=()=>new Promise((l,a)=>{he(c.target_id).then(d=>{if(d.code/1===200){const S=f.t("conversation.del_success");ht.success(S),o("deleteSuccess"),l(200)}else ht.warning(d.msg)}).catch(d=>{ht.warning(d.msg),a(d)})});return(l,a)=>{const d=dt("icon-delete");return M(),Y("span",{onClick:g,class:"btn-delete"},[O(d)])}}},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:m}){const c=s,o=m,f=C(!1),g=zt(),i=E(()=>c.history.client_field_content_type==="label"),l=E(()=>c.history.client_field_content_type==="content"),a=E(()=>l.value&&!f.value),d=E(()=>{const p={"conversation-history-item":!0};return p[`item-${c.index}`]=!0,p[`item-${c.history.session_id}`]=!0,p[c.history.client_field_timestamp_type]=!0,i.value&&(p["conversation-history-section-title"]=!0),l.value&&(p["conversation-history-section-data"]=!0),p}),S=E(()=>{const p=c.history.client_field_timestamp_type,L=c.history.create_time,x=g.value;return p==="today"?de(L,x):p==="month"||p==="earlier"?pt(L,x):""}),$=()=>{o("active",c.history.session_id)},k=()=>{f.value=!0};return(p,L)=>(M(),Y(nt,null,[i.value?(M(),Y("div",{key:0,class:_t([d.value,"history-block-title"])},[s.history.client_field_timestamp_type==="today"?(M(),Y(nt,{key:0},[lt(W(p.$t("conversation.history_today")),1)],64)):z("",!0),s.history.client_field_timestamp_type==="month"?(M(),Y(nt,{key:1},[lt(W(p.$t("conversation.history_month")),1)],64)):z("",!0),s.history.client_field_timestamp_type==="earlier"?(M(),Y(nt,{key:2},[lt(W(p.$t("conversation.history_earlier")),1)],64)):z("",!0)],2)):z("",!0),a.value?(M(),Y("div",{key:1,class:_t(d.value)},[w("div",{class:"history-item-icon",onClick:$},[w("img",{src:s.agent_icon},null,8,pe)]),w("div",ve,[w("div",{class:"history-item-intro-title",onClick:$},W(s.history.name),1)]),w("div",ye,[w("span",ge,W(S.value),1),w("span",$e,[O(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:m}){const c=s,o=m,f=E(()=>{const i={"conversation-history-item":!0};return i["load-more"]=!0,i}),g=()=>{c.can_loadmore&&o("loadmore")};return(i,l)=>(M(),Y("div",{class:_t(f.value),onClick:g},[s.can_loadmore?(M(),Y("div",Se,W(i.$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:m}){const c=m,o=E(()=>"conversation-history-list"),f=l=>{c("active",l)},g=l=>{c("delete",l)},i=()=>{c("loadmore")};return(l,a)=>(M(),Y("div",be,[w("div",{class:_t(o.value)},[(M(!0),Y(nt,null,yt(s.list,(d,S)=>(M(),Q(De,{key:d.id,history:d,index:S,agent_icon:s.agent_icon,onActive:$=>f(d),onDelete:g},null,8,["history","index","agent_icon","onActive"]))),128)),O(we,{can_loadmore:s.can_loadmore,onLoadmore:i},null,8,["can_loadmore"])],2)]))}},Ye=Z(He,[["__scopeId","data-v-8e81d4c3"]]);function Ce(s){const m=C(1),c=C(""),o=C([]);Rt();const f=()=>({});return{getAgentList:()=>{const i=f();m.value=2,c.value="",Ft(i).then(l=>{if(l.code/1===200){const a=l.data;a.length!==0&&(a.unshift({id:"",name:"全部",icon:"intelligentFrame1"}),typeof s=="function"&&s(a)),o.value=a,m.value=3,c.value="success"}else m.value=4,c.value=err.message}).catch(l=>{console.log(l),m.value=5,c.value=l.msg})},api_status:m,api_message:c,list_agents:o}}function Le(s){const m=$t(s);Mt.setItem(m)}function vt(){const s=Mt.getItem(),m=Bt(s);return m===null?null:m}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"],Oe={class:"label-text"},Ie={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:m}){const c=s,o=Te(),{api_status:f,list_agents:g,getAgentList:i}=Ce(k=>{var p;if(o.search_type){const L=((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===L){x=q;break}}$(x||k[0])}else $(k[0])}),l=m,a=E(()=>{var k;return((k=o==null?void 0:o.search_type)==null?void 0:k.name)||""}),d=E(()=>o.search_type&&o.search_type.icon?mt(o.search_type.icon):""),S=E(()=>c.list_status===2),$=k=>{o.setType(k),l("typeSelected",k)};return gt(()=>{i()}),(k,p)=>{const L=dt("icon-down"),x=Et,X=Dt,F=Ut,q=qt;return M(),Q(q,{trigger:"hover",defaultValue:a.value},{content:U(()=>[(M(!0),Y(nt,null,yt(it(g),(V,tt)=>(M(),Q(F,{key:V.id,disabled:S.value,value:V.name,onClick:J=>$(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?(M(),Q(x,{key:0,class:"history-type-btn",type:"text"},{default:U(()=>[w("img",{src:d.value,class:"agent-icon-img"},null,8,xe),w("span",Oe,W(a.value),1),w("span",Ie,[O(L,{class:"arrow-down"})])]),_:1})):z("",!0),it(f)===2?(M(),Q(x,{key:1,class:"history-type-btn",type:"text"},{default:U(()=>[O(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:m}){const c=m,o=C(1),f=C(50),g=C(""),i=C(""),l=C(!0),a=C(1),d=C(""),S=C([]),$=C(0),k=C(0),p=C(0),L=C(""),x=le(),F=x-wt-ue;function q(b){b.forEach((v,y)=>{let N=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>=x?($.value===0&&(N={client_field_content_type:"label",client_field_timestamp_type:"today",id:"today"}),I.client_field_timestamp_type="today",I.client_field_content_type="content",$.value=$.value+1):t<x&&t>F?(k.value===0&&(N={client_field_content_type:"label",client_field_timestamp_type:"month",id:"month"}),I.client_field_timestamp_type="month",I.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"}),I.client_field_timestamp_type="earlier",I.client_field_content_type="content",p.value=p.value+1),N&&S.value.push(N),S.value.push(I)})}const V=()=>({search:g.value,page:o.value,per_page:f.value,agent_id:i.value}),tt=()=>{const b=V();a.value=2,d.value="",_e(b).then(v=>{if(v.code/1===200){const N=v.data.rows;N.length<f.value?l.value=!1:l.value=!0,q(N),a.value=3,d.value="success"}else a.value=4,d.value=v.msg}).catch(v=>{a.value=5,d.value=v.message})},J=()=>{a.value!==2&&l.value&&(o.value=o.value+1,tt())},R=b=>{console.log(b),b.event_type!=="complex-chat"&&(i.value=b.chat_id),c("historyActive",{agent_id:i.value,target_id:b.session_id,mode:b.event_type})},ct=b=>{a.value!==2&&(g.value=b,o.value=1,S.value=[],tt())},ot=b=>{a.value!==2&&b&&($.value=0,k.value=0,p.value=0,L.value=mt(b.icon),i.value=b.id,o.value=1,S.value=[],tt())};return gt(()=>{}),(b,v)=>{const y=Dt,N=Jt,I=Wt;return M(),Y("div",Ee,[v[1]||(v[1]=w("div",{class:"conversation-history-left"},null,-1)),w("div",Ve,[O(Qt),O(re,{onSearch:ct},{default:U(()=>[O(Be,{onTypeSelected:ot,list_status:a.value},null,8,["list_status"])]),_:1}),S.value.length!==0?(M(),Q(Ye,{key:0,list:S.value,can_loadmore:l.value,agent_icon:L.value,onLoadmore:J,onActive:R},null,8,["list","can_loadmore","agent_icon"])):z("",!0),a.value===1||a.value===2?(M(),Y("div",We,[O(y,{size:32})])):z("",!0),a.value===3&&S.value.length===0?(M(),Y("div",Fe,[O(N,null,{default:U(()=>[lt(W(b.$t("conversation.history_empty")),1)]),_:1})])):z("",!0),a.value===4?(M(),Y("div",Re,[O(I,{status:"warning",title:d.value},null,8,["title"])])):z("",!0),a.value===5?(M(),Y("div",Ue,[O(I,{status:"error",title:d.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-8e31c3b5"]]),Pe="/assets/history-bg-Cuh6wzmt.png",Hn={__name:"ConversationHistory",setup(s){const m=Lt(),c=Vt(),o=E(()=>c.value==="light"?{backgroundImage:`url(${Pe})`,backgroundRepeat:"no-repeat",backgroundSize:"cover"}:{}),f=({target_id:g,agent_id:i,mode:l})=>{const a={session:g,history:"history"};i&&(a.agent=i),l&&(a.mode=l),m.push({path:"/chat/qa",query:a})};return(g,i)=>(M(),Q(Tt,null,{default:U(()=>[O(xt,{containerStyle:o.value,id:"fjkdsdajfklgjsklfjskdlf"},{default:U(()=>[O(Ot),O(Je,{onHistoryActive:f})]),_:1},8,["containerStyle"])]),_:1}))}};export{Hn as default};
|