@gientech/modual 2.3.11 → 2.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{ReviewManage-48WfSH2b.js → ReviewManage-bo3oWSa2.js} +4 -4
- package/assets/index-B3i3ClAr.js +343 -0
- package/assets/index-Bttzd-R0.js +263 -0
- package/assets/{index-C5OVrHqf.js → index-CJfOfBmA.js} +29 -29
- package/assets/{index-BIS6Xs7b.js → index-DDOYnvar.js} +36 -35
- package/assets/style.css +1 -1
- package/assets/style8.css +1 -1
- package/assistantConfig.js +1 -1
- package/chat.js +1 -1
- package/chatCompare.js +1 -1
- package/graphBase.js +1 -1
- package/index.js +1 -1
- package/package.json +3 -3
- package/assets/index-BIl0ZvFZ.js +0 -344
- package/assets/index-DkiaNOyQ.js +0 -263
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import{jsxs as h,jsx as e,Fragment as je}from"react/jsx-runtime";import Ce,{useState as k,createContext as tu,useContext as au,forwardRef as
|
|
1
|
+
import{jsxs as h,jsx as e,Fragment as je}from"react/jsx-runtime";import Ce,{useState as k,createContext as tu,useContext as au,forwardRef as ru,useEffect as j,useMemo as Ee,useImperativeHandle as nu,useRef as Q}from"react";import{Button as te,Form as be,Checkbox as Pe,Input as Ae,Modal as Be,Select as Z,Slider as su,InputNumber as lu,Col as ue,Row as se,Switch as fe,message as _e}from"antd";import{c as we}from"./createLucideIcon-Bj5DlX2s.js";import ou from"axios";import{X as iu}from"./x-CdZQbi--.js";import K from"styled-components";import{S as cu}from"./search-CEuIa9-_.js";import{P as xe}from"./plus-B679mjyt.js";/* empty css *//**
|
|
2
2
|
* @license lucide-react v0.456.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const du=
|
|
6
|
+
*/const du=we("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
7
7
|
* @license lucide-react v0.456.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const Ie=we("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
12
12
|
* @license lucide-react v0.456.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Le=
|
|
16
|
+
*/const Le=we("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
17
17
|
* @license lucide-react v0.456.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Ke=De("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),ke=({title:t,defaultExpanded:a=!0,className:r,children:u})=>{const[m,E]=k(a);return h("div",{className:r,children:[h("div",{className:"flex items-center justify-between",style:{marginBottom:"10px"},children:[h("div",{className:"flex items-center",children:[e("div",{style:{width:"3px",height:"12px",backgroundColor:"#4E6EF2",borderRadius:"6px",marginRight:"6px"}}),e("div",{className:"font-bold",children:t})]}),m?e(Le,{onClick:()=>E(D=>!D),color:"#4E6EF2",size:18}):e($e,{onClick:()=>E(D=>!D),color:"#4E5969",size:18})]}),u?e("div",{style:{display:m?"block":"none"},children:u}):null]})},de=()=>h("div",{className:"w-full h-[80px] rounded-md flex flex-col justify-center items-center",children:[e("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:h("g",{transform:"translate(0 1)",fill:"none","fill-rule":"evenodd",children:[e("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),h("g",{"fill-rule":"nonzero",stroke:"#d9d9d9",children:[e("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),e("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:"#fafafa"})]})]})}),e("div",{children:"\u6682\u65E0\u53EF\u7528\u6A21\u578B"})]}),mu="\u60A8\u597D\uFF01\u6211\u6CE8\u610F\u5230\u60A8\u7684\u6D88\u606F\u4E2D\u53EF\u80FD\u5305\u542B\u4E86\u4E00\u4E9B\u654F\u611F\u7684\u5185\u5BB9\u3002\u4E3A\u4E86\u4FDD\u8BC1\u793E\u533A\u7684\u53CB\u597D\u6C1B\u56F4\uFF0C\u6211\u4EEC\u65E0\u6CD5\u7EE7\u7EED\u5C31\u6B64\u8BDD\u9898\u8FDB\u884C\u8BA8\u8BBA\u3002\u5982\u679C\u60A8\u6709\u5176\u4ED6\u95EE\u9898\u6216\u9700\u8981\u5E2E\u52A9\uFF0C\u6211\u5F88\u4E50\u610F\u7EE7\u7EED\u4E3A\u60A8\u670D\u52A1\uFF01\u8C22\u8C22\u60A8\u7684\u7406\u89E3\u548C\u652F\u6301\u3002",le={top_k:{default:10,min:1,max:15,step:1,tooltip:"top_k\u4EE3\u8868\u6A21\u578B\u6700\u7EC8\u53D6\u4FE1\u7684\u6587\u672C\u5757\u6570\uFF0C\u4F8B\u5982\u95E8\u69DBtop_p = 0.8\uFF0Ctop_k = 3\uFF0C\u610F\u5473\u7740\u6A21\u578B\u4F1A\u4F9D\u636E\u76F8\u4F3C\u5EA6\u9AD8\u4F4E\u53D6\u524D3\u4E2A\u5927\u4E8E0.8\u7684\u6587\u672C\u5757\uFF0C\u5373\u4F7F\u5F53\u524D\u53EF\u80FD\u6709\u5927\u4E8E3\u4E2A\u6587\u672C\u5757\u7684\u76F8\u4F3C\u5EA6\u5927\u4E8E0.8\uFF1B"},max_tokens:{default:4096,min:0,max:1e4,step:64,tooltip:"max_tokens\u4EE3\u8868\u6A21\u578B\u7A97\u53E3\u5927\u5C0F\uFF0C\u5373\u4E00\u6B21\u95EE\u7B54\u5927\u6A21\u578B\u4E00\u6B21\u80FD\u591F\u63A5\u53D7\u7684\u5B57\u7B26\u4E32\u6700\u5927\u957F\u5EA6\uFF0C\u5305\u62EC\u7528\u6237\u7684\u63D0\u95EE\u548C\u6A21\u578B\u7684\u56DE\u7B54\uFF1B\u591A\u8F6E\u5BF9\u8BDD\u4E2D\u5386\u53F2\u5BF9\u8BDD\u5185\u5BB9\u4E5F\u5305\u62EC\u5728\u5185\uFF1B\u6700\u5927\u503C\u53D6\u51B3\u4E8E\u5927\u6A21\u578B\u672C\u8EAB\u662F\u5426\u652F\u6301\uFF1B"},max_round:{default:5,min:0,max:32,step:1,tooltip:"\u4EA4\u4E92\u5BF9\u8BDD\u573A\u666F\u91CC\uFF0C\u7CFB\u7EDF\u80FD\u591F\u8BB0\u5FC6\u5E76\u6709\u6548\u5173\u8054\u7684\u7528\u6237\u4E0E\u6A21\u578B\u4E4B\u95F4\u6765\u56DE\u4EA4\u6D41\u7684\u6700\u5927\u6B21\u6570\uFF1B"},temperature:{default:.3,min:.1,max:1,step:.1,tooltip:"\u6E29\u5EA6\u662F\u6A21\u578B\u56DE\u7B54\u7684\u503E\u5411\u6027\uFF0C\u53D6\u503C\u8303\u56F4\u4E00\u822C\u662F0\uFF5E1; \u53D6\u503C\u8D8B\u8FD10\u4EE3\u8868\u7740\u6A21\u578B\u56DE\u7B54\u4F1A\u66F4\u4E25\u8C28\uFF0C\u9002\u5408\u56DE\u7B54\u68C0\u7D22\u7C7B\u95EE\u9898; \u53D6\u503C\u8D8B\u8FD11\u5219\u4EE3\u8868\u56DE\u7B54\u66F4\u53D1\u6563\uFF0C\u9002\u5408\u56DE\u7B54\u521B\u65B0\u6027\u7684\u95EE\u9898\uFF1B"},top_p:{default:.8,min:.1,max:1,step:.1,tooltip:"top_p \u7528\u4E8E\u63A7\u5236\u5927\u6A21\u578B\u751F\u6210\u7B56\u7565\uFF0C\u51B3\u5B9A\u4E86\u6A21\u578B\u5728\u751F\u6210\u4E0B\u4E00\u4E2A\u8BCD\u65F6\uFF0C\u4ECE\u7D2F\u79EF\u6982\u7387\u8FBE\u5230 p \u7684\u6700\u5C0F\u8BCD\u96C6\u5408\u4E2D\u8FDB\u884C\u91C7\u6837\u3002\u901A\u5E38\u8BBE\u7F6E\u57280.8 - 0.95\u4E4B\u95F4\uFF0Ctop_p\u8D8A\u4F4E\u6A21\u578B\u7528\u8BCD\u8D8A\u4FDD\u5B88\uFF0C\u8D8A\u9AD8\u8D8A\u6D3B\u8DC3\u3002"},score_threshold:{default:.1,min:.1,max:1,step:.1,tooltip:"score_threshold\u53C2\u6570\u662F\u6A21\u578B\u8FDB\u884C\u91CD\u6392\u5E8F\u65F6\uFF0C\u5BF9\u4E8E\u6587\u672C\u5757\u53D6\u820D\u7684\u95E8\u69DB\u503C\uFF1B"}},hu={search_policy:1,enabled_rerank:!0,need_trace_source:!0,trace_by_llm:!0,is_download:!1,dependOnKb:0,enabled_faq:!1,enabled_graph:!1,enabled_question_rewrite:!1,isDefault:0},pe=({url:t,token:a,role:r,eventsEmit:u})=>{const m=ou.create({baseURL:t,timeout:1e6});return m.interceptors.request.use(n=>{let s=a;return!s&&!["user/login","user/kaptcha","user/regist"].some(i=>n.url.includes(i))?(u&&u("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(n.headers.Authorization=s||"",n.headers.userName=r==="\u672A\u767B\u5F55\u7528\u6237"?"":r,n)}),m.interceptors.response.use(n=>{const s=["user/kaptcha"],d=n.data;if(s.some(C=>n.config.url&&n.config.url.includes(C))||d.size&&d.type)return d;const{success:i,errorMsg:N,errorCode:w}=d;if(i)return d;u&&u("request:error_business",{errorCode:w,errorMsg:N||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:d})},n=>{var s,d,i,N,w,C,_,F,y;if(n.message==="canceled")return Promise.reject(n);if(u){let v="request:error_network",A={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:n};((s=n==null?void 0:n.response)==null?void 0:s.status)===401?(v="request:error_auth",A={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:n,redirect:"/login"}):(((i=(d=n==null?void 0:n.response)==null?void 0:d.data)==null?void 0:i.errorCode)==="30013"||((w=(N=n==null?void 0:n.response)==null?void 0:N.data)==null?void 0:w.errorCode)==="30023")&&(v="request:error_business",A={errorCode:(_=(C=n==null?void 0:n.response)==null?void 0:C.data)==null?void 0:_.errorCode,errorMsg:((y=(F=n==null?void 0:n.response)==null?void 0:F.data)==null?void 0:y.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:n}),u(v,A)}return Promise.reject(n)}),{fetchGraphLabel:async n=>{try{const s=await m.get(`/graph/graphdb/labels/${n}`,{}),{success:d,data:i}=s;return d?i:!1}catch(s){console.error("fetchGraphBases",s)}},fetchGraphBases:async()=>{try{const n=await m.post("/graph/graphdb/pageAll",{pageNo:1,pageSize:9999}),{success:s,data:d}=n;return s?d:!1}catch(n){console.error("fetchGraphBases",n)}},getConfigById:async n=>{try{const s=await m.get(`/qa/search/config/getById?configId=${n}`),{success:d,data:i}=s;return d?i:!1}catch(s){console.error("getConfigById",s)}},fetchDatabases:async()=>{try{const n=await m.get("/index/database/queryAllDBList"),{success:s,data:d}=n;return s?d:!1}catch(n){console.error("fetchDatabases",n)}},fetchModels:async n=>{try{const s=await m.get(`/index/modelInfo/allPage?${new URLSearchParams(n).toString()}`),{success:d,data:i}=s;return d?i:!1}catch(s){return console.log("fetchModels error",s),!1}},fetchSensitiveLibrary:async n=>{try{const s=await m.get(`/sensitive/library?${new URLSearchParams(n).toString()}`),{success:d,data:i}=s;return d?i:!1}catch(s){return console.log("fetchSensitiveLibrary error",s),!1}},fetchConfigItemLimit:async()=>{try{const n=await m.get("/qa/search/config/configItemLimit"),{success:s,data:d}=n;return s?d:!1}catch(n){console.error("fetchConfigItemLimit error",n)}},fetchKnowledgeBase:async n=>{try{const s=n?`?userName=${n}`:"";console.log("+++",s);const d=await m.get(`/index/knowledgeBase/searchList${s}`),{success:i,data:N}=d;return i?N:!1}catch(s){console.log("e",s)}},fetchGraphs:async()=>{try{const n=await m.get("/index/graph/platform/querySnapshotList?pageSize=999&pageNo=1"),{success:s,data:d}=n;return s?d:!1}catch(n){console.error("fetchGraphs",n)}},checkName:async(n,s)=>{try{const d=await m.get(`/qa/search/config/checkName?configName=${n}${s?`&configId=${s}`:""}`),{success:i,data:N}=d;if(i)return N}catch(d){return console.log("updateConversationAssistant error:",d),!1}},getBizLabelLabels:async n=>{try{const s=await m.post("/index/bizLabel/labels",n),{success:d,data:i}=s;if(d)return i}catch(s){return console.log("updateConversationAssistant error:",s),!1}},addConversationAssistant:async n=>{try{const s=await m.post("/qa/search/config/add",{...n}),{success:d,data:i}=s;if(d)return i}catch(s){return console.log("addConversationAssistant error:",s),!1}},updateConversationAssistant:async(n,s)=>{try{const d=await m.put("/qa/search/config/update",{id:n,...s}),{success:i,data:N}=d;if(i)return N}catch(d){return console.log("updateConversationAssistant error:",d),!1}}}},Ae=({countText:t,eventsEmit:a,data:r})=>{const[u,m]=k(!0);return h("div",{style:{marginTop:8},children:[t&&h("div",{className:"flex items-center gap-2",children:[e("span",{style:{color:u?"#4E6EF2":"#4E5969"},children:t}),u?e(Le,{onClick:()=>m(E=>!E),color:"#4E6EF2",size:14}):e($e,{onClick:()=>m(E=>!E),color:"#4E5969",size:14})]}),e("div",{style:{display:u?"block":"none"},children:r.map(E=>e(pu,{item:E,eventsEmit:a},E.key))})]})},pu=({item:t,eventsEmit:a})=>{var m,E,D;const[r,u]=k(!0);return h("div",{className:"flex items-center justify-between",style:{padding:"8px 12px",borderRadius:6},children:[h("div",{children:[h("div",{style:{color:"#1D2129"},className:"flex items-center",children:[t.label,((m=t==null?void 0:t.tags)==null?void 0:m.length)>0&&h(je,{children:[h("span",{style:{color:"#4E5969",marginLeft:"6px",marginRight:6},children:["(",(E=t==null?void 0:t.tags)==null?void 0:E.length,"\u4E2A\u6807\u7B7E)"]}),r?e(Le,{onClick:()=>u(p=>!p),color:"#4E6EF2",size:14}):e($e,{onClick:()=>u(p=>!p),color:"#4E5969",size:14})]})]}),((D=t==null?void 0:t.tags)==null?void 0:D.length)>0&&e("div",{className:"flex flex-wrap gap-4",style:{display:r?"block":"none",marginTop:8},children:((t==null?void 0:t.tags)||[]).map(p=>e(te,{iconPosition:"end",type:"text",style:{backgroundColor:"#F0F0F0",padding:"2px 6px",height:22,borderRadius:2,color:"#1D2129",margin:5},icon:e(iu,{size:14,color:"#86909C",onClick:()=>{const f={...t,tags:t.tags.filter(b=>b!==p)};a("removeTag",f)}}),children:p},p))})]}),e(te,{type:"text",icon:e(Ke,{size:14}),onClick:()=>a("removeItem",t)})]},t.key)},O={colors:{primary:"#4E6EF2",secondary:"#6D86F5",success:"#52C41A",warning:"#FAAD14",error:"#F5222D",info:"#1890FF",background:"#F7F8FA",appBackground:"transparent",listBackground:"#F2F3F5",dashboardBackground:"#FFFFFF",text:"#1D2129",textSecondary:"#4E5969",textTertiary:"#86909C",textInverse:"#FFFFFF",border:"#DDE0E5",borderWeak:"#E5E6EB",disabled:"#C9CDD4",disabledBackground:"#F5F7FA",disabledText:"#C9CDD4",shadow:"0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)",primaryHover:"#6D86F5",primaryActive:"#2D4BE0",surfaceSubtle:"#F2F3F5",surfaceSelected:"#EEF3FE",btnPrimaryBg:"#4E6EF2",btnPrimaryBgHover:"#6D86F5",btnPrimaryBgActive:"#2D4BE0",btnPrimaryBgDisabled:"#F5F7FA",btnPrimaryText:"#FFFFFF",btnPrimaryTextDisabled:"#C9CDD4",btnSecondaryText:"#4E6EF2",btnSecondaryTextHover:"#4E6EF2",btnSecondaryTextActive:"#2D4BE0",btnSecondaryTextDisabled:"#C9CDD4",btnSecondaryBg:"#FFFFFF",btnSecondaryBgHover:"#EEF3FE",btnSecondaryBgActive:"#EEF3FE",btnSecondaryBgDisabled:"#F5F7FA",btnSecondaryBorder:"#4E6EF2",btnSecondaryBorderHover:"#6D86F5",btnSecondaryBorderActive:"#2D4BE0",btnSecondaryBorderDisabled:"#E5E6EB",btnTextText:"#4E6EF2",btnTextTextHover:"#6D86F5",btnTextTextActive:"#2D4BE0",btnTextTextDisabled:"#C9CDD4"},space:{sidebar:"260px",size:"12px",radius:"4px",padding:"8px",margin:"8px",shadow:"0 2px 8px rgba(0,0,0,0.1)",lineHeight:"1.5"},fonts:{body:{size:"14px",weight:"normal",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},heading:{size:"16px",weight:"600",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"}},icons:{aiAvatar:"http://10.15.12.13:9000/dev-rag-data/header_pic/JIABINBIN00/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20231212161213.jpg",userAvatar:"http://10.15.12.13:9005/assets/nav-logo-BKaOCDqi.png",pdf:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/pdf-icon.png",word:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/word-icon.png",image:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/image-icon.png",video:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/video-icon.png",audio:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/audio-icon.png",excel:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/excel-icon.png",ppt:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/ppt-icon.png"},others:{baseFontWeight:"normal"}};function Pe(t,a){if(!a)return t;const r={...t,...a};return a.theme&&t.theme&&(r.theme={...t.theme,...a.theme,colors:{...t.theme.colors,...a.theme.colors},space:{...t.theme.space,...a.theme.space},icons:{...t.theme.icons,...a.theme.icons},fonts:{...t.theme.fonts,...a.theme.fonts},others:{...t.theme.others,...a.theme.others}}),r}const fu=tu({theme:O,mode:"light"}),Fu=()=>au(fu),gu=K.div`
|
|
21
|
+
*/const Ke=we("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),ke=({title:t,defaultExpanded:a=!0,className:n,children:u})=>{const[m,E]=k(a);return h("div",{className:n,children:[h("div",{className:"flex items-center justify-between",style:{marginBottom:"10px"},children:[h("div",{className:"flex items-center",children:[e("div",{style:{width:"3px",height:"12px",backgroundColor:"#4E6EF2",borderRadius:"6px",marginRight:"6px"}}),e("div",{className:"font-bold",children:t})]}),m?e(Le,{onClick:()=>E(w=>!w),color:"#4E6EF2",size:18}):e(Ie,{onClick:()=>E(w=>!w),color:"#4E5969",size:18})]}),u?e("div",{style:{display:m?"block":"none"},children:u}):null]})},de=()=>h("div",{className:"w-full h-[80px] rounded-md flex flex-col justify-center items-center",children:[e("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:h("g",{transform:"translate(0 1)",fill:"none","fill-rule":"evenodd",children:[e("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),h("g",{"fill-rule":"nonzero",stroke:"#d9d9d9",children:[e("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),e("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:"#fafafa"})]})]})}),e("div",{children:"\u6682\u65E0\u53EF\u7528\u6A21\u578B"})]}),mu="\u60A8\u597D\uFF01\u6211\u6CE8\u610F\u5230\u60A8\u7684\u6D88\u606F\u4E2D\u53EF\u80FD\u5305\u542B\u4E86\u4E00\u4E9B\u654F\u611F\u7684\u5185\u5BB9\u3002\u4E3A\u4E86\u4FDD\u8BC1\u793E\u533A\u7684\u53CB\u597D\u6C1B\u56F4\uFF0C\u6211\u4EEC\u65E0\u6CD5\u7EE7\u7EED\u5C31\u6B64\u8BDD\u9898\u8FDB\u884C\u8BA8\u8BBA\u3002\u5982\u679C\u60A8\u6709\u5176\u4ED6\u95EE\u9898\u6216\u9700\u8981\u5E2E\u52A9\uFF0C\u6211\u5F88\u4E50\u610F\u7EE7\u7EED\u4E3A\u60A8\u670D\u52A1\uFF01\u8C22\u8C22\u60A8\u7684\u7406\u89E3\u548C\u652F\u6301\u3002",le={top_k:{default:10,min:1,max:15,step:1,tooltip:"top_k\u4EE3\u8868\u6A21\u578B\u6700\u7EC8\u53D6\u4FE1\u7684\u6587\u672C\u5757\u6570\uFF0C\u4F8B\u5982\u95E8\u69DBtop_p = 0.8\uFF0Ctop_k = 3\uFF0C\u610F\u5473\u7740\u6A21\u578B\u4F1A\u4F9D\u636E\u76F8\u4F3C\u5EA6\u9AD8\u4F4E\u53D6\u524D3\u4E2A\u5927\u4E8E0.8\u7684\u6587\u672C\u5757\uFF0C\u5373\u4F7F\u5F53\u524D\u53EF\u80FD\u6709\u5927\u4E8E3\u4E2A\u6587\u672C\u5757\u7684\u76F8\u4F3C\u5EA6\u5927\u4E8E0.8\uFF1B"},max_tokens:{default:4096,min:0,max:1e4,step:64,tooltip:"max_tokens\u4EE3\u8868\u6A21\u578B\u7A97\u53E3\u5927\u5C0F\uFF0C\u5373\u4E00\u6B21\u95EE\u7B54\u5927\u6A21\u578B\u4E00\u6B21\u80FD\u591F\u63A5\u53D7\u7684\u5B57\u7B26\u4E32\u6700\u5927\u957F\u5EA6\uFF0C\u5305\u62EC\u7528\u6237\u7684\u63D0\u95EE\u548C\u6A21\u578B\u7684\u56DE\u7B54\uFF1B\u591A\u8F6E\u5BF9\u8BDD\u4E2D\u5386\u53F2\u5BF9\u8BDD\u5185\u5BB9\u4E5F\u5305\u62EC\u5728\u5185\uFF1B\u6700\u5927\u503C\u53D6\u51B3\u4E8E\u5927\u6A21\u578B\u672C\u8EAB\u662F\u5426\u652F\u6301\uFF1B"},max_round:{default:5,min:0,max:32,step:1,tooltip:"\u4EA4\u4E92\u5BF9\u8BDD\u573A\u666F\u91CC\uFF0C\u7CFB\u7EDF\u80FD\u591F\u8BB0\u5FC6\u5E76\u6709\u6548\u5173\u8054\u7684\u7528\u6237\u4E0E\u6A21\u578B\u4E4B\u95F4\u6765\u56DE\u4EA4\u6D41\u7684\u6700\u5927\u6B21\u6570\uFF1B"},temperature:{default:.3,min:.1,max:1,step:.1,tooltip:"\u6E29\u5EA6\u662F\u6A21\u578B\u56DE\u7B54\u7684\u503E\u5411\u6027\uFF0C\u53D6\u503C\u8303\u56F4\u4E00\u822C\u662F0\uFF5E1; \u53D6\u503C\u8D8B\u8FD10\u4EE3\u8868\u7740\u6A21\u578B\u56DE\u7B54\u4F1A\u66F4\u4E25\u8C28\uFF0C\u9002\u5408\u56DE\u7B54\u68C0\u7D22\u7C7B\u95EE\u9898; \u53D6\u503C\u8D8B\u8FD11\u5219\u4EE3\u8868\u56DE\u7B54\u66F4\u53D1\u6563\uFF0C\u9002\u5408\u56DE\u7B54\u521B\u65B0\u6027\u7684\u95EE\u9898\uFF1B"},top_p:{default:.8,min:.1,max:1,step:.1,tooltip:"top_p \u7528\u4E8E\u63A7\u5236\u5927\u6A21\u578B\u751F\u6210\u7B56\u7565\uFF0C\u51B3\u5B9A\u4E86\u6A21\u578B\u5728\u751F\u6210\u4E0B\u4E00\u4E2A\u8BCD\u65F6\uFF0C\u4ECE\u7D2F\u79EF\u6982\u7387\u8FBE\u5230 p \u7684\u6700\u5C0F\u8BCD\u96C6\u5408\u4E2D\u8FDB\u884C\u91C7\u6837\u3002\u901A\u5E38\u8BBE\u7F6E\u57280.8 - 0.95\u4E4B\u95F4\uFF0Ctop_p\u8D8A\u4F4E\u6A21\u578B\u7528\u8BCD\u8D8A\u4FDD\u5B88\uFF0C\u8D8A\u9AD8\u8D8A\u6D3B\u8DC3\u3002"},score_threshold:{default:.1,min:.1,max:1,step:.1,tooltip:"score_threshold\u53C2\u6570\u662F\u6A21\u578B\u8FDB\u884C\u91CD\u6392\u5E8F\u65F6\uFF0C\u5BF9\u4E8E\u6587\u672C\u5757\u53D6\u820D\u7684\u95E8\u69DB\u503C\uFF1B"}},hu={search_policy:1,enabled_rerank:!0,need_trace_source:!0,trace_by_llm:!0,is_download:!1,dependOnKb:0,enabled_faq:!1,enabled_graph:!1,enabled_question_rewrite:!1,isDefault:0},pe=({url:t,token:a,role:n,eventsEmit:u})=>{const m=ou.create({baseURL:t,timeout:1e6});return m.interceptors.request.use(r=>{let s=a;return!s&&!["user/login","user/kaptcha","user/regist"].some(i=>r.url.includes(i))?(u&&u("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(r.headers.Authorization=s||"",r.headers.userName=n==="\u672A\u767B\u5F55\u7528\u6237"?"":n,r)}),m.interceptors.response.use(r=>{const s=["user/kaptcha"],d=r.data;if(s.some(C=>r.config.url&&r.config.url.includes(C))||d.size&&d.type)return d;const{success:i,errorMsg:M,errorCode:D}=d;if(i)return d;u&&u("request:error_business",{errorCode:D,errorMsg:M||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:d})},r=>{var s,d,i,M,D,C,_,g,x;if(r.message==="canceled")return Promise.reject(r);if(u){let v="request:error_network",y={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:r};((s=r==null?void 0:r.response)==null?void 0:s.status)===401?(v="request:error_auth",y={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:r,redirect:"/login"}):(((i=(d=r==null?void 0:r.response)==null?void 0:d.data)==null?void 0:i.errorCode)==="30013"||((D=(M=r==null?void 0:r.response)==null?void 0:M.data)==null?void 0:D.errorCode)==="30023")&&(v="request:error_business",y={errorCode:(_=(C=r==null?void 0:r.response)==null?void 0:C.data)==null?void 0:_.errorCode,errorMsg:((x=(g=r==null?void 0:r.response)==null?void 0:g.data)==null?void 0:x.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:r}),u(v,y)}return Promise.reject(r)}),{fetchGraphLabel:async r=>{try{const s=await m.get(`/graph/graphdb/labels/${r}`,{}),{success:d,data:i}=s;return d?i:!1}catch(s){console.error("fetchGraphBases",s)}},fetchGraphBases:async()=>{try{const r=await m.post("/graph/graphdb/pageAll",{pageNo:1,pageSize:9999}),{success:s,data:d}=r;return s?d:!1}catch(r){console.error("fetchGraphBases",r)}},getConfigById:async r=>{try{const s=await m.get(`/qa/search/config/getById?configId=${r}`),{success:d,data:i}=s;return d?i:!1}catch(s){console.error("getConfigById",s)}},fetchDatabases:async()=>{try{const r=await m.get("/index/database/queryAllDBList"),{success:s,data:d}=r;return s?d:!1}catch(r){console.error("fetchDatabases",r)}},fetchModels:async r=>{try{const s=await m.get(`/index/modelInfo/allPage?${new URLSearchParams(r).toString()}`),{success:d,data:i}=s;return d?i:!1}catch(s){return console.log("fetchModels error",s),!1}},fetchSensitiveLibrary:async r=>{try{const s=await m.get(`/sensitive/library?${new URLSearchParams(r).toString()}`),{success:d,data:i}=s;return d?i:!1}catch(s){return console.log("fetchSensitiveLibrary error",s),!1}},fetchConfigItemLimit:async()=>{try{const r=await m.get("/qa/search/config/configItemLimit"),{success:s,data:d}=r;return s?d:!1}catch(r){console.error("fetchConfigItemLimit error",r)}},fetchKnowledgeBase:async r=>{try{const s=r?`?userName=${r}`:"";console.log("+++",s);const d=await m.get(`/index/knowledgeBase/searchList${s}`),{success:i,data:M}=d;return i?M:!1}catch(s){console.log("e",s)}},fetchGraphs:async()=>{try{const r=await m.get("/index/graph/platform/querySnapshotList?pageSize=999&pageNo=1"),{success:s,data:d}=r;return s?d:!1}catch(r){console.error("fetchGraphs",r)}},checkName:async(r,s)=>{try{const d=await m.get(`/qa/search/config/checkName?configName=${r}${s?`&configId=${s}`:""}`),{success:i,data:M}=d;if(i)return M}catch(d){return console.log("updateConversationAssistant error:",d),!1}},getBizLabelLabels:async r=>{try{const s=await m.post("/index/bizLabel/labels",r),{success:d,data:i}=s;if(d)return i}catch(s){return console.log("updateConversationAssistant error:",s),!1}},addConversationAssistant:async r=>{try{const s=await m.post("/qa/search/config/add",{...r}),{success:d,data:i}=s;if(d)return i}catch(s){return console.log("addConversationAssistant error:",s),!1}},updateConversationAssistant:async(r,s)=>{try{const d=await m.put("/qa/search/config/update",{id:r,...s}),{success:i,data:M}=d;if(i)return M}catch(d){return console.log("updateConversationAssistant error:",d),!1}}}},ye=({countText:t,eventsEmit:a,data:n})=>{const[u,m]=k(!0);return h("div",{style:{marginTop:8},children:[t&&h("div",{className:"flex items-center gap-2",children:[e("span",{style:{color:u?"#4E6EF2":"#4E5969"},children:t}),u?e(Le,{onClick:()=>m(E=>!E),color:"#4E6EF2",size:14}):e(Ie,{onClick:()=>m(E=>!E),color:"#4E5969",size:14})]}),e("div",{style:{display:u?"block":"none"},children:n.map(E=>e(pu,{item:E,eventsEmit:a},E.key))})]})},pu=({item:t,eventsEmit:a})=>{var m,E,w;const[n,u]=k(!0);return h("div",{className:"flex items-center justify-between",style:{padding:"8px 12px",borderRadius:6},children:[h("div",{children:[h("div",{style:{color:"#1D2129"},className:"flex items-center",children:[t.label,((m=t==null?void 0:t.tags)==null?void 0:m.length)>0&&h(je,{children:[h("span",{style:{color:"#4E5969",marginLeft:"6px",marginRight:6},children:["(",(E=t==null?void 0:t.tags)==null?void 0:E.length,"\u4E2A\u6807\u7B7E)"]}),n?e(Le,{onClick:()=>u(p=>!p),color:"#4E6EF2",size:14}):e(Ie,{onClick:()=>u(p=>!p),color:"#4E5969",size:14})]})]}),((w=t==null?void 0:t.tags)==null?void 0:w.length)>0&&e("div",{className:"flex flex-wrap gap-4",style:{display:n?"block":"none",marginTop:8},children:((t==null?void 0:t.tags)||[]).map(p=>e(te,{iconPosition:"end",type:"text",style:{backgroundColor:"#F0F0F0",padding:"2px 6px",height:22,borderRadius:2,color:"#1D2129",margin:5},icon:e(iu,{size:14,color:"#86909C",onClick:()=>{const F={...t,tags:t.tags.filter(B=>B!==p)};a("removeTag",F)}}),children:p},p))})]}),e(te,{type:"text",icon:e(Ke,{size:14}),onClick:()=>a("removeItem",t)})]},t.key)},O={colors:{primary:"#4E6EF2",secondary:"#6D86F5",success:"#52C41A",warning:"#FAAD14",error:"#F5222D",info:"#1890FF",background:"#F7F8FA",appBackground:"transparent",listBackground:"#F2F3F5",dashboardBackground:"#FFFFFF",dashboardMainBackground:"transparent",text:"#1D2129",textSecondary:"#4E5969",textTertiary:"#86909C",textInverse:"#FFFFFF",border:"#DDE0E5",borderWeak:"#E5E6EB",disabled:"#C9CDD4",disabledBackground:"#F5F7FA",disabledText:"#C9CDD4",shadow:"0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)",primaryHover:"#6D86F5",primaryActive:"#2D4BE0",surfaceSubtle:"#F2F3F5",surfaceSelected:"#EEF3FE",btnPrimaryBg:"#4E6EF2",btnPrimaryBgHover:"#6D86F5",btnPrimaryBgActive:"#2D4BE0",btnPrimaryBgDisabled:"#F5F7FA",btnPrimaryText:"#FFFFFF",btnPrimaryTextDisabled:"#C9CDD4",btnSecondaryText:"#4E6EF2",btnSecondaryTextHover:"#4E6EF2",btnSecondaryTextActive:"#2D4BE0",btnSecondaryTextDisabled:"#C9CDD4",btnSecondaryBg:"#FFFFFF",btnSecondaryBgHover:"#EEF3FE",btnSecondaryBgActive:"#EEF3FE",btnSecondaryBgDisabled:"#F5F7FA",btnSecondaryBorder:"#4E6EF2",btnSecondaryBorderHover:"#6D86F5",btnSecondaryBorderActive:"#2D4BE0",btnSecondaryBorderDisabled:"#E5E6EB",btnTextText:"#4E6EF2",btnTextTextHover:"#6D86F5",btnTextTextActive:"#2D4BE0",btnTextTextDisabled:"#C9CDD4",tableBackground:"#FFFFFF",tableHeaderBg:"#F5F7FA",tableHeaderText:"#1D2129",tableHeaderDividerColor:"#E5E7EB",tableRowDividerColor:"#E5E7EB",tableFirstColumnBg:"#F7F9FC",tableLastColumnBg:"#F7F9FC",subTableBackground:"#F5F7FA",subTableHeaderBg:"#F5F7FA",tablePaginationDividerColor:"#E5E7EB",subTablePaginationDividerColor:"#E5E7EB",paginationBackground:"#FFFFFF",tagColor:"#1d70f5",tagBackground:"#ebf6ff",tagBorder:"#99caff",xviewerCardBorder:"#e5e6eb",xviewerCardBackground:"#FFFFFF",xviewerCardShadow:"0 2px 12px 0 rgba(0,0,0,0.07)",xviewerCardTitleColor:"#222222",xviewerCardDescBg:"#f9fafb",xviewerCardDescText:"#888888",xviewerCardMetaText:"#666666",tableActionText:"#1D4ED8",tableActionTextHover:"#1E40AF",dropdownBackground:"#FFFFFF",dropdownBorder:"#DEE2E6",dropdownShadow:"0 1px 3px rgba(0, 0, 0, 0.12)",xviewerCardMoreBackground:"#FFFFFF",xviewerCardMoreText:"#222222",xviewerCardMoreBorder:"#E5E7EB",xviewerCardMoreShadow:"0 2px 8px 0 rgba(0,0,0,0.08)",xviewerCardMoreDivider:"#F3F4F6",xviewerCardMoreItemHoverBg:"#F5F5F5"},space:{sidebar:"260px",size:"12px",radius:"4px",padding:"8px",margin:"8px",shadow:"0 2px 8px rgba(0,0,0,0.1)",lineHeight:"1.5",dashboardHeaderHeight:"38px",dashboardHeaderPadding:"0 0 8px 0",dashboardContentRadius:"4px",xviewerToolbarHeight:"52px",tableHeaderPadding:"0.5rem 0.75rem",tableHeaderDividerWidth:"1px",xviewerTabsGap:"8px",xviewerTabsPadding:"0px 0px 4px",xviewerCardsColumnGap:24,xviewerCardsRowGap:24,xviewerCardsPadding:"16px",subTableWrapperPadding:"8px",subTableInnerPadding:"0px 8px",tableRowHeight:"44px",subTableRowHeight:"40px",xviewerCardPadding:"18px 20px 16px 20px",xviewerCardContentGap:"4px",xviewerCardHeaderGap:"10px",xviewerCardHeaderRowGap:"12px",xviewerCardIconSize:"32px",xviewerCardHeaderMarginBottom:"6px",xviewerCardDescMinHeight:"45px",xviewerCardDescPadding:"6px 8px",xviewerCardDescRadius:"4px",xviewerCardActionsMarginTop:"12px",xviewerCardActionsGap:"8px",tableActionFontSize:"12px",dropdownItemGap:"4px",dropdownPadding:"4px 0",dropdownItemPadding:"8px 12px",xviewerCardMorePadding:"4px 0",xviewerCardMoreItemPadding:"4px 12px",xviewerCardMoreWidth:"128px",xviewerCardMoreOffsetX:"0px",xviewerCardMoreOffsetY:"0px",xviewerCardMoreIconPadding:"0px",xviewerFuzzySearchWidth:"200px",xviewerFuzzySearchHeight:"36px",chatMobilePadding:"16px",chatMobileHeaderHeight:"48px",chatMobileSenderMinHeight:"120px",bottomSheetRadius:"16px",bottomSheetHandleHeight:"4px"},fonts:{body:{size:"14px",weight:"normal",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},heading:{size:"16px",weight:"600",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},xs:{size:"10px",weight:"400",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},sm:{size:"12px",weight:"400",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},md:{size:"14px",weight:"400",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},lg:{size:"16px",weight:"400",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},"2lg":{size:"24px",weight:"400",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"}},icons:{aiAvatar:"http://10.15.12.13:9000/dev-rag-data/header_pic/JIABINBIN00/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20231212161213.jpg",userAvatar:"http://10.15.12.13:9005/assets/nav-logo-BKaOCDqi.png",pdf:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/pdf-icon.png",word:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/word-icon.png",image:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/image-icon.png",video:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/video-icon.png",audio:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/audio-icon.png",excel:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/excel-icon.png",ppt:"https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/ppt-icon.png"},others:{baseFontWeight:"normal"}};function Te(t,a){if(!a)return t;const n={...t,...a};return a.theme&&t.theme&&(n.theme={...t.theme,...a.theme,colors:{...t.theme.colors,...a.theme.colors},space:{...t.theme.space,...a.theme.space},icons:{...t.theme.icons,...a.theme.icons},fonts:{...t.theme.fonts,...a.theme.fonts},others:{...t.theme.others,...a.theme.others}}),n}const Fu=tu({theme:O,mode:"light"}),gu=()=>au(Fu),fu=K.div`
|
|
22
22
|
display: flex;
|
|
23
23
|
background-color: #ffffff;
|
|
24
|
-
border: 1px solid ${t=>{var a,
|
|
25
|
-
border-radius: ${t=>{var a,
|
|
24
|
+
border: 1px solid ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.border)==null?void 0:u.default)||"#e5e7eb"}};
|
|
25
|
+
border-radius: ${t=>{var a,n;return((n=(a=t.$theme)==null?void 0:a.space)==null?void 0:n.radius)||"8px"}};
|
|
26
26
|
overflow: hidden;
|
|
27
27
|
width: ${t=>t.$width||"600px"};
|
|
28
28
|
height: ${t=>t.$height||"400px"};
|
|
29
29
|
position: relative;
|
|
30
|
-
|
|
30
|
+
`,$e=K.div`
|
|
31
31
|
display: flex;
|
|
32
32
|
flex-direction: column;
|
|
33
|
-
border-right: 1px solid ${t=>{var a,
|
|
33
|
+
border-right: 1px solid ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.border)==null?void 0:u.default)||"#e5e7eb"}};
|
|
34
34
|
overflow: hidden;
|
|
35
35
|
|
|
36
36
|
&:last-child {
|
|
@@ -43,32 +43,32 @@ import{jsxs as h,jsx as e,Fragment as je}from"react/jsx-runtime";import Ce,{useS
|
|
|
43
43
|
display: flex;
|
|
44
44
|
align-items: center;
|
|
45
45
|
justify-content: space-between;
|
|
46
|
-
color: ${t=>{var a,
|
|
46
|
+
color: ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.text)==null?void 0:u.primary)||"#4E5969"}};
|
|
47
47
|
`,Cu=K.div`
|
|
48
48
|
font-weight: 400;
|
|
49
49
|
font-size: 14px;
|
|
50
|
-
color: ${t=>{var a,
|
|
51
|
-
`,
|
|
50
|
+
color: ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.text)==null?void 0:u.primary)||"#4E6EF2"}};
|
|
51
|
+
`,bu=K.div`
|
|
52
52
|
padding: 12px;
|
|
53
|
-
background-color: ${t=>{var a,
|
|
54
|
-
`,
|
|
53
|
+
background-color: ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.background)==null?void 0:u.default)||"#ffffff"}};
|
|
54
|
+
`,Bu=K.input`
|
|
55
55
|
width: 100%;
|
|
56
56
|
padding: 8px 12px 8px 12px;
|
|
57
|
-
border: 1px solid ${t=>{var a,
|
|
58
|
-
border-radius: ${t=>{var a,
|
|
57
|
+
border: 1px solid ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.border)==null?void 0:u.default)||"#e5e7eb"}};
|
|
58
|
+
border-radius: ${t=>{var a,n;return((n=(a=t.$theme)==null?void 0:a.space)==null?void 0:n.radius)||"6px"}};
|
|
59
59
|
font-size: 14px;
|
|
60
60
|
outline: none;
|
|
61
61
|
transition: all 0.2s;
|
|
62
62
|
|
|
63
63
|
&:focus {
|
|
64
|
-
border-color: ${t=>{var a,
|
|
65
|
-
box-shadow: 0 0 0 3px ${t=>{var a,
|
|
64
|
+
border-color: ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.primary)==null?void 0:u.default)||"#3b82f6"}};
|
|
65
|
+
box-shadow: 0 0 0 3px ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.primary)==null?void 0:u.default)||"#3b82f6"}}20;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
&::placeholder {
|
|
69
|
-
color: ${t=>{var a,
|
|
69
|
+
color: ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.text)==null?void 0:u.tertiary)||"#9ca3af"}};
|
|
70
70
|
}
|
|
71
|
-
`,
|
|
71
|
+
`,xu=K.div`
|
|
72
72
|
position: absolute;
|
|
73
73
|
right: 20px;
|
|
74
74
|
top: 50%;
|
|
@@ -106,16 +106,16 @@ import{jsxs as h,jsx as e,Fragment as je}from"react/jsx-runtime";import Ce,{useS
|
|
|
106
106
|
opacity: ${t=>t.$disabled?.5:1};
|
|
107
107
|
|
|
108
108
|
&:hover {
|
|
109
|
-
background-color: ${t=>{var a,
|
|
109
|
+
background-color: ${t=>{var a,n,u;return t.$disabled?"transparent":((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.background)==null?void 0:u.hover)||"#f3f4f6"}};
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
&:last-child {
|
|
113
113
|
border-bottom: none;
|
|
114
114
|
}
|
|
115
|
-
`,
|
|
115
|
+
`,He=K.span`
|
|
116
116
|
flex: 1;
|
|
117
117
|
font-size: 14px;
|
|
118
|
-
color: ${t=>{var a,
|
|
118
|
+
color: ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.text)==null?void 0:u.primary)||"#111827"}};
|
|
119
119
|
overflow: hidden;
|
|
120
120
|
text-overflow: ellipsis;
|
|
121
121
|
white-space: nowrap;
|
|
@@ -129,17 +129,17 @@ import{jsxs as h,jsx as e,Fragment as je}from"react/jsx-runtime";import Ce,{useS
|
|
|
129
129
|
border-radius: 4px;
|
|
130
130
|
cursor: pointer;
|
|
131
131
|
font-size: 12px;
|
|
132
|
-
color: ${t=>{var a,
|
|
132
|
+
color: ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.text)==null?void 0:u.secondary)||"#1D2129"}};
|
|
133
133
|
transition: all 0.2s;
|
|
134
134
|
|
|
135
135
|
&:disabled {
|
|
136
136
|
cursor: not-allowed;
|
|
137
|
-
color: ${t=>{var a,
|
|
137
|
+
color: ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.text)==null?void 0:u.secondary)||"#C9CDD4"}};
|
|
138
138
|
}
|
|
139
|
-
`,
|
|
139
|
+
`,qe=K.div`
|
|
140
140
|
padding: 40px 20px;
|
|
141
141
|
text-align: center;
|
|
142
|
-
color: ${t=>{var a,
|
|
142
|
+
color: ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.text)==null?void 0:u.tertiary)||"#9ca3af"}};
|
|
143
143
|
font-size: 14px;
|
|
144
144
|
`;K.span`
|
|
145
145
|
display: inline-flex;
|
|
@@ -148,10 +148,10 @@ import{jsxs as h,jsx as e,Fragment as je}from"react/jsx-runtime";import Ce,{useS
|
|
|
148
148
|
min-width: 20px;
|
|
149
149
|
height: 20px;
|
|
150
150
|
padding: 0 6px;
|
|
151
|
-
background-color: ${t=>{var a,
|
|
151
|
+
background-color: ${t=>{var a,n,u;return((u=(n=(a=t.$theme)==null?void 0:a.colors)==null?void 0:n.primary)==null?void 0:u.default)||"#3b82f6"}};
|
|
152
152
|
color: white;
|
|
153
153
|
border-radius: 10px;
|
|
154
154
|
font-size: 12px;
|
|
155
155
|
font-weight: 500;
|
|
156
156
|
margin-left: 8px;
|
|
157
|
-
`;const fe=nu(({dataSource:t,value:a=[],onConfirm:r,maxCount:u=0,searchPlaceholder:m="\u641C\u7D22...",title:E="",showSearch:D=!0,filterOption:p,renderItem:f,renderSelectedItem:b,className:T,style:M,styles:l,height:q,width:S},B)=>{const H=Fu(),o=Pe(Pe({theme:O,mode:"light"},H),l),[n,s]=k(a),[d,i]=k("");j(()=>{s(a)},[a]),Ee(()=>new Set(a.map(c=>c.key)),[a]);const N=Ee(()=>new Set(n.map(c=>c.key)),[n]);ru(B,()=>({getSelectedItems:()=>n,confirm:()=>{r==null||r(n)}}),[n,r]);const C=p||((c,x)=>{var V;if(!c)return!0;const I=c.toLowerCase();return x.label.toLowerCase().includes(I)||((V=x.tags)==null?void 0:V.some(W=>W.toLowerCase().includes(I)))||!1}),_=Ee(()=>(t||[]).filter(c=>C(d,c)),[t,d,C]),F=c=>{const x=N.has(c.key);let I;if(x)I=(n||[]).filter(V=>V.key!==c.key);else{if(u>0&&n.length>=u)return;I=[...n,c]}s(I)},y=(c,x)=>{s(I=>I.map(W=>W.key==c?{...W,tags:x}:W))},v=c=>{const x=(n||[]).filter(I=>I.key!==c.key);s(x)},A=c=>N.has(c);return u>0&&n.length>=u,h(gu,{$theme:o.theme||O,$width:S,$height:q,className:T,style:M,children:[h(Te,{$theme:o.theme||O,style:{flex:1},children:[D&&e(Bu,{$theme:o.theme||O,children:h("div",{style:{position:"relative"},children:[e(yu,{children:e(cu,{size:16})}),e(bu,{$theme:o.theme||O,type:"text",placeholder:m,value:d,onChange:c=>i(c.target.value)})]})}),e(ze,{children:_.length===0?e(He,{$theme:o.theme||O,children:d?"\u672A\u627E\u5230\u5339\u914D\u9879":"\u6682\u65E0\u6570\u636E"}):_.map(c=>{const x=A(c.key);return h(Re,{$theme:o.theme||O,$selected:x,children:[e(qe,{$theme:o.theme||O,children:f?f(c):c.label}),x&&e(Oe,{$theme:o.theme||O,onClick:I=>{I.stopPropagation(),v(c)},disabled:!0,children:"\u5DF2\u6DFB\u52A0"}),!x&&e(Oe,{$theme:o.theme||O,onClick:I=>{I.stopPropagation(),F(c)},children:"\u6DFB\u52A0"})]},c.key)})})]}),h(Te,{$theme:o.theme||O,style:{flex:1},children:[h(Eu,{$theme:o.theme||O,children:[u>0?`\u5DF2\u9009\uFF1A${n.length}/${u}\u4E2A${E}`:`\u5DF2\u9009\uFF1A${n.length}\u4E2A${E}`,e(Cu,{$theme:o.theme||O,onClick:c=>{c.stopPropagation(),s([])},children:"\u6E05\u7A7A"})]}),e(ze,{children:n.length===0?e(He,{$theme:o.theme||O,children:"\u6682\u65E0\u5DF2\u9009\u9879"}):n.map(c=>{var I,V,W;const x=ae=>y(c.key,ae);return h(Re,{$theme:o.theme||O,children:[e(qe,{$theme:o.theme||O,children:b?b(c,x):c.label}),e(Ke,{size:14,color:((W=(V=(I=o.theme)==null?void 0:I.colors)==null?void 0:V.text)==null?void 0:W.secondary)||"#86909C",style:{cursor:"pointer"},onClick:ae=>{ae.stopPropagation(),v(c)}})]},c.key)})})]})]})});fe.displayName="SearchableSelector";const Se="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='2.22222'%20fill='%23FFCC3C'/%3e%3cpath%20d='M13.3263%2012.7917H7.53763C7.33426%2012.8116%207.17923%2012.9825%207.17923%2013.1867C7.17923%2013.3909%207.33426%2013.5618%207.53763%2013.5817H13.3277C13.3828%2013.5871%2013.4384%2013.5809%2013.4909%2013.5634C13.5435%2013.546%2013.5918%2013.5178%2013.6328%2013.4806C13.6738%2013.4434%2013.7066%2013.3981%2013.729%2013.3474C13.7514%2013.2968%2013.763%2013.2421%2013.763%2013.1867C13.763%2013.1313%2013.7514%2013.0766%2013.729%2013.026C13.7066%2012.9753%2013.6738%2012.93%2013.6328%2012.8928C13.5918%2012.8556%2013.5435%2012.8274%2013.4909%2012.8099C13.4384%2012.7925%2013.3828%2012.7863%2013.3277%2012.7917H13.3263ZM9.19742%207.60418L8.84232%208.55193H9.57339L9.19742%207.60418Z'%20fill='white'/%3e%3cpath%20d='M15.3211%2014.7707V6.9692H14.4704V14.3543H6.70511C6.06668%2014.3392%205.55704%2013.8173%205.55704%2013.1788C5.55704%2012.5402%206.06668%2012.0184%206.70511%2012.0033H13.352C13.4644%2012.0075%2013.5735%2011.9648%2013.653%2011.8852C13.6923%2011.8459%2013.7231%2011.7988%2013.7434%2011.747C13.7638%2011.6952%2013.7731%2011.6398%2013.771%2011.5842V5.20102C13.7736%205.14526%2013.7646%205.08958%2013.7445%205.03752C13.7244%204.98546%2013.6936%204.93816%2013.6542%204.89865C13.6148%204.85915%2013.5675%204.82832%2013.5155%204.80812C13.4634%204.78792%2013.4077%204.7788%2013.352%204.78134H6.70511C5.60281%204.80136%204.71609%205.69369%204.70291%206.79599V13.1759C4.71609%2014.283%205.61038%2015.1773%206.71756%2015.1905H14.8893C15.0042%2015.1994%2015.1173%2015.1585%2015.1999%2015.0782C15.2407%2015.0385%2015.2727%2014.9905%2015.2936%2014.9375C15.3145%2014.8845%2015.3239%2014.8276%2015.3211%2014.7707ZM8.98782%206.78585H9.44888L10.7213%209.92562H10.2475L9.9075%209.06759H8.51871L8.19742%209.92562H7.72354L8.98782%206.78585Z'%20fill='white'/%3e%3c/svg%3e",{Item:Au}=Be,xu=({url:t,token:a,role:r,eventsEmit:u,sectionData:m,defaultAnswer:E,form:D})=>{const[p,f]=k([]),[b,T]=k([]),[M,l]=k(!1),[q,S]=k(!1),B=J(null),{fetchSensitiveLibrary:H}=pe({url:t,token:a,role:r,eventsEmit:u});j(()=>{o()},[]),j(()=>{if(m&&(p==null?void 0:p.length)>0){let i=m?Array.isArray(m)?m:m.split(","):[],N=[];i.forEach(w=>{const C=(p||[]).find(_=>_.key===w);C&&N.push({key:C.key,label:C.label})}),T(N)}},[m,p]),j(()=>{E&&S(!0)},[E]);const o=async()=>{try{const i=await H({pageNo:1,pageSize:9999});if(i!=null&&i.records){const N=((i==null?void 0:i.records)||[]).map(w=>({key:w.id+"",label:w.name}));f(N)}}catch(i){console.error(i)}},n=(i,N)=>{switch(i){case"removeItem":const w=b.filter(C=>C.key!==N.key);T([...w]),s(w);break}},s=i=>{const N=i.map(w=>(w==null?void 0:w.key)||"").filter(w=>w).join(",");u&&u("sensitive_selected",N)},d=()=>{var N;const i=((N=B.current)==null?void 0:N.getSelectedItems())||[];T(i),l(!1),s(i)};return h("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[h("div",{className:"flex items-center justify-between",children:[h("div",{className:"flex items-center",children:[e("img",{src:Se}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u654F\u611F\u8BCD"})]}),e(te,{color:"primary",variant:"outlined",size:"small",icon:e(ye,{size:14}),onClick:()=>l(!0),children:"\u6DFB\u52A0"})]}),e(Ie,{checked:q,onChange:i=>{S(i.target.checked),i.target.checked?D.setFieldsValue({defaultAnswer:mu}):D.setFieldsValue({defaultAnswer:""})},style:{marginBottom:8,marginTop:8},children:"\u81EA\u5B9A\u4E49\u56DE\u590D"}),q&&e(Au,{label:"\u81EA\u5B9A\u4E49\u56DE\u590D\u5185\u5BB9",name:"defaultAnswer",layout:"vertical",children:e(xe.TextArea,{style:{height:"55px",resize:"none"}})}),(b==null?void 0:b.length)>0&&e(Ae,{countText:(b==null?void 0:b.length)>0?`\u5DF2\u9009\uFF1A${b==null?void 0:b.length}\u4E2A\u654F\u611F\u8BCD\u5E93`:void 0,eventsEmit:n,data:b}),e(be,{width:740,title:"\u9009\u62E9\u654F\u611F\u8BCD",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:M,onOk:d,onCancel:()=>l(!1),destroyOnHidden:!0,className:"assistant-config-resource-bind-modal",children:e(fe,{ref:B,dataSource:p,value:b,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u654F\u611F\u8BCD\u5E93",renderItem:i=>h("div",{className:"flex ",children:[e("img",{src:Se,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:i.label,children:i.label})]}),renderSelectedItem:(i,N)=>h("div",{className:"flex items-center",children:[e("img",{src:Se,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:i.label})})]})})})]})},Ne="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='2.22222'%20fill='%2300B2F9'/%3e%3cpath%20d='M5.3125%2013.9672V13.975C5.32812%2014.6938%205.89922%2015.2734%206.61875%2015.2734H13.9062C14.3375%2015.2734%2014.6875%2014.9289%2014.6875%2014.4977V5.50703C14.6875%205.40447%2014.6673%205.30292%2014.628%205.20818C14.5887%205.11344%2014.5312%205.02736%2014.4586%204.95488C14.3861%204.8824%2014.2999%204.82492%2014.2052%204.78575C14.1104%204.74657%2014.0088%204.72646%2013.9062%204.72656H6.875C6.01172%204.72656%205.3125%205.42031%205.3125%206.28359V13.9672ZM7.5%209.24531V6.25C7.5%206.07813%207.64062%205.9375%207.8125%205.9375H9.6875C9.86016%205.9375%2010%206.07813%2010%206.25V9.24531C10%209.30716%209.98175%209.36762%209.94741%209.41906C9.91308%209.47049%209.86425%209.51058%209.80712%209.53426C9.74999%209.55793%209.68712%209.56412%209.62647%209.55204C9.56581%209.53996%209.51011%209.51016%209.46641%209.46641L8.97109%208.97109C8.94207%208.94204%208.90761%208.91899%208.86967%208.90326C8.83173%208.88754%208.79107%208.87944%208.75%208.87944C8.70893%208.87944%208.66827%208.88754%208.63033%208.90326C8.59239%208.91899%208.55793%208.94204%208.52891%208.97109L8.03359%209.46641C7.98989%209.51016%207.93418%209.53996%207.87353%209.55204C7.81288%209.56412%207.75001%209.55793%207.69288%209.53426C7.63575%209.51058%207.58692%209.47049%207.55259%209.41906C7.51825%209.36762%207.49995%209.30716%207.5%209.24531ZM6.54375%2014.2063C6.45208%2014.1156%206.40625%2014.0052%206.40625%2013.875C6.40625%2013.7458%206.45208%2013.6354%206.54375%2013.5438C6.6349%2013.4521%206.74531%2013.4062%206.875%2013.4062H13.5938V14.3438H6.875C6.74531%2014.3438%206.6349%2014.2979%206.54375%2014.2063Z'%20fill='white'/%3e%3c/svg%3e",vu=({url:t,token:a,role:r,sectionData:u,createBy:m,eventsEmit:E})=>{const[D,p]=k(),[f,b]=k([]),[T,M]=k(!1),l=J(null),[q,S]=k(!1),[B,H]=k([]),o=J(new Map).current,{fetchKnowledgeBase:n,getBizLabelLabels:s}=pe({url:t,token:a,role:r,eventsEmit:E}),d=J(!1);j(()=>{d.current||(m?(i(m),d.current=!0):(i(),d.current=!0))},[m]),j(()=>{if(u&&(D==null?void 0:D.length)>0){const F=u==null?void 0:u.knowledge_base_name_source,y=F&&(Array.isArray(F)?F:F.split(";"));let v=[];(y||[]).forEach(A=>{const c=((u==null?void 0:u.selectedKnowledgeBase)||[]).find(I=>I.name==A),x=(D||[]).find(I=>I.knowledge_base_name_source===A);if(x){const{key:I,label:V,knowledge_base_name:W,knowledge_base_name_source:ae}=x;v.push({key:I,label:V,knowledge_base_name:W,knowledge_base_name_source:ae,tags:c==null?void 0:c.labels})}}),b(v)}},[u,D]);const i=async F=>{try{const y=await n(F);if(y){const v=(y||[]).map(A=>({key:A.id,label:A.kbName,knowledge_base_name:A.primitiveName,knowledge_base_name_source:A.kbName}));p(v)}}catch(y){console.error(y)}},N=(F,y)=>{switch(F){case"removeItem":const v=f.filter(c=>c.key!==y.key);b([...v]),w(v);break;case"removeTag":const A=f.findIndex(c=>c.key==y.key);A!==-1&&(f[A]=y),b([...f]),w(f);break}},w=F=>{const y=(F||[]).map(c=>(c==null?void 0:c.knowledge_base_name)||"").filter(c=>c).join(";"),v=(F||[]).map(c=>(c==null?void 0:c.knowledge_base_name_source)||"").filter(c=>c).join(";"),A=(F||[]).filter(c=>{var x;return Array.isArray(c==null?void 0:c.tags)&&((x=c.tags)==null?void 0:x.length)>0}).map(c=>({id:c.key,name:c.label,knowledge_base_name_source:c.knowledge_base_name,labels:c.tags}));E&&E("knowledge_selected",{knowledge_base_name:y,knowledge_base_name_source:v,selectedKnowledgeBase:A})},C=()=>{var y;const F=((y=l.current)==null?void 0:y.getSelectedItems())||[];b(F),M(!1),w(F)},_=async(F,y)=>{if(F){const v=o.get(y);if(v){H(v);return}if(!q)try{S(!0);const A=await s({kbNames:[y]});if(Array.isArray(A)){const c=A.length?A[0].label:"",x=c?(c||"").split(",").map(I=>({label:I,value:I})):[];o.set(y,x),H(x)}S(!1)}catch(A){console.error("Error fetching data:",A),S(!1)}}};return h("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[h("div",{className:"flex items-center justify-between",children:[h("div",{className:"flex items-center",children:[e("img",{src:Ne}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u77E5\u8BC6\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(te,{color:"primary",variant:"outlined",size:"small",icon:e(ye,{size:14}),onClick:()=>M(!0),children:"\u6DFB\u52A0"})})]}),(f==null?void 0:f.length)>0&&e(Ae,{countText:(f==null?void 0:f.length)>0?`\u5DF2\u9009\uFF1A${f==null?void 0:f.length}\u4E2A\u77E5\u8BC6\u5E93`:void 0,eventsEmit:N,data:f}),e(be,{width:740,className:"assistant-config-resource-bind-modal",title:"\u9009\u62E9\u77E5\u8BC6\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:T,onOk:C,onCancel:()=>M(!1),destroyOnHidden:!0,children:e(fe,{ref:l,dataSource:D,value:f,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u77E5\u8BC6\u5E93",renderItem:F=>h("div",{className:"flex ",children:[e("img",{src:Ne,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:F.label,children:F.label})]}),renderSelectedItem:(F,y)=>h("div",{className:"flex ",children:[e("img",{src:Ne,alt:"add"}),h("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:F.label}),e(Q,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:F.tags||[],onChange:v=>{y(v)},style:{width:250},options:B,loading:q,onOpenChange:v=>{_(v,F.knowledge_base_name)}})]})]})})})]})},Du=Ce.memo(vu),Me="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='3.55556'%20fill='%23925BFF'/%3e%3cpath%20d='M11.9971%2011.265C15.249%2011.265%2017.8891%2010.443%2017.8891%209.423V7.95288C17.8891%206.93291%2015.2492%206.11084%2011.9971%206.11084C8.74513%206.11084%206.10504%206.93276%206.10504%207.95288V9.42285C6.10504%2010.437%208.73898%2011.265%2011.9971%2011.265Z'%20fill='white'/%3e%3cpath%20d='M11.9971%2014.577C15.249%2014.577%2017.8891%2013.7551%2017.8891%2012.7349V10.527C17.8891%2011.5469%2015.2492%2012.369%2011.9971%2012.369C8.74513%2012.369%206.10504%2011.5471%206.10504%2010.527V12.7349C6.10504%2013.749%208.73898%2014.577%2011.9971%2014.577Z'%20fill='white'/%3e%3cpath%20d='M11.9971%2015.681C8.7451%2015.681%206.11102%2014.859%206.11102%2013.839V16.0469C6.11102%2017.0609%208.74496%2017.889%2012.0031%2017.889C15.255%2017.889%2017.8951%2017.0671%2017.8951%2016.0469V13.8391C17.889%2014.859%2015.249%2015.681%2011.9971%2015.681Z'%20fill='white'/%3e%3c/svg%3e",Ve=10,wu=({url:t,token:a,role:r,eventsEmit:u,sectionData:m,disabled:E})=>{const[D,p]=k([]),[f,b]=k([]),[T,M]=k(!1),l=J(null),{fetchDatabases:q}=pe({url:t,token:a,role:r,eventsEmit:u});j(()=>{S()},[]),j(()=>{if(m){let o=[];(m||[]).map(n=>{const s=(D||[]).find(d=>d.key===n.key);if(s){const{key:d,label:i}=s;o.push({key:d,label:i})}}),b(o)}},[m,D]);const S=async()=>{try{const o=await q();if(o){const n=(o||[]).map(s=>({key:s.primitiveName,label:s.name}));p(n)}}catch(o){console.error(o)}},B=(o,n)=>{switch(o){case"removeItem":const s=f.filter(d=>d.key!==n.key);b([...s]),u&&u("database_selected",s);break}},H=()=>{var n;const o=((n=l.current)==null?void 0:n.getSelectedItems())||[];b(o),M(!1),u&&u("database_selected",o)};return h("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[h("div",{className:"flex items-center justify-between",children:[h("div",{className:"flex items-center",children:[e("img",{src:Me}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u6570\u636E\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(te,{color:"primary",variant:"outlined",size:"small",icon:e(ye,{size:14}),onClick:()=>M(!0),disabled:f.length>=Ve||E,children:"\u6DFB\u52A0"})})]}),(f==null?void 0:f.length)>0&&e(Ae,{countText:(f==null?void 0:f.length)>0?`\u5DF2\u9009\uFF1A${f==null?void 0:f.length}\u4E2A\u6570\u636E\u5E93`:void 0,eventsEmit:B,data:f}),e(be,{width:740,title:"\u9009\u62E9\u6570\u636E\u5E93",className:"assistant-config-resource-bind-modal",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:T,onOk:H,onCancel:()=>M(!1),destroyOnHidden:!0,children:e(fe,{ref:l,dataSource:D,value:f,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u6570\u636E\u5E93",maxCount:Ve,renderItem:o=>h("div",{className:"flex ",children:[e("img",{src:Me,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o.label,children:o.label})]}),renderSelectedItem:(o,n)=>h("div",{className:"flex items-center",children:[e("img",{src:Me,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:o.label})})]})})})]})},he="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='3.55556'%20fill='%2300C1B8'/%3e%3cpath%20d='M17.9887%2012.582C18.1207%2013.6621%2017.2267%2014.5801%2016.1526%2014.4901C15.3306%2014.4181%2014.6645%2013.7521%2014.6045%2012.924C14.5745%2012.558%2014.6645%2012.21%2014.8445%2011.9159C14.9285%2011.7779%2014.9045%2011.6039%2014.8025%2011.4899L14.3885%2011.0339C14.2805%2010.9139%2014.1005%2010.8839%2013.9565%2010.9559C13.6144%2011.1239%2013.2304%2011.2199%2012.8224%2011.2199C12.6244%2011.2199%2012.4324%2011.1959%2012.2464%2011.1539C12.0963%2011.1179%2011.9463%2011.1779%2011.8563%2011.3039L11.2803%2012.1259C11.1783%2012.276%2011.1963%2012.474%2011.3223%2012.606C11.8983%2013.188%2012.2464%2013.9921%2012.2284%2014.8741C12.1924%2016.4702%2010.9203%2017.7963%209.32417%2017.9043C7.45804%2018.0243%205.90994%2016.4942%206.00595%2014.6281C6.08995%2013.038%207.38604%2011.7599%208.97614%2011.6879C9.42017%2011.6699%209.8402%2011.7419%2010.2302%2011.8919C10.3922%2011.9519%2010.5722%2011.8979%2010.6743%2011.7599L11.1663%2011.0579C11.2743%2010.9019%2011.2503%2010.6919%2011.1123%2010.5658C10.5302%2010.0498%2010.1882%209.26976%2010.2662%208.4177C10.3742%207.18162%2011.3823%206.18556%2012.6244%206.09555C14.1245%205.98154%2015.3846%207.17562%2015.3846%208.65172C15.3846%209.20376%2015.2106%209.70779%2014.9105%2010.1278C14.8085%2010.2658%2014.8205%2010.4578%2014.9345%2010.5898L15.3786%2011.0819C15.4746%2011.1899%2015.6306%2011.2259%2015.7626%2011.1779C16.0086%2011.0939%2016.2786%2011.0639%2016.5606%2011.1119C17.3047%2011.2259%2017.8987%2011.8319%2017.9887%2012.582Z'%20fill='white'/%3e%3c/svg%3e",_u=({url:t,token:a,role:r,eventsEmit:u,sectionData:m})=>{const[E,D]=k([]),[p,f]=k([]),[b,T]=k(!1),M=J(null),{fetchGraphs:l}=pe({url:t,token:a,role:r,eventsEmit:u});j(()=>{q()},[]),j(()=>{if(m){let o=[];(m||[]).map(n=>{const s=(E||[]).find(d=>d.key===n.index_name);if(s){const{key:d,label:i}=s;o.push({key:d,label:i})}}),f(o)}},[m,E]);const q=async()=>{try{const o=await l();if(o!=null&&o.dataList){const n=((o==null?void 0:o.dataList)||[]).map(s=>({key:s.schemaId,label:s.name}));D(n)}}catch(o){console.error(o)}},S=(o,n)=>{switch(o){case"removeItem":const s=p.filter(d=>d.key!==n.key);f([...s]),B(s);break}},B=o=>{const n=(o||[]).map(s=>({graph_name:s.label,index_name:s.key}));u&&u("graph_selected",n)},H=()=>{var n;const o=((n=M.current)==null?void 0:n.getSelectedItems())||[];f(o),T(!1),B(o)};return h("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[h("div",{className:"flex items-center justify-between",children:[h("div",{className:"flex items-center",children:[e("img",{src:he}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(te,{color:"primary",variant:"outlined",size:"small",icon:e(ye,{size:14}),onClick:()=>T(!0),children:"\u6DFB\u52A0"})})]}),(p==null?void 0:p.length)>0&&e(Ae,{countText:(p==null?void 0:p.length)>0?`\u5DF2\u9009\uFF1A${p==null?void 0:p.length}\u4E2A\u56FE\u8C31`:void 0,eventsEmit:S,data:p}),e(be,{width:740,title:"\u9009\u62E9\u56FE\u8C31",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",className:"assistant-config-resource-bind-modal",open:b,onOk:H,destroyOnHidden:!0,onCancel:()=>T(!1),children:e(fe,{ref:M,dataSource:E,value:p,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31",renderItem:o=>h("div",{className:"flex ",children:[e("img",{src:he,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o.label,children:o.label})]}),renderSelectedItem:o=>h("div",{className:"flex items-center",children:[e("img",{src:he,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:o.label})})]})})})]})},ku=({value:t,onChange:a,min:r,max:u,step:m,disabled:E,sliderStyle:D,inputStyle:p,inputWidth:f=90})=>{const b=M=>{const l=Array.isArray(M)?M[0]:M;a==null||a(l)},T=M=>{a==null||a(M)};return h("div",{className:"w-full flex overflow-x-auto",children:[e(su,{min:r,max:u,step:m,disabled:E,value:t,onChange:b,style:{width:"200px",...D}}),e(lu,{min:r,max:u,step:m,disabled:E,controls:!1,value:t,onChange:T,style:{width:f,marginLeft:"10px",...p}})]})},ve={header:{titleEdit:"\u7F16\u8F91\u4F1A\u8BDD\u52A9\u624B",titleNew:"\u65B0\u5EFA\u4F1A\u8BDD\u52A9\u624B",confirm:"\u786E\u5B9A"},form:{labels:{assistantName:"\u52A9\u624B\u540D\u79F0",qaModel:"\u95EE\u7B54\u6A21\u578B",planModel:"\u89C4\u5212\u6A21\u578B",multiModel:"\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B",rerankModel:"Rerank\u6A21\u578B",embeddingModel:"\u5411\u91CF\u89E3\u6790\u6A21\u578B",prologue:"\u5F00\u573A\u767D",systemPrompt:"\u63D0\u793A\u8BCD",defaultAssistant:"\u9009\u62E9\u4E3A\u9ED8\u8BA4\u52A9\u624B",recommendModel:"\u95EE\u9898\u63A8\u8350\u6A21\u578B",searchPolicy:"\u68C0\u7D22\u7B56\u7565",temperature:"\u6E29\u5EA6",diversity:"\u591A\u6837\u6027",topK:"\u53EC\u56DE\u6570",scoreThreshold:"\u76F8\u4F3C\u5EA6\u9608\u503C",maxTokens:"\u6700\u5927\u4EE4\u724C\u6570",maxRound:"\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570",enabledFaq:"\u5F00\u542FFAQ\u4F18\u5148",enabledGraph:"\u542F\u7528\u56FE\u8C31\u589E\u5F3A",dependOnKb:"\u5F00\u542F\u5F3A\u4F01\u4E1A\u77E5\u8BC6\u4F9D\u8D56",questionRewrite:"\u5F00\u542F\u95EE\u9898\u6539\u5199",traceSource:"\u5F00\u542F\u6EAF\u6E90",traceStrategy:"\u6EAF\u6E90\u7B56\u7565",allowDownloadTrace:"\u5141\u8BB8\u4E0B\u8F7D\u6EAF\u6E90\u6587\u4EF6"},placeholders:{input:"\u8BF7\u8F93\u5165",select:"\u8BF7\u9009\u62E9",prologue:"\u8BF7\u8F93\u5165\u5F00\u573A\u767D",promptExample:"\u4F8B\u5982\uFF1A"},validation:{assistantNameRequired:"\u8BF7\u8F93\u5165\u52A9\u624B\u540D\u79F0",nameDuplicate:"\u540D\u79F0\u91CD\u590D\uFF01",nameDuplicateShort:"\u540D\u79F0\u91CD\u590D",selectModel:"\u8BF7\u9009\u62E9{{model}}",noModelAvailable:"\u6682\u65E0\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458",modelUnavailable:"\u6A21\u578B\u65E0\u6CD5\u4F7F\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458",validNumberRequired:"\u8BF7\u8F93\u5165\u6709\u6548\u6570\u5B57",numbersOnly:"\u53EA\u80FD\u8F93\u5165\u6570\u5B57",numberRange:"\u8BF7\u8F93\u5165{{min}}\u5230{{max}}\u4E4B\u95F4\u7684\u6570\u5B57"}},paragraph:{retrievalParams:"\u68C0\u7D22\u4E0E\u751F\u6210\u53C2\u6570",featureSwitch:"\u529F\u80FD\u5F00\u5173",resourceBind:"\u8D44\u6E90\u7ED1\u5B9A"},searchPolicyOptions:[{label:"\u6DF7\u5408\u68C0\u7D22",value:1},{label:"\u5168\u6587\u68C0\u7D22",value:2},{label:"\u8BED\u4E49\u68C0\u7D22",value:3}],traceabilityStrategy:[{label:"\u89C4\u5219\u6EAF\u6E90",value:!1},{label:"\u5927\u6A21\u578B\u6EAF\u6E90",value:!0}],explanation:{prompt:"\u63D0\u793A\u8BCD\u7528\u4E8E\u6307\u5B9A\u804A\u5929\u7684\u80CC\u666F\u548C\u4E0A\u4E0B\u6587\uFF0C\u6216\u8005\u8BA9\u52A9\u624B\u91C7\u53D6\u67D0\u4E2A\u4EBA\u683C\u6765\u56DE\u7B54\u4F60\u7684\u95EE\u9898\uFF1B",dependOnKb:"\u5F00\u5173\u5F00\u542F\uFF0C\u5219\u82E5\u7CFB\u7EDF\u672A\u5728\u77E5\u8BC6\u5E93\u3001\u6570\u636E\u5E93\u7B49\u4F01\u4E1A\u77E5\u8BC6\u6570\u636E\u8303\u56F4\u5185\u68C0\u7D22\u5230\u7B54\u6848\uFF0C\u5219\u76F4\u63A5\u62D2\u7EDD\u56DE\u7B54\u76F8\u5173\u95EE\u9898\uFF1B"},defaultPrompt:'\u4F60\u662F\u4E00\u4E2A\u667A\u80FD\u52A9\u624B\uFF0C\u8BF7\u603B\u7ED3\u77E5\u8BC6\u5E93\u7684\u5185\u5BB9\u6765\u56DE\u7B54\u95EE\u9898,\u8BF7\u5217\u4E3E\u77E5\u8BC6\u5E93\u4E2D\u7684\u6570\u636E\u8BE6\u7EC6\u56DE\u7B54\u3002\u5F53\u6240\u6709\u77E5\u8BC6\u5E93\u5185\u5BB9\u90FD\u4E0E\u95EE\u9898\u65E0\u5173\u65F6\uFF0C\u4F60\u7684\u56DE\u7B54\u5FC5\u987B\u5305\u62EC"\u77E5\u8BC6\u5E93\u4E2D\u672A\u627E\u5230\u60A8\u8981\u7684\u7B54\u6848!"',message:{updateSuccess:"\u66F4\u65B0\u52A9\u624B\u914D\u7F6E\u6210\u529F",createSuccess:"\u65B0\u589E\u52A9\u624B\u914D\u7F6E\u6210\u529F"},paramsValidation:{validNumberRequired:"\u8BF7\u8F93\u5165\u6709\u6548\u6570\u5B57",numbersOnly:"\u53EA\u80FD\u8F93\u5165\u6570\u5B57",numberRange:"\u8BF7\u8F93\u5165{{min}}\u5230{{max}}\u4E4B\u95F4\u7684\u6570\u5B57"}},Su={header:{titleEdit:"Edit session assistant",titleNew:"New session assistant",confirm:"Confirm"},form:{labels:{assistantName:"Assistant name",qaModel:"QA model",planModel:"Planning model",multiModel:"Upload document QA multimodal model",rerankModel:"Rerank model",embeddingModel:"Embedding model",prologue:"Prologue",systemPrompt:"System prompt",defaultAssistant:"Set as default assistant",recommendModel:"Question recommendation model",searchPolicy:"Search policy",temperature:"Temperature",diversity:"Diversity",topK:"Top K",scoreThreshold:"Score threshold",maxTokens:"Max tokens",maxRound:"Max conversation rounds",enabledFaq:"Enable FAQ priority",enabledGraph:"Enable graph enhancement",dependOnKb:"Enable strong enterprise knowledge dependency",questionRewrite:"Enable question rewriting",traceSource:"Enable traceability",traceStrategy:"Traceability strategy",allowDownloadTrace:"Allow downloading trace files"},placeholders:{input:"Please enter",select:"Please select",prologue:"Enter prologue",promptExample:"e.g. "},validation:{assistantNameRequired:"Please enter assistant name",nameDuplicate:"Name already exists!",nameDuplicateShort:"Duplicate name",selectModel:"Please select {{model}}",noModelAvailable:"No models available. Contact administrator.",modelUnavailable:"Model unavailable. Contact administrator.",validNumberRequired:"Please enter a valid number",numbersOnly:"Numbers only",numberRange:"Please enter a number between {{min}} and {{max}}"}},paragraph:{retrievalParams:"Retrieval & generation parameters",featureSwitch:"Feature switches",resourceBind:"Resource binding"},searchPolicyOptions:[{label:"Hybrid search",value:1},{label:"Full-text search",value:2},{label:"Semantic search",value:3}],traceabilityStrategy:[{label:"Rule-based traceability",value:!1},{label:"LLM-based traceability",value:!0}],explanation:{prompt:"The prompt defines the chat context and persona for the assistant;",dependOnKb:"When enabled, the assistant will refuse to answer if no relevant content is found in knowledge bases or databases."},defaultPrompt:'You are a helpful assistant. Summarize knowledge base content to answer questions. When content is irrelevant, include "Knowledge base does not contain the answer!" in your response.',message:{updateSuccess:"Assistant config updated",createSuccess:"Assistant config created"},paramsValidation:{validNumberRequired:"Please enter a valid number",numbersOnly:"Numbers only",numberRange:"Please enter a number between {{min}} and {{max}}"}},Nu={header:{titleEdit:"\u30BB\u30C3\u30B7\u30E7\u30F3\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u3092\u7DE8\u96C6",titleNew:"\u65B0\u898F\u30BB\u30C3\u30B7\u30E7\u30F3\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8",confirm:"\u78BA\u5B9A"},form:{labels:{assistantName:"\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u540D",qaModel:"QA\u30E2\u30C7\u30EB",planModel:"\u8A08\u753B\u30E2\u30C7\u30EB",multiModel:"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8QA\u30DE\u30EB\u30C1\u30E2\u30FC\u30C0\u30EB\u30E2\u30C7\u30EB",rerankModel:"Rerank\u30E2\u30C7\u30EB",embeddingModel:"\u57CB\u3081\u8FBC\u307F\u30E2\u30C7\u30EB",prologue:"\u30D7\u30ED\u30ED\u30FC\u30B0",systemPrompt:"\u30B7\u30B9\u30C6\u30E0\u30D7\u30ED\u30F3\u30D7\u30C8",defaultAssistant:"\u30C7\u30D5\u30A9\u30EB\u30C8\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u306B\u3059\u308B",recommendModel:"\u8CEA\u554F\u63A8\u85A6\u30E2\u30C7\u30EB",searchPolicy:"\u691C\u7D22\u6226\u7565",temperature:"\u6E29\u5EA6",diversity:"\u591A\u69D8\u6027",topK:"\u30C8\u30C3\u30D7K",scoreThreshold:"\u30B9\u30B3\u30A2\u95BE\u5024",maxTokens:"\u6700\u5927\u30C8\u30FC\u30AF\u30F3\u6570",maxRound:"\u6700\u5927\u4F1A\u8A71\u30BF\u30FC\u30F3\u6570",enabledFaq:"FAQ\u512A\u5148\u3092\u6709\u52B9\u5316",enabledGraph:"\u30B0\u30E9\u30D5\u5897\u5F37\u3092\u6709\u52B9\u5316",dependOnKb:"\u4F01\u696D\u30CA\u30EC\u30C3\u30B8\u5F37\u4F9D\u5B58\u3092\u6709\u52B9\u5316",questionRewrite:"\u8CEA\u554F\u66F8\u304D\u63DB\u3048\u3092\u6709\u52B9\u5316",traceSource:"\u30C8\u30EC\u30FC\u30B5\u30D3\u30EA\u30C6\u30A3\u3092\u6709\u52B9\u5316",traceStrategy:"\u30C8\u30EC\u30FC\u30B5\u30D3\u30EA\u30C6\u30A3\u6226\u7565",allowDownloadTrace:"\u30C8\u30EC\u30FC\u30B9\u30D5\u30A1\u30A4\u30EB\u306E\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3092\u8A31\u53EF"},placeholders:{input:"\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",select:"\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",prologue:"\u30D7\u30ED\u30ED\u30FC\u30B0\u3092\u5165\u529B",promptExample:"\u4F8B\uFF1A"},validation:{assistantNameRequired:"\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u540D\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",nameDuplicate:"\u540D\u524D\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\uFF01",nameDuplicateShort:"\u540D\u524D\u91CD\u8907",selectModel:"{{model}}\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",noModelAvailable:"\u5229\u7528\u53EF\u80FD\u306A\u30E2\u30C7\u30EB\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u7BA1\u7406\u8005\u306B\u304A\u554F\u3044\u5408\u308F\u305B\u304F\u3060\u3055\u3044\u3002",modelUnavailable:"\u30E2\u30C7\u30EB\u304C\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002\u7BA1\u7406\u8005\u306B\u304A\u554F\u3044\u5408\u308F\u305B\u304F\u3060\u3055\u3044\u3002",validNumberRequired:"\u6709\u52B9\u306A\u6570\u5024\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",numbersOnly:"\u6570\u5B57\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059",numberRange:"{{min}}\u304B\u3089{{max}}\u306E\u6570\u5024\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}},paragraph:{retrievalParams:"\u691C\u7D22\u30FB\u751F\u6210\u30D1\u30E9\u30E1\u30FC\u30BF",featureSwitch:"\u6A5F\u80FD\u30B9\u30A4\u30C3\u30C1",resourceBind:"\u30EA\u30BD\u30FC\u30B9\u30D0\u30A4\u30F3\u30C9"},searchPolicyOptions:[{label:"\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9\u691C\u7D22",value:1},{label:"\u5168\u6587\u691C\u7D22",value:2},{label:"\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u691C\u7D22",value:3}],traceabilityStrategy:[{label:"\u30EB\u30FC\u30EB\u30D9\u30FC\u30B9",value:!1},{label:"LLM\u30D9\u30FC\u30B9",value:!0}],explanation:{prompt:"\u30D7\u30ED\u30F3\u30D7\u30C8\u306F\u30C1\u30E3\u30C3\u30C8\u306E\u80CC\u666F\u3068\u6587\u8108\u3001\u307E\u305F\u306F\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u306E\u30DA\u30EB\u30BD\u30CA\u3092\u6307\u5B9A\u3057\u307E\u3059\uFF1B",dependOnKb:"\u30AA\u30F3\u306B\u3059\u308B\u3068\u3001\u30CA\u30EC\u30C3\u30B8\u30D9\u30FC\u30B9\u3084\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3067\u56DE\u7B54\u304C\u898B\u3064\u304B\u3089\u306A\u3044\u5834\u5408\u3001\u95A2\u9023\u8CEA\u554F\u3078\u306E\u56DE\u7B54\u3092\u62D2\u5426\u3057\u307E\u3059\uFF1B"},defaultPrompt:"\u3042\u306A\u305F\u306F\u30A4\u30F3\u30C6\u30EA\u30B8\u30A7\u30F3\u30C8\u306A\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u3067\u3059\u3002\u30CA\u30EC\u30C3\u30B8\u30D9\u30FC\u30B9\u306E\u5185\u5BB9\u3092\u307E\u3068\u3081\u3066\u8CEA\u554F\u306B\u7B54\u3048\u3066\u304F\u3060\u3055\u3044\u3002\u95A2\u9023\u3059\u308B\u5185\u5BB9\u304C\u306A\u3044\u5834\u5408\u306F\u3001\u56DE\u7B54\u306B\u300C\u30CA\u30EC\u30C3\u30B8\u30D9\u30FC\u30B9\u306B\u8A72\u5F53\u3059\u308B\u56DE\u7B54\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\uFF01\u300D\u3092\u542B\u3081\u3066\u304F\u3060\u3055\u3044\u3002",message:{updateSuccess:"\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u8A2D\u5B9A\u3092\u66F4\u65B0\u3057\u307E\u3057\u305F",createSuccess:"\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u8A2D\u5B9A\u3092\u4F5C\u6210\u3057\u307E\u3057\u305F"},paramsValidation:{validNumberRequired:"\u6709\u52B9\u306A\u6570\u5024\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",numbersOnly:"\u6570\u5B57\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059",numberRange:"{{min}}\u304B\u3089{{max}}\u306E\u6570\u5024\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}},Mu={zh:ve,en:Su,ja:Nu};function oe(t,a){return t.replace(/\{\{(\w+)\}\}/g,(r,u)=>String(a[u]??""))}function Iu(t,a){const r=Mu[t]??ve;return a?{...r,...a}:r}function We(t,a){const r=a.split(".");let u=t;for(const m of r)u=u==null?void 0:u[m];return typeof u=="string"?u:a}const Ge=Ce.createContext({locale:"zh",messages:ve,getMessage:t=>We(ve,t)});function Ue(){return Ce.useContext(Ge)}function $u({locale:t,messages:a,children:r}){const u=Ce.useMemo(()=>{const m=Iu(t,a);return{locale:t,messages:m,getMessage:E=>We(m,E)}},[t,a]);return Ce.createElement(Ge.Provider,{value:u,children:r})}const{Item:Lu}=Be,me=({label:t,name:a,configScale:r})=>{const{messages:u}=Ue(),m=Ee(()=>r[a],[r]),E=(D,p)=>({validator(f,b){return b==null?Promise.reject(u.paramsValidation.validNumberRequired):typeof+b!="number"||isNaN(+b)?Promise.reject(u.paramsValidation.numbersOnly):b<D||b>p?Promise.reject(oe(u.paramsValidation.numberRange,{min:String(D),max:String(p)})):Promise.resolve()}});return e(ue,{span:12,children:e(Lu,{label:t,name:a,tooltip:m.tooltip,rules:[{required:!0,message:""},E(m.min,m.max)],children:e(ku,{min:m.min,max:m.max,step:m.step})})})},Pu=({url:t,token:a,role:r,eventsEmit:u,sectionData:m})=>{const[E,D]=k([]),[p,f]=k([]),[b,T]=k(!1),[M,l]=k([]),q=J(null),[S,B]=k(!1),H=J(new Map).current,{fetchGraphBases:o,fetchGraphLabel:n}=pe({url:t,token:a,role:r,eventsEmit:u});j(()=>{s()},[]),j(()=>{if(m){let C=[];(m||[]).map(_=>{const F=(E||[]).find(y=>y.key===_.config_id);if(F){const{key:y,label:v,id:A}=F;C.push({key:y,label:v,id:A,tags:_.labels})}}),f(C)}},[m,E]);const s=async()=>{try{const C=await o();if(C!=null&&C.records){const _=((C==null?void 0:C.records)||[]).map(F=>({key:F.id,label:F.name,id:F.id}));D(_)}}catch(C){console.error(C)}},d=(C,_)=>{switch(C){case"removeItem":const F=p.filter(v=>v.key!==_.key);f([...F]),i(F);break;case"removeTag":const y=p.findIndex(v=>v.key==_.key);y!==-1&&(p[y]=_),f([...p]),i(p)}},i=C=>{const _=(C||[]).map(F=>({config_id:F.id,labels:F.tags}));u&&u("graph_selected",_)},N=()=>{var _;const C=((_=q.current)==null?void 0:_.getSelectedItems())||[];f(C),T(!1),i(C)},w=async(C,_)=>{if(C){const F=H.get(_);if(F){l(F);return}if(!S)try{B(!0);const y=await n(_);if(Array.isArray(y)){const v=y.map(A=>({label:A,value:A}));H.set(_,v),l(v)}B(!1)}catch(y){console.error("Error fetching data:",y),B(!1)}}};return h("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[h("div",{className:"flex items-center justify-between",children:[h("div",{className:"flex items-center",children:[e("img",{src:he}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(te,{color:"primary",variant:"outlined",size:"small",icon:e(ye,{size:14}),onClick:()=>T(!0),children:"\u6DFB\u52A0"})})]}),(p==null?void 0:p.length)>0&&e(Ae,{countText:(p==null?void 0:p.length)>0?`\u5DF2\u9009\uFF1A${p==null?void 0:p.length}\u4E2A\u56FE\u8C31\u5E93`:void 0,eventsEmit:d,data:p}),e(be,{width:740,title:"\u9009\u62E9\u56FE\u8C31\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",className:"assistant-config-resource-bind-modal",open:b,onOk:N,destroyOnHidden:!0,onCancel:()=>T(!1),children:e(fe,{ref:q,dataSource:E,value:p,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31\u5E93",renderItem:C=>h("div",{className:"flex ",children:[e("img",{src:he,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:C.label,children:C.label})]}),renderSelectedItem:(C,_)=>h("div",{className:"flex ",children:[e("img",{src:he,alt:"add"}),h("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:C.label}),e(Q,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:C.tags||[],onChange:F=>{_(F)},style:{width:250},options:M,loading:S,onOpenChange:F=>{w(F,C.id)}})]})]})})})]})},{Item:R}=Be,Tu=({url:t,token:a,role:r,id:u,showDatabase:m,showGraph:E,isShare:D,disabled:p,eventsEmit:f,showGraphEnhanced:b,CustomComponents:T,newGraph:M})=>{const{messages:l}=Ue(),{ContentLoading:q}=T??{},[S]=Be.useForm(),[B,H]=k(),[o,n]=k(),[s,d]=k(),[i,N]=k(),[w,C]=k(),[_,F]=k(!0),[y,v]=k(!1),[A,c]=k(le),x=J({}),{getConfigById:I,fetchModels:V,fetchConfigItemLimit:W,checkName:ae,addConversationAssistant:Ze,updateConversationAssistant:Qe}=pe({url:t,token:a,role:r,eventsEmit:f});j(()=>{Je()},[u]),j(()=>{u?(Array.isArray(o)&&Array.isArray(s)&&S.validateFields(["model_name","plan_model_name","recommend_model_name","rerank_model_name","multi_model_name","embedding_model_name"]),Array.isArray(i)&&S.validateFields(["multi_model_name"])):(Array.isArray(o)&&(o==null?void 0:o.length)==0&&S.validateFields(["model_name","plan_model_name","recommend_model_name","embedding_model_name"]),Array.isArray(s)&&(s==null?void 0:s.length)==0&&S.validateFields(["rerank_model_name"]),Array.isArray(i)&&(i==null?void 0:i.length)==0&&S.validateFields(["multi_model_name"]),Array.isArray(w)&&(w==null?void 0:w.length)==0&&S.validateFields(["embedding_model_name"]))},[s,o,i,w,u]);const Je=async()=>{let g;if(u){_||F(!0);try{const $=await I(u);if($){const{configJson:L,...U}=$,G=L&&JSON.parse(L),{knowledge_base_name:Y,knowledge_base_name_source:Z,selectedKnowledgeBase:ne,sensitiveWordIds:re,database_name:X,graph_nb_name:ce,graph_db:z}=G;g={...U,...G},x.current={knowledge_base_name:Y,knowledge_base_name_source:Z,selectedKnowledgeBase:ne,sensitiveWordIds:re,database_name:X,graph_nb_name:ce,graph_db:z},H(g),S.setFieldsValue(g),F(!1)}}catch{}}else F(!1);await Ye(g)},Ye=async g=>{var $,L,U,G,Y;try{const[Z,ne,re,X,ce]=await Promise.allSettled([V({pageNum:1,pageSize:9999,status:1,type:1}),V({pageNum:1,pageSize:9999,status:1,type:3}),V({pageNum:1,pageSize:9999,status:1,type:4}),W(),V({pageNum:1,pageSize:9999,status:1,type:2})]);if(Z.status==="fulfilled"&&Z.value){const P=((($=Z.value)==null?void 0:$.records)||[]).map(ee=>({...ee,label:ee.modelName,value:ee.modelName}));if(P.length>0){const ee=(L=P.find(we=>we.value==(g==null?void 0:g.model_name)))==null?void 0:L.maxTokens;(g==null?void 0:g.max_tokens)>ee&&S.setFieldsValue({max_tokens:ee})}n(P)}if(ne.status==="fulfilled"&&ne.value){const z=(((U=ne.value)==null?void 0:U.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));d(z),z.length>0&&!(g!=null&&g.rerank_model_name)&&S.setFieldsValue({rerank_model_name:z[0].value})}if(re.status==="fulfilled"&&re.value){const z=(((G=re.value)==null?void 0:G.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));N(z),z.length>0&&!(g!=null&&g.multi_model_name)&&S.setFieldsValue({multi_model_name:z[0].value})}if(ce.status==="fulfilled"&&ce.value){const z=(((Y=ce.value)==null?void 0:Y.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));C(z),z.length>0&&!(g!=null&&g.embedding_model_name)&&S.setFieldsValue({embedding_model_name:z[0].value})}if(X.status==="fulfilled"&&X.value&&X.value){const z=X.value;Object.keys(le).forEach(P=>{if(z.hasOwnProperty(P)){const{max:ee,min:we}=z[P];le[P]={...le[P],min:we,max:ee}}}),c(le)}}catch(Z){console.error("\u83B7\u53D6\u5217\u8868\u5931\u8D25:",Z)}},Xe=async(g,$)=>await ae($,u)?(_e.warning(l.form.validation.nameDuplicate,2),Promise.reject(l.form.validation.nameDuplicateShort)):Promise.resolve(),ie=(g,$)=>({validator(L,U){return U?Array.isArray(g)&&g.length===0||!g.find(G=>G.value==U)?Promise.reject(l.form.validation.modelUnavailable):Promise.resolve():Array.isArray(g)&&g.length===0?Promise.reject(l.form.validation.noModelAvailable):Promise.reject($)}}),Fe=(g,$)=>{switch(g){case"knowledge_selected":x.current={...x.current,...$};break;case"sensitive_selected":x.current={...x.current,sensitiveWordIds:$};break;case"database_selected":x.current={...x.current,database_name:$};break;case"graph_selected":M?x.current={...x.current,graph_db:$}:x.current={...x.current,graph_nb_name:$};break}},eu=async()=>{var $;let g={};try{v(!0);const L=await S.validateFields(),{knowledge_base_name:U,knowledge_base_name_source:G,selectedKnowledgeBase:Y,sensitiveWordIds:Z,database_name:ne,graph_nb_name:re,graph_db:X}=x.current;L.thinking=(($=o.find(z=>z.modelName==L.model_name))==null?void 0:$.thinking)||!1,E&&(L.enabled_nb_graph=!0),g={configJson:JSON.stringify({...L,knowledge_base_name:U,knowledge_base_name_source:G,selectedKnowledgeBase:Y,sensitiveWordIds:Z,...m?{database_name:ne}:{},...E&&!M?{graph_nb_name:re}:{},...E&&M?{graph_db:X}:{}}),name:L.config_name,isDefault:L.isDefault,defaultAnswer:L.defaultAnswer,dependOnKb:L.dependOnKb,sensitiveWordIds:Z},u?await Qe(u,g)&&(_e.success(l.message.updateSuccess),f&&f("go_back")):await Ze(g)&&(_e.success(l.message.createSuccess),f&&f("go_back"))}catch(L){console.error("submit error",L)}finally{v(!1)}},uu=Ee(()=>{const g={};return Object.keys(le).forEach($=>{var L;g[$]=(L=le[$])==null?void 0:L.default}),{...hu,...g}},[]);return h("div",{style:{height:"100%",width:"100%"},children:[h("div",{className:"flex items-center justify-between",style:{width:"100%",padding:"4px 10px 16px 10px"},children:[h("div",{className:"flex items-center",children:[e(du,{color:"#2468F2",onClick:()=>f&&f("go_back")}),e("div",{className:"text-[16px] text-[#1D2129] bold",style:{marginLeft:20},children:u?l.header.titleEdit:l.header.titleNew})]}),!_&&e(te,{type:"primary",onClick:()=>eu(),loading:y,disabled:p,children:l.header.confirm})]}),_?q&&e(q,{}):e(Be,{style:{padding:20,height:"calc(100vh - 150px)",backgroundColor:"#fff"},form:S,layout:"vertical",initialValues:uu,disabled:p,colon:!1,children:h(se,{gutter:24,style:{height:"100%"},children:[h(ue,{span:12,style:{borderRight:"1px solid #E5E6EB",padding:"10px 32px",height:"100%",overflowY:"auto"},children:[e(R,{label:l.form.labels.assistantName,name:"config_name",validateTrigger:"onBlur",rules:[{required:!0,message:l.form.validation.assistantNameRequired},{validator:Xe}],children:e(xe,{placeholder:l.form.placeholders.input})}),h(se,{gutter:16,children:[e(ue,{span:12,children:e(R,{label:l.form.labels.qaModel,name:"model_name",rules:[{required:!0,message:""},ie(o,oe(l.form.validation.selectModel,{model:l.form.labels.qaModel}))],children:e(Q,{placeholder:l.form.placeholders.select,options:o,notFoundContent:e(de,{})})})}),e(ue,{span:12,children:e(R,{label:l.form.labels.planModel,name:"plan_model_name",rules:[{required:!0,message:""},ie(o,oe(l.form.validation.selectModel,{model:l.form.labels.planModel}))],children:e(Q,{placeholder:l.form.placeholders.select,options:o,notFoundContent:e(de,{})})})})]}),h(se,{gutter:16,children:[e(ue,{span:12,children:e(R,{label:l.form.labels.multiModel,name:"multi_model_name",rules:[{required:!0,message:""},ie(i,oe(l.form.validation.selectModel,{model:l.form.labels.multiModel}))],children:e(Q,{placeholder:l.form.placeholders.select,options:i,notFoundContent:e(de,{})})})}),e(ue,{span:12,children:e(R,{label:l.form.labels.rerankModel,name:"rerank_model_name",rules:[{required:!0,message:""},ie(s,oe(l.form.validation.selectModel,{model:l.form.labels.rerankModel}))],children:e(Q,{placeholder:l.form.placeholders.select,options:s,notFoundContent:e(de,{})})})})]}),e(se,{gutter:16,children:e(ue,{span:24,children:e(R,{label:l.form.labels.embeddingModel,name:"embedding_model_name",rules:[{required:!0,message:""},ie(w,oe(l.form.validation.selectModel,{model:l.form.labels.embeddingModel}))],children:e(Q,{placeholder:l.form.placeholders.select,options:w,notFoundContent:e(de,{})})})})}),e(R,{label:l.form.labels.prologue,name:"prologue",children:e(xe.TextArea,{maxLength:50,showCount:!0,placeholder:l.form.placeholders.prologue,autoSize:{minRows:2}})}),e(R,{label:l.form.labels.systemPrompt,name:"system_prompt",tooltip:l.explanation.prompt,children:e(xe.TextArea,{showCount:!0,rows:8,maxLength:3e3,autoSize:{minRows:10},placeholder:`${l.form.placeholders.promptExample}${l.defaultPrompt}`})}),e(R,{name:"isDefault",valuePropName:"checked",normalize:g=>g===!0?1:0,children:e(Ie,{children:l.form.labels.defaultAssistant})})]}),h(ue,{span:12,style:{height:"100%",padding:"10px 32px",overflowY:"auto"},children:[h(ke,{title:l.paragraph.retrievalParams,children:[e(R,{label:l.form.labels.recommendModel,name:"recommend_model_name",rules:[{required:!0,message:""},ie(o,oe(l.form.validation.selectModel,{model:l.form.labels.recommendModel}))],children:e(Q,{placeholder:l.form.placeholders.select,options:o,notFoundContent:e(de,{})})}),e(R,{label:l.form.labels.searchPolicy,name:"search_policy",children:e(Q,{options:l.searchPolicyOptions,placeholder:l.form.placeholders.select})}),h(se,{gutter:16,children:[e(me,{label:l.form.labels.temperature,name:"temperature",configScale:A}),e(me,{label:l.form.labels.diversity,name:"top_p",configScale:A})]}),h(se,{gutter:16,children:[e(me,{label:l.form.labels.topK,name:"top_k",configScale:A}),e(me,{label:l.form.labels.scoreThreshold,name:"score_threshold",configScale:A})]}),h(se,{gutter:16,children:[e(R,{noStyle:!0,shouldUpdate:(g,$)=>g.model_name!==$.model_name,children:({getFieldValue:g})=>{var G;const $=g("model_name"),L=(G=(o||[]).find(Y=>Y.value==$))==null?void 0:G.maxTokens;return g("max_tokens")>L&&S.setFieldValue("max_tokens",L),e(me,{label:l.form.labels.maxTokens,name:"max_tokens",configScale:{...A,max_tokens:{...A.max_tokens,max:L||1e4}}})}}),e(me,{label:l.form.labels.maxRound,name:"max_round",configScale:A})]})]}),h(ke,{title:l.paragraph.featureSwitch,children:[e(R,{label:l.form.labels.enabledFaq,name:"enabled_faq",valuePropName:"checked",layout:"horizontal",children:e(ge,{})}),b&&e(R,{label:l.form.labels.enabledGraph,name:"enabled_graph",valuePropName:"checked",layout:"horizontal",children:e(ge,{})}),e(R,{label:l.form.labels.dependOnKb,name:"dependOnKb",valuePropName:"checked",layout:"horizontal",tooltip:l.explanation.dependOnKb,normalize:g=>g===!0?1:0,children:e(ge,{})}),e(R,{label:l.form.labels.questionRewrite,name:"enabled_question_rewrite",valuePropName:"checked",layout:"horizontal",children:e(ge,{})}),e(R,{label:l.form.labels.traceSource,name:"need_trace_source",valuePropName:"checked",layout:"horizontal",children:e(ge,{})}),e(R,{noStyle:!0,shouldUpdate:(g,$)=>g.need_trace_source!==$.need_trace_source,children:({getFieldValue:g})=>g("need_trace_source")?h(je,{children:[e(R,{label:l.form.labels.traceStrategy,name:"trace_by_llm",layout:"horizontal",children:e(Q,{placeholder:l.form.placeholders.select,options:l.traceabilityStrategy})}),e(R,{name:"is_download",valuePropName:"checked",layout:"horizontal",children:e(Ie,{children:l.form.labels.allowDownloadTrace})})]}):null})]}),h(ke,{title:l.paragraph.resourceBind,children:[e(xu,{url:t,token:a,role:r,sectionData:B==null?void 0:B.sensitiveWordIds,eventsEmit:Fe,defaultAnswer:B==null?void 0:B.defaultAnswer,form:S}),e(Du,{url:t,token:a,role:r,sectionData:{knowledge_base_name:B==null?void 0:B.knowledge_base_name,knowledge_base_name_source:B==null?void 0:B.knowledge_base_name_source,selectedKnowledgeBase:B==null?void 0:B.selectedKnowledgeBase},createBy:D?B==null?void 0:B.createBy:void 0,eventsEmit:Fe}),m&&e(wu,{url:t,token:a,role:r,disabled:p,sectionData:B==null?void 0:B.database_name,eventsEmit:Fe}),E&&(M?e(Pu,{url:t,token:a,role:r,sectionData:B==null?void 0:B.graph_db,eventsEmit:Fe}):e(_u,{url:t,token:a,role:r,sectionData:B==null?void 0:B.graph_nb_name,eventsEmit:Fe}))]})]})]})})]})},Uu=t=>{const{locale:a="zh",messages:r,...u}=t;return e($u,{locale:a,messages:r,children:e(Tu,{...u})})};export{$u as A,Uu as C,Ge as a,Iu as g,O as i,Ue as u};
|
|
157
|
+
`;const Fe=ru(({dataSource:t,value:a=[],onConfirm:n,maxCount:u=0,searchPlaceholder:m="\u641C\u7D22...",title:E="",showSearch:w=!0,filterOption:p,renderItem:F,renderSelectedItem:B,className:$,style:N,styles:l,height:H,width:S},b)=>{const q=gu(),o=Te(Te({theme:O,mode:"light"},q),l),[r,s]=k(a),[d,i]=k("");j(()=>{s(a)},[a]),Ee(()=>new Set(a.map(c=>c.key)),[a]);const M=Ee(()=>new Set(r.map(c=>c.key)),[r]);nu(b,()=>({getSelectedItems:()=>r,confirm:()=>{n==null||n(r)}}),[r,n]);const C=p||((c,A)=>{var V;if(!c)return!0;const P=c.toLowerCase();return A.label.toLowerCase().includes(P)||((V=A.tags)==null?void 0:V.some(G=>G.toLowerCase().includes(P)))||!1}),_=Ee(()=>(t||[]).filter(c=>C(d,c)),[t,d,C]),g=c=>{const A=M.has(c.key);let P;if(A)P=(r||[]).filter(V=>V.key!==c.key);else{if(u>0&&r.length>=u)return;P=[...r,c]}s(P)},x=(c,A)=>{s(P=>P.map(G=>G.key==c?{...G,tags:A}:G))},v=c=>{const A=(r||[]).filter(P=>P.key!==c.key);s(A)},y=c=>M.has(c);return u>0&&r.length>=u,h(fu,{$theme:o.theme||O,$width:S,$height:H,className:$,style:N,children:[h($e,{$theme:o.theme||O,style:{flex:1},children:[w&&e(bu,{$theme:o.theme||O,children:h("div",{style:{position:"relative"},children:[e(xu,{children:e(cu,{size:16})}),e(Bu,{$theme:o.theme||O,type:"text",placeholder:m,value:d,onChange:c=>i(c.target.value)})]})}),e(ze,{children:_.length===0?e(qe,{$theme:o.theme||O,children:d?"\u672A\u627E\u5230\u5339\u914D\u9879":"\u6682\u65E0\u6570\u636E"}):_.map(c=>{const A=y(c.key);return h(Re,{$theme:o.theme||O,$selected:A,children:[e(He,{$theme:o.theme||O,children:F?F(c):c.label}),A&&e(Oe,{$theme:o.theme||O,onClick:P=>{P.stopPropagation(),v(c)},disabled:!0,children:"\u5DF2\u6DFB\u52A0"}),!A&&e(Oe,{$theme:o.theme||O,onClick:P=>{P.stopPropagation(),g(c)},children:"\u6DFB\u52A0"})]},c.key)})})]}),h($e,{$theme:o.theme||O,style:{flex:1},children:[h(Eu,{$theme:o.theme||O,children:[u>0?`\u5DF2\u9009\uFF1A${r.length}/${u}\u4E2A${E}`:`\u5DF2\u9009\uFF1A${r.length}\u4E2A${E}`,e(Cu,{$theme:o.theme||O,onClick:c=>{c.stopPropagation(),s([])},children:"\u6E05\u7A7A"})]}),e(ze,{children:r.length===0?e(qe,{$theme:o.theme||O,children:"\u6682\u65E0\u5DF2\u9009\u9879"}):r.map(c=>{var P,V,G;const A=ae=>x(c.key,ae);return h(Re,{$theme:o.theme||O,children:[e(He,{$theme:o.theme||O,children:B?B(c,A):c.label}),e(Ke,{size:14,color:((G=(V=(P=o.theme)==null?void 0:P.colors)==null?void 0:V.text)==null?void 0:G.secondary)||"#86909C",style:{cursor:"pointer"},onClick:ae=>{ae.stopPropagation(),v(c)}})]},c.key)})})]})]})});Fe.displayName="SearchableSelector";const Se="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='2.22222'%20fill='%23FFCC3C'/%3e%3cpath%20d='M13.3263%2012.7917H7.53763C7.33426%2012.8116%207.17923%2012.9825%207.17923%2013.1867C7.17923%2013.3909%207.33426%2013.5618%207.53763%2013.5817H13.3277C13.3828%2013.5871%2013.4384%2013.5809%2013.4909%2013.5634C13.5435%2013.546%2013.5918%2013.5178%2013.6328%2013.4806C13.6738%2013.4434%2013.7066%2013.3981%2013.729%2013.3474C13.7514%2013.2968%2013.763%2013.2421%2013.763%2013.1867C13.763%2013.1313%2013.7514%2013.0766%2013.729%2013.026C13.7066%2012.9753%2013.6738%2012.93%2013.6328%2012.8928C13.5918%2012.8556%2013.5435%2012.8274%2013.4909%2012.8099C13.4384%2012.7925%2013.3828%2012.7863%2013.3277%2012.7917H13.3263ZM9.19742%207.60418L8.84232%208.55193H9.57339L9.19742%207.60418Z'%20fill='white'/%3e%3cpath%20d='M15.3211%2014.7707V6.9692H14.4704V14.3543H6.70511C6.06668%2014.3392%205.55704%2013.8173%205.55704%2013.1788C5.55704%2012.5402%206.06668%2012.0184%206.70511%2012.0033H13.352C13.4644%2012.0075%2013.5735%2011.9648%2013.653%2011.8852C13.6923%2011.8459%2013.7231%2011.7988%2013.7434%2011.747C13.7638%2011.6952%2013.7731%2011.6398%2013.771%2011.5842V5.20102C13.7736%205.14526%2013.7646%205.08958%2013.7445%205.03752C13.7244%204.98546%2013.6936%204.93816%2013.6542%204.89865C13.6148%204.85915%2013.5675%204.82832%2013.5155%204.80812C13.4634%204.78792%2013.4077%204.7788%2013.352%204.78134H6.70511C5.60281%204.80136%204.71609%205.69369%204.70291%206.79599V13.1759C4.71609%2014.283%205.61038%2015.1773%206.71756%2015.1905H14.8893C15.0042%2015.1994%2015.1173%2015.1585%2015.1999%2015.0782C15.2407%2015.0385%2015.2727%2014.9905%2015.2936%2014.9375C15.3145%2014.8845%2015.3239%2014.8276%2015.3211%2014.7707ZM8.98782%206.78585H9.44888L10.7213%209.92562H10.2475L9.9075%209.06759H8.51871L8.19742%209.92562H7.72354L8.98782%206.78585Z'%20fill='white'/%3e%3c/svg%3e",{Item:yu}=be,Au=({url:t,token:a,role:n,eventsEmit:u,sectionData:m,defaultAnswer:E,form:w})=>{const[p,F]=k([]),[B,$]=k([]),[N,l]=k(!1),[H,S]=k(!1),b=Q(null),{fetchSensitiveLibrary:q}=pe({url:t,token:a,role:n,eventsEmit:u});j(()=>{o()},[]),j(()=>{if(m&&(p==null?void 0:p.length)>0){let i=m?Array.isArray(m)?m:m.split(","):[],M=[];i.forEach(D=>{const C=(p||[]).find(_=>_.key===D);C&&M.push({key:C.key,label:C.label})}),$(M)}},[m,p]),j(()=>{E&&S(!0)},[E]);const o=async()=>{try{const i=await q({pageNo:1,pageSize:9999});if(i!=null&&i.records){const M=((i==null?void 0:i.records)||[]).map(D=>({key:D.id+"",label:D.name}));F(M)}}catch(i){console.error(i)}},r=(i,M)=>{switch(i){case"removeItem":const D=B.filter(C=>C.key!==M.key);$([...D]),s(D);break}},s=i=>{const M=i.map(D=>(D==null?void 0:D.key)||"").filter(D=>D).join(",");u&&u("sensitive_selected",M)},d=()=>{var M;const i=((M=b.current)==null?void 0:M.getSelectedItems())||[];$(i),l(!1),s(i)};return h("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[h("div",{className:"flex items-center justify-between",children:[h("div",{className:"flex items-center",children:[e("img",{src:Se}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u654F\u611F\u8BCD"})]}),e(te,{color:"primary",variant:"outlined",size:"small",icon:e(xe,{size:14}),onClick:()=>l(!0),children:"\u6DFB\u52A0"})]}),e(Pe,{checked:H,onChange:i=>{S(i.target.checked),i.target.checked?w.setFieldsValue({defaultAnswer:mu}):w.setFieldsValue({defaultAnswer:""})},style:{marginBottom:8,marginTop:8},children:"\u81EA\u5B9A\u4E49\u56DE\u590D"}),H&&e(yu,{label:"\u81EA\u5B9A\u4E49\u56DE\u590D\u5185\u5BB9",name:"defaultAnswer",layout:"vertical",children:e(Ae.TextArea,{style:{height:"55px",resize:"none"}})}),(B==null?void 0:B.length)>0&&e(ye,{countText:(B==null?void 0:B.length)>0?`\u5DF2\u9009\uFF1A${B==null?void 0:B.length}\u4E2A\u654F\u611F\u8BCD\u5E93`:void 0,eventsEmit:r,data:B}),e(Be,{width:740,title:"\u9009\u62E9\u654F\u611F\u8BCD",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:N,onOk:d,onCancel:()=>l(!1),destroyOnHidden:!0,className:"assistant-config-resource-bind-modal",children:e(Fe,{ref:b,dataSource:p,value:B,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u654F\u611F\u8BCD\u5E93",renderItem:i=>h("div",{className:"flex ",children:[e("img",{src:Se,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:i.label,children:i.label})]}),renderSelectedItem:(i,M)=>h("div",{className:"flex items-center",children:[e("img",{src:Se,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:i.label})})]})})})]})},Me="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='2.22222'%20fill='%2300B2F9'/%3e%3cpath%20d='M5.3125%2013.9672V13.975C5.32812%2014.6938%205.89922%2015.2734%206.61875%2015.2734H13.9062C14.3375%2015.2734%2014.6875%2014.9289%2014.6875%2014.4977V5.50703C14.6875%205.40447%2014.6673%205.30292%2014.628%205.20818C14.5887%205.11344%2014.5312%205.02736%2014.4586%204.95488C14.3861%204.8824%2014.2999%204.82492%2014.2052%204.78575C14.1104%204.74657%2014.0088%204.72646%2013.9062%204.72656H6.875C6.01172%204.72656%205.3125%205.42031%205.3125%206.28359V13.9672ZM7.5%209.24531V6.25C7.5%206.07813%207.64062%205.9375%207.8125%205.9375H9.6875C9.86016%205.9375%2010%206.07813%2010%206.25V9.24531C10%209.30716%209.98175%209.36762%209.94741%209.41906C9.91308%209.47049%209.86425%209.51058%209.80712%209.53426C9.74999%209.55793%209.68712%209.56412%209.62647%209.55204C9.56581%209.53996%209.51011%209.51016%209.46641%209.46641L8.97109%208.97109C8.94207%208.94204%208.90761%208.91899%208.86967%208.90326C8.83173%208.88754%208.79107%208.87944%208.75%208.87944C8.70893%208.87944%208.66827%208.88754%208.63033%208.90326C8.59239%208.91899%208.55793%208.94204%208.52891%208.97109L8.03359%209.46641C7.98989%209.51016%207.93418%209.53996%207.87353%209.55204C7.81288%209.56412%207.75001%209.55793%207.69288%209.53426C7.63575%209.51058%207.58692%209.47049%207.55259%209.41906C7.51825%209.36762%207.49995%209.30716%207.5%209.24531ZM6.54375%2014.2063C6.45208%2014.1156%206.40625%2014.0052%206.40625%2013.875C6.40625%2013.7458%206.45208%2013.6354%206.54375%2013.5438C6.6349%2013.4521%206.74531%2013.4062%206.875%2013.4062H13.5938V14.3438H6.875C6.74531%2014.3438%206.6349%2014.2979%206.54375%2014.2063Z'%20fill='white'/%3e%3c/svg%3e",vu=({url:t,token:a,role:n,sectionData:u,createBy:m,eventsEmit:E})=>{const[w,p]=k(),[F,B]=k([]),[$,N]=k(!1),l=Q(null),[H,S]=k(!1),[b,q]=k([]),o=Q(new Map).current,{fetchKnowledgeBase:r,getBizLabelLabels:s}=pe({url:t,token:a,role:n,eventsEmit:E}),d=Q(!1);j(()=>{d.current||(m?(i(m),d.current=!0):(i(),d.current=!0))},[m]),j(()=>{if(u&&(w==null?void 0:w.length)>0){const g=u==null?void 0:u.knowledge_base_name_source,x=g&&(Array.isArray(g)?g:g.split(";"));let v=[];(x||[]).forEach(y=>{const c=((u==null?void 0:u.selectedKnowledgeBase)||[]).find(P=>P.name==y),A=(w||[]).find(P=>P.knowledge_base_name_source===y);if(A){const{key:P,label:V,knowledge_base_name:G,knowledge_base_name_source:ae}=A;v.push({key:P,label:V,knowledge_base_name:G,knowledge_base_name_source:ae,tags:c==null?void 0:c.labels})}}),B(v)}},[u,w]);const i=async g=>{try{const x=await r(g);if(x){const v=(x||[]).map(y=>({key:y.id,label:y.kbName,knowledge_base_name:y.primitiveName,knowledge_base_name_source:y.kbName}));p(v)}}catch(x){console.error(x)}},M=(g,x)=>{switch(g){case"removeItem":const v=F.filter(c=>c.key!==x.key);B([...v]),D(v);break;case"removeTag":const y=F.findIndex(c=>c.key==x.key);y!==-1&&(F[y]=x),B([...F]),D(F);break}},D=g=>{const x=(g||[]).map(c=>(c==null?void 0:c.knowledge_base_name)||"").filter(c=>c).join(";"),v=(g||[]).map(c=>(c==null?void 0:c.knowledge_base_name_source)||"").filter(c=>c).join(";"),y=(g||[]).filter(c=>{var A;return Array.isArray(c==null?void 0:c.tags)&&((A=c.tags)==null?void 0:A.length)>0}).map(c=>({id:c.key,name:c.label,knowledge_base_name_source:c.knowledge_base_name,labels:c.tags}));E&&E("knowledge_selected",{knowledge_base_name:x,knowledge_base_name_source:v,selectedKnowledgeBase:y})},C=()=>{var x;const g=((x=l.current)==null?void 0:x.getSelectedItems())||[];B(g),N(!1),D(g)},_=async(g,x)=>{if(g){const v=o.get(x);if(v){q(v);return}if(!H)try{S(!0);const y=await s({kbNames:[x]});if(Array.isArray(y)){const c=y.length?y[0].label:"",A=c?(c||"").split(",").map(P=>({label:P,value:P})):[];o.set(x,A),q(A)}S(!1)}catch(y){console.error("Error fetching data:",y),S(!1)}}};return h("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[h("div",{className:"flex items-center justify-between",children:[h("div",{className:"flex items-center",children:[e("img",{src:Me}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u77E5\u8BC6\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(te,{color:"primary",variant:"outlined",size:"small",icon:e(xe,{size:14}),onClick:()=>N(!0),children:"\u6DFB\u52A0"})})]}),(F==null?void 0:F.length)>0&&e(ye,{countText:(F==null?void 0:F.length)>0?`\u5DF2\u9009\uFF1A${F==null?void 0:F.length}\u4E2A\u77E5\u8BC6\u5E93`:void 0,eventsEmit:M,data:F}),e(Be,{width:740,className:"assistant-config-resource-bind-modal",title:"\u9009\u62E9\u77E5\u8BC6\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:$,onOk:C,onCancel:()=>N(!1),destroyOnHidden:!0,children:e(Fe,{ref:l,dataSource:w,value:F,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u77E5\u8BC6\u5E93",renderItem:g=>h("div",{className:"flex ",children:[e("img",{src:Me,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:g.label,children:g.label})]}),renderSelectedItem:(g,x)=>h("div",{className:"flex ",children:[e("img",{src:Me,alt:"add"}),h("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:g.label}),e(Z,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:g.tags||[],onChange:v=>{x(v)},style:{width:250},options:b,loading:H,onOpenChange:v=>{_(v,g.knowledge_base_name)}})]})]})})})]})},wu=Ce.memo(vu),Ne="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='3.55556'%20fill='%23925BFF'/%3e%3cpath%20d='M11.9971%2011.265C15.249%2011.265%2017.8891%2010.443%2017.8891%209.423V7.95288C17.8891%206.93291%2015.2492%206.11084%2011.9971%206.11084C8.74513%206.11084%206.10504%206.93276%206.10504%207.95288V9.42285C6.10504%2010.437%208.73898%2011.265%2011.9971%2011.265Z'%20fill='white'/%3e%3cpath%20d='M11.9971%2014.577C15.249%2014.577%2017.8891%2013.7551%2017.8891%2012.7349V10.527C17.8891%2011.5469%2015.2492%2012.369%2011.9971%2012.369C8.74513%2012.369%206.10504%2011.5471%206.10504%2010.527V12.7349C6.10504%2013.749%208.73898%2014.577%2011.9971%2014.577Z'%20fill='white'/%3e%3cpath%20d='M11.9971%2015.681C8.7451%2015.681%206.11102%2014.859%206.11102%2013.839V16.0469C6.11102%2017.0609%208.74496%2017.889%2012.0031%2017.889C15.255%2017.889%2017.8951%2017.0671%2017.8951%2016.0469V13.8391C17.889%2014.859%2015.249%2015.681%2011.9971%2015.681Z'%20fill='white'/%3e%3c/svg%3e",Ve=10,Du=({url:t,token:a,role:n,eventsEmit:u,sectionData:m,disabled:E})=>{const[w,p]=k([]),[F,B]=k([]),[$,N]=k(!1),l=Q(null),{fetchDatabases:H}=pe({url:t,token:a,role:n,eventsEmit:u});j(()=>{S()},[]),j(()=>{if(m){let o=[];(m||[]).map(r=>{const s=(w||[]).find(d=>d.key===r.key);if(s){const{key:d,label:i}=s;o.push({key:d,label:i})}}),B(o)}},[m,w]);const S=async()=>{try{const o=await H();if(o){const r=(o||[]).map(s=>({key:s.primitiveName,label:s.name}));p(r)}}catch(o){console.error(o)}},b=(o,r)=>{switch(o){case"removeItem":const s=F.filter(d=>d.key!==r.key);B([...s]),u&&u("database_selected",s);break}},q=()=>{var r;const o=((r=l.current)==null?void 0:r.getSelectedItems())||[];B(o),N(!1),u&&u("database_selected",o)};return h("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[h("div",{className:"flex items-center justify-between",children:[h("div",{className:"flex items-center",children:[e("img",{src:Ne}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u6570\u636E\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(te,{color:"primary",variant:"outlined",size:"small",icon:e(xe,{size:14}),onClick:()=>N(!0),disabled:F.length>=Ve||E,children:"\u6DFB\u52A0"})})]}),(F==null?void 0:F.length)>0&&e(ye,{countText:(F==null?void 0:F.length)>0?`\u5DF2\u9009\uFF1A${F==null?void 0:F.length}\u4E2A\u6570\u636E\u5E93`:void 0,eventsEmit:b,data:F}),e(Be,{width:740,title:"\u9009\u62E9\u6570\u636E\u5E93",className:"assistant-config-resource-bind-modal",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:$,onOk:q,onCancel:()=>N(!1),destroyOnHidden:!0,children:e(Fe,{ref:l,dataSource:w,value:F,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u6570\u636E\u5E93",maxCount:Ve,renderItem:o=>h("div",{className:"flex ",children:[e("img",{src:Ne,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o.label,children:o.label})]}),renderSelectedItem:(o,r)=>h("div",{className:"flex items-center",children:[e("img",{src:Ne,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:o.label})})]})})})]})},he="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='3.55556'%20fill='%2300C1B8'/%3e%3cpath%20d='M17.9887%2012.582C18.1207%2013.6621%2017.2267%2014.5801%2016.1526%2014.4901C15.3306%2014.4181%2014.6645%2013.7521%2014.6045%2012.924C14.5745%2012.558%2014.6645%2012.21%2014.8445%2011.9159C14.9285%2011.7779%2014.9045%2011.6039%2014.8025%2011.4899L14.3885%2011.0339C14.2805%2010.9139%2014.1005%2010.8839%2013.9565%2010.9559C13.6144%2011.1239%2013.2304%2011.2199%2012.8224%2011.2199C12.6244%2011.2199%2012.4324%2011.1959%2012.2464%2011.1539C12.0963%2011.1179%2011.9463%2011.1779%2011.8563%2011.3039L11.2803%2012.1259C11.1783%2012.276%2011.1963%2012.474%2011.3223%2012.606C11.8983%2013.188%2012.2464%2013.9921%2012.2284%2014.8741C12.1924%2016.4702%2010.9203%2017.7963%209.32417%2017.9043C7.45804%2018.0243%205.90994%2016.4942%206.00595%2014.6281C6.08995%2013.038%207.38604%2011.7599%208.97614%2011.6879C9.42017%2011.6699%209.8402%2011.7419%2010.2302%2011.8919C10.3922%2011.9519%2010.5722%2011.8979%2010.6743%2011.7599L11.1663%2011.0579C11.2743%2010.9019%2011.2503%2010.6919%2011.1123%2010.5658C10.5302%2010.0498%2010.1882%209.26976%2010.2662%208.4177C10.3742%207.18162%2011.3823%206.18556%2012.6244%206.09555C14.1245%205.98154%2015.3846%207.17562%2015.3846%208.65172C15.3846%209.20376%2015.2106%209.70779%2014.9105%2010.1278C14.8085%2010.2658%2014.8205%2010.4578%2014.9345%2010.5898L15.3786%2011.0819C15.4746%2011.1899%2015.6306%2011.2259%2015.7626%2011.1779C16.0086%2011.0939%2016.2786%2011.0639%2016.5606%2011.1119C17.3047%2011.2259%2017.8987%2011.8319%2017.9887%2012.582Z'%20fill='white'/%3e%3c/svg%3e",_u=({url:t,token:a,role:n,eventsEmit:u,sectionData:m})=>{const[E,w]=k([]),[p,F]=k([]),[B,$]=k(!1),N=Q(null),{fetchGraphs:l}=pe({url:t,token:a,role:n,eventsEmit:u});j(()=>{H()},[]),j(()=>{if(m){let o=[];(m||[]).map(r=>{const s=(E||[]).find(d=>d.key===r.index_name);if(s){const{key:d,label:i}=s;o.push({key:d,label:i})}}),F(o)}},[m,E]);const H=async()=>{try{const o=await l();if(o!=null&&o.dataList){const r=((o==null?void 0:o.dataList)||[]).map(s=>({key:s.schemaId,label:s.name}));w(r)}}catch(o){console.error(o)}},S=(o,r)=>{switch(o){case"removeItem":const s=p.filter(d=>d.key!==r.key);F([...s]),b(s);break}},b=o=>{const r=(o||[]).map(s=>({graph_name:s.label,index_name:s.key}));u&&u("graph_selected",r)},q=()=>{var r;const o=((r=N.current)==null?void 0:r.getSelectedItems())||[];F(o),$(!1),b(o)};return h("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[h("div",{className:"flex items-center justify-between",children:[h("div",{className:"flex items-center",children:[e("img",{src:he}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(te,{color:"primary",variant:"outlined",size:"small",icon:e(xe,{size:14}),onClick:()=>$(!0),children:"\u6DFB\u52A0"})})]}),(p==null?void 0:p.length)>0&&e(ye,{countText:(p==null?void 0:p.length)>0?`\u5DF2\u9009\uFF1A${p==null?void 0:p.length}\u4E2A\u56FE\u8C31`:void 0,eventsEmit:S,data:p}),e(Be,{width:740,title:"\u9009\u62E9\u56FE\u8C31",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",className:"assistant-config-resource-bind-modal",open:B,onOk:q,destroyOnHidden:!0,onCancel:()=>$(!1),children:e(Fe,{ref:N,dataSource:E,value:p,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31",renderItem:o=>h("div",{className:"flex ",children:[e("img",{src:he,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o.label,children:o.label})]}),renderSelectedItem:o=>h("div",{className:"flex items-center",children:[e("img",{src:he,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:o.label})})]})})})]})},ku=({value:t,onChange:a,min:n,max:u,step:m,disabled:E,sliderStyle:w,inputStyle:p,inputWidth:F=90})=>{const B=N=>{const l=Array.isArray(N)?N[0]:N;a==null||a(l)},$=N=>{a==null||a(N)};return h("div",{className:"w-full flex overflow-x-auto",children:[e(su,{min:n,max:u,step:m,disabled:E,value:t,onChange:B,style:{width:"200px",...w}}),e(lu,{min:n,max:u,step:m,disabled:E,controls:!1,value:t,onChange:$,style:{width:F,marginLeft:"10px",...p}})]})},ve={header:{titleEdit:"\u7F16\u8F91\u4F1A\u8BDD\u52A9\u624B",titleNew:"\u65B0\u5EFA\u4F1A\u8BDD\u52A9\u624B",confirm:"\u786E\u5B9A"},form:{labels:{assistantName:"\u52A9\u624B\u540D\u79F0",qaModel:"\u95EE\u7B54\u6A21\u578B",planModel:"\u89C4\u5212\u6A21\u578B",multiModel:"\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B",rerankModel:"Rerank\u6A21\u578B",embeddingModel:"\u5411\u91CF\u89E3\u6790\u6A21\u578B",prologue:"\u5F00\u573A\u767D",systemPrompt:"\u63D0\u793A\u8BCD",defaultAssistant:"\u9009\u62E9\u4E3A\u9ED8\u8BA4\u52A9\u624B",recommendModel:"\u95EE\u9898\u63A8\u8350\u6A21\u578B",searchPolicy:"\u68C0\u7D22\u7B56\u7565",temperature:"\u6E29\u5EA6",diversity:"\u591A\u6837\u6027",topK:"\u53EC\u56DE\u6570",scoreThreshold:"\u76F8\u4F3C\u5EA6\u9608\u503C",maxTokens:"\u6700\u5927\u4EE4\u724C\u6570",maxRound:"\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570",enabledFaq:"\u5F00\u542FFAQ\u4F18\u5148",enabledGraph:"\u542F\u7528\u56FE\u8C31\u589E\u5F3A",dependOnKb:"\u5F00\u542F\u5F3A\u4F01\u4E1A\u77E5\u8BC6\u4F9D\u8D56",questionRewrite:"\u5F00\u542F\u95EE\u9898\u6539\u5199",traceSource:"\u5F00\u542F\u6EAF\u6E90",traceStrategy:"\u6EAF\u6E90\u7B56\u7565",allowDownloadTrace:"\u5141\u8BB8\u4E0B\u8F7D\u6EAF\u6E90\u6587\u4EF6"},placeholders:{input:"\u8BF7\u8F93\u5165",select:"\u8BF7\u9009\u62E9",prologue:"\u8BF7\u8F93\u5165\u5F00\u573A\u767D",promptExample:"\u4F8B\u5982\uFF1A"},validation:{assistantNameRequired:"\u8BF7\u8F93\u5165\u52A9\u624B\u540D\u79F0",nameDuplicate:"\u540D\u79F0\u91CD\u590D\uFF01",nameDuplicateShort:"\u540D\u79F0\u91CD\u590D",selectModel:"\u8BF7\u9009\u62E9{{model}}",noModelAvailable:"\u6682\u65E0\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458",modelUnavailable:"\u6A21\u578B\u65E0\u6CD5\u4F7F\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458",validNumberRequired:"\u8BF7\u8F93\u5165\u6709\u6548\u6570\u5B57",numbersOnly:"\u53EA\u80FD\u8F93\u5165\u6570\u5B57",numberRange:"\u8BF7\u8F93\u5165{{min}}\u5230{{max}}\u4E4B\u95F4\u7684\u6570\u5B57"}},paragraph:{retrievalParams:"\u68C0\u7D22\u4E0E\u751F\u6210\u53C2\u6570",featureSwitch:"\u529F\u80FD\u5F00\u5173",resourceBind:"\u8D44\u6E90\u7ED1\u5B9A"},searchPolicyOptions:[{label:"\u6DF7\u5408\u68C0\u7D22",value:1},{label:"\u5168\u6587\u68C0\u7D22",value:2},{label:"\u8BED\u4E49\u68C0\u7D22",value:3}],traceabilityStrategy:[{label:"\u89C4\u5219\u6EAF\u6E90",value:!1},{label:"\u5927\u6A21\u578B\u6EAF\u6E90",value:!0}],explanation:{prompt:"\u63D0\u793A\u8BCD\u7528\u4E8E\u6307\u5B9A\u804A\u5929\u7684\u80CC\u666F\u548C\u4E0A\u4E0B\u6587\uFF0C\u6216\u8005\u8BA9\u52A9\u624B\u91C7\u53D6\u67D0\u4E2A\u4EBA\u683C\u6765\u56DE\u7B54\u4F60\u7684\u95EE\u9898\uFF1B",dependOnKb:"\u5F00\u5173\u5F00\u542F\uFF0C\u5219\u82E5\u7CFB\u7EDF\u672A\u5728\u77E5\u8BC6\u5E93\u3001\u6570\u636E\u5E93\u7B49\u4F01\u4E1A\u77E5\u8BC6\u6570\u636E\u8303\u56F4\u5185\u68C0\u7D22\u5230\u7B54\u6848\uFF0C\u5219\u76F4\u63A5\u62D2\u7EDD\u56DE\u7B54\u76F8\u5173\u95EE\u9898\uFF1B"},defaultPrompt:'\u4F60\u662F\u4E00\u4E2A\u667A\u80FD\u52A9\u624B\uFF0C\u8BF7\u603B\u7ED3\u77E5\u8BC6\u5E93\u7684\u5185\u5BB9\u6765\u56DE\u7B54\u95EE\u9898,\u8BF7\u5217\u4E3E\u77E5\u8BC6\u5E93\u4E2D\u7684\u6570\u636E\u8BE6\u7EC6\u56DE\u7B54\u3002\u5F53\u6240\u6709\u77E5\u8BC6\u5E93\u5185\u5BB9\u90FD\u4E0E\u95EE\u9898\u65E0\u5173\u65F6\uFF0C\u4F60\u7684\u56DE\u7B54\u5FC5\u987B\u5305\u62EC"\u77E5\u8BC6\u5E93\u4E2D\u672A\u627E\u5230\u60A8\u8981\u7684\u7B54\u6848!"',message:{updateSuccess:"\u66F4\u65B0\u52A9\u624B\u914D\u7F6E\u6210\u529F",createSuccess:"\u65B0\u589E\u52A9\u624B\u914D\u7F6E\u6210\u529F"},paramsValidation:{validNumberRequired:"\u8BF7\u8F93\u5165\u6709\u6548\u6570\u5B57",numbersOnly:"\u53EA\u80FD\u8F93\u5165\u6570\u5B57",numberRange:"\u8BF7\u8F93\u5165{{min}}\u5230{{max}}\u4E4B\u95F4\u7684\u6570\u5B57"}},Su={header:{titleEdit:"Edit session assistant",titleNew:"New session assistant",confirm:"Confirm"},form:{labels:{assistantName:"Assistant name",qaModel:"QA model",planModel:"Planning model",multiModel:"Upload document QA multimodal model",rerankModel:"Rerank model",embeddingModel:"Embedding model",prologue:"Prologue",systemPrompt:"System prompt",defaultAssistant:"Set as default assistant",recommendModel:"Question recommendation model",searchPolicy:"Search policy",temperature:"Temperature",diversity:"Diversity",topK:"Top K",scoreThreshold:"Score threshold",maxTokens:"Max tokens",maxRound:"Max conversation rounds",enabledFaq:"Enable FAQ priority",enabledGraph:"Enable graph enhancement",dependOnKb:"Enable strong enterprise knowledge dependency",questionRewrite:"Enable question rewriting",traceSource:"Enable traceability",traceStrategy:"Traceability strategy",allowDownloadTrace:"Allow downloading trace files"},placeholders:{input:"Please enter",select:"Please select",prologue:"Enter prologue",promptExample:"e.g. "},validation:{assistantNameRequired:"Please enter assistant name",nameDuplicate:"Name already exists!",nameDuplicateShort:"Duplicate name",selectModel:"Please select {{model}}",noModelAvailable:"No models available. Contact administrator.",modelUnavailable:"Model unavailable. Contact administrator.",validNumberRequired:"Please enter a valid number",numbersOnly:"Numbers only",numberRange:"Please enter a number between {{min}} and {{max}}"}},paragraph:{retrievalParams:"Retrieval & generation parameters",featureSwitch:"Feature switches",resourceBind:"Resource binding"},searchPolicyOptions:[{label:"Hybrid search",value:1},{label:"Full-text search",value:2},{label:"Semantic search",value:3}],traceabilityStrategy:[{label:"Rule-based traceability",value:!1},{label:"LLM-based traceability",value:!0}],explanation:{prompt:"The prompt defines the chat context and persona for the assistant;",dependOnKb:"When enabled, the assistant will refuse to answer if no relevant content is found in knowledge bases or databases."},defaultPrompt:'You are a helpful assistant. Summarize knowledge base content to answer questions. When content is irrelevant, include "Knowledge base does not contain the answer!" in your response.',message:{updateSuccess:"Assistant config updated",createSuccess:"Assistant config created"},paramsValidation:{validNumberRequired:"Please enter a valid number",numbersOnly:"Numbers only",numberRange:"Please enter a number between {{min}} and {{max}}"}},Mu={header:{titleEdit:"\u30BB\u30C3\u30B7\u30E7\u30F3\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u3092\u7DE8\u96C6",titleNew:"\u65B0\u898F\u30BB\u30C3\u30B7\u30E7\u30F3\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8",confirm:"\u78BA\u5B9A"},form:{labels:{assistantName:"\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u540D",qaModel:"QA\u30E2\u30C7\u30EB",planModel:"\u8A08\u753B\u30E2\u30C7\u30EB",multiModel:"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8QA\u30DE\u30EB\u30C1\u30E2\u30FC\u30C0\u30EB\u30E2\u30C7\u30EB",rerankModel:"Rerank\u30E2\u30C7\u30EB",embeddingModel:"\u57CB\u3081\u8FBC\u307F\u30E2\u30C7\u30EB",prologue:"\u30D7\u30ED\u30ED\u30FC\u30B0",systemPrompt:"\u30B7\u30B9\u30C6\u30E0\u30D7\u30ED\u30F3\u30D7\u30C8",defaultAssistant:"\u30C7\u30D5\u30A9\u30EB\u30C8\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u306B\u3059\u308B",recommendModel:"\u8CEA\u554F\u63A8\u85A6\u30E2\u30C7\u30EB",searchPolicy:"\u691C\u7D22\u6226\u7565",temperature:"\u6E29\u5EA6",diversity:"\u591A\u69D8\u6027",topK:"\u30C8\u30C3\u30D7K",scoreThreshold:"\u30B9\u30B3\u30A2\u95BE\u5024",maxTokens:"\u6700\u5927\u30C8\u30FC\u30AF\u30F3\u6570",maxRound:"\u6700\u5927\u4F1A\u8A71\u30BF\u30FC\u30F3\u6570",enabledFaq:"FAQ\u512A\u5148\u3092\u6709\u52B9\u5316",enabledGraph:"\u30B0\u30E9\u30D5\u5897\u5F37\u3092\u6709\u52B9\u5316",dependOnKb:"\u4F01\u696D\u30CA\u30EC\u30C3\u30B8\u5F37\u4F9D\u5B58\u3092\u6709\u52B9\u5316",questionRewrite:"\u8CEA\u554F\u66F8\u304D\u63DB\u3048\u3092\u6709\u52B9\u5316",traceSource:"\u30C8\u30EC\u30FC\u30B5\u30D3\u30EA\u30C6\u30A3\u3092\u6709\u52B9\u5316",traceStrategy:"\u30C8\u30EC\u30FC\u30B5\u30D3\u30EA\u30C6\u30A3\u6226\u7565",allowDownloadTrace:"\u30C8\u30EC\u30FC\u30B9\u30D5\u30A1\u30A4\u30EB\u306E\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3092\u8A31\u53EF"},placeholders:{input:"\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",select:"\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",prologue:"\u30D7\u30ED\u30ED\u30FC\u30B0\u3092\u5165\u529B",promptExample:"\u4F8B\uFF1A"},validation:{assistantNameRequired:"\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u540D\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",nameDuplicate:"\u540D\u524D\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\uFF01",nameDuplicateShort:"\u540D\u524D\u91CD\u8907",selectModel:"{{model}}\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",noModelAvailable:"\u5229\u7528\u53EF\u80FD\u306A\u30E2\u30C7\u30EB\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u7BA1\u7406\u8005\u306B\u304A\u554F\u3044\u5408\u308F\u305B\u304F\u3060\u3055\u3044\u3002",modelUnavailable:"\u30E2\u30C7\u30EB\u304C\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002\u7BA1\u7406\u8005\u306B\u304A\u554F\u3044\u5408\u308F\u305B\u304F\u3060\u3055\u3044\u3002",validNumberRequired:"\u6709\u52B9\u306A\u6570\u5024\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",numbersOnly:"\u6570\u5B57\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059",numberRange:"{{min}}\u304B\u3089{{max}}\u306E\u6570\u5024\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}},paragraph:{retrievalParams:"\u691C\u7D22\u30FB\u751F\u6210\u30D1\u30E9\u30E1\u30FC\u30BF",featureSwitch:"\u6A5F\u80FD\u30B9\u30A4\u30C3\u30C1",resourceBind:"\u30EA\u30BD\u30FC\u30B9\u30D0\u30A4\u30F3\u30C9"},searchPolicyOptions:[{label:"\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9\u691C\u7D22",value:1},{label:"\u5168\u6587\u691C\u7D22",value:2},{label:"\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u691C\u7D22",value:3}],traceabilityStrategy:[{label:"\u30EB\u30FC\u30EB\u30D9\u30FC\u30B9",value:!1},{label:"LLM\u30D9\u30FC\u30B9",value:!0}],explanation:{prompt:"\u30D7\u30ED\u30F3\u30D7\u30C8\u306F\u30C1\u30E3\u30C3\u30C8\u306E\u80CC\u666F\u3068\u6587\u8108\u3001\u307E\u305F\u306F\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u306E\u30DA\u30EB\u30BD\u30CA\u3092\u6307\u5B9A\u3057\u307E\u3059\uFF1B",dependOnKb:"\u30AA\u30F3\u306B\u3059\u308B\u3068\u3001\u30CA\u30EC\u30C3\u30B8\u30D9\u30FC\u30B9\u3084\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3067\u56DE\u7B54\u304C\u898B\u3064\u304B\u3089\u306A\u3044\u5834\u5408\u3001\u95A2\u9023\u8CEA\u554F\u3078\u306E\u56DE\u7B54\u3092\u62D2\u5426\u3057\u307E\u3059\uFF1B"},defaultPrompt:"\u3042\u306A\u305F\u306F\u30A4\u30F3\u30C6\u30EA\u30B8\u30A7\u30F3\u30C8\u306A\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u3067\u3059\u3002\u30CA\u30EC\u30C3\u30B8\u30D9\u30FC\u30B9\u306E\u5185\u5BB9\u3092\u307E\u3068\u3081\u3066\u8CEA\u554F\u306B\u7B54\u3048\u3066\u304F\u3060\u3055\u3044\u3002\u95A2\u9023\u3059\u308B\u5185\u5BB9\u304C\u306A\u3044\u5834\u5408\u306F\u3001\u56DE\u7B54\u306B\u300C\u30CA\u30EC\u30C3\u30B8\u30D9\u30FC\u30B9\u306B\u8A72\u5F53\u3059\u308B\u56DE\u7B54\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\uFF01\u300D\u3092\u542B\u3081\u3066\u304F\u3060\u3055\u3044\u3002",message:{updateSuccess:"\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u8A2D\u5B9A\u3092\u66F4\u65B0\u3057\u307E\u3057\u305F",createSuccess:"\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u8A2D\u5B9A\u3092\u4F5C\u6210\u3057\u307E\u3057\u305F"},paramsValidation:{validNumberRequired:"\u6709\u52B9\u306A\u6570\u5024\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",numbersOnly:"\u6570\u5B57\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059",numberRange:"{{min}}\u304B\u3089{{max}}\u306E\u6570\u5024\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}},Nu={zh:ve,en:Su,ja:Mu};function oe(t,a){return t.replace(/\{\{(\w+)\}\}/g,(n,u)=>String(a[u]??""))}function Pu(t,a){const n=Nu[t]??ve;return a?{...n,...a}:n}function Ge(t,a){const n=a.split(".");let u=t;for(const m of n)u=u==null?void 0:u[m];return typeof u=="string"?u:a}const We=Ce.createContext({locale:"zh",messages:ve,getMessage:t=>Ge(ve,t)});function Ue(){return Ce.useContext(We)}function Iu({locale:t,messages:a,children:n}){const u=Ce.useMemo(()=>{const m=Pu(t,a);return{locale:t,messages:m,getMessage:E=>Ge(m,E)}},[t,a]);return Ce.createElement(We.Provider,{value:u,children:n})}const{Item:Lu}=be,me=({label:t,name:a,configScale:n})=>{const{messages:u}=Ue(),m=Ee(()=>n[a],[n]),E=(w,p)=>({validator(F,B){return B==null?Promise.reject(u.paramsValidation.validNumberRequired):typeof+B!="number"||isNaN(+B)?Promise.reject(u.paramsValidation.numbersOnly):B<w||B>p?Promise.reject(oe(u.paramsValidation.numberRange,{min:String(w),max:String(p)})):Promise.resolve()}});return e(ue,{span:12,children:e(Lu,{label:t,name:a,tooltip:m.tooltip,rules:[{required:!0,message:""},E(m.min,m.max)],children:e(ku,{min:m.min,max:m.max,step:m.step})})})},Tu=({url:t,token:a,role:n,eventsEmit:u,sectionData:m})=>{const[E,w]=k([]),[p,F]=k([]),[B,$]=k(!1),[N,l]=k([]),H=Q(null),[S,b]=k(!1),q=Q(new Map).current,{fetchGraphBases:o,fetchGraphLabel:r}=pe({url:t,token:a,role:n,eventsEmit:u});j(()=>{s()},[]),j(()=>{if(m){let C=[];(m||[]).map(_=>{const g=(E||[]).find(x=>x.key===_.config_id);if(g){const{key:x,label:v,id:y}=g;C.push({key:x,label:v,id:y,tags:_.labels})}}),F(C)}},[m,E]);const s=async()=>{try{const C=await o();if(C!=null&&C.records){const _=((C==null?void 0:C.records)||[]).map(g=>({key:g.id,label:g.name,id:g.id}));w(_)}}catch(C){console.error(C)}},d=(C,_)=>{switch(C){case"removeItem":const g=p.filter(v=>v.key!==_.key);F([...g]),i(g);break;case"removeTag":const x=p.findIndex(v=>v.key==_.key);x!==-1&&(p[x]=_),F([...p]),i(p)}},i=C=>{const _=(C||[]).map(g=>({config_id:g.id,labels:g.tags}));u&&u("graph_selected",_)},M=()=>{var _;const C=((_=H.current)==null?void 0:_.getSelectedItems())||[];F(C),$(!1),i(C)},D=async(C,_)=>{if(C){const g=q.get(_);if(g){l(g);return}if(!S)try{b(!0);const x=await r(_);if(Array.isArray(x)){const v=x.map(y=>({label:y,value:y}));q.set(_,v),l(v)}b(!1)}catch(x){console.error("Error fetching data:",x),b(!1)}}};return h("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[h("div",{className:"flex items-center justify-between",children:[h("div",{className:"flex items-center",children:[e("img",{src:he}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(te,{color:"primary",variant:"outlined",size:"small",icon:e(xe,{size:14}),onClick:()=>$(!0),children:"\u6DFB\u52A0"})})]}),(p==null?void 0:p.length)>0&&e(ye,{countText:(p==null?void 0:p.length)>0?`\u5DF2\u9009\uFF1A${p==null?void 0:p.length}\u4E2A\u56FE\u8C31\u5E93`:void 0,eventsEmit:d,data:p}),e(Be,{width:740,title:"\u9009\u62E9\u56FE\u8C31\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",className:"assistant-config-resource-bind-modal",open:B,onOk:M,destroyOnHidden:!0,onCancel:()=>$(!1),children:e(Fe,{ref:H,dataSource:E,value:p,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31\u5E93",renderItem:C=>h("div",{className:"flex ",children:[e("img",{src:he,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:C.label,children:C.label})]}),renderSelectedItem:(C,_)=>h("div",{className:"flex ",children:[e("img",{src:he,alt:"add"}),h("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:C.label}),e(Z,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:C.tags||[],onChange:g=>{_(g)},style:{width:250},options:N,loading:S,onOpenChange:g=>{D(g,C.id)}})]})]})})})]})},{Item:R}=be,$u=({url:t,token:a,role:n,id:u,showDatabase:m,showGraph:E,isShare:w,disabled:p,eventsEmit:F,showGraphEnhanced:B,CustomComponents:$,newGraph:N})=>{const{messages:l}=Ue(),{ContentLoading:H}=$??{},[S]=be.useForm(),[b,q]=k(),[o,r]=k(),[s,d]=k(),[i,M]=k(),[D,C]=k(),[_,g]=k(!0),[x,v]=k(!1),[y,c]=k(le),A=Q({}),{getConfigById:P,fetchModels:V,fetchConfigItemLimit:G,checkName:ae,addConversationAssistant:Ye,updateConversationAssistant:Ze}=pe({url:t,token:a,role:n,eventsEmit:F});j(()=>{Qe()},[u]),j(()=>{u?(Array.isArray(o)&&Array.isArray(s)&&S.validateFields(["model_name","plan_model_name","recommend_model_name","rerank_model_name","multi_model_name","embedding_model_name"]),Array.isArray(i)&&S.validateFields(["multi_model_name"])):(Array.isArray(o)&&(o==null?void 0:o.length)==0&&S.validateFields(["model_name","plan_model_name","recommend_model_name","embedding_model_name"]),Array.isArray(s)&&(s==null?void 0:s.length)==0&&S.validateFields(["rerank_model_name"]),Array.isArray(i)&&(i==null?void 0:i.length)==0&&S.validateFields(["multi_model_name"]),Array.isArray(D)&&(D==null?void 0:D.length)==0&&S.validateFields(["embedding_model_name"]))},[s,o,i,D,u]);const Qe=async()=>{let f;if(u){_||g(!0);try{const I=await P(u);if(I){const{configJson:L,...U}=I,W=L&&JSON.parse(L),{knowledge_base_name:J,knowledge_base_name_source:Y,selectedKnowledgeBase:re,sensitiveWordIds:ne,database_name:X,graph_nb_name:ce,graph_db:z}=W;f={...U,...W},A.current={knowledge_base_name:J,knowledge_base_name_source:Y,selectedKnowledgeBase:re,sensitiveWordIds:ne,database_name:X,graph_nb_name:ce,graph_db:z},q(f),S.setFieldsValue(f),g(!1)}}catch{}}else g(!1);await Je(f)},Je=async f=>{var I,L,U,W,J;try{const[Y,re,ne,X,ce]=await Promise.allSettled([V({pageNum:1,pageSize:9999,status:1,type:1}),V({pageNum:1,pageSize:9999,status:1,type:3}),V({pageNum:1,pageSize:9999,status:1,type:4}),G(),V({pageNum:1,pageSize:9999,status:1,type:2})]);if(Y.status==="fulfilled"&&Y.value){const T=(((I=Y.value)==null?void 0:I.records)||[]).map(ee=>({...ee,label:ee.modelName,value:ee.modelName}));if(T.length>0){const ee=(L=T.find(De=>De.value==(f==null?void 0:f.model_name)))==null?void 0:L.maxTokens;(f==null?void 0:f.max_tokens)>ee&&S.setFieldsValue({max_tokens:ee})}r(T)}if(re.status==="fulfilled"&&re.value){const z=(((U=re.value)==null?void 0:U.records)||[]).map(T=>({label:T.modelName||T.name,value:T.modelName||T.name}));d(z),z.length>0&&!(f!=null&&f.rerank_model_name)&&S.setFieldsValue({rerank_model_name:z[0].value})}if(ne.status==="fulfilled"&&ne.value){const z=(((W=ne.value)==null?void 0:W.records)||[]).map(T=>({label:T.modelName||T.name,value:T.modelName||T.name}));M(z),z.length>0&&!(f!=null&&f.multi_model_name)&&S.setFieldsValue({multi_model_name:z[0].value})}if(ce.status==="fulfilled"&&ce.value){const z=(((J=ce.value)==null?void 0:J.records)||[]).map(T=>({label:T.modelName||T.name,value:T.modelName||T.name}));C(z),z.length>0&&!(f!=null&&f.embedding_model_name)&&S.setFieldsValue({embedding_model_name:z[0].value})}if(X.status==="fulfilled"&&X.value&&X.value){const z=X.value;Object.keys(le).forEach(T=>{if(z.hasOwnProperty(T)){const{max:ee,min:De}=z[T];le[T]={...le[T],min:De,max:ee}}}),c(le)}}catch(Y){console.error("\u83B7\u53D6\u5217\u8868\u5931\u8D25:",Y)}},Xe=async(f,I)=>await ae(I,u)?(_e.warning(l.form.validation.nameDuplicate,2),Promise.reject(l.form.validation.nameDuplicateShort)):Promise.resolve(),ie=(f,I)=>({validator(L,U){return U?Array.isArray(f)&&f.length===0||!f.find(W=>W.value==U)?Promise.reject(l.form.validation.modelUnavailable):Promise.resolve():Array.isArray(f)&&f.length===0?Promise.reject(l.form.validation.noModelAvailable):Promise.reject(I)}}),ge=(f,I)=>{switch(f){case"knowledge_selected":A.current={...A.current,...I};break;case"sensitive_selected":A.current={...A.current,sensitiveWordIds:I};break;case"database_selected":A.current={...A.current,database_name:I};break;case"graph_selected":N?A.current={...A.current,graph_db:I}:A.current={...A.current,graph_nb_name:I};break}},eu=async()=>{var I;let f={};try{v(!0);const L=await S.validateFields(),{knowledge_base_name:U,knowledge_base_name_source:W,selectedKnowledgeBase:J,sensitiveWordIds:Y,database_name:re,graph_nb_name:ne,graph_db:X}=A.current;L.thinking=((I=o.find(z=>z.modelName==L.model_name))==null?void 0:I.thinking)||!1,E&&(L.enabled_nb_graph=!0),f={configJson:JSON.stringify({...L,knowledge_base_name:U,knowledge_base_name_source:W,selectedKnowledgeBase:J,sensitiveWordIds:Y,...m?{database_name:re}:{},...E&&!N?{graph_nb_name:ne}:{},...E&&N?{graph_db:X}:{}}),name:L.config_name,isDefault:L.isDefault,defaultAnswer:L.defaultAnswer,dependOnKb:L.dependOnKb,sensitiveWordIds:Y},u?await Ze(u,f)&&(_e.success(l.message.updateSuccess),F&&F("go_back")):await Ye(f)&&(_e.success(l.message.createSuccess),F&&F("go_back"))}catch(L){console.error("submit error",L)}finally{v(!1)}},uu=Ee(()=>{const f={};return Object.keys(le).forEach(I=>{var L;f[I]=(L=le[I])==null?void 0:L.default}),{...hu,...f}},[]);return h("div",{style:{height:"100%",width:"100%"},children:[h("div",{className:"flex items-center justify-between",style:{width:"100%",padding:"4px 10px 16px 10px"},children:[h("div",{className:"flex items-center",children:[e(du,{color:"#2468F2",onClick:()=>F&&F("go_back")}),e("div",{className:"text-[16px] text-[#1D2129] bold",style:{marginLeft:20},children:u?l.header.titleEdit:l.header.titleNew})]}),!_&&e(te,{type:"primary",onClick:()=>eu(),loading:x,disabled:p,children:l.header.confirm})]}),_?H&&e(H,{}):e(be,{style:{padding:20,height:"calc(100vh - 150px)",backgroundColor:"#fff"},form:S,layout:"vertical",initialValues:uu,disabled:p,colon:!1,children:h(se,{gutter:24,style:{height:"100%"},children:[h(ue,{span:12,style:{borderRight:"1px solid #E5E6EB",padding:"10px 32px",height:"100%",overflowY:"auto"},children:[e(R,{label:l.form.labels.assistantName,name:"config_name",validateTrigger:"onBlur",rules:[{required:!0,message:l.form.validation.assistantNameRequired},{validator:Xe}],children:e(Ae,{placeholder:l.form.placeholders.input})}),h(se,{gutter:16,children:[e(ue,{span:12,children:e(R,{label:l.form.labels.qaModel,name:"model_name",rules:[{required:!0,message:""},ie(o,oe(l.form.validation.selectModel,{model:l.form.labels.qaModel}))],children:e(Z,{placeholder:l.form.placeholders.select,options:o,notFoundContent:e(de,{})})})}),e(ue,{span:12,children:e(R,{label:l.form.labels.planModel,name:"plan_model_name",rules:[{required:!0,message:""},ie(o,oe(l.form.validation.selectModel,{model:l.form.labels.planModel}))],children:e(Z,{placeholder:l.form.placeholders.select,options:o,notFoundContent:e(de,{})})})})]}),h(se,{gutter:16,children:[e(ue,{span:12,children:e(R,{label:l.form.labels.multiModel,name:"multi_model_name",rules:[{required:!0,message:""},ie(i,oe(l.form.validation.selectModel,{model:l.form.labels.multiModel}))],children:e(Z,{placeholder:l.form.placeholders.select,options:i,notFoundContent:e(de,{})})})}),e(ue,{span:12,children:e(R,{label:l.form.labels.rerankModel,name:"rerank_model_name",rules:[{required:!0,message:""},ie(s,oe(l.form.validation.selectModel,{model:l.form.labels.rerankModel}))],children:e(Z,{placeholder:l.form.placeholders.select,options:s,notFoundContent:e(de,{})})})})]}),e(se,{gutter:16,children:e(ue,{span:24,children:e(R,{label:l.form.labels.embeddingModel,name:"embedding_model_name",rules:[{required:!0,message:""},ie(D,oe(l.form.validation.selectModel,{model:l.form.labels.embeddingModel}))],children:e(Z,{placeholder:l.form.placeholders.select,options:D,notFoundContent:e(de,{})})})})}),e(R,{label:l.form.labels.prologue,name:"prologue",children:e(Ae.TextArea,{maxLength:50,showCount:!0,placeholder:l.form.placeholders.prologue,autoSize:{minRows:2}})}),e(R,{label:l.form.labels.systemPrompt,name:"system_prompt",tooltip:l.explanation.prompt,children:e(Ae.TextArea,{showCount:!0,rows:8,maxLength:3e3,autoSize:{minRows:10},placeholder:`${l.form.placeholders.promptExample}${l.defaultPrompt}`})}),e(R,{name:"isDefault",valuePropName:"checked",normalize:f=>f===!0?1:0,children:e(Pe,{children:l.form.labels.defaultAssistant})})]}),h(ue,{span:12,style:{height:"100%",padding:"10px 32px",overflowY:"auto"},children:[h(ke,{title:l.paragraph.retrievalParams,children:[e(R,{label:l.form.labels.recommendModel,name:"recommend_model_name",rules:[{required:!0,message:""},ie(o,oe(l.form.validation.selectModel,{model:l.form.labels.recommendModel}))],children:e(Z,{placeholder:l.form.placeholders.select,options:o,notFoundContent:e(de,{})})}),e(R,{label:l.form.labels.searchPolicy,name:"search_policy",children:e(Z,{options:l.searchPolicyOptions,placeholder:l.form.placeholders.select})}),h(se,{gutter:16,children:[e(me,{label:l.form.labels.temperature,name:"temperature",configScale:y}),e(me,{label:l.form.labels.diversity,name:"top_p",configScale:y})]}),h(se,{gutter:16,children:[e(me,{label:l.form.labels.topK,name:"top_k",configScale:y}),e(me,{label:l.form.labels.scoreThreshold,name:"score_threshold",configScale:y})]}),h(se,{gutter:16,children:[e(R,{noStyle:!0,shouldUpdate:(f,I)=>f.model_name!==I.model_name,children:({getFieldValue:f})=>{var W;const I=f("model_name"),L=(W=(o||[]).find(J=>J.value==I))==null?void 0:W.maxTokens;return f("max_tokens")>L&&S.setFieldValue("max_tokens",L),e(me,{label:l.form.labels.maxTokens,name:"max_tokens",configScale:{...y,max_tokens:{...y.max_tokens,max:L||1e4}}})}}),e(me,{label:l.form.labels.maxRound,name:"max_round",configScale:y})]})]}),h(ke,{title:l.paragraph.featureSwitch,children:[e(R,{label:l.form.labels.enabledFaq,name:"enabled_faq",valuePropName:"checked",layout:"horizontal",children:e(fe,{})}),B&&e(R,{label:l.form.labels.enabledGraph,name:"enabled_graph",valuePropName:"checked",layout:"horizontal",children:e(fe,{})}),e(R,{label:l.form.labels.dependOnKb,name:"dependOnKb",valuePropName:"checked",layout:"horizontal",tooltip:l.explanation.dependOnKb,normalize:f=>f===!0?1:0,children:e(fe,{})}),e(R,{label:l.form.labels.questionRewrite,name:"enabled_question_rewrite",valuePropName:"checked",layout:"horizontal",children:e(fe,{})}),e(R,{label:l.form.labels.traceSource,name:"need_trace_source",valuePropName:"checked",layout:"horizontal",children:e(fe,{})}),e(R,{noStyle:!0,shouldUpdate:(f,I)=>f.need_trace_source!==I.need_trace_source,children:({getFieldValue:f})=>f("need_trace_source")?h(je,{children:[e(R,{label:l.form.labels.traceStrategy,name:"trace_by_llm",layout:"horizontal",children:e(Z,{placeholder:l.form.placeholders.select,options:l.traceabilityStrategy})}),e(R,{name:"is_download",valuePropName:"checked",layout:"horizontal",children:e(Pe,{children:l.form.labels.allowDownloadTrace})})]}):null})]}),h(ke,{title:l.paragraph.resourceBind,children:[e(Au,{url:t,token:a,role:n,sectionData:b==null?void 0:b.sensitiveWordIds,eventsEmit:ge,defaultAnswer:b==null?void 0:b.defaultAnswer,form:S}),e(wu,{url:t,token:a,role:n,sectionData:{knowledge_base_name:b==null?void 0:b.knowledge_base_name,knowledge_base_name_source:b==null?void 0:b.knowledge_base_name_source,selectedKnowledgeBase:b==null?void 0:b.selectedKnowledgeBase},createBy:w?b==null?void 0:b.createBy:void 0,eventsEmit:ge}),m&&e(Du,{url:t,token:a,role:n,disabled:p,sectionData:b==null?void 0:b.database_name,eventsEmit:ge}),E&&(N?e(Tu,{url:t,token:a,role:n,sectionData:b==null?void 0:b.graph_db,eventsEmit:ge}):e(_u,{url:t,token:a,role:n,sectionData:b==null?void 0:b.graph_nb_name,eventsEmit:ge}))]})]})]})})]})},Uu=t=>{const{locale:a="zh",messages:n,...u}=t;return e(Iu,{locale:a,messages:n,children:e($u,{...u})})};export{Iu as A,Uu as C,We as a,Pu as g,O as p,Ue as u};
|