UnisKB/static/admin/chat/assets/index-Buc_eEm4.js

2 lines
13 KiB
JavaScript
Raw Normal View History

import{aW as pe,aZ as s,aY as me,aX as P,ba as ve,bb as re,a$ as Y,b0 as o,b1 as c,br as _e,bq as ge,bc as O,b2 as l,b4 as r,b5 as u,b6 as i,b9 as f,b8 as B,bR as ze,a_ as Ke,aT as K,bp as We,cQ as Pe,cR as Ye,bk as W,bd as Be,be as He,bl as Q,b7 as ee,c3 as Fe,cS as Ge,bW as ue,bY as ce,cT as de,b_ as je,bf as qe,bm as Qe,ce as Xe}from"./chat-BQoI2g3l.js";const Ze={class:"single-line"},Je={class:"h-full",style:{padding:"24px 0"}},ea=pe({__name:"ChatRecordDrawer",props:{application:{},chatId:{},currentAbstract:{},next:{},pre:{},pre_disable:{type:Boolean},next_disable:{type:Boolean}},emits:["update:chatId","update:currentAbstract","refresh"],setup($,{expose:ae,emit:F}){const b=s(),L=$,h=F,v=me(),{params:{id:w}}=v,X=P(()=>v.path.includes("resource-management")?"systemManage":"workspace"),S=s(!1),T=s(!1),p=s([]),_=ve({current_page:1,page_size:20,total:0});function I(){p.value=[],_.total=0,_.current_page=1}function H(){return B({type:"chatLog",systemType:X.value}).getChatRecordLog(w,L.chatId,_,S).then(n=>{_.total=n.data.total;const g=n.data.records;p.value=[...g,...p.value].sort((k,C)=>k.create_time.localeCompare(C.create_time)),_.current_page===1&&ze(()=>{b.value.setScrollBottom()})})}re(()=>L.chatId,()=>{p.value=[],_.total=0,_.current_page=1,L.chatId&&H()}),re(T,n=>{n||(h("update:chatId",""),h("update:currentAbstract",""),h("refresh"))});function A(n){if(L.chatId!=="new"&&n.scrollTop===0&&_.total>p.value.length){const g=n.dialogScrollbar.offsetHeight;_.current_page+=1,H().then(()=>{n.scrollDiv.setScrollTop(n.dialogScrollbar.offsetHeight-g)})}}return ae({open:()=>{T.value=!0}}),(n,g)=>{const k=c("AiChat"),C=c("el-button"),d=c("el-drawer"),M=ge("loading");return f(),Y(d,{modelValue:T.value,"onUpdate:modelValue":g[0]||(g[0]=U=>T.value=U),size:"60%",onClose:I,class:"chat-record-drawer"},{header:o(()=>[r("h4",Ze,i($.currentAbstract),1)]),footer:o(()=>[r("div",null,[l(C,{onClick:$.pre,disabled:$.pre_disable||S.value},{default:o(()=>[u(i(n.$t("views.chatLog.buttons.prev")),1)]),_:1},8,["onClick","disabled"]),l(C,{onClick:$.next,disabled:$.next_disable||S.value},{default:o(()=>[u(i(n.$t("views.chatLog.buttons.next")),1)]),_:1},8,["onClick","disabled"])])]),default:o(()=>[_e((f(),O("div",Je,[l(k,{ref_key:"AiChatRef",ref:b,"application-details":$.application,type:"log",record:p.value,onScroll:A},null,8,["application-details","record"])])),[[M,_.current_page===1&&S.value]])]),_:1},8,["modelValue"])}}}),aa={class:"p-16-24"},ta={class:"mb-16"},la={class:"mb-16 flex-between"},oa={class:"flex align-center"},na={class:"flex-between complex-search"},sa={style:{display:"flex","align-items":"center"},class:"float-right"},ia={class:"filter"},ra={class:"form-item mb-16"},ua={class:"form-item mb-16"},ca={class:"text-right"},da={key:0,class:"mr-8"},pa={key:1,class:"mr-8"},ma={key:0},va={key:1,class:"ml-8"},_a={class:"dialog-footer",style:{"margin-top":"16px"}},ga={class:"dialog-footer"},fa=pe({__name:"index",emits:["refresh"],setup($,{emit:ae}){const F=me(),b=P(()=>F.path.includes("resource-management")?"systemManage":"workspace"),L=P(()=>Ke.application[b.value]),{params:{id:h}}=F,v=s("abstract"),w=s({abstract:"",username:""}),X=()=>{w.value={abstract:"",username:""}},S=[{value:7,label:K("views.applicationOverview.monitor.pastDayOptions.past7Days")},{value:30,label:K("views.applicationOverview.monitor.pastDayOptions.past30Days")},{value:90,label:K("views.applicationOverview.monitor.pastDayOptions.past90Days")},{value:183,label:K("views.applicationOverview.monitor.pastDayOptions.past183Days")},{value:"other",label:K("common.custom")}],T=s(""),p=s({start_time:"",end_time:""}),_=s(),I=s([]),H=s(),A=s(!1),Z=s(!1),n=ve({current_page:1,page_size:20,total:0}),g=s(!1),k=s(!1),C=s(180),d=s([]),M=P(()=>d.value.map((e,a)=>({[e.id]:a})).reduce((e,a)=>({...e,...a}),{})),U=s(7),N=s(null),m=s(""),x=s(""),G=s(!1),fe={min_star:0,min_trample:0,comparer:"and"},D=s({min_star:0,min_trample:0,comparer:"and"}),be=e=>e.filter(a=>{if(b.value==="workspace"){if(a.resource_type==="folder")return!0;if(a.resource_type==="knowledge")return ue([ce.WORKSPACE_MANAGE.getWorkspac