@gientech/modual 2.1.36 → 2.1.37

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.
@@ -1,4 +1,4 @@
1
- import{jsxs as d,jsx as e,Fragment as je}from"react/jsx-runtime";import Ue,{useState as v,forwardRef as Xe,useEffect as W,useMemo as me,useImperativeHandle as Je,useRef as le}from"react";import{c as Ce,a8 as Ne,a as Ge,L as oe,d as q,g as Ye,x as Ie,F as O,b as pe,a9 as Se,I as Ee,S as G,aa as Qe,ab as eu,B as ee,R as ae,a6 as he}from"./index-8h59dJlj.js";import{X as uu}from"./x-CmbLQ9dc.js";import{P as Be}from"./plus-CnVxGdOo.js";import{M as ye,s as xe}from"./index-DoUk2Ei_.js";import{S as tu}from"./index-CVis9Agw.js";/* empty css *//**
1
+ import{jsxs as d,jsx as e,Fragment as je}from"react/jsx-runtime";import Ue,{useState as v,forwardRef as Xe,useEffect as W,useMemo as me,useImperativeHandle as Je,useRef as ae}from"react";import{c as Ce,a8 as Ne,a as Ge,L as oe,d as q,g as Ye,x as Ie,F as O,b as pe,a9 as Se,I as Ee,S as G,aa as Qe,ab as eu,B as ee,R as re,a6 as he}from"./index-8h59dJlj.js";import{X as uu}from"./x-CmbLQ9dc.js";import{P as Be}from"./plus-CnVxGdOo.js";import{M as ye,s as xe}from"./index-DoUk2Ei_.js";import{S as tu}from"./index-CVis9Agw.js";/* empty css *//**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -18,19 +18,19 @@ import{jsxs as d,jsx as e,Fragment as je}from"react/jsx-runtime";import Ue,{useS
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const su=Ce("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),_e=({title:s,defaultExpanded:n=!0,className:a,children:t})=>{const[h,g]=v(n);return d("div",{className:a,children:[d("div",{className:"flex items-center justify-between",style:{marginBottom:"10px"},children:[d("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:s})]}),h?e($e,{onClick:()=>g(b=>!b),color:"#4E6EF2",size:18}):e(Ne,{onClick:()=>g(b=>!b),color:"#4E5969",size:18})]}),t?e("div",{style:{display:h?"block":"none"},children:t}):null]})},ce=()=>d("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:d("g",{transform:"translate(0 1)",fill:"none","fill-rule":"evenodd",children:[e("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),d("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"})]}),au="\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",ru="\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",lu='\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!"',ou="\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",re={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"}},iu={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},cu=[{label:"\u6DF7\u5408\u68C0\u7D22",value:1},{label:"\u5168\u6587\u68C0\u7D22",value:2},{label:"\u8BED\u4E49\u68C0\u7D22",value:3}],du=[{label:"\u89C4\u5219\u6EAF\u6E90",value:!1},{label:"\u5927\u6A21\u578B\u6EAF\u6E90",value:!0}],fe=({url:s,token:n,role:a,eventsEmit:t})=>{const h=Ge.create({baseURL:s,timeout:1e6});return h.interceptors.request.use(l=>{let u=n;return!u&&!["user/login","user/kaptcha","user/regist"].some(i=>l.url.includes(i))?(t&&t("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=u||"",l.headers.userName=a==="\u672A\u767B\u5F55\u7528\u6237"?"":a,l)}),h.interceptors.response.use(l=>{const u=["user/kaptcha"],r=l.data;if(u.some(I=>l.config.url&&l.config.url.includes(I))||r.size&&r.type)return r;const{success:i,errorMsg:E,errorCode:m}=r;if(i)return r;t&&t("request:error_business",{errorCode:m,errorMsg:E||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:r})},l=>{var u,r,i,E,m,I,N,T,Z;if(l.message==="canceled")return Promise.reject(l);if(t){let y="request:error_network",C={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:l};((u=l==null?void 0:l.response)==null?void 0:u.status)===401?(y="request:error_auth",C={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:l,redirect:"/login"}):(((i=(r=l==null?void 0:l.response)==null?void 0:r.data)==null?void 0:i.errorCode)==="30013"||((m=(E=l==null?void 0:l.response)==null?void 0:E.data)==null?void 0:m.errorCode)==="30023")&&(y="request:error_business",C={errorCode:(N=(I=l==null?void 0:l.response)==null?void 0:I.data)==null?void 0:N.errorCode,errorMsg:((Z=(T=l==null?void 0:l.response)==null?void 0:T.data)==null?void 0:Z.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:l}),t(y,C)}return Promise.reject(l)}),{getConfigById:async l=>{try{const u=await h.get(`/qa/search/config/getById?configId=${l}`),{success:r,data:i}=u;return r?i:!1}catch(u){console.error("getConfigById",u)}},fetchDatabases:async()=>{try{const l=await h.get("/index/database/queryAllDBList"),{success:u,data:r}=l;return u?r:!1}catch(l){console.error("fetchDatabases",l)}},fetchModels:async l=>{try{const u=await h.get(`/index/modelInfo/allPage?${new URLSearchParams(l).toString()}`),{success:r,data:i}=u;return r?i:!1}catch(u){return console.log("fetchModels error",u),!1}},fetchSensitiveLibrary:async l=>{try{const u=await h.get(`/sensitive/library?${new URLSearchParams(l).toString()}`),{success:r,data:i}=u;return r?i:!1}catch(u){return console.log("fetchSensitiveLibrary error",u),!1}},fetchConfigItemLimit:async()=>{try{const l=await h.get("/qa/search/config/configItemLimit"),{success:u,data:r}=l;return u?r:!1}catch(l){console.error("fetchConfigItemLimit error",l)}},fetchKnowledgeBase:async l=>{try{const u=l?`?userName=${l}`:"";console.log("+++",u);const r=await h.get(`/index/knowledgeBase/searchList${u}`),{success:i,data:E}=r;return i?E:!1}catch(u){console.log("e",u)}},fetchGraphs:async()=>{try{const l=await h.get("/index/graph/platform/querySnapshotList?pageSize=999&pageNo=1"),{success:u,data:r}=l;return u?r:!1}catch(l){console.error("fetchGraphs",l)}},checkName:async(l,u)=>{try{const r=await h.get(`/qa/search/config/checkName?configName=${l}${u?`&configId=${u}`:""}`),{success:i,data:E}=r;if(i)return E}catch(r){return console.log("updateConversationAssistant error:",r),!1}},getBizLabelLabels:async l=>{try{const u=await h.post("/index/bizLabel/labels",l),{success:r,data:i}=u;if(r)return i}catch(u){return console.log("updateConversationAssistant error:",u),!1}},addConversationAssistant:async l=>{try{const u=await h.post("/qa/search/config/add",{...l}),{success:r,data:i}=u;if(r)return i}catch(u){return console.log("addConversationAssistant error:",u),!1}},updateConversationAssistant:async(l,u)=>{try{const r=await h.put("/qa/search/config/update",{id:l,...u}),{success:i,data:E}=r;if(i)return E}catch(r){return console.log("updateConversationAssistant error:",r),!1}}}},be=({countText:s,eventsEmit:n,data:a})=>{const[t,h]=v(!0);return d("div",{style:{marginTop:8},children:[s&&d("div",{className:"flex items-center gap-2",children:[e("span",{style:{color:t?"#4E6EF2":"#4E5969"},children:s}),t?e($e,{onClick:()=>h(g=>!g),color:"#4E6EF2",size:14}):e(Ne,{onClick:()=>h(g=>!g),color:"#4E5969",size:14})]}),e("div",{style:{display:t?"block":"none"},children:a.map(g=>e(hu,{item:g,eventsEmit:n},g.key))})]})},hu=({item:s,eventsEmit:n})=>{var h,g,b;const[a,t]=v(!0);return d("div",{className:"flex items-center justify-between",style:{padding:"8px 12px",borderRadius:6},children:[d("div",{children:[d("div",{style:{color:"#1D2129"},className:"flex items-center",children:[s.label,((h=s==null?void 0:s.tags)==null?void 0:h.length)>0&&d(je,{children:[d("span",{style:{color:"#4E5969",marginLeft:"6px",marginRight:6},children:["(",(g=s==null?void 0:s.tags)==null?void 0:g.length,"\u4E2A\u6807\u7B7E)"]}),a?e($e,{onClick:()=>t(f=>!f),color:"#4E6EF2",size:14}):e(Ne,{onClick:()=>t(f=>!f),color:"#4E5969",size:14})]})]}),((b=s==null?void 0:s.tags)==null?void 0:b.length)>0&&e("div",{className:"flex flex-wrap gap-4",style:{display:a?"block":"none",marginTop:8},children:((s==null?void 0:s.tags)||[]).map(f=>e(oe,{iconPosition:"end",type:"text",style:{backgroundColor:"#F0F0F0",padding:"2px 6px",height:22,borderRadius:2,color:"#1D2129",margin:5},icon:e(uu,{size:14,color:"#86909C",onClick:()=>{const c={...s,tags:s.tags.filter(B=>B!==f)};n("removeTag",c)}}),children:f},f))})]}),e(oe,{type:"text",icon:e(qe,{size:14}),onClick:()=>n("removeItem",s)})]},s.key)},mu=q.div`
21
+ */const su=Ce("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),_e=({title:n,defaultExpanded:s=!0,className:r,children:t})=>{const[h,g]=v(s);return d("div",{className:r,children:[d("div",{className:"flex items-center justify-between",style:{marginBottom:"10px"},children:[d("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($e,{onClick:()=>g(b=>!b),color:"#4E6EF2",size:18}):e(Ne,{onClick:()=>g(b=>!b),color:"#4E5969",size:18})]}),t?e("div",{style:{display:h?"block":"none"},children:t}):null]})},ce=()=>d("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:d("g",{transform:"translate(0 1)",fill:"none","fill-rule":"evenodd",children:[e("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),d("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"})]}),ru="\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",lu="\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",au='\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!"',ou="\u60A8\u597D\uFF01\u6211\u6CE8\u610F\u5230\u60A8\u7684\u6D88\u606F\u4E2D\u53EF\u80FD\u5305\u542B\u4E86\u4E00\u4E9B\u654F\u611F\u7684\u5185\u5BB9\u3002\u4E3A\u4E86\u4FDD\u8BC1\u793E\u533A\u7684\u53CB\u597D\u6C1B\u56F4\uFF0C\u6211\u4EEC\u65E0\u6CD5\u7EE7\u7EED\u5C31\u6B64\u8BDD\u9898\u8FDB\u884C\u8BA8\u8BBA\u3002\u5982\u679C\u60A8\u6709\u5176\u4ED6\u95EE\u9898\u6216\u9700\u8981\u5E2E\u52A9\uFF0C\u6211\u5F88\u4E50\u610F\u7EE7\u7EED\u4E3A\u60A8\u670D\u52A1\uFF01\u8C22\u8C22\u60A8\u7684\u7406\u89E3\u548C\u652F\u6301\u3002",le={top_k:{default:10,min:1,max:15,step:1,tooltip:"top_k\u4EE3\u8868\u6A21\u578B\u6700\u7EC8\u53D6\u4FE1\u7684\u6587\u672C\u5757\u6570\uFF0C\u4F8B\u5982\u95E8\u69DBtop_p = 0.8\uFF0Ctop_k = 3\uFF0C\u610F\u5473\u7740\u6A21\u578B\u4F1A\u4F9D\u636E\u76F8\u4F3C\u5EA6\u9AD8\u4F4E\u53D6\u524D3\u4E2A\u5927\u4E8E0.8\u7684\u6587\u672C\u5757\uFF0C\u5373\u4F7F\u5F53\u524D\u53EF\u80FD\u6709\u5927\u4E8E3\u4E2A\u6587\u672C\u5757\u7684\u76F8\u4F3C\u5EA6\u5927\u4E8E0.8\uFF1B"},max_tokens:{default:4096,min:0,max:1e4,step:64,tooltip:"max_tokens\u4EE3\u8868\u6A21\u578B\u7A97\u53E3\u5927\u5C0F\uFF0C\u5373\u4E00\u6B21\u95EE\u7B54\u5927\u6A21\u578B\u4E00\u6B21\u80FD\u591F\u63A5\u53D7\u7684\u5B57\u7B26\u4E32\u6700\u5927\u957F\u5EA6\uFF0C\u5305\u62EC\u7528\u6237\u7684\u63D0\u95EE\u548C\u6A21\u578B\u7684\u56DE\u7B54\uFF1B\u591A\u8F6E\u5BF9\u8BDD\u4E2D\u5386\u53F2\u5BF9\u8BDD\u5185\u5BB9\u4E5F\u5305\u62EC\u5728\u5185\uFF1B\u6700\u5927\u503C\u53D6\u51B3\u4E8E\u5927\u6A21\u578B\u672C\u8EAB\u662F\u5426\u652F\u6301\uFF1B"},max_round:{default:5,min:0,max:32,step:1,tooltip:"\u4EA4\u4E92\u5BF9\u8BDD\u573A\u666F\u91CC\uFF0C\u7CFB\u7EDF\u80FD\u591F\u8BB0\u5FC6\u5E76\u6709\u6548\u5173\u8054\u7684\u7528\u6237\u4E0E\u6A21\u578B\u4E4B\u95F4\u6765\u56DE\u4EA4\u6D41\u7684\u6700\u5927\u6B21\u6570\uFF1B"},temperature:{default:.3,min:.1,max:1,step:.1,tooltip:"\u6E29\u5EA6\u662F\u6A21\u578B\u56DE\u7B54\u7684\u503E\u5411\u6027\uFF0C\u53D6\u503C\u8303\u56F4\u4E00\u822C\u662F0\uFF5E1; \u53D6\u503C\u8D8B\u8FD10\u4EE3\u8868\u7740\u6A21\u578B\u56DE\u7B54\u4F1A\u66F4\u4E25\u8C28\uFF0C\u9002\u5408\u56DE\u7B54\u68C0\u7D22\u7C7B\u95EE\u9898; \u53D6\u503C\u8D8B\u8FD11\u5219\u4EE3\u8868\u56DE\u7B54\u66F4\u53D1\u6563\uFF0C\u9002\u5408\u56DE\u7B54\u521B\u65B0\u6027\u7684\u95EE\u9898\uFF1B"},top_p:{default:.8,min:.1,max:1,step:.1,tooltip:"top_p \u7528\u4E8E\u63A7\u5236\u5927\u6A21\u578B\u751F\u6210\u7B56\u7565\uFF0C\u51B3\u5B9A\u4E86\u6A21\u578B\u5728\u751F\u6210\u4E0B\u4E00\u4E2A\u8BCD\u65F6\uFF0C\u4ECE\u7D2F\u79EF\u6982\u7387\u8FBE\u5230 p \u7684\u6700\u5C0F\u8BCD\u96C6\u5408\u4E2D\u8FDB\u884C\u91C7\u6837\u3002\u901A\u5E38\u8BBE\u7F6E\u57280.8 - 0.95\u4E4B\u95F4\uFF0Ctop_p\u8D8A\u4F4E\u6A21\u578B\u7528\u8BCD\u8D8A\u4FDD\u5B88\uFF0C\u8D8A\u9AD8\u8D8A\u6D3B\u8DC3\u3002"},score_threshold:{default:.1,min:.1,max:1,step:.1,tooltip:"score_threshold\u53C2\u6570\u662F\u6A21\u578B\u8FDB\u884C\u91CD\u6392\u5E8F\u65F6\uFF0C\u5BF9\u4E8E\u6587\u672C\u5757\u53D6\u820D\u7684\u95E8\u69DB\u503C\uFF1B"}},iu={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},cu=[{label:"\u6DF7\u5408\u68C0\u7D22",value:1},{label:"\u5168\u6587\u68C0\u7D22",value:2},{label:"\u8BED\u4E49\u68C0\u7D22",value:3}],du=[{label:"\u89C4\u5219\u6EAF\u6E90",value:!1},{label:"\u5927\u6A21\u578B\u6EAF\u6E90",value:!0}],fe=({url:n,token:s,role:r,eventsEmit:t})=>{const h=Ge.create({baseURL:n,timeout:1e6});return h.interceptors.request.use(a=>{let u=s;return!u&&!["user/login","user/kaptcha","user/regist"].some(i=>a.url.includes(i))?(t&&t("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(a.headers.Authorization=u||"",a.headers.userName=r==="\u672A\u767B\u5F55\u7528\u6237"?"":r,a)}),h.interceptors.response.use(a=>{const u=["user/kaptcha"],l=a.data;if(u.some(I=>a.config.url&&a.config.url.includes(I))||l.size&&l.type)return l;const{success:i,errorMsg:E,errorCode:p}=l;if(i)return l;t&&t("request:error_business",{errorCode:p,errorMsg:E||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:l})},a=>{var u,l,i,E,p,I,N,T,Z;if(a.message==="canceled")return Promise.reject(a);if(t){let y="request:error_network",C={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:a};((u=a==null?void 0:a.response)==null?void 0:u.status)===401?(y="request:error_auth",C={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:a,redirect:"/login"}):(((i=(l=a==null?void 0:a.response)==null?void 0:l.data)==null?void 0:i.errorCode)==="30013"||((p=(E=a==null?void 0:a.response)==null?void 0:E.data)==null?void 0:p.errorCode)==="30023")&&(y="request:error_business",C={errorCode:(N=(I=a==null?void 0:a.response)==null?void 0:I.data)==null?void 0:N.errorCode,errorMsg:((Z=(T=a==null?void 0:a.response)==null?void 0:T.data)==null?void 0:Z.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:a}),t(y,C)}return Promise.reject(a)}),{getConfigById:async a=>{try{const u=await h.get(`/qa/search/config/getById?configId=${a}`),{success:l,data:i}=u;return l?i:!1}catch(u){console.error("getConfigById",u)}},fetchDatabases:async()=>{try{const a=await h.get("/index/database/queryAllDBList"),{success:u,data:l}=a;return u?l:!1}catch(a){console.error("fetchDatabases",a)}},fetchModels:async a=>{try{const u=await h.get(`/index/modelInfo/allPage?${new URLSearchParams(a).toString()}`),{success:l,data:i}=u;return l?i:!1}catch(u){return console.log("fetchModels error",u),!1}},fetchSensitiveLibrary:async a=>{try{const u=await h.get(`/sensitive/library?${new URLSearchParams(a).toString()}`),{success:l,data:i}=u;return l?i:!1}catch(u){return console.log("fetchSensitiveLibrary error",u),!1}},fetchConfigItemLimit:async()=>{try{const a=await h.get("/qa/search/config/configItemLimit"),{success:u,data:l}=a;return u?l:!1}catch(a){console.error("fetchConfigItemLimit error",a)}},fetchKnowledgeBase:async a=>{try{const u=a?`?userName=${a}`:"";console.log("+++",u);const l=await h.get(`/index/knowledgeBase/searchList${u}`),{success:i,data:E}=l;return i?E:!1}catch(u){console.log("e",u)}},fetchGraphs:async()=>{try{const a=await h.get("/index/graph/platform/querySnapshotList?pageSize=999&pageNo=1"),{success:u,data:l}=a;return u?l:!1}catch(a){console.error("fetchGraphs",a)}},checkName:async(a,u)=>{try{const l=await h.get(`/qa/search/config/checkName?configName=${a}${u?`&configId=${u}`:""}`),{success:i,data:E}=l;if(i)return E}catch(l){return console.log("updateConversationAssistant error:",l),!1}},getBizLabelLabels:async a=>{try{const u=await h.post("/index/bizLabel/labels",a),{success:l,data:i}=u;if(l)return i}catch(u){return console.log("updateConversationAssistant error:",u),!1}},addConversationAssistant:async a=>{try{const u=await h.post("/qa/search/config/add",{...a}),{success:l,data:i}=u;if(l)return i}catch(u){return console.log("addConversationAssistant error:",u),!1}},updateConversationAssistant:async(a,u)=>{try{const l=await h.put("/qa/search/config/update",{id:a,...u}),{success:i,data:E}=l;if(i)return E}catch(l){return console.log("updateConversationAssistant error:",l),!1}}}},be=({countText:n,eventsEmit:s,data:r})=>{const[t,h]=v(!0);return d("div",{style:{marginTop:8},children:[n&&d("div",{className:"flex items-center gap-2",children:[e("span",{style:{color:t?"#4E6EF2":"#4E5969"},children:n}),t?e($e,{onClick:()=>h(g=>!g),color:"#4E6EF2",size:14}):e(Ne,{onClick:()=>h(g=>!g),color:"#4E5969",size:14})]}),e("div",{style:{display:t?"block":"none"},children:r.map(g=>e(hu,{item:g,eventsEmit:s},g.key))})]})},hu=({item:n,eventsEmit:s})=>{var h,g,b;const[r,t]=v(!0);return d("div",{className:"flex items-center justify-between",style:{padding:"8px 12px",borderRadius:6},children:[d("div",{children:[d("div",{style:{color:"#1D2129"},className:"flex items-center",children:[n.label,((h=n==null?void 0:n.tags)==null?void 0:h.length)>0&&d(je,{children:[d("span",{style:{color:"#4E5969",marginLeft:"6px",marginRight:6},children:["(",(g=n==null?void 0:n.tags)==null?void 0:g.length,"\u4E2A\u6807\u7B7E)"]}),r?e($e,{onClick:()=>t(f=>!f),color:"#4E6EF2",size:14}):e(Ne,{onClick:()=>t(f=>!f),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:r?"block":"none",marginTop:8},children:((n==null?void 0:n.tags)||[]).map(f=>e(oe,{iconPosition:"end",type:"text",style:{backgroundColor:"#F0F0F0",padding:"2px 6px",height:22,borderRadius:2,color:"#1D2129",margin:5},icon:e(uu,{size:14,color:"#86909C",onClick:()=>{const c={...n,tags:n.tags.filter(B=>B!==f)};s("removeTag",c)}}),children:f},f))})]}),e(oe,{type:"text",icon:e(qe,{size:14}),onClick:()=>s("removeItem",n)})]},n.key)},mu=q.div`
22
22
  display: flex;
23
23
  background-color: #ffffff;
24
- border: 1px solid ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.border)==null?void 0:t.default)||"#e5e7eb"}};
25
- border-radius: ${s=>{var n,a;return((a=(n=s.$theme)==null?void 0:n.space)==null?void 0:a.radius)||"8px"}};
24
+ border: 1px solid ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.border)==null?void 0:t.default)||"#e5e7eb"}};
25
+ border-radius: ${n=>{var s,r;return((r=(s=n.$theme)==null?void 0:s.space)==null?void 0:r.radius)||"8px"}};
26
26
  overflow: hidden;
27
- width: ${s=>s.$width||"600px"};
28
- height: ${s=>s.$height||"400px"};
27
+ width: ${n=>n.$width||"600px"};
28
+ height: ${n=>n.$height||"400px"};
29
29
  position: relative;
30
30
  `,Le=q.div`
31
31
  display: flex;
32
32
  flex-direction: column;
33
- border-right: 1px solid ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.border)==null?void 0:t.default)||"#e5e7eb"}};
33
+ border-right: 1px solid ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.border)==null?void 0:t.default)||"#e5e7eb"}};
34
34
  overflow: hidden;
35
35
 
36
36
  &:last-child {
@@ -43,30 +43,30 @@ import{jsxs as d,jsx as e,Fragment as je}from"react/jsx-runtime";import Ue,{useS
43
43
  display: flex;
44
44
  align-items: center;
45
45
  justify-content: space-between;
46
- color: ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.text)==null?void 0:t.primary)||"#4E5969"}};
46
+ color: ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.text)==null?void 0:t.primary)||"#4E5969"}};
47
47
  `,fu=q.div`
48
48
  font-weight: 400;
49
49
  font-size: 14px;
50
- color: ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.text)==null?void 0:t.primary)||"#4E6EF2"}};
50
+ color: ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.text)==null?void 0:t.primary)||"#4E6EF2"}};
51
51
  `,gu=q.div`
52
52
  padding: 12px;
53
- background-color: ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.background)==null?void 0:t.default)||"#ffffff"}};
53
+ background-color: ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.background)==null?void 0:t.default)||"#ffffff"}};
54
54
  `,Fu=q.input`
55
55
  width: 100%;
56
56
  padding: 8px 12px 8px 12px;
57
- border: 1px solid ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.border)==null?void 0:t.default)||"#e5e7eb"}};
58
- border-radius: ${s=>{var n,a;return((a=(n=s.$theme)==null?void 0:n.space)==null?void 0:a.radius)||"6px"}};
57
+ border: 1px solid ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.border)==null?void 0:t.default)||"#e5e7eb"}};
58
+ border-radius: ${n=>{var s,r;return((r=(s=n.$theme)==null?void 0:s.space)==null?void 0:r.radius)||"6px"}};
59
59
  font-size: 14px;
60
60
  outline: none;
61
61
  transition: all 0.2s;
62
62
 
63
63
  &:focus {
64
- border-color: ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.primary)==null?void 0:t.default)||"#3b82f6"}};
65
- box-shadow: 0 0 0 3px ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.primary)==null?void 0:t.default)||"#3b82f6"}}20;
64
+ border-color: ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.primary)==null?void 0:t.default)||"#3b82f6"}};
65
+ box-shadow: 0 0 0 3px ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.primary)==null?void 0:t.default)||"#3b82f6"}}20;
66
66
  }
67
67
 
68
68
  &::placeholder {
69
- color: ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.text)==null?void 0:t.tertiary)||"#9ca3af"}};
69
+ color: ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.text)==null?void 0:t.tertiary)||"#9ca3af"}};
70
70
  }
71
71
  `,Eu=q.div`
72
72
  position: absolute;
@@ -98,15 +98,15 @@ import{jsxs as d,jsx as e,Fragment as je}from"react/jsx-runtime";import Ue,{useS
98
98
  }
99
99
  `,Pe=q.div`
100
100
  padding: 10px 16px;
101
- cursor: ${s=>s.$disabled?"not-allowed":"pointer"};
101
+ cursor: ${n=>n.$disabled?"not-allowed":"pointer"};
102
102
  transition: all 0.2s;
103
103
  display: flex;
104
104
  align-items: center;
105
105
  justify-content: space-between;
106
- opacity: ${s=>s.$disabled?.5:1};
106
+ opacity: ${n=>n.$disabled?.5:1};
107
107
 
108
108
  &:hover {
109
- background-color: ${s=>{var n,a,t;return s.$disabled?"transparent":((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.background)==null?void 0:t.hover)||"#f3f4f6"}};
109
+ background-color: ${n=>{var s,r,t;return n.$disabled?"transparent":((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.background)==null?void 0:t.hover)||"#f3f4f6"}};
110
110
  }
111
111
 
112
112
  &:last-child {
@@ -115,7 +115,7 @@ import{jsxs as d,jsx as e,Fragment as je}from"react/jsx-runtime";import Ue,{useS
115
115
  `,Me=q.span`
116
116
  flex: 1;
117
117
  font-size: 14px;
118
- color: ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.text)==null?void 0:t.primary)||"#111827"}};
118
+ color: ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.text)==null?void 0:t.primary)||"#111827"}};
119
119
  overflow: hidden;
120
120
  text-overflow: ellipsis;
121
121
  white-space: nowrap;
@@ -129,17 +129,17 @@ import{jsxs as d,jsx as e,Fragment as je}from"react/jsx-runtime";import Ue,{useS
129
129
  border-radius: 4px;
130
130
  cursor: pointer;
131
131
  font-size: 12px;
132
- color: ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.text)==null?void 0:t.secondary)||"#1D2129"}};
132
+ color: ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.text)==null?void 0:t.secondary)||"#1D2129"}};
133
133
  transition: all 0.2s;
134
134
 
135
135
  &:disabled {
136
136
  cursor: not-allowed;
137
- color: ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.text)==null?void 0:t.secondary)||"#C9CDD4"}};
137
+ color: ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.text)==null?void 0:t.secondary)||"#C9CDD4"}};
138
138
  }
139
139
  `,Oe=q.div`
140
140
  padding: 40px 20px;
141
141
  text-align: center;
142
- color: ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.text)==null?void 0:t.tertiary)||"#9ca3af"}};
142
+ color: ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.text)==null?void 0:t.tertiary)||"#9ca3af"}};
143
143
  font-size: 14px;
144
144
  `;q.span`
145
145
  display: inline-flex;
@@ -148,10 +148,10 @@ import{jsxs as d,jsx as e,Fragment as je}from"react/jsx-runtime";import Ue,{useS
148
148
  min-width: 20px;
149
149
  height: 20px;
150
150
  padding: 0 6px;
151
- background-color: ${s=>{var n,a,t;return((t=(a=(n=s.$theme)==null?void 0:n.colors)==null?void 0:a.primary)==null?void 0:t.default)||"#3b82f6"}};
151
+ background-color: ${n=>{var s,r,t;return((t=(r=(s=n.$theme)==null?void 0:s.colors)==null?void 0:r.primary)==null?void 0:t.default)||"#3b82f6"}};
152
152
  color: white;
153
153
  border-radius: 10px;
154
154
  font-size: 12px;
155
155
  font-weight: 500;
156
156
  margin-left: 8px;
157
- `;const ge=Xe(({dataSource:s,value:n=[],onConfirm:a,maxCount:t=0,searchPlaceholder:h="\u641C\u7D22...",title:g="",showSearch:b=!0,filterOption:f,renderItem:c,renderSelectedItem:B,className:M,style:$,styles:A,height:F,width:R},k)=>{const l=Ye(),u=Ie(Ie({theme:O,mode:"light"},l),A),[r,i]=v(n),[E,m]=v("");W(()=>{i(n)},[n]),me(()=>new Set(n.map(o=>o.key)),[n]);const I=me(()=>new Set(r.map(o=>o.key)),[r]);Je(k,()=>({getSelectedItems:()=>r,confirm:()=>{a==null||a(r)}}),[r,a]);const T=f||((o,_)=>{var H;if(!o)return!0;const w=o.toLowerCase();return _.label.toLowerCase().includes(w)||((H=_.tags)==null?void 0:H.some(V=>V.toLowerCase().includes(w)))||!1}),Z=me(()=>(s||[]).filter(o=>T(E,o)),[s,E,T]),y=o=>{const _=I.has(o.key);let w;if(_)w=(r||[]).filter(H=>H.key!==o.key);else{if(t>0&&r.length>=t)return;w=[...r,o]}i(w)},C=(o,_)=>{i(w=>w.map(V=>V.key==o?{...V,tags:_}:V))},z=o=>{const _=(r||[]).filter(w=>w.key!==o.key);i(_)},x=o=>I.has(o);return t>0&&r.length>=t,d(mu,{$theme:u.theme||O,$width:R,$height:F,className:M,style:$,children:[d(Le,{$theme:u.theme||O,style:{flex:1},children:[b&&e(gu,{$theme:u.theme||O,children:d("div",{style:{position:"relative"},children:[e(Eu,{children:e(su,{size:16})}),e(Fu,{$theme:u.theme||O,type:"text",placeholder:h,value:E,onChange:o=>m(o.target.value)})]})}),e(ze,{children:Z.length===0?e(Oe,{$theme:u.theme||O,children:E?"\u672A\u627E\u5230\u5339\u914D\u9879":"\u6682\u65E0\u6570\u636E"}):Z.map(o=>{const _=x(o.key);return d(Pe,{$theme:u.theme||O,$selected:_,children:[e(Me,{$theme:u.theme||O,children:c?c(o):o.label}),_&&e(Te,{$theme:u.theme||O,onClick:w=>{w.stopPropagation(),z(o)},disabled:!0,children:"\u5DF2\u6DFB\u52A0"}),!_&&e(Te,{$theme:u.theme||O,onClick:w=>{w.stopPropagation(),y(o)},children:"\u6DFB\u52A0"})]},o.key)})})]}),d(Le,{$theme:u.theme||O,style:{flex:1},children:[d(pu,{$theme:u.theme||O,children:[t>0?`\u5DF2\u9009\uFF1A${r.length}/${t}\u4E2A${g}`:`\u5DF2\u9009\uFF1A${r.length}\u4E2A${g}`,e(fu,{$theme:u.theme||O,onClick:o=>{o.stopPropagation(),i([])},children:"\u6E05\u7A7A"})]}),e(ze,{children:r.length===0?e(Oe,{$theme:u.theme||O,children:"\u6682\u65E0\u5DF2\u9009\u9879"}):r.map(o=>{var w,H,V;const _=ue=>C(o.key,ue);return d(Pe,{$theme:u.theme||O,children:[e(Me,{$theme:u.theme||O,children:B?B(o,_):o.label}),e(qe,{size:14,color:((V=(H=(w=u.theme)==null?void 0:w.colors)==null?void 0:H.text)==null?void 0:V.secondary)||"#86909C",style:{cursor:"pointer"},onClick:ue=>{ue.stopPropagation(),z(o)}})]},o.key)})})]})]})});ge.displayName="SearchableSelector";const we="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:Cu}=pe,Bu=({url:s,token:n,role:a,eventsEmit:t,sectionData:h,defaultAnswer:g,form:b})=>{const[f,c]=v([]),[B,M]=v([]),[$,A]=v(!1),[F,R]=v(!1),k=le(null),{fetchSensitiveLibrary:l}=fe({url:s,token:n,role:a,eventsEmit:t});W(()=>{u()},[]),W(()=>{if(h&&(f==null?void 0:f.length)>0){let m=h?Array.isArray(h)?h:h.split(","):[],I=[];m.forEach(N=>{const T=(f||[]).find(Z=>Z.key===N);T&&I.push({key:T.key,label:T.label})}),M(I)}},[h,f]),W(()=>{g&&R(!0)},[g]);const u=async()=>{try{const m=await l({pageNo:1,pageSize:9999});if(m!=null&&m.records){const I=((m==null?void 0:m.records)||[]).map(N=>({key:N.id+"",label:N.name}));c(I)}}catch(m){console.error(m)}},r=(m,I)=>{switch(m){case"removeItem":const N=B.filter(T=>T.key!==I.key);M([...N]),i(N);break}},i=m=>{const I=m.map(N=>(N==null?void 0:N.key)||"").filter(N=>N).join(",");t&&t("sensitive_selected",I)},E=()=>{var I;const m=((I=k.current)==null?void 0:I.getSelectedItems())||[];M(m),A(!1),i(m)};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:we}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u654F\u611F\u8BCD"})]}),e(oe,{color:"primary",variant:"outlined",size:"small",icon:e(Be,{size:14}),onClick:()=>A(!0),children:"\u6DFB\u52A0"})]}),e(Se,{checked:F,onChange:m=>{R(m.target.checked),m.target.checked?b.setFieldsValue({defaultAnswer:ou}):b.setFieldsValue({defaultAnswer:""})},style:{marginBottom:8,marginTop:8},children:"\u81EA\u5B9A\u4E49\u56DE\u590D"}),F&&e(Cu,{label:"\u81EA\u5B9A\u4E49\u56DE\u590D\u5185\u5BB9",name:"defaultAnswer",layout:"vertical",children:e(Ee.TextArea,{style:{height:"55px",resize:"none"}})}),(B==null?void 0:B.length)>0&&e(be,{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(ye,{width:740,title:"\u9009\u62E9\u654F\u611F\u8BCD",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:$,onOk:E,onCancel:()=>A(!1),destroyOnHidden:!0,className:"assistant-config-resource-bind-modal",children:e(ge,{ref:k,dataSource:f,value:B,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u654F\u611F\u8BCD\u5E93",renderItem:m=>d("div",{className:"flex ",children:[e("img",{src:we,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:m.label,children:m.label})]}),renderSelectedItem:(m,I)=>d("div",{className:"flex items-center",children:[e("img",{src:we,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:m.label})})]})})})]})},ve="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",yu=({url:s,token:n,role:a,sectionData:t,createBy:h,eventsEmit:g})=>{const[b,f]=v(),[c,B]=v([]),[M,$]=v(!1),A=le(null),[F,R]=v(!1),[k,l]=v([]),u=le(new Map).current,{fetchKnowledgeBase:r,getBizLabelLabels:i}=fe({url:s,token:n,role:a,eventsEmit:g}),E=le(!1);W(()=>{E.current||(h?(m(h),E.current=!0):(m(),E.current=!0))},[h]),W(()=>{if(t&&(b==null?void 0:b.length)>0){const y=t==null?void 0:t.knowledge_base_name_source,C=y&&(Array.isArray(y)?y:y.split(";"));let z=[];(C||[]).forEach(x=>{const o=((t==null?void 0:t.selectedKnowledgeBase)||[]).find(w=>w.name==x),_=(b||[]).find(w=>w.knowledge_base_name_source===x);if(_){const{key:w,label:H,knowledge_base_name:V,knowledge_base_name_source:ue}=_;z.push({key:w,label:H,knowledge_base_name:V,knowledge_base_name_source:ue,tags:o==null?void 0:o.labels})}}),B(z)}},[t,b]);const m=async y=>{try{const C=await r(y);if(C){const z=(C||[]).map(x=>({key:x.id,label:x.kbName,knowledge_base_name:x.primitiveName,knowledge_base_name_source:x.kbName}));f(z)}}catch(C){console.error(C)}},I=(y,C)=>{switch(y){case"removeItem":const z=c.filter(o=>o.key!==C.key);B([...z]),N(z);break;case"removeTag":const x=c.findIndex(o=>o.key==C.key);x!==-1&&(c[x]=C),B([...c]),N(c);break}},N=y=>{const C=(y||[]).map(o=>(o==null?void 0:o.knowledge_base_name)||"").filter(o=>o).join(";"),z=(y||[]).map(o=>(o==null?void 0:o.knowledge_base_name_source)||"").filter(o=>o).join(";"),x=(y||[]).filter(o=>{var _;return Array.isArray(o==null?void 0:o.tags)&&((_=o.tags)==null?void 0:_.length)>0}).map(o=>({id:o.key,name:o.label,knowledge_base_name_source:o.knowledge_base_name,labels:o.tags}));g&&g("knowledge_selected",{knowledge_base_name:C,knowledge_base_name_source:z,selectedKnowledgeBase:x})},T=()=>{var C;const y=((C=A.current)==null?void 0:C.getSelectedItems())||[];B(y),$(!1),N(y)},Z=async(y,C)=>{if(y){const z=u.get(C);if(z){l(z);return}if(!F)try{R(!0);const x=await i({kbNames:[C]});if(Array.isArray(x)){const o=x.length?x[0].label:"",_=o?(o||"").split(",").map(w=>({label:w,value:w})):[];u.set(C,_),l(_)}R(!1)}catch(x){console.error("Error fetching data:",x),R(!1)}}};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:ve}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u77E5\u8BC6\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(oe,{color:"primary",variant:"outlined",size:"small",icon:e(Be,{size:14}),onClick:()=>$(!0),children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(be,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u77E5\u8BC6\u5E93`:void 0,eventsEmit:I,data:c}),e(ye,{width:740,className:"assistant-config-resource-bind-modal",title:"\u9009\u62E9\u77E5\u8BC6\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:M,onOk:T,onCancel:()=>$(!1),destroyOnHidden:!0,children:e(ge,{ref:A,dataSource:b,value:c,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u77E5\u8BC6\u5E93",renderItem:y=>d("div",{className:"flex ",children:[e("img",{src:ve,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:y.label,children:y.label})]}),renderSelectedItem:(y,C)=>d("div",{className:"flex ",children:[e("img",{src:ve,alt:"add"}),d("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:y.label}),e(G,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:y.tags||[],onChange:z=>{C(z)},style:{width:250},options:k,loading:F,onOpenChange:z=>{Z(z,y.knowledge_base_name)}})]})]})})})]})},bu=Ue.memo(yu),ke="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",Re=10,Au=({url:s,token:n,role:a,eventsEmit:t,sectionData:h,disabled:g})=>{const[b,f]=v([]),[c,B]=v([]),[M,$]=v(!1),A=le(null),{fetchDatabases:F}=fe({url:s,token:n,role:a,eventsEmit:t});W(()=>{R()},[]),W(()=>{if(h){let u=[];(h||[]).map(r=>{const i=(b||[]).find(E=>E.key===r.key);if(i){const{key:E,label:m}=i;u.push({key:E,label:m})}}),B(u)}},[h,b]);const R=async()=>{try{const u=await F();if(u){const r=(u||[]).map(i=>({key:i.primitiveName,label:i.name}));f(r)}}catch(u){console.error(u)}},k=(u,r)=>{switch(u){case"removeItem":const i=c.filter(E=>E.key!==r.key);B([...i]),t&&t("database_selected",i);break}},l=()=>{var r;const u=((r=A.current)==null?void 0:r.getSelectedItems())||[];B(u),$(!1),t&&t("database_selected",u)};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:ke}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u6570\u636E\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(oe,{color:"primary",variant:"outlined",size:"small",icon:e(Be,{size:14}),onClick:()=>$(!0),disabled:c.length>=Re||g,children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(be,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u6570\u636E\u5E93`:void 0,eventsEmit:k,data:c}),e(ye,{width:740,title:"\u9009\u62E9\u6570\u636E\u5E93",className:"assistant-config-resource-bind-modal",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:M,onOk:l,onCancel:()=>$(!1),destroyOnHidden:!0,children:e(ge,{ref:A,dataSource:b,value:c,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u6570\u636E\u5E93",maxCount:Re,renderItem:u=>d("div",{className:"flex ",children:[e("img",{src:ke,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:u.label,children:u.label})]}),renderSelectedItem:(u,r)=>d("div",{className:"flex items-center",children:[e("img",{src:ke,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:u.label})})]})})})]})},De="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",xu=({url:s,token:n,role:a,eventsEmit:t,sectionData:h})=>{const[g,b]=v([]),[f,c]=v([]),[B,M]=v(!1),$=le(null),{fetchGraphs:A}=fe({url:s,token:n,role:a,eventsEmit:t});W(()=>{F()},[]),W(()=>{if(h){let u=[];(h||[]).map(r=>{const i=(g||[]).find(E=>E.key===r.index_name);if(i){const{key:E,label:m}=i;u.push({key:E,label:m})}}),c(u)}},[h,g]);const F=async()=>{try{const u=await A();if(u!=null&&u.dataList){const r=((u==null?void 0:u.dataList)||[]).map(i=>({key:i.schemaId,label:i.name}));b(r)}}catch(u){console.error(u)}},R=(u,r)=>{switch(u){case"removeItem":const i=f.filter(E=>E.key!==r.key);c([...i]),k(i);break}},k=u=>{const r=(u||[]).map(i=>({graph_name:i.label,index_name:i.key}));t&&t("graph_selected",r)},l=()=>{var r;const u=((r=$.current)==null?void 0:r.getSelectedItems())||[];c(u),M(!1),k(u)};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:De}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(oe,{color:"primary",variant:"outlined",size:"small",icon:e(Be,{size:14}),onClick:()=>M(!0),children:"\u6DFB\u52A0"})})]}),(f==null?void 0:f.length)>0&&e(be,{countText:(f==null?void 0:f.length)>0?`\u5DF2\u9009\uFF1A${f==null?void 0:f.length}\u4E2A\u56FE\u8C31`:void 0,eventsEmit:R,data:f}),e(ye,{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:()=>M(!1),children:e(ge,{ref:$,dataSource:g,value:f,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31",renderItem:u=>d("div",{className:"flex ",children:[e("img",{src:De,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:u.label,children:u.label})]}),renderSelectedItem:u=>d("div",{className:"flex items-center",children:[e("img",{src:De,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:u.label})})]})})})]})},_u=({value:s,onChange:n,min:a,max:t,step:h,disabled:g,sliderStyle:b,inputStyle:f,inputWidth:c=90})=>{const B=$=>{const A=Array.isArray($)?$[0]:$;n==null||n(A)},M=$=>{n==null||n($)};return d(tu,{style:{width:"100%"},children:[e(Qe,{min:a,max:t,step:h,disabled:g,value:s,onChange:B,style:{width:"200px",flex:1,...b}}),e(eu,{min:a,max:t,step:h,disabled:g,controls:!1,value:s,onChange:M,style:{width:c,...f}})]})},{Item:wu}=pe,de=({label:s,name:n,configScale:a})=>{const t=me(()=>a[n],[a]);console.log("=====namew",n,t);const h=(g,b)=>({validator(f,c){return c==null?Promise.reject("\u8BF7\u8F93\u5165\u6709\u6548\u6570\u5B57"):typeof+c!="number"||isNaN(+c)?Promise.reject("\u53EA\u80FD\u8F93\u5165\u6570\u5B57"):c<g||c>b?Promise.reject(`\u8BF7\u8F93\u5165${g}\u5230${b}\u4E4B\u95F4\u7684\u6570\u5B57`):Promise.resolve()}});return e(ee,{span:12,children:e(wu,{label:s,name:n,tooltip:t.tooltip,rules:[{required:!0,message:""},h(t.min,t.max)],children:e(_u,{min:t.min,max:t.max,step:t.step})})})},{Item:P}=pe,zu=({url:s,token:n,role:a,id:t,showDatabase:h,showGraph:g,isShare:b,disabled:f,eventsEmit:c,showGraphEnhanced:B,CustomComponents:M})=>{const{ContentLoading:$}=M,[A]=pe.useForm(),[F,R]=v(),[k,l]=v(),[u,r]=v(),[i,E]=v(),[m,I]=v(),[N,T]=v(!0),[Z,y]=v(!1),[C,z]=v(re),x=le({}),{getConfigById:o,fetchModels:_,fetchConfigItemLimit:w,checkName:H,addConversationAssistant:V,updateConversationAssistant:ue}=fe({url:s,token:n,role:a,eventsEmit:c});W(()=>{He()},[t]),W(()=>{t?(Array.isArray(k)&&Array.isArray(u)&&A.validateFields(["model_name","plan_model_name","recommend_model_name","rerank_model_name","multi_model_name","embedding_model_name"]),Array.isArray(i)&&A.validateFields(["multi_model_name"])):(Array.isArray(k)&&(k==null?void 0:k.length)==0&&A.validateFields(["model_name","plan_model_name","recommend_model_name","embedding_model_name"]),Array.isArray(u)&&(u==null?void 0:u.length)==0&&A.validateFields(["rerank_model_name"]),Array.isArray(i)&&(i==null?void 0:i.length)==0&&A.validateFields(["multi_model_name"]),Array.isArray(m)&&(m==null?void 0:m.length)==0&&A.validateFields(["embedding_model_name"]))},[u,k,i,m,t]);const He=async()=>{let p;if(t){N||T(!0);try{const D=await o(t);if(D){const{configJson:S,...U}=D,K=S&&JSON.parse(S),{knowledge_base_name:Y,knowledge_base_name_source:X,selectedKnowledgeBase:te,sensitiveWordIds:ne,database_name:se,graph_nb_name:J}=K;p={...U,...K},x.current={knowledge_base_name:Y,knowledge_base_name_source:X,selectedKnowledgeBase:te,sensitiveWordIds:ne,database_name:se,graph_nb_name:J},R(p),A.setFieldsValue(p),T(!1)}}catch{}}else T(!1);await Ve(p)},Ve=async p=>{var D,S,U,K,Y;try{const[X,te,ne,se,J]=await Promise.allSettled([_({pageNum:1,pageSize:9999,status:1,type:1}),_({pageNum:1,pageSize:9999,status:1,type:3}),_({pageNum:1,pageSize:9999,status:1,type:4}),w(),_({pageNum:1,pageSize:9999,status:1,type:2})]);if(X.status==="fulfilled"&&X.value){const L=(((D=X.value)==null?void 0:D.records)||[]).map(Q=>({...Q,label:Q.modelName,value:Q.modelName}));if(L.length>0){const Q=(S=L.find(Ae=>Ae.value==p.model_name))==null?void 0:S.maxTokens;p.max_tokens>Q&&A.setFieldsValue({max_tokens:Q})}l(L)}if(te.status==="fulfilled"&&te.value){const j=(((U=te.value)==null?void 0:U.records)||[]).map(L=>({label:L.modelName||L.name,value:L.modelName||L.name}));r(j),j.length>0&&!(p!=null&&p.rerank_model_name)&&A.setFieldsValue({rerank_model_name:j[0].value})}if(ne.status==="fulfilled"&&ne.value){const j=(((K=ne.value)==null?void 0:K.records)||[]).map(L=>({label:L.modelName||L.name,value:L.modelName||L.name}));E(j),j.length>0&&!(p!=null&&p.multi_model_name)&&A.setFieldsValue({multi_model_name:j[0].value})}if(J.status==="fulfilled"&&J.value){const j=(((Y=J.value)==null?void 0:Y.records)||[]).map(L=>({label:L.modelName||L.name,value:L.modelName||L.name}));I(j),j.length>0&&!(p!=null&&p.embedding_model_name)&&A.setFieldsValue({embedding_model_name:j[0].value})}if(se.status==="fulfilled"&&se.value&&se.value){const j=se.value;Object.keys(re).forEach(L=>{if(j.hasOwnProperty(L)){const{max:Q,min:Ae}=j[L];re[L]={...re[L],min:Ae,max:Q}}}),z(re)}}catch(X){console.error("\u83B7\u53D6\u5217\u8868\u5931\u8D25:",X)}},Ke=async(p,D)=>await H(D,t)?(xe.warning("\u540D\u79F0\u91CD\u590D\uFF01",2),Promise.reject("\u540D\u79F0\u91CD\u590D")):Promise.resolve(),ie=(p,D)=>({validator(S,U){return U?Array.isArray(p)&&p.length===0||!p.find(K=>K.value==U)?Promise.reject("\u6A21\u578B\u65E0\u6CD5\u4F7F\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.resolve():Array.isArray(p)&&p.length===0?Promise.reject("\u6682\u65E0\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.reject(D)}}),Fe=(p,D)=>{switch(p){case"knowledge_selected":x.current={...x.current,...D};break;case"sensitive_selected":x.current={...x.current,sensitiveWordIds:D};break;case"database_selected":x.current={...x.current,database_name:D};break;case"graph_selected":x.current={...x.current,graph_nb_name:D};break}},We=async()=>{var D;let p={};try{y(!0);const S=await A.validateFields(),{knowledge_base_name:U,knowledge_base_name_source:K,selectedKnowledgeBase:Y,sensitiveWordIds:X,database_name:te,graph_nb_name:ne}=x.current;S.thinking=((D=k.find(J=>J.modelName==S.model_name))==null?void 0:D.thinking)||!1,g&&(S.enabled_nb_graph=!0),p={configJson:JSON.stringify({...S,knowledge_base_name:U,knowledge_base_name_source:K,selectedKnowledgeBase:Y,sensitiveWordIds:X,...h?{database_name:te}:{},...g?{graph_nb_name:ne}:{}}),name:S.config_name,isDefault:S.isDefault,defaultAnswer:S.defaultAnswer,dependOnKb:S.dependOnKb,sensitiveWordIds:X},t?await ue(t,p)&&(xe.success("\u66F4\u65B0\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back")):await V(p)&&(xe.success("\u65B0\u589E\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back"))}catch(S){console.error("submit error",S)}finally{y(!1)}},Ze=me(()=>{const p={};return Object.keys(re).forEach(D=>{var S;p[D]=(S=re[D])==null?void 0:S.default}),{...iu,...p}},[]);return d("div",{style:{height:"100%",width:"100%"},children:[d("div",{className:"flex items-center justify-between",style:{width:"100%",padding:"4px 10px 16px 10px"},children:[d("div",{className:"flex items-center",children:[e(nu,{color:"#2468F2",onClick:()=>c&&c("go_back")}),e("div",{className:"text-[16px] text-[#1D2129] bold",style:{marginLeft:20},children:t?"\u7F16\u8F91\u4F1A\u8BDD\u52A9\u624B":"\u65B0\u5EFA\u4F1A\u8BDD\u52A9\u624B"})]}),!N&&e(oe,{type:"primary",onClick:()=>We(),loading:Z,disabled:f,children:"\u786E\u5B9A"})]}),N?$&&e($,{}):e(pe,{style:{padding:20,height:"calc(100vh - 150px)",backgroundColor:"#fff"},form:A,layout:"vertical",initialValues:Ze,disabled:f,colon:!1,children:d(ae,{gutter:24,style:{height:"100%"},children:[d(ee,{span:12,style:{borderRight:"1px solid #E5E6EB",padding:"10px 32px",height:"100%",overflowY:"auto"},children:[e(P,{label:"\u52A9\u624B\u540D\u79F0",name:"config_name",validateTrigger:"onBlur",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u52A9\u624B\u540D\u79F0"},{validator:Ke}],children:e(Ee,{placeholder:"\u8BF7\u8F93\u5165"})}),d(ae,{gutter:16,children:[e(ee,{span:12,children:e(P,{label:"\u95EE\u7B54\u6A21\u578B",name:"model_name",rules:[{required:!0,message:""},ie(k,"\u8BF7\u9009\u62E9\u95EE\u7B54\u6A21\u578B")],children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:k,notFoundContent:e(ce,{})})})}),e(ee,{span:12,children:e(P,{label:"\u89C4\u5212\u6A21\u578B",name:"plan_model_name",rules:[{required:!0,message:""},ie(k,"\u8BF7\u9009\u62E9\u89C4\u5212\u6A21\u578B")],children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:k,notFoundContent:e(ce,{})})})})]}),d(ae,{gutter:16,children:[e(ee,{span:12,children:e(P,{label:"\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B",name:"multi_model_name",rules:[{required:!0,message:""},ie(i,"\u8BF7\u9009\u62E9\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B")],children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:i,notFoundContent:e(ce,{})})})}),e(ee,{span:12,children:e(P,{label:"Rerank\u6A21\u578B",name:"rerank_model_name",rules:[{required:!0,message:""},ie(u,"\u8BF7\u9009\u62E9Rerank\u6A21\u578B")],children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:u,notFoundContent:e(ce,{})})})})]}),e(ae,{gutter:16,children:e(ee,{span:24,children:e(P,{label:"\u5411\u91CF\u89E3\u6790\u6A21\u578B",name:"embedding_model_name",rules:[{required:!0,message:""},ie(m,"\u8BF7\u9009\u62E9\u5411\u91CF\u89E3\u6790\u6A21\u578B")],children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:m,notFoundContent:e(ce,{})})})})}),e(P,{label:"\u5F00\u573A\u767D",name:"prologue",children:e(Ee.TextArea,{maxLength:50,showCount:!0,placeholder:"\u8BF7\u8F93\u5165\u5F00\u573A\u767D",autoSize:{minRows:2}})}),e(P,{label:"\u63D0\u793A\u8BCD",name:"system_prompt",tooltip:au,children:e(Ee.TextArea,{showCount:!0,rows:8,maxLength:3e3,autoSize:{minRows:10},placeholder:`\u4F8B\u5982\uFF1A${lu}`})}),e(P,{name:"isDefault",valuePropName:"checked",normalize:p=>p===!0?1:0,children:e(Se,{children:"\u9009\u62E9\u4E3A\u9ED8\u8BA4\u52A9\u624B"})})]}),d(ee,{span:12,style:{height:"100%",padding:"10px 32px",overflowY:"auto"},children:[d(_e,{title:"\u68C0\u7D22\u4E0E\u751F\u6210\u53C2\u6570",children:[e(P,{label:"\u95EE\u9898\u63A8\u8350\u6A21\u578B",name:"recommend_model_name",rules:[{required:!0,message:""},ie(k,"\u8BF7\u9009\u62E9\u95EE\u9898\u63A8\u8350\u6A21\u578B")],children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:k,notFoundContent:e(ce,{})})}),e(P,{label:"\u68C0\u7D22\u7B56\u7565",name:"search_policy",children:e(G,{options:cu,placeholder:"\u8BF7\u9009\u62E9"})}),d(ae,{gutter:16,children:[e(de,{label:"\u6E29\u5EA6",name:"temperature",configScale:C}),e(de,{label:"\u591A\u6837\u6027",name:"top_p",configScale:C})]}),d(ae,{gutter:16,children:[e(de,{label:"\u53EC\u56DE\u6570",name:"top_k",configScale:C}),e(de,{label:"\u76F8\u4F3C\u5EA6\u9608\u503C",name:"score_threshold",configScale:C})]}),d(ae,{gutter:16,children:[e(P,{noStyle:!0,shouldUpdate:(p,D)=>p.model_name!==D.model_name,children:({getFieldValue:p})=>{var K;const D=p("model_name"),S=(K=(k||[]).find(Y=>Y.value==D))==null?void 0:K.maxTokens;return p("max_tokens")>S&&A.setFieldValue("max_tokens",S),e(de,{label:"\u6700\u5927\u4EE4\u724C\u6570",name:"max_tokens",configScale:{...C,max_tokens:{...C.max_tokens,max:S||1e4}}})}}),e(de,{label:"\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570",name:"max_round",configScale:C})]})]}),d(_e,{title:"\u529F\u80FD\u5F00\u5173",children:[e(P,{label:"\u5F00\u542FFAQ\u4F18\u5148",name:"enabled_faq",valuePropName:"checked",layout:"horizontal",children:e(he,{})}),B&&e(P,{label:"\u542F\u7528\u56FE\u8C31\u589E\u5F3A",name:"enabled_graph",valuePropName:"checked",layout:"horizontal",children:e(he,{})}),e(P,{label:"\u5F00\u542F\u5F3A\u4F01\u4E1A\u77E5\u8BC6\u4F9D\u8D56",name:"dependOnKb",valuePropName:"checked",layout:"horizontal",tooltip:ru,normalize:p=>p===!0?1:0,children:e(he,{})}),e(P,{label:"\u5F00\u542F\u95EE\u9898\u6539\u5199",name:"enabled_question_rewrite",valuePropName:"checked",layout:"horizontal",children:e(he,{})}),e(P,{label:"\u5F00\u542F\u6EAF\u6E90",name:"need_trace_source",valuePropName:"checked",layout:"horizontal",children:e(he,{})}),e(P,{noStyle:!0,shouldUpdate:(p,D)=>p.need_trace_source!==D.need_trace_source,children:({getFieldValue:p})=>p("need_trace_source")?d(je,{children:[e(P,{label:"\u6EAF\u6E90\u7B56\u7565",name:"trace_by_llm",layout:"horizontal",children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:du})}),e(P,{name:"is_download",valuePropName:"checked",layout:"horizontal",children:e(Se,{children:"\u5141\u8BB8\u4E0B\u8F7D\u6EAF\u6E90\u6587\u4EF6"})})]}):null})]}),d(_e,{title:"\u8D44\u6E90\u7ED1\u5B9A",children:[e(Bu,{url:s,token:n,role:a,sectionData:F==null?void 0:F.sensitiveWordIds,eventsEmit:Fe,defaultAnswer:F==null?void 0:F.defaultAnswer,form:A}),e(bu,{url:s,token:n,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:Fe}),h&&e(Au,{url:s,token:n,role:a,disabled:f,sectionData:F==null?void 0:F.database_name,eventsEmit:Fe}),g&&e(xu,{url:s,token:n,role:a,sectionData:F==null?void 0:F.graph_nb_name,eventsEmit:Fe})]})]})]})})]})};export{zu as C,su as S};
157
+ `;const ge=Xe(({dataSource:n,value:s=[],onConfirm:r,maxCount:t=0,searchPlaceholder:h="\u641C\u7D22...",title:g="",showSearch:b=!0,filterOption:f,renderItem:c,renderSelectedItem:B,className:M,style:$,styles:A,height:F,width:R},k)=>{const a=Ye(),u=Ie(Ie({theme:O,mode:"light"},a),A),[l,i]=v(s),[E,p]=v("");W(()=>{i(s)},[s]),me(()=>new Set(s.map(o=>o.key)),[s]);const I=me(()=>new Set(l.map(o=>o.key)),[l]);Je(k,()=>({getSelectedItems:()=>l,confirm:()=>{r==null||r(l)}}),[l,r]);const T=f||((o,_)=>{var H;if(!o)return!0;const w=o.toLowerCase();return _.label.toLowerCase().includes(w)||((H=_.tags)==null?void 0:H.some(V=>V.toLowerCase().includes(w)))||!1}),Z=me(()=>(n||[]).filter(o=>T(E,o)),[n,E,T]),y=o=>{const _=I.has(o.key);let w;if(_)w=(l||[]).filter(H=>H.key!==o.key);else{if(t>0&&l.length>=t)return;w=[...l,o]}i(w)},C=(o,_)=>{i(w=>w.map(V=>V.key==o?{...V,tags:_}:V))},z=o=>{const _=(l||[]).filter(w=>w.key!==o.key);i(_)},x=o=>I.has(o);return t>0&&l.length>=t,d(mu,{$theme:u.theme||O,$width:R,$height:F,className:M,style:$,children:[d(Le,{$theme:u.theme||O,style:{flex:1},children:[b&&e(gu,{$theme:u.theme||O,children:d("div",{style:{position:"relative"},children:[e(Eu,{children:e(su,{size:16})}),e(Fu,{$theme:u.theme||O,type:"text",placeholder:h,value:E,onChange:o=>p(o.target.value)})]})}),e(ze,{children:Z.length===0?e(Oe,{$theme:u.theme||O,children:E?"\u672A\u627E\u5230\u5339\u914D\u9879":"\u6682\u65E0\u6570\u636E"}):Z.map(o=>{const _=x(o.key);return d(Pe,{$theme:u.theme||O,$selected:_,children:[e(Me,{$theme:u.theme||O,children:c?c(o):o.label}),_&&e(Te,{$theme:u.theme||O,onClick:w=>{w.stopPropagation(),z(o)},disabled:!0,children:"\u5DF2\u6DFB\u52A0"}),!_&&e(Te,{$theme:u.theme||O,onClick:w=>{w.stopPropagation(),y(o)},children:"\u6DFB\u52A0"})]},o.key)})})]}),d(Le,{$theme:u.theme||O,style:{flex:1},children:[d(pu,{$theme:u.theme||O,children:[t>0?`\u5DF2\u9009\uFF1A${l.length}/${t}\u4E2A${g}`:`\u5DF2\u9009\uFF1A${l.length}\u4E2A${g}`,e(fu,{$theme:u.theme||O,onClick:o=>{o.stopPropagation(),i([])},children:"\u6E05\u7A7A"})]}),e(ze,{children:l.length===0?e(Oe,{$theme:u.theme||O,children:"\u6682\u65E0\u5DF2\u9009\u9879"}):l.map(o=>{var w,H,V;const _=ue=>C(o.key,ue);return d(Pe,{$theme:u.theme||O,children:[e(Me,{$theme:u.theme||O,children:B?B(o,_):o.label}),e(qe,{size:14,color:((V=(H=(w=u.theme)==null?void 0:w.colors)==null?void 0:H.text)==null?void 0:V.secondary)||"#86909C",style:{cursor:"pointer"},onClick:ue=>{ue.stopPropagation(),z(o)}})]},o.key)})})]})]})});ge.displayName="SearchableSelector";const we="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:Cu}=pe,Bu=({url:n,token:s,role:r,eventsEmit:t,sectionData:h,defaultAnswer:g,form:b})=>{const[f,c]=v([]),[B,M]=v([]),[$,A]=v(!1),[F,R]=v(!1),k=ae(null),{fetchSensitiveLibrary:a}=fe({url:n,token:s,role:r,eventsEmit:t});W(()=>{u()},[]),W(()=>{if(h&&(f==null?void 0:f.length)>0){let p=h?Array.isArray(h)?h:h.split(","):[],I=[];p.forEach(N=>{const T=(f||[]).find(Z=>Z.key===N);T&&I.push({key:T.key,label:T.label})}),M(I)}},[h,f]),W(()=>{g&&R(!0)},[g]);const u=async()=>{try{const p=await a({pageNo:1,pageSize:9999});if(p!=null&&p.records){const I=((p==null?void 0:p.records)||[]).map(N=>({key:N.id+"",label:N.name}));c(I)}}catch(p){console.error(p)}},l=(p,I)=>{switch(p){case"removeItem":const N=B.filter(T=>T.key!==I.key);M([...N]),i(N);break}},i=p=>{const I=p.map(N=>(N==null?void 0:N.key)||"").filter(N=>N).join(",");t&&t("sensitive_selected",I)},E=()=>{var I;const p=((I=k.current)==null?void 0:I.getSelectedItems())||[];M(p),A(!1),i(p)};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:we}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u654F\u611F\u8BCD"})]}),e(oe,{color:"primary",variant:"outlined",size:"small",icon:e(Be,{size:14}),onClick:()=>A(!0),children:"\u6DFB\u52A0"})]}),e(Se,{checked:F,onChange:p=>{R(p.target.checked),p.target.checked?b.setFieldsValue({defaultAnswer:ou}):b.setFieldsValue({defaultAnswer:""})},style:{marginBottom:8,marginTop:8},children:"\u81EA\u5B9A\u4E49\u56DE\u590D"}),F&&e(Cu,{label:"\u81EA\u5B9A\u4E49\u56DE\u590D\u5185\u5BB9",name:"defaultAnswer",layout:"vertical",children:e(Ee.TextArea,{style:{height:"55px",resize:"none"}})}),(B==null?void 0:B.length)>0&&e(be,{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:l,data:B}),e(ye,{width:740,title:"\u9009\u62E9\u654F\u611F\u8BCD",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:$,onOk:E,onCancel:()=>A(!1),destroyOnHidden:!0,className:"assistant-config-resource-bind-modal",children:e(ge,{ref:k,dataSource:f,value:B,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u654F\u611F\u8BCD\u5E93",renderItem:p=>d("div",{className:"flex ",children:[e("img",{src:we,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:p.label,children:p.label})]}),renderSelectedItem:(p,I)=>d("div",{className:"flex items-center",children:[e("img",{src:we,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:p.label})})]})})})]})},ve="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",yu=({url:n,token:s,role:r,sectionData:t,createBy:h,eventsEmit:g})=>{const[b,f]=v(),[c,B]=v([]),[M,$]=v(!1),A=ae(null),[F,R]=v(!1),[k,a]=v([]),u=ae(new Map).current,{fetchKnowledgeBase:l,getBizLabelLabels:i}=fe({url:n,token:s,role:r,eventsEmit:g}),E=ae(!1);W(()=>{E.current||(h?(p(h),E.current=!0):(p(),E.current=!0))},[h]),W(()=>{if(t&&(b==null?void 0:b.length)>0){const y=t==null?void 0:t.knowledge_base_name_source,C=y&&(Array.isArray(y)?y:y.split(";"));let z=[];(C||[]).forEach(x=>{const o=((t==null?void 0:t.selectedKnowledgeBase)||[]).find(w=>w.name==x),_=(b||[]).find(w=>w.knowledge_base_name_source===x);if(_){const{key:w,label:H,knowledge_base_name:V,knowledge_base_name_source:ue}=_;z.push({key:w,label:H,knowledge_base_name:V,knowledge_base_name_source:ue,tags:o==null?void 0:o.labels})}}),B(z)}},[t,b]);const p=async y=>{try{const C=await l(y);if(C){const z=(C||[]).map(x=>({key:x.id,label:x.kbName,knowledge_base_name:x.primitiveName,knowledge_base_name_source:x.kbName}));f(z)}}catch(C){console.error(C)}},I=(y,C)=>{switch(y){case"removeItem":const z=c.filter(o=>o.key!==C.key);B([...z]),N(z);break;case"removeTag":const x=c.findIndex(o=>o.key==C.key);x!==-1&&(c[x]=C),B([...c]),N(c);break}},N=y=>{const C=(y||[]).map(o=>(o==null?void 0:o.knowledge_base_name)||"").filter(o=>o).join(";"),z=(y||[]).map(o=>(o==null?void 0:o.knowledge_base_name_source)||"").filter(o=>o).join(";"),x=(y||[]).filter(o=>{var _;return Array.isArray(o==null?void 0:o.tags)&&((_=o.tags)==null?void 0:_.length)>0}).map(o=>({id:o.key,name:o.label,knowledge_base_name_source:o.knowledge_base_name,labels:o.tags}));g&&g("knowledge_selected",{knowledge_base_name:C,knowledge_base_name_source:z,selectedKnowledgeBase:x})},T=()=>{var C;const y=((C=A.current)==null?void 0:C.getSelectedItems())||[];B(y),$(!1),N(y)},Z=async(y,C)=>{if(y){const z=u.get(C);if(z){a(z);return}if(!F)try{R(!0);const x=await i({kbNames:[C]});if(Array.isArray(x)){const o=x.length?x[0].label:"",_=o?(o||"").split(",").map(w=>({label:w,value:w})):[];u.set(C,_),a(_)}R(!1)}catch(x){console.error("Error fetching data:",x),R(!1)}}};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:ve}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u77E5\u8BC6\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(oe,{color:"primary",variant:"outlined",size:"small",icon:e(Be,{size:14}),onClick:()=>$(!0),children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(be,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u77E5\u8BC6\u5E93`:void 0,eventsEmit:I,data:c}),e(ye,{width:740,className:"assistant-config-resource-bind-modal",title:"\u9009\u62E9\u77E5\u8BC6\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:M,onOk:T,onCancel:()=>$(!1),destroyOnHidden:!0,children:e(ge,{ref:A,dataSource:b,value:c,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u77E5\u8BC6\u5E93",renderItem:y=>d("div",{className:"flex ",children:[e("img",{src:ve,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:y.label,children:y.label})]}),renderSelectedItem:(y,C)=>d("div",{className:"flex ",children:[e("img",{src:ve,alt:"add"}),d("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:y.label}),e(G,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:y.tags||[],onChange:z=>{C(z)},style:{width:250},options:k,loading:F,onOpenChange:z=>{Z(z,y.knowledge_base_name)}})]})]})})})]})},bu=Ue.memo(yu),ke="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",Re=10,Au=({url:n,token:s,role:r,eventsEmit:t,sectionData:h,disabled:g})=>{const[b,f]=v([]),[c,B]=v([]),[M,$]=v(!1),A=ae(null),{fetchDatabases:F}=fe({url:n,token:s,role:r,eventsEmit:t});W(()=>{R()},[]),W(()=>{if(h){let u=[];(h||[]).map(l=>{const i=(b||[]).find(E=>E.key===l.key);if(i){const{key:E,label:p}=i;u.push({key:E,label:p})}}),B(u)}},[h,b]);const R=async()=>{try{const u=await F();if(u){const l=(u||[]).map(i=>({key:i.primitiveName,label:i.name}));f(l)}}catch(u){console.error(u)}},k=(u,l)=>{switch(u){case"removeItem":const i=c.filter(E=>E.key!==l.key);B([...i]),t&&t("database_selected",i);break}},a=()=>{var l;const u=((l=A.current)==null?void 0:l.getSelectedItems())||[];B(u),$(!1),t&&t("database_selected",u)};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:ke}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u6570\u636E\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(oe,{color:"primary",variant:"outlined",size:"small",icon:e(Be,{size:14}),onClick:()=>$(!0),disabled:c.length>=Re||g,children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(be,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u6570\u636E\u5E93`:void 0,eventsEmit:k,data:c}),e(ye,{width:740,title:"\u9009\u62E9\u6570\u636E\u5E93",className:"assistant-config-resource-bind-modal",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:M,onOk:a,onCancel:()=>$(!1),destroyOnHidden:!0,children:e(ge,{ref:A,dataSource:b,value:c,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u6570\u636E\u5E93",maxCount:Re,renderItem:u=>d("div",{className:"flex ",children:[e("img",{src:ke,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:u.label,children:u.label})]}),renderSelectedItem:(u,l)=>d("div",{className:"flex items-center",children:[e("img",{src:ke,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:u.label})})]})})})]})},De="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",xu=({url:n,token:s,role:r,eventsEmit:t,sectionData:h})=>{const[g,b]=v([]),[f,c]=v([]),[B,M]=v(!1),$=ae(null),{fetchGraphs:A}=fe({url:n,token:s,role:r,eventsEmit:t});W(()=>{F()},[]),W(()=>{if(h){let u=[];(h||[]).map(l=>{const i=(g||[]).find(E=>E.key===l.index_name);if(i){const{key:E,label:p}=i;u.push({key:E,label:p})}}),c(u)}},[h,g]);const F=async()=>{try{const u=await A();if(u!=null&&u.dataList){const l=((u==null?void 0:u.dataList)||[]).map(i=>({key:i.schemaId,label:i.name}));b(l)}}catch(u){console.error(u)}},R=(u,l)=>{switch(u){case"removeItem":const i=f.filter(E=>E.key!==l.key);c([...i]),k(i);break}},k=u=>{const l=(u||[]).map(i=>({graph_name:i.label,index_name:i.key}));t&&t("graph_selected",l)},a=()=>{var l;const u=((l=$.current)==null?void 0:l.getSelectedItems())||[];c(u),M(!1),k(u)};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:De}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(oe,{color:"primary",variant:"outlined",size:"small",icon:e(Be,{size:14}),onClick:()=>M(!0),children:"\u6DFB\u52A0"})})]}),(f==null?void 0:f.length)>0&&e(be,{countText:(f==null?void 0:f.length)>0?`\u5DF2\u9009\uFF1A${f==null?void 0:f.length}\u4E2A\u56FE\u8C31`:void 0,eventsEmit:R,data:f}),e(ye,{width:740,title:"\u9009\u62E9\u56FE\u8C31",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",className:"assistant-config-resource-bind-modal",open:B,onOk:a,destroyOnHidden:!0,onCancel:()=>M(!1),children:e(ge,{ref:$,dataSource:g,value:f,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31",renderItem:u=>d("div",{className:"flex ",children:[e("img",{src:De,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:u.label,children:u.label})]}),renderSelectedItem:u=>d("div",{className:"flex items-center",children:[e("img",{src:De,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:u.label})})]})})})]})},_u=({value:n,onChange:s,min:r,max:t,step:h,disabled:g,sliderStyle:b,inputStyle:f,inputWidth:c=90})=>{const B=$=>{const A=Array.isArray($)?$[0]:$;s==null||s(A)},M=$=>{s==null||s($)};return d(tu,{style:{width:"100%"},children:[e(Qe,{min:r,max:t,step:h,disabled:g,value:n,onChange:B,style:{width:"200px",flex:1,...b}}),e(eu,{min:r,max:t,step:h,disabled:g,controls:!1,value:n,onChange:M,style:{width:c,...f}})]})},{Item:wu}=pe,de=({label:n,name:s,configScale:r})=>{const t=me(()=>r[s],[r]),h=(g,b)=>({validator(f,c){return c==null?Promise.reject("\u8BF7\u8F93\u5165\u6709\u6548\u6570\u5B57"):typeof+c!="number"||isNaN(+c)?Promise.reject("\u53EA\u80FD\u8F93\u5165\u6570\u5B57"):c<g||c>b?Promise.reject(`\u8BF7\u8F93\u5165${g}\u5230${b}\u4E4B\u95F4\u7684\u6570\u5B57`):Promise.resolve()}});return e(ee,{span:12,children:e(wu,{label:n,name:s,tooltip:t.tooltip,rules:[{required:!0,message:""},h(t.min,t.max)],children:e(_u,{min:t.min,max:t.max,step:t.step})})})},{Item:P}=pe,zu=({url:n,token:s,role:r,id:t,showDatabase:h,showGraph:g,isShare:b,disabled:f,eventsEmit:c,showGraphEnhanced:B,CustomComponents:M})=>{const{ContentLoading:$}=M,[A]=pe.useForm(),[F,R]=v(),[k,a]=v(),[u,l]=v(),[i,E]=v(),[p,I]=v(),[N,T]=v(!0),[Z,y]=v(!1),[C,z]=v(le),x=ae({}),{getConfigById:o,fetchModels:_,fetchConfigItemLimit:w,checkName:H,addConversationAssistant:V,updateConversationAssistant:ue}=fe({url:n,token:s,role:r,eventsEmit:c});W(()=>{He()},[t]),W(()=>{t?(Array.isArray(k)&&Array.isArray(u)&&A.validateFields(["model_name","plan_model_name","recommend_model_name","rerank_model_name","multi_model_name","embedding_model_name"]),Array.isArray(i)&&A.validateFields(["multi_model_name"])):(Array.isArray(k)&&(k==null?void 0:k.length)==0&&A.validateFields(["model_name","plan_model_name","recommend_model_name","embedding_model_name"]),Array.isArray(u)&&(u==null?void 0:u.length)==0&&A.validateFields(["rerank_model_name"]),Array.isArray(i)&&(i==null?void 0:i.length)==0&&A.validateFields(["multi_model_name"]),Array.isArray(p)&&(p==null?void 0:p.length)==0&&A.validateFields(["embedding_model_name"]))},[u,k,i,p,t]);const He=async()=>{let m;if(t){N||T(!0);try{const D=await o(t);if(D){const{configJson:S,...U}=D,K=S&&JSON.parse(S),{knowledge_base_name:Y,knowledge_base_name_source:X,selectedKnowledgeBase:te,sensitiveWordIds:ne,database_name:se,graph_nb_name:J}=K;m={...U,...K},x.current={knowledge_base_name:Y,knowledge_base_name_source:X,selectedKnowledgeBase:te,sensitiveWordIds:ne,database_name:se,graph_nb_name:J},R(m),A.setFieldsValue(m),T(!1)}}catch{}}else T(!1);await Ve(m)},Ve=async m=>{var D,S,U,K,Y;try{const[X,te,ne,se,J]=await Promise.allSettled([_({pageNum:1,pageSize:9999,status:1,type:1}),_({pageNum:1,pageSize:9999,status:1,type:3}),_({pageNum:1,pageSize:9999,status:1,type:4}),w(),_({pageNum:1,pageSize:9999,status:1,type:2})]);if(X.status==="fulfilled"&&X.value){const L=(((D=X.value)==null?void 0:D.records)||[]).map(Q=>({...Q,label:Q.modelName,value:Q.modelName}));if(L.length>0){const Q=(S=L.find(Ae=>Ae.value==(m==null?void 0:m.model_name)))==null?void 0:S.maxTokens;(m==null?void 0:m.max_tokens)>Q&&A.setFieldsValue({max_tokens:Q})}a(L)}if(te.status==="fulfilled"&&te.value){const j=(((U=te.value)==null?void 0:U.records)||[]).map(L=>({label:L.modelName||L.name,value:L.modelName||L.name}));l(j),j.length>0&&!(m!=null&&m.rerank_model_name)&&A.setFieldsValue({rerank_model_name:j[0].value})}if(ne.status==="fulfilled"&&ne.value){const j=(((K=ne.value)==null?void 0:K.records)||[]).map(L=>({label:L.modelName||L.name,value:L.modelName||L.name}));E(j),j.length>0&&!(m!=null&&m.multi_model_name)&&A.setFieldsValue({multi_model_name:j[0].value})}if(J.status==="fulfilled"&&J.value){const j=(((Y=J.value)==null?void 0:Y.records)||[]).map(L=>({label:L.modelName||L.name,value:L.modelName||L.name}));I(j),j.length>0&&!(m!=null&&m.embedding_model_name)&&A.setFieldsValue({embedding_model_name:j[0].value})}if(se.status==="fulfilled"&&se.value&&se.value){const j=se.value;Object.keys(le).forEach(L=>{if(j.hasOwnProperty(L)){const{max:Q,min:Ae}=j[L];le[L]={...le[L],min:Ae,max:Q}}}),z(le)}}catch(X){console.error("\u83B7\u53D6\u5217\u8868\u5931\u8D25:",X)}},Ke=async(m,D)=>await H(D,t)?(xe.warning("\u540D\u79F0\u91CD\u590D\uFF01",2),Promise.reject("\u540D\u79F0\u91CD\u590D")):Promise.resolve(),ie=(m,D)=>({validator(S,U){return U?Array.isArray(m)&&m.length===0||!m.find(K=>K.value==U)?Promise.reject("\u6A21\u578B\u65E0\u6CD5\u4F7F\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.resolve():Array.isArray(m)&&m.length===0?Promise.reject("\u6682\u65E0\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.reject(D)}}),Fe=(m,D)=>{switch(m){case"knowledge_selected":x.current={...x.current,...D};break;case"sensitive_selected":x.current={...x.current,sensitiveWordIds:D};break;case"database_selected":x.current={...x.current,database_name:D};break;case"graph_selected":x.current={...x.current,graph_nb_name:D};break}},We=async()=>{var D;let m={};try{y(!0);const S=await A.validateFields(),{knowledge_base_name:U,knowledge_base_name_source:K,selectedKnowledgeBase:Y,sensitiveWordIds:X,database_name:te,graph_nb_name:ne}=x.current;S.thinking=((D=k.find(J=>J.modelName==S.model_name))==null?void 0:D.thinking)||!1,g&&(S.enabled_nb_graph=!0),m={configJson:JSON.stringify({...S,knowledge_base_name:U,knowledge_base_name_source:K,selectedKnowledgeBase:Y,sensitiveWordIds:X,...h?{database_name:te}:{},...g?{graph_nb_name:ne}:{}}),name:S.config_name,isDefault:S.isDefault,defaultAnswer:S.defaultAnswer,dependOnKb:S.dependOnKb,sensitiveWordIds:X},t?await ue(t,m)&&(xe.success("\u66F4\u65B0\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back")):await V(m)&&(xe.success("\u65B0\u589E\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back"))}catch(S){console.error("submit error",S)}finally{y(!1)}},Ze=me(()=>{const m={};return Object.keys(le).forEach(D=>{var S;m[D]=(S=le[D])==null?void 0:S.default}),{...iu,...m}},[]);return d("div",{style:{height:"100%",width:"100%"},children:[d("div",{className:"flex items-center justify-between",style:{width:"100%",padding:"4px 10px 16px 10px"},children:[d("div",{className:"flex items-center",children:[e(nu,{color:"#2468F2",onClick:()=>c&&c("go_back")}),e("div",{className:"text-[16px] text-[#1D2129] bold",style:{marginLeft:20},children:t?"\u7F16\u8F91\u4F1A\u8BDD\u52A9\u624B":"\u65B0\u5EFA\u4F1A\u8BDD\u52A9\u624B"})]}),!N&&e(oe,{type:"primary",onClick:()=>We(),loading:Z,disabled:f,children:"\u786E\u5B9A"})]}),N?$&&e($,{}):e(pe,{style:{padding:20,height:"calc(100vh - 150px)",backgroundColor:"#fff"},form:A,layout:"vertical",initialValues:Ze,disabled:f,colon:!1,children:d(re,{gutter:24,style:{height:"100%"},children:[d(ee,{span:12,style:{borderRight:"1px solid #E5E6EB",padding:"10px 32px",height:"100%",overflowY:"auto"},children:[e(P,{label:"\u52A9\u624B\u540D\u79F0",name:"config_name",validateTrigger:"onBlur",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u52A9\u624B\u540D\u79F0"},{validator:Ke}],children:e(Ee,{placeholder:"\u8BF7\u8F93\u5165"})}),d(re,{gutter:16,children:[e(ee,{span:12,children:e(P,{label:"\u95EE\u7B54\u6A21\u578B",name:"model_name",rules:[{required:!0,message:""},ie(k,"\u8BF7\u9009\u62E9\u95EE\u7B54\u6A21\u578B")],children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:k,notFoundContent:e(ce,{})})})}),e(ee,{span:12,children:e(P,{label:"\u89C4\u5212\u6A21\u578B",name:"plan_model_name",rules:[{required:!0,message:""},ie(k,"\u8BF7\u9009\u62E9\u89C4\u5212\u6A21\u578B")],children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:k,notFoundContent:e(ce,{})})})})]}),d(re,{gutter:16,children:[e(ee,{span:12,children:e(P,{label:"\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B",name:"multi_model_name",rules:[{required:!0,message:""},ie(i,"\u8BF7\u9009\u62E9\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B")],children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:i,notFoundContent:e(ce,{})})})}),e(ee,{span:12,children:e(P,{label:"Rerank\u6A21\u578B",name:"rerank_model_name",rules:[{required:!0,message:""},ie(u,"\u8BF7\u9009\u62E9Rerank\u6A21\u578B")],children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:u,notFoundContent:e(ce,{})})})})]}),e(re,{gutter:16,children:e(ee,{span:24,children:e(P,{label:"\u5411\u91CF\u89E3\u6790\u6A21\u578B",name:"embedding_model_name",rules:[{required:!0,message:""},ie(p,"\u8BF7\u9009\u62E9\u5411\u91CF\u89E3\u6790\u6A21\u578B")],children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:p,notFoundContent:e(ce,{})})})})}),e(P,{label:"\u5F00\u573A\u767D",name:"prologue",children:e(Ee.TextArea,{maxLength:50,showCount:!0,placeholder:"\u8BF7\u8F93\u5165\u5F00\u573A\u767D",autoSize:{minRows:2}})}),e(P,{label:"\u63D0\u793A\u8BCD",name:"system_prompt",tooltip:ru,children:e(Ee.TextArea,{showCount:!0,rows:8,maxLength:3e3,autoSize:{minRows:10},placeholder:`\u4F8B\u5982\uFF1A${au}`})}),e(P,{name:"isDefault",valuePropName:"checked",normalize:m=>m===!0?1:0,children:e(Se,{children:"\u9009\u62E9\u4E3A\u9ED8\u8BA4\u52A9\u624B"})})]}),d(ee,{span:12,style:{height:"100%",padding:"10px 32px",overflowY:"auto"},children:[d(_e,{title:"\u68C0\u7D22\u4E0E\u751F\u6210\u53C2\u6570",children:[e(P,{label:"\u95EE\u9898\u63A8\u8350\u6A21\u578B",name:"recommend_model_name",rules:[{required:!0,message:""},ie(k,"\u8BF7\u9009\u62E9\u95EE\u9898\u63A8\u8350\u6A21\u578B")],children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:k,notFoundContent:e(ce,{})})}),e(P,{label:"\u68C0\u7D22\u7B56\u7565",name:"search_policy",children:e(G,{options:cu,placeholder:"\u8BF7\u9009\u62E9"})}),d(re,{gutter:16,children:[e(de,{label:"\u6E29\u5EA6",name:"temperature",configScale:C}),e(de,{label:"\u591A\u6837\u6027",name:"top_p",configScale:C})]}),d(re,{gutter:16,children:[e(de,{label:"\u53EC\u56DE\u6570",name:"top_k",configScale:C}),e(de,{label:"\u76F8\u4F3C\u5EA6\u9608\u503C",name:"score_threshold",configScale:C})]}),d(re,{gutter:16,children:[e(P,{noStyle:!0,shouldUpdate:(m,D)=>m.model_name!==D.model_name,children:({getFieldValue:m})=>{var K;const D=m("model_name"),S=(K=(k||[]).find(Y=>Y.value==D))==null?void 0:K.maxTokens;return m("max_tokens")>S&&A.setFieldValue("max_tokens",S),e(de,{label:"\u6700\u5927\u4EE4\u724C\u6570",name:"max_tokens",configScale:{...C,max_tokens:{...C.max_tokens,max:S||1e4}}})}}),e(de,{label:"\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570",name:"max_round",configScale:C})]})]}),d(_e,{title:"\u529F\u80FD\u5F00\u5173",children:[e(P,{label:"\u5F00\u542FFAQ\u4F18\u5148",name:"enabled_faq",valuePropName:"checked",layout:"horizontal",children:e(he,{})}),B&&e(P,{label:"\u542F\u7528\u56FE\u8C31\u589E\u5F3A",name:"enabled_graph",valuePropName:"checked",layout:"horizontal",children:e(he,{})}),e(P,{label:"\u5F00\u542F\u5F3A\u4F01\u4E1A\u77E5\u8BC6\u4F9D\u8D56",name:"dependOnKb",valuePropName:"checked",layout:"horizontal",tooltip:lu,normalize:m=>m===!0?1:0,children:e(he,{})}),e(P,{label:"\u5F00\u542F\u95EE\u9898\u6539\u5199",name:"enabled_question_rewrite",valuePropName:"checked",layout:"horizontal",children:e(he,{})}),e(P,{label:"\u5F00\u542F\u6EAF\u6E90",name:"need_trace_source",valuePropName:"checked",layout:"horizontal",children:e(he,{})}),e(P,{noStyle:!0,shouldUpdate:(m,D)=>m.need_trace_source!==D.need_trace_source,children:({getFieldValue:m})=>m("need_trace_source")?d(je,{children:[e(P,{label:"\u6EAF\u6E90\u7B56\u7565",name:"trace_by_llm",layout:"horizontal",children:e(G,{placeholder:"\u8BF7\u9009\u62E9",options:du})}),e(P,{name:"is_download",valuePropName:"checked",layout:"horizontal",children:e(Se,{children:"\u5141\u8BB8\u4E0B\u8F7D\u6EAF\u6E90\u6587\u4EF6"})})]}):null})]}),d(_e,{title:"\u8D44\u6E90\u7ED1\u5B9A",children:[e(Bu,{url:n,token:s,role:r,sectionData:F==null?void 0:F.sensitiveWordIds,eventsEmit:Fe,defaultAnswer:F==null?void 0:F.defaultAnswer,form:A}),e(bu,{url:n,token:s,role:r,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:Fe}),h&&e(Au,{url:n,token:s,role:r,disabled:f,sectionData:F==null?void 0:F.database_name,eventsEmit:Fe}),g&&e(xu,{url:n,token:s,role:r,sectionData:F==null?void 0:F.graph_nb_name,eventsEmit:Fe})]})]})]})})]})};export{zu as C,su as S};
@@ -1 +1 @@
1
- import"react/jsx-runtime";import"react";import{C as s}from"./assets/index-pbEQPM5Z.js";/* empty css */import"./assets/index-8h59dJlj.js";import"./assets/index-DoUk2Ei_.js";import"./assets/x-CmbLQ9dc.js";import"./assets/plus-CnVxGdOo.js";import"./assets/index-CVis9Agw.js";import"react-dom";export{s as default};
1
+ import"react/jsx-runtime";import"react";import{C as s}from"./assets/index-Cbz7IFQk.js";/* empty css */import"./assets/index-8h59dJlj.js";import"./assets/index-DoUk2Ei_.js";import"./assets/x-CmbLQ9dc.js";import"./assets/plus-CnVxGdOo.js";import"./assets/index-CVis9Agw.js";import"react-dom";export{s as default};
package/chat.js CHANGED
@@ -1,4 +1,4 @@
1
- import{jsx as S,jsxs as J,Fragment as rt}from"react/jsx-runtime";import*as x0 from"react";import Ze,{createElement as tr,PureComponent as _i,useState as se,useMemo as be,createContext as qn,Children as wi,cloneElement as Si,Component as ki,useRef as He,useEffect as Ce,useCallback as ct}from"react";import{c as X0,aR as Ii,O as Ni,aS as Pr,aT as Hn,I as $n,F as yr,a as Je,L as G0,aU as Wn,aK as Yt,b as Lr,aQ as Ri,T as tt,x as Ti,aV as rr}from"./assets/index-8h59dJlj.js";import{f as zi,r as Pi,c as Li,B as Oi,z as Mi,d as jn,g as Vn,a as Kn,b as ur,e as Cr,h as xr,D as Ui,i as qi,T as dr,j as nr,k as Hi,l as $i,G as Wi,m as ji,W as Vi,n as Ki,o as Gi,p as Gn,q as Xi,K as Yi,s as Qi,u as Zi,F as Ji,t as Or,v as ir,Q as ea,J as ta,w as ra,x as na,y as ia,A as aa,E as oa}from"./assets/index-C_tt8KnS.js";import{D as sa,U as ca,F as la,a as Mr}from"./assets/index-C9ax6WsW.js";import{u as F0}from"./assets/index-CpW6Dhpp.js";import{d as ua,g as Ur,c as xa,f as da}from"./assets/index-CtPe9ln8.js";import{P as fa}from"./assets/plus-CnVxGdOo.js";import{S as fr}from"./assets/index-pbEQPM5Z.js";import{X as Xn}from"./assets/x-CmbLQ9dc.js";import{s as Ue,S as lt,M as Yn}from"./assets/index-DoUk2Ei_.js";import{P as pa}from"./assets/index-B-AFa3n1.js";import{C as ha,G as Qn,c as va,r as ga}from"./assets/GientechStreamReader-C8rYtUxB.js";import{B as _c}from"./assets/GientechStreamReader-C8rYtUxB.js";import{P as ma}from"./assets/index-C6WKbL3A.js";/* empty css *//* empty css */import{D as Zn}from"./assets/index-BN3yu4iN.js";import"./database.js";import"./databaseId.js";import"./databaseTable.js";import"./modelManage.js";import"./sensitive.js";import"react-dom";import"./assets/index-CVis9Agw.js";import"./assets/index-BdNcL3V6.js";import"./assets/index-w1SriKuR.js";import"./assets/triangle-alert-BycMPaz2.js";/**
1
+ import{jsx as S,jsxs as J,Fragment as rt}from"react/jsx-runtime";import*as x0 from"react";import Ze,{createElement as tr,PureComponent as _i,useState as se,useMemo as be,createContext as qn,Children as wi,cloneElement as Si,Component as ki,useRef as He,useEffect as Ce,useCallback as ct}from"react";import{c as X0,aR as Ii,O as Ni,aS as Pr,aT as Hn,I as $n,F as yr,a as Je,L as G0,aU as Wn,aK as Yt,b as Lr,aQ as Ri,T as tt,x as Ti,aV as rr}from"./assets/index-8h59dJlj.js";import{f as zi,r as Pi,c as Li,B as Oi,z as Mi,d as jn,g as Vn,a as Kn,b as ur,e as Cr,h as xr,D as Ui,i as qi,T as dr,j as nr,k as Hi,l as $i,G as Wi,m as ji,W as Vi,n as Ki,o as Gi,p as Gn,q as Xi,K as Yi,s as Qi,u as Zi,F as Ji,t as Or,v as ir,Q as ea,J as ta,w as ra,x as na,y as ia,A as aa,E as oa}from"./assets/index-C_tt8KnS.js";import{D as sa,U as ca,F as la,a as Mr}from"./assets/index-C9ax6WsW.js";import{u as F0}from"./assets/index-CpW6Dhpp.js";import{d as ua,g as Ur,c as xa,f as da}from"./assets/index-CtPe9ln8.js";import{P as fa}from"./assets/plus-CnVxGdOo.js";import{S as fr}from"./assets/index-Cbz7IFQk.js";import{X as Xn}from"./assets/x-CmbLQ9dc.js";import{s as Ue,S as lt,M as Yn}from"./assets/index-DoUk2Ei_.js";import{P as pa}from"./assets/index-B-AFa3n1.js";import{C as ha,G as Qn,c as va,r as ga}from"./assets/GientechStreamReader-C8rYtUxB.js";import{B as _c}from"./assets/GientechStreamReader-C8rYtUxB.js";import{P as ma}from"./assets/index-C6WKbL3A.js";/* empty css *//* empty css */import{D as Zn}from"./assets/index-BN3yu4iN.js";import"./database.js";import"./databaseId.js";import"./databaseTable.js";import"./modelManage.js";import"./sensitive.js";import"react-dom";import"./assets/index-CVis9Agw.js";import"./assets/index-BdNcL3V6.js";import"./assets/index-w1SriKuR.js";import"./assets/triangle-alert-BycMPaz2.js";/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
package/databaseId.d.ts CHANGED
@@ -16,6 +16,7 @@ declare interface DatabaseViewAdopterProps {
16
16
  CustomComponents?: CustomComponents;
17
17
  eventsEmit?: (name: string, data: any) => void;
18
18
  getBtnDisabled?: (type: OPT_BTN, permission: number) => boolean;
19
+ ref: any;
19
20
  }
20
21
 
21
22
  declare enum OPT_BTN {
package/databaseId.js CHANGED
@@ -1 +1 @@
1
- import{jsx as t,jsxs as T,Fragment as Ee}from"react/jsx-runtime";import{useMemo as J,useState as C,useRef as Fe,useCallback as Y,useEffect as Be}from"react";import{u as Me}from"./assets/index-CpW6Dhpp.js";import{F as ze,J as H,C as Le,T as _e,U as Ve,N as Ne}from"./assets/index-CtPe9ln8.js";import{a as Re,T as pe,a6 as Ue,F as ge}from"./assets/index-8h59dJlj.js";import{O as Ae}from"./assets/index-w1SriKuR.js";/* empty css *//* empty css */import{N as xe}from"./assets/index-C9ax6WsW.js";import{s as G,M as Ce}from"./assets/index-DoUk2Ei_.js";import{D as we}from"./assets/index-BN3yu4iN.js";import{X as me}from"./assets/x-CmbLQ9dc.js";import{P as Ge,L as He}from"./assets/index-B-AFa3n1.js";import{B as he}from"./assets/index-BdNcL3V6.js";import{T as ve}from"./assets/triangle-alert-BycMPaz2.js";import"react-dom";import"./assets/index-C6WKbL3A.js";import"./assets/index-CVis9Agw.js";const We="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%201C13.4997%201.50025%2013.25%201.99975%2013.25%202.5C13.25%203.00025%2013.4997%203.49975%2014%204C13.4997%203.49975%2013.0003%203.25%2012.5%203.25C11.9997%203.25%2011.5003%203.49975%2011%204C11.5003%203.49975%2011.75%203.00025%2011.75%202.5C11.75%201.99975%2011.5003%201.50025%2011%201C11.5003%201.50025%2011.9997%201.75%2012.5%201.75C13.0003%201.75%2013.4997%201.50025%2014%201Z'%20fill='%23055AFF'/%3e%3cpath%20d='M13%206.28571V13C13%2013.5523%2012.5523%2014%2012%2014H4C3.44772%2014%203%2013.5523%203%2013V3C3%202.44772%203.44772%202%204%202H9.25'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='6.35'%20x2='10.35'%20y2='6.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='9.35'%20x2='8.35'%20y2='9.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3c/svg%3e",$e="data:image/svg+xml,%3csvg%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42%2022C43.1046%2022%2044%2022.8954%2044%2024V42C44%2043.1046%2043.1046%2044%2042%2044H6C4.89543%2044%204%2043.1046%204%2042V24.0088C4%2022.9042%204.89543%2022.0078%206%2022.0078C7.10457%2022.0078%208%2022.9042%208%2024.0088V40H40V24C40%2022.8954%2040.8954%2022%2042%2022ZM24.0293%204.00195C24.0808%204.00272%2024.1322%204.00504%2024.1836%204.00977C24.1904%204.01042%2024.1973%204.011%2024.2041%204.01172C24.2673%204.01819%2024.3301%204.02757%2024.3926%204.04004C24.3939%204.04031%2024.3952%204.04075%2024.3965%204.04102C24.7693%204.11623%2025.125%204.29691%2025.4141%204.58594L34.4141%2013.5859C35.1951%2014.367%2035.1951%2015.633%2034.4141%2016.4141C33.633%2017.1951%2032.367%2017.1951%2031.5859%2016.4141L25.9922%2010.8203V32C25.9922%2033.1046%2025.0968%2034%2023.9922%2034C22.8876%2034%2021.9922%2033.1046%2021.9922%2032V10.8359L16.4141%2016.4141C15.633%2017.1951%2014.367%2017.1951%2013.5859%2016.4141C12.8049%2015.633%2012.8049%2014.367%2013.5859%2013.5859L22.498%204.67285C22.8016%204.33138%2023.2194%204.09559%2023.6924%204.02441C23.7122%204.02135%2023.732%204.01809%2023.752%204.01562C23.7862%204.01152%2023.8207%204.00919%2023.8555%204.00684C23.8887%204.00446%2023.9218%204.00268%2023.9551%204.00195C23.9674%204.00173%2023.9798%204%2023.9922%204C24.0046%204%2024.0169%204.00173%2024.0293%204.00195Z'%20fill='url(%23paint0_linear_4072_34663)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_4072_34663'%20x1='4'%20y1='-7.25'%20x2='54.4707'%20y2='1.556'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%232B69FF'/%3e%3cstop%20offset='1'%20stop-color='%238F91FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",ke=({url:a,token:w,role:F,eventsEmit:p})=>{const d=Re.create({baseURL:a,timeout:1e6});return d.interceptors.request.use(u=>{let s=w;return!s&&!["user/login","user/kaptcha","user/regist"].some(i=>u.url.includes(i))?(p&&p("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(u.headers.Authorization=s||"",u.headers.userName=F==="\u672A\u767B\u5F55\u7528\u6237"?"":F,u)}),d.interceptors.response.use(u=>{const s=["user/kaptcha"],o=u.data;if(s.some(g=>u.config.url&&u.config.url.includes(g))||o.size&&o.type)return o;const{success:i,errorMsg:b,errorCode:D}=o;if(i)return o;p&&p("request:error_business",{errorCode:D,errorMsg:b||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:o})},u=>{var s,o,i,b,D,g,c,R,q;if(u.message==="canceled")return Promise.reject(u);if(p){let j="request:error_network",O={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:u};((s=u==null?void 0:u.response)==null?void 0:s.status)===401?(j="request:error_auth",O={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:u,redirect:"/login"}):(((i=(o=u==null?void 0:u.response)==null?void 0:o.data)==null?void 0:i.errorCode)==="30013"||((D=(b=u==null?void 0:u.response)==null?void 0:b.data)==null?void 0:D.errorCode)==="30023")&&(j="request:error_business",O={errorCode:(c=(g=u==null?void 0:u.response)==null?void 0:g.data)==null?void 0:c.errorCode,errorMsg:((q=(R=u==null?void 0:u.response)==null?void 0:R.data)==null?void 0:q.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:u}),p(j,O)}return Promise.reject(u)}),{getTableList:async u=>{try{const s=await d.get(`/directDB/queryTableList/${u}`),{success:o,data:i}=s;if(o)return i}catch(s){console.log("getTableList error:",s)}},getTableTreeList:async u=>{try{const s=await d.get(`/dataTable/queryTableFileTreeList/${u}`),{success:o,data:i}=s;if(o)return i}catch(s){console.log("getTableTreeList error:",s)}},getDBDetailById:async(u,s)=>{const o=ye(s);try{const i=await d.get(`/${o}/queryDBInfo/${u}`),{success:b,data:D}=i;if(b)return D}catch(i){console.log("getDBDetailById error:",i)}},delTableById:async(u,s)=>{const o=ye(s);try{const i=await d.delete(`/${o}/deleteTable/${u}`),{success:b,data:D}=i;if(b)return D}catch(i){console.log("delTableById error:",i)}},delFileById:async u=>{try{const s=await d.delete(`/dataTable/deleteTableFileData/${u}`),{success:o,data:i}=s;if(o)return i}catch(s){console.log("delFileById",s)}},parseFiles:async({fileIds:u,isGenDescription:s,tableDescriptionMap:o})=>{try{const i=await d.post("/dataTable/parseFiles",{fileIds:u,isGenDescription:s,tableDescriptionMap:o}),{success:b,data:D}=i;if(b)return D}catch(i){console.log("parseFiles error:",i)}},reParseFile:async u=>{try{const s=await d.post(`/dataTable/reParseFile/${u}`),{success:o,data:i}=s;if(o)return i}catch(s){console.log("reParseFile error:",s)}},parseAppendFile:async({fileIds:u,tableId:s})=>{try{const o=await d.post("/dataTable/parseAppendFiles",{fileIds:u,tableId:s}),{success:i,data:b}=o;if(i)return b}catch(o){console.log("parseAppendFile error:",o)}},deleteUploadedFiles:async u=>{try{const s=await d.post("/dataTable/cancelUploadFile",{fileIds:u}),{success:o,data:i}=s;if(o)return i}catch(s){console.log("deleteUploadedFiles error:",s)}},getTableInfoById:async u=>{try{const s=await d.get(`/dataTable/queryTableMeta/${u}`),{success:o,data:i}=s;if(o)return i}catch(s){console.log("getTableInfoById error:",s)}},updateTableInfo:async({tableId:u,description:s,businessName:o})=>{try{const i=await d.post("/dataTable/updateTableInfo",{tableId:u,businessName:o,description:s}),{success:b,data:D}=i;if(b)return D}catch(i){console.log("updateTableInfo error:",i)}},optimizeDesc:async u=>{try{const s=await d.get(`/genTableDescription/${u}`),{success:o,data:i}=s;if(o)return i}catch(s){console.log("optimizeDesc error:",s)}}}},ye=a=>a=="DataTable"?"dataTable":"directDB",ne='<template key="type" placeholder="\u8F93\u5165\u8868\u683C\u7C7B\u578B"></template>\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86<template key="scene" placeholder="\u8F93\u5165\u573A\u666F\u540D\u79F0"></template>\u573A\u666F\u7684\u6570\u636E,\u5305\u542B<template key="primary_key" placeholder="\u4E3B\u8981\u5B57\u6BB5(\u53EF\u5199\u591A\u4E2A,\u7528\u987F\u53F7\u5206\u9694)"></template>\u7B49\u4E3B\u8981\u5B57\u6BB5,\u652F\u6301\u7528\u6237\u67E5\u8BE2<template key="search_direction" placeholder="\u5927\u6982\u4ECB\u7ECD\u9700\u8981\u67E5\u8BE2\u7684\u65B9\u5411"></template>\u95EE\u9898,\u5982\u679C\u8BBE\u8BA1\u591A\u8868\u5173\u8054\u67E5\u8BE2,\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7<template key="key_name" placeholder="\u5B57\u6BB5\u540D\u79F0"></template>\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A<template key="table_name" placeholder="\u8868\u683C\u540D\u79F0"></template>\u8868\u683C\u3002',Ze={colors:{background:"#ffffff",border:"#e5e7eb",appBackground:"#ffffff",listBackground:"#ffffff",dashboardBackground:"#ffffff"},space:{padding:"0",margin:"md",shadow:"none"}},qe=({drawerTitle:a,drawerVisible:w,uploadUrl:F,handleDrawerClose:p,dbId:d,tableInfo:m,token:Z,url:E,role:X})=>{const M=J(()=>({id:"upload",layout:"vertical",formWidth:"670px",fields:[{id:"fileIds",name:"fileIds",type:"uploader",required:!1,defaultValue:"",uploaderConfig:{multiple:!m,accept:".csv,.xlsx,.xls",maxFiles:m?1:20,url:F,autoUpload:!0,headers:{Authorization:Z},queryParams:{databaseId:d,...m&&{tableId:m.tableId}},placeholder:T("div",{children:[t("div",{className:"text-lg font-bold",children:"\u70B9\u51FB\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20"}),T("div",{className:"flex flex-col gap-1.8 mt-[12px]",children:[t("div",{className:"text-[#888888] font-[12px]",children:"\u6570\u91CF\uFF1A\u226420 \u6587\u4EF6\uFF08\u5F53\u524D 0/20\uFF09"}),t("div",{className:"text-[#888888] font-[12px]",style:{width:"580px"},children:"\u683C\u5F0F\uFF1A.xlsx / .xls / .csv /\uFF08\u7B2C\u4E00\u884C\u662F\u8868\u5934\uFF0C\u5176\u4ED6\u884C\u662F\u6570\u636E\uFF1BCSV \u652F\u6301 UTF-8/GBK/GB2312\u2026\uFF09"}),t("div",{className:"text-[#888888] font-[12px]",children:"\u5355\u6587\u4EF6\u9650\u5236\uFF1A \u226410\u4E07\u884C\uFF0C\u226460\u5217\uFF08\u8D85\u51FA\u81EA\u52A8\u5FFD\u7565\uFF09\uFF1B \u6BCF\u6587\u4EF6 \u22641\u4E2ASheet"}),t("div",{className:"text-[#888888] font-[12px]",children:"\u4E0A\u4F20\u7684\u6587\u4EF6\uFF0C\u5982\u679C\u6709\u4E0D\u7B26\u5408\u6587\u672C\u683C\u5F0F\u7684\u6570\u636E\u7CFB\u7EDF\u81EA\u52A8\u5FFD\u7565"})]})]}),listName:m?"\u8FFD\u52A0\u6587\u4EF6":"\u4E0A\u4F20\u6587\u4EF6\u5217\u8868",icons:{dragUpload:t("img",{src:$e,width:40}),itemStatus:{pending:t("span",{style:{fontSize:"12px",color:"#6b7280"}}),uploading:t("span",{style:{fontSize:"12px",color:"#007bff"}}),success:t("span",{style:{fontSize:"12px",color:"#10b981"}}),error:t("span",{style:{fontSize:"12px",color:"#ef4444"},children:"\u5931\u8D25"})},fileType:{default:t(ze,{size:20,style:{color:"#6b7280"}})}},...!m&&{buttons:[{label:"\u4F7F\u7528\u6A21\u7248",icon:t("img",{src:We}),mode:"text",onClick:()=>{i(!0)}}]},...!m&&{itemForm:[{type:"textarea",name:"description",counter:150,placeholder:"\u4E3A\u4E86\u63D0\u9AD8\u95EE\u7B54\u51C6\u786E\u7387\uFF0C\u8BF7\u8F93\u5165\u63CF\u8FF0"}]}}}]}),[m]),[L,h]=C(!1),[f,W]=C({}),V=Fe(null),[$,N]=C(!1),[u,s]=C([]),[o,i]=C(!1),[b,D]=C(ne),[g,c]=C(null),[R,q]=C(ne),[j,O]=C(0),{parseFiles:ue,parseAppendFile:te,deleteUploadedFiles:ae}=ke({url:E,token:Z,role:X}),K=Y(async(n,l,S)=>{var B;switch(console.log("[DynamicFormAdopter] \u4E8B\u4EF6:",n,l),n){case"form:ready":l.formRef?V.current=l.formRef:console.log("\u274C data.formRef \u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u8868\u5355\u5F15\u7528");break;case"form:submit":P();break;case"form_field_change":W(A=>({...A,[l.fieldId]:l.value}));break;case"uploader:error":(B=l.item)!=null&&B.id?s(A=>[{id:l.item.id,status:l.item.status},...A]):G.error(l==null?void 0:l.message);break;case"uploader:success":s(A=>[{id:l.item.id,status:l.item.status},...A]);break;case"uploader:remove":const _=l.item.status;s(A=>A.filter(r=>r.id!==l.item.id)),_=="success"&&await ee([l.item.uploadApiRes]);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",n)}},[]),se=J(()=>({label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:"form-view",model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:"form-view",type:"form",size:"md",formWidth:M.formWidth,formConfig:{layout:M.layout,showReset:!1,showSubmit:!1,formWidth:M.formWidth,getFormData:()=>({...f,timestamp:new Date().toISOString(),formId:M.id}),onFieldChange:(n,l)=>{K("form_field_change",{fieldId:n,value:l},void 0)},onValidationError:n=>{K("form_validation_error",n,void 0)}}}],dataSource:[{id:M.id,fields:M.fields,defaultValues:{}}],eventsEmit:K,styles:{theme:Ze}}),[m,M]),P=async()=>{var n;try{h(!0);const l=await V.current.getAllData();if(l.isValid){const S=(n=l.fields.find(B=>B.name=="fileIds"))==null?void 0:n.value;if(Array.isArray(S)&&(S==null?void 0:S.length)>0){let B;if(m)B=await te({fileIds:S.map(_=>_.uploadApiRes),tableId:m.id});else{const _={fileIds:S.map(A=>A.uploadApiRes),tableDescriptionMap:S.reduce((A,r)=>(A[r.uploadApiRes]=r.formData.description,A),{}),isGenDescription:$};B=await ue(_)}B&&p("refresh")}}}catch(l){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",l)}finally{p(),h(!1),N(!1)}},Q=async n=>{var l;try{const S=await V.current.getAllData();if(S.isValid){const B=(l=S.fields.find(_=>_.name=="fileIds"))==null?void 0:l.value;if(B&&Array.isArray(B)&&(B==null?void 0:B.length)>0){const _=B.map(r=>r.uploadApiRes),A=await ee(_)}}}catch(S){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",S)}finally{p(),N(!1)}},ee=async n=>{try{const l=await ae(n);if(l)return l}catch(l){console.error("\u5220\u9664\u6587\u4EF6\u6570\u636E\u5931\u8D25:",l)}},ie=n=>{N(n)},oe=Y(n=>{D(n),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",n)},[]),re=Y(n=>{c(()=>n),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),le=Y(async()=>{try{if(!g){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const n=g("pure_string");await navigator.clipboard.writeText(n),G.success("\u5DF2\u590D\u5236",1)}catch(n){console.error("\u590D\u5236\u5931\u8D25:",n)}finally{i(!1)}},[g]);return T(we,{title:a,className:"database-upload-drawer",placement:"right",width:720,closeIcon:!1,extra:t(me,{size:20,color:"#888888",onClick:()=>Q(),className:"cursor-pointer"}),open:w,destroyOnHidden:!0,footer:T("div",{className:"flex items-center",style:{justifyContent:m?"end":"space-between"},children:[!m&&T("div",{className:"flex gap-2 items-center",children:[t("span",{children:"\u81EA\u52A8\u751F\u6210\u6570\u636E\u8868\u63CF\u8FF0"})," ",t(pe,{title:"\u81EA\u52A8\u751F\u6210\u5F00\u542F\u65F6\u5C06\u57FA\u4E8E\u6570\u636E\u667A\u80FD\u751F\u6210\u63CF\u8FF0\uFF1B\u82E5\u5F00\u542F\u6B64\u529F\u80FD\u5E76\u624B\u52A8\u586B\u5199\u63CF\u8FF0\uFF0C\u5C06\u4F18\u5148\u91C7\u7528\u7528\u6237\u586B\u5199\u7684\u5185\u5BB9\u3002",children:t(Le,{size:14})}),t(Ue,{onChange:ie})]}),T("div",{className:"flex self-end gap-3",children:[t(H,{mode:"default",style:{marginRight:10},label:"\u53D6\u6D88",onClick:Q}),t(H,{mode:"primary",label:"\u786E\u8BA4\u5BFC\u5165",loading:L,disabled:u.some(n=>n.status=="error"),onClick:async()=>{await P()}})]})]}),children:[t(Ae,{...se},"upload-file"),t(Ce,{title:T("div",{children:["\u6A21\u7248",t("span",{className:"text-[12px] text-[#888888] ml-[8px]",children:"\u5B8C\u6210\u7F16\u8F91\u540E\uFF0C\u53EF\u5C06\u6587\u672C\u590D\u5236\u7C98\u8D34\u5230\u76F8\u5E94\u63CF\u8FF0\u6846\u4E2D\u3002"})]}),width:672,destroyOnHidden:!0,open:o,onCancel:()=>i(!1),footer:T("div",{className:"flex justify-end items-center gap-3",children:[t(H,{mode:"default",label:"\u91CD\u7F6E",onClick:()=>{q(ne),O(n=>n+1)}}),t(H,{mode:"primary",label:"\u590D\u5236",onClick:le})]}),children:t(xe,{data:R,onChange:oe,onGetData:re,styles:{theme:{colors:{primary:"#0969da",secondary:"#6b7280",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6",background:"#ffffff",text:"#1f2937",border:"#e5e7eb",disabled:"#9ca3af",disabledBackground:"#f3f4f6",disabledText:"#6b7280",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)",appBackground:"transparent",listBackground:"#f9fafb",dashboardBackground:"#ffffff",textSecondary:"#6b7280"},space:{sidebar:"260px",size:"12px",radius:"8px",padding:"1rem",margin:"1rem",shadow:"0 2px 8px rgba(0,0,0,0.1)",lineHeight:"1.8"},icons:{},fonts:{body:{size:"14px",weight:"normal",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},heading:{size:"14px",weight:"600",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"}},others:{baseFontWeight:"normal"}},templateField:{backgroundColor:"#E5EEFF",borderColor:"#84ADFF",borderRadius:"6px",padding:"6px 12px",margin:"2px",fontSize:"14px",fontWeight:"500",minWidth:"80px",textColor:"#84ADFF"}}},j)})]})},je="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%201C13.4997%201.50025%2013.25%201.99975%2013.25%202.5C13.25%203.00025%2013.4997%203.49975%2014%204C13.4997%203.49975%2013.0003%203.25%2012.5%203.25C11.9997%203.25%2011.5003%203.49975%2011%204C11.5003%203.49975%2011.75%203.00025%2011.75%202.5C11.75%201.99975%2011.5003%201.50025%2011%201C11.5003%201.50025%2011.9997%201.75%2012.5%201.75C13.0003%201.75%2013.4997%201.50025%2014%201Z'%20fill='%23055AFF'/%3e%3cpath%20d='M13%206.28571V13C13%2013.5523%2012.5523%2014%2012%2014H4C3.44772%2014%203%2013.5523%203%2013V3C3%202.44772%203.44772%202%204%202H9.25'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='6.35'%20x2='10.35'%20y2='6.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='9.35'%20x2='8.35'%20y2='9.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3c/svg%3e",Oe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_4199_8826)'%3e%3cpath%20d='M15.5554%2012.4444C14.9626%2013.0373%2014.6666%2013.6293%2014.6666%2014.2222C14.6666%2014.8151%2014.9626%2015.4071%2015.5554%2016C14.9626%2015.4071%2014.3706%2015.1111%2013.7777%2015.1111C13.1848%2015.1111%2012.5928%2015.4071%2011.9999%2016C12.5928%2015.4071%2012.8888%2014.8151%2012.8888%2014.2222C12.8888%2013.6293%2012.5928%2013.0373%2011.9999%2012.4444C12.5928%2013.0373%2013.1848%2013.3333%2013.7777%2013.3333C14.3706%2013.3333%2014.9626%2013.0373%2015.5554%2012.4444ZM14.6488%204.01778C15.1905%204.55954%2015.4948%205.29431%2015.4948%206.06044C15.4948%206.82658%2015.1905%207.56135%2014.6488%208.10311L7.735%2015.0169C7.46766%2015.2892%207.14901%2015.5058%206.79746%2015.6543C6.44592%2015.8028%206.06844%2015.8801%205.68684%2015.8819C5.30523%2015.8836%204.92706%2015.8097%204.57417%2015.6645C4.22127%2015.5193%203.90065%2015.3056%203.63081%2015.0357C3.36097%2014.7659%203.14727%2014.4453%203.00205%2014.0924C2.85682%2013.7395%202.78295%2013.3613%202.7847%2012.9797C2.78646%2012.5981%202.8638%2012.2206%203.01226%2011.8691C3.16072%2011.5176%203.37736%2011.1989%203.64967%2010.9316L3.95545%2010.6249L3.85145%2010.5244C3.30922%2010.0267%202.76522%209.77778%202.22211%209.77778C1.62923%209.77778%201.03722%2010.0738%200.444336%2010.6667C1.03722%2010.0738%201.33322%209.48178%201.33322%208.88889C1.33322%208.296%201.03722%207.704%200.444336%207.11111C1.03722%207.704%201.62923%208%202.22211%208C2.815%208%203.407%207.704%203.99989%207.11111C3.407%207.704%203.111%208.296%203.111%208.88889C3.111%209.46667%203.39278%2010.0444%203.95545%2010.6222L10.5634%204.01778C11.1052%203.47606%2011.84%203.17173%2012.6061%203.17173C13.3723%203.17173%2014.107%203.47606%2014.6488%204.01778ZM9.55189%206.91378L4.59189%2011.8738C4.30004%2012.1655%204.13603%2012.5612%204.13594%2012.9739C4.1359%2013.1782%204.17611%2013.3806%204.25426%2013.5694C4.33242%2013.7582%204.44699%2013.9297%204.59145%2014.0742C4.7359%2014.2187%204.9074%2014.3334%205.09617%2014.4116C5.28493%2014.4898%205.48725%2014.5301%205.69158%2014.5302C6.10424%2014.5303%206.50004%2014.3664%206.79189%2014.0747L11.7519%209.11378L9.55189%206.91378ZM11.5066%204.96089L10.495%205.97156L12.695%208.17156L13.7057%207.16C13.9846%206.86582%2014.1377%206.47437%2014.1323%206.069C14.1269%205.66364%2013.9635%205.27639%2013.6768%204.98973C13.3902%204.70306%2013.0029%204.53964%2012.5976%204.53425C12.1922%204.52887%2011.8007%204.68194%2011.5066%204.96089ZM9.59545%200C8.85589%200.740444%208.48434%201.48178%208.48434%202.22222C8.48434%202.96267%208.85589%203.704%209.59545%204.44444C8.85589%203.704%208.11456%203.33333%207.37322%203.33333C6.63367%203.33333%205.89234%203.704%205.151%204.44444C5.89234%203.704%206.26211%202.96267%206.26211%202.22222C6.26211%201.48178%205.89322%200.740444%205.15189%200C5.89322%200.740444%206.63456%201.11111%207.37411%201.11111C8.11545%201.11111%208.85678%200.740444%209.59634%200H9.59545Z'%20fill='%23055AFF'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_4199_8826'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",{confirm:Ye}=Ce,Xe='<template key="type" placeholder="\u8F93\u5165\u8868\u683C\u7C7B\u578B"></template>\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86<template key="scene" placeholder="\u8F93\u5165\u573A\u666F\u540D\u79F0"></template>\u573A\u666F\u7684\u6570\u636E,\u5305\u542B<template key="primary_key" placeholder="\u4E3B\u8981\u5B57\u6BB5(\u53EF\u5199\u591A\u4E2A,\u7528\u987F\u53F7\u5206\u9694)"></template>\u7B49\u4E3B\u8981\u5B57\u6BB5,\u652F\u6301\u7528\u6237\u67E5\u8BE2<template key="search_direction" placeholder="\u5927\u6982\u4ECB\u7ECD\u9700\u8981\u67E5\u8BE2\u7684\u65B9\u5411"></template>\u95EE\u9898,\u5982\u679C\u8BBE\u8BA1\u591A\u8868\u5173\u8054\u67E5\u8BE2,\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7<template key="key_name" placeholder="\u5B57\u6BB5\u540D\u79F0"></template>\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A<template key="table_name" placeholder="\u8868\u683C\u540D\u79F0"></template>\u8868\u683C\u3002',Ke=({drawerTitle:a,drawerVisible:w,tableInfo:F,handleDrawerClose:p,optimizeDesc:d,eventsEmit:m})=>{const Z=J(()=>(F==null?void 0:F.data.find(c=>c.columnId=="name").value)||"-",[F]),[E,X]=C(""),[M,L]=C(null),[h,f]=C(""),[W,V]=C(0),[$,N]=C(!1),[u,s]=C(!1);Be(()=>{const c=(F==null?void 0:F.data.find(R=>R.columnId=="description").value)||"-";f(c)},[F]);const o=()=>{Ye({title:"\u4F60\u786E\u5B9A\u8981\u4F7F\u7528\u6A21\u677F\u5417\uFF1F",content:"\u8FD9\u5C06\u66FF\u6362\u4F60\u5F53\u524D\u5DF2\u586B\u5199\u7684\u5185\u5BB9\uFF0C\u4E14\u65E0\u6CD5\u64A4\u9500\u3002",okText:"\u786E\u8BA4\u66FF\u6362",cancelText:"\u53D6\u6D88",onOk(){f(Xe),V(c=>c+1)},onCancel(){console.log("Cancel")}})},i=Y(c=>{X(c),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",c)},[]),b=Y(c=>{L(()=>c),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),D=async()=>{try{N(!0);const c=await d(F.tableId);c&&(f(c),V(R=>R+1),N(!1))}catch{G.error("AI \u4F18\u5316\u5931\u8D25")}},g=Y(()=>{if(!M){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const c=M("pure_string");m("table_info:update",c)},[M,m]);return T(we,{title:a,placement:"right",width:720,onClose:p,closeIcon:!1,extra:t(me,{size:20,color:"#888888",onClick:p,className:"cursor-pointer"}),open:w,destroyOnHidden:!0,footer:t("div",{className:"flex items-center",style:{justifyContent:"end"},children:T("div",{className:"flex self-end gap-3",children:[t(H,{mode:"default",style:{marginRight:10},label:"\u53D6\u6D88",onClick:p}),t(H,{mode:"primary",label:"\u786E\u8BA4",onClick:()=>g(),disabled:$})]})}),children:[t("div",{className:"mb-[10px] font-bold",children:Z}),T("div",{className:"mb-[10px]",children:[t("span",{style:{color:"#FF3B30",marginRight:"4px"},children:"*"}),t("span",{children:"\u6570\u636E\u8868\u63CF\u8FF0"}),t("span",{className:"text-[#888888] ml-[4px]",children:"(\u8BF7\u51C6\u786E\u586B\u5199\u8868\u683C\u7684\u5E94\u7528\u573A\u666F\u63CF\u8FF0\uFF0C\u5927\u6A21\u578B\u5C06\u4F9D\u8D56\u6B64\u4FE1\u606F\u8BC6\u522B\u5E76\u6B63\u786E\u8C03\u7528\u8BE5\u6570\u636E\u8868\u3002)"})]}),t(xe,{data:h,onChange:i,onGetData:b,styles:{theme:{colors:{primary:"#0969da",secondary:"#6b7280",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6",background:"#ffffff",text:"#1f2937",border:"#e5e7eb",disabled:"#9ca3af",disabledBackground:"#f3f4f6",disabledText:"#6b7280",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)",appBackground:"transparent",listBackground:"#f9fafb",dashboardBackground:"#ffffff",textSecondary:"#6b7280"},space:{sidebar:"260px",size:"12px",radius:"8px",padding:"1rem",margin:"1rem",shadow:"0 2px 8px rgba(0,0,0,0.1)",lineHeight:"1.8"},icons:{},fonts:{body:{size:"14px",weight:"normal",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},heading:{size:"14px",weight:"600",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"}},others:{baseFontWeight:"normal"}},templateField:{backgroundColor:"#E5EEFF",borderColor:"#84ADFF",borderRadius:"6px",padding:"6px 12px",margin:"2px",fontSize:"14px",fontWeight:"500",minWidth:"80px",textColor:"#84ADFF"}}},W),T("div",{children:[t(Ge,{open:u,onOpenChange:c=>s(!!c),content:t("div",{style:{width:"600px",margin:"10px",padding:"10px"},onClick:o,className:"hover:bg-gray-100 h-[80px] cursor-pointer rounded",children:"______\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86______\u573A\u666F\u7684\u6570\u636E\uFF0C\u5305\u542B______\u3001______\u3001______\u7B49\u4E3B\u8981\u5B57\u6BB5\uFF0C\u652F\u6301\u7528\u6237\u67E5\u8BE2______\u95EE\u9898(\u5927\u6982\u4ECB\u7ECD)\u5982\u679C\u6D89\u53CA\u591A\u8868\u5173\u8054\u67E5\u8BE2\uFF0C\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7______\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A______\u8868\u683C\u3002"}),title:T("div",{className:"flex justify-between items-center",style:{margin:"10px"},children:[t("div",{className:"text-[16px]",children:"\u6A21\u7248"}),t(me,{size:20,color:"#888888",onClick:()=>s(!1),className:"cursor-pointer"})]}),trigger:"click",destroyOnHidden:!0,placement:"bottomRight",getPopupContainer:c=>c,children:t("span",{children:t(H,{mode:"text",icon:t("img",{src:je}),children:"\u4F7F\u7528\u6A21\u7248"})})}),t(H,{onClick:D,mode:"text",icon:t("img",{src:Oe}),loading:$,children:"AI\u4F18\u5316"})]})]})},Je=""+new URL("assets/empty.png",import.meta.url).href;var U=(a=>(a[a.DATE=0]="DATE",a[a.VIEW=1]="VIEW",a[a.ERROR=2]="ERROR",a[a.AUTHORIZE=3]="AUTHORIZE",a[a.DELETE=4]="DELETE",a[a.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",a[a.DOWNLOAD=6]="DOWNLOAD",a[a.EDIT=7]="EDIT",a[a.ADD=8]="ADD",a[a.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",a[a.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",a))(U||{}),fe=(a=>(a.GENERATING="generating",a.SUCCESS="success",a.FAIL="fail",a))(fe||{});const ce={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},Pe=a=>typeof a=="string"&&a in ce?ce[a]:ce.default,de=a=>{const{value:w,cell:F}=a;switch(F.columnId){case"importstatus":return w?t(pe,{title:"\u6709\u8FFD\u52A0\u5931\u8D25\u7684\u6587\u4EF6\uFF0C\u8BF7\u53CA\u65F6\u5904\u7406",children:t(_e,{color:"red",bordered:!1,children:"\u8FFD\u52A0\u5931\u8D25"})}):t(Ee,{});case"status":const p=Pe(a.cell.statusType);return w=="\u5BFC\u5165\u5931\u8D25"?t(pe,{title:F.errorMsg,children:T("div",{className:"flex items-center gap-2",children:[t(he,{color:p,text:w}),t(ve,{size:14,color:"red"})]})}):t(he,{color:p,text:w});default:return t(Ee,{})}},De=[{statusType:"success",value:"\u5BFC\u5165\u6210\u529F",status:"30"},{statusType:"error",value:"\u5BFC\u5165\u5931\u8D25",status:"00"},{statusType:"default",value:"\u5F85\u5BFC\u5165",status:"10"},{statusType:"processing",value:"\u5BFC\u5165\u4E2D",status:"20"},{statusType:"processing",value:"\u5BFC\u5165\u4E2D",status:"11"}],Qe=a=>{var p,d;const{cell:w,value:F}=a;return typeof F=="string"?t("div",{title:F,style:{maxWidth:240,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:F}):(p=w.tableMeta)!=null&&p.isGenDescription&&((d=w.tableMeta)==null?void 0:d.generateDescriptionStatus)=="generating"?T("div",{className:"flex items-center gap-1 text-[#84ADFF]",style:{color:"#84ADFF"},children:[t("span",{children:"\u751F\u6210\u4E2D"}),t(He,{size:14})]}):"-"},eu=({dbInfo:a,setDrawerTitle:w,setDrawerVisible:F,getBtnDisabled:p})=>T("div",{className:"flex flex-col items-center justify-center h-full",children:[t("div",{className:"text-xl font-semibold mb-3",children:t("img",{src:Je,width:120})}),t("div",{className:"text-base mb-2",style:{color:"#888888"},children:"\u6682\u65E0\u6570\u636E\u6587\u4EF6"}),t("div",{className:"flex gap-3",children:t(H,{mode:"primary",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",disabled:p&&p(8,a==null?void 0:a.permission),onClick:()=>{w("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),F(!0)}})})]}),{confirm:be}=Ce,hu=a=>{const{url:w,token:F,role:p,id:d,dbType:m,CustomComponents:Z,getBtnDisabled:E,uploadUrl:X}=a,[M,L]=C({container:"ready",content:"ready"}),h=Fe(null),f=Fe(null),[W,V]=C(),[$,N]=C({}),[u,s]=C(),[o,i]=C(!1),[b,D]=C(""),[g,c]=C(),[R,q]=C(!1),[j,O]=C(""),{getTableList:ue,delTableById:te,delFileById:ae,updateTableInfo:K,optimizeDesc:se,getTableTreeList:P,reParseFile:Q,getDBDetailById:ee}=ke({url:w,token:F,role:p,eventsEmit:a.eventsEmit});Be(()=>(d&&m&&(L(r=>({...r,container:"loading"})),ie()),()=>{f.current&&(clearTimeout(f.current),f.current=null)}),[d,m]);const ie=async()=>{try{const r=await ee(d,m);r&&(s(r),L(e=>({...e,container:"ready",content:"loading"})))}catch(r){console.log("[TableApiError] getDBInfo:",r)}await A()},oe=async()=>{try{if(m=="DirectDB"){const r=await ue(d);if(r){const e=le(r);return V(e||[]),L(z=>({...z,content:"ready"})),e||[]}else L(e=>({...e,content:"error"}))}else{const r=await P(d);if(r){const e=re(r);return V(e||[]),L(z=>({...z,content:"ready"})),e||[]}else L(e=>({...e,content:"error"}))}}catch(r){console.log("[TableApiError] getTableList:",r)}};function re(r){return(r||[]).map((e,z)=>{var x,I;let y=De.find(v=>v.status==e.status);const k=e.children.some(v=>v.status=="00");return{id:e.fileId.toString(),tableId:e.tableId,data:[{columnId:"name",value:(e==null?void 0:e.originalFilename)||"-",type:"label"},{columnId:"description",value:(x=e==null?void 0:e.tableMeta)==null?void 0:x.description,type:"customized",tableMeta:e==null?void 0:e.tableMeta},{columnId:"count",value:`${e.rowCount}\u884C\uFF0C${e.columnCount}\u5217`,type:"text"},{columnId:"status",...y,type:"customized",errorMsg:e.errorMsg},{columnId:"importstatus",value:k,type:"customized"},{columnId:"createdAt",value:e.gmtCreate,type:"date"},{columnId:"updatedAt",value:e.gmtModified,type:"date"},...e.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:E&&E(U.VIEW,e.permission)},{columnId:"actions",value:"edit",label:"\u4FEE\u6539\u914D\u7F6E",type:"action",disabled:E&&E(U.EDIT,e.permission)},{columnId:"actions",value:"addData",label:"\u8FFD\u52A0\u6570\u636E",type:"action",disabled:E&&E(U.EDIT,e.permission)}]:[],...e.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action"}]:[],{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action",disabled:E&&E(U.DELETE,e.permission)}],expanded:!1,...e.children&&((I=e.children)==null?void 0:I.length)>0&&{children:[...(e.children||[]).map(v=>{const Ie=De.find(Se=>Se.status==v.status),Te=[{columnId:"name",value:v.originalFilename,type:"text"},{columnId:"count",value:`${v.rowCount}\u884C\uFF0C${v.columnCount}\u5217`,type:"text"},{columnId:"status",...Ie,errorMsg:v.errorMsg,type:"customized"},{columnId:"createdAt",value:v.gmtCreate,type:"date"},{columnId:"updatedAt",value:v.gmtModified,type:"date"},...v.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:E&&E(U.VIEW,v.permission)}]:[],...v.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action",disabled:E&&E(U.ADD,v.permission)}]:[],{columnId:"actions",value:"delete_sub",label:"\u5220\u9664",type:"action",disabled:E&&E(U.DELETE,v.permission)}];return{id:v.fileId.toString(),tableId:v.tableId,data:Te}})]}}})}function le(r){return(r||[]).map((e,z)=>({id:e.id||Me(8),data:[{columnId:"name",value:e.physicalName},{columnId:"cnname",value:e.businessName},{columnId:"colcount",value:e.columnCount},{columnId:"count",value:`${e.rowCount}\u884C\uFF0C${e.columnCount}\u5217`},{columnId:"actions",value:"view",label:"\u67E5\u770B",disabled:E&&E(U.VIEW,e.permission)}]}))}async function n(r,e,z){switch(console.log("[adopter] mergedEventsEmit",r,e,z),r){case"table_action_delete":{try{if(console.log("[delete] \u5220\u9664\u4E8B\u4EF6\u6570\u636E:",e),!e||!e.tableId&&!e.id){console.error("[delete] \u5220\u9664\u4E8B\u4EF6\u6570\u636E\u4E0D\u5B8C\u6574:",e),G.error("\u5220\u9664\u5931\u8D25\uFF1A\u6570\u636E\u4E0D\u5B8C\u6574");return}const y=e.tableId||e.id,k=e.id;be({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",content:"\u8BE5\u6570\u636E\u8868\u53CA\u5176\u8FFD\u52A0\u6570\u636E\u90FD\u5C06\u88AB\u5220\u9664\u4E14\u65E0\u6CD5\u6062\u590D",icon:t(ve,{color:"#FF4D4F",className:"mr-[8px]"}),okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await te(y,m)&&(h!=null&&h.current)?(h==null||h.current.appFn.removeItem(k),G.success("\u5220\u9664\u6210\u529F")):G.error("\u5220\u9664\u5931\u8D25")}})}catch(y){console.error("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25:",y),G.error("\u5220\u9664\u5931\u8D25")}break}case"table_action_edit":{O("\u4FEE\u6539\u6570\u636E\u914D\u7F6E"),q(!0),c(e);break}case"toolbar_upload":{D("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),i(!0);break}case"table_action_addData":{D("\u8FFD\u52A0\u6570\u636E"),i(!0),c(e);break}case"table_action_reValidate":{await Q(e.id)&&(f.current&&(clearTimeout(f.current),f.current=null),await A());break}case"table_info:update":{try{if(g!=null&&g.id){const y=(g==null?void 0:g.data.find(x=>x.columnId=="name").value)||"-";if(await K({tableId:g.tableId,description:e,businessName:y})&&(h!=null&&h.current)){const x={...g,data:g.data.map(I=>I.columnId=="description"?{...I,value:e}:I)};h==null||h.current.appFn.updateItem(x,g.id),G.success("\u4FEE\u6539\u914D\u7F6E\u6210\u529F")}}}catch(y){console.error("\u4FEE\u6539\u914D\u7F6E\u5931\u8D25",y)}finally{B()}break}case"table_action_delete_sub":{try{be({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){const{id:y,tableId:k}=e;await ae(e.id)&&(h!=null&&h.current)&&(N(I=>({...I,[k]:[...I[k]||[],y]})),e.data.find(I=>I.status=="00")&&(f.current&&(clearTimeout(f.current),f.current=null),A()),z.removeItem(y,k),G.success("\u8FFD\u52A0\u6587\u4EF6\u6570\u636E\u5220\u9664\u6210\u529F"))}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25")}break}case"toolbar_auth":{typeof a.eventsEmit=="function"&&a.eventsEmit("toolbar_auth",u);break}default:typeof a.eventsEmit=="function"&&a.eventsEmit(r,e);break}}const l=J(()=>({label:"\u6570\u636E\u8868\u7BA1\u7406",model:null,defaultActiveId:"direct-table-view",views:[{label:"\u6211\u7684\u6570\u636E\u5E93",id:"direct-table-view",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,columns:[{id:"name",title:"\u6570\u636E\u8868\u82F1\u6587\u540D\u79F0",type:"label"},{id:"cnname",title:"\u6570\u636E\u8868\u4E2D\u6587\u540D\u79F0",type:"label"},{id:"colcount",title:"\u5B57\u6BB5\u6570",type:"text"},{id:"count",title:"\u6570\u636E\u91CF",type:"text"},{id:"actions",title:"\u64CD\u4F5C",type:"action"}],toolbar:[{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",searchKeys:["name","description"],position:"right"},{type:"button",key:"auth",label:"\u914D\u7F6E",btnType:"default",position:"right"}]}]}),[W,m]),S=J(()=>({label:"\u6570\u636E\u8868\u7BA1\u7406",model:null,defaultActiveId:"data-table-view",views:[{label:"\u4E0A\u4F20\u6570\u636E\u5217\u8868",id:"data-table-view",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,columns:[{id:"name",title:"\u6587\u4EF6\u540D",type:"label",tip:"\u6587\u4EF6\u540D"},{id:"description",title:"\u63CF\u8FF0",type:"customized",component:t(Qe,{}),helpText:"\u6253\u5F00\u81EA\u52A8\u751F\u6210\u63CF\u8FF0\u5F00\u5173\u540E\uFF0C\u82E5\u63CF\u8FF0\u672A\u6B63\u5E38\u751F\u6210\uFF0C\u5219\u63CF\u8FF0\u5185\u5BB9\u4E3A\u7A7A\uFF0C\u5982\u60A8\u4ECD\u7136\u9700\u8981\u63CF\u8FF0\uFF0C\u5219\u9700\u8981\u624B\u52A8\u6DFB\u52A0"},{id:"count",title:"\u6570\u636E\u91CF",type:"text",tip:"\u6570\u636E\u91CF"},{id:"status",title:"\u5BFC\u5165\u72B6\u6001",type:"customized",component:t(de,{})},{id:"importstatus",title:"\u8FFD\u52A0\u63D0\u793A",type:"customized",component:t(de,{})},{id:"createdAt",title:"\u521B\u5EFA\u65F6\u95F4",type:"date",tip:"\u521B\u5EFA\u65F6\u95F4"},{id:"updatedAt",title:"\u66F4\u65B0\u65F6\u95F4",type:"date",tip:"\u66F4\u65B0\u65F6\u95F4"},{id:"actions",title:"\u64CD\u4F5C",type:"action"}],toolbar:[{type:"button",key:"upload",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",btnType:"primary",disabled:E&&E(U.ADD,u==null?void 0:u.permission),icon:t(Ve,{size:12})},{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",searchKeys:["name","description",["name"]],position:"right"},{type:"button",key:"auth",label:"\u914D\u7F6E",btnType:"default",position:"right"}]}],subTableConfig:{type:"table",allowMultiSelect:!1,viewBehavior:"pagination",viewPageSize:5,columns:[{title:"\u8FFD\u52A0\u6587\u4EF6\u540D",id:"name",type:"text",tip:"\u8FFD\u52A0\u6587\u4EF6\u540D"},{title:"\u6570\u636E\u91CF",id:"count",type:"text",tip:"\u6570\u636E\u91CF"},{id:"status",title:"\u5BFC\u5165\u72B6\u6001",type:"customized",tip:"\u5BFC\u5165\u72B6\u6001",component:t(de,{})},{title:"\u521B\u5EFA\u65F6\u95F4",id:"createdAt",type:"date",tip:"\u521B\u5EFA\u65F6\u95F4"},{title:"\u66F4\u6539\u65F6\u95F4",id:"updatedAt",type:"date",tip:"\u66F4\u6539\u65F6\u95F4"},{title:"\u64CD\u4F5C",id:"actions",type:"action"}]},subTablePendingIds:$,onSubTableRowAnimationComplete:(r,e)=>{N(z=>({...z,[r]:(z[r]||[]).filter(y=>y!==e)}))}}),[$,W,m,u]),B=r=>{i(!1),q(!1),c(void 0),r=="refresh"&&(f.current&&(clearTimeout(f.current),f.current=null),A())};function _(r){var e,z;if(!Array.isArray(r))return!0;for(const y of r){if(y.data){const k=y.data.find(I=>I.columnId==="status"),x=y.data.find(I=>I.columnId==="description");if(console.log("+++++",k.status==="20"||k.status==="11"||((e=x==null?void 0:x.tableMeta)==null?void 0:e.generateDescriptionStatus)==fe.GENERATING),k&&(k.status==="20"||k.status==="11"||((z=x==null?void 0:x.tableMeta)==null?void 0:z.generateDescriptionStatus)==fe.GENERATING))return!1}if(Array.isArray(y.children)){for(const k of y.children)if(k.data){const x=k.data.find(I=>I.columnId==="status");if(x&&(x.status==="20"||x.status==="11"))return!1}}}return!0}const A=async()=>{const r=await oe();_(r||[])?f.current&&(clearTimeout(f.current),f.current=null):(f.current&&(clearTimeout(f.current),f.current=null),f.current=setTimeout(()=>{A()},5e3))};return T(Ne,{title:u==null?void 0:u.name,description:(u==null?void 0:u.description)||"-",goBack:()=>{var r;(r=a.eventsEmit)==null||r.call(a,"goBack",{})},children:[t(Ae,{dataSource:W,ref:h,eventsEmit:n,status:M,styles:{theme:{...ge,colors:{...ge.colors,tableFirstColumnBg:"#ffffff",tableLastColumnBg:"#ffffff",paginationBackground:"#ffffff",subTableBackground:"#F5F5F5",tableHeaderBg:"#F5F5F5"}},mode:"light"},CustomComponents:{EmptyData:()=>t(eu,{dbInfo:u,setDrawerTitle:D,setDrawerVisible:i,getBtnDisabled:E}),...Z},...m=="DataTable"?S:l}),t(qe,{drawerTitle:b,drawerVisible:o,handleDrawerClose:B,dbId:d,token:F,url:w,uploadUrl:X,role:p,tableInfo:g}),t(Ke,{drawerTitle:j,drawerVisible:R,handleDrawerClose:B,tableInfo:g,optimizeDesc:se,eventsEmit:n})]})};export{hu as default};
1
+ import{jsx as u,jsxs as k,Fragment as ge}from"react/jsx-runtime";import{useMemo as P,useState as E,useRef as pe,useCallback as O,useEffect as Ae,forwardRef as ze,useImperativeHandle as Le}from"react";import{u as _e}from"./assets/index-CpW6Dhpp.js";import{F as Ve,J as $,C as Ne,T as Re,U as Ue,N as He}from"./assets/index-CtPe9ln8.js";import{a as Ge,T as me,a6 as We,F as he}from"./assets/index-8h59dJlj.js";import{O as xe}from"./assets/index-w1SriKuR.js";/* empty css *//* empty css */import{N as we}from"./assets/index-C9ax6WsW.js";import{s as W,M as Ee}from"./assets/index-DoUk2Ei_.js";import{D as ve}from"./assets/index-BN3yu4iN.js";import{X as fe}from"./assets/x-CmbLQ9dc.js";import{P as $e,L as Ze}from"./assets/index-B-AFa3n1.js";import{B as ye}from"./assets/index-BdNcL3V6.js";import{T as ke}from"./assets/triangle-alert-BycMPaz2.js";import"react-dom";import"./assets/index-C6WKbL3A.js";import"./assets/index-CVis9Agw.js";const qe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%201C13.4997%201.50025%2013.25%201.99975%2013.25%202.5C13.25%203.00025%2013.4997%203.49975%2014%204C13.4997%203.49975%2013.0003%203.25%2012.5%203.25C11.9997%203.25%2011.5003%203.49975%2011%204C11.5003%203.49975%2011.75%203.00025%2011.75%202.5C11.75%201.99975%2011.5003%201.50025%2011%201C11.5003%201.50025%2011.9997%201.75%2012.5%201.75C13.0003%201.75%2013.4997%201.50025%2014%201Z'%20fill='%23055AFF'/%3e%3cpath%20d='M13%206.28571V13C13%2013.5523%2012.5523%2014%2012%2014H4C3.44772%2014%203%2013.5523%203%2013V3C3%202.44772%203.44772%202%204%202H9.25'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='6.35'%20x2='10.35'%20y2='6.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='9.35'%20x2='8.35'%20y2='9.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3c/svg%3e",je="data:image/svg+xml,%3csvg%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42%2022C43.1046%2022%2044%2022.8954%2044%2024V42C44%2043.1046%2043.1046%2044%2042%2044H6C4.89543%2044%204%2043.1046%204%2042V24.0088C4%2022.9042%204.89543%2022.0078%206%2022.0078C7.10457%2022.0078%208%2022.9042%208%2024.0088V40H40V24C40%2022.8954%2040.8954%2022%2042%2022ZM24.0293%204.00195C24.0808%204.00272%2024.1322%204.00504%2024.1836%204.00977C24.1904%204.01042%2024.1973%204.011%2024.2041%204.01172C24.2673%204.01819%2024.3301%204.02757%2024.3926%204.04004C24.3939%204.04031%2024.3952%204.04075%2024.3965%204.04102C24.7693%204.11623%2025.125%204.29691%2025.4141%204.58594L34.4141%2013.5859C35.1951%2014.367%2035.1951%2015.633%2034.4141%2016.4141C33.633%2017.1951%2032.367%2017.1951%2031.5859%2016.4141L25.9922%2010.8203V32C25.9922%2033.1046%2025.0968%2034%2023.9922%2034C22.8876%2034%2021.9922%2033.1046%2021.9922%2032V10.8359L16.4141%2016.4141C15.633%2017.1951%2014.367%2017.1951%2013.5859%2016.4141C12.8049%2015.633%2012.8049%2014.367%2013.5859%2013.5859L22.498%204.67285C22.8016%204.33138%2023.2194%204.09559%2023.6924%204.02441C23.7122%204.02135%2023.732%204.01809%2023.752%204.01562C23.7862%204.01152%2023.8207%204.00919%2023.8555%204.00684C23.8887%204.00446%2023.9218%204.00268%2023.9551%204.00195C23.9674%204.00173%2023.9798%204%2023.9922%204C24.0046%204%2024.0169%204.00173%2024.0293%204.00195Z'%20fill='url(%23paint0_linear_4072_34663)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_4072_34663'%20x1='4'%20y1='-7.25'%20x2='54.4707'%20y2='1.556'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%232B69FF'/%3e%3cstop%20offset='1'%20stop-color='%238F91FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Ie=({url:s,token:A,role:d,eventsEmit:F})=>{const p=Ge.create({baseURL:s,timeout:1e6});return p.interceptors.request.use(a=>{let t=A;return!t&&!["user/login","user/kaptcha","user/regist"].some(i=>a.url.includes(i))?(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"))):(a.headers.Authorization=t||"",a.headers.userName=d==="\u672A\u767B\u5F55\u7528\u6237"?"":d,a)}),p.interceptors.response.use(a=>{const t=["user/kaptcha"],r=a.data;if(t.some(z=>a.config.url&&a.config.url.includes(z))||r.size&&r.type)return r;const{success:i,errorMsg:h,errorCode:b}=r;if(i)return r;F&&F("request:error_business",{errorCode:b,errorMsg:h||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:r})},a=>{var t,r,i,h,b,z,o,N,X;if(a.message==="canceled")return Promise.reject(a);if(F){let q="request:error_network",j={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:a};((t=a==null?void 0:a.response)==null?void 0:t.status)===401?(q="request:error_auth",j={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:a,redirect:"/login"}):(((i=(r=a==null?void 0:a.response)==null?void 0:r.data)==null?void 0:i.errorCode)==="30013"||((b=(h=a==null?void 0:a.response)==null?void 0:h.data)==null?void 0:b.errorCode)==="30023")&&(q="request:error_business",j={errorCode:(o=(z=a==null?void 0:a.response)==null?void 0:z.data)==null?void 0:o.errorCode,errorMsg:((X=(N=a==null?void 0:a.response)==null?void 0:N.data)==null?void 0:X.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:a}),F(q,j)}return Promise.reject(a)}),{getTableList:async a=>{try{const t=await p.get(`/directDB/queryTableList/${a}`),{success:r,data:i}=t;if(r)return i}catch(t){console.log("getTableList error:",t)}},getTableTreeList:async a=>{try{const t=await p.get(`/dataTable/queryTableFileTreeList/${a}`),{success:r,data:i}=t;if(r)return i}catch(t){console.log("getTableTreeList error:",t)}},getDBDetailById:async(a,t)=>{const r=De(t);try{const i=await p.get(`/${r}/queryDBInfo/${a}`),{success:h,data:b}=i;if(h)return b}catch(i){console.log("getDBDetailById error:",i)}},delTableById:async(a,t)=>{const r=De(t);try{const i=await p.delete(`/${r}/deleteTable/${a}`),{success:h,data:b}=i;if(h)return b}catch(i){console.log("delTableById error:",i)}},delFileById:async a=>{try{const t=await p.delete(`/dataTable/deleteTableFileData/${a}`),{success:r,data:i}=t;if(r)return i}catch(t){console.log("delFileById",t)}},parseFiles:async({fileIds:a,isGenDescription:t,tableDescriptionMap:r})=>{try{const i=await p.post("/dataTable/parseFiles",{fileIds:a,isGenDescription:t,tableDescriptionMap:r}),{success:h,data:b}=i;if(h)return b}catch(i){console.log("parseFiles error:",i)}},reParseFile:async a=>{try{const t=await p.post(`/dataTable/reParseFile/${a}`),{success:r,data:i}=t;if(r)return i}catch(t){console.log("reParseFile error:",t)}},parseAppendFile:async({fileIds:a,tableId:t})=>{try{const r=await p.post("/dataTable/parseAppendFiles",{fileIds:a,tableId:t}),{success:i,data:h}=r;if(i)return h}catch(r){console.log("parseAppendFile error:",r)}},deleteUploadedFiles:async a=>{try{const t=await p.post("/dataTable/cancelUploadFile",{fileIds:a}),{success:r,data:i}=t;if(r)return i}catch(t){console.log("deleteUploadedFiles error:",t)}},getTableInfoById:async a=>{try{const t=await p.get(`/dataTable/queryTableMeta/${a}`),{success:r,data:i}=t;if(r)return i}catch(t){console.log("getTableInfoById error:",t)}},updateTableInfo:async({tableId:a,description:t,businessName:r})=>{try{const i=await p.post("/dataTable/updateTableInfo",{tableId:a,businessName:r,description:t}),{success:h,data:b}=i;if(h)return b}catch(i){console.log("updateTableInfo error:",i)}},optimizeDesc:async a=>{try{const t=await p.get(`/genTableDescription/${a}`),{success:r,data:i}=t;if(r)return i}catch(t){console.log("optimizeDesc error:",t)}}}},De=s=>s=="DataTable"?"dataTable":"directDB",ce='<template key="type" placeholder="\u8F93\u5165\u8868\u683C\u7C7B\u578B"></template>\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86<template key="scene" placeholder="\u8F93\u5165\u573A\u666F\u540D\u79F0"></template>\u573A\u666F\u7684\u6570\u636E,\u5305\u542B<template key="primary_key" placeholder="\u4E3B\u8981\u5B57\u6BB5(\u53EF\u5199\u591A\u4E2A,\u7528\u987F\u53F7\u5206\u9694)"></template>\u7B49\u4E3B\u8981\u5B57\u6BB5,\u652F\u6301\u7528\u6237\u67E5\u8BE2<template key="search_direction" placeholder="\u5927\u6982\u4ECB\u7ECD\u9700\u8981\u67E5\u8BE2\u7684\u65B9\u5411"></template>\u95EE\u9898,\u5982\u679C\u8BBE\u8BA1\u591A\u8868\u5173\u8054\u67E5\u8BE2,\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7<template key="key_name" placeholder="\u5B57\u6BB5\u540D\u79F0"></template>\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A<template key="table_name" placeholder="\u8868\u683C\u540D\u79F0"></template>\u8868\u683C\u3002',Oe={colors:{background:"#ffffff",border:"#e5e7eb",appBackground:"#ffffff",listBackground:"#ffffff",dashboardBackground:"#ffffff"},space:{padding:"0",margin:"md",shadow:"none"}},Ye=({drawerTitle:s,drawerVisible:A,uploadUrl:d,handleDrawerClose:F,dbId:p,tableInfo:m,token:S,url:K,role:f})=>{const M=P(()=>({id:"upload",layout:"vertical",formWidth:"670px",fields:[{id:"fileIds",name:"fileIds",type:"uploader",required:!1,defaultValue:"",uploaderConfig:{multiple:!m,accept:".csv,.xlsx,.xls",maxFiles:m?1:20,url:d,autoUpload:!0,headers:{Authorization:S},queryParams:{databaseId:p,...m&&{tableId:m.tableId}},placeholder:k("div",{children:[u("div",{className:"text-lg font-bold",children:"\u70B9\u51FB\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20"}),k("div",{className:"flex flex-col gap-1.8 mt-[12px]",children:[u("div",{className:"text-[#888888] font-[12px]",children:"\u6570\u91CF\uFF1A\u226420 \u6587\u4EF6\uFF08\u5F53\u524D 0/20\uFF09"}),u("div",{className:"text-[#888888] font-[12px]",style:{width:"580px"},children:"\u683C\u5F0F\uFF1A.xlsx / .xls / .csv /\uFF08\u7B2C\u4E00\u884C\u662F\u8868\u5934\uFF0C\u5176\u4ED6\u884C\u662F\u6570\u636E\uFF1BCSV \u652F\u6301 UTF-8/GBK/GB2312\u2026\uFF09"}),u("div",{className:"text-[#888888] font-[12px]",children:"\u5355\u6587\u4EF6\u9650\u5236\uFF1A \u226410\u4E07\u884C\uFF0C\u226460\u5217\uFF08\u8D85\u51FA\u81EA\u52A8\u5FFD\u7565\uFF09\uFF1B \u6BCF\u6587\u4EF6 \u22641\u4E2ASheet"}),u("div",{className:"text-[#888888] font-[12px]",children:"\u4E0A\u4F20\u7684\u6587\u4EF6\uFF0C\u5982\u679C\u6709\u4E0D\u7B26\u5408\u6587\u672C\u683C\u5F0F\u7684\u6570\u636E\u7CFB\u7EDF\u81EA\u52A8\u5FFD\u7565"})]})]}),listName:m?"\u8FFD\u52A0\u6587\u4EF6":"\u4E0A\u4F20\u6587\u4EF6\u5217\u8868",icons:{dragUpload:u("img",{src:je,width:40}),itemStatus:{pending:u("span",{style:{fontSize:"12px",color:"#6b7280"}}),uploading:u("span",{style:{fontSize:"12px",color:"#007bff"}}),success:u("span",{style:{fontSize:"12px",color:"#10b981"}}),error:u("span",{style:{fontSize:"12px",color:"#ef4444"},children:"\u5931\u8D25"})},fileType:{default:u(Ve,{size:20,style:{color:"#6b7280"}})}},...!m&&{buttons:[{label:"\u4F7F\u7528\u6A21\u7248",icon:u("img",{src:qe}),mode:"text",onClick:()=>{i(!0)}}]},...!m&&{itemForm:[{type:"textarea",name:"description",counter:150,placeholder:"\u4E3A\u4E86\u63D0\u9AD8\u95EE\u7B54\u51C6\u786E\u7387\uFF0C\u8BF7\u8F93\u5165\u63CF\u8FF0"}]}}}]}),[m]),[Y,V]=E(!1),[g,C]=E({}),U=pe(null),[Z,H]=E(!1),[a,t]=E([]),[r,i]=E(!1),[h,b]=E(ce),[z,o]=E(null),[N,X]=E(ce),[q,j]=E(0),{parseFiles:ae,parseAppendFile:se,deleteUploadedFiles:ie}=Ie({url:K,token:S,role:f}),J=O(async(c,n,I)=>{var x;switch(console.log("[DynamicFormAdopter] \u4E8B\u4EF6:",c,n),c){case"form:ready":n.formRef?U.current=n.formRef:console.log("\u274C data.formRef \u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u8868\u5355\u5F15\u7528");break;case"form:submit":Q();break;case"form_field_change":C(T=>({...T,[n.fieldId]:n.value}));break;case"uploader:error":(x=n.item)!=null&&x.id?t(T=>[{id:n.item.id,status:n.item.status},...T]):W.error(n==null?void 0:n.message);break;case"uploader:success":t(T=>[{id:n.item.id,status:n.item.status},...T]);break;case"uploader:remove":const _=n.item.status;t(T=>T.filter(R=>R.id!==n.item.id)),_=="success"&&await ue([n.item.uploadApiRes]);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",c)}},[]),re=P(()=>({label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:"form-view",model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:"form-view",type:"form",size:"md",formWidth:M.formWidth,formConfig:{layout:M.layout,showReset:!1,showSubmit:!1,formWidth:M.formWidth,getFormData:()=>({...g,timestamp:new Date().toISOString(),formId:M.id}),onFieldChange:(c,n)=>{J("form_field_change",{fieldId:c,value:n},void 0)},onValidationError:c=>{J("form_validation_error",c,void 0)}}}],dataSource:[{id:M.id,fields:M.fields,defaultValues:{}}],eventsEmit:J,styles:{theme:Oe}}),[m,M]),Q=async()=>{var c;try{V(!0);const n=await U.current.getAllData();if(n.isValid){const I=(c=n.fields.find(x=>x.name=="fileIds"))==null?void 0:c.value;if(Array.isArray(I)&&(I==null?void 0:I.length)>0){let x;if(m)x=await se({fileIds:I.map(_=>_.uploadApiRes),tableId:m.id});else{const _={fileIds:I.map(T=>T.uploadApiRes),tableDescriptionMap:I.reduce((T,R)=>(T[R.uploadApiRes]=R.formData.description,T),{}),isGenDescription:Z};x=await ae(_)}x&&F("refresh")}}}catch(n){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",n)}finally{F(),V(!1),H(!1)}},ee=async c=>{var n;try{const I=await U.current.getAllData();if(I.isValid){const x=(n=I.fields.find(_=>_.name=="fileIds"))==null?void 0:n.value;if(x&&Array.isArray(x)&&(x==null?void 0:x.length)>0){const _=x.map(R=>R.uploadApiRes),T=await ue(_)}}}catch(I){console.error("\u8868\u5355\u6570\u636E\u5931\u8D25:",I)}finally{F(),H(!1)}},ue=async c=>{try{const n=await ie(c);if(n)return n}catch(n){console.error("\u5220\u9664\u6587\u4EF6\u6570\u636E\u5931\u8D25:",n)}},oe=c=>{H(c)},te=O(c=>{b(c),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",c)},[]),le=O(c=>{o(()=>c),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),ne=O(async()=>{try{if(!z){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const c=z("pure_string");await navigator.clipboard.writeText(c),W.success("\u5DF2\u590D\u5236",1)}catch(c){console.error("\u590D\u5236\u5931\u8D25:",c)}finally{i(!1)}},[z]);return k(ve,{title:s,className:"database-upload-drawer",placement:"right",width:720,closeIcon:!1,extra:u(fe,{size:20,color:"#888888",onClick:()=>ee(),className:"cursor-pointer"}),open:A,destroyOnHidden:!0,footer:k("div",{className:"flex items-center",style:{justifyContent:m?"end":"space-between"},children:[!m&&k("div",{className:"flex gap-2 items-center",children:[u("span",{children:"\u81EA\u52A8\u751F\u6210\u6570\u636E\u8868\u63CF\u8FF0"})," ",u(me,{title:"\u81EA\u52A8\u751F\u6210\u5F00\u542F\u65F6\u5C06\u57FA\u4E8E\u6570\u636E\u667A\u80FD\u751F\u6210\u63CF\u8FF0\uFF1B\u82E5\u5F00\u542F\u6B64\u529F\u80FD\u5E76\u624B\u52A8\u586B\u5199\u63CF\u8FF0\uFF0C\u5C06\u4F18\u5148\u91C7\u7528\u7528\u6237\u586B\u5199\u7684\u5185\u5BB9\u3002",children:u(Ne,{size:14})}),u(We,{onChange:oe})]}),k("div",{className:"flex self-end gap-3",children:[u($,{mode:"default",style:{marginRight:10},label:"\u53D6\u6D88",onClick:ee}),u($,{mode:"primary",label:"\u786E\u8BA4\u5BFC\u5165",loading:Y,disabled:a.some(c=>c.status=="error"),onClick:async()=>{await Q()}})]})]}),children:[u(xe,{...re},"upload-file"),u(Ee,{title:k("div",{children:["\u6A21\u7248",u("span",{className:"text-[12px] text-[#888888] ml-[8px]",children:"\u5B8C\u6210\u7F16\u8F91\u540E\uFF0C\u53EF\u5C06\u6587\u672C\u590D\u5236\u7C98\u8D34\u5230\u76F8\u5E94\u63CF\u8FF0\u6846\u4E2D\u3002"})]}),width:672,destroyOnHidden:!0,open:r,onCancel:()=>i(!1),footer:k("div",{className:"flex justify-end items-center gap-3",children:[u($,{mode:"default",label:"\u91CD\u7F6E",onClick:()=>{X(ce),j(c=>c+1)}}),u($,{mode:"primary",label:"\u590D\u5236",onClick:ne})]}),children:u(we,{data:N,onChange:te,onGetData:le,styles:{theme:{colors:{primary:"#0969da",secondary:"#6b7280",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6",background:"#ffffff",text:"#1f2937",border:"#e5e7eb",disabled:"#9ca3af",disabledBackground:"#f3f4f6",disabledText:"#6b7280",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)",appBackground:"transparent",listBackground:"#f9fafb",dashboardBackground:"#ffffff",textSecondary:"#6b7280"},space:{sidebar:"260px",size:"12px",radius:"8px",padding:"1rem",margin:"1rem",shadow:"0 2px 8px rgba(0,0,0,0.1)",lineHeight:"1.8"},icons:{},fonts:{body:{size:"14px",weight:"normal",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},heading:{size:"14px",weight:"600",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"}},others:{baseFontWeight:"normal"}},templateField:{backgroundColor:"#E5EEFF",borderColor:"#84ADFF",borderRadius:"6px",padding:"6px 12px",margin:"2px",fontSize:"14px",fontWeight:"500",minWidth:"80px",textColor:"#84ADFF"}}},q)})]})},Xe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%201C13.4997%201.50025%2013.25%201.99975%2013.25%202.5C13.25%203.00025%2013.4997%203.49975%2014%204C13.4997%203.49975%2013.0003%203.25%2012.5%203.25C11.9997%203.25%2011.5003%203.49975%2011%204C11.5003%203.49975%2011.75%203.00025%2011.75%202.5C11.75%201.99975%2011.5003%201.50025%2011%201C11.5003%201.50025%2011.9997%201.75%2012.5%201.75C13.0003%201.75%2013.4997%201.50025%2014%201Z'%20fill='%23055AFF'/%3e%3cpath%20d='M13%206.28571V13C13%2013.5523%2012.5523%2014%2012%2014H4C3.44772%2014%203%2013.5523%203%2013V3C3%202.44772%203.44772%202%204%202H9.25'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='6.35'%20x2='10.35'%20y2='6.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3cline%20x1='5.65'%20y1='9.35'%20x2='8.35'%20y2='9.35'%20stroke='%23055AFF'%20stroke-width='1.3'%20stroke-linecap='round'/%3e%3c/svg%3e",Ke="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_4199_8826)'%3e%3cpath%20d='M15.5554%2012.4444C14.9626%2013.0373%2014.6666%2013.6293%2014.6666%2014.2222C14.6666%2014.8151%2014.9626%2015.4071%2015.5554%2016C14.9626%2015.4071%2014.3706%2015.1111%2013.7777%2015.1111C13.1848%2015.1111%2012.5928%2015.4071%2011.9999%2016C12.5928%2015.4071%2012.8888%2014.8151%2012.8888%2014.2222C12.8888%2013.6293%2012.5928%2013.0373%2011.9999%2012.4444C12.5928%2013.0373%2013.1848%2013.3333%2013.7777%2013.3333C14.3706%2013.3333%2014.9626%2013.0373%2015.5554%2012.4444ZM14.6488%204.01778C15.1905%204.55954%2015.4948%205.29431%2015.4948%206.06044C15.4948%206.82658%2015.1905%207.56135%2014.6488%208.10311L7.735%2015.0169C7.46766%2015.2892%207.14901%2015.5058%206.79746%2015.6543C6.44592%2015.8028%206.06844%2015.8801%205.68684%2015.8819C5.30523%2015.8836%204.92706%2015.8097%204.57417%2015.6645C4.22127%2015.5193%203.90065%2015.3056%203.63081%2015.0357C3.36097%2014.7659%203.14727%2014.4453%203.00205%2014.0924C2.85682%2013.7395%202.78295%2013.3613%202.7847%2012.9797C2.78646%2012.5981%202.8638%2012.2206%203.01226%2011.8691C3.16072%2011.5176%203.37736%2011.1989%203.64967%2010.9316L3.95545%2010.6249L3.85145%2010.5244C3.30922%2010.0267%202.76522%209.77778%202.22211%209.77778C1.62923%209.77778%201.03722%2010.0738%200.444336%2010.6667C1.03722%2010.0738%201.33322%209.48178%201.33322%208.88889C1.33322%208.296%201.03722%207.704%200.444336%207.11111C1.03722%207.704%201.62923%208%202.22211%208C2.815%208%203.407%207.704%203.99989%207.11111C3.407%207.704%203.111%208.296%203.111%208.88889C3.111%209.46667%203.39278%2010.0444%203.95545%2010.6222L10.5634%204.01778C11.1052%203.47606%2011.84%203.17173%2012.6061%203.17173C13.3723%203.17173%2014.107%203.47606%2014.6488%204.01778ZM9.55189%206.91378L4.59189%2011.8738C4.30004%2012.1655%204.13603%2012.5612%204.13594%2012.9739C4.1359%2013.1782%204.17611%2013.3806%204.25426%2013.5694C4.33242%2013.7582%204.44699%2013.9297%204.59145%2014.0742C4.7359%2014.2187%204.9074%2014.3334%205.09617%2014.4116C5.28493%2014.4898%205.48725%2014.5301%205.69158%2014.5302C6.10424%2014.5303%206.50004%2014.3664%206.79189%2014.0747L11.7519%209.11378L9.55189%206.91378ZM11.5066%204.96089L10.495%205.97156L12.695%208.17156L13.7057%207.16C13.9846%206.86582%2014.1377%206.47437%2014.1323%206.069C14.1269%205.66364%2013.9635%205.27639%2013.6768%204.98973C13.3902%204.70306%2013.0029%204.53964%2012.5976%204.53425C12.1922%204.52887%2011.8007%204.68194%2011.5066%204.96089ZM9.59545%200C8.85589%200.740444%208.48434%201.48178%208.48434%202.22222C8.48434%202.96267%208.85589%203.704%209.59545%204.44444C8.85589%203.704%208.11456%203.33333%207.37322%203.33333C6.63367%203.33333%205.89234%203.704%205.151%204.44444C5.89234%203.704%206.26211%202.96267%206.26211%202.22222C6.26211%201.48178%205.89322%200.740444%205.15189%200C5.89322%200.740444%206.63456%201.11111%207.37411%201.11111C8.11545%201.11111%208.85678%200.740444%209.59634%200H9.59545Z'%20fill='%23055AFF'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_4199_8826'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",{confirm:Je}=Ee,Pe='<template key="type" placeholder="\u8F93\u5165\u8868\u683C\u7C7B\u578B"></template>\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86<template key="scene" placeholder="\u8F93\u5165\u573A\u666F\u540D\u79F0"></template>\u573A\u666F\u7684\u6570\u636E,\u5305\u542B<template key="primary_key" placeholder="\u4E3B\u8981\u5B57\u6BB5(\u53EF\u5199\u591A\u4E2A,\u7528\u987F\u53F7\u5206\u9694)"></template>\u7B49\u4E3B\u8981\u5B57\u6BB5,\u652F\u6301\u7528\u6237\u67E5\u8BE2<template key="search_direction" placeholder="\u5927\u6982\u4ECB\u7ECD\u9700\u8981\u67E5\u8BE2\u7684\u65B9\u5411"></template>\u95EE\u9898,\u5982\u679C\u8BBE\u8BA1\u591A\u8868\u5173\u8054\u67E5\u8BE2,\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7<template key="key_name" placeholder="\u5B57\u6BB5\u540D\u79F0"></template>\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A<template key="table_name" placeholder="\u8868\u683C\u540D\u79F0"></template>\u8868\u683C\u3002',Qe=({drawerTitle:s,drawerVisible:A,tableInfo:d,handleDrawerClose:F,optimizeDesc:p,eventsEmit:m})=>{const S=P(()=>(d==null?void 0:d.data.find(o=>o.columnId=="name").value)||"-",[d]),[K,f]=E(""),[M,Y]=E(null),[V,g]=E(""),[C,U]=E(0),[Z,H]=E(!1),[a,t]=E(!1);Ae(()=>{const o=(d==null?void 0:d.data.find(N=>N.columnId=="description").value)||"-";g(o)},[d]);const r=()=>{Je({title:"\u4F60\u786E\u5B9A\u8981\u4F7F\u7528\u6A21\u677F\u5417\uFF1F",content:"\u8FD9\u5C06\u66FF\u6362\u4F60\u5F53\u524D\u5DF2\u586B\u5199\u7684\u5185\u5BB9\uFF0C\u4E14\u65E0\u6CD5\u64A4\u9500\u3002",okText:"\u786E\u8BA4\u66FF\u6362",cancelText:"\u53D6\u6D88",onOk(){g(Pe),U(o=>o+1)},onCancel(){console.log("Cancel")}})},i=O(o=>{f(o),console.log("\u6A21\u7248\u5185\u5BB9\u53D8\u5316:",o)},[]),h=O(o=>{Y(()=>o),console.log("getData\u51FD\u6570\u5DF2\u8BBE\u7F6E")},[]),b=async()=>{try{H(!0);const o=await p(d.tableId);o&&(g(o),U(N=>N+1),H(!1))}catch{W.error("AI \u4F18\u5316\u5931\u8D25")}},z=O(()=>{if(!M){console.error("getData\u51FD\u6570\u5C1A\u672A\u51C6\u5907\u597D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");return}const o=M("pure_string");m("table_info:update",o)},[M,m]);return k(ve,{title:s,placement:"right",width:720,onClose:F,closeIcon:!1,extra:u(fe,{size:20,color:"#888888",onClick:F,className:"cursor-pointer"}),open:A,destroyOnHidden:!0,footer:u("div",{className:"flex items-center",style:{justifyContent:"end"},children:k("div",{className:"flex self-end gap-3",children:[u($,{mode:"default",style:{marginRight:10},label:"\u53D6\u6D88",onClick:F}),u($,{mode:"primary",label:"\u786E\u8BA4",onClick:()=>z(),disabled:Z})]})}),children:[u("div",{className:"mb-[10px] font-bold",children:S}),k("div",{className:"mb-[10px]",children:[u("span",{style:{color:"#FF3B30",marginRight:"4px"},children:"*"}),u("span",{children:"\u6570\u636E\u8868\u63CF\u8FF0"}),u("span",{className:"text-[#888888] ml-[4px]",children:"(\u8BF7\u51C6\u786E\u586B\u5199\u8868\u683C\u7684\u5E94\u7528\u573A\u666F\u63CF\u8FF0\uFF0C\u5927\u6A21\u578B\u5C06\u4F9D\u8D56\u6B64\u4FE1\u606F\u8BC6\u522B\u5E76\u6B63\u786E\u8C03\u7528\u8BE5\u6570\u636E\u8868\u3002)"})]}),u(we,{data:V,onChange:i,onGetData:h,styles:{theme:{colors:{primary:"#0969da",secondary:"#6b7280",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6",background:"#ffffff",text:"#1f2937",border:"#e5e7eb",disabled:"#9ca3af",disabledBackground:"#f3f4f6",disabledText:"#6b7280",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)",appBackground:"transparent",listBackground:"#f9fafb",dashboardBackground:"#ffffff",textSecondary:"#6b7280"},space:{sidebar:"260px",size:"12px",radius:"8px",padding:"1rem",margin:"1rem",shadow:"0 2px 8px rgba(0,0,0,0.1)",lineHeight:"1.8"},icons:{},fonts:{body:{size:"14px",weight:"normal",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"},heading:{size:"14px",weight:"600",family:"PingFang SC, Microsoft YaHei, Arial, sans-serif"}},others:{baseFontWeight:"normal"}},templateField:{backgroundColor:"#E5EEFF",borderColor:"#84ADFF",borderRadius:"6px",padding:"6px 12px",margin:"2px",fontSize:"14px",fontWeight:"500",minWidth:"80px",textColor:"#84ADFF"}}},C),k("div",{children:[u($e,{open:a,onOpenChange:o=>t(!!o),content:u("div",{style:{width:"600px",margin:"10px",padding:"10px"},onClick:r,className:"hover:bg-gray-100 h-[80px] cursor-pointer rounded",children:"______\u8868\u683C\u4E3B\u8981\u5C55\u793A\u4E86______\u573A\u666F\u7684\u6570\u636E\uFF0C\u5305\u542B______\u3001______\u3001______\u7B49\u4E3B\u8981\u5B57\u6BB5\uFF0C\u652F\u6301\u7528\u6237\u67E5\u8BE2______\u95EE\u9898(\u5927\u6982\u4ECB\u7ECD)\u5982\u679C\u6D89\u53CA\u591A\u8868\u5173\u8054\u67E5\u8BE2\uFF0C\u6700\u597D\u8BF4\u660E\u6B64\u8868\u683C\u901A\u8FC7______\u5B57\u6BB5\u53EF\u4EE5\u5173\u8054\u53E6\u4E00\u4E2A______\u8868\u683C\u3002"}),title:k("div",{className:"flex justify-between items-center",style:{margin:"10px"},children:[u("div",{className:"text-[16px]",children:"\u6A21\u7248"}),u(fe,{size:20,color:"#888888",onClick:()=>t(!1),className:"cursor-pointer"})]}),trigger:"click",destroyOnHidden:!0,placement:"bottomRight",getPopupContainer:o=>o,children:u("span",{children:u($,{mode:"text",icon:u("img",{src:Xe}),children:"\u4F7F\u7528\u6A21\u7248"})})}),u($,{onClick:b,mode:"text",icon:u("img",{src:Ke}),loading:Z,children:"AI\u4F18\u5316"})]})]})},eu=""+new URL("assets/empty.png",import.meta.url).href;var G=(s=>(s[s.DATE=0]="DATE",s[s.VIEW=1]="VIEW",s[s.ERROR=2]="ERROR",s[s.AUTHORIZE=3]="AUTHORIZE",s[s.DELETE=4]="DELETE",s[s.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",s[s.DOWNLOAD=6]="DOWNLOAD",s[s.EDIT=7]="EDIT",s[s.ADD=8]="ADD",s[s.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",s[s.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",s))(G||{}),Ce=(s=>(s.GENERATING="generating",s.SUCCESS="success",s.FAIL="fail",s))(Ce||{});const de={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},uu=s=>typeof s=="string"&&s in de?de[s]:de.default,Fe=s=>{const{value:A,cell:d}=s;switch(d.columnId){case"importstatus":return A?u(me,{title:"\u6709\u8FFD\u52A0\u5931\u8D25\u7684\u6587\u4EF6\uFF0C\u8BF7\u53CA\u65F6\u5904\u7406",children:u(Re,{color:"red",bordered:!1,children:"\u8FFD\u52A0\u5931\u8D25"})}):u(ge,{});case"status":const F=uu(s.cell.statusType);return A=="\u5BFC\u5165\u5931\u8D25"?u(me,{title:d.errorMsg,children:k("div",{className:"flex items-center gap-2",children:[u(ye,{color:F,text:A}),u(ke,{size:14,color:"red"})]})}):u(ye,{color:F,text:A});default:return u(ge,{})}},be=[{statusType:"success",value:"\u5BFC\u5165\u6210\u529F",status:"30"},{statusType:"error",value:"\u5BFC\u5165\u5931\u8D25",status:"00"},{statusType:"default",value:"\u5F85\u5BFC\u5165",status:"10"},{statusType:"processing",value:"\u5BFC\u5165\u4E2D",status:"20"},{statusType:"processing",value:"\u5BFC\u5165\u4E2D",status:"11"}],tu=s=>{var F,p;const{cell:A,value:d}=s;return typeof d=="string"?u("div",{title:d,style:{maxWidth:240,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:d}):(F=A.tableMeta)!=null&&F.isGenDescription&&((p=A.tableMeta)==null?void 0:p.generateDescriptionStatus)=="generating"?k("div",{className:"flex items-center gap-1 text-[#84ADFF]",style:{color:"#84ADFF"},children:[u("span",{children:"\u751F\u6210\u4E2D"}),u(Ze,{size:14})]}):"-"},au=({dbInfo:s,setDrawerTitle:A,setDrawerVisible:d,getBtnDisabled:F})=>k("div",{className:"flex flex-col items-center justify-center h-full",children:[u("div",{className:"text-xl font-semibold mb-3",children:u("img",{src:eu,width:120})}),u("div",{className:"text-base mb-2",style:{color:"#888888"},children:"\u6682\u65E0\u6570\u636E\u6587\u4EF6"}),u("div",{className:"flex gap-3",children:u($,{mode:"primary",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",disabled:F&&F(8,s==null?void 0:s.permission),onClick:()=>{A("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),d(!0)}})})]}),{confirm:Be}=Ee,bu=ze((s,A)=>{const{url:d,token:F,role:p,id:m,dbType:S,CustomComponents:K,getBtnDisabled:f,uploadUrl:M}=s,[Y,V]=E({container:"ready",content:"ready"}),g=pe(null),C=pe(null),[U,Z]=E(),[H,a]=E({}),[t,r]=E(),[i,h]=E(!1),[b,z]=E(""),[o,N]=E(),[X,q]=E(!1),[j,ae]=E(""),{getTableList:se,delTableById:ie,delFileById:J,updateTableInfo:re,optimizeDesc:Q,getTableTreeList:ee,reParseFile:ue,getDBDetailById:oe}=Ie({url:d,token:F,role:p,eventsEmit:s.eventsEmit});Ae(()=>(m&&S&&(V(l=>({...l,container:"loading"})),te()),()=>{C.current&&(clearTimeout(C.current),C.current=null)}),[m,S]);const te=async()=>{try{const l=await oe(m,S);l&&(r(l),V(e=>({...e,container:"ready",content:"loading"})))}catch(l){console.log("[TableApiError] getDBInfo:",l)}await R()};Le(A,()=>({getDatabaseDetail:te}));const le=async()=>{try{if(S=="DirectDB"){const l=await se(m);if(l){const e=c(l);return Z(e||[]),V(L=>({...L,content:"ready"})),e||[]}else V(e=>({...e,content:"error"}))}else{const l=await ee(m);if(l){const e=ne(l);return Z(e||[]),V(L=>({...L,content:"ready"})),e||[]}else V(e=>({...e,content:"error"}))}}catch(l){console.log("[TableApiError] getTableList:",l)}};function ne(l){return(l||[]).map((e,L)=>{var D,v;let y=be.find(B=>B.status==e.status);const w=e.children.some(B=>B.status=="00");return{id:e.fileId.toString(),tableId:e.tableId,data:[{columnId:"name",value:(e==null?void 0:e.originalFilename)||"-",type:"label"},{columnId:"description",value:(D=e==null?void 0:e.tableMeta)==null?void 0:D.description,type:"customized",tableMeta:e==null?void 0:e.tableMeta},{columnId:"count",value:`${e.rowCount}\u884C\uFF0C${e.columnCount}\u5217`,type:"text"},{columnId:"status",...y,type:"customized",errorMsg:e.errorMsg},{columnId:"importstatus",value:w,type:"customized"},{columnId:"createdAt",value:e.gmtCreate,type:"date"},{columnId:"updatedAt",value:e.gmtModified,type:"date"},...e.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:f&&f(G.VIEW,e.permission)},{columnId:"actions",value:"edit",label:"\u4FEE\u6539\u914D\u7F6E",type:"action",disabled:f&&f(G.EDIT,e.permission)},{columnId:"actions",value:"addData",label:"\u8FFD\u52A0\u6570\u636E",type:"action",disabled:f&&f(G.EDIT,e.permission)}]:[],...e.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action"}]:[],{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action",disabled:f&&f(G.DELETE,e.permission)}],expanded:!1,...e.children&&((v=e.children)==null?void 0:v.length)>0&&{children:[...(e.children||[]).map(B=>{const Te=be.find(Me=>Me.status==B.status),Se=[{columnId:"name",value:B.originalFilename,type:"text"},{columnId:"count",value:`${B.rowCount}\u884C\uFF0C${B.columnCount}\u5217`,type:"text"},{columnId:"status",...Te,errorMsg:B.errorMsg,type:"customized"},{columnId:"createdAt",value:B.gmtCreate,type:"date"},{columnId:"updatedAt",value:B.gmtModified,type:"date"},...B.status=="30"?[{columnId:"actions",value:"view",label:"\u67E5\u770B",type:"action",disabled:f&&f(G.VIEW,B.permission)}]:[],...B.status=="00"?[{columnId:"actions",value:"reValidate",label:"\u91CD\u65B0\u5BFC\u5165",type:"action",disabled:f&&f(G.ADD,B.permission)}]:[],{columnId:"actions",value:"delete_sub",label:"\u5220\u9664",type:"action",disabled:f&&f(G.DELETE,B.permission)}];return{id:B.fileId.toString(),tableId:B.tableId,data:Se}})]}}})}function c(l){return(l||[]).map((e,L)=>({id:e.id||_e(8),data:[{columnId:"name",value:e.physicalName},{columnId:"cnname",value:e.businessName},{columnId:"colcount",value:e.columnCount},{columnId:"count",value:`${e.rowCount}\u884C\uFF0C${e.columnCount}\u5217`},{columnId:"actions",value:"view",label:"\u67E5\u770B",disabled:f&&f(G.VIEW,e.permission)}]}))}async function n(l,e,L){switch(console.log("[adopter] mergedEventsEmit",l,e,L),l){case"table_action_delete":{try{if(console.log("[delete] \u5220\u9664\u4E8B\u4EF6\u6570\u636E:",e),!e||!e.tableId&&!e.id){console.error("[delete] \u5220\u9664\u4E8B\u4EF6\u6570\u636E\u4E0D\u5B8C\u6574:",e),W.error("\u5220\u9664\u5931\u8D25\uFF1A\u6570\u636E\u4E0D\u5B8C\u6574");return}const y=e.tableId||e.id,w=e.id;Be({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",content:"\u8BE5\u6570\u636E\u8868\u53CA\u5176\u8FFD\u52A0\u6570\u636E\u90FD\u5C06\u88AB\u5220\u9664\u4E14\u65E0\u6CD5\u6062\u590D",icon:u(ke,{color:"#FF4D4F",className:"mr-[8px]"}),okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await ie(y,S)&&(g!=null&&g.current)?(g==null||g.current.appFn.removeItem(w),W.success("\u5220\u9664\u6210\u529F")):W.error("\u5220\u9664\u5931\u8D25")}})}catch(y){console.error("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25:",y),W.error("\u5220\u9664\u5931\u8D25")}break}case"table_action_edit":{ae("\u4FEE\u6539\u6570\u636E\u914D\u7F6E"),q(!0),N(e);break}case"toolbar_upload":{z("\u4E0A\u4F20\u6570\u636E\u6587\u4EF6"),h(!0);break}case"table_action_addData":{z("\u8FFD\u52A0\u6570\u636E"),h(!0),N(e);break}case"table_action_reValidate":{await ue(e.id)&&(C.current&&(clearTimeout(C.current),C.current=null),await R());break}case"table_info:update":{try{if(o!=null&&o.id){const y=(o==null?void 0:o.data.find(D=>D.columnId=="name").value)||"-";if(await re({tableId:o.tableId,description:e,businessName:y})&&(g!=null&&g.current)){const D={...o,data:o.data.map(v=>v.columnId=="description"?{...v,value:e}:v)};g==null||g.current.appFn.updateItem(D,o.id),W.success("\u4FEE\u6539\u914D\u7F6E\u6210\u529F")}}}catch(y){console.error("\u4FEE\u6539\u914D\u7F6E\u5931\u8D25",y)}finally{_()}break}case"table_action_delete_sub":{try{Be({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){const{id:y,tableId:w}=e;await J(e.id)&&(g!=null&&g.current)&&(a(v=>({...v,[w]:[...v[w]||[],y]})),e.data.find(v=>v.status=="00")&&(C.current&&(clearTimeout(C.current),C.current=null),R()),L.removeItem(y,w),W.success("\u8FFD\u52A0\u6587\u4EF6\u6570\u636E\u5220\u9664\u6210\u529F"))}})}catch{console.log("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25")}break}case"toolbar_auth":{typeof s.eventsEmit=="function"&&s.eventsEmit("toolbar_auth",t);break}default:typeof s.eventsEmit=="function"&&s.eventsEmit(l,e);break}}const I=P(()=>({label:"\u6570\u636E\u8868\u7BA1\u7406",model:null,defaultActiveId:"direct-table-view",views:[{label:"\u6211\u7684\u6570\u636E\u5E93",id:"direct-table-view",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,columns:[{id:"name",title:"\u6570\u636E\u8868\u82F1\u6587\u540D\u79F0",type:"label"},{id:"cnname",title:"\u6570\u636E\u8868\u4E2D\u6587\u540D\u79F0",type:"label"},{id:"colcount",title:"\u5B57\u6BB5\u6570",type:"text"},{id:"count",title:"\u6570\u636E\u91CF",type:"text"},{id:"actions",title:"\u64CD\u4F5C",type:"action"}],toolbar:[{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",searchKeys:["name","description"],position:"right"},{type:"button",key:"auth",label:"\u914D\u7F6E",btnType:"default",position:"right"}]}]}),[U,S]),x=P(()=>({label:"\u6570\u636E\u8868\u7BA1\u7406",model:null,defaultActiveId:"data-table-view",views:[{label:"\u4E0A\u4F20\u6570\u636E\u5217\u8868",id:"data-table-view",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,columns:[{id:"name",title:"\u6587\u4EF6\u540D",type:"label",tip:"\u6587\u4EF6\u540D"},{id:"description",title:"\u63CF\u8FF0",type:"customized",component:u(tu,{}),helpText:"\u6253\u5F00\u81EA\u52A8\u751F\u6210\u63CF\u8FF0\u5F00\u5173\u540E\uFF0C\u82E5\u63CF\u8FF0\u672A\u6B63\u5E38\u751F\u6210\uFF0C\u5219\u63CF\u8FF0\u5185\u5BB9\u4E3A\u7A7A\uFF0C\u5982\u60A8\u4ECD\u7136\u9700\u8981\u63CF\u8FF0\uFF0C\u5219\u9700\u8981\u624B\u52A8\u6DFB\u52A0"},{id:"count",title:"\u6570\u636E\u91CF",type:"text",tip:"\u6570\u636E\u91CF"},{id:"status",title:"\u5BFC\u5165\u72B6\u6001",type:"customized",component:u(Fe,{})},{id:"importstatus",title:"\u8FFD\u52A0\u63D0\u793A",type:"customized",component:u(Fe,{})},{id:"createdAt",title:"\u521B\u5EFA\u65F6\u95F4",type:"date",tip:"\u521B\u5EFA\u65F6\u95F4"},{id:"updatedAt",title:"\u66F4\u65B0\u65F6\u95F4",type:"date",tip:"\u66F4\u65B0\u65F6\u95F4"},{id:"actions",title:"\u64CD\u4F5C",type:"action"}],toolbar:[{type:"button",key:"upload",label:"\u4E0A\u4F20\u6570\u636E\u6587\u4EF6",btnType:"primary",disabled:f&&f(G.ADD,t==null?void 0:t.permission),icon:u(Ue,{size:12})},{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",searchKeys:["name","description",["name"]],position:"right"},{type:"button",key:"auth",label:"\u914D\u7F6E",btnType:"default",position:"right"}]}],subTableConfig:{type:"table",allowMultiSelect:!1,viewBehavior:"pagination",viewPageSize:5,columns:[{title:"\u8FFD\u52A0\u6587\u4EF6\u540D",id:"name",type:"text",tip:"\u8FFD\u52A0\u6587\u4EF6\u540D"},{title:"\u6570\u636E\u91CF",id:"count",type:"text",tip:"\u6570\u636E\u91CF"},{id:"status",title:"\u5BFC\u5165\u72B6\u6001",type:"customized",tip:"\u5BFC\u5165\u72B6\u6001",component:u(Fe,{})},{title:"\u521B\u5EFA\u65F6\u95F4",id:"createdAt",type:"date",tip:"\u521B\u5EFA\u65F6\u95F4"},{title:"\u66F4\u6539\u65F6\u95F4",id:"updatedAt",type:"date",tip:"\u66F4\u6539\u65F6\u95F4"},{title:"\u64CD\u4F5C",id:"actions",type:"action"}]},subTablePendingIds:H,onSubTableRowAnimationComplete:(l,e)=>{a(L=>({...L,[l]:(L[l]||[]).filter(y=>y!==e)}))}}),[H,U,S,t]),_=l=>{h(!1),q(!1),N(void 0),l=="refresh"&&(C.current&&(clearTimeout(C.current),C.current=null),R())};function T(l){var e,L;if(!Array.isArray(l))return!0;for(const y of l){if(y.data){const w=y.data.find(v=>v.columnId==="status"),D=y.data.find(v=>v.columnId==="description");if(console.log("+++++",w.status==="20"||w.status==="11"||((e=D==null?void 0:D.tableMeta)==null?void 0:e.generateDescriptionStatus)==Ce.GENERATING),w&&(w.status==="20"||w.status==="11"||((L=D==null?void 0:D.tableMeta)==null?void 0:L.generateDescriptionStatus)==Ce.GENERATING))return!1}if(Array.isArray(y.children)){for(const w of y.children)if(w.data){const D=w.data.find(v=>v.columnId==="status");if(D&&(D.status==="20"||D.status==="11"))return!1}}}return!0}const R=async()=>{const l=await le();T(l||[])?C.current&&(clearTimeout(C.current),C.current=null):(C.current&&(clearTimeout(C.current),C.current=null),C.current=setTimeout(()=>{R()},5e3))};return k(He,{title:t==null?void 0:t.name,description:(t==null?void 0:t.description)||"-",goBack:()=>{var l;(l=s.eventsEmit)==null||l.call(s,"goBack",{})},children:[u(xe,{dataSource:U,ref:g,eventsEmit:n,status:Y,styles:{theme:{...he,colors:{...he.colors,tableFirstColumnBg:"#ffffff",tableLastColumnBg:"#ffffff",paginationBackground:"#ffffff",subTableBackground:"#F5F5F5",tableHeaderBg:"#F5F5F5"}},mode:"light"},CustomComponents:{EmptyData:()=>u(au,{dbInfo:t,setDrawerTitle:z,setDrawerVisible:h,getBtnDisabled:f}),...K},...S=="DataTable"?x:I}),u(Ye,{drawerTitle:b,drawerVisible:i,handleDrawerClose:_,dbId:m,token:F,url:d,uploadUrl:M,role:p,tableInfo:o}),u(Qe,{drawerTitle:j,drawerVisible:X,handleDrawerClose:_,tableInfo:o,optimizeDesc:Q,eventsEmit:n})]})});export{bu as default};
package/index.js CHANGED
@@ -1 +1 @@
1
- import{DrawerType as B}from"./chat.js";import{C as R}from"./assets/index-C_tt8KnS.js";import"./database.js";import"./databaseId.js";import"./databaseTable.js";import"react/jsx-runtime";import"react";import"./modelManage.js";import"./sensitive.js";import{G as W,B as b}from"./assets/GientechStreamReader-C8rYtUxB.js";import"./assets/index-pbEQPM5Z.js";import{F as q}from"./assets/index-8h59dJlj.js";import"./assets/index-C9ax6WsW.js";import"react-dom";import"./assets/index-CtPe9ln8.js";import"./assets/index-C6WKbL3A.js";import"./assets/index-CVis9Agw.js";import"./assets/index-CpW6Dhpp.js";import"./assets/plus-CnVxGdOo.js";import"./assets/x-CmbLQ9dc.js";import"./assets/index-DoUk2Ei_.js";import"./assets/index-B-AFa3n1.js";/* empty css *//* empty css */import"./assets/index-BN3yu4iN.js";import"./assets/index-BdNcL3V6.js";import"./assets/index-w1SriKuR.js";import"./assets/triangle-alert-BycMPaz2.js";export{R as ChatCompareComponent,B as DrawerType,W as GientechStreamReader,q as defaultTheme,b as registerPDFWorker};
1
+ import{DrawerType as B}from"./chat.js";import{C as R}from"./assets/index-C_tt8KnS.js";import"./database.js";import"./databaseId.js";import"./databaseTable.js";import"react/jsx-runtime";import"react";import"./modelManage.js";import"./sensitive.js";import{G as W,B as b}from"./assets/GientechStreamReader-C8rYtUxB.js";import"./assets/index-Cbz7IFQk.js";import{F as q}from"./assets/index-8h59dJlj.js";import"./assets/index-C9ax6WsW.js";import"react-dom";import"./assets/index-CtPe9ln8.js";import"./assets/index-C6WKbL3A.js";import"./assets/index-CVis9Agw.js";import"./assets/index-CpW6Dhpp.js";import"./assets/plus-CnVxGdOo.js";import"./assets/x-CmbLQ9dc.js";import"./assets/index-DoUk2Ei_.js";import"./assets/index-B-AFa3n1.js";/* empty css *//* empty css */import"./assets/index-BN3yu4iN.js";import"./assets/index-BdNcL3V6.js";import"./assets/index-w1SriKuR.js";import"./assets/triangle-alert-BycMPaz2.js";export{R as ChatCompareComponent,B as DrawerType,W as GientechStreamReader,q as defaultTheme,b as registerPDFWorker};
package/modelManage.js CHANGED
@@ -1 +1 @@
1
- import{jsx as o,jsxs as V}from"react/jsx-runtime";import{useState as h,useMemo as O,useRef as Q,useEffect as re}from"react";import{J as L,N as ve}from"./assets/index-CtPe9ln8.js";import{a as Ie,b as _,S as te,T as ee,F as se}from"./assets/index-8h59dJlj.js";import{O as ne}from"./assets/index-w1SriKuR.js";import{D as we}from"./assets/index-BN3yu4iN.js";import{X as xe}from"./assets/x-CmbLQ9dc.js";import{M as ce,s as j}from"./assets/index-DoUk2Ei_.js";import{T as ke}from"./assets/triangle-alert-BycMPaz2.js";/* empty css *//* empty css */import{P as Le}from"./assets/plus-CnVxGdOo.js";import{B as ae}from"./assets/index-BdNcL3V6.js";import"react-dom";const Se=""+new URL("assets/empty.png",import.meta.url).href,Re=({url:s,token:B,role:n,eventsEmit:p})=>{const m=Ie.create({baseURL:s,timeout:1e6});return m.interceptors.request.use(e=>{let a=B;return!a&&!["user/login","user/kaptcha","user/regist"].some(l=>e.url.includes(l))?(p&&p("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=a||"",e.headers.userName=n==="\u672A\u767B\u5F55\u7528\u6237"?"":n,e)}),m.interceptors.response.use(e=>{const a=["user/kaptcha"],u=e.data;if(a.some(x=>e.config.url&&e.config.url.includes(x))||u.size&&u.type)return u;const{success:l,errorMsg:g,errorCode:k}=u;return l?u:(p&&p("request:error_business",{errorCode:k,errorMsg:g||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:u}),!1)},e=>{var a,u,l,g,k,x,T,W,q;if(e.message==="canceled")return Promise.reject(e);if(p){let I="request:error_network",U={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:e};((a=e==null?void 0:e.response)==null?void 0:a.status)===401?(I="request:error_auth",U={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:e,redirect:"/login"}):(((l=(u=e==null?void 0:e.response)==null?void 0:u.data)==null?void 0:l.errorCode)==="30013"||((k=(g=e==null?void 0:e.response)==null?void 0:g.data)==null?void 0:k.errorCode)==="30023")&&(I="request:error_business",U={errorCode:(T=(x=e==null?void 0:e.response)==null?void 0:x.data)==null?void 0:T.errorCode,errorMsg:((q=(W=e==null?void 0:e.response)==null?void 0:W.data)==null?void 0:q.message)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:e}),p(I,U)}return Promise.reject(e)}),{getModelList:async e=>{try{const a=await m.get(`/allPage?${new URLSearchParams(e).toString()}`),{success:u,data:l}=a;if(u)return l}catch(a){return console.log("getModelList error:",a),!1}},delModelById:async e=>{try{const a=await m.delete(`/delete?id=${e}`),{success:u,data:l}=a;if(u)return l}catch(a){console.log("delModelById error:",a)}},createModel:async e=>{try{const a=await m.post("/create",e),{success:u,data:l}=a;if(u)return l}catch(a){console.log("createModel error:",a)}},updateModelById:async e=>{try{const a=await m.put("/update",e),{success:u,data:l}=a;if(u)return l}catch(a){console.log("updateModelById error:",a)}},getUseTypeList:async()=>{try{const e=await m.get("/getModelTypes"),{success:a,data:u}=e;if(a)return u}catch(e){return console.log("getUseTypeList error:",e),!1}},getModelProtocolsList:async()=>{try{const e=await m.get("/getModelProtocols"),{success:a,data:u}=e;if(a)return u}catch(e){return console.log("getModelProtocolsList error:",e),!1}},testStatus:async()=>{try{const e=await m.post("/check"),{success:a,data:u}=e;if(a)return u}catch(e){console.log("testStatus error:",e)}},replaceModel:async(e,a)=>{try{const u=await m.get(`/replaceModel?sourceModelId=${e}&targetModelId=${a}`),{success:l,data:g}=u;if(l)return g}catch(u){console.log("replaceModel error:",u)}},checkModel:async e=>{try{const a=await m.get(`/checkModelReference?modelName=${e}`),{success:u,data:l}=a;if(u)return l}catch(a){console.log("checkModelReference error:",a)}}}},Te=({drawerTitle:s,drawerVisible:B,modelInfo:n,handleDrawerClose:p,modelUseTypeOpt:m,modelProtocolsOpt:S,eventsEmit:i})=>{const[v,R]=h(!1),[z,c]=h(!1),f=O(()=>({id:"config-model",layout:"vertical",formWidth:"550px",fields:[{id:"modelName",name:"modelName",label:"\u6A21\u578B\u540D\u79F0",type:"input",required:!0,placeholder:"\u8BF7\u8F93\u5165\u6A21\u578B\u540D\u79F0",counter:30},{id:"modelIde",name:"modelIde",label:"\u6A21\u578BID",type:"input",required:!0,placeholder:"\u8BF7\u8F93\u5165\u6A21\u578BID",defaultValue:""},{id:"apiKey",name:"apiKey",label:"APIKey",type:"input",required:!1,placeholder:"\u8BF7\u8F93\u5165APIKey",defaultValue:""},{id:"url",name:"url",label:"\u8BF7\u6C42URL",type:"input",required:!0,placeholder:"\u8BF7\u8F93\u5165\u8BF7\u6C42URL",defaultValue:""},{id:"modelProtocol",name:"modelProtocol",label:"\u6A21\u578B\u4F20\u8F93\u534F\u8BAE",type:"select",required:!0,options:S},{id:"type",name:"type",label:"\u4F7F\u7528\u7C7B\u578B",type:"select",required:!0,options:m,defaultValue:1},{id:"maxTokens",name:"maxTokens",label:"\u4E0A\u4E0B\u6587\u957F\u5EA6",type:"slider",range:{max:1e5,min:200},step:1,sliderInline:!0,required:!0,helpText:"\u8BF7\u5411\u6A21\u578B\u90E8\u7F72\u6216\u8FD0\u7EF4\u4EBA\u5458\u786E\u8BA4\u5F53\u524D\u6A21\u578B\u7684\u6700\u5927\u4E0A\u4E0B\u6587\u957F\u5EA6\uFF08Max Tokens / Context Length\uFF09\uFF0C\u5E76\u786E\u8BA4\u63A8\u7406\u670D\u52A1\uFF08\u5982 vLLM\uFF09\u662F\u5426\u914D\u7F6E\u4E86\u989D\u5916\u7684\u8F93\u5165\u957F\u5EA6\u9650\u5236"},{id:"dec",name:"dec",label:"\u8BF4\u660E",type:"textarea",required:!1}]}),[n,m,S]),A=Q(null),E=async(u,l,g)=>{var k;switch(console.log("[Form] eventsEmit:",u,l,g),u){case"form:ready":l.formRef&&(A.current=l.formRef);break;case"form:change":if(!((k=A.current)!=null&&k.getValue)){console.log("\u8868\u5355\u5F15\u7528\u672A\u5C31\u7EEA\uFF0C\u8DF3\u8FC7 formdata_onchange \u4E8B\u4EF6");return}const x=await A.current.getValue("type");x==2||x==3?c(!0):c(!1),x==2&&A.current.setValues({maxTokens:512});break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",u,l)}i==null||i(u,l,g)},e=async()=>{try{R(!0);const u=await A.current.getAllData();u.isValid&&(n!=null&&n.id?await i("form_submitted_edit",u,void 0):await i("form_submitted_add",u,void 0))}catch(u){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",u)}finally{R(!1)}},a=O(()=>{const u=n==null?void 0:n.data.reduce((l,g)=>(l[g.columnId]=g.value,l),{});return console.log("====",u,n==null?void 0:n.data),{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:f.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:f.id,type:"form",size:"md",formWidth:f.formWidth,formConfig:{layout:f.layout,showReset:!1,showSubmit:!1,formWidth:f.formWidth}}],dataSource:[{id:f.id,fields:f.fields,defaultValues:u||{}}],eventsEmit:E}},[n,z,f]);return o(we,{title:s,placement:"right",width:560,onClose:p,closeIcon:!1,extra:o(xe,{size:20,color:"#888888",onClick:p,className:"cursor-pointer"}),open:B,destroyOnHidden:!0,footer:V("div",{className:"flex justify-end items-center gap-3",children:[o(L,{mode:"default",label:"\u53D6\u6D88",onClick:p}),o(L,{mode:"primary",label:"\u786E\u8BA4",loading:v,onClick:e})]}),children:o(ne,{...a},"example-form")})},{Item:oe}=_,Ve=({modelVisible:s,options:B,eventsEmit:n,replaceModel:p})=>{const[m,S]=h(!1),[i]=_.useForm(),v=_.useWatch("sourceModelId",i),R=O(()=>{const c=B.find(f=>f.value==v);return c?B.filter(A=>A.useType==c.useType&&A.value!==v&&A.status==1):[]},[v]);return re(()=>{v&&i.setFieldValue("targetModelId",void 0)},[v]),V(ce,{open:s,title:"\u6A21\u578B\u66FF\u6362",width:620,destroyOnHidden:!0,onCancel:()=>{i.resetFields(),n&&n("close_model")},footer:V("div",{className:"flex justify-end gap-3",style:{justifyContent:"end",margin:"20px 4px"},children:[o(L,{mode:"default",label:"\u53D6\u6D88",onClick:()=>{i.resetFields(),n&&n("close_model")}}),o(L,{mode:"primary",label:"\u786E\u8BA4",loading:m,onClick:async()=>{try{S(!0);const c=await i.validateFields(),{sourceModelId:f,targetModelId:A}=c;await p(f,A)&&(j.success("\u6A21\u578B\u66FF\u6362\u6210\u529F"),i.resetFields(),n&&n("replace_model"))}catch(c){console.log("e---->",c)}finally{S(!1)}}})]}),children:[V("div",{className:"flex gap-3",style:{margin:"20px 4px"},children:[o("div",{children:o(ke,{size:22,color:"#f4a02a"})}),o("span",{className:"text-[14px]",children:"\u5982\u9700\u66F4\u6362\u6A21\u578B\uFF0C\u5728\u4E00\u952E\u66FF\u6362\u65F6\uFF0C\u7CFB\u7EDF\u5C06\u81EA\u52A8\u66F4\u65B0\u77E5\u8BC6\u89E3\u6790\u914D\u7F6E\u3001\u68C0\u7D22\u6D4B\u8BD5\u548C\u52A9\u624B\u914D\u7F6E\u4E2D\u7684\u6A21\u578B\u3002\u82E5\u66FF\u6362\u7684\u662F\u6587\u6863\u89E3\u6790\u7528\u7684Embedding\u6A21\u578B\uFF0C\u5219\u4F7F\u7528\u8BE5\u6A21\u578B\u7684\u6587\u6863\u5C06\u5168\u90E8\u91CD\u65B0\u6392\u961F\u89E3\u6790\uFF0C\u72B6\u6001\u53D8\u4E3A\u201C\u89E3\u6790\u4E2D\u201D\uFF0C\u4E14\u672A\u89E3\u6790\u5B8C\u6210\u7684\u6587\u6863\u6682\u4E0D\u53EF\u68C0\u7D22\uFF01"})]}),V(_,{form:i,colon:!1,labelCol:{span:5},wrapperCol:{span:18},style:{margin:"40px 60px"},children:[o(oe,{label:"\u6A21\u578B\u540D\u79F0",name:"sourceModelId",rules:[{required:!0,message:""}],children:o(te,{placeholder:"\u8BF7\u9009\u62E9",options:B})}),o(oe,{label:"\u66FF\u6362\u4E3A",name:"targetModelId",rules:[{required:!0,message:""}],children:o(te,{placeholder:"\u8BF7\u9009\u62E9",options:R})})]})]})},X={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},J=[{statusType:"success",value:"\u53EF\u7528",status:1},{statusType:"error",value:"\u4E0D\u53EF\u7528",status:0},{statusType:"warning",value:"\u68C0\u6D4B\u4E2D",status:2}],ze=s=>typeof s=="string"&&s in X?X[s]:X.default;var K=(s=>(s[s.DATE=0]="DATE",s[s.VIEW=1]="VIEW",s[s.ERROR=2]="ERROR",s[s.AUTHORIZE=3]="AUTHORIZE",s[s.DELETE=4]="DELETE",s[s.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",s[s.DOWNLOAD=6]="DOWNLOAD",s[s.EDIT=7]="EDIT",s[s.ADD=8]="ADD",s[s.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",s[s.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",s))(K||{});const{confirm:le}=ce,qe={pageNum:1,pageSize:1e3},Ue=s=>{const{value:B,cell:n}=s,p=ze(s.cell.statusType);return B=="\u4E0D\u53EF\u7528"?o(ee,{title:n.errorMsg,children:o("div",{className:"flex items-center gap-2",children:o(ae,{color:p,text:B})})}):o(ae,{color:p,text:B})};function Qe(s){const{url:B,token:n,role:p,CustomComponents:m,eventsEmit:S,getBtnDisabled:i,showModelReplace:v}=s,[R,z]=h({container:"ready",content:"ready"}),c=Q(null),[f,A]=h(),E=Q(null),[e,a]=h(!1),[u,l]=h(!1),[g,k]=h([]),[x,T]=h(!1),[W,q]=h(""),[I,U]=h(),[Z,ie]=h([]),[P,de]=h([]),{getModelList:Fe,delModelById:me,createModel:pe,updateModelById:fe,getUseTypeList:ye,getModelProtocolsList:Ae,testStatus:Ee,replaceModel:ge,checkModel:Be}=Re({url:B,token:n,role:p,eventsEmit:S});re(()=>(z(r=>({...r,content:"loading"})),G(),be(),()=>{E.current&&(clearTimeout(E.current),E.current=null)}),[]);const De=r=>(r||[]).map((t,F)=>{let d=J.find(w=>w.status==t.status);return{id:t.id,data:[{columnId:"modelName",value:t.modelName},{columnId:"modelProtocol",value:t.modelProtocol,type:"customized"},{columnId:"type",value:t.type,type:"customized"},{columnId:"dec",value:t.dec},{columnId:"status",...d,type:"customized",errorMsg:t.errorMsg},{columnId:"actions",value:"edit",label:"\u7F16\u8F91",status:t.status,type:"action",disabled:i&&i(K.EDIT,t.permission)},{columnId:"actions",value:"auth",label:"\u6388\u6743",type:"action",status:t.status,disabled:i&&i(K.AUTHORIZE,t.permission)},{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action",status:t.status,disabled:i&&i(K.AUTHORIZE,t.permission)},{columnId:"url",value:t.url},{columnId:"apiKey",value:t.apiKey},{columnId:"modelIde",value:t.modelIde},{columnId:"thinking",value:t.thinking},{columnId:"maxTokens",value:t.maxTokens}]}}),be=async()=>{try{const[r,t]=await Promise.allSettled([ye(),Ae()]);r.status==="fulfilled"&&r.value&&ie((r.value||[]).map(F=>({...F,value:Number(F.value)}))),t.status==="fulfilled"&&t.value&&de((t.value||[]).map(F=>({...F,value:Number(F.value)})))}catch(r){console.error("[TableApiError] getTableList:",r)}},ue=async()=>{try{const r=await Fe(qe);if(r.records){const t=De(r.records),F=(r.records||[]).map(d=>({value:d.id,label:d.modelName,useType:d.type,status:d.status}));return k(F),A(t||[]),z(d=>({...d,content:"ready"})),t||[]}}catch(r){console.error("[TableApiError] getTableList:",r)}},G=async()=>{const r=await ue();he(r||[])?E.current&&(clearTimeout(E.current),E.current=null):(E.current&&(clearTimeout(E.current),E.current=null),E.current=setTimeout(()=>{G()},5e3))};function he(r){if(!Array.isArray(r))return!0;for(const t of r)if(t.data){const F=t.data.find(d=>d.columnId==="status");if(F&&F.status===2)return!1}return!0}const Ce=O(()=>({label:"\u6570\u636E\u5E93\u8868\u683C",defaultActiveId:"model-table",model:null,views:[{label:"\u6A21\u578B",id:"model-table",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,columns:[{id:"modelName",title:"\u6A21\u578B\u540D\u79F0",type:"label"},{id:"modelProtocol",title:"\u6A21\u578B\u4F20\u8F93\u534F\u8BAE",type:"customized",component:r=>{var d;const{value:t}=r,F=(d=P.find(w=>w.value==t))==null?void 0:d.label;return o("span",{children:F})}},{id:"type",title:"\u4F7F\u7528\u7C7B\u578B",type:"customized",component:r=>{var d;const{value:t}=r,F=(d=Z.find(w=>w.value==t))==null?void 0:d.label;return o("span",{children:F})}},{id:"dec",title:"\u8BF4\u660E",type:"paragraph"},{id:"status",title:"\u72B6\u6001",type:"customized",component:o(Ue,{}),helpText:"\u5F53\u524D\u6A21\u578B\u72B6\u6001\u4E3A\u521D\u6B21\u65B0\u589E\u6821\u9A8C\u72B6\u6001\uFF0C\u82E5\u6A21\u578B\u4E0B\u7EBF\uFF0C\u6B64\u72B6\u6001\u4E0D\u4F1A\u4E3B\u52A8\u66F4\u65B0\uFF0C\u9700\u624B\u52A8\u6267\u884C\u6A21\u578B\u5220\u9664"},{id:"actions",title:"\u64CD\u4F5C",type:"customized",component:r=>{const{value:t,cell:F,row:d}=r,{disabled:w,label:N,status:$}=F;return $==2?o(ee,{title:"\u68C0\u6D4B\u4E2D\uFF0C\u8BF7\u7A0D\u540E",children:o(L,{mode:"text",label:N,disabled:!0})}):w?o(ee,{title:"\u89D2\u8272\u65E0\u6743\u9650\u64CD\u4F5C",children:o(L,{mode:"text",label:N,disabled:w})}):o(L,{mode:"text",label:N,onClick:()=>H(`table_action_${t}`,d,void 0)})}}],toolbar:[{type:"button",btnType:"primary",key:"add",label:"\u65B0\u5EFA",icon:o(Le,{})},...v?[{type:"customized",key:"test",render:()=>o(L,{loading:e,mode:"primary",label:"\u6A21\u578B\u72B6\u6001\u68C0\u6D4B",onClick:()=>{H("toolbar_test")}})},{type:"button",btnType:"primary",key:"replace",label:"\u6A21\u578B\u66FF\u6362"}]:[]]}]}),[f,Z,P,e,v]),Me=()=>V("div",{className:"flex flex-col items-center justify-center h-full",children:[o("div",{className:"text-xl font-semibold mb-3",style:{color:"#374151"},children:o("img",{src:Se,width:120})}),o("div",{className:"text-base mb-6",style:{color:"#6b7280"},children:"\u6682\u65E0\u6570\u636E\uFF0C\u8BF7\u5148\u65B0\u5EFA\u6A21\u578B"}),o("div",{className:"flex gap-3",children:o(L,{mode:"primary",label:"\u65B0\u5EFA\u6A21\u578B",onClick:()=>{q("\u65B0\u5EFA"),T(!0)}})})]});async function H(r,t,F){var d,w,N,$;switch(console.log("[adopter] mergedEventsEmit",r,t,F),r){case"toolbar_add":{q("\u65B0\u5EFA"),T(!0);break}case"toolbar_test":{a(!0),await Ee()&&(a(!1),await G(),j.success("\u6A21\u578B\u68C0\u6D4B\u4E2D\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85\u72B6\u6001\u66F4\u65B0\uFF01"));break}case"toolbar_replace":{l(!0);break}case"table_action_delete":{try{const C=t.data.find(b=>b.columnId=="modelName").value;if(await Be(C)>0)le({title:"\u5220\u9664\u6A21\u578B",content:o("div",{style:{marginRight:"20px"},children:"\u5F53\u524D\u6A21\u578B\u5728\u7CFB\u7EDF\u5185\u5DF2\u88AB\u914D\u7F6E\u4F7F\u7528\uFF0C\u5220\u9664\u53EF\u80FD\u5F71\u54CD\u6587\u6863\u89E3\u6790\u3001\u95EE\u7B54\u3001\u591A\u6A21\u6001\u80FD\u529B\u4F7F\u7528\u7B49\uFF0C\u8BF7\u60A8\u5148\u4F7F\u7528\u201C\u6A21\u578B\u4E00\u952E\u66FF\u6362\u201D\u80FD\u529B\u5C06\u8BE5\u6A21\u578B\u66FF\u6362\u4E3A\u540C\u7C7B\u578B\u6A21\u578B\uFF0C\u518D\u5220\u9664\u6A21\u578B"}),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88"});else{const b=t.data.find(M=>M.columnId=="modelName").value;le({title:"\u786E\u8BA4\u5220\u9664\uFF1F",content:`\u786E\u5B9A\u8981\u5220\u9664\u6A21\u578B \u201C${b}\u201D \u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002`,okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await me(t.id)&&(c!=null&&c.current)&&(c==null||c.current.appFn.removeItem(t.id),j.success("\u5220\u9664\u6210\u529F"))}})}}catch(C){console.error("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25",C)}break}case"table_action_edit":{q("\u7F16\u8F91"),T(!0),U(t);break}case"form_submitted_add":{try{const C=t.fields.reduce((b,M)=>(b[M.name]=M.value,b),{}),D=await pe({...C});if(D){let b=J.find(y=>y.status==D.status);const M={id:D.id,data:[...(Object.keys(D)||[]).map(y=>({columnId:y,value:D[y],...(y=="modelProtocol"||y=="type")&&{type:"customized"},...y=="status"&&{...b,type:"customized",errorMsg:D.errorMsg}})),{columnId:"actions",value:"edit",label:"\u7F16\u8F91",type:"action"},{columnId:"actions",value:"auth",label:"\u6388\u6743",type:"action"},{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action"}]};(w=(d=c==null?void 0:c.current)==null?void 0:d.appFn)==null||w.addItem(M,{animate:!0,position:"start"}),j.success("\u6A21\u578B\u65B0\u589E\u6210\u529F\uFF01")}}catch(C){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",C)}finally{Y()}break}case"form_submitted_edit":{try{const C=t.fields.reduce((b,M)=>(b[M.name]=M.value,b),{}),D=await fe({...C,id:I.id});if(D){let b=J.find(y=>y.status==D.status);const M={...I,data:I.data.map(y=>{if(D[y.columnId]!==null&&D[y.columnId]!==void 0){if(y.columnId=="status")return{...y,...b};y.value=D[y.columnId]}return y})};($=(N=c==null?void 0:c.current)==null?void 0:N.appFn)==null||$.updateItem(M,I==null?void 0:I.id),j.success("\u6A21\u578B\u7F16\u8F91\u6210\u529F\uFF01")}}catch(C){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",C)}finally{Y()}break}case"replace_model":{await ue(),l(!1);break}case"close_model":{l(!1);break}default:typeof s.eventsEmit=="function"&&s.eventsEmit(r,t);break}}const Y=()=>{T(!1),U(void 0)};return V(ve,{title:"\u6A21\u578B\u7BA1\u7406",children:[o(ne,{dataSource:f,ref:c,eventsEmit:H,status:R,CustomComponents:{EmptyData:Me,...m},styles:{theme:{...se,colors:{...se.colors,tableFirstColumnBg:"#ffffff",tableLastColumnBg:"#ffffff",paginationBackground:"#ffffff",subTableBackground:"#F5F5F5",tableHeaderBg:"#F5F5F5"}},mode:"light"},...Ce}),o(Te,{drawerTitle:W,drawerVisible:x,handleDrawerClose:Y,modelInfo:I,modelUseTypeOpt:Z,modelProtocolsOpt:P,eventsEmit:H}),o(Ve,{modelVisible:u,options:g,eventsEmit:H,replaceModel:ge})]})}export{Qe as default};
1
+ import{jsx as o,jsxs as V}from"react/jsx-runtime";import{useState as h,useMemo as O,useRef as Q,useEffect as re}from"react";import{J as L,N as ve}from"./assets/index-CtPe9ln8.js";import{a as Ie,b as _,S as te,T as ee,F as se}from"./assets/index-8h59dJlj.js";import{O as ne}from"./assets/index-w1SriKuR.js";import{D as we}from"./assets/index-BN3yu4iN.js";import{X as xe}from"./assets/x-CmbLQ9dc.js";import{M as ce,s as j}from"./assets/index-DoUk2Ei_.js";import{T as ke}from"./assets/triangle-alert-BycMPaz2.js";/* empty css *//* empty css */import{P as Le}from"./assets/plus-CnVxGdOo.js";import{B as ae}from"./assets/index-BdNcL3V6.js";import"react-dom";const Se=""+new URL("assets/empty.png",import.meta.url).href,Re=({url:s,token:g,role:n,eventsEmit:p})=>{const m=Ie.create({baseURL:s,timeout:1e6});return m.interceptors.request.use(e=>{let a=g;return!a&&!["user/login","user/kaptcha","user/regist"].some(l=>e.url.includes(l))?(p&&p("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=a||"",e.headers.userName=n==="\u672A\u767B\u5F55\u7528\u6237"?"":n,e)}),m.interceptors.response.use(e=>{const a=["user/kaptcha"],u=e.data;if(a.some(k=>e.config.url&&e.config.url.includes(k))||u.size&&u.type)return u;const{success:l,errorMsg:E,errorCode:x}=u;return l?u:(p&&p("request:error_business",{errorCode:x,errorMsg:E||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:u}),!1)},e=>{var a,u,l,E,x,k,T,W,q;if(e.message==="canceled")return Promise.reject(e);if(p){let I="request:error_network",U={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:e};((a=e==null?void 0:e.response)==null?void 0:a.status)===401?(I="request:error_auth",U={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:e,redirect:"/login"}):(((l=(u=e==null?void 0:e.response)==null?void 0:u.data)==null?void 0:l.errorCode)==="30013"||((x=(E=e==null?void 0:e.response)==null?void 0:E.data)==null?void 0:x.errorCode)==="30023")&&(I="request:error_business",U={errorCode:(T=(k=e==null?void 0:e.response)==null?void 0:k.data)==null?void 0:T.errorCode,errorMsg:((q=(W=e==null?void 0:e.response)==null?void 0:W.data)==null?void 0:q.message)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:e}),p(I,U)}return Promise.reject(e)}),{getModelList:async e=>{try{const a=await m.get(`/allPage?${new URLSearchParams(e).toString()}`),{success:u,data:l}=a;if(u)return l}catch(a){return console.log("getModelList error:",a),!1}},delModelById:async e=>{try{const a=await m.delete(`/delete?id=${e}`),{success:u,data:l}=a;if(u)return l}catch(a){console.log("delModelById error:",a)}},createModel:async e=>{try{const a=await m.post("/create",e),{success:u,data:l}=a;if(u)return l}catch(a){console.log("createModel error:",a)}},updateModelById:async e=>{try{const a=await m.put("/update",e),{success:u,data:l}=a;if(u)return l}catch(a){console.log("updateModelById error:",a)}},getUseTypeList:async()=>{try{const e=await m.get("/getModelTypes"),{success:a,data:u}=e;if(a)return u}catch(e){return console.log("getUseTypeList error:",e),!1}},getModelProtocolsList:async()=>{try{const e=await m.get("/getModelProtocols"),{success:a,data:u}=e;if(a)return u}catch(e){return console.log("getModelProtocolsList error:",e),!1}},testStatus:async()=>{try{const e=await m.post("/check"),{success:a,data:u}=e;if(a)return u}catch(e){console.log("testStatus error:",e)}},replaceModel:async(e,a)=>{try{const u=await m.get(`/replaceModel?sourceModelId=${e}&targetModelId=${a}`),{success:l,data:E}=u;if(l)return E}catch(u){console.log("replaceModel error:",u)}},checkModel:async e=>{try{const a=await m.get(`/checkModelReference?modelName=${e}`),{success:u,data:l}=a;if(u)return l}catch(a){console.log("checkModelReference error:",a)}}}},Te=({drawerTitle:s,drawerVisible:g,modelInfo:n,handleDrawerClose:p,modelUseTypeOpt:m,modelProtocolsOpt:S,eventsEmit:i})=>{const[v,R]=h(!1),[z,c]=h(!1),f=O(()=>({id:"config-model",layout:"vertical",formWidth:"550px",fields:[{id:"modelName",name:"modelName",label:"\u6A21\u578B\u540D\u79F0",type:"input",required:!0,placeholder:"\u8BF7\u8F93\u5165\u6A21\u578B\u540D\u79F0",counter:30},{id:"modelIde",name:"modelIde",label:"\u6A21\u578BID",type:"input",required:!0,placeholder:"\u8BF7\u8F93\u5165\u6A21\u578BID",defaultValue:""},{id:"apiKey",name:"apiKey",label:"APIKey",type:"input",required:!1,placeholder:"\u8BF7\u8F93\u5165APIKey",defaultValue:""},{id:"url",name:"url",label:"\u8BF7\u6C42URL",type:"input",required:!0,placeholder:"\u8BF7\u8F93\u5165\u8BF7\u6C42URL",defaultValue:""},{id:"modelProtocol",name:"modelProtocol",label:"\u6A21\u578B\u4F20\u8F93\u534F\u8BAE",type:"select",required:!0,options:S},{id:"type",name:"type",label:"\u4F7F\u7528\u7C7B\u578B",type:"select",required:!0,options:m,defaultValue:1},{id:"maxTokens",name:"maxTokens",label:"\u4E0A\u4E0B\u6587\u957F\u5EA6",type:"slider",range:{max:1e5,min:200},step:1,sliderInline:!0,required:!0,defaultValue:512,helpText:"\u8BF7\u5411\u6A21\u578B\u90E8\u7F72\u6216\u8FD0\u7EF4\u4EBA\u5458\u786E\u8BA4\u5F53\u524D\u6A21\u578B\u7684\u6700\u5927\u4E0A\u4E0B\u6587\u957F\u5EA6\uFF08Max Tokens / Context Length\uFF09\uFF0C\u5E76\u786E\u8BA4\u63A8\u7406\u670D\u52A1\uFF08\u5982 vLLM\uFF09\u662F\u5426\u914D\u7F6E\u4E86\u989D\u5916\u7684\u8F93\u5165\u957F\u5EA6\u9650\u5236"},{id:"dec",name:"dec",label:"\u8BF4\u660E",type:"textarea",required:!1}]}),[n,m,S]),B=Q(null),A=async(u,l,E)=>{var x;switch(console.log("[Form] eventsEmit:",u,l,E),u){case"form:ready":l.formRef&&(B.current=l.formRef);break;case"form:change":if(!((x=B.current)!=null&&x.getValue)){console.log("\u8868\u5355\u5F15\u7528\u672A\u5C31\u7EEA\uFF0C\u8DF3\u8FC7 formdata_onchange \u4E8B\u4EF6");return}const k=await B.current.getValue("type");k==2||k==3?c(!0):c(!1);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",u,l)}i==null||i(u,l,E)},e=async()=>{try{R(!0);const u=await B.current.getAllData();u.isValid&&(n!=null&&n.id?await i("form_submitted_edit",u,void 0):await i("form_submitted_add",u,void 0))}catch(u){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",u)}finally{R(!1)}},a=O(()=>{const u=n==null?void 0:n.data.reduce((l,E)=>(l[E.columnId]=E.value,l),{});return console.log("====",u,n==null?void 0:n.data),{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:f.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:f.id,type:"form",size:"md",formWidth:f.formWidth,formConfig:{layout:f.layout,showReset:!1,showSubmit:!1,formWidth:f.formWidth}}],dataSource:[{id:f.id,fields:f.fields,defaultValues:u||{}}],eventsEmit:A}},[n,z,f]);return o(we,{title:s,placement:"right",width:560,onClose:p,closeIcon:!1,extra:o(xe,{size:20,color:"#888888",onClick:p,className:"cursor-pointer"}),open:g,destroyOnHidden:!0,footer:V("div",{className:"flex justify-end items-center gap-3",children:[o(L,{mode:"default",label:"\u53D6\u6D88",onClick:p}),o(L,{mode:"primary",label:"\u786E\u8BA4",loading:v,onClick:e})]}),children:o(ne,{...a},"example-form")})},{Item:oe}=_,Ve=({modelVisible:s,options:g,eventsEmit:n,replaceModel:p})=>{const[m,S]=h(!1),[i]=_.useForm(),v=_.useWatch("sourceModelId",i),R=O(()=>{const c=g.find(f=>f.value==v);return c?g.filter(B=>B.useType==c.useType&&B.value!==v&&B.status==1):[]},[v]);return re(()=>{v&&i.setFieldValue("targetModelId",void 0)},[v]),V(ce,{open:s,title:"\u6A21\u578B\u66FF\u6362",width:620,destroyOnHidden:!0,onCancel:()=>{i.resetFields(),n&&n("close_model")},footer:V("div",{className:"flex justify-end gap-3",style:{justifyContent:"end",margin:"20px 4px"},children:[o(L,{mode:"default",label:"\u53D6\u6D88",onClick:()=>{i.resetFields(),n&&n("close_model")}}),o(L,{mode:"primary",label:"\u786E\u8BA4",loading:m,onClick:async()=>{try{S(!0);const c=await i.validateFields(),{sourceModelId:f,targetModelId:B}=c;await p(f,B)&&(j.success("\u6A21\u578B\u66FF\u6362\u6210\u529F"),i.resetFields(),n&&n("replace_model"))}catch(c){console.log("e---->",c)}finally{S(!1)}}})]}),children:[V("div",{className:"flex gap-3",style:{margin:"20px 4px"},children:[o("div",{children:o(ke,{size:22,color:"#f4a02a"})}),o("span",{className:"text-[14px]",children:"\u5982\u9700\u66F4\u6362\u6A21\u578B\uFF0C\u5728\u4E00\u952E\u66FF\u6362\u65F6\uFF0C\u7CFB\u7EDF\u5C06\u81EA\u52A8\u66F4\u65B0\u77E5\u8BC6\u89E3\u6790\u914D\u7F6E\u3001\u68C0\u7D22\u6D4B\u8BD5\u548C\u52A9\u624B\u914D\u7F6E\u4E2D\u7684\u6A21\u578B\u3002\u82E5\u66FF\u6362\u7684\u662F\u6587\u6863\u89E3\u6790\u7528\u7684Embedding\u6A21\u578B\uFF0C\u5219\u4F7F\u7528\u8BE5\u6A21\u578B\u7684\u6587\u6863\u5C06\u5168\u90E8\u91CD\u65B0\u6392\u961F\u89E3\u6790\uFF0C\u72B6\u6001\u53D8\u4E3A\u201C\u89E3\u6790\u4E2D\u201D\uFF0C\u4E14\u672A\u89E3\u6790\u5B8C\u6210\u7684\u6587\u6863\u6682\u4E0D\u53EF\u68C0\u7D22\uFF01"})]}),V(_,{form:i,colon:!1,labelCol:{span:5},wrapperCol:{span:18},style:{margin:"40px 60px"},children:[o(oe,{label:"\u6A21\u578B\u540D\u79F0",name:"sourceModelId",rules:[{required:!0,message:""}],children:o(te,{placeholder:"\u8BF7\u9009\u62E9",options:g})}),o(oe,{label:"\u66FF\u6362\u4E3A",name:"targetModelId",rules:[{required:!0,message:""}],children:o(te,{placeholder:"\u8BF7\u9009\u62E9",options:R})})]})]})},X={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},J=[{statusType:"success",value:"\u53EF\u7528",status:1},{statusType:"error",value:"\u4E0D\u53EF\u7528",status:0},{statusType:"warning",value:"\u68C0\u6D4B\u4E2D",status:2}],ze=s=>typeof s=="string"&&s in X?X[s]:X.default;var K=(s=>(s[s.DATE=0]="DATE",s[s.VIEW=1]="VIEW",s[s.ERROR=2]="ERROR",s[s.AUTHORIZE=3]="AUTHORIZE",s[s.DELETE=4]="DELETE",s[s.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",s[s.DOWNLOAD=6]="DOWNLOAD",s[s.EDIT=7]="EDIT",s[s.ADD=8]="ADD",s[s.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",s[s.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",s))(K||{});const{confirm:le}=ce,qe={pageNum:1,pageSize:1e3},Ue=s=>{const{value:g,cell:n}=s,p=ze(s.cell.statusType);return g=="\u4E0D\u53EF\u7528"?o(ee,{title:n.errorMsg,children:o("div",{className:"flex items-center gap-2",children:o(ae,{color:p,text:g})})}):o(ae,{color:p,text:g})};function Qe(s){const{url:g,token:n,role:p,CustomComponents:m,eventsEmit:S,getBtnDisabled:i,showModelReplace:v}=s,[R,z]=h({container:"ready",content:"ready"}),c=Q(null),[f,B]=h(),A=Q(null),[e,a]=h(!1),[u,l]=h(!1),[E,x]=h([]),[k,T]=h(!1),[W,q]=h(""),[I,U]=h(),[Z,ie]=h([]),[P,de]=h([]),{getModelList:Fe,delModelById:me,createModel:pe,updateModelById:fe,getUseTypeList:ye,getModelProtocolsList:Ae,testStatus:Ee,replaceModel:ge,checkModel:Be}=Re({url:g,token:n,role:p,eventsEmit:S});re(()=>(z(r=>({...r,content:"loading"})),G(),be(),()=>{A.current&&(clearTimeout(A.current),A.current=null)}),[]);const De=r=>(r||[]).map((t,F)=>{let d=J.find(w=>w.status==t.status);return{id:t.id,data:[{columnId:"modelName",value:t.modelName},{columnId:"modelProtocol",value:t.modelProtocol,type:"customized"},{columnId:"type",value:t.type,type:"customized"},{columnId:"dec",value:t.dec},{columnId:"status",...d,type:"customized",errorMsg:t.errorMsg},{columnId:"actions",value:"edit",label:"\u7F16\u8F91",status:t.status,type:"action",disabled:i&&i(K.EDIT,t.permission)},{columnId:"actions",value:"auth",label:"\u6388\u6743",type:"action",status:t.status,disabled:i&&i(K.AUTHORIZE,t.permission)},{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action",status:t.status,disabled:i&&i(K.AUTHORIZE,t.permission)},{columnId:"url",value:t.url},{columnId:"apiKey",value:t.apiKey},{columnId:"modelIde",value:t.modelIde},{columnId:"thinking",value:t.thinking},{columnId:"maxTokens",value:t.maxTokens}]}}),be=async()=>{try{const[r,t]=await Promise.allSettled([ye(),Ae()]);r.status==="fulfilled"&&r.value&&ie((r.value||[]).map(F=>({...F,value:Number(F.value)}))),t.status==="fulfilled"&&t.value&&de((t.value||[]).map(F=>({...F,value:Number(F.value)})))}catch(r){console.error("[TableApiError] getTableList:",r)}},ue=async()=>{try{const r=await Fe(qe);if(r.records){const t=De(r.records),F=(r.records||[]).map(d=>({value:d.id,label:d.modelName,useType:d.type,status:d.status}));return x(F),B(t||[]),z(d=>({...d,content:"ready"})),t||[]}}catch(r){console.error("[TableApiError] getTableList:",r)}},G=async()=>{const r=await ue();he(r||[])?A.current&&(clearTimeout(A.current),A.current=null):(A.current&&(clearTimeout(A.current),A.current=null),A.current=setTimeout(()=>{G()},5e3))};function he(r){if(!Array.isArray(r))return!0;for(const t of r)if(t.data){const F=t.data.find(d=>d.columnId==="status");if(F&&F.status===2)return!1}return!0}const Ce=O(()=>({label:"\u6570\u636E\u5E93\u8868\u683C",defaultActiveId:"model-table",model:null,views:[{label:"\u6A21\u578B",id:"model-table",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,columns:[{id:"modelName",title:"\u6A21\u578B\u540D\u79F0",type:"label"},{id:"modelProtocol",title:"\u6A21\u578B\u4F20\u8F93\u534F\u8BAE",type:"customized",component:r=>{var d;const{value:t}=r,F=(d=P.find(w=>w.value==t))==null?void 0:d.label;return o("span",{children:F})}},{id:"type",title:"\u4F7F\u7528\u7C7B\u578B",type:"customized",component:r=>{var d;const{value:t}=r,F=(d=Z.find(w=>w.value==t))==null?void 0:d.label;return o("span",{children:F})}},{id:"dec",title:"\u8BF4\u660E",type:"paragraph"},{id:"status",title:"\u72B6\u6001",type:"customized",component:o(Ue,{}),helpText:"\u5F53\u524D\u6A21\u578B\u72B6\u6001\u4E3A\u521D\u6B21\u65B0\u589E\u6821\u9A8C\u72B6\u6001\uFF0C\u82E5\u6A21\u578B\u4E0B\u7EBF\uFF0C\u6B64\u72B6\u6001\u4E0D\u4F1A\u4E3B\u52A8\u66F4\u65B0\uFF0C\u9700\u624B\u52A8\u6267\u884C\u6A21\u578B\u5220\u9664"},{id:"actions",title:"\u64CD\u4F5C",type:"customized",component:r=>{const{value:t,cell:F,row:d}=r,{disabled:w,label:N,status:$}=F;return $==2?o(ee,{title:"\u68C0\u6D4B\u4E2D\uFF0C\u8BF7\u7A0D\u540E",children:o(L,{mode:"text",label:N,disabled:!0})}):w?o(ee,{title:"\u89D2\u8272\u65E0\u6743\u9650\u64CD\u4F5C",children:o(L,{mode:"text",label:N,disabled:w})}):o(L,{mode:"text",label:N,onClick:()=>H(`table_action_${t}`,d,void 0)})}}],toolbar:[{type:"button",btnType:"primary",key:"add",label:"\u65B0\u5EFA",icon:o(Le,{})},...v?[{type:"customized",key:"test",render:()=>o(L,{loading:e,mode:"primary",label:"\u6A21\u578B\u72B6\u6001\u68C0\u6D4B",onClick:()=>{H("toolbar_test")}})},{type:"button",btnType:"primary",key:"replace",label:"\u6A21\u578B\u66FF\u6362"}]:[]]}]}),[f,Z,P,e,v]),Me=()=>V("div",{className:"flex flex-col items-center justify-center h-full",children:[o("div",{className:"text-xl font-semibold mb-3",style:{color:"#374151"},children:o("img",{src:Se,width:120})}),o("div",{className:"text-base mb-6",style:{color:"#6b7280"},children:"\u6682\u65E0\u6570\u636E\uFF0C\u8BF7\u5148\u65B0\u5EFA\u6A21\u578B"}),o("div",{className:"flex gap-3",children:o(L,{mode:"primary",label:"\u65B0\u5EFA\u6A21\u578B",onClick:()=>{q("\u65B0\u5EFA"),T(!0)}})})]});async function H(r,t,F){var d,w,N,$;switch(console.log("[adopter] mergedEventsEmit",r,t,F),r){case"toolbar_add":{q("\u65B0\u5EFA"),T(!0);break}case"toolbar_test":{a(!0),await Ee()&&(a(!1),await G(),j.success("\u6A21\u578B\u68C0\u6D4B\u4E2D\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85\u72B6\u6001\u66F4\u65B0\uFF01"));break}case"toolbar_replace":{l(!0);break}case"table_action_delete":{try{const C=t.data.find(b=>b.columnId=="modelName").value;if(await Be(C)>0)le({title:"\u5220\u9664\u6A21\u578B",content:o("div",{style:{marginRight:"20px"},children:"\u5F53\u524D\u6A21\u578B\u5728\u7CFB\u7EDF\u5185\u5DF2\u88AB\u914D\u7F6E\u4F7F\u7528\uFF0C\u5220\u9664\u53EF\u80FD\u5F71\u54CD\u6587\u6863\u89E3\u6790\u3001\u95EE\u7B54\u3001\u591A\u6A21\u6001\u80FD\u529B\u4F7F\u7528\u7B49\uFF0C\u8BF7\u60A8\u5148\u4F7F\u7528\u201C\u6A21\u578B\u4E00\u952E\u66FF\u6362\u201D\u80FD\u529B\u5C06\u8BE5\u6A21\u578B\u66FF\u6362\u4E3A\u540C\u7C7B\u578B\u6A21\u578B\uFF0C\u518D\u5220\u9664\u6A21\u578B"}),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88"});else{const b=t.data.find(M=>M.columnId=="modelName").value;le({title:"\u786E\u8BA4\u5220\u9664\uFF1F",content:`\u786E\u5B9A\u8981\u5220\u9664\u6A21\u578B \u201C${b}\u201D \u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002`,okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await me(t.id)&&(c!=null&&c.current)&&(c==null||c.current.appFn.removeItem(t.id),j.success("\u5220\u9664\u6210\u529F"))}})}}catch(C){console.error("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25",C)}break}case"table_action_edit":{q("\u7F16\u8F91"),T(!0),U(t);break}case"form_submitted_add":{try{const C=t.fields.reduce((b,M)=>(b[M.name]=M.value,b),{}),D=await pe({...C});if(D){let b=J.find(y=>y.status==D.status);const M={id:D.id,data:[...(Object.keys(D)||[]).map(y=>({columnId:y,value:D[y],...(y=="modelProtocol"||y=="type")&&{type:"customized"},...y=="status"&&{...b,type:"customized",errorMsg:D.errorMsg}})),{columnId:"actions",value:"edit",label:"\u7F16\u8F91",type:"action"},{columnId:"actions",value:"auth",label:"\u6388\u6743",type:"action"},{columnId:"actions",value:"delete",label:"\u5220\u9664",type:"action"}]};(w=(d=c==null?void 0:c.current)==null?void 0:d.appFn)==null||w.addItem(M,{animate:!0,position:"start"}),j.success("\u6A21\u578B\u65B0\u589E\u6210\u529F\uFF01")}}catch(C){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",C)}finally{Y()}break}case"form_submitted_edit":{try{const C=t.fields.reduce((b,M)=>(b[M.name]=M.value,b),{}),D=await fe({...C,id:I.id});if(D){let b=J.find(y=>y.status==D.status);const M={...I,data:I.data.map(y=>{if(D[y.columnId]!==null&&D[y.columnId]!==void 0){if(y.columnId=="status")return{...y,...b};y.value=D[y.columnId]}return y})};($=(N=c==null?void 0:c.current)==null?void 0:N.appFn)==null||$.updateItem(M,I==null?void 0:I.id),j.success("\u6A21\u578B\u7F16\u8F91\u6210\u529F\uFF01")}}catch(C){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",C)}finally{Y()}break}case"replace_model":{await ue(),l(!1);break}case"close_model":{l(!1);break}default:typeof s.eventsEmit=="function"&&s.eventsEmit(r,t);break}}const Y=()=>{T(!1),U(void 0)};return V(ve,{title:"\u6A21\u578B\u7BA1\u7406",children:[o(ne,{dataSource:f,ref:c,eventsEmit:H,status:R,CustomComponents:{EmptyData:Me,...m},styles:{theme:{...se,colors:{...se.colors,tableFirstColumnBg:"#ffffff",tableLastColumnBg:"#ffffff",paginationBackground:"#ffffff",subTableBackground:"#F5F5F5",tableHeaderBg:"#F5F5F5"}},mode:"light"},...Ce}),o(Te,{drawerTitle:W,drawerVisible:k,handleDrawerClose:Y,modelInfo:I,modelUseTypeOpt:Z,modelProtocolsOpt:P,eventsEmit:H}),o(Ve,{modelVisible:u,options:E,eventsEmit:H,replaceModel:ge})]})}export{Qe as default};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "license": "MIT",
4
4
  "style": "assets/style.css",
5
5
  "private": false,
6
- "version": "2.1.36",
6
+ "version": "2.1.37",
7
7
  "author": "hanfeng_Zhang",
8
8
  "type": "module",
9
9
  "main": "index.js",