@gientech/modual 1.8.0 → 1.8.1

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/graph.svg CHANGED
@@ -1,4 +1,4 @@
1
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect width="24" height="24" rx="3.55556" fill="#00C1B8"/>
3
- <path d="M17.9887 12.582C18.1207 13.6621 17.2267 14.5801 16.1526 14.4901C15.3306 14.4181 14.6645 13.7521 14.6045 12.924C14.5745 12.558 14.6645 12.21 14.8445 11.9159C14.9285 11.7779 14.9045 11.6039 14.8025 11.4899L14.3885 11.0339C14.2805 10.9139 14.1005 10.8839 13.9565 10.9559C13.6144 11.1239 13.2304 11.2199 12.8224 11.2199C12.6244 11.2199 12.4324 11.1959 12.2464 11.1539C12.0963 11.1179 11.9463 11.1779 11.8563 11.3039L11.2803 12.1259C11.1783 12.276 11.1963 12.474 11.3223 12.606C11.8983 13.188 12.2464 13.9921 12.2284 14.8741C12.1924 16.4702 10.9203 17.7963 9.32417 17.9043C7.45804 18.0243 5.90994 16.4942 6.00595 14.6281C6.08995 13.038 7.38604 11.7599 8.97614 11.6879C9.42017 11.6699 9.8402 11.7419 10.2302 11.8919C10.3922 11.9519 10.5722 11.8979 10.6743 11.7599L11.1663 11.0579C11.2743 10.9019 11.2503 10.6919 11.1123 10.5658C10.5302 10.0498 10.1882 9.26976 10.2662 8.4177C10.3742 7.18162 11.3823 6.18556 12.6244 6.09555C14.1245 5.98154 15.3846 7.17562 15.3846 8.65172C15.3846 9.20376 15.2106 9.70779 14.9105 10.1278C14.8085 10.2658 14.8205 10.4578 14.9345 10.5898L15.3786 11.0819C15.4746 11.1899 15.6306 11.2259 15.7626 11.1779C16.0086 11.0939 16.2786 11.0639 16.5606 11.1119C17.3047 11.2259 17.8987 11.8319 17.9887 12.582Z" fill="white"/>
4
- </svg>
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="24" height="24" rx="3.55556" fill="#00C1B8"/>
3
+ <path d="M17.9887 12.582C18.1207 13.6621 17.2267 14.5801 16.1526 14.4901C15.3306 14.4181 14.6645 13.7521 14.6045 12.924C14.5745 12.558 14.6645 12.21 14.8445 11.9159C14.9285 11.7779 14.9045 11.6039 14.8025 11.4899L14.3885 11.0339C14.2805 10.9139 14.1005 10.8839 13.9565 10.9559C13.6144 11.1239 13.2304 11.2199 12.8224 11.2199C12.6244 11.2199 12.4324 11.1959 12.2464 11.1539C12.0963 11.1179 11.9463 11.1779 11.8563 11.3039L11.2803 12.1259C11.1783 12.276 11.1963 12.474 11.3223 12.606C11.8983 13.188 12.2464 13.9921 12.2284 14.8741C12.1924 16.4702 10.9203 17.7963 9.32417 17.9043C7.45804 18.0243 5.90994 16.4942 6.00595 14.6281C6.08995 13.038 7.38604 11.7599 8.97614 11.6879C9.42017 11.6699 9.8402 11.7419 10.2302 11.8919C10.3922 11.9519 10.5722 11.8979 10.6743 11.7599L11.1663 11.0579C11.2743 10.9019 11.2503 10.6919 11.1123 10.5658C10.5302 10.0498 10.1882 9.26976 10.2662 8.4177C10.3742 7.18162 11.3823 6.18556 12.6244 6.09555C14.1245 5.98154 15.3846 7.17562 15.3846 8.65172C15.3846 9.20376 15.2106 9.70779 14.9105 10.1278C14.8085 10.2658 14.8205 10.4578 14.9345 10.5898L15.3786 11.0819C15.4746 11.1899 15.6306 11.2259 15.7626 11.1779C16.0086 11.0939 16.2786 11.0639 16.5606 11.1119C17.3047 11.2259 17.8987 11.8319 17.9887 12.582Z" fill="white"/>
4
+ </svg>
@@ -0,0 +1,157 @@
1
+ import{jsxs as c,jsx as e,Fragment as Me}from"react/jsx-runtime";import He,{useState as x,forwardRef as qe,useEffect as W,useMemo as ce,useImperativeHandle as Ve,useRef as se}from"react";import{c as ge,a5 as ve,a as Ke,B as re,W as H,a6 as We,a7 as ke,i as O,F as de,a8 as _e,I as fe,a9 as Y,aa as Ze,ab as Ue,n as ne,R as ae,a4 as oe}from"./index-C0f77Ai0.js";import{X as Xe}from"./x-B50yFeY5.js";import{P as Fe}from"./plus-CrrWzgTO.js";import{M as Ee,s as Be}from"./index-D1PtBLCr.js";import{S as Ge}from"./index-BQWU6aA6.js";/* empty css *//**
2
+ * @license lucide-react v0.456.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Je=ge("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
7
+ * @license lucide-react v0.456.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const De=ge("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
12
+ * @license lucide-react v0.456.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Oe=ge("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"}]]);/**
17
+ * @license lucide-react v0.456.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const Ye=ge("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),ye=({title:n,defaultExpanded:s=!0,className:a,children:u})=>{const[h,F]=x(s);return c("div",{className:a,children:[c("div",{className:"flex items-center justify-between",style:{marginBottom:"10px"},children:[c("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:n})]}),h?e(De,{onClick:()=>F(b=>!b),color:"#4E6EF2",size:18}):e(ve,{onClick:()=>F(b=>!b),color:"#4E5969",size:18})]}),u?e("div",{style:{display:h?"block":"none"},children:u}):null]})},ie=()=>c("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:c("g",{transform:"translate(0 1)",fill:"none","fill-rule":"evenodd",children:[e("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),c("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"})]}),Qe="\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",eu="\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",uu='\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!"',tu="\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",te={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"}},nu={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},su=[{label:"\u6DF7\u5408\u68C0\u7D22",value:1},{label:"\u5168\u6587\u68C0\u7D22",value:2},{label:"\u8BED\u4E49\u68C0\u7D22",value:3}],ru=[{label:"\u89C4\u5219\u6EAF\u6E90",value:!1},{label:"\u5927\u6A21\u578B\u6EAF\u6E90",value:!0}],he=({url:n,token:s,role:a,eventsEmit:u})=>{const h=Ke.create({baseURL:n,timeout:1e6});return h.interceptors.request.use(l=>{let t=s;return!t&&!["user/login","user/kaptcha","user/regist"].some(d=>l.url.includes(d))?(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"))):(l.headers.Authorization=t||"",l.headers.userName=a==="\u672A\u767B\u5F55\u7528\u6237"?"":a,l)}),h.interceptors.response.use(l=>{const t=["user/kaptcha"],r=l.data;if(t.some(_=>l.config.url&&l.config.url.includes(_))||r.size&&r.type)return r;const{success:d,errorMsg:E,errorCode:m}=r;if(d)return r;u&&u("request:error_business",{errorCode:m,errorMsg:E||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:r})},l=>{var t,r,d,E,m,_,v,I,Z;if(l.message==="canceled")return Promise.reject(l);if(u){let g="request:error_network",A={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:l};((t=l==null?void 0:l.response)==null?void 0:t.status)===401?(g="request:error_auth",A={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:l,redirect:"/login"}):(((d=(r=l==null?void 0:l.response)==null?void 0:r.data)==null?void 0:d.errorCode)==="30013"||((m=(E=l==null?void 0:l.response)==null?void 0:E.data)==null?void 0:m.errorCode)==="30023")&&(g="request:error_business",A={errorCode:(v=(_=l==null?void 0:l.response)==null?void 0:_.data)==null?void 0:v.errorCode,errorMsg:((Z=(I=l==null?void 0:l.response)==null?void 0:I.data)==null?void 0:Z.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:l}),u(g,A)}return Promise.reject(l)}),{getConfigById:async l=>{try{const t=await h.get(`/qa/search/config/getById?configId=${l}`),{success:r,data:d}=t;return r?d:!1}catch(t){console.error("getConfigById",t)}},fetchDatabases:async()=>{try{const l=await h.get("/index/database/queryAllDBList"),{success:t,data:r}=l;return t?r:!1}catch(l){console.error("fetchDatabases",l)}},fetchModels:async l=>{try{const t=await h.get(`/index/modelInfo/allPage?${new URLSearchParams(l).toString()}`),{success:r,data:d}=t;return r?d:!1}catch(t){return console.log("fetchModels error",t),!1}},fetchSensitiveLibrary:async l=>{try{const t=await h.get(`/sensitive/library?${new URLSearchParams(l).toString()}`),{success:r,data:d}=t;return r?d:!1}catch(t){return console.log("fetchSensitiveLibrary error",t),!1}},fetchConfigItemLimit:async()=>{try{const l=await h.get("/qa/search/config/configItemLimit"),{success:t,data:r}=l;return t?r:!1}catch(l){console.error("fetchConfigItemLimit error",l)}},fetchKnowledgeBase:async l=>{try{const t=l?`?userName=${l}`:"";console.log("+++",t);const r=await h.get(`/index/knowledgeBase/searchList${t}`),{success:d,data:E}=r;return d?E:!1}catch(t){console.log("e",t)}},fetchGraphs:async()=>{try{const l=await h.get("/index/graph/platform/querySnapshotList?pageSize=999&pageNo=1"),{success:t,data:r}=l;return t?r:!1}catch(l){console.error("fetchGraphs",l)}},checkName:async(l,t)=>{try{const r=await h.get(`/qa/search/config/checkName?configName=${l}${t?`&configId=${t}`:""}`),{success:d,data:E}=r;if(d)return E}catch(r){return console.log("updateConversationAssistant error:",r),!1}},getBizLabelLabels:async l=>{try{const t=await h.post("/index/bizLabel/labels",l),{success:r,data:d}=t;if(r)return d}catch(t){return console.log("updateConversationAssistant error:",t),!1}},addConversationAssistant:async l=>{try{const t=await h.post("/qa/search/config/add",{...l}),{success:r,data:d}=t;if(r)return d}catch(t){return console.log("addConversationAssistant error:",t),!1}},updateConversationAssistant:async(l,t)=>{try{const r=await h.put("/qa/search/config/update",{id:l,...t}),{success:d,data:E}=r;if(d)return E}catch(r){return console.log("updateConversationAssistant error:",r),!1}}}},Ce=({countText:n,eventsEmit:s,data:a})=>{const[u,h]=x(!0);return c("div",{style:{marginTop:8},children:[n&&c("div",{className:"flex items-center gap-2",children:[e("span",{style:{color:u?"#4E6EF2":"#4E5969"},children:n}),u?e(De,{onClick:()=>h(F=>!F),color:"#4E6EF2",size:14}):e(ve,{onClick:()=>h(F=>!F),color:"#4E5969",size:14})]}),e("div",{style:{display:u?"block":"none"},children:a.map(F=>e(au,{item:F,eventsEmit:s},F.key))})]})},au=({item:n,eventsEmit:s})=>{var h,F,b;const[a,u]=x(!0);return c("div",{className:"flex items-center justify-between",style:{padding:"8px 12px",borderRadius:6},children:[c("div",{children:[c("div",{style:{color:"#1D2129"},className:"flex items-center",children:[n.label,((h=n==null?void 0:n.tags)==null?void 0:h.length)>0&&c(Me,{children:[c("span",{style:{color:"#4E5969",marginLeft:"6px",marginRight:6},children:["(",(F=n==null?void 0:n.tags)==null?void 0:F.length,"\u4E2A\u6807\u7B7E)"]}),a?e(De,{onClick:()=>u(p=>!p),color:"#4E6EF2",size:14}):e(ve,{onClick:()=>u(p=>!p),color:"#4E5969",size:14})]})]}),((b=n==null?void 0:n.tags)==null?void 0:b.length)>0&&e("div",{className:"flex flex-wrap gap-4",style:{display:a?"block":"none",marginTop:8},children:((n==null?void 0:n.tags)||[]).map(p=>e(re,{iconPosition:"end",type:"text",style:{backgroundColor:"#F0F0F0",padding:"2px 6px",height:22,borderRadius:2,color:"#1D2129",margin:5},icon:e(Xe,{size:14,color:"#86909C",onClick:()=>{const i={...n,tags:n.tags.filter(B=>B!==p)};s("removeTag",i)}}),children:p},p))})]}),e(re,{type:"text",icon:e(Oe,{size:14}),onClick:()=>s("removeItem",n)})]},n.key)},lu=H.div`
22
+ display: flex;
23
+ background-color: #ffffff;
24
+ border: 1px solid ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.border)==null?void 0:u.default)||"#e5e7eb"}};
25
+ border-radius: ${n=>{var s,a;return((a=(s=n.$theme)==null?void 0:s.space)==null?void 0:a.radius)||"8px"}};
26
+ overflow: hidden;
27
+ width: ${n=>n.$width||"600px"};
28
+ height: ${n=>n.$height||"400px"};
29
+ position: relative;
30
+ `,Se=H.div`
31
+ display: flex;
32
+ flex-direction: column;
33
+ border-right: 1px solid ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.border)==null?void 0:u.default)||"#e5e7eb"}};
34
+ overflow: hidden;
35
+
36
+ &:last-child {
37
+ border-right: none;
38
+ }
39
+ `,ou=H.div`
40
+ padding: 12px 16px;
41
+ font-weight: 400;
42
+ font-size: 14px;
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: space-between;
46
+ color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.text)==null?void 0:u.primary)||"#4E5969"}};
47
+ `,iu=H.div`
48
+ font-weight: 400;
49
+ font-size: 14px;
50
+ color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.text)==null?void 0:u.primary)||"#4E6EF2"}};
51
+ `,cu=H.div`
52
+ padding: 12px;
53
+ background-color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.background)==null?void 0:u.default)||"#ffffff"}};
54
+ `,du=H.input`
55
+ width: 100%;
56
+ padding: 8px 12px 8px 12px;
57
+ border: 1px solid ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.border)==null?void 0:u.default)||"#e5e7eb"}};
58
+ border-radius: ${n=>{var s,a;return((a=(s=n.$theme)==null?void 0:s.space)==null?void 0:a.radius)||"6px"}};
59
+ font-size: 14px;
60
+ outline: none;
61
+ transition: all 0.2s;
62
+
63
+ &:focus {
64
+ border-color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.primary)==null?void 0:u.default)||"#3b82f6"}};
65
+ box-shadow: 0 0 0 3px ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.primary)==null?void 0:u.default)||"#3b82f6"}}20;
66
+ }
67
+
68
+ &::placeholder {
69
+ color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.text)==null?void 0:u.tertiary)||"#9ca3af"}};
70
+ }
71
+ `,hu=H.div`
72
+ position: absolute;
73
+ right: 20px;
74
+ top: 50%;
75
+ transform: translateY(-50%);
76
+ color: #9ca3af;
77
+ pointer-events: none;
78
+ `,Ne=H.div`
79
+ flex: 1;
80
+ overflow-y: auto;
81
+ overflow-x: hidden;
82
+
83
+ &::-webkit-scrollbar {
84
+ width: 6px;
85
+ }
86
+
87
+ &::-webkit-scrollbar-track {
88
+ background: #f1f1f1;
89
+ }
90
+
91
+ &::-webkit-scrollbar-thumb {
92
+ background: #c1c1c1;
93
+ border-radius: 3px;
94
+
95
+ &:hover {
96
+ background: #a8a8a8;
97
+ }
98
+ }
99
+ `,$e=H.div`
100
+ padding: 10px 16px;
101
+ cursor: ${n=>n.$disabled?"not-allowed":"pointer"};
102
+ transition: all 0.2s;
103
+ display: flex;
104
+ align-items: center;
105
+ justify-content: space-between;
106
+ opacity: ${n=>n.$disabled?.5:1};
107
+
108
+ &:hover {
109
+ background-color: ${n=>{var s,a,u;return n.$disabled?"transparent":((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.background)==null?void 0:u.hover)||"#f3f4f6"}};
110
+ }
111
+
112
+ &:last-child {
113
+ border-bottom: none;
114
+ }
115
+ `,Ie=H.span`
116
+ flex: 1;
117
+ font-size: 14px;
118
+ color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.text)==null?void 0:u.primary)||"#111827"}};
119
+ overflow: hidden;
120
+ text-overflow: ellipsis;
121
+ white-space: nowrap;
122
+ `,Le=H.button`
123
+ display: flex;
124
+ align-items: center;
125
+ justify-content: center;
126
+ width: 68px;
127
+ border: none;
128
+ background-color: #ebecf3;
129
+ border-radius: 4px;
130
+ cursor: pointer;
131
+ font-size: 12px;
132
+ color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.text)==null?void 0:u.secondary)||"#1D2129"}};
133
+ transition: all 0.2s;
134
+
135
+ &:disabled {
136
+ cursor: not-allowed;
137
+ color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.text)==null?void 0:u.secondary)||"#C9CDD4"}};
138
+ }
139
+ `,ze=H.div`
140
+ padding: 40px 20px;
141
+ text-align: center;
142
+ color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.text)==null?void 0:u.tertiary)||"#9ca3af"}};
143
+ font-size: 14px;
144
+ `;H.span`
145
+ display: inline-flex;
146
+ align-items: center;
147
+ justify-content: center;
148
+ min-width: 20px;
149
+ height: 20px;
150
+ padding: 0 6px;
151
+ background-color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.primary)==null?void 0:u.default)||"#3b82f6"}};
152
+ color: white;
153
+ border-radius: 10px;
154
+ font-size: 12px;
155
+ font-weight: 500;
156
+ margin-left: 8px;
157
+ `;const me=qe(({dataSource:n,value:s=[],onConfirm:a,maxCount:u=0,searchPlaceholder:h="\u641C\u7D22...",title:F="",showSearch:b=!0,filterOption:p,renderItem:i,renderSelectedItem:B,className:z,style:y,styles:f,height:R,width:w},j)=>{const l=We(),t=ke(ke({theme:O,mode:"light"},l),f),[r,d]=x(s),[E,m]=x("");W(()=>{d(s)},[s]),ce(()=>new Set(s.map(o=>o.key)),[s]);const _=ce(()=>new Set(r.map(o=>o.key)),[r]);Ve(j,()=>({getSelectedItems:()=>r,confirm:()=>{a==null||a(r)}}),[r,a]);const I=p||((o,D)=>{var q;if(!o)return!0;const k=o.toLowerCase();return D.label.toLowerCase().includes(k)||((q=D.tags)==null?void 0:q.some(V=>V.toLowerCase().includes(k)))||!1}),Z=ce(()=>(n||[]).filter(o=>I(E,o)),[n,E,I]),g=o=>{const D=_.has(o.key);let k;if(D)k=(r||[]).filter(q=>q.key!==o.key);else{if(u>0&&r.length>=u)return;k=[...r,o]}d(k)},A=(o,D)=>{d(k=>k.map(V=>V.key==o?{...V,tags:D}:V))},N=o=>{const D=(r||[]).filter(k=>k.key!==o.key);d(D)},$=o=>_.has(o);return u>0&&r.length>=u,c(lu,{$theme:t.theme||O,$width:w,$height:R,className:z,style:y,children:[c(Se,{$theme:t.theme||O,style:{flex:1},children:[b&&e(cu,{$theme:t.theme||O,children:c("div",{style:{position:"relative"},children:[e(hu,{children:e(Ye,{size:16})}),e(du,{$theme:t.theme||O,type:"text",placeholder:h,value:E,onChange:o=>m(o.target.value)})]})}),e(Ne,{children:Z.length===0?e(ze,{$theme:t.theme||O,children:E?"\u672A\u627E\u5230\u5339\u914D\u9879":"\u6682\u65E0\u6570\u636E"}):Z.map(o=>{const D=$(o.key);return c($e,{$theme:t.theme||O,$selected:D,children:[e(Ie,{$theme:t.theme||O,children:i?i(o):o.label}),D&&e(Le,{$theme:t.theme||O,onClick:k=>{k.stopPropagation(),N(o)},disabled:!0,children:"\u5DF2\u6DFB\u52A0"}),!D&&e(Le,{$theme:t.theme||O,onClick:k=>{k.stopPropagation(),g(o)},children:"\u6DFB\u52A0"})]},o.key)})})]}),c(Se,{$theme:t.theme||O,style:{flex:1},children:[c(ou,{$theme:t.theme||O,children:[u>0?`\u5DF2\u9009\uFF1A${r.length}/${u}\u4E2A${F}`:`\u5DF2\u9009\uFF1A${r.length}\u4E2A${F}`,e(iu,{$theme:t.theme||O,onClick:o=>{o.stopPropagation(),d([])},children:"\u6E05\u7A7A"})]}),e(Ne,{children:r.length===0?e(ze,{$theme:t.theme||O,children:"\u6682\u65E0\u5DF2\u9009\u9879"}):r.map(o=>{var k,q,V;const D=Q=>A(o.key,Q);return c($e,{$theme:t.theme||O,children:[e(Ie,{$theme:t.theme||O,children:B?B(o,D):o.label}),e(Oe,{size:14,color:((V=(q=(k=t.theme)==null?void 0:k.colors)==null?void 0:q.text)==null?void 0:V.secondary)||"#86909C",style:{cursor:"pointer"},onClick:Q=>{Q.stopPropagation(),N(o)}})]},o.key)})})]})]})});me.displayName="SearchableSelector";const be="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:mu}=de,pu=({url:n,token:s,role:a,eventsEmit:u,sectionData:h,defaultAnswer:F,form:b})=>{const[p,i]=x([]),[B,z]=x([]),[y,f]=x(!1),[R,w]=x(!1),j=se(null),{fetchSensitiveLibrary:l}=he({url:n,token:s,role:a,eventsEmit:u});W(()=>{t()},[]),W(()=>{if(h&&(p==null?void 0:p.length)>0){let m=h?Array.isArray(h)?h:h.split(","):[],_=[];m.forEach(v=>{const I=(p||[]).find(Z=>Z.key===v);I&&_.push({key:I.key,label:I.label})}),z(_)}},[h,p]),W(()=>{F&&w(!0)},[F]);const t=async()=>{try{const m=await l({pageNo:1,pageSize:9999});if(m!=null&&m.records){const _=((m==null?void 0:m.records)||[]).map(v=>({key:v.id+"",label:v.name}));i(_)}}catch(m){console.error(m)}},r=(m,_)=>{switch(m){case"removeItem":const v=B.filter(I=>I.key!==_.key);z([...v]),d(v);break}},d=m=>{const _=m.map(v=>(v==null?void 0:v.key)||"").filter(v=>v).join(",");u&&u("sensitive_selected",_)},E=()=>{var _;const m=((_=j.current)==null?void 0:_.getSelectedItems())||[];z(m),f(!1),d(m)};return c("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[c("div",{className:"flex items-center justify-between",children:[c("div",{className:"flex items-center",children:[e("img",{src:be}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u654F\u611F\u8BCD"})]}),e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Fe,{size:14}),onClick:()=>f(!0),children:"\u6DFB\u52A0"})]}),e(_e,{checked:R,onChange:m=>{w(m.target.checked),m.target.checked?b.setFieldsValue({defaultAnswer:tu}):b.setFieldsValue({defaultAnswer:""})},style:{marginBottom:8,marginTop:8},children:"\u81EA\u5B9A\u4E49\u56DE\u590D"}),R&&e(mu,{label:"\u81EA\u5B9A\u4E49\u56DE\u590D\u5185\u5BB9",name:"defaultAnswer",layout:"vertical",children:e(fe.TextArea,{style:{height:"55px",resize:"none"}})}),(B==null?void 0:B.length)>0&&e(Ce,{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(Ee,{width:740,title:"\u9009\u62E9\u654F\u611F\u8BCD",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:y,onOk:E,onCancel:()=>f(!1),destroyOnHidden:!0,className:"assistant-config-resource-bind-modal",children:e(me,{ref:j,dataSource:p,value:B,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u654F\u611F\u8BCD\u5E93",renderItem:m=>c("div",{className:"flex ",children:[e("img",{src:be,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:m.label,children:m.label})]}),renderSelectedItem:(m,_)=>c("div",{className:"flex items-center",children:[e("img",{src:be,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:m.label})})]})})})]})},Ae="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",fu=({url:n,token:s,role:a,sectionData:u,createBy:h,eventsEmit:F})=>{const[b,p]=x(),[i,B]=x([]),[z,y]=x(!1),f=se(null),[R,w]=x(!1),[j,l]=x([]),t=se(new Map).current,{fetchKnowledgeBase:r,getBizLabelLabels:d}=he({url:n,token:s,role:a,eventsEmit:F}),E=se(!1);W(()=>{E.current||(h?(m(h),E.current=!0):(m(),E.current=!0))},[h]),W(()=>{if(u&&(b==null?void 0:b.length)>0){const g=u==null?void 0:u.knowledge_base_name_source,A=g&&(Array.isArray(g)?g:g.split(";"));let N=[];(A||[]).forEach($=>{const o=((u==null?void 0:u.selectedKnowledgeBase)||[]).find(X=>X.name==$),D=(b||[]).find(X=>X.knowledge_base_name_source===$),{key:k,label:q,knowledge_base_name:V,knowledge_base_name_source:Q}=D;N.push({key:k,label:q,knowledge_base_name:V,knowledge_base_name_source:Q,tags:o==null?void 0:o.labels})}),B(N)}},[u,b]);const m=async g=>{try{const A=await r(g);if(A){const N=(A||[]).map($=>({key:$.id,label:$.kbName,knowledge_base_name:$.primitiveName,knowledge_base_name_source:$.kbName}));p(N)}}catch(A){console.error(A)}},_=(g,A)=>{switch(g){case"removeItem":const N=i.filter(o=>o.key!==A.key);B([...N]),v(N);break;case"removeTag":const $=i.findIndex(o=>o.key==A.key);$!==-1&&(i[$]=A),B([...i]),v(i);break}},v=g=>{const A=(g||[]).map(o=>(o==null?void 0:o.knowledge_base_name)||"").filter(o=>o).join(";"),N=(g||[]).map(o=>(o==null?void 0:o.knowledge_base_name_source)||"").filter(o=>o).join(";"),$=(g||[]).filter(o=>{var D;return Array.isArray(o==null?void 0:o.tags)&&((D=o.tags)==null?void 0:D.length)>0}).map(o=>({id:o.key,name:o.label,knowledge_base_name_source:o.knowledge_base_name_source,labels:o.tags}));F&&F("knowledge_selected",{knowledge_base_name:A,knowledge_base_name_source:N,selectedKnowledgeBase:$})},I=()=>{var A;const g=((A=f.current)==null?void 0:A.getSelectedItems())||[];B(g),y(!1),v(g)},Z=async(g,A)=>{if(g){const N=t.get(A);if(N){l(N);return}if(!R)try{w(!0);const $=await d({kbNames:[A]});if(Array.isArray($)){const o=$.length?$[0].label:"",D=o?(o||"").split(",").map(k=>({label:k,value:k})):[];t.set(A,D),l(D)}w(!1)}catch($){console.error("Error fetching data:",$),w(!1)}}};return c("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[c("div",{className:"flex items-center justify-between",children:[c("div",{className:"flex items-center",children:[e("img",{src:Ae}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u77E5\u8BC6\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Fe,{size:14}),onClick:()=>y(!0),children:"\u6DFB\u52A0"})})]}),(i==null?void 0:i.length)>0&&e(Ce,{countText:(i==null?void 0:i.length)>0?`\u5DF2\u9009\uFF1A${i==null?void 0:i.length}\u4E2A\u77E5\u8BC6\u5E93`:void 0,eventsEmit:_,data:i}),e(Ee,{width:740,className:"assistant-config-resource-bind-modal",title:"\u9009\u62E9\u77E5\u8BC6\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:z,onOk:I,onCancel:()=>y(!1),destroyOnHidden:!0,children:e(me,{ref:f,dataSource:b,value:i,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u77E5\u8BC6\u5E93",renderItem:g=>c("div",{className:"flex ",children:[e("img",{src:Ae,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:g.label,children:g.label})]}),renderSelectedItem:(g,A)=>c("div",{className:"flex ",children:[e("img",{src:Ae,alt:"add"}),c("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:g.label}),e(Y,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:g.tags||[],onChange:N=>{A(N)},style:{width:250},options:j,loading:R,onOpenChange:N=>{Z(N,g.knowledge_base_name)}})]})]})})})]})},gu=He.memo(fu),we="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",Pe=10,Fu=({url:n,token:s,role:a,eventsEmit:u,sectionData:h,disabled:F})=>{const[b,p]=x([]),[i,B]=x([]),[z,y]=x(!1),f=se(null),{fetchDatabases:R}=he({url:n,token:s,role:a,eventsEmit:u});W(()=>{w()},[]),W(()=>{if(h){let t=[];(h||[]).map(r=>{const d=(b||[]).find(E=>E.key===r.key);if(d){const{key:E,label:m}=d;t.push({key:E,label:m})}}),B(t)}},[h,b]);const w=async()=>{try{const t=await R();if(t){const r=(t||[]).map(d=>({key:d.primitiveName,label:d.name}));p(r)}}catch(t){console.error(t)}},j=(t,r)=>{switch(t){case"removeItem":const d=i.filter(E=>E.key!==r.key);B([...d]),u&&u("database_selected",d);break}},l=()=>{var r;const t=((r=f.current)==null?void 0:r.getSelectedItems())||[];B(t),y(!1),u&&u("database_selected",t)};return c("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[c("div",{className:"flex items-center justify-between",children:[c("div",{className:"flex items-center",children:[e("img",{src:we}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u6570\u636E\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Fe,{size:14}),onClick:()=>y(!0),disabled:i.length>=Pe||F,children:"\u6DFB\u52A0"})})]}),(i==null?void 0:i.length)>0&&e(Ce,{countText:(i==null?void 0:i.length)>0?`\u5DF2\u9009\uFF1A${i==null?void 0:i.length}\u4E2A\u6570\u636E\u5E93`:void 0,eventsEmit:j,data:i}),e(Ee,{width:740,title:"\u9009\u62E9\u6570\u636E\u5E93",className:"assistant-config-resource-bind-modal",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:z,onOk:l,onCancel:()=>y(!1),destroyOnHidden:!0,children:e(me,{ref:f,dataSource:b,value:i,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u6570\u636E\u5E93",maxCount:Pe,renderItem:t=>c("div",{className:"flex ",children:[e("img",{src:we,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.label,children:t.label})]}),renderSelectedItem:(t,r)=>c("div",{className:"flex items-center",children:[e("img",{src:we,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:t.label})})]})})})]})},xe="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",Eu=({url:n,token:s,role:a,eventsEmit:u,sectionData:h})=>{const[F,b]=x([]),[p,i]=x([]),[B,z]=x(!1),y=se(null),{fetchGraphs:f}=he({url:n,token:s,role:a,eventsEmit:u});W(()=>{R()},[]),W(()=>{if(h){let t=[];(h||[]).map(r=>{const d=(F||[]).find(E=>E.key===r.index_name);if(d){const{key:E,label:m}=d;t.push({key:E,label:m})}}),i(t)}},[h,F]);const R=async()=>{try{const t=await f();if(t!=null&&t.dataList){const r=((t==null?void 0:t.dataList)||[]).map(d=>({key:d.schemaId,label:d.name}));b(r)}}catch(t){console.error(t)}},w=(t,r)=>{switch(t){case"removeItem":const d=p.filter(E=>E.key!==r.key);i([...d]),j(d);break}},j=t=>{const r=(t||[]).map(d=>({graph_name:d.label,index_name:d.key}));u&&u("graph_selected",r)},l=()=>{var r;const t=((r=y.current)==null?void 0:r.getSelectedItems())||[];i(t),z(!1),j(t)};return c("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[c("div",{className:"flex items-center justify-between",children:[c("div",{className:"flex items-center",children:[e("img",{src:xe}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Fe,{size:14}),onClick:()=>z(!0),children:"\u6DFB\u52A0"})})]}),(p==null?void 0:p.length)>0&&e(Ce,{countText:(p==null?void 0:p.length)>0?`\u5DF2\u9009\uFF1A${p==null?void 0:p.length}\u4E2A\u56FE\u8C31`:void 0,eventsEmit:w,data:p}),e(Ee,{width:740,title:"\u9009\u62E9\u56FE\u8C31",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",className:"assistant-config-resource-bind-modal",open:B,onOk:l,destroyOnHidden:!0,onCancel:()=>z(!1),children:e(me,{ref:y,dataSource:F,value:p,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31",renderItem:t=>c("div",{className:"flex ",children:[e("img",{src:xe,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.label,children:t.label})]}),renderSelectedItem:t=>c("div",{className:"flex items-center",children:[e("img",{src:xe,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:t.label})})]})})})]})},Cu=({value:n,onChange:s,min:a,max:u,step:h,disabled:F,sliderStyle:b,inputStyle:p,inputWidth:i=90})=>{const B=y=>{const f=Array.isArray(y)?y[0]:y;s==null||s(f)},z=y=>{s==null||s(y)};return c(Ge,{style:{width:"100%"},children:[e(Ze,{min:a,max:u,step:h,disabled:F,value:n,onChange:B,style:{width:"200px",flex:1,...b}}),e(Ue,{min:a,max:u,step:h,disabled:F,controls:!1,value:n,onChange:z,style:{width:i,...p}})]})},{Item:Bu}=de,le=({label:n,name:s,configScale:a})=>{const u=ce(()=>a[s],[a]),h=(F,b)=>({validator(p,i){return i==null?Promise.reject("\u8BF7\u8F93\u5165\u6709\u6548\u6570\u5B57"):typeof+i!="number"||isNaN(+i)?Promise.reject("\u53EA\u80FD\u8F93\u5165\u6570\u5B57"):i<F||i>b?Promise.reject(`\u8BF7\u8F93\u5165${F}\u5230${b}\u4E4B\u95F4\u7684\u6570\u5B57`):Promise.resolve()}});return e(ne,{span:12,children:e(Bu,{label:n,name:s,tooltip:u.tooltip,rules:[{required:!0,message:""},h(u.min,u.max)],children:e(Cu,{min:u.min,max:u.max,step:u.step})})})},{Item:M}=de,ku=({url:n,token:s,role:a,id:u,showDatabase:h,showGraph:F,isShare:b,disabled:p,eventsEmit:i,CustomComponents:B})=>{const{ContentLoading:z}=B,[y]=de.useForm(),[f,R]=x(),[w,j]=x(),[l,t]=x(),[r,d]=x(),[E,m]=x(!0),[_,v]=x(!1),[I,Z]=x(te),g=se({}),{getConfigById:A,fetchModels:N,fetchConfigItemLimit:$,checkName:o,addConversationAssistant:D,updateConversationAssistant:k}=he({url:n,token:s,role:a,eventsEmit:i});W(()=>{q()},[u]),W(()=>{u?(Array.isArray(w)&&Array.isArray(l)&&y.validateFields(["model_name","plan_model_name","recommend_model_name","rerank_model_name","multi_model_name"]),Array.isArray(r)&&y.validateFields(["multi_model_name"])):(Array.isArray(w)&&(w==null?void 0:w.length)==0&&y.validateFields(["model_name","plan_model_name","recommend_model_name"]),Array.isArray(l)&&(l==null?void 0:l.length)==0&&y.validateFields(["rerank_model_name"]),Array.isArray(r)&&(r==null?void 0:r.length)==0&&y.validateFields(["multi_model_name"]))},[l,w,r,u]);const q=async()=>{let C;if(u){E||m(!0);try{const S=await A(u);if(S){const{configJson:L,...G}=S,K=L&&JSON.parse(L),{knowledge_base_name:ee,knowledge_base_name_source:ue,selectedKnowledgeBase:J,sensitiveWordIds:T,database_name:P,graph_nb_name:U}=K;C={...G,...K},g.current={knowledge_base_name:ee,knowledge_base_name_source:ue,selectedKnowledgeBase:J,sensitiveWordIds:T,database_name:P,graph_nb_name:U},R(C),console.log("_configData--->",C),y.setFieldsValue(C),m(!1)}}catch{}}else m(!1);await V(C)},V=async C=>{var S,L,G;try{const[K,ee,ue,J]=await Promise.allSettled([N({pageNum:1,pageSize:9999,status:1,type:1}),N({pageNum:1,pageSize:9999,status:1,type:3}),N({pageNum:1,pageSize:9999,status:1,type:4}),$()]);if(K.status==="fulfilled"&&K.value){const P=(((S=K.value)==null?void 0:S.records)||[]).map(U=>({...U,label:U.modelName,value:U.modelName}));j(P)}if(ee.status==="fulfilled"&&ee.value){const T=(((L=ee.value)==null?void 0:L.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));t(T),T.length>0&&!(C!=null&&C.rerank_model_name)&&y.setFieldsValue({rerank_model_name:T[0].value})}if(ue.status==="fulfilled"&&ue.value){const T=(((G=ue.value)==null?void 0:G.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));d(T),T.length>0&&!(C!=null&&C.multi_model_name)&&y.setFieldsValue({multi_model_name:T[0].value})}if(J.status==="fulfilled"&&J.value&&J.value){const T=J.value;Object.keys(te).forEach(P=>{if(T.hasOwnProperty(P)){const{max:U,min:je}=T[P];te[P]={...te[P],min:je,max:U}}}),Z(te)}}catch(K){console.error("\u83B7\u53D6\u5217\u8868\u5931\u8D25:",K)}},Q=async(C,S)=>await o(S,u)?(Be.warning("\u540D\u79F0\u91CD\u590D\uFF01",2),Promise.reject("\u540D\u79F0\u91CD\u590D")):Promise.resolve(),X=(C,S)=>({validator(L,G){return G?Array.isArray(C)&&C.length===0||!C.find(K=>K.value==G)?Promise.reject("\u6A21\u578B\u65E0\u6CD5\u4F7F\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.resolve():Array.isArray(C)&&C.length===0?Promise.reject("\u6682\u65E0\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.reject(S)}}),pe=(C,S)=>{switch(console.log("++++\u52A9\u624B\u914D\u7F6E",C,S),C){case"knowledge_selected":g.current={...g.current,...S};break;case"sensitive_selected":g.current={...g.current,sensitiveWordIds:S};break;case"database_selected":g.current={...g.current,database_name:S};break;case"graph_selected":g.current={...g.current,graph_nb_name:S};break}},Te=async()=>{var S;let C={};try{v(!0);const L=await y.validateFields(),{knowledge_base_name:G,knowledge_base_name_source:K,selectedKnowledgeBase:ee,sensitiveWordIds:ue,database_name:J,graph_nb_name:T}=g.current;L.thinking=((S=w.find(U=>U.modelName==L.model_name))==null?void 0:S.thinking)||!1,C={configJson:JSON.stringify({...L,knowledge_base_name:G,knowledge_base_name_source:K,selectedKnowledgeBase:ee,sensitiveWordIds:ue,...h?{database_name:J}:{},...F?{graph_nb_name:T}:{}}),name:L.config_name,isDefault:L.isDefault,defaultAnswer:L.defaultAnswer,dependOnKb:L.dependOnKb},u?await k(u,C)&&(Be.success("\u66F4\u65B0\u52A9\u624B\u914D\u7F6E\u6210\u529F"),i&&i("go_back")):await D(C)&&(Be.success("\u65B0\u589E\u52A9\u624B\u914D\u7F6E\u6210\u529F"),i&&i("go_back"))}catch(L){console.error("submit error",L)}finally{v(!1)}},Re=ce(()=>{const C={};return Object.keys(te).forEach(S=>{var L;C[S]=(L=te[S])==null?void 0:L.default}),{...nu,...C}},[]);return c("div",{style:{height:"100%",width:"100%"},children:[c("div",{className:"flex items-center justify-between",style:{width:"100%",padding:"4px 10px 16px 10px"},children:[c("div",{className:"flex items-center",children:[e(Je,{color:"#2468F2",onClick:()=>i&&i("go_back")}),e("div",{className:"text-[16px] text-[#1D2129] bold",style:{marginLeft:20},children:u?"\u7F16\u8F91\u4F1A\u8BDD\u52A9\u624B":"\u65B0\u5EFA\u4F1A\u8BDD\u52A9\u624B"})]}),!E&&e(re,{type:"primary",onClick:()=>Te(),loading:_,disabled:p,children:"\u786E\u5B9A"})]}),E?z&&e(z,{}):e(de,{style:{padding:20,height:"calc(100vh - 150px)",backgroundColor:"#fff"},form:y,layout:"vertical",initialValues:Re,disabled:p,colon:!1,children:c(ae,{gutter:24,style:{height:"100%"},children:[c(ne,{span:12,style:{borderRight:"1px solid #E5E6EB",padding:"10px 32px",height:"100%",overflowY:"auto"},children:[e(M,{label:"\u52A9\u624B\u540D\u79F0",name:"config_name",validateTrigger:"onBlur",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u52A9\u624B\u540D\u79F0"},{validator:Q}],children:e(fe,{placeholder:"\u8BF7\u8F93\u5165"})}),c(ae,{gutter:16,children:[e(ne,{span:12,children:e(M,{label:"\u95EE\u7B54\u6A21\u578B",name:"model_name",rules:[{required:!0,message:""},X(w,"\u8BF7\u9009\u62E9\u95EE\u7B54\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:w,notFoundContent:e(ie,{})})})}),e(ne,{span:12,children:e(M,{label:"\u89C4\u5212\u6A21\u578B",name:"plan_model_name",rules:[{required:!0,message:""},X(w,"\u8BF7\u9009\u62E9\u89C4\u5212\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:w,notFoundContent:e(ie,{})})})})]}),c(ae,{gutter:16,children:[e(ne,{span:12,children:e(M,{label:"\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B",name:"multi_model_name",rules:[{required:!0,message:""},X(r,"\u8BF7\u9009\u62E9\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:r,notFoundContent:e(ie,{})})})}),e(ne,{span:12,children:e(M,{label:"Rerank\u6A21\u578B",name:"rerank_model_name",rules:[{required:!0,message:""},X(l,"\u8BF7\u9009\u62E9Rerank\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:l,notFoundContent:e(ie,{})})})})]}),e(M,{label:"\u5F00\u573A\u767D",name:"prologue",children:e(fe.TextArea,{maxLength:50,showCount:!0,placeholder:"\u8BF7\u8F93\u5165\u5F00\u573A\u767D",autoSize:{minRows:2}})}),e(M,{label:"\u63D0\u793A\u8BCD",name:"system_prompt",tooltip:Qe,children:e(fe.TextArea,{showCount:!0,rows:8,maxLength:3e3,autoSize:{minRows:10},placeholder:`\u4F8B\u5982\uFF1A${uu}`})}),e(M,{name:"isDefault",valuePropName:"checked",normalize:C=>C===!0?1:0,children:e(_e,{children:"\u9009\u62E9\u4E3A\u9ED8\u8BA4\u52A9\u624B"})})]}),c(ne,{span:12,style:{height:"100%",padding:"10px 32px",overflowY:"auto"},children:[c(ye,{title:"\u68C0\u7D22\u4E0E\u751F\u6210\u53C2\u6570",children:[e(M,{label:"\u95EE\u9898\u63A8\u8350\u6A21\u578B",name:"recommend_model_name",rules:[{required:!0,message:""},X(w,"\u8BF7\u9009\u62E9\u95EE\u9898\u63A8\u8350\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:w,notFoundContent:e(ie,{})})}),e(M,{label:"\u68C0\u7D22\u7B56\u7565",name:"search_policy",children:e(Y,{options:su,placeholder:"\u8BF7\u9009\u62E9"})}),c(ae,{gutter:16,children:[e(le,{label:"\u6E29\u5EA6",name:"temperature",configScale:I}),e(le,{label:"\u591A\u6837\u6027",name:"top_p",configScale:I})]}),c(ae,{gutter:16,children:[e(le,{label:"\u53EC\u56DE\u6570",name:"top_k",configScale:I}),e(le,{label:"\u76F8\u4F3C\u5EA6\u9608\u503C",name:"score_threshold",configScale:I})]}),c(ae,{gutter:16,children:[e(le,{label:"\u6700\u5927\u4EE4\u724C\u6570",name:"max_tokens",configScale:I}),e(le,{label:"\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570",name:"max_round",configScale:I})]})]}),c(ye,{title:"\u529F\u80FD\u5F00\u5173",children:[e(M,{label:"\u5F00\u542FFAQ\u4F18\u5148",name:"enabled_faq",valuePropName:"checked",layout:"horizontal",children:e(oe,{})}),e(M,{label:"\u542F\u7528\u56FE\u8C31\u589E\u5F3A",name:"enabled_graph",valuePropName:"checked",layout:"horizontal",children:e(oe,{})}),e(M,{label:"\u5F00\u542F\u5F3A\u4F01\u4E1A\u77E5\u8BC6\u4F9D\u8D56",name:"dependOnKb",valuePropName:"checked",layout:"horizontal",tooltip:eu,normalize:C=>C===!0?1:0,children:e(oe,{})}),e(M,{label:"\u5F00\u542F\u95EE\u9898\u6539\u5199",name:"enabled_question_rewrite",valuePropName:"checked",layout:"horizontal",children:e(oe,{})}),e(M,{label:"\u5F00\u542F\u6EAF\u6E90",name:"need_trace_source",valuePropName:"checked",layout:"horizontal",children:e(oe,{})}),e(M,{noStyle:!0,shouldUpdate:(C,S)=>C.need_trace_source!==S.need_trace_source,children:({getFieldValue:C})=>C("need_trace_source")?c(Me,{children:[e(M,{label:"\u6EAF\u6E90\u7B56\u7565",name:"trace_by_llm",layout:"horizontal",children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:ru})}),e(M,{name:"is_download",valuePropName:"checked",layout:"horizontal",children:e(_e,{children:"\u5141\u8BB8\u4E0B\u8F7D\u6EAF\u6E90\u6587\u4EF6"})})]}):null})]}),c(ye,{title:"\u8D44\u6E90\u7ED1\u5B9A",children:[e(pu,{url:n,token:s,role:a,sectionData:f==null?void 0:f.sensitiveWordIds,eventsEmit:pe,defaultAnswer:f==null?void 0:f.defaultAnswer,form:y}),e(gu,{url:n,token:s,role:a,sectionData:{knowledge_base_name:f==null?void 0:f.knowledge_base_name,knowledge_base_name_source:f==null?void 0:f.knowledge_base_name_source,selectedKnowledgeBase:f==null?void 0:f.selectedKnowledgeBase},createBy:b?f==null?void 0:f.createBy:void 0,eventsEmit:pe}),h&&e(Fu,{url:n,token:s,role:a,disabled:p,sectionData:f==null?void 0:f.database_name,eventsEmit:pe}),F&&e(Eu,{url:n,token:s,role:a,sectionData:f==null?void 0:f.graph_nb_name,eventsEmit:pe})]})]})]})})]})};export{ku as C,Ye as S};
@@ -1,4 +1,4 @@
1
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect width="20" height="20" rx="2.22222" fill="#00B2F9"/>
3
- <path d="M5.3125 13.9672V13.975C5.32812 14.6938 5.89922 15.2734 6.61875 15.2734H13.9062C14.3375 15.2734 14.6875 14.9289 14.6875 14.4977V5.50703C14.6875 5.40447 14.6673 5.30292 14.628 5.20818C14.5887 5.11344 14.5312 5.02736 14.4586 4.95488C14.3861 4.8824 14.2999 4.82492 14.2052 4.78575C14.1104 4.74657 14.0088 4.72646 13.9062 4.72656H6.875C6.01172 4.72656 5.3125 5.42031 5.3125 6.28359V13.9672ZM7.5 9.24531V6.25C7.5 6.07813 7.64062 5.9375 7.8125 5.9375H9.6875C9.86016 5.9375 10 6.07813 10 6.25V9.24531C10 9.30716 9.98175 9.36762 9.94741 9.41906C9.91308 9.47049 9.86425 9.51058 9.80712 9.53426C9.74999 9.55793 9.68712 9.56412 9.62647 9.55204C9.56581 9.53996 9.51011 9.51016 9.46641 9.46641L8.97109 8.97109C8.94207 8.94204 8.90761 8.91899 8.86967 8.90326C8.83173 8.88754 8.79107 8.87944 8.75 8.87944C8.70893 8.87944 8.66827 8.88754 8.63033 8.90326C8.59239 8.91899 8.55793 8.94204 8.52891 8.97109L8.03359 9.46641C7.98989 9.51016 7.93418 9.53996 7.87353 9.55204C7.81288 9.56412 7.75001 9.55793 7.69288 9.53426C7.63575 9.51058 7.58692 9.47049 7.55259 9.41906C7.51825 9.36762 7.49995 9.30716 7.5 9.24531ZM6.54375 14.2063C6.45208 14.1156 6.40625 14.0052 6.40625 13.875C6.40625 13.7458 6.45208 13.6354 6.54375 13.5438C6.6349 13.4521 6.74531 13.4062 6.875 13.4062H13.5938V14.3438H6.875C6.74531 14.3438 6.6349 14.2979 6.54375 14.2063Z" fill="white"/>
4
- </svg>
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="20" height="20" rx="2.22222" fill="#00B2F9"/>
3
+ <path d="M5.3125 13.9672V13.975C5.32812 14.6938 5.89922 15.2734 6.61875 15.2734H13.9062C14.3375 15.2734 14.6875 14.9289 14.6875 14.4977V5.50703C14.6875 5.40447 14.6673 5.30292 14.628 5.20818C14.5887 5.11344 14.5312 5.02736 14.4586 4.95488C14.3861 4.8824 14.2999 4.82492 14.2052 4.78575C14.1104 4.74657 14.0088 4.72646 13.9062 4.72656H6.875C6.01172 4.72656 5.3125 5.42031 5.3125 6.28359V13.9672ZM7.5 9.24531V6.25C7.5 6.07813 7.64062 5.9375 7.8125 5.9375H9.6875C9.86016 5.9375 10 6.07813 10 6.25V9.24531C10 9.30716 9.98175 9.36762 9.94741 9.41906C9.91308 9.47049 9.86425 9.51058 9.80712 9.53426C9.74999 9.55793 9.68712 9.56412 9.62647 9.55204C9.56581 9.53996 9.51011 9.51016 9.46641 9.46641L8.97109 8.97109C8.94207 8.94204 8.90761 8.91899 8.86967 8.90326C8.83173 8.88754 8.79107 8.87944 8.75 8.87944C8.70893 8.87944 8.66827 8.88754 8.63033 8.90326C8.59239 8.91899 8.55793 8.94204 8.52891 8.97109L8.03359 9.46641C7.98989 9.51016 7.93418 9.53996 7.87353 9.55204C7.81288 9.56412 7.75001 9.55793 7.69288 9.53426C7.63575 9.51058 7.58692 9.47049 7.55259 9.41906C7.51825 9.36762 7.49995 9.30716 7.5 9.24531ZM6.54375 14.2063C6.45208 14.1156 6.40625 14.0052 6.40625 13.875C6.40625 13.7458 6.45208 13.6354 6.54375 13.5438C6.6349 13.4521 6.74531 13.4062 6.875 13.4062H13.5938V14.3438H6.875C6.74531 14.3438 6.6349 14.2979 6.54375 14.2063Z" fill="white"/>
4
+ </svg>
@@ -1,5 +1,5 @@
1
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect width="20" height="20" rx="2.22222" fill="#FFCC3C"/>
3
- <path d="M13.3263 12.7917H7.53763C7.33426 12.8116 7.17923 12.9825 7.17923 13.1867C7.17923 13.3909 7.33426 13.5618 7.53763 13.5817H13.3277C13.3828 13.5871 13.4384 13.5809 13.4909 13.5634C13.5435 13.546 13.5918 13.5178 13.6328 13.4806C13.6738 13.4434 13.7066 13.3981 13.729 13.3474C13.7514 13.2968 13.763 13.2421 13.763 13.1867C13.763 13.1313 13.7514 13.0766 13.729 13.026C13.7066 12.9753 13.6738 12.93 13.6328 12.8928C13.5918 12.8556 13.5435 12.8274 13.4909 12.8099C13.4384 12.7925 13.3828 12.7863 13.3277 12.7917H13.3263ZM9.19742 7.60418L8.84232 8.55193H9.57339L9.19742 7.60418Z" fill="white"/>
4
- <path d="M15.3211 14.7707V6.9692H14.4704V14.3543H6.70511C6.06668 14.3392 5.55704 13.8173 5.55704 13.1788C5.55704 12.5402 6.06668 12.0184 6.70511 12.0033H13.352C13.4644 12.0075 13.5735 11.9648 13.653 11.8852C13.6923 11.8459 13.7231 11.7988 13.7434 11.747C13.7638 11.6952 13.7731 11.6398 13.771 11.5842V5.20102C13.7736 5.14526 13.7646 5.08958 13.7445 5.03752C13.7244 4.98546 13.6936 4.93816 13.6542 4.89865C13.6148 4.85915 13.5675 4.82832 13.5155 4.80812C13.4634 4.78792 13.4077 4.7788 13.352 4.78134H6.70511C5.60281 4.80136 4.71609 5.69369 4.70291 6.79599V13.1759C4.71609 14.283 5.61038 15.1773 6.71756 15.1905H14.8893C15.0042 15.1994 15.1173 15.1585 15.1999 15.0782C15.2407 15.0385 15.2727 14.9905 15.2936 14.9375C15.3145 14.8845 15.3239 14.8276 15.3211 14.7707ZM8.98782 6.78585H9.44888L10.7213 9.92562H10.2475L9.9075 9.06759H8.51871L8.19742 9.92562H7.72354L8.98782 6.78585Z" fill="white"/>
5
- </svg>
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="20" height="20" rx="2.22222" fill="#FFCC3C"/>
3
+ <path d="M13.3263 12.7917H7.53763C7.33426 12.8116 7.17923 12.9825 7.17923 13.1867C7.17923 13.3909 7.33426 13.5618 7.53763 13.5817H13.3277C13.3828 13.5871 13.4384 13.5809 13.4909 13.5634C13.5435 13.546 13.5918 13.5178 13.6328 13.4806C13.6738 13.4434 13.7066 13.3981 13.729 13.3474C13.7514 13.2968 13.763 13.2421 13.763 13.1867C13.763 13.1313 13.7514 13.0766 13.729 13.026C13.7066 12.9753 13.6738 12.93 13.6328 12.8928C13.5918 12.8556 13.5435 12.8274 13.4909 12.8099C13.4384 12.7925 13.3828 12.7863 13.3277 12.7917H13.3263ZM9.19742 7.60418L8.84232 8.55193H9.57339L9.19742 7.60418Z" fill="white"/>
4
+ <path d="M15.3211 14.7707V6.9692H14.4704V14.3543H6.70511C6.06668 14.3392 5.55704 13.8173 5.55704 13.1788C5.55704 12.5402 6.06668 12.0184 6.70511 12.0033H13.352C13.4644 12.0075 13.5735 11.9648 13.653 11.8852C13.6923 11.8459 13.7231 11.7988 13.7434 11.747C13.7638 11.6952 13.7731 11.6398 13.771 11.5842V5.20102C13.7736 5.14526 13.7646 5.08958 13.7445 5.03752C13.7244 4.98546 13.6936 4.93816 13.6542 4.89865C13.6148 4.85915 13.5675 4.82832 13.5155 4.80812C13.4634 4.78792 13.4077 4.7788 13.352 4.78134H6.70511C5.60281 4.80136 4.71609 5.69369 4.70291 6.79599V13.1759C4.71609 14.283 5.61038 15.1773 6.71756 15.1905H14.8893C15.0042 15.1994 15.1173 15.1585 15.1999 15.0782C15.2407 15.0385 15.2727 14.9905 15.2936 14.9375C15.3145 14.8845 15.3239 14.8276 15.3211 14.7707ZM8.98782 6.78585H9.44888L10.7213 9.92562H10.2475L9.9075 9.06759H8.51871L8.19742 9.92562H7.72354L8.98782 6.78585Z" fill="white"/>
5
+ </svg>
@@ -1 +1 @@
1
- import"react/jsx-runtime";import"react";import{C as s}from"./assets/index-DV_mya3D.js";/* empty css */import"./assets/index-C0f77Ai0.js";import"./assets/index-D1PtBLCr.js";import"./assets/x-B50yFeY5.js";import"./assets/plus-CrrWzgTO.js";import"./assets/index-BQWU6aA6.js";import"react-dom";export{s as default};
1
+ import"react/jsx-runtime";import"react";import{C as s}from"./assets/index-BU3ahTSx.js";/* empty css */import"./assets/index-C0f77Ai0.js";import"./assets/index-D1PtBLCr.js";import"./assets/x-B50yFeY5.js";import"./assets/plus-CrrWzgTO.js";import"./assets/index-BQWU6aA6.js";import"react-dom";export{s as default};
package/chat.js CHANGED
@@ -1,4 +1,4 @@
1
- import{jsx as Z,jsxs as et,Fragment as hp}from"react/jsx-runtime";import*as C from"react";import ke,{useRef as tt,useEffect as vt,Component as AC,forwardRef as Ai,createElement as Jl,createContext as fs,version as $H,useMemo as Vt,useContext as or,useState as at,Children as aI,useCallback as o3,useImperativeHandle as Sc,useLayoutEffect as sI,cloneElement as lI,isValidElement as cI,PureComponent as AH}from"react";import{c as Ji,g as OC,au as uI,h as $c,an as dI,aN as fI,B as So,aB as OH,d as sr,u as hI,a3 as pI,aF as NC,A as NH,aE as MH,ad as ql,E as r2,v as gI,x as Yi,bT as o2,T as MC,m as mI,r as vI,f as xo,K as i2,b5 as DH,av as TH,ay as PH,aw as IH,bU as FH,ac as xd,z as RH,bV as La,bW as eo,_ as Fi,bz as yI,bA as bI,aW as xI,G as Er,bN as Lr,aV as EI,y as BH,aJ as wI,bh as CI,bX as i3,bC as _H,bY as jH,l as kI,bu as LH,bE as zH,ap as HH,k as a3,at as s3,aZ as WH,bZ as VH,aP as SI,a as Ur,I as Wu,i as DC,F as Ra,aK as pp,b_ as $I,bR as GH,a7 as qH,b$ as sm}from"./assets/index-C0f77Ai0.js";import{I as ar,d as l3,C as AI,T as UH,b as YH}from"./assets/index-BtzZe0dg.js";import*as XH from"react-dom";import c3,{flushSync as Vu,createPortal as OI,unstable_batchedUpdates as KH}from"react-dom";import{D as ZH,T as QH,F as JH,q as u3}from"./assets/index-6rZwr24p.js";import{u as pa}from"./assets/index-CpW6Dhpp.js";/* empty css */import{P as NI}from"./assets/plus-CrrWzgTO.js";import{S as a2}from"./assets/index-DV_mya3D.js";import{X as gp}from"./assets/x-B50yFeY5.js";import{A as eW,i as tW,s as rr,M as mp,S as Xd}from"./assets/index-D1PtBLCr.js";import{g as d3,P as nW,a as MI}from"./assets/index-DNf62wMu.js";import{C as rW,G as DI,c as oW,r as iW}from"./assets/GientechStreamReader-COjGWi_s.js";import{B as oCe}from"./assets/GientechStreamReader-COjGWi_s.js";import{P as aW}from"./assets/index-B16gaAst.js";import"./database.js";import"./databaseTable.js";import"./modelManage.js";import"./sensitive.js";import{D as sW}from"./assets/index-NBU1h9MU.js";import"./assets/index-BQWU6aA6.js";import"./assets/index-Cqand6Yl.js";import"./assets/index-CTXs951x.js";/**
1
+ import{jsx as Z,jsxs as et,Fragment as hp}from"react/jsx-runtime";import*as C from"react";import ke,{useRef as tt,useEffect as vt,Component as AC,forwardRef as Ai,createElement as Jl,createContext as fs,version as $H,useMemo as Vt,useContext as or,useState as at,Children as aI,useCallback as o3,useImperativeHandle as Sc,useLayoutEffect as sI,cloneElement as lI,isValidElement as cI,PureComponent as AH}from"react";import{c as Ji,g as OC,au as uI,h as $c,an as dI,aN as fI,B as So,aB as OH,d as sr,u as hI,a3 as pI,aF as NC,A as NH,aE as MH,ad as ql,E as r2,v as gI,x as Yi,bT as o2,T as MC,m as mI,r as vI,f as xo,K as i2,b5 as DH,av as TH,ay as PH,aw as IH,bU as FH,ac as xd,z as RH,bV as La,bW as eo,_ as Fi,bz as yI,bA as bI,aW as xI,G as Er,bN as Lr,aV as EI,y as BH,aJ as wI,bh as CI,bX as i3,bC as _H,bY as jH,l as kI,bu as LH,bE as zH,ap as HH,k as a3,at as s3,aZ as WH,bZ as VH,aP as SI,a as Ur,I as Wu,i as DC,F as Ra,aK as pp,b_ as $I,bR as GH,a7 as qH,b$ as sm}from"./assets/index-C0f77Ai0.js";import{I as ar,d as l3,C as AI,T as UH,b as YH}from"./assets/index-BtzZe0dg.js";import*as XH from"react-dom";import c3,{flushSync as Vu,createPortal as OI,unstable_batchedUpdates as KH}from"react-dom";import{D as ZH,T as QH,F as JH,q as u3}from"./assets/index-6rZwr24p.js";import{u as pa}from"./assets/index-CpW6Dhpp.js";/* empty css */import{P as NI}from"./assets/plus-CrrWzgTO.js";import{S as a2}from"./assets/index-BU3ahTSx.js";import{X as gp}from"./assets/x-B50yFeY5.js";import{A as eW,i as tW,s as rr,M as mp,S as Xd}from"./assets/index-D1PtBLCr.js";import{g as d3,P as nW,a as MI}from"./assets/index-DNf62wMu.js";import{C as rW,G as DI,c as oW,r as iW}from"./assets/GientechStreamReader-COjGWi_s.js";import{B as oCe}from"./assets/GientechStreamReader-COjGWi_s.js";import{P as aW}from"./assets/index-B16gaAst.js";import"./database.js";import"./databaseTable.js";import"./modelManage.js";import"./sensitive.js";import{D as sW}from"./assets/index-NBU1h9MU.js";import"./assets/index-BQWU6aA6.js";import"./assets/index-Cqand6Yl.js";import"./assets/index-CTXs951x.js";/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -604,7 +604,7 @@ ${v.substring(Y)}`;y(J),requestAnimationFrame(()=>{U.selectionStart=U.selectionE
604
604
  border-color: ${n.primary};
605
605
  box-shadow: 0 0 0 2px ${n.primary}1A;
606
606
  }
607
- `};function tse({config:e,styles:t}){if(!e)return null;const n=JSON.parse(e.configJson),r=Vt(()=>{var o;return{...DC.colors,...(o=t==null?void 0:t.theme)==null?void 0:o.colors}},[t]);return et("div",{className:"w-[340px] rounded-xl p-4 animate-fade-in bg-white",children:[et("div",{className:"flex items-center mb-2",children:[Z("span",{className:"text-md font-bold truncate mr-2",style:{color:r.primary},children:n.config_name||"\u52A9\u624B\u914D\u7F6E"}),Z("span",{className:"text-xs truncate rounded px-2 py-0.5",style:{backgroundColor:`${r.primary}1A`,color:r.disabled},children:n.model_name})]}),Z("div",{className:"border-b my-2",style:{borderColor:r.border}}),et("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-700 mb-2",style:{color:r.text},children:[et("div",{children:["\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570\uFF1A",Z("span",{className:"font-semibold",children:n.max_round})]}),et("div",{children:["\u6700\u5927\u4EE4\u724C\u6570\uFF1A",Z("span",{className:"font-semibold",children:n.max_tokens})]}),et("div",{children:["\u6E29\u5EA6\uFF1A",Z("span",{className:"font-semibold",children:n.temperature})]}),et("div",{children:["\u53EC\u56DE\u6570\uFF1A",Z("span",{className:"font-semibold",children:n.top_k})]}),et("div",{children:["\u591A\u6837\u6027\uFF1A",Z("span",{className:"font-semibold",children:n.top_p})]}),et("div",{children:["\u76F8\u4F3C\u5EA6\u9608\u503C\uFF1A",Z("span",{className:"font-semibold",children:n.score_threshold})]})]}),et("div",{className:"mb-2",children:[Z("div",{className:"text-xs text-gray-400 mb-1",style:{color:r.disabled},children:"\u5173\u8054\u77E5\u8BC6\u5E93\uFF1A"}),Z("div",{className:"flex flex-wrap gap-1",children:n.knowledge_base_name?n.knowledge_base_name.split(";").map((o,i)=>Z("span",{className:"px-2 py-0.5 rounded-full text-xs",style:{backgroundColor:`${r.primary}1A`,color:r.primary},children:o},i)):Z("span",{className:"text-gray-300",style:{color:r.disabled},children:"\u65E0"})})]}),et("div",{className:"mb-2",children:[Z("div",{className:"text-xs text-gray-400 mb-1",style:{color:r.disabled},children:"\u5F00\u542F\u529F\u80FD:"}),et("div",{className:"flex flex-wrap gap-2 text-xs mt-2",children:[!!n.enabled_faq&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"FAQ"}),!!n.enabled_graph&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u56FE\u8C31"}),!!n.dependOnKb&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u5F3A\u77E5\u8BC6\u4F9D\u8D56"}),!!n.enabled_table_select&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u8868\u683C\u7B5B\u9009"}),!!n.enabled_rerank&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u7CBE\u6392\u6A21\u5F0F"}),!!n.need_trace_source&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u6EAF\u6E90"}),!!n.is_download&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u4E0B\u8F7D\u6EAF\u6E90"})]})]})]})}function nse(e,t=[],n=60){const[r,o]=at("");return vt(()=>{o("");let i=0;const a=setInterval(()=>{o(s=>i>=e.length?(clearInterval(a),s):(i++,e.slice(0,i)))},n);return()=>clearInterval(a)},[e,...t]),r}function rse(e){const{assistantList:t,eventsEmit:n,styles:r,selectedId:o,onSelectAssistant:i,productLogo:a}=e,[s,l]=at(1),[c,u]=at(!1),[d,f]=at(""),h=c||d.trim()?6:12,m=tt(),g=tt(!1),p=tt(null),v=tt(null),y=tt("");vt(()=>{o&&m.current!==o&&(n==null||n("conversation:new_assistant_change",{assistantId:o}),m.current=o)},[o,n]);const b=Vt(()=>pa(),[]);vt(()=>{var A;if((A=r==null?void 0:r.theme)!=null&&A.colors){const N=document.createElement("style");return N.innerHTML=ese(r.theme.colors,b),N.id=`g-welcome-styles-${b}`,document.head.appendChild(N),()=>{const M=document.getElementById(N.id);M&&M.remove()}}},[r,b]);const E=Vt(()=>t.find(A=>A.id===o),[t,o]),x=Vt(()=>JSON.parse((E==null?void 0:E.configJson)||"{}"),[E]),w=Vt(()=>{if(!d.trim())return t||[];const A=d.toLowerCase().trim();return(t||[]).filter(N=>{var D,P;const M=((D=N.name)==null?void 0:D.toLowerCase())||"";try{const R=((P=JSON.parse(N.configJson||"{}").config_name)==null?void 0:P.toLowerCase())||"";return M.includes(A)||R.includes(A)}catch{return M.includes(A)}})},[t,d]),k=Math.ceil(((w==null?void 0:w.length)||0)/h),S=(w==null?void 0:w.slice((s-1)*h,s*h))||[];vt(()=>{if(o&&o!==v.current){if(g.current&&p.current!==null){v.current=o;return}const A=d.trim()?w:t;if(A&&A.length>0){const N=A.findIndex(M=>M.id===o);if(N!==-1){const M=Math.floor(N/h)+1;l(M),v.current=o}}}},[o,t,w,h,d]),vt(()=>{if(d!==y.current){if(g.current&&p.current!==null){l(p.current),g.current=!1,p.current=null,y.current=d;return}if(v.current===o){y.current=d;return}g.current||(d.trim()&&(v.current=null),l(1)),y.current=d}},[d,o]),vt(()=>{k>0&&s>k&&l(k)},[k,s]);const O=x.prologue||"\u60A8\u597D\uFF0C\u6B22\u8FCE\u4F7F\u7528\u5C0F\u9CB8\u667A\u80FD\u95EE\u7B54",$=nse(O,[o],30);return et("div",{className:`flex flex-col relative items-center justify-center h-full w-full g-welcome-${b}`,children:[Z("img",{src:a||Qae,alt:"logo",className:"mb-4",style:{width:68,height:68}}),Z("div",{className:"text-3xl font-bold mb-2 g-welcome-title",children:$}),!o&&Z("div",{className:"flex mb-2 g-welcome-subtitle",children:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u667A\u80FD\u52A9\u624B"}),et("div",{style:{maxWidth:"1200px"},className:`flex mt-8 flex-wrap gap-3\r
607
+ `};function tse({config:e,styles:t}){if(!e)return null;const n=JSON.parse(e.configJson),r=Vt(()=>{var o;return{...DC.colors,...(o=t==null?void 0:t.theme)==null?void 0:o.colors}},[t]);return et("div",{className:"w-[340px] rounded-xl p-4 animate-fade-in bg-white",children:[et("div",{className:"flex items-center mb-2",children:[Z("span",{className:"text-md font-bold truncate mr-2",style:{color:r.primary},children:n.config_name||"\u52A9\u624B\u914D\u7F6E"}),Z("span",{className:"text-xs truncate rounded px-2 py-0.5",style:{backgroundColor:`${r.primary}1A`,color:r.disabled},children:n.model_name})]}),Z("div",{className:"border-b my-2",style:{borderColor:r.border}}),et("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-700 mb-2",style:{color:r.text},children:[et("div",{children:["\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570\uFF1A",Z("span",{className:"font-semibold",children:n.max_round})]}),et("div",{children:["\u6700\u5927\u4EE4\u724C\u6570\uFF1A",Z("span",{className:"font-semibold",children:n.max_tokens})]}),et("div",{children:["\u6E29\u5EA6\uFF1A",Z("span",{className:"font-semibold",children:n.temperature})]}),et("div",{children:["\u53EC\u56DE\u6570\uFF1A",Z("span",{className:"font-semibold",children:n.top_k})]}),et("div",{children:["\u591A\u6837\u6027\uFF1A",Z("span",{className:"font-semibold",children:n.top_p})]}),et("div",{children:["\u76F8\u4F3C\u5EA6\u9608\u503C\uFF1A",Z("span",{className:"font-semibold",children:n.score_threshold})]})]}),et("div",{className:"mb-2",children:[Z("div",{className:"text-xs text-gray-400 mb-1",style:{color:r.disabled},children:"\u5173\u8054\u77E5\u8BC6\u5E93\uFF1A"}),Z("div",{className:"flex flex-wrap gap-1",children:n.knowledge_base_name?n.knowledge_base_name.split(";").map((o,i)=>Z("span",{className:"px-2 py-0.5 rounded-full text-xs",style:{backgroundColor:`${r.primary}1A`,color:r.primary},children:o},i)):Z("span",{className:"text-gray-300",style:{color:r.disabled},children:"\u65E0"})})]}),et("div",{className:"mb-2",children:[Z("div",{className:"text-xs text-gray-400 mb-1",style:{color:r.disabled},children:"\u5F00\u542F\u529F\u80FD:"}),et("div",{className:"flex flex-wrap gap-2 text-xs mt-2",children:[!!n.enabled_faq&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"FAQ"}),!!n.enabled_graph&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u56FE\u8C31"}),!!n.dependOnKb&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u5F3A\u77E5\u8BC6\u4F9D\u8D56"}),!!n.enabled_table_select&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u8868\u683C\u7B5B\u9009"}),!!n.enabled_rerank&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u7CBE\u6392\u6A21\u5F0F"}),!!n.need_trace_source&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u6EAF\u6E90"}),!!n.is_download&&Z("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u4E0B\u8F7D\u6EAF\u6E90"})]})]})]})}function nse(e,t=[],n=60){const[r,o]=at("");return vt(()=>{o("");let i=0;const a=setInterval(()=>{o(s=>i>=e.length?(clearInterval(a),s):(i++,e.slice(0,i)))},n);return()=>clearInterval(a)},[e,...t]),r}function rse(e){const{assistantList:t,eventsEmit:n,styles:r,selectedId:o,onSelectAssistant:i,productLogo:a}=e,[s,l]=at(1),[c,u]=at(!1),[d,f]=at(""),h=c||d.trim()?6:12,m=tt(),g=tt(!1),p=tt(null),v=tt(null),y=tt("");vt(()=>{o&&m.current!==o&&(n==null||n("conversation:new_assistant_change",{assistantId:o}),m.current=o)},[o,n]);const b=Vt(()=>pa(),[]);vt(()=>{var A;if((A=r==null?void 0:r.theme)!=null&&A.colors){const N=document.createElement("style");return N.innerHTML=ese(r.theme.colors,b),N.id=`g-welcome-styles-${b}`,document.head.appendChild(N),()=>{const M=document.getElementById(N.id);M&&M.remove()}}},[r,b]);const E=Vt(()=>t.find(A=>A.id===o),[t,o]),x=Vt(()=>JSON.parse((E==null?void 0:E.configJson)||"{}"),[E]),w=Vt(()=>{if(!d.trim())return t||[];const A=d.toLowerCase().trim();return(t||[]).filter(N=>{var D,P;const M=((D=N.name)==null?void 0:D.toLowerCase())||"";try{const R=((P=JSON.parse(N.configJson||"{}").config_name)==null?void 0:P.toLowerCase())||"";return M.includes(A)||R.includes(A)}catch{return M.includes(A)}})},[t,d]),k=Math.ceil(((w==null?void 0:w.length)||0)/h),S=(w==null?void 0:w.slice((s-1)*h,s*h))||[];vt(()=>{if(o&&o!==v.current){if(g.current&&p.current!==null){v.current=o;return}const A=d.trim()?w:t;if(A&&A.length>0){const N=A.findIndex(M=>M.id===o);if(N!==-1){const M=Math.floor(N/h)+1;l(M),v.current=o}}}},[o,t,w,h,d]),vt(()=>{if(d!==y.current){if(g.current&&p.current!==null){l(p.current),g.current=!1,p.current=null,y.current=d;return}if(v.current===o){y.current=d;return}g.current||(d.trim()&&(v.current=null),l(1)),y.current=d}},[d,o]),vt(()=>{k>0&&s>k&&l(k)},[k,s]);const O=x.prologue||"\u60A8\u597D\uFF0C\u6B22\u8FCE\u4F7F\u7528\u5C0F\u9CB8\u667A\u80FD\u95EE\u7B54",$=nse(O,[o],30);return et("div",{className:`flex flex-col relative items-center justify-center h-full w-full g-welcome-${b}`,children:[Z("img",{src:a||Qae,alt:"logo",className:"mb-4",style:{width:68,height:68}}),Z("div",{className:"text-3xl font-bold mb-2 g-welcome-title",children:$}),!o&&Z("div",{className:"flex mb-2 g-welcome-subtitle",children:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u667A\u80FD\u52A9\u624B"}),et("div",{style:{maxWidth:"1200px"},className:`flex mt-8 flex-wrap gap-3
608
608
  max-w-[1200px] px-8 w-full mx-auto justify-center mb-4`,children:[c?Z("div",{className:"flex items-center gap-2 px-5 w-full",style:{flexBasis:"100%"},children:Z(Wu,{className:"g-welcome-search-input w-full",placeholder:"\u641C\u7D22\u52A9\u624B\u540D\u79F0",prefix:Z(a2,{size:16}),suffix:Z("button",{type:"button",onClick:()=>{u(!1),f("")},style:{background:"transparent",border:"none",cursor:"pointer"},children:Z(gp,{size:14})}),value:d,onChange:A=>f(A.target.value),autoFocus:!0})}):Z("button",{type:"button",className:"g-welcome-search-btn",onClick:()=>u(!0),children:Z(a2,{size:16})}),S&&S.length>0?Z(hp,{children:S.map(A=>{const N=o===A.id;let M=A.icon;try{const D=JSON.parse(A.configJson||"{}");M=M||D.icon||D.avatar||D.logo}catch{}return M=M||Jae,Z(MI,{content:()=>Z(tse,{config:t.find(D=>D.id===A.id),styles:r}),trigger:"hover",placement:"bottom",children:et("button",{type:"button",className:`g-welcome-btn px-3 cursor-pointer rounded-full border font-medium min-w-[160px] text-sm transition-all flex items-center gap-2 ${N?"active":""}`,onClick:()=>{i==null||i(A.id);const D=c||d.trim(),I=(D?t:d.trim()?w:t).findIndex(R=>R.id===A.id);if(I!==-1){const j=Math.floor(I/(D?12:h))+1;l(j),v.current=A.id,D&&(p.current=j,g.current=!0,setTimeout(()=>{f(""),u(!1)},100))}},title:A.name,children:[Z("span",{className:"icon-badge",children:Z("img",{src:M,alt:"icon",style:{width:16,height:16,borderRadius:4}})}),Z("span",{className:"truncate max-w-[180px]",children:A.name})]})},A.id)})}):Z("div",{className:"g-welcome-subtitle",children:"\u6682\u65E0\u53EF\u7528\u52A9\u624B"})]}),k>1&&et("div",{className:"flex items-center gap-2",children:[Z("button",{type:"button",className:"g-welcome-pagination-btn",onClick:()=>l(A=>Math.max(1,A-1)),disabled:s===1,children:Z(rW,{size:16})}),Z("div",{className:"flex items-center gap-1",children:(()=>{const A=[];if(k<=7)for(let M=1;M<=k;M++)A.push(M);else if(A.push(1),s<=4){for(let M=2;M<=5;M++)A.push(M);A.push("..."),A.push(k)}else if(s>=k-3){A.push("...");for(let M=k-4;M<=k;M++)A.push(M)}else{A.push("...");for(let M=s-1;M<=s+1;M++)A.push(M);A.push("..."),A.push(k)}return A.map((M,D)=>{if(M==="...")return Z("span",{className:"g-welcome-pagination-text px-1",children:"..."},`ellipsis-${D}`);const P=M;return Z("button",{type:"button",className:`g-welcome-pagination-btn ${s===P?"active":""}`,onClick:()=>l(P),children:P},P)})})()}),Z("button",{type:"button",className:"g-welcome-pagination-btn",onClick:()=>l(A=>Math.min(k,A+1)),disabled:s===k,children:Z(AI,{size:16})})]})]})}async function ose(e,t){const n=e.getReader();let r;for(;!(r=await n.read()).done;)t(r.value)}function ise(e){let t,n,r,o=!1;return function(a){t===void 0?(t=a,n=0,r=-1):t=sse(t,a);const s=t.length;let l=0;for(;n<s;){o&&(t[n]===10&&(l=++n),o=!1);let c=-1;for(;n<s&&c===-1;++n)switch(t[n]){case 58:r===-1&&(r=n-l);break;case 13:o=!0;case 10:c=n;break}if(c===-1)break;e(t.subarray(l,c),r),l=n,r=-1}l===s?t=void 0:l!==0&&(t=t.subarray(l),n-=l)}}function ase(e,t,n){let r=k6();const o=new TextDecoder;return function(a,s){if(a.length===0)n==null||n(r),r=k6();else if(s>0){const l=o.decode(a.subarray(0,s)),c=s+(a[s+1]===32?2:1),u=o.decode(a.subarray(c));switch(l){case"data":r.data=r.data?r.data+`
609
609
  `+u:u;break;case"event":r.event=u;break;case"id":e(r.id=u);break;case"retry":const d=parseInt(u,10);isNaN(d)||t(r.retry=d);break}}}}function sse(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function k6(){return{data:"",event:"",id:"",retry:void 0}}var lse=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const Mw="text/event-stream",cse=1e3,S6="last-event-id";function use(e,t){var{signal:n,headers:r,onopen:o,onmessage:i,onclose:a,onerror:s,openWhenHidden:l,fetch:c}=t,u=lse(t,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((d,f)=>{const h=Object.assign({},r);h.accept||(h.accept=Mw);let m;function g(){m.abort(),document.hidden||x()}l||document.addEventListener("visibilitychange",g);let p=cse,v=0;function y(){document.removeEventListener("visibilitychange",g),window.clearTimeout(v),m.abort()}n==null||n.addEventListener("abort",()=>{y(),d()});const b=c??window.fetch,E=o??dse;async function x(){var w;m=new AbortController;try{const k=await b(e,Object.assign(Object.assign({},u),{headers:h,signal:m.signal}));await E(k),await ose(k.body,ise(ase(S=>{S?h[S6]=S:delete h[S6]},S=>{p=S},i))),a==null||a(),y(),d()}catch(k){if(!m.signal.aborted)try{const S=(w=s==null?void 0:s(k))!==null&&w!==void 0?w:p;window.clearTimeout(v),v=window.setTimeout(x,S)}catch(S){y(),f(S)}}}x()})}function dse(e){const t=e.headers.get("content-type");if(!(t!=null&&t.startsWith(Mw)))throw new Error(`Expected content-type to be ${Mw}, Actual: ${t}`)}class rv extends Error{}let Po=null,ia=null;const fse=({baseUrl:e,token:t,CSRFToken:n,setChatData:r,activeSessionId:o,setAppStatus:i,setConversationList:a})=>{const s=p=>{if(!p)return!1;if(typeof p=="string"){const v=p.trim();return v!==""&&v!=="[]"&&v!=="null"}return!0},l=({content:p,status:v,respTime:y,filePaths:b,reference:E,webReference:x,graphReference:w,databaseReference:k,llmType:S,resultType:O,queryId:$,tokens:A})=>{r(N=>{var L;if(!N[0])return N;const M=N[0],D=M.messages||[],P=D.length-1;if(P<0)return N;const I=D[P];if(I.istype!=="ai")return N;let R=D.slice();if(b!=null&&b.length){const _=D.length-2;if(_>=0&&((L=D[_])==null?void 0:L.istype)==="user"){const F={...D[_],filePaths:b};R[_]=F}}const j=w!==void 0&&s(w)?w:I.graphReference;v===2&&w!==void 0&&console.log("[AichatUseController] reset_chat status=2 \u65F6\u7684 graphReference:",{graphReference:w,isValid:s(w),lastMessageGraphReference:I.graphReference,finalGraphReference:j});const z={...I,content:(I.content||"")+p,status:v,respTime:y,filePaths:b,reference:E,webReference:x,graphReference:j,databaseReference:k??I.databaseReference,resultType:O,llmType:S,tokens:A,queryId:$||I.queryId||pa(32)};return z.clientSideId=z.clientSideId||z.queryId+"-ai",R[P]=z,[{...M,isNew:!1,messages:R},...N.slice(1)]})},c=p=>{if(p instanceof rv)throw i(v=>({...v,display:"error",sender:"ready"})),Po&&(Po.abort(),Po=null),ia=null,p};return{updateUserFilesMessage:({currentFiles:p})=>{r(v=>{if(!v[0])return v;const y=v[0],b=y.messages||[];if(!b.length)return v;const E=b.length-2;if(E<0||b[E].istype!=="user")return v;const w=b.slice();return w[E]={...b[E],currentFiles:p},[{...y,messages:w},...v.slice(1)]})},api_startChat_re:(p,v)=>{Po&&Po.abort(),Po=new AbortController,ia=p.sessionId;const y=`${e}/qa/ai/question_re`;console.log("data",p);const b={...p};use(y,{method:"post",signal:Po.signal,headers:{"Content-Type":"application/json",Accept:"text/event-stream",Authorization:t||"","X-CSRF-TOKEN-IN":n||""},openWhenHidden:!0,body:JSON.stringify(b),onopen:async E=>{if(E.status===500)throw new rv("Internal Server Error");if(!E.ok)throw new rv(`HTTP error: ${E.status}`)},onmessage:E=>{const x=JSON.parse(E.data);if(ia!==x.sessionId){console.log("[AichatUseController] \u6D41\u5F0F\u8BF7\u6C42\u7684 sessionId \u5DF2\u4E0D\u5339\u914D\uFF0C\u5FFD\u7565\u6570\u636E",{currentStreamSessionId:ia,receivedSessionId:x.sessionId,activeSessionId:o});return}if(o!==x.sessionId)return;const{reply:w,resultType:k,respTime:S,reference:O,webReference:$,graphReference:A,filePaths:N,status:M,docs:D,llmType:P,databaseReference:I}=x,R=N?JSON.parse(N):[];M===2&&w&&w.content&&(w.content.includes("\u6A21\u578B\u6682\u65E0\u6CD5\u8FD4\u56DE")||w.content.includes("\u5931\u8D25")||w.content.includes("\u9519\u8BEF")||w.content.includes("\u8BF7\u7A0D\u540E\u518D\u8BD5"))&&i(z=>({...z,display:"ready",sender:"ready"}));const j=s(A)?A:void 0;if(M===2&&console.log("[AichatUseController] status=2 \u65F6\u7684 graphReference:",{graphReference:A,type:typeof A,isValid:s(A),finalGraphReference:j}),M===2){if(l({content:w.content||"",status:2,respTime:S,filePaths:R,reference:O||D||"",webReference:$||"",graphReference:j,databaseReference:I,llmType:P,resultType:k,queryId:x.queryId,tokens:x.tokens}),i(z=>({...z,display:"ready",sender:"ready"})),v){const z=S||Date.now();console.log("[AichatUseController] \u6D88\u606F\u53D1\u9001\u6210\u529F\uFF0CgmtModified:",z),v(z)}}else l({content:w.content||"",status:M,respTime:S,filePaths:R,reference:O||D||"",webReference:$||"",graphReference:j,databaseReference:I,llmType:P,resultType:k,queryId:x.queryId,tokens:x.tokens})},onerror:c,onclose:()=>{ia===p.sessionId&&(ia=null)}})},addEmptyMessage:({queryId:p,content:v,filePaths:y,currentFiles:b})=>{r(E=>{const x=new Date().toISOString(),w=p||pa(32),k={istype:"user",content:v,time:x,queryId:w,clientSideId:w+"-user",filePaths:y||"",currentFiles:b||[]},S={istype:"ai",content:"",time:new Date(Date.now()+1).toISOString(),streaming:!0,status:0,queryId:w,clientSideId:w+"-ai"},O=E.find($=>$.id===o);return O?O.messages.push(k,S):console.warn("addEmptyMessage called without an active session."),[...E]})},setLastEmptyMessage:({now:p})=>{r(v=>{if(!v[0])return v;const y=v[0],b=y.messages||[];if(!b.length)return v;const E=b.length-1;if(E<0)return v;const x=b[E];if(x.istype!=="ai")return v;const w=b.slice();return w[E]={...x,istype:"ai",content:"",time:p,streaming:!0,status:0},[{...y,messages:w},...v.slice(1)]})},stopStream:()=>{Po&&(Po.abort(),Po=null),ia=null,i(p=>({...p,display:"ready",sender:"ready"}))},cancelStreamBySessionId:p=>Po&&ia===p?(console.log("[AichatUseController] \u5207\u6362\u4F1A\u8BDD\uFF0C\u53D6\u6D88\u6B63\u5728\u8FDB\u884C\u7684\u6D41\u5F0F\u8BF7\u6C42",p),Po.abort(),Po=null,ia=null,i(v=>({...v,display:"ready",sender:"ready"})),!0):!1}},hse="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACRSURBVHgB7ZJBCsQgDEWTmQvMncT7dOuqmY3iai6kMN31UmIjdNFFKuk+DwKahP9ABDAMQyTnvHCtT/ZjjIs0e0nN1hr03kkjGTu8+0PEjzR/S81a6+6cQz6S9x5KKdsknLi+IQRSC07JfybRhE8FM4k2fICgIKVE/MYrF427NlwtuEpOgSr8MUNy9x0Nw7jnAFsnZ7Uu5CkqAAAAAElFTkSuQmCC",{TextArea:$6}=Wu,{useForm:pse}=Ra,f9={\u56DE\u7B54\u4E0D\u4F73:"ansPoor",\u683C\u5F0F\u95EE\u9898:"formatError",\u7406\u89E3\u95EE\u9898\u6709\u8BEF:"harmfulInfo",\u5176\u4ED6:"othres"},gse=({open:e,setOpen:t,feedBackList:n,handleConfirm:r})=>{const o={header:{padding:"20px 24px",borderBottom:"1px solid #F0F0F0",margin:0},body:{padding:"16px 24px 20px 24px",borderBottom:"1px solid #F0F0F0"},mask:{},footer:{padding:"16px 24px",margin:0},content:{padding:0,borderRadius:"4px",width:"563px"}},[i]=pse(),[a,s]=at({}),l=async()=>{try{const c=await i.validateFields();t(!1);const u={...c};Object.entries(a||{}).forEach(d=>{const[f,h]=d;h&&(u[f9[f]]=h)}),r(u)}catch(c){console.log(c);return}};return vt(()=>{e||(i.resetFields(),s(null))},[e]),Z(pp,{modal:{styles:o},children:et(mp,{open:e,onCancel:()=>t(!1),title:Z("div",{className:"text-[16px] text-[#2A2A2A] font-bold leading-[1]",children:"\u611F\u8C22\u60A8\u7684\u53CD\u9988\uFF01\u8FD9\u5C06\u5E2E\u52A9\u6211\u4EEC\u4E0D\u65AD\u4F18\u5316\u4E0E\u63D0\u5347\u3002"}),footer:et("div",{children:[Z(So,{className:"mr-[16px] w-[76px]",onClick:()=>{t(!1)},children:"\u53D6\u6D88"}),Z(So,{type:"primary",className:"w-[76px] border-none",onClick:l,children:"\u786E\u8BA4"})]}),children:[Z(mse,{feedBackList:n,treeSelectResult:a,setTreeSelectResult:s}),et(Ra,{form:i,layout:"vertical",children:[Z(Ra.Item,{name:"supplementExplain",label:"\u8865\u5145\u63CF\u8FF0",children:Z($6,{})})," ",Z(Ra.Item,{name:"idealAnswer",label:"\u60A8\u89C9\u5F97\u66F4\u597D\u7684\u56DE\u7B54\u662F\u4EC0\u4E48\uFF1F",children:Z($6,{})}),Z(Ra.Item,{name:"userPhone",label:"\u8054\u7CFB\u7535\u8BDD",children:Z(Wu,{})}),Z(Ra.Item,{name:"deptName",label:"\u90E8\u95E8",children:Z(Wu,{})})]})]})})},mse=({feedBackList:e,treeSelectResult:t,setTreeSelectResult:n})=>{const[r,o]=at(!1),[i,a]=at([]),[s,l]=at([]),[c,u]=at([]),[d,f]=at(null),h=Vt(()=>(l([]),d!=null&&d.items?[{title:"\u5168\u9009",key:"\u5168\u9009",children:d.items.map(g=>({title:g,key:g}))}]:[]),[d]),m=g=>{u(p=>Array.isArray(p)&&Array.isArray(s)?Object.entries(t).reduce((y,b)=>{const[E,x]=b,k=(x?x.split(";"):[]).filter(S=>S!==g);return n(S=>({...S||{},[E]:k.join(";")})),[...y,...k]},[]):p)};return vt(()=>{if(a(["\u5168\u9009"]),!t||!(d!=null&&d.que_name))return;const g=t[d.que_name]||"",p=g?g.split(";"):[];l(p)},[h,r]),vt(()=>{t===null&&(u([]),f(null),l([]))},[t]),vt(()=>{console.log("treeSelectResult",t),console.log("selectedValue",c),console.log("feedBackList",e),console.log("pKey",f9),console.log("selectedParent",d)},[t,c]),et("div",{className:"relative mb-[24px] z-20",children:[et("div",{className:"absolute w-full z-10",children:[et("div",{className:"h-[32px] box-border flex items-center justify-between border-[1px] border-solid border-[#D9D9D9] rounded-[4px] cursor-pointer",onClick:()=>o(!r),children:[Z("div",{className:"ml-[16px]",children:"\u95EE\u9898\u7C7B\u578B"}),Z("img",{src:hse,width:24,height:24,className:"mr-[16px]"})]}),et("div",{style:{display:r?"":"none"},className:"h-[288px] rounded-[4px] shadow-md mt-[4px] bg-white",children:[et("div",{className:"h-[248px] flex",style:{borderBottom:"1px solid #F0F0F0"},children:[Z("div",{className:"w-[203px] px-[8px] py-[8px]",style:{borderRight:"1px solid #F0F0F0"},children:e.map((g,p)=>{var v;return et("div",{className:"rounded-[4px] h-[32px] cursor-pointer flex items-center",style:{backgroundColor:(d==null?void 0:d.que_name)===g.que_name?"#E6F4FF":""},children:[Z("div",{className:"h-full w-full leading-[32px]",onClick:()=>{f(g)},children:et("div",{className:"ml-[8px] text-[14px] text-[#2A2A2A]",children:[g.que_name,"(",t&&t[g.que_name]?t[g.que_name].split(";").length:0,"/",(v=g==null?void 0:g.items)==null?void 0:v.length,")"]})}),Z(AI,{className:"mr-[8px] w-3 h-3 text-[rgba(0,0,0,0.45)]"})]},p)})}),Z("div",{className:"selfTree h-full flex-1 mt-[8px] ml-[16px]",children:Z(QH,{checkable:!0,defaultSelectedKeys:["0-1"],treeData:h,blockNode:!0,checkedKeys:s,expandedKeys:i,onCheck:g=>{Array.isArray(g)&&n(p=>({...p||{},[(d==null?void 0:d.que_name)||""]:(g||[]).filter(v=>v!=="\u5168\u9009").join(";")})),l(g)}})})]}),et("div",{className:"flex justify-end h-[40px] items-center",children:[Z(So,{size:"small",className:"mr-[8px]",onClick:()=>o(!1),children:"\u53D6\u6D88"}),Z(So,{size:"small",type:"primary",className:"border-none mr-[16px]",onClick:()=>{u(g=>Array.isArray(g)&&Array.isArray(s)?Object.values(t).reduce((v,y)=>[...v,...y?y.split(";"):[]],[]):g),o(!1)},children:"\u786E\u8BA4"})]})]})]}),Z("div",{className:"h-[32px]"}),!!(c!=null&&c.length)&&et("div",{children:[et("div",{className:"mt-[5px] text-[12px] text-[#555555]",children:["\u5DF2\u9009\u62E9 ",c.length," \u4E2A"]}),(c||[]).map(g=>{let p="";return Object.entries(t||{}).forEach(v=>{const[y,b]=v;b.indexOf(g)>-1&&(p=y)}),et(UH,{closable:!0,className:"mt-[5px]",onClose:()=>m(g),children:[p,"\uFF08",g,"\uFF09"]},g)})]})]})},A6=e=>e?Array.isArray(e)?e.map(r=>"/minio/"+r.split("/").slice(3).join("/")):"/minio/"+e.split("/").slice(3).join("/"):"",O6="http://10.15.12.13:9000/",vse=e=>{if(typeof e=="string"){const t=e.split(".");return t.length?t[t.length-1]:""}else return""},yse=e=>{var x,w,k,S,O,$,A,N;const{file_type:t,file_name:n,url:r,parse_url:o,retrieve_tags:i,file_id:a,parsed_file_type:s,onlyDownloadTypes:l,references:c,eventsEmit:u,styles:d,isUploadFile:f,type:h,collectionItems:m,pdfPages:g=0,fileManagerData:p}=e;if(h==="collection"&&Array.isArray(m)){const P=`calc(90% - ${.5}px)`,I=m.slice(0,4),R=m.length>4,j="\u6253\u5F00\u5408\u96C6",z=()=>{if(p&&t==="pdf"&&!e.pdfPages){const V=((p==null?void 0:p.uploadedFiles)||[]).find(L=>{var _;return((L==null?void 0:L.name)||((_=L==null?void 0:L.file)==null?void 0:_.name))===n});if(!(V!=null&&V.pdfPages)){rr.warning("\u8BE5PDF\u6587\u4EF6\u672A\u89E3\u6790\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}u==null||u("reference_file:click",{...e,pdfPages:(V==null?void 0:V.pdfPages)||0})}else u==null||u("reference_file:click",e)};return et("div",{className:"user-file relative group flex flex-col items-center justify-center cursor-pointer backdrop-blur-sm rounded-lg border p-2 text-sm transition-all bg-white shadow",style:{width:94,height:94,minWidth:94,minHeight:94,borderColor:(w=(x=d==null?void 0:d.theme)==null?void 0:x.colors)==null?void 0:w.border},onClick:z,children:[Z("div",{className:"grid grid-cols-2 items-center justify-center grid-rows-2 gap-1 w-full h-full",style:{width:"100%",height:"100%",gap:1},children:I.map((V,L)=>{var T,B,H,G;if(R&&L===3)return Z("div",{className:"flex items-center justify-center bg-gray-100 rounded",style:{width:P,height:P},children:Z("span",{className:"text-xl text-gray-300 font-bold scale-75",children:"..."})},"ellipsis");if(V.file_type==="image"||V.file_type==="jpg"||V.file_type==="jpeg"||V.file_type==="png"||V.file_type==="gif"||V.file_type==="bmp"||V.file_type==="webp")return Z("div",{className:"relative flex items-center justify-center bg-white rounded-lg border overflow-hidden",style:{width:P,height:P,borderColor:(B=(T=d==null?void 0:d.theme)==null?void 0:T.colors)==null?void 0:B.border},children:Z("div",{className:"flex items-center justify-center w-full h-full scale-75",children:Z("img",{src:String(V.url||V.file_path||""),alt:V.file_name||"",className:"object-contain max-w-full max-h-full"})})},V.file_name||L);const F=Dw(String(V.file_type||""),d);return Z("div",{className:"user-file flex flex-col items-center justify-center rounded-lg border bg-gray-50 p-1 text-sm",title:V.file_name,style:{width:P,height:P,borderColor:(G=(H=d==null?void 0:d.theme)==null?void 0:H.colors)==null?void 0:G.border},children:Z("div",{className:"flex items-center justify-center w-full h-full scale-75",children:F})},V.file_name||L)})}),Z("div",{className:"absolute inset-0 bg-transparent group-hover:bg-black/40 transition-all duration-300 flex items-center justify-center rounded-lg pointer-events-none",children:et("div",{className:"flex flex-col items-center text-xs justify-center text-white opacity-0 group-hover:opacity-100 transition-opacity",children:[Z(lm,{size:20,className:"mb-1 text-white"}),Z("span",{className:"text-white text-center",style:{fontSize:12},children:j})]})})]})}const v=()=>{if(console.log(o,"parse_url",r,"url"),p&&t==="pdf"&&!g){const M=((p==null?void 0:p.uploadedFiles)||[]).find(D=>{var P;return((D==null?void 0:D.name)||((P=D==null?void 0:D.file)==null?void 0:P.name))===(n||"").replace(/\s+/g,"")});if(!(M!=null&&M.pdfPages)){rr.warning("\u8BE5PDF\u6587\u4EF6\u672A\u89E3\u6790\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}u==null||u("reference_file:click",{file:n,file_type:t,url:r,parse_url:o,retrieve_tags:i,file_id:a,parsed_file_type:s,references:c,type:y,isUploadFile:f,pdfPages:M.pdfPages||0})}else u==null||u("reference_file:click",{file:n,file_type:t,url:r,parse_url:o,retrieve_tags:i,file_id:a,parsed_file_type:s,references:c,type:y,isUploadFile:f,pdfPages:g})},y=Vt(()=>(n||"").split(".").pop()||"",[n]),b=Dw(y,d),E=async()=>{if(r){const M=A6(r.indexOf("http")>-1?r:`${O6}/${r}`);if(y.toLowerCase()==="json"){try{const I=await fetch(M);if(!I.ok)throw new Error("\u4E0B\u8F7D\u5931\u8D25");const R=await I.blob(),j=document.createElement("a");j.href=URL.createObjectURL(R),j.download=n||"",document.body.appendChild(j),j.click(),document.body.removeChild(j),setTimeout(()=>URL.revokeObjectURL(j.href),1e3)}catch{alert("\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25")}return}const P=document.createElement("a");P.href=M,P.download=n||"",document.body.appendChild(P),P.click(),document.body.removeChild(P)}};return l&&l.includes(y.toLowerCase())?et("div",{className:"user-file relative group w-24 h-24 flex flex-col items-center justify-center cursor-pointer backdrop-blur-sm rounded-lg border p-2 text-sm transition-all",title:n,onClick:E,style:{borderColor:(S=(k=d==null?void 0:d.theme)==null?void 0:k.colors)==null?void 0:S.border},children:[b,Z("span",{className:"file-name font-medium truncate text-center px-2 pt-1",style:{fontSize:10,maxWidth:"5.5rem"},children:n}),Z("div",{className:"absolute text-center inset-0 cursor-pointer bg-transparent group-hover:bg-black/40 transition-all duration-300 flex items-center justify-center rounded-lg",children:et("div",{className:"flex flex-col items-center text-xs justify-center text-white opacity-0 group-hover:opacity-100 transition-opacity",children:[Z(lm,{className:"text-white opacity-0 group-hover:opacity-100 transition-opacity mx-auto"}),Z("div",{className:"text-white text-center",style:{fontSize:10},children:"\u4E0B\u8F7D\u6587\u4EF6"})]})})]},n):y==="image"||y==="jpg"||y==="jpeg"||y==="png"||y==="gif"||y==="bmp"||y==="webp"?et("div",{className:"relative group w-24 h-24 cursor-pointer flex items-center justify-center",onClick:()=>v(),children:[r?Z("img",{src:String(A6(r&&r.indexOf("http")>-1?r:`${O6}/${r}`)||""),alt:n||"",className:"w-full h-full object-cover rounded-md border",style:{borderColor:($=(O=d==null?void 0:d.theme)==null?void 0:O.colors)==null?void 0:$.border}}):Z("div",{className:"w-full h-full flex items-center justify-center",children:Z("span",{className:"animate-spin rounded-full border-2 border-gray-300 border-t-blue-500 w-8 h-8 inline-block"})}),Z("div",{className:"absolute inset-0 bg-transparent group-hover:bg-black/40 transition-all duration-300 flex items-center justify-center rounded-md",children:et("div",{className:"flex flex-col items-center text-xs justify-center text-white opacity-0 group-hover:opacity-100 transition-opacity",children:[Z(cW,{className:"text-white opacity-0 group-hover:opacity-100 transition-opacity mx-auto"}),Z("div",{className:"text-white text-center",children:"\u67E5\u770B\u56FE\u7247"})]})})]},n):et("div",{className:"user-file relative group w-24 h-24 flex flex-col items-center justify-center cursor-pointer backdrop-blur-sm rounded-lg border p-2 text-sm transition-all",title:n,onClick:v,style:{borderColor:(N=(A=d==null?void 0:d.theme)==null?void 0:A.colors)==null?void 0:N.border},children:[b,Z("span",{className:"file-name font-medium truncate text-center px-2 pt-1",style:{fontSize:10,maxWidth:"5.5rem"},children:n}),Z("div",{className:"absolute text-center inset-0 cursor-pointer bg-transparent group-hover:bg-black/40 transition-all duration-300 flex items-center justify-center rounded-lg",children:et("div",{className:"flex flex-col items-center text-xs justify-center text-white opacity-0 group-hover:opacity-100 transition-opacity",children:[Z(lm,{className:"text-white opacity-0 group-hover:opacity-100 transition-opacity mx-auto"}),Z("div",{className:"text-white text-center",style:{fontSize:10},children:"\u6253\u5F00\u6587\u4EF6"})]})})]},n)},bse=e=>e?e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`:"",xse=({fileName:e,fileSize:t,icon:n,statusText:r,statusColor:o="text-gray-400",statusIcon:i,onRemove:a,themeColors:s={},cardId:l,showRemove:c=!0,disabledRemove:u=!1,onRemoveWithAnim:d,extra:f,style:h})=>et("div",{id:l,className:"group gap-x-2.5 items-center file-display-card relative flex w-[210px] bg-white border border-gray-200 rounded-md shadow-sm px-2 py-1 transition-all hover:shadow-md hover:border-blue-300",style:h,children:[Z("div",{className:"pt-1",children:n}),et("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:[et("div",{className:"flex items-center justify-between gap-1",children:[Z("span",{className:"text-[12px] font-medium truncate max-w-[120px]",title:e,children:e}),Z("span",{className:"ml-1 text-[11px] text-gray-400",children:bse(t)})]}),et("div",{className:`text-[10px] mt-0.5 flex items-center gap-3 ${o}`,children:[i,Z("span",{children:r})]})]}),f,c&&!u&&Z("button",{className:"absolute top-0.5 right-0.5 opacity-0 group-hover:opacity-100 transition-opacity text-gray-300 hover:text-red-400 text-xs p-0.5 rounded-full bg-white shadow-sm z-10",onClick:()=>{d&&l?d(l):a&&a()},title:"\u79FB\u9664",style:{lineHeight:0,color:s.error||"#FF0000"},children:Z(gp,{className:"w-3.5 h-3.5"})})]});function Dw(e,t){var r;const n=((r=t==null?void 0:t.theme)==null?void 0:r.icons)||{};switch(e.toLowerCase()){case"docx":case"doc":return n.docx?Z("img",{src:n.docx,alt:"docx",style:{width:20,height:20}}):Z(ar,{type:"rag/word",size:18});case"image":case"jpg":case"jpeg":case"png":case"gif":case"bmp":case"webp":case"svg":case"ico":return n.image?Z("img",{src:n.image,alt:"image",style:{width:20,height:20}}):Z(ar,{type:"rag/pic",size:18});case"pptx":case"ppt":return n.pptx?Z("img",{src:n.pptx,alt:"pptx",style:{width:20,height:20}}):Z(ar,{type:"rag/ppt",size:18});case"sheets":case"excel":case"xls":case"csv":case"xlsx":case"xlsm":case"xlsb":case"xltx":case"xltm":case"xlt":case"xlam":return n.sheets?Z("img",{src:n.sheets,alt:"sheets",style:{width:20,height:20}}):Z(ar,{type:"rag/excel",size:18});case"pdf":return n.pdf?Z("img",{src:n.pdf,alt:"pdf",style:{width:20,height:20}}):Z(ar,{type:"rag/pdf",size:18});case"txt":return n.txt?Z("img",{src:n.txt,alt:"txt",style:{width:20,height:20}}):Z(ar,{type:"rag/txt",size:18});case"md":return n.md?Z("img",{src:n.md,alt:"txt",style:{width:20,height:20}}):Z(ar,{type:"rag/document",size:18});case"json":return n.json?Z("img",{src:n.json,alt:"json",style:{width:20,height:20}}):Z(ar,{type:"rag/json",size:18});case"html":case"htm":return n.html?Z("img",{src:n.html,alt:"html",style:{width:20,height:20}}):Z(ar,{type:"rag/url",size:18});case"xml":default:return Z(ar,{type:"rag/file",size:18})}}const Ese=[{file:{name:"\u4EA7\u54C1\u9700\u6C42\u6587\u6863.pdf",size:1024*1024*2.5,type:"application/pdf"},type:"pdf",status:"uploaded",url:"https://example.com/file1.pdf"},{file:{name:"\u6570\u636E\u5206\u6790\u62A5\u544A.xlsx",size:1024*1024*1.2,type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},type:"excel",status:"uploaded",url:"https://example.com/file3.xlsx"},{file:{name:"\u7CFB\u7EDF\u67B6\u6784\u56FE.png",size:1024*512,type:"image/png"},type:"image",status:"uploaded",url:"https://example.com/file2.png"}];function wse({open:e,onCancel:t,files:n=Ese,currentFiles:r=[],onUpload:o,onRemoveFile:i,styles:a,eventsEmit:s}){const l={pending:"\u5F85\u4E0A\u4F20",uploading:"\u4E0A\u4F20\u4E2D",uploaded:"\u5DF2\u4E0A\u4F20",analyzing:"\u89E3\u6790\u4E2D",analyze_failed:"\u89E3\u6790\u5931\u8D25",error:"\u5931\u8D25"},[c,u]=at([]),d=(g,p)=>{s&&s("uploaded_file:removeFromTemp",{file:g,idx:p})},f=a&&a.theme&&a.theme.colors?a.theme.colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080",shadow:"#000000",appBackground:"#fff"},h=n.map((g,p)=>et("div",{className:"relative flex flex-col gap-2.5 items-center justify-center",children:[Z("div",{className:"absolute right-1 top-1 z-10",children:Z(FI,{title:"\u786E\u8BA4\u4ECE\u4E34\u65F6\u5BF9\u8BDD\u77E5\u8BC6\u5E93\u79FB\u9664\u8BE5\u6587\u4EF6\uFF1F",onConfirm:()=>d(g,p),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",children:Z("button",{className:"bg-white cursor-pointer rounded-full p-0.5",style:{lineHeight:0,color:f&&f.text?f.text:"#FF0000",transition:"background 0.2s, color 0.2s"},onMouseOver:v=>{v.currentTarget.style.color=f&&f.error?f.error:"#FF0000"},onMouseOut:v=>{v.currentTarget.style.color=f.text},title:"\u79FB\u9664",children:Z(gp,{className:"w-3 h-3"})})})}),Z(yse,{file_type:vse(g.file.name||g.name),file_name:g.name||g.file.name,url:g.url,retrieve_tags:[],styles:a,isUploadFile:!0,eventsEmit:s,parse_url:g.convertedFilePath,pdfPages:g.pdfPages||0})]},g.file.name+p)),m=r.map((g,p)=>{const v=g.file.name.split(".").pop()||"",y=Dw(v,a);return Z(xse,{cardId:`pending-file-card-${p}`,fileName:g.file.name,fileSize:g.file.size,icon:y,statusText:l[g.status||"pending"],statusColor:"text-gray-400",showRemove:!0,onRemove:()=>i&&i(g,p,"pending"),themeColors:f,style:{boxShadow:"none",height:55,background:"#f8fafc"}},g.file.name+p)});return c.length>0?(f&&f.error&&f.error,f&&f.error&&f.error+"",f&&f.error&&f.error):(f&&f.disabledText&&f.disabledText,f&&f.disabledBackground&&f.disabledBackground,f&&f.disabledText&&f.disabledText),et(mp,{open:e,onCancel:t,footer:null,title:"\u5BF9\u8BDD\u4E34\u65F6\u6587\u4EF6\u77E5\u8BC6\u5E93",closable:!1,width:800,styles:{body:{padding:"0",maxHeight:"70vh",overflow:"auto"}},children:[et("div",{className:"file-manager-modal space-y-6 px-4 py-4",children:[et("div",{className:"",children:[Z("div",{className:"flex items-center mb-2 justify-between",children:et("div",{className:"flex items-center",children:[Z("span",{className:"text-xs font-semibold text-gray-700",children:"\u5DF2\u4E0A\u4F20\u6587\u4EF6"}),et("span",{className:"ml-2 text-xs text-gray-400",children:[n.length," \u4E2A"]})]})}),Z("div",{className:"w-full relative min-h-[200px] max-h-[260px] p-2 overflow-y-auto",style:{overflowX:"hidden"},children:Z("div",{className:"flex flex-wrap gap-1",children:h.length>0?h:Z("div",{className:"flex items-center w-full h-full py-10 justify-center text-gray-400 text-sm",children:"\u6682\u65E0\u5DF2\u4E0A\u4F20\u6587\u4EF6"})})})]}),et("div",{children:[et("div",{className:"flex items-center mb-2",children:[Z("span",{className:"text-xs font-semibold text-gray-700",children:"\u5F85\u4E0A\u4F20\u6587\u4EF6"}),et("span",{className:"ml-2 text-xs text-gray-400",children:[r.length," \u4E2A"]})]}),et("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[m,Z(TC.Dragger,{multiple:!0,showUploadList:!1,beforeUpload:(g,p)=>(g===p[0]&&(o==null||o(p)),!1),className:"!bg-gray-50 !border-dashed !border-gray-300 hover:!border-blue-400 cursor-pointer min-w-[160px] max-w-[220px] flex flex-row items-center justify-center border-2 rounded-lg transition-all",style:{height:45,boxShadow:"none",padding:0},children:et("div",{className:"flex flex-row items-center pb-8 justify-center",children:[Z(NI,{size:20,className:"text-blue-400 mr-2"}),Z("div",{className:"text-xs text-gray-500",children:"\u4E0A\u4F20\u6587\u4EF6"})]})})]})]}),Z("div",{className:"flex justify-end gap-2",children:Z(So,{type:"primary",onClick:t,children:"\u786E\u8BA4"})})]}),Z("style",{children:`
610
610
  .file-manager-modal .ant-upload-wrapper,
package/database.js CHANGED
@@ -1,4 +1,4 @@
1
- import{jsxs as L,jsx as n,Fragment as de}from"react/jsx-runtime";import{useState as F,useMemo as W,useRef as q,useEffect as De}from"react";import{J as R,i as me,m as be}from"./assets/index-BtzZe0dg.js";import{a as ye,T as Fe,W as Ie}from"./assets/index-C0f77Ai0.js";import{M as $}from"./assets/index-Cqand6Yl.js";/* empty css */import{M as K,s as J}from"./assets/index-D1PtBLCr.js";import"react-dom";const Ee=({url:m,token:v,role:B,eventsEmit:E})=>{const c=ye.create({baseURL:m,timeout:1e6});return c.interceptors.request.use(e=>{let t=v;return!t&&!["user/login","user/kaptcha","user/regist"].some(u=>e.url.includes(u))?(E&&E("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(e.headers.Authorization=t||"",e.headers.userName=B==="\u672A\u767B\u5F55\u7528\u6237"?"":B,e)}),c.interceptors.response.use(e=>{const t=["user/kaptcha"],i=e.data;if(t.some(g=>e.config.url&&e.config.url.includes(g))||i.size&&i.type)return i;const{success:u,errorMsg:b,errorCode:D}=i;return u?i:(E&&E("request:error_business",{errorCode:D,errorMsg:b||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:i}),!1)},async e=>{var t,i,u,b,D,g,C,h,w;if(e.message==="canceled")return Promise.reject(e);if(E){let d="request:error_network",j={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:e};((t=e==null?void 0:e.response)==null?void 0:t.status)===401?(d="request:error_auth",j={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:e,redirect:"/login"}):(((u=(i=e==null?void 0:e.response)==null?void 0:i.data)==null?void 0:u.errorCode)==="30013"||((D=(b=e==null?void 0:e.response)==null?void 0:b.data)==null?void 0:D.errorCode)==="30023")&&(d="request:error_business",j={errorCode:(C=(g=e==null?void 0:e.response)==null?void 0:g.data)==null?void 0:C.errorCode,errorMsg:((w=(h=e==null?void 0:e.response)==null?void 0:h.data)==null?void 0:w.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:e}),E(d,j)}return console.log("Error occurs",e),Promise.reject(e)}),{getDatabaseList:async e=>{try{const t=await c.get(`/queryPageDBList?${new URLSearchParams(e).toString()}`),{success:i,data:u}=t;if(i)return u}catch(t){console.log("getDatabaseList error:",t)}},getShareDatabaseList:async e=>{try{const t=await c.get(`/queryShareDBList?${new URLSearchParams(e).toString()}`),{success:i,data:u}=t;if(i)return u}catch(t){console.log("getShareDatabaseList error:",t)}},delDatabaseById:async(e,t)=>{const i=O(t);try{const u=await c.delete(`/${i}/deleteDB/${e}`),{success:b,data:D}=u;if(b)return D}catch(u){console.log("delDatabaseById error:",u)}},saveDatabase:async(e,t)=>{const i=O(t);try{const u=await c.post(`/${i}/saveDBInfo`,e),{success:b,data:D}=u;if(b)return D}catch(u){console.log("saveDatabase error:",u)}},testConnection:async e=>{try{const t=await c.post("/directDB/testConnect",e),{success:i,data:u}=t;if(i)return u}catch(t){console.log("testConnection error:",t)}},syncSchema:async e=>{try{const t=await c.get(`/directDB/syncSchema/${e}`),{success:i,data:u}=t;if(i)return u}catch(t){console.log("syncSchema error:",t)}}}},O=m=>m=="DataTable"?"dataTable":"directDB",ge="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCAzNiAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik0xNCAxMkMxNCAxMC44OTU0IDE0Ljg5NTQgMTAgMTYgMTBIMjlDMzEuMjA5MSAxMCAzMyAxMS43OTA5IDMzIDE0VjI2QzMzIDMwLjQxODMgMjkuNDE4MyAzNCAyNSAzNEgxNkMxNC44OTU0IDM0IDE0IDMzLjEwNDYgMTQgMzJWMTJaIiBmaWxsPSJ1cmwoI3BhaW50MF9saW5lYXJfNDQ3Ml8xODA1MikiLz4NCjxmb3JlaWduT2JqZWN0IHg9Ii0xIiB5PSItMSIgd2lkdGg9IjMyIiBoZWlnaHQ9IjM2Ij48ZGl2IHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hodG1sIiBzdHlsZT0iYmFja2Ryb3AtZmlsdGVyOmJsdXIoMnB4KTtjbGlwLXBhdGg6dXJsKCNiZ2JsdXJfMF80NDcyXzE4MDUyX2NsaXBfcGF0aCk7aGVpZ2h0OjEwMCU7d2lkdGg6MTAwJSI+PC9kaXY+PC9mb3JlaWduT2JqZWN0PjxnIGRhdGEtZmlnbWEtYmctYmx1ci1yYWRpdXM9IjQiPg0KPHBhdGggZD0iTTMgN0MzIDQuNzkwODYgNC43OTA4NiAzIDcgM0gyM0MyNS4yMDkxIDMgMjcgNC43OTA4NiAyNyA3VjE5QzI3IDI1LjYyNzQgMjEuNjI3NCAzMSAxNSAzMUg3QzQuNzkwODYgMzEgMyAyOS4yMDkxIDMgMjdWN1oiIGZpbGw9IndoaXRlIiBmaWxsLW9wYWNpdHk9IjAuNDYiLz4NCjxwYXRoIGQ9Ik03IDMuMjVIMjNDMjUuMDcxMSAzLjI1IDI2Ljc1IDQuOTI4OTMgMjYuNzUgN1YxOUMyNi43NSAyNS40ODkzIDIxLjQ4OTMgMzAuNzUgMTUgMzAuNzVIN0M0LjkyODkzIDMwLjc1IDMuMjUgMjkuMDcxMSAzLjI1IDI3VjdDMy4yNSA0LjkyODkzIDQuOTI4OTMgMy4yNSA3IDMuMjVaIiBzdHJva2U9IndoaXRlIiBzdHJva2Utb3BhY2l0eT0iMC4zNCIgc3Ryb2tlLXdpZHRoPSIwLjUiLz4NCjwvZz4NCjxnIGZpbHRlcj0idXJsKCNmaWx0ZXIxX2RfNDQ3Ml8xODA1MikiPg0KPHBhdGggZD0iTTE0IDE5VjExLjY2NjciIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS44Mzk3MiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+DQo8cGF0aCBkPSJNMTEgMTRMMTIgMTNMMTQgMTFMMTYgMTNMMTcgMTQiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+DQo8cGF0aCBkPSJNMTAgMjJIMTgiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+DQo8L2c+DQo8ZGVmcz4NCjxjbGlwUGF0aCBpZD0iYmdibHVyXzBfNDQ3Ml8xODA1Ml9jbGlwX3BhdGgiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPjxwYXRoIGQ9Ik0zIDdDMyA0Ljc5MDg2IDQuNzkwODYgMyA3IDNIMjNDMjUuMjA5MSAzIDI3IDQuNzkwODYgMjcgN1YxOUMyNyAyNS42Mjc0IDIxLjYyNzQgMzEgMTUgMzFIN0M0Ljc5MDg2IDMxIDMgMjkuMjA5MSAzIDI3VjdaIi8+DQo8L2NsaXBQYXRoPjxmaWx0ZXIgaWQ9ImZpbHRlcjFfZF80NDcyXzE4MDUyIiB4PSI1IiB5PSI2IiB3aWR0aD0iMTgiIGhlaWdodD0iMjEiIGZpbHRlclVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY29sb3ItaW50ZXJwb2xhdGlvbi1maWx0ZXJzPSJzUkdCIj4NCjxmZUZsb29kIGZsb29kLW9wYWNpdHk9IjAiIHJlc3VsdD0iQmFja2dyb3VuZEltYWdlRml4Ii8+DQo8ZmVDb2xvck1hdHJpeCBpbj0iU291cmNlQWxwaGEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAxMjcgMCIgcmVzdWx0PSJoYXJkQWxwaGEiLz4NCjxmZU9mZnNldC8+DQo8ZmVHYXVzc2lhbkJsdXIgc3RkRGV2aWF0aW9uPSIyIi8+DQo8ZmVDb21wb3NpdGUgaW4yPSJoYXJkQWxwaGEiIG9wZXJhdG9yPSJvdXQiLz4NCjxmZUNvbG9yTWF0cml4IHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwLjM5NjA3OCAwIDAgMCAwIDAuOTg0MzE0IDAgMCAwIDAuNCAwIi8+DQo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluMj0iQmFja2dyb3VuZEltYWdlRml4IiByZXN1bHQ9ImVmZmVjdDFfZHJvcFNoYWRvd180NDcyXzE4MDUyIi8+DQo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluPSJTb3VyY2VHcmFwaGljIiBpbjI9ImVmZmVjdDFfZHJvcFNoYWRvd180NDcyXzE4MDUyIiByZXN1bHQ9InNoYXBlIi8+DQo8L2ZpbHRlcj4NCjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl80NDcyXzE4MDUyIiB4MT0iMjMuNSIgeTE9IjEwIiB4Mj0iMjMuNSIgeTI9IjM0IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+DQo8c3RvcCBzdG9wLWNvbG9yPSIjNjRBMEZEIi8+DQo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiMwMTVBRkYiLz4NCjwvbGluZWFyR3JhZGllbnQ+DQo8L2RlZnM+DQo8L3N2Zz4NCg==",Me=""+new URL("assets/database_connect.svg",import.meta.url).href,pe=""+new URL("assets/mysql.svg",import.meta.url).href,fe=""+new URL("assets/SQLServer.png",import.meta.url).href,Ae=""+new URL("assets/PostgreSQL.png",import.meta.url).href,Ce=""+new URL("assets/Doris.png",import.meta.url).href,he=[{label:"MySQL",value:"MySQL",icon:pe},{label:"PostgreSQL",value:"PostgreSQL",icon:Ae},{label:"SQLServer",value:"SQLServer",icon:fe},{label:"Doris",value:"Doris",icon:Ce}],Be=({drawerTitle:m,drawerVisible:v,isConnectSuccess:B,handleDrawerClose:E,dbInfo:c,dbType:l,eventsEmit:p})=>{const[Q,V]=F(!1),[G,N]=F(!1),[e,t]=F({}),[i,u]=F(!1),b=W(()=>({id:l,layout:"vertical",formWidth:"500px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",counter:150,required:!1,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""}]}),[l,c]),D=W(()=>({id:l,layout:"vertical",formWidth:"470px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",required:!1,counter:150,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""},{id:"db-info",label:"\u76F4\u8FDE\u6570\u636E\u6E90\u4FE1\u606F",type:"title",level:2},{id:"dbType",name:"dbType",label:"\u6570\u636E\u6E90\u7C7B\u578B",type:"select",disabled:!!c,required:!0,options:he.map(a=>{const{label:r,value:M,icon:k}=a;return{label:r,value:M,render:()=>L("div",{className:"flex items-center gap-2",children:[n("img",{src:k,width:24}),n("span",{children:r})]})}})},{id:"dbHost",name:"dbHost",label:"\u4E3B\u673A\u5730\u5740",type:"input",required:!0,disabled:!!c,placeholder:"\u8BF7\u8F93\u5165IP\u5730\u5740\u6216\u8005\u57DF\u540D"},{id:"dbPort",name:"dbPort",label:"\u7AEF\u53E3\u53F7",type:"number",required:!0,disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u7AEF\u53E3\u540D\u79F0"},{id:"dbDatabase",name:"dbDatabase",label:"\u8FDE\u63A5\u6570\u636E\u5E93\u540D",disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u8FDE\u63A5\u6570\u636E\u5E93\u540D",required:!0,type:"input"},{type:"col",children:[{id:"dbUser",type:"input",name:"dbUser",label:"\u7528\u6237\u540D",disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D",required:!0},{id:"dbPassword",type:"password",name:"dbPassword",label:"\u5BC6\u7801",placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801",required:!0,disabled:i?!1:!!c}]}]}),[l,c,i]),g=q(null),C=(a,r,M)=>{switch(console.log("[Form] eventsEmit:",a,r,M),a){case"form:ready":r.formRef&&(g.current=r.formRef);break;case"form_field_change":console.log("\u5B57\u6BB5\u503C\u53D8\u5316:",r),t(k=>({...k,[r.fieldId]:r.value}));break;case"form_validation_error":console.log("\u8868\u5355\u9A8C\u8BC1\u9519\u8BEF:",r);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",a,r)}p==null||p(a,r,M)},h=async()=>{try{V(!0);const a=await g.current.getAllData();a.isValid&&(console.log(a,"==="),l=="DirectDB"&&m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!i&&(a.fields=a.fields.filter(r=>r.name=="name"||r.name=="description")),await p("form_submitted",a,void 0),u(!1))}catch(a){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",a)}finally{V(!1)}},w=async()=>{try{N(!0);const a=await g.current.getAllData();if(a.isValid){const r=a.fields.reduce((M,k)=>(M[k.name]=k.value,M),{});await p("form:connect_test",r,void 0)}}catch{N(!1)}finally{N(!1)}},d=W(()=>{const a=l=="DataTable"?b:D;return{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:a.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:a.id,type:"form",size:"md",formWidth:a.formWidth,formConfig:{layout:a.layout,showReset:!1,showSubmit:!1,formWidth:a.formWidth,getFormData:()=>({...e,timestamp:new Date().toISOString(),formId:a.id}),onFieldChange:(r,M)=>{C("form_field_change",{fieldId:r,value:M},void 0)},onValidationError:r=>{C("form_validation_error",r,void 0)}}}],dataSource:[{id:a.id,fields:a.fields,defaultValues:{...c}}],eventsEmit:C}},[l,b,D,v,c]),j=W(()=>l=="DirectDB"?c?i&&!B:!B:!1,[l,B,i,v]);return L(K,{title:m,width:620,onCancel:()=>{E(),u(!1)},open:v,destroyOnHidden:!0,footer:L("div",{className:"flex justify-end gap-3",children:[n(R,{mode:"default",label:"\u53D6\u6D88",onClick:()=>{E(),u(!1)}}),n(R,{mode:"primary",label:"\u786E\u8BA4",loading:Q,disabled:j,onClick:h})]}),children:[n($,{...d},"example-form"),l==="DirectDB"&&n(de,{children:m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!i?n(R,{mode:"primary",className:"mt-[10px]",label:"\u4FEE\u6539\u5BC6\u7801",onClick:()=>{u(!0),g.current.setValues({dbPassword:void 0})}}):n(Fe,{title:"\u9700\u901A\u8FC7\u6D4B\u8BD5\u624D\u53EF\u521B\u5EFA\u6210\u529F",children:n(R,{mode:"primary",className:"mt-[10px]",label:"\u8FDE\u63A5\u6D4B\u8BD5",loading:G,onClick:w})})})]})},Ne=""+new URL("assets/empty.png",import.meta.url).href,{confirm:we}=K,je=Ie.div`
1
+ import{jsxs as Z,jsx as l,Fragment as de}from"react/jsx-runtime";import{useState as y,useMemo as T,useRef as q,useEffect as De}from"react";import{J as Q,i as me,m as ge}from"./assets/index-BtzZe0dg.js";import{a as be,T as ye,W as Ee}from"./assets/index-C0f77Ai0.js";import{M as K}from"./assets/index-Cqand6Yl.js";/* empty css */import{M as $,s as H}from"./assets/index-D1PtBLCr.js";import"react-dom";const Fe=({url:m,token:z,role:B,eventsEmit:F})=>{const c=be.create({baseURL:m,timeout:1e6});return c.interceptors.request.use(e=>{let t=z;return!t&&!["user/login","user/kaptcha","user/regist"].some(u=>e.url.includes(u))?(F&&F("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(e.headers.Authorization=t||"",e.headers.userName=B==="\u672A\u767B\u5F55\u7528\u6237"?"":B,e)}),c.interceptors.response.use(e=>{const t=["user/kaptcha"],r=e.data;if(t.some(p=>e.config.url&&e.config.url.includes(p))||r.size&&r.type)return r;const{success:u,errorMsg:g,errorCode:D}=r;return u?r:(F&&F("request:error_business",{errorCode:D,errorMsg:g||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:r}),!1)},async e=>{var t,r,u,g,D,p,C,h,N;if(e.message==="canceled")return Promise.reject(e);if(F){let d="request:error_network",v={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:e};((t=e==null?void 0:e.response)==null?void 0:t.status)===401?(d="request:error_auth",v={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:e,redirect:"/login"}):(((u=(r=e==null?void 0:e.response)==null?void 0:r.data)==null?void 0:u.errorCode)==="30013"||((D=(g=e==null?void 0:e.response)==null?void 0:g.data)==null?void 0:D.errorCode)==="30023")&&(d="request:error_business",v={errorCode:(C=(p=e==null?void 0:e.response)==null?void 0:p.data)==null?void 0:C.errorCode,errorMsg:((N=(h=e==null?void 0:e.response)==null?void 0:h.data)==null?void 0:N.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:e}),F(d,v)}return console.log("Error occurs",e),Promise.reject(e)}),{getDatabaseList:async e=>{try{const t=await c.get(`/queryPageDBList?${new URLSearchParams(e).toString()}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("getDatabaseList error:",t)}},getShareDatabaseList:async e=>{try{const t=await c.get(`/queryShareDBList?${new URLSearchParams(e).toString()}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("getShareDatabaseList error:",t)}},delDatabaseById:async(e,t)=>{const r=O(t);try{const u=await c.delete(`/${r}/deleteDB/${e}`),{success:g,data:D}=u;if(g)return D}catch(u){console.log("delDatabaseById error:",u)}},saveDatabase:async(e,t)=>{const r=O(t);try{const u=await c.post(`/${r}/saveDBInfo`,e),{success:g,data:D}=u;if(g)return D}catch(u){console.log("saveDatabase error:",u)}},testConnection:async e=>{try{const t=await c.post("/directDB/testConnect",e),{success:r,data:u}=t;if(r)return u}catch(t){console.log("testConnection error:",t)}},syncSchema:async e=>{try{const t=await c.get(`/directDB/syncSchema/${e}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("syncSchema error:",t)}}}},O=m=>m=="DataTable"?"dataTable":"directDB",pe="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCAzNiAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE0IDEyQzE0IDEwLjg5NTQgMTQuODk1NCAxMCAxNiAxMEgyOUMzMS4yMDkxIDEwIDMzIDExLjc5MDkgMzMgMTRWMjZDMzMgMzAuNDE4MyAyOS40MTgzIDM0IDI1IDM0SDE2QzE0Ljg5NTQgMzQgMTQgMzMuMTA0NiAxNCAzMlYxMloiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl80NDcyXzE4MDUyKSIvPgo8Zm9yZWlnbk9iamVjdCB4PSItMSIgeT0iLTEiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzNiI+PGRpdiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94aHRtbCIgc3R5bGU9ImJhY2tkcm9wLWZpbHRlcjpibHVyKDJweCk7Y2xpcC1wYXRoOnVybCgjYmdibHVyXzBfNDQ3Ml8xODA1Ml9jbGlwX3BhdGgpO2hlaWdodDoxMDAlO3dpZHRoOjEwMCUiPjwvZGl2PjwvZm9yZWlnbk9iamVjdD48ZyBkYXRhLWZpZ21hLWJnLWJsdXItcmFkaXVzPSI0Ij4KPHBhdGggZD0iTTMgN0MzIDQuNzkwODYgNC43OTA4NiAzIDcgM0gyM0MyNS4yMDkxIDMgMjcgNC43OTA4NiAyNyA3VjE5QzI3IDI1LjYyNzQgMjEuNjI3NCAzMSAxNSAzMUg3QzQuNzkwODYgMzEgMyAyOS4yMDkxIDMgMjdWN1oiIGZpbGw9IndoaXRlIiBmaWxsLW9wYWNpdHk9IjAuNDYiLz4KPHBhdGggZD0iTTcgMy4yNUgyM0MyNS4wNzExIDMuMjUgMjYuNzUgNC45Mjg5MyAyNi43NSA3VjE5QzI2Ljc1IDI1LjQ4OTMgMjEuNDg5MyAzMC43NSAxNSAzMC43NUg3QzQuOTI4OTMgMzAuNzUgMy4yNSAyOS4wNzExIDMuMjUgMjdWN0MzLjI1IDQuOTI4OTMgNC45Mjg5MyAzLjI1IDcgMy4yNVoiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS1vcGFjaXR5PSIwLjM0IiBzdHJva2Utd2lkdGg9IjAuNSIvPgo8L2c+CjxnIGZpbHRlcj0idXJsKCNmaWx0ZXIxX2RfNDQ3Ml8xODA1MikiPgo8cGF0aCBkPSJNMTQgMTlWMTEuNjY2NyIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjgzOTcyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTExIDE0TDEyIDEzTDE0IDExTDE2IDEzTDE3IDE0IiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTAgMjJIMTgiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+CjwvZz4KPGRlZnM+CjxjbGlwUGF0aCBpZD0iYmdibHVyXzBfNDQ3Ml8xODA1Ml9jbGlwX3BhdGgiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPjxwYXRoIGQ9Ik0zIDdDMyA0Ljc5MDg2IDQuNzkwODYgMyA3IDNIMjNDMjUuMjA5MSAzIDI3IDQuNzkwODYgMjcgN1YxOUMyNyAyNS42Mjc0IDIxLjYyNzQgMzEgMTUgMzFIN0M0Ljc5MDg2IDMxIDMgMjkuMjA5MSAzIDI3VjdaIi8+CjwvY2xpcFBhdGg+PGZpbHRlciBpZD0iZmlsdGVyMV9kXzQ0NzJfMTgwNTIiIHg9IjUiIHk9IjYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIyMSIgZmlsdGVyVW5pdHM9InVzZXJTcGFjZU9uVXNlIiBjb2xvci1pbnRlcnBvbGF0aW9uLWZpbHRlcnM9InNSR0IiPgo8ZmVGbG9vZCBmbG9vZC1vcGFjaXR5PSIwIiByZXN1bHQ9IkJhY2tncm91bmRJbWFnZUZpeCIvPgo8ZmVDb2xvck1hdHJpeCBpbj0iU291cmNlQWxwaGEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAxMjcgMCIgcmVzdWx0PSJoYXJkQWxwaGEiLz4KPGZlT2Zmc2V0Lz4KPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMiIvPgo8ZmVDb21wb3NpdGUgaW4yPSJoYXJkQWxwaGEiIG9wZXJhdG9yPSJvdXQiLz4KPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAuMzk2MDc4IDAgMCAwIDAgMC45ODQzMTQgMCAwIDAgMC40IDAiLz4KPGZlQmxlbmQgbW9kZT0ibm9ybWFsIiBpbjI9IkJhY2tncm91bmRJbWFnZUZpeCIgcmVzdWx0PSJlZmZlY3QxX2Ryb3BTaGFkb3dfNDQ3Ml8xODA1MiIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluPSJTb3VyY2VHcmFwaGljIiBpbjI9ImVmZmVjdDFfZHJvcFNoYWRvd180NDcyXzE4MDUyIiByZXN1bHQ9InNoYXBlIi8+CjwvZmlsdGVyPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfNDQ3Ml8xODA1MiIgeDE9IjIzLjUiIHkxPSIxMCIgeDI9IjIzLjUiIHkyPSIzNCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgo8c3RvcCBzdG9wLWNvbG9yPSIjNjRBMEZEIi8+CjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzAxNUFGRiIvPgo8L2xpbmVhckdyYWRpZW50Pgo8L2RlZnM+Cjwvc3ZnPgo=",Ie=""+new URL("assets/database_connect.svg",import.meta.url).href,Me=""+new URL("assets/MySQL.svg",import.meta.url).href,fe=""+new URL("assets/SQLServer.png",import.meta.url).href,Ae=""+new URL("assets/PostgreSQL.png",import.meta.url).href,Ce=""+new URL("assets/Doris.png",import.meta.url).href,he=[{label:"MySQL",value:"MySQL",icon:Me},{label:"PostgreSQL",value:"PostgreSQL",icon:Ae},{label:"SQLServer",value:"SQLServer",icon:fe},{label:"Doris",value:"Doris",icon:Ce}],Be=({drawerTitle:m,drawerVisible:z,isConnectSuccess:B,handleDrawerClose:F,dbInfo:c,dbType:n,eventsEmit:M})=>{const[G,W]=y(!1),[R,w]=y(!1),[e,t]=y({}),[r,u]=y(!1),g=T(()=>({id:n,layout:"vertical",formWidth:"500px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",counter:150,required:!1,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""}]}),[n,c]),D=T(()=>({id:n,layout:"vertical",formWidth:"470px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",required:!1,counter:150,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""},{id:"db-info",label:"\u76F4\u8FDE\u6570\u636E\u6E90\u4FE1\u606F",type:"title",level:2},{id:"dbType",name:"dbType",label:"\u6570\u636E\u6E90\u7C7B\u578B",type:"select",disabled:!!c,required:!0,options:he.map(a=>{const{label:i,value:I,icon:x}=a;return{label:i,value:I,render:()=>Z("div",{className:"flex items-center gap-2",children:[l("img",{src:x,width:24}),l("span",{children:i})]})}})},{id:"dbHost",name:"dbHost",label:"\u4E3B\u673A\u5730\u5740",type:"input",required:!0,disabled:!!c,placeholder:"\u8BF7\u8F93\u5165IP\u5730\u5740\u6216\u8005\u57DF\u540D"},{id:"dbPort",name:"dbPort",label:"\u7AEF\u53E3\u53F7",type:"number",required:!0,disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u7AEF\u53E3\u540D\u79F0"},{id:"dbDatabase",name:"dbDatabase",label:"\u8FDE\u63A5\u6570\u636E\u5E93\u540D",disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u8FDE\u63A5\u6570\u636E\u5E93\u540D",required:!0,type:"input"},{type:"col",children:[{id:"dbUser",type:"input",name:"dbUser",label:"\u7528\u6237\u540D",disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D",required:!0},{id:"dbPassword",type:"password",name:"dbPassword",label:"\u5BC6\u7801",placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801",required:!0,disabled:r?!1:!!c}]}]}),[n,c,r]),p=q(null),C=(a,i,I)=>{switch(console.log("[Form] eventsEmit:",a,i,I),a){case"form:ready":i.formRef&&(p.current=i.formRef);break;case"form_field_change":console.log("\u5B57\u6BB5\u503C\u53D8\u5316:",i),t(x=>({...x,[i.fieldId]:i.value}));break;case"form_validation_error":console.log("\u8868\u5355\u9A8C\u8BC1\u9519\u8BEF:",i);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",a,i)}M==null||M(a,i,I)},h=async()=>{try{W(!0);const a=await p.current.getAllData();a.isValid&&(console.log(a,"==="),n=="DirectDB"&&m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!r&&(a.fields=a.fields.filter(i=>i.name=="name"||i.name=="description")),await M("form_submitted",a,void 0),u(!1))}catch(a){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",a)}finally{W(!1)}},N=async()=>{try{w(!0);const a=await p.current.getAllData();if(a.isValid){const i=a.fields.reduce((I,x)=>(I[x.name]=x.value,I),{});await M("form:connect_test",i,void 0)}}catch{w(!1)}finally{w(!1)}},d=T(()=>{const a=n=="DataTable"?g:D;return{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:a.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:a.id,type:"form",size:"md",formWidth:a.formWidth,formConfig:{layout:a.layout,showReset:!1,showSubmit:!1,formWidth:a.formWidth,getFormData:()=>({...e,timestamp:new Date().toISOString(),formId:a.id}),onFieldChange:(i,I)=>{C("form_field_change",{fieldId:i,value:I},void 0)},onValidationError:i=>{C("form_validation_error",i,void 0)}}}],dataSource:[{id:a.id,fields:a.fields,defaultValues:{...c}}],eventsEmit:C}},[n,g,D,z,c]),v=T(()=>n=="DirectDB"?c?r&&!B:!B:!1,[n,B,r,z]);return Z($,{title:m,width:620,onCancel:()=>{F(),u(!1)},open:z,destroyOnHidden:!0,footer:Z("div",{className:"flex justify-end gap-3",children:[l(Q,{mode:"default",label:"\u53D6\u6D88",onClick:()=>{F(),u(!1)}}),l(Q,{mode:"primary",label:"\u786E\u8BA4",loading:G,disabled:v,onClick:h})]}),children:[l(K,{...d},"example-form"),n==="DirectDB"&&l(de,{children:m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!r?l(Q,{mode:"primary",className:"mt-[10px]",label:"\u4FEE\u6539\u5BC6\u7801",onClick:()=>{u(!0),p.current.setValues({dbPassword:void 0})}}):l(ye,{title:"\u9700\u901A\u8FC7\u6D4B\u8BD5\u624D\u53EF\u521B\u5EFA\u6210\u529F",children:l(Q,{mode:"primary",className:"mt-[10px]",label:"\u8FDE\u63A5\u6D4B\u8BD5",loading:R,onClick:N})})})]})},we=""+new URL("assets/empty.png",import.meta.url).href,{confirm:Ne}=$,ve=Ee.div`
2
2
  width: 282px;
3
3
  height: 81px;
4
4
  display: flex;
@@ -17,4 +17,4 @@ import{jsxs as L,jsx as n,Fragment as de}from"react/jsx-runtime";import{useState
17
17
  background-color: #F1F5FF;
18
18
  };
19
19
  border: 1px solid #EBEBEB
20
- `,ke=[{key:"add_file_db",label:"\u4E0A\u4F20\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0A\u4F20Excel\u3001csv\u7B49\u683C\u5F0F\u6570\u636E\u8868\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:ge},{key:"add_direct_db",label:"\u76F4\u8FDE\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0E\u5DF2\u6709\u4E1A\u52A1\u5EFA\u7ACB\u8FDE\u63A5\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:Me}],Ve=m=>{const{url:v,token:B,role:E,CustomComponents:c,getBtnDisabled:l}=m,[p,Q]=F("my-db"),[V,G]=F({app:"ready",container:"ready",content:"ready"}),[N,e]=F(!1),[t,i]=F([{id:"my-db",data:[]},{id:"shared-db",data:[]}]),u=q(null),[b,D]=F(!1),[g,C]=F(""),[h,w]=F("DataTable"),[d,j]=F(),[a,r]=F(!1),{getDatabaseList:M,delDatabaseById:k,saveDatabase:ee,testConnection:ue,getShareDatabaseList:te,syncSchema:ae}=Ee({url:v,token:B,role:E,eventsEmit:m.eventsEmit}),H=W(()=>[{label:"\u6211\u7684\u6570\u636E\u5E93",id:"my-db",type:"card",cardType:"database",rowHeight:220,viewPageSize:12,viewBehavior:"pagination",actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}],toolbar:[{type:"customized",key:"add",render:()=>n(me,{mode:"primary",label:"\u521B\u5EFA\u6570\u636E\u5E93",actions:ke.map(o=>({key:o.key,component:n(je,{children:L("div",{className:"flex flex-grow",children:[n("div",{className:"mr-[6px]",children:n("img",{src:o.icon})}),L("div",{children:[n("div",{className:"text-base font-bold mb-1 text-[14px]",children:o.label}),n("div",{className:"text-[#888] text-[10px]",children:o.dsc})]})]})},o.key)})),eventEmit:Y})},{type:"fuzzy_search",key:"search",label:"\u8F93\u5165\u540D\u79F0\u641C\u7D22",searchKeys:["name","description"],position:"right"}]},{label:"\u5171\u4EAB\u6570\u636E\u5E93",id:"shared-db",type:"card",cardType:"database",rowHeight:240,toolbar:[{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",position:"right"}],actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}]}],[t]);De(()=>{G(o=>({...o,content:"loading"})),se()},[]);const se=async()=>{var o,s,f,y;try{const[A,z]=await Promise.allSettled([M({pageNo:1,pageSize:999}),te({pageNo:1,pageSize:999})]);let T=[];if(A.status==="fulfilled"&&A.value&&(o=A.value)!=null&&o.records){const x=X((s=A.value)==null?void 0:s.records);T.push({id:"my-db",data:x||[]})}if(z.status==="fulfilled"&&z.value&&(f=z.value)!=null&&f.records){const x=X((y=z.value)==null?void 0:y.records);T.push({id:"shared-db",data:x||[]})}i(T),G(x=>({...x,content:"ready"}))}catch(A){console.log("[DatabaseApiError] getDatabaseList:",A)}},X=o=>(o||[]).map(s=>{const f=U("shared-db").map((y,A)=>({...y,key:y.type==="divider"?`${y.key}_${s.id}`:y.key,disabled:l&&l(y.key=="edit"?7:4,s.permission)}));return s.datasourceType=="DirectDB"&&f.push({label:"\u540C\u6B65\u8868\u7ED3\u6784",key:"sync_schema",disabled:l&&l(7,s.permission)}),console.log("[DatabaseViewAdopter] actions:",f),{...s,actions:f||[]}}),ie="admin",re=()=>L("div",{className:"flex flex-col items-center justify-center h-full",children:[n("div",{className:"text-xl font-semibold mb-3",style:{color:"#374151"},children:n("img",{src:Ne,width:120})}),n("div",{className:"text-base mb-6",style:{color:"#6b7280"},children:"\u6682\u65E0\u6570\u636E\uFF0C\u8BF7\u5148\u6DFB\u52A0\u6570\u636E\u5E93"})]}),U=o=>{const s=H.find(y=>y.id===o);return(s==null?void 0:s.actions)||[]},oe=W(()=>{var s;const o=((s=t==null?void 0:t.find(f=>f.id===p))==null?void 0:s.data)||[];return N?[]:o},[p,t,N]),_=()=>{D(!1),r(!1),j(void 0)},ce=async o=>{console.log("[DatabaseViewAdopter] \u6D4B\u8BD5\u8FDE\u63A5:",o);const s=await ue(o);return s&&(r(!0),J.success("\u8FDE\u63A5\u6D4B\u8BD5\u6210\u529F\uFF01")),s};async function Y(o,s,f){var y,A,z,T,x;switch(console.log("[DatabaseViewAdopter] mergedEventsEmit",o,s),o){case"card_delete":we({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5E93\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await k(s.id,s.datasourceType)&&(u!=null&&u.current)&&(u==null||u.current.appFn.removeItem(s.id))},onCancel(){console.log("Cancel")}});break;case"card_edit":C("\u7F16\u8F91\u6570\u636E\u5E93"),D(!0),w(s.datasourceType),delete s.render,j(s);break;case"select":Q(s.id);break;case"filesDir_clicked":Q(s.id);break;case"dropdown_action":C("\u521B\u5EFA\u6570\u636E\u5E93"),D(!0),s.key=="add_file_db"?w("DataTable"):w("DirectDB");break;case"form_submitted":try{const S=s.fields.reduce((Z,I)=>(Z[I.name]=I.value,Z),{}),ne=d?{id:d==null?void 0:d.id,...S}:S,P=await ee(ne,h);if(P){if(d){const Z={...d,...S,datasourceType:h,actions:U("my-db").map((I,le)=>({...I,key:I.type==="divider"?`${I.key}_${P}`:I.key,allow:!0}))};(A=(y=u==null?void 0:u.current)==null?void 0:y.appFn)==null||A.updateItem(Z,d==null?void 0:d.id),J.success("\u6570\u636E\u5E93\u7F16\u8F91\u6210\u529F\uFF01")}else{const Z={...S,...P,createBy:ie,datasourceType:h,actions:U("my-db").map((I,le)=>({...I,key:I.type==="divider"?`${I.key}_${P}`:I.key,allow:!0}))};(T=(z=u==null?void 0:u.current)==null?void 0:z.appFn)==null||T.addItem(Z,{animate:!0,position:"start"}),J.success("\u6570\u636E\u5E93\u521B\u5EFA\u6210\u529F\uFF01")}return P}}catch(S){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",S)}finally{_()}break;case"form:connect_test":return await ce(s);case"toolbar_test_empty":console.log("[DatabaseViewAdopter] toolbar_test_empty \u4E8B\u4EF6\u89E6\u53D1"),e(!N);break;case"card_sync_schema":await ae(s.id)&&(r(!0),J.success("\u540C\u6B65\u8868\u7ED3\u6784\u6210\u529F\uFF01"));break;default:(x=m.eventsEmit)==null||x.call(m,o,s);break}}return L(be,{title:"\u6570\u636E\u5E93\u7BA1\u7406",children:[n($,{ref:u,label:"",model:"tabs",defaultActiveId:p,views:H,dataSource:oe,eventsEmit:Y,status:V,CustomComponents:{EmptyData:re,...c},styles:m.styles},"db"),n(Be,{drawerTitle:g,drawerVisible:b,isConnectSuccess:a,dbType:h,dbInfo:d,handleDrawerClose:_,eventsEmit:Y})]})};export{Ve as default};
20
+ `,xe=[{key:"add_file_db",label:"\u4E0A\u4F20\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0A\u4F20Excel\u3001csv\u7B49\u683C\u5F0F\u6570\u636E\u8868\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:pe},{key:"add_direct_db",label:"\u76F4\u8FDE\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0E\u5DF2\u6709\u4E1A\u52A1\u5EFA\u7ACB\u8FDE\u63A5\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:Ie}],We=m=>{const{url:z,token:B,role:F,CustomComponents:c,getBtnDisabled:n}=m,[M,G]=y("my-db"),[W,R]=y({app:"ready",container:"ready",content:"ready"}),[w,e]=y(!1),[t,r]=y([{id:"my-db",data:[]},{id:"shared-db",data:[]}]),u=q(null),[g,D]=y(!1),[p,C]=y(""),[h,N]=y("DataTable"),[d,v]=y(),[a,i]=y(!1),{getDatabaseList:I,delDatabaseById:x,saveDatabase:ee,testConnection:ue,getShareDatabaseList:te,syncSchema:ae}=Fe({url:z,token:B,role:F,eventsEmit:m.eventsEmit}),J=T(()=>[{label:"\u6211\u7684\u6570\u636E\u5E93",id:"my-db",type:"card",cardType:"database",rowHeight:220,viewPageSize:12,viewBehavior:"pagination",actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}],toolbar:[{type:"customized",key:"add",render:()=>l(me,{mode:"primary",label:"\u521B\u5EFA\u6570\u636E\u5E93",actions:xe.map(o=>({key:o.key,component:l(ve,{children:Z("div",{className:"flex flex-grow",children:[l("div",{className:"mr-[6px]",children:l("img",{src:o.icon})}),Z("div",{children:[l("div",{className:"text-base font-bold mb-1 text-[14px]",children:o.label}),l("div",{className:"text-[#888] text-[10px]",children:o.dsc})]})]})},o.key)})),eventEmit:_})},{type:"fuzzy_search",key:"search",label:"\u8F93\u5165\u540D\u79F0\u641C\u7D22",searchKeys:["name","description"],position:"right"}]},{label:"\u5171\u4EAB\u6570\u636E\u5E93",id:"shared-db",type:"card",cardType:"database",rowHeight:240,toolbar:[{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",position:"right"}],actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}]}],[t]);De(()=>{R(o=>({...o,content:"loading"})),se()},[]);const se=async()=>{var o,s,f,b;try{const[A,j]=await Promise.allSettled([I({pageNo:1,pageSize:999}),te({pageNo:1,pageSize:999})]);let L=[];if(A.status==="fulfilled"&&A.value&&(o=A.value)!=null&&o.records){const S=Y((s=A.value)==null?void 0:s.records);L.push({id:"my-db",data:S||[]})}if(j.status==="fulfilled"&&j.value&&(f=j.value)!=null&&f.records){const S=Y((b=j.value)==null?void 0:b.records);L.push({id:"shared-db",data:S||[]})}r(L),R(S=>({...S,content:"ready"}))}catch(A){console.log("[DatabaseApiError] getDatabaseList:",A)}},Y=o=>(o||[]).map(s=>{const f=U("shared-db").map((b,A)=>({...b,key:b.type==="divider"?`${b.key}_${s.id}`:b.key,disabled:n&&n(b.key=="edit"?7:4,s.permission)}));return s.datasourceType=="DirectDB"&&f.push({label:"\u540C\u6B65\u8868\u7ED3\u6784",key:"sync_schema",disabled:n&&n(7,s.permission)}),console.log("[DatabaseViewAdopter] actions:",f),{...s,actions:f||[]}}),re="admin",ie=()=>Z("div",{className:"flex flex-col items-center justify-center h-full",children:[l("div",{className:"text-xl font-semibold mb-3",style:{color:"#374151"},children:l("img",{src:we,width:120})}),l("div",{className:"text-base mb-6",style:{color:"#6b7280"},children:"\u6682\u65E0\u6570\u636E\uFF0C\u8BF7\u5148\u6DFB\u52A0\u6570\u636E\u5E93"})]}),U=o=>{const s=J.find(b=>b.id===o);return(s==null?void 0:s.actions)||[]},oe=T(()=>{var s;const o=((s=t==null?void 0:t.find(f=>f.id===M))==null?void 0:s.data)||[];return w?[]:o},[M,t,w]),X=()=>{D(!1),i(!1),v(void 0)},ce=async o=>{console.log("[DatabaseViewAdopter] \u6D4B\u8BD5\u8FDE\u63A5:",o);const s=await ue(o);return s&&(i(!0),H.success("\u8FDE\u63A5\u6D4B\u8BD5\u6210\u529F\uFF01")),s};async function _(o,s,f){var b,A,j,L,S;switch(console.log("[DatabaseViewAdopter] mergedEventsEmit",o,s),o){case"card_delete":Ne({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5E93\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await x(s.id,s.datasourceType)&&(u!=null&&u.current)&&(u==null||u.current.appFn.removeItem(s.id))},onCancel(){console.log("Cancel")}});break;case"card_edit":C("\u7F16\u8F91\u6570\u636E\u5E93"),D(!0),N(s.datasourceType),delete s.render,v(s);break;case"select":G(s.id);break;case"filesDir_clicked":G(s.id);break;case"dropdown_action":C("\u521B\u5EFA\u6570\u636E\u5E93"),D(!0),s.key=="add_file_db"?N("DataTable"):N("DirectDB");break;case"form_submitted":try{const k=s.fields.reduce((P,E)=>(P[E.name]=E.value,P),{}),le=d?{id:d==null?void 0:d.id,...k}:k,V=await ee(le,h);if(V){if(d){const P={...d,...k,datasourceType:h,actions:U("my-db").map((E,ne)=>({...E,key:E.type==="divider"?`${E.key}_${V}`:E.key,allow:!0}))};(A=(b=u==null?void 0:u.current)==null?void 0:b.appFn)==null||A.updateItem(P,d==null?void 0:d.id),H.success("\u6570\u636E\u5E93\u7F16\u8F91\u6210\u529F\uFF01")}else{const P={...k,...V,createBy:re,datasourceType:h,actions:U("my-db").map((E,ne)=>({...E,key:E.type==="divider"?`${E.key}_${V}`:E.key,allow:!0}))};(L=(j=u==null?void 0:u.current)==null?void 0:j.appFn)==null||L.addItem(P,{animate:!0,position:"start"}),H.success("\u6570\u636E\u5E93\u521B\u5EFA\u6210\u529F\uFF01")}return V}}catch(k){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",k)}finally{X()}break;case"form:connect_test":return await ce(s);case"toolbar_test_empty":console.log("[DatabaseViewAdopter] toolbar_test_empty \u4E8B\u4EF6\u89E6\u53D1"),e(!w);break;case"card_sync_schema":await ae(s.id)&&(i(!0),H.success("\u540C\u6B65\u8868\u7ED3\u6784\u6210\u529F\uFF01"));break;default:(S=m.eventsEmit)==null||S.call(m,o,s);break}}return Z(ge,{title:"\u6570\u636E\u5E93\u7BA1\u7406",children:[l(K,{ref:u,label:"",model:"tabs",defaultActiveId:M,views:J,dataSource:oe,eventsEmit:_,status:W,CustomComponents:{EmptyData:ie,...c},styles:m.styles},"db"),l(Be,{drawerTitle:p,drawerVisible:g,isConnectSuccess:a,dbType:h,dbInfo:d,handleDrawerClose:X,eventsEmit:_})]})};export{We as default};
package/index.js CHANGED
@@ -1 +1 @@
1
- import{DrawerType as y}from"./chat.js";import"./database.js";import"./assets/index-DNf62wMu.js";import"./databaseTable.js";import"react/jsx-runtime";import"react";import"./modelManage.js";import"./sensitive.js";import{G as F,B as P}from"./assets/GientechStreamReader-COjGWi_s.js";import"./assets/index-DV_mya3D.js";import{i as S}from"./assets/index-C0f77Ai0.js";import"./assets/index-BtzZe0dg.js";import"react-dom";import"./assets/index-6rZwr24p.js";import"./assets/index-B16gaAst.js";import"./assets/index-BQWU6aA6.js";import"./assets/index-CpW6Dhpp.js";/* empty css */import"./assets/plus-CrrWzgTO.js";import"./assets/x-B50yFeY5.js";import"./assets/index-D1PtBLCr.js";import"./assets/index-NBU1h9MU.js";import"./assets/index-Cqand6Yl.js";import"./assets/index-CTXs951x.js";export{y as DrawerType,F as GientechStreamReader,S as defaultTheme,P as registerPDFWorker};
1
+ import{DrawerType as y}from"./chat.js";import"./database.js";import"./assets/index-DNf62wMu.js";import"./databaseTable.js";import"react/jsx-runtime";import"react";import"./modelManage.js";import"./sensitive.js";import{G as F,B as P}from"./assets/GientechStreamReader-COjGWi_s.js";import"./assets/index-BU3ahTSx.js";import{i as S}from"./assets/index-C0f77Ai0.js";import"./assets/index-BtzZe0dg.js";import"react-dom";import"./assets/index-6rZwr24p.js";import"./assets/index-B16gaAst.js";import"./assets/index-BQWU6aA6.js";import"./assets/index-CpW6Dhpp.js";/* empty css */import"./assets/plus-CrrWzgTO.js";import"./assets/x-B50yFeY5.js";import"./assets/index-D1PtBLCr.js";import"./assets/index-NBU1h9MU.js";import"./assets/index-Cqand6Yl.js";import"./assets/index-CTXs951x.js";export{y as DrawerType,F as GientechStreamReader,S as defaultTheme,P as registerPDFWorker};