2 lines
17 KiB
JavaScript
2 lines
17 KiB
JavaScript
|
|
import{l as je,_ as Fe}from"./vue-draggable-plus-bMgZGhSz.js";import{ay as he,aQ as _e,aO as J,aB as u,aV as ye,aD as d,aE as r,aF as m,aS as z,aG as l,aH as t,cO as He,aI as k,aK as b,aJ as p,aT as j,aP as Pe,b7 as Se,b8 as me,ce as Te,aW as B,b2 as R,b1 as _,cg as Oe,c0 as Ve,aC as T,b3 as fe,cf as Me,aU as Qe,b6 as Je,aX as ge,aY as Ce,aZ as We}from"./admin-DgPvPHD7.js";import{_ as Re}from"./ParagraphDialog.vue_vue_type_script_setup_true_lang-q8AjspD3.js";import{_ as Ie}from"./index.vue_vue_type_script_setup_true_lang-f-C4tYUl.js";import"./ParagraphForm.vue_vue_type_script_setup_true_lang-C1Gb1CJ_.js";import"./AIModeParamSettingDialog.vue_vue_type_script_setup_true_lang-B62TecnF.js";const Xe={class:"dialog-footer"},xe=he({__name:"SelectDocumentDialog",props:{apiType:{}},emits:["refresh"],setup(f,{expose:ne,emit:D}){const A=f,w=_e(),{params:{id:K,documentId:V},query:{from:L,isShared:x}}=w,$=J(()=>x==="true"),F=D,v=u(),H=u({}),C=u(!1),N=u(!1),n=u([]);ye(C,g=>{var h;g||(n.value=[],(h=v.value)==null||h.clearValidate())});const Y=g=>{W(),n.value=g,C.value=!0},G=async()=>{var g;if(await((g=v.value)==null?void 0:g.validate())){const h={id_list:n.value};j({type:"paragraph",systemType:A.apiType}).putMigrateMulParagraph(K,V,v.value.form.knowledge_id,v.value.form.document_id,h,N).then(()=>{F("refresh"),C.value=!1})}};function W(){j({type:"knowledge",systemType:A.apiType,isShared:$.value}).getKnowledgeDetail(K,N).then(g=>{H.value=g.data})}function O(g){localStorage.setItem(K+"chat_dataset_id",g)}function X(g){localStorage.setItem(K+"chat_document_id",g)}return ne({open:Y,dialogVisible:C}),(g,h)=>{const P=d("el-button"),c=d("el-dialog");return r(),m(c,{title:`${g.$t("views.chatLog.selectKnowledge")}/${g.$t("common.fileUpload.document")}`,modelValue:C.value,"onUpdate:modelValue":h[1]||(h[1]=Z=>C.value=Z),width:"500","close-on-click-modal":!1,"close-on-press-escape":!1,onClick:h[2]||(h[2]=z(()=>{},["stop"]))},{footer:l(()=>[k("span",Xe,[t(P,{onClick:h[0]||(h[0]=z(Z=>C.value=!1,["prevent"]))},{default:l(()=>[b(p(g.$t("common.cancel")),1)]),_:1}),t(P,{type:"primary",onClick:G,loading:N.value},{default:l(()=>[b(p(g.$t("views.document.setting.migration")),1)]),_:1},8,["loading"])])]),default:l(()=>[t(He,{ref_key:"SelectKnowledgeDocumentRef",ref:v,apiType:f.apiType,onChangeKnowledge:O,onChangeDocument:X,isApplication:!0,"workspace-id":H.value.workspace_id},null,8,["apiType","workspace-id"])]),_:1},8,["title","modelValue"])}}}),Ye={key:0,class:"mk-sticky"},Ze={class:"mr-8"},ea={class:"mr-8"},aa={class:"w-full flex-between",style:{"line-height":"22px"}},ta={class:"flex align-center"},la={class:"mb-16"},oa=he({__name:"ParagraphCard",props:{data:{},disabled:{type:Boolean},showMoveUp:{type:Boolean},showMoveDown:{type:Boolean}},emits:["dialogVisibleChange","clickCard","changeState","deleteParagraph","refresh","refreshMigrateParagraph","move"],setup(f,{emit:ne}){const D=f,A=_e(),{params:{id:w,documentId:K},query:{from:V,isShared:L}}=A;J(()=>L==="true");const x=J(()=>V),$=J(()=>Pe.knowledge[x.value]),F=o=>$.value.doc_generate(o)||$.value.doc_edit(o),v=ne,H=u(!1),C=u(!1),N=u(!1),n=u(!1);function Y(){N.value=!0,n.value=!1}function G(){N.value=n.value}async function W(o){const i={is_active:!o.is_active};await j({type:"paragraph",systemType:x.value}).putParagraph(w,K,o.id,i,C).then(()=>(v("changeState",o.id),!0)).catch(()=>!1)}const O=u();function X(o){O.value&&O.value.open([o.id],"paragraph",o.id)}function g(o){Ve(`${T("views.paragraph.delete.confirmTitle")} ${o.title||"-"} ?`,T("views.paragraph.delete.confirmMessage"),{confirmButtonText:T("common.confirm"),confirmButtonClass:"danger"}).then(()=>{j({type:"paragraph",systemType:x.value}).delParagraph(w,K,o.id,H).then(()=>{v("deleteParagraph",o.id),fe(T("common.deleteSuccess"))})}).catch(()=>{})}const h=u(),P=u("");function c(o){D.disabled||(P.value=T("views.paragraph.editParagraph"),h.value.open(o,"edit"))}const Z=$.value.doc_edit(w);function M(o){!Z||ie.value||(D.disabled?v("clickCard"):(P.value=T("views.paragraph.paragraphDetail"),h.value.open(o)))}function pe(o){P.value=T("views.paragraph.addPar
|