@gientech/modual 2.1.24 → 2.1.26
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.
|
@@ -167,7 +167,7 @@ var zn=Object.defineProperty;var Sn=m=>{throw TypeError(m)};var Gn=(m,a,A)=>a in
|
|
|
167
167
|
0% { transform: rotate(0deg); }
|
|
168
168
|
100% { transform: rotate(360deg); }
|
|
169
169
|
}
|
|
170
|
-
`))},We=(m,a)=>{var A,f,_,V,q;console.log("=== Fviewer renderTextContent ==="),console.log("data:",m),console.log("data.content:",m.content);let Y="";typeof m.content=="string"?Y=m.content:(A=m.content)!=null&&A.text?Y=m.content.text:(f=m.content)!=null&&f.content&&(Y=m.content.content),console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:",Y);const M=useRef(null),b=useRef(null);return useEffect(()=>{if(M.current&&b.current&&Y){const w=setTimeout(()=>{var P;const F=((P=M.current)==null?void 0:P.scrollHeight)||0,S=Math.max(F+80,200);b.current&&(b.current.style.minHeight=`${S}px`,console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:",S))},100);return()=>clearTimeout(w)}},[Y]),React__default.createElement("div",{style:{height:"100%",overflow:"auto",backgroundColor:"#f5f5f5",padding:"20px",display:"flex",justifyContent:"center",position:"relative"}},React__default.createElement("div",{ref:b,style:{width:"100%",maxWidth:"800px",backgroundColor:"white",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)",borderRadius:"8px",padding:"40px",margin:"20px 0",position:"relative",transform:`scale(${a.scale||1})`,transition:"transform 0.2s ease-in-out",transformOrigin:"top center"}},React__default.createElement("div",{ref:M,style:{width:"100%",overflow:"visible"}},React__default.createElement(O8,{dataSource:{type:ea.TEXT,content:Y},size:"md",theme:{primaryColor:((q=(V=(_=a.styles)==null?void 0:_.theme)==null?void 0:V.colors)==null?void 0:q.primary)||"#007bff",backgroundColor:"transparent",textColor:"#333",borderColor:"transparent",borderRadius:"0",padding:"0"},style:{border:"none",background:"transparent",width:"100%",height:"auto",overflow:"visible"}})),React__default.createElement("div",{style:{position:"absolute",top:"0",left:"0",right:"0",height:"2px",background:"linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}})))},je=({data:m,parentProps:a,isTableMode:A=!1})=>{var f,_,V,q,Y,M,b,w,P,F,S,c;const t=useRef(null),s=useRef(null),o=useRef(null),v=useRef(!1);useRef(0),useRef(null);const[g]=useState(!1),l=(N,U)=>{console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="),console.log("\u6EDA\u52A8\u4F4D\u7F6E:",{scrollTop:N,scrollHeight:U}),a.eventsEmit&&a.eventsEmit("markdown_scroll",{scrollTop:N,scrollHeight:U})},n=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="),a.eventsEmit&&a.eventsEmit("markdown_scroll_to_top")},r=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="),a.eventsEmit&&a.eventsEmit("markdown_scroll_to_bottom")},e=useRef();e.current=N=>{var U,G;try{if(!A)return;const bt=typeof m.content=="string"?m.content:((U=m.content)==null?void 0:U.content)||"";if(!bt||O.length===0)return;const wt=JSON.stringify(O.map(H=>({o:H.offsets,c:H.color}))),Mt=`${bt.length}:${bt.substring(0,64)}:${bt.substring(bt.length-64)}|${wt}`;if(((G=N.dataset)==null?void 0:G.tableAnnoRuntimeSig)===Mt)return;setTimeout(()=>{pt(),N.dataset&&(N.dataset.tableAnnoRuntimeSig=Mt)},50)}catch(bt){console.warn("[MarkdownRendered] apply failed",bt)}};const E=React__default.useCallback(N=>{var U;return(U=e.current)==null?void 0:U.call(e,N)},[]),x=useCallback(()=>{var N;if(!g||!t.current)return;const U=window.getSelection();if(!U||U.isCollapsed)return;const G=U.getRangeAt(0),bt=G.toString().trim();if(!bt)return;const wt=t.current;let Mt=0,H=0;const h=document.createTreeWalker(wt,NodeFilter.SHOW_TEXT,{acceptNode:I=>{var $;return($=I.parentElement)!=null&&$.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let u=h.nextNode();for(;u;){if(u===G.startContainer){H=Mt+G.startOffset;break}Mt+=((N=u.textContent)==null?void 0:N.length)||0,u=h.nextNode()}console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:",{text:bt,startOffset:H,charCount:Mt,container:G.startContainer.textContent});const T={id:`md-anno-${Date.now()}`,start:H,end:H+bt.length,color:"#FFE599"};console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:",T),a.eventsEmit&&a.eventsEmit("md_annotation_add",T),U.removeAllRanges()},[g,a.eventsEmit]),L=A?[]:(a.annotationData||[]).filter(N=>"start"in N&&"end"in N&&!("pageNumber"in N)),O=A?(a.annotationData||[]).filter(N=>"offsets"in N&&Array.isArray(N.offsets)):[],yt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");return}const N=t.current.querySelectorAll(".md-annotation");console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",N.length),N.length>0&&N.forEach(U=>{const G=U.parentNode;G&&G.replaceChild(document.createTextNode(U.textContent||""),U)}),console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A")},[]),St=useCallback(()=>{t.current&&(t.current.querySelectorAll("table").forEach(N=>{Array.from(N.rows).forEach(U=>{Array.from(U.cells).forEach(G=>{G.getAttribute("data-table-annotated")==="1"&&(G.style.removeProperty("background"),G.style.removeProperty("background-color"),G.removeAttribute("data-table-annotated"),G.removeAttribute("title"))})})}),console.log("\u5DF2\u6E05\u7A7A\u6240\u6709\u8868\u683C\u6807\u6CE8"))},[]),pt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="),console.log("tableAnnotations:",O),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");return}if(St(),!O.length){console.log("\u6CA1\u6709\u8868\u683C\u6807\u6CE8\u6570\u636E\uFF0C\u4EC5\u6E05\u7A7A\u65E7\u6807\u6CE8");return}const N=t.current.querySelectorAll("table");if(console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:",N.length),N.length===0){console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");return}v.current=!0,O.forEach((U,G)=>{const bt=U.offsets;if(console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:",U),!Array.isArray(bt)||!bt.length||!Array.isArray(bt[0])||bt[0].length!==2){console.warn("[TableAnnotation] annotation.offsets is not valid",U);return}bt.forEach((wt,Mt)=>{const[H,h]=wt;if(typeof H!="number"||typeof h!="number"){console.warn("[TableAnnotation] offset is not [number, number]",wt);return}N.forEach((u,T)=>{var I;const $=Array.from(u.rows),W=$[H];if(!W){console.warn("[TableAnnotation] row out of range",{row:H,tableIndex:T,totalRows:$.length});return}const i=(I=W.cells)==null?void 0:I[h];if(!i){console.warn("[TableAnnotation] cell is undefined",{row:H,col:h,tableIndex:T});return}const d=U.color||"rgba(255, 229, 153, 0.5)",C=getComputedStyle(i).backgroundColor;i.getAttribute("data-table-annotated")==="1"&&(C===d||i.style.backgroundColor===d)||(i.style.setProperty("background",d,"important"),i.style.setProperty("background-color",d,"important"),i.setAttribute("data-table-annotated","1")),U.content&&(i.title=U.content),Mt===0&&G===0&&setTimeout(()=>{i.scrollIntoView({behavior:"smooth",block:"start"})},300)})})}),requestAnimationFrame(()=>{v.current=!1})},[O,St]),K=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="),!t.current||!L.length){console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}s.current&&clearTimeout(s.current);const N=()=>{var U;console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");const G=(U=t.current)==null?void 0:U.querySelectorAll(".md-annotation");console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:",(G==null?void 0:G.length)||0),G==null||G.forEach(T=>{const I=T.parentNode;I&&I.replaceChild(document.createTextNode(T.textContent||""),T)});const bt=document.createTreeWalker(t.current,NodeFilter.SHOW_TEXT,{acceptNode:T=>{var I;return(I=T.parentElement)!=null&&I.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),wt=[];let Mt;for(;Mt=bt.nextNode();)wt.push(Mt);if(console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:",wt.length),wt.length===0){console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."),s.current=setTimeout(()=>{N()},200);return}let H=0;const h=wt.map(T=>{var I;const $=H;return H+=((I=T.textContent)==null?void 0:I.length)||0,{node:T,start:$,end:H,text:T.textContent}});console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:",h),console.log("\u603B\u6587\u672C\u957F\u5EA6:",H);const u=[...L].sort((T,I)=>I.start-T.start);console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:",u),u.forEach(T=>{const{start:I,end:$,color:W}=T;console.log("\u5904\u7406\u6807\u6CE8:",{annotation:T,nodePositions:h});const i=h.filter(d=>I<d.end&&$>d.start);console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:",i.length),i.forEach(({node:d,start:C})=>{var y,k,j,D,p,B;const _t=Math.max(0,I-C),z=Math.min(((y=d.textContent)==null?void 0:y.length)||0,$-C);if(console.log("\u672C\u5730\u4F4D\u7F6E:",{localStart:_t,localEnd:z,nodeTextLength:(k=d.textContent)==null?void 0:k.length}),_t>=z){console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");return}const Q=((j=d.textContent)==null?void 0:j.slice(0,_t))||"",At=((D=d.textContent)==null?void 0:D.slice(_t,z))||"",kt=((p=d.textContent)==null?void 0:p.slice(z))||"";console.log("\u5206\u5272\u6587\u672C:",{before:Q,annotatedText:At,after:kt});const Rt=document.createElement("span");Rt.className="md-annotation",Rt.style.backgroundColor=W||"#FFE599",Rt.textContent=At;const xt=document.createDocumentFragment();Q&&xt.appendChild(document.createTextNode(Q)),xt.appendChild(Rt),kt&&xt.appendChild(document.createTextNode(kt)),(B=d.parentNode)==null||B.replaceChild(xt,d),console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:",At)})})};s.current=setTimeout(()=>{N()},100)},[L]);return useEffect(()=>{var N;if(A){console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");return}const U=typeof m.content=="string"?m.content:((N=m.content)==null?void 0:N.content)||"";if(!U||typeof U!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="),console.log("markdownRef.current:",t.current),console.log("isTableMode:",A),console.log("mdAnnotations:",L),console.log("tableAnnotations:",O),console.log("data.content:",m.content),console.log("\u5B9E\u9645\u5185\u5BB9:",U),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");return}if(A||yt(),!A&&L.length>0){K();return}console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8")},[A,O,L]),useEffect(()=>{if(!A)return document.addEventListener("mouseup",x),()=>{document.removeEventListener("mouseup",x)}},[x,A]),useEffect(()=>{var N;const U=typeof m.content=="string"?m.content:((N=m.content)==null?void 0:N.content)||"";if(!U||typeof U!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");return}console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="),console.log("isTableMode:",A),console.log("\u5185\u5BB9\u957F\u5EA6:",U.length||0),typeof U=="string"?(console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:",U.substring(0,100)),console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:",U.substring(U.length-100))):(console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:",typeof U),console.log("\u5185\u5BB9\u503C:",U)),console.log("\u6807\u6CE8\u6570\u636E:",L),console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:",O)},[L,O,A]),useEffect(()=>{if(A&&t.current){const N=setTimeout(()=>{var U;const G=(U=t.current)==null?void 0:U.querySelectorAll("table");G&&G.length>0&&(console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:",G.length),G.forEach((bt,wt)=>{if(bt instanceof HTMLTableElement){bt.style.width="100%",bt.style.minWidth="100%",bt.style.tableLayout="auto";const Mt=bt.closest(".markdown-table-mode");Mt&&Mt instanceof HTMLElement&&(Mt.style.width="100%",Mt.style.overflowX="auto"),console.log(`\u8868\u683C ${wt+1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`)}}))},500);return()=>clearTimeout(N)}},[A,m.content]),useEffect(()=>()=>{s.current&&clearTimeout(s.current),o.current&&(o.current.disconnect(),o.current=null)},[]),React__default.createElement("div",{style:{height:"100%",width:"100%",overflow:"auto"},className:`markdown-container markdown-scrollbar ${A?"markdown-table-mode":""}`},React__default.createElement("style",null,Le),React__default.createElement("div",{ref:t},React__default.createElement(O8,{dataSource:{type:ea.MARKDOWN,content:(()=>{var N,U;return typeof m.content=="string"?m.content:(N=m.content)!=null&&N.text?m.content.text:(U=m.content)!=null&&U.content?m.content.content:""})()},size:"md",onScroll:A?void 0:l,onScrollToTop:A?void 0:n,onScrollToBottom:A?void 0:r,onRendered:E,theme:{primaryColor:((V=(_=(f=a.styles)==null?void 0:f.theme)==null?void 0:_.colors)==null?void 0:V.primary)||"#007bff",backgroundColor:((M=(Y=(q=a.styles)==null?void 0:q.theme)==null?void 0:Y.colors)==null?void 0:M.background)||"#f8f9fa",textColor:((P=(w=(b=a.styles)==null?void 0:b.theme)==null?void 0:w.colors)==null?void 0:P.text)||"#343a40",borderColor:((c=(S=(F=a.styles)==null?void 0:F.theme)==null?void 0:S.colors)==null?void 0:c.border)||"#dee2e6",borderRadius:A?"0px":"8px",padding:A?"0px":"20px"},style:{height:"100%",border:"none",background:"transparent",overflowY:A?"visible":"scroll"}})))},Oe=({markdown:m,onRendered:a,tableAnnotations:A=[]})=>{const f=useRef(null),_=q=>{const Y=q.split(/\r?\n/).filter(F=>F.trim().length>0);let M=-1;for(let F=0;F<Y.length-1;F++){const S=Y[F].trim(),c=Y[F+1].trim();if(S.startsWith("|")&&S.endsWith("|")&&c.replace(/\s|:|\|/g,"").match(/^[-]+$/)){M=F;break}}if(M===-1)return null;const b=Y[M].split("|").slice(1,-1).map(F=>F.trim()),w=[];for(let F=M+2;F<Y.length;F++){const S=Y[F].trim();if(!S.startsWith("|")||!S.endsWith("|"))break;w.push(S)}const P=w.map(F=>F.split("|").slice(1,-1).map(S=>S.trim()));return{headers:b,rows:P}},V=React__default.useMemo(()=>_(m),[m]);return useEffect(()=>{const q=()=>{try{if(!f.current)return;const M=f.current.querySelectorAll("table");if(M.forEach(b=>{Array.from(b.rows).forEach(w=>{Array.from(w.cells).forEach(P=>{P.getAttribute("data-table-annotated")==="1"&&(P.style.removeProperty("background"),P.style.removeProperty("background-color"),P.removeAttribute("data-table-annotated"),P.removeAttribute("title"))})})}),!A.length||!M||M.length===0)return;A.forEach((b,w)=>{(b.offsets||[]).forEach((P,F)=>{const[S,c]=P;M.forEach(t=>{var s;const o=Array.from(t.rows)[S];if(!o)return;const v=(s=o.cells)==null?void 0:s[c];if(!v)return;const g=b.color||"rgba(255, 229, 153, 0.5)";v.getAttribute("data-table-annotated")==="1"||(v.style.setProperty("background",g,"important"),v.style.setProperty("background-color",g,"important"),v.setAttribute("data-table-annotated","1"),b.content&&(v.title=b.content)),w===0&&F===0&&setTimeout(()=>v.scrollIntoView({behavior:"smooth",block:"start"}),50)})})})}catch(M){console.warn("[MinimalMarkdownTable] apply annotations failed",M)}},Y=requestAnimationFrame(()=>{q(),a&&a()});return()=>cancelAnimationFrame(Y)},[m,A,a]),V?React__default.createElement("div",{ref:f,className:"markdown-table-mode z-mdtbl-wrapper"},React__default.createElement("style",null,`
|
|
170
|
+
`))},We=(m,a)=>{var A,f,_,V,q;console.log("=== Fviewer renderTextContent ==="),console.log("data:",m),console.log("data.content:",m.content);let Y="";typeof m.content=="string"?Y=m.content:(A=m.content)!=null&&A.text?Y=m.content.text:(f=m.content)!=null&&f.content&&(Y=m.content.content),console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:",Y);const M=useRef(null),b=useRef(null);return useEffect(()=>{if(M.current&&b.current&&Y){const w=setTimeout(()=>{var P;const F=((P=M.current)==null?void 0:P.scrollHeight)||0,S=Math.max(F+80,200);b.current&&(b.current.style.minHeight=`${S}px`,console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:",S))},100);return()=>clearTimeout(w)}},[Y]),React__default.createElement("div",{style:{height:"100%",overflow:"auto",backgroundColor:"#f5f5f5",padding:"20px",display:"flex",justifyContent:"center",position:"relative"}},React__default.createElement("div",{ref:b,style:{width:"100%",maxWidth:"800px",backgroundColor:"white",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)",borderRadius:"8px",padding:"40px",margin:"20px 0",position:"relative",transform:`scale(${a.scale||1})`,transition:"transform 0.2s ease-in-out",transformOrigin:"top center"}},React__default.createElement("div",{ref:M,style:{width:"100%",overflow:"visible"}},React__default.createElement(O8,{dataSource:{type:ea.TEXT,content:Y},size:"md",theme:{primaryColor:((q=(V=(_=a.styles)==null?void 0:_.theme)==null?void 0:V.colors)==null?void 0:q.primary)||"#007bff",backgroundColor:"transparent",textColor:"#333",borderColor:"transparent",borderRadius:"0",padding:"0"},style:{border:"none",background:"transparent",width:"100%",height:"auto",overflow:"visible",whiteSpace:"pre-line"}})),React__default.createElement("div",{style:{position:"absolute",top:"0",left:"0",right:"0",height:"2px",background:"linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}})))},je=({data:m,parentProps:a,isTableMode:A=!1})=>{var f,_,V,q,Y,M,b,w,P,F,S,c;const t=useRef(null),s=useRef(null),o=useRef(null),v=useRef(!1);useRef(0),useRef(null);const[g]=useState(!1),l=(N,U)=>{console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="),console.log("\u6EDA\u52A8\u4F4D\u7F6E:",{scrollTop:N,scrollHeight:U}),a.eventsEmit&&a.eventsEmit("markdown_scroll",{scrollTop:N,scrollHeight:U})},n=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="),a.eventsEmit&&a.eventsEmit("markdown_scroll_to_top")},r=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="),a.eventsEmit&&a.eventsEmit("markdown_scroll_to_bottom")},e=useRef();e.current=N=>{var U,G;try{if(!A)return;const bt=typeof m.content=="string"?m.content:((U=m.content)==null?void 0:U.content)||"";if(!bt||O.length===0)return;const wt=JSON.stringify(O.map(H=>({o:H.offsets,c:H.color}))),Mt=`${bt.length}:${bt.substring(0,64)}:${bt.substring(bt.length-64)}|${wt}`;if(((G=N.dataset)==null?void 0:G.tableAnnoRuntimeSig)===Mt)return;setTimeout(()=>{pt(),N.dataset&&(N.dataset.tableAnnoRuntimeSig=Mt)},50)}catch(bt){console.warn("[MarkdownRendered] apply failed",bt)}};const E=React__default.useCallback(N=>{var U;return(U=e.current)==null?void 0:U.call(e,N)},[]),x=useCallback(()=>{var N;if(!g||!t.current)return;const U=window.getSelection();if(!U||U.isCollapsed)return;const G=U.getRangeAt(0),bt=G.toString().trim();if(!bt)return;const wt=t.current;let Mt=0,H=0;const h=document.createTreeWalker(wt,NodeFilter.SHOW_TEXT,{acceptNode:I=>{var $;return($=I.parentElement)!=null&&$.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let u=h.nextNode();for(;u;){if(u===G.startContainer){H=Mt+G.startOffset;break}Mt+=((N=u.textContent)==null?void 0:N.length)||0,u=h.nextNode()}console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:",{text:bt,startOffset:H,charCount:Mt,container:G.startContainer.textContent});const T={id:`md-anno-${Date.now()}`,start:H,end:H+bt.length,color:"#FFE599"};console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:",T),a.eventsEmit&&a.eventsEmit("md_annotation_add",T),U.removeAllRanges()},[g,a.eventsEmit]),L=A?[]:(a.annotationData||[]).filter(N=>"start"in N&&"end"in N&&!("pageNumber"in N)),O=A?(a.annotationData||[]).filter(N=>"offsets"in N&&Array.isArray(N.offsets)):[],yt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");return}const N=t.current.querySelectorAll(".md-annotation");console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",N.length),N.length>0&&N.forEach(U=>{const G=U.parentNode;G&&G.replaceChild(document.createTextNode(U.textContent||""),U)}),console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A")},[]),St=useCallback(()=>{t.current&&(t.current.querySelectorAll("table").forEach(N=>{Array.from(N.rows).forEach(U=>{Array.from(U.cells).forEach(G=>{G.getAttribute("data-table-annotated")==="1"&&(G.style.removeProperty("background"),G.style.removeProperty("background-color"),G.removeAttribute("data-table-annotated"),G.removeAttribute("title"))})})}),console.log("\u5DF2\u6E05\u7A7A\u6240\u6709\u8868\u683C\u6807\u6CE8"))},[]),pt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="),console.log("tableAnnotations:",O),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");return}if(St(),!O.length){console.log("\u6CA1\u6709\u8868\u683C\u6807\u6CE8\u6570\u636E\uFF0C\u4EC5\u6E05\u7A7A\u65E7\u6807\u6CE8");return}const N=t.current.querySelectorAll("table");if(console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:",N.length),N.length===0){console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");return}v.current=!0,O.forEach((U,G)=>{const bt=U.offsets;if(console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:",U),!Array.isArray(bt)||!bt.length||!Array.isArray(bt[0])||bt[0].length!==2){console.warn("[TableAnnotation] annotation.offsets is not valid",U);return}bt.forEach((wt,Mt)=>{const[H,h]=wt;if(typeof H!="number"||typeof h!="number"){console.warn("[TableAnnotation] offset is not [number, number]",wt);return}N.forEach((u,T)=>{var I;const $=Array.from(u.rows),W=$[H];if(!W){console.warn("[TableAnnotation] row out of range",{row:H,tableIndex:T,totalRows:$.length});return}const i=(I=W.cells)==null?void 0:I[h];if(!i){console.warn("[TableAnnotation] cell is undefined",{row:H,col:h,tableIndex:T});return}const d=U.color||"rgba(255, 229, 153, 0.5)",C=getComputedStyle(i).backgroundColor;i.getAttribute("data-table-annotated")==="1"&&(C===d||i.style.backgroundColor===d)||(i.style.setProperty("background",d,"important"),i.style.setProperty("background-color",d,"important"),i.setAttribute("data-table-annotated","1")),U.content&&(i.title=U.content),Mt===0&&G===0&&setTimeout(()=>{i.scrollIntoView({behavior:"smooth",block:"start"})},300)})})}),requestAnimationFrame(()=>{v.current=!1})},[O,St]),K=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="),!t.current||!L.length){console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}s.current&&clearTimeout(s.current);const N=()=>{var U;console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");const G=(U=t.current)==null?void 0:U.querySelectorAll(".md-annotation");console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:",(G==null?void 0:G.length)||0),G==null||G.forEach(T=>{const I=T.parentNode;I&&I.replaceChild(document.createTextNode(T.textContent||""),T)});const bt=document.createTreeWalker(t.current,NodeFilter.SHOW_TEXT,{acceptNode:T=>{var I;return(I=T.parentElement)!=null&&I.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),wt=[];let Mt;for(;Mt=bt.nextNode();)wt.push(Mt);if(console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:",wt.length),wt.length===0){console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."),s.current=setTimeout(()=>{N()},200);return}let H=0;const h=wt.map(T=>{var I;const $=H;return H+=((I=T.textContent)==null?void 0:I.length)||0,{node:T,start:$,end:H,text:T.textContent}});console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:",h),console.log("\u603B\u6587\u672C\u957F\u5EA6:",H);const u=[...L].sort((T,I)=>I.start-T.start);console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:",u),u.forEach(T=>{const{start:I,end:$,color:W}=T;console.log("\u5904\u7406\u6807\u6CE8:",{annotation:T,nodePositions:h});const i=h.filter(d=>I<d.end&&$>d.start);console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:",i.length),i.forEach(({node:d,start:C})=>{var y,k,j,D,p,B;const _t=Math.max(0,I-C),z=Math.min(((y=d.textContent)==null?void 0:y.length)||0,$-C);if(console.log("\u672C\u5730\u4F4D\u7F6E:",{localStart:_t,localEnd:z,nodeTextLength:(k=d.textContent)==null?void 0:k.length}),_t>=z){console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");return}const Q=((j=d.textContent)==null?void 0:j.slice(0,_t))||"",At=((D=d.textContent)==null?void 0:D.slice(_t,z))||"",kt=((p=d.textContent)==null?void 0:p.slice(z))||"";console.log("\u5206\u5272\u6587\u672C:",{before:Q,annotatedText:At,after:kt});const Rt=document.createElement("span");Rt.className="md-annotation",Rt.style.backgroundColor=W||"#FFE599",Rt.textContent=At;const xt=document.createDocumentFragment();Q&&xt.appendChild(document.createTextNode(Q)),xt.appendChild(Rt),kt&&xt.appendChild(document.createTextNode(kt)),(B=d.parentNode)==null||B.replaceChild(xt,d),console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:",At)})})};s.current=setTimeout(()=>{N()},100)},[L]);return useEffect(()=>{var N;if(A){console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");return}const U=typeof m.content=="string"?m.content:((N=m.content)==null?void 0:N.content)||"";if(!U||typeof U!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="),console.log("markdownRef.current:",t.current),console.log("isTableMode:",A),console.log("mdAnnotations:",L),console.log("tableAnnotations:",O),console.log("data.content:",m.content),console.log("\u5B9E\u9645\u5185\u5BB9:",U),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");return}if(A||yt(),!A&&L.length>0){K();return}console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8")},[A,O,L]),useEffect(()=>{if(!A)return document.addEventListener("mouseup",x),()=>{document.removeEventListener("mouseup",x)}},[x,A]),useEffect(()=>{var N;const U=typeof m.content=="string"?m.content:((N=m.content)==null?void 0:N.content)||"";if(!U||typeof U!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");return}console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="),console.log("isTableMode:",A),console.log("\u5185\u5BB9\u957F\u5EA6:",U.length||0),typeof U=="string"?(console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:",U.substring(0,100)),console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:",U.substring(U.length-100))):(console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:",typeof U),console.log("\u5185\u5BB9\u503C:",U)),console.log("\u6807\u6CE8\u6570\u636E:",L),console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:",O)},[L,O,A]),useEffect(()=>{if(A&&t.current){const N=setTimeout(()=>{var U;const G=(U=t.current)==null?void 0:U.querySelectorAll("table");G&&G.length>0&&(console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:",G.length),G.forEach((bt,wt)=>{if(bt instanceof HTMLTableElement){bt.style.width="100%",bt.style.minWidth="100%",bt.style.tableLayout="auto";const Mt=bt.closest(".markdown-table-mode");Mt&&Mt instanceof HTMLElement&&(Mt.style.width="100%",Mt.style.overflowX="auto"),console.log(`\u8868\u683C ${wt+1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`)}}))},500);return()=>clearTimeout(N)}},[A,m.content]),useEffect(()=>()=>{s.current&&clearTimeout(s.current),o.current&&(o.current.disconnect(),o.current=null)},[]),React__default.createElement("div",{style:{height:"100%",width:"100%",overflow:"auto"},className:`markdown-container markdown-scrollbar ${A?"markdown-table-mode":""}`},React__default.createElement("style",null,Le),React__default.createElement("div",{ref:t},React__default.createElement(O8,{dataSource:{type:ea.MARKDOWN,content:(()=>{var N,U;return typeof m.content=="string"?m.content:(N=m.content)!=null&&N.text?m.content.text:(U=m.content)!=null&&U.content?m.content.content:""})()},size:"md",onScroll:A?void 0:l,onScrollToTop:A?void 0:n,onScrollToBottom:A?void 0:r,onRendered:E,theme:{primaryColor:((V=(_=(f=a.styles)==null?void 0:f.theme)==null?void 0:_.colors)==null?void 0:V.primary)||"#007bff",backgroundColor:((M=(Y=(q=a.styles)==null?void 0:q.theme)==null?void 0:Y.colors)==null?void 0:M.background)||"#f8f9fa",textColor:((P=(w=(b=a.styles)==null?void 0:b.theme)==null?void 0:w.colors)==null?void 0:P.text)||"#343a40",borderColor:((c=(S=(F=a.styles)==null?void 0:F.theme)==null?void 0:S.colors)==null?void 0:c.border)||"#dee2e6",borderRadius:A?"0px":"8px",padding:A?"0px":"20px"},style:{height:"100%",border:"none",background:"transparent",overflowY:A?"visible":"scroll"}})))},Oe=({markdown:m,onRendered:a,tableAnnotations:A=[]})=>{const f=useRef(null),_=q=>{const Y=q.split(/\r?\n/).filter(F=>F.trim().length>0);let M=-1;for(let F=0;F<Y.length-1;F++){const S=Y[F].trim(),c=Y[F+1].trim();if(S.startsWith("|")&&S.endsWith("|")&&c.replace(/\s|:|\|/g,"").match(/^[-]+$/)){M=F;break}}if(M===-1)return null;const b=Y[M].split("|").slice(1,-1).map(F=>F.trim()),w=[];for(let F=M+2;F<Y.length;F++){const S=Y[F].trim();if(!S.startsWith("|")||!S.endsWith("|"))break;w.push(S)}const P=w.map(F=>F.split("|").slice(1,-1).map(S=>S.trim()));return{headers:b,rows:P}},V=React__default.useMemo(()=>_(m),[m]);return useEffect(()=>{const q=()=>{try{if(!f.current)return;const M=f.current.querySelectorAll("table");if(M.forEach(b=>{Array.from(b.rows).forEach(w=>{Array.from(w.cells).forEach(P=>{P.getAttribute("data-table-annotated")==="1"&&(P.style.removeProperty("background"),P.style.removeProperty("background-color"),P.removeAttribute("data-table-annotated"),P.removeAttribute("title"))})})}),!A.length||!M||M.length===0)return;A.forEach((b,w)=>{(b.offsets||[]).forEach((P,F)=>{const[S,c]=P;M.forEach(t=>{var s;const o=Array.from(t.rows)[S];if(!o)return;const v=(s=o.cells)==null?void 0:s[c];if(!v)return;const g=b.color||"rgba(255, 229, 153, 0.5)";v.getAttribute("data-table-annotated")==="1"||(v.style.setProperty("background",g,"important"),v.style.setProperty("background-color",g,"important"),v.setAttribute("data-table-annotated","1"),b.content&&(v.title=b.content)),w===0&&F===0&&setTimeout(()=>v.scrollIntoView({behavior:"smooth",block:"start"}),50)})})})}catch(M){console.warn("[MinimalMarkdownTable] apply annotations failed",M)}},Y=requestAnimationFrame(()=>{q(),a&&a()});return()=>cancelAnimationFrame(Y)},[m,A,a]),V?React__default.createElement("div",{ref:f,className:"markdown-table-mode z-mdtbl-wrapper"},React__default.createElement("style",null,`
|
|
171
171
|
.z-mdtbl-wrapper { overflow: auto; position: relative; }
|
|
172
172
|
.z-mdtbl { border-collapse: separate; border-spacing: 0; background: transparent; box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06); border-radius: 8px; }
|
|
173
173
|
.z-mdtbl th, .z-mdtbl td { border: 1px solid #e5e7eb; padding: 10px 14px; font-size: 13px; line-height: 1.4; color: inherit; }
|
|
@@ -154,4 +154,4 @@ import{jsxs as d,jsx as e,Fragment as Te}from"react/jsx-runtime";import Ze,{useS
|
|
|
154
154
|
font-size: 12px;
|
|
155
155
|
font-weight: 500;
|
|
156
156
|
margin-left: 8px;
|
|
157
|
-
`;const fe=Ue(({dataSource:n,value:s=[],onConfirm:r,maxCount:t=0,searchPlaceholder:h="\u641C\u7D22...",title:f="",showSearch:b=!0,filterOption:p,renderItem:c,renderSelectedItem:B,className:O,style:S,styles:w,height:F,width:j},D)=>{const l=Ge(),u=Ne(Ne({theme:R,mode:"light"},l),w),[a,i]=v(s),[E,m]=v("");K(()=>{i(s)},[s]),he(()=>new Set(s.map(o=>o.key)),[s]);const N=he(()=>new Set(a.map(o=>o.key)),[a]);Xe(D,()=>({getSelectedItems:()=>a,confirm:()=>{r==null||r(a)}}),[a,r]);const T=p||((o,x)=>{var H;if(!o)return!0;const _=o.toLowerCase();return x.label.toLowerCase().includes(_)||((H=x.tags)==null?void 0:H.some(V=>V.toLowerCase().includes(_)))||!1}),W=he(()=>(n||[]).filter(o=>T(E,o)),[n,E,T]),y=o=>{const x=N.has(o.key);let _;if(x)_=(a||[]).filter(H=>H.key!==o.key);else{if(t>0&&a.length>=t)return;_=[...a,o]}i(_)},C=(o,x)=>{i(_=>_.map(V=>V.key==o?{...V,tags:x}:V))},I=o=>{const x=(a||[]).filter(_=>_.key!==o.key);i(x)},A=o=>N.has(o);return t>0&&a.length>=t,d(hu,{$theme:u.theme||R,$width:j,$height:F,className:O,style:S,children:[d($e,{$theme:u.theme||R,style:{flex:1},children:[b&&e(fu,{$theme:u.theme||R,children:d("div",{style:{position:"relative"},children:[e(Fu,{children:e(nu,{size:16})}),e(gu,{$theme:u.theme||R,type:"text",placeholder:h,value:E,onChange:o=>m(o.target.value)})]})}),e(Ie,{children:W.length===0?e(Me,{$theme:u.theme||R,children:E?"\u672A\u627E\u5230\u5339\u914D\u9879":"\u6682\u65E0\u6570\u636E"}):W.map(o=>{const x=A(o.key);return d(Le,{$theme:u.theme||R,$selected:x,children:[e(ze,{$theme:u.theme||R,children:c?c(o):o.label}),x&&e(Pe,{$theme:u.theme||R,onClick:_=>{_.stopPropagation(),I(o)},disabled:!0,children:"\u5DF2\u6DFB\u52A0"}),!x&&e(Pe,{$theme:u.theme||R,onClick:_=>{_.stopPropagation(),y(o)},children:"\u6DFB\u52A0"})]},o.key)})})]}),d($e,{$theme:u.theme||R,style:{flex:1},children:[d(mu,{$theme:u.theme||R,children:[t>0?`\u5DF2\u9009\uFF1A${a.length}/${t}\u4E2A${f}`:`\u5DF2\u9009\uFF1A${a.length}\u4E2A${f}`,e(pu,{$theme:u.theme||R,onClick:o=>{o.stopPropagation(),i([])},children:"\u6E05\u7A7A"})]}),e(Ie,{children:a.length===0?e(Me,{$theme:u.theme||R,children:"\u6682\u65E0\u5DF2\u9009\u9879"}):a.map(o=>{var _,H,V;const x=ee=>C(o.key,ee);return d(Le,{$theme:u.theme||R,children:[e(ze,{$theme:u.theme||R,children:B?B(o,x):o.label}),e(Re,{size:14,color:((V=(H=(_=u.theme)==null?void 0:_.colors)==null?void 0:H.text)==null?void 0:V.secondary)||"#86909C",style:{cursor:"pointer"},onClick:ee=>{ee.stopPropagation(),I(o)}})]},o.key)})})]})]})});fe.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:Eu}=me,Cu=({url:n,token:s,role:r,eventsEmit:t,sectionData:h,defaultAnswer:f,form:b})=>{const[p,c]=v([]),[B,O]=v([]),[S,w]=v(!1),[F,j]=v(!1),D=se(null),{fetchSensitiveLibrary:l}=pe({url:n,token:s,role:r,eventsEmit:t});K(()=>{u()},[]),K(()=>{if(h&&(p==null?void 0:p.length)>0){let m=h?Array.isArray(h)?h:h.split(","):[],N=[];m.forEach(k=>{const T=(p||[]).find(W=>W.key===k);T&&N.push({key:T.key,label:T.label})}),O(N)}},[h,p]),K(()=>{f&&j(!0)},[f]);const u=async()=>{try{const m=await l({pageNo:1,pageSize:9999});if(m!=null&&m.records){const N=((m==null?void 0:m.records)||[]).map(k=>({key:k.id+"",label:k.name}));c(N)}}catch(m){console.error(m)}},a=(m,N)=>{switch(m){case"removeItem":const k=B.filter(T=>T.key!==N.key);O([...k]),i(k);break}},i=m=>{const N=m.map(k=>(k==null?void 0:k.key)||"").filter(k=>k).join(",");t&&t("sensitive_selected",N)},E=()=>{var N;const m=((N=D.current)==null?void 0:N.getSelectedItems())||[];O(m),w(!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(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>w(!0),children:"\u6DFB\u52A0"})]}),e(De,{checked:F,onChange:m=>{j(m.target.checked),m.target.checked?b.setFieldsValue({defaultAnswer:lu}):b.setFieldsValue({defaultAnswer:""})},style:{marginBottom:8,marginTop:8},children:"\u81EA\u5B9A\u4E49\u56DE\u590D"}),F&&e(Eu,{label:"\u81EA\u5B9A\u4E49\u56DE\u590D\u5185\u5BB9",name:"defaultAnswer",layout:"vertical",children:e(Fe.TextArea,{style:{height:"55px",resize:"none"}})}),(B==null?void 0:B.length)>0&&e(ye,{countText:(B==null?void 0:B.length)>0?`\u5DF2\u9009\uFF1A${B==null?void 0:B.length}\u4E2A\u654F\u611F\u8BCD\u5E93`:void 0,eventsEmit:a,data:B}),e(Be,{width:740,title:"\u9009\u62E9\u654F\u611F\u8BCD",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:S,onOk:E,onCancel:()=>w(!1),destroyOnHidden:!0,className:"assistant-config-resource-bind-modal",children:e(fe,{ref:D,dataSource:p,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,N)=>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})})]})})})]})},xe="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",Bu=({url:n,token:s,role:r,sectionData:t,createBy:h,eventsEmit:f})=>{const[b,p]=v(),[c,B]=v([]),[O,S]=v(!1),w=se(null),[F,j]=v(!1),[D,l]=v([]),u=se(new Map).current,{fetchKnowledgeBase:a,getBizLabelLabels:i}=pe({url:n,token:s,role:r,eventsEmit:f}),E=se(!1);K(()=>{E.current||(h?(m(h),E.current=!0):(m(),E.current=!0))},[h]),K(()=>{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 I=[];(C||[]).forEach(A=>{const o=((t==null?void 0:t.selectedKnowledgeBase)||[]).find(_=>_.name==A),x=(b||[]).find(_=>_.knowledge_base_name_source===A);if(x){const{key:_,label:H,knowledge_base_name:V,knowledge_base_name_source:ee}=x;I.push({key:_,label:H,knowledge_base_name:V,knowledge_base_name_source:ee,tags:o==null?void 0:o.labels})}}),B(I)}},[t,b]);const m=async y=>{try{const C=await a(y);if(C){const I=(C||[]).map(A=>({key:A.id,label:A.kbName,knowledge_base_name:A.primitiveName,knowledge_base_name_source:A.kbName}));p(I)}}catch(C){console.error(C)}},N=(y,C)=>{switch(y){case"removeItem":const I=c.filter(o=>o.key!==C.key);B([...I]),k(I);break;case"removeTag":const A=c.findIndex(o=>o.key==C.key);A!==-1&&(c[A]=C),B([...c]),k(c);break}},k=y=>{const C=(y||[]).map(o=>(o==null?void 0:o.knowledge_base_name)||"").filter(o=>o).join(";"),I=(y||[]).map(o=>(o==null?void 0:o.knowledge_base_name_source)||"").filter(o=>o).join(";"),A=(y||[]).filter(o=>{var x;return Array.isArray(o==null?void 0:o.tags)&&((x=o.tags)==null?void 0:x.length)>0}).map(o=>({id:o.key,name:o.label,knowledge_base_name_source:o.knowledge_base_name_source,labels:o.tags}));f&&f("knowledge_selected",{knowledge_base_name:C,knowledge_base_name_source:I,selectedKnowledgeBase:A})},T=()=>{var C;const y=((C=w.current)==null?void 0:C.getSelectedItems())||[];B(y),S(!1),k(y)},W=async(y,C)=>{if(y){const I=u.get(C);if(I){l(I);return}if(!F)try{j(!0);const A=await i({kbNames:[C]});if(Array.isArray(A)){const o=A.length?A[0].label:"",x=o?(o||"").split(",").map(_=>({label:_,value:_})):[];u.set(C,x),l(x)}j(!1)}catch(A){console.error("Error fetching data:",A),j(!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:xe}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u77E5\u8BC6\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>S(!0),children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(ye,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u77E5\u8BC6\u5E93`:void 0,eventsEmit:N,data:c}),e(Be,{width:740,className:"assistant-config-resource-bind-modal",title:"\u9009\u62E9\u77E5\u8BC6\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:O,onOk:T,onCancel:()=>S(!1),destroyOnHidden:!0,children:e(fe,{ref:w,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:xe,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:xe,alt:"add"}),d("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:y.label}),e(J,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:y.tags||[],onChange:I=>{C(I)},style:{width:250},options:D,loading:F,onOpenChange:I=>{W(I,y.knowledge_base_name)}})]})]})})})]})},yu=Ze.memo(Bu),_e="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",Oe=10,bu=({url:n,token:s,role:r,eventsEmit:t,sectionData:h,disabled:f})=>{const[b,p]=v([]),[c,B]=v([]),[O,S]=v(!1),w=se(null),{fetchDatabases:F}=pe({url:n,token:s,role:r,eventsEmit:t});K(()=>{j()},[]),K(()=>{if(h){let u=[];(h||[]).map(a=>{const i=(b||[]).find(E=>E.key===a.key);if(i){const{key:E,label:m}=i;u.push({key:E,label:m})}}),B(u)}},[h,b]);const j=async()=>{try{const u=await F();if(u){const a=(u||[]).map(i=>({key:i.primitiveName,label:i.name}));p(a)}}catch(u){console.error(u)}},D=(u,a)=>{switch(u){case"removeItem":const i=c.filter(E=>E.key!==a.key);B([...i]),t&&t("database_selected",i);break}},l=()=>{var a;const u=((a=w.current)==null?void 0:a.getSelectedItems())||[];B(u),S(!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:_e}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u6570\u636E\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>S(!0),disabled:c.length>=Oe||f,children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(ye,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u6570\u636E\u5E93`:void 0,eventsEmit:D,data:c}),e(Be,{width:740,title:"\u9009\u62E9\u6570\u636E\u5E93",className:"assistant-config-resource-bind-modal",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:O,onOk:l,onCancel:()=>S(!1),destroyOnHidden:!0,children:e(fe,{ref:w,dataSource:b,value:c,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u6570\u636E\u5E93",maxCount:Oe,renderItem:u=>d("div",{className:"flex ",children:[e("img",{src:_e,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:u.label,children:u.label})]}),renderSelectedItem:(u,a)=>d("div",{className:"flex items-center",children:[e("img",{src:_e,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:u.label})})]})})})]})},ve="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",Au=({url:n,token:s,role:r,eventsEmit:t,sectionData:h})=>{const[f,b]=v([]),[p,c]=v([]),[B,O]=v(!1),S=se(null),{fetchGraphs:w}=pe({url:n,token:s,role:r,eventsEmit:t});K(()=>{F()},[]),K(()=>{if(h){let u=[];(h||[]).map(a=>{const i=(f||[]).find(E=>E.key===a.index_name);if(i){const{key:E,label:m}=i;u.push({key:E,label:m})}}),c(u)}},[h,f]);const F=async()=>{try{const u=await w();if(u!=null&&u.dataList){const a=((u==null?void 0:u.dataList)||[]).map(i=>({key:i.schemaId,label:i.name}));b(a)}}catch(u){console.error(u)}},j=(u,a)=>{switch(u){case"removeItem":const i=p.filter(E=>E.key!==a.key);c([...i]),D(i);break}},D=u=>{const a=(u||[]).map(i=>({graph_name:i.label,index_name:i.key}));t&&t("graph_selected",a)},l=()=>{var a;const u=((a=S.current)==null?void 0:a.getSelectedItems())||[];c(u),O(!1),D(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:ve}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>O(!0),children:"\u6DFB\u52A0"})})]}),(p==null?void 0:p.length)>0&&e(ye,{countText:(p==null?void 0:p.length)>0?`\u5DF2\u9009\uFF1A${p==null?void 0:p.length}\u4E2A\u56FE\u8C31`:void 0,eventsEmit:j,data:p}),e(Be,{width:740,title:"\u9009\u62E9\u56FE\u8C31",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",className:"assistant-config-resource-bind-modal",open:B,onOk:l,destroyOnHidden:!0,onCancel:()=>O(!1),children:e(fe,{ref:S,dataSource:f,value:p,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31",renderItem:u=>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:u.label,children:u.label})]}),renderSelectedItem:u=>d("div",{className:"flex items-center",children:[e("img",{src:ve,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:u.label})})]})})})]})},wu=({value:n,onChange:s,min:r,max:t,step:h,disabled:f,sliderStyle:b,inputStyle:p,inputWidth:c=90})=>{const B=S=>{const w=Array.isArray(S)?S[0]:S;s==null||s(w)},O=S=>{s==null||s(S)};return d(uu,{style:{width:"100%"},children:[e(Ye,{min:r,max:t,step:h,disabled:f,value:n,onChange:B,style:{width:"200px",flex:1,...b}}),e(Qe,{min:r,max:t,step:h,disabled:f,controls:!1,value:n,onChange:O,style:{width:c,...p}})]})},{Item:xu}=me,ie=({label:n,name:s,configScale:r})=>{const t=he(()=>r[s],[r]),h=(f,b)=>({validator(p,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<f||c>b?Promise.reject(`\u8BF7\u8F93\u5165${f}\u5230${b}\u4E4B\u95F4\u7684\u6570\u5B57`):Promise.resolve()}});return e(Q,{span:12,children:e(xu,{label:n,name:s,tooltip:t.tooltip,rules:[{required:!0,message:""},h(t.min,t.max)],children:e(wu,{min:t.min,max:t.max,step:t.step})})})},{Item:M}=me,Iu=({url:n,token:s,role:r,id:t,showDatabase:h,showGraph:f,isShare:b,disabled:p,eventsEmit:c,showGraphEnhanced:B,CustomComponents:O})=>{const{ContentLoading:S}=O,[w]=me.useForm(),[F,j]=v(),[D,l]=v(),[u,a]=v(),[i,E]=v(),[m,N]=v(),[k,T]=v(!0),[W,y]=v(!1),[C,I]=v(ne),A=se({}),{getConfigById:o,fetchModels:x,fetchConfigItemLimit:_,checkName:H,addConversationAssistant:V,updateConversationAssistant:ee}=pe({url:n,token:s,role:r,eventsEmit:c});K(()=>{je()},[t]),K(()=>{t?(Array.isArray(D)&&Array.isArray(u)&&w.validateFields(["model_name","plan_model_name","recommend_model_name","rerank_model_name","multi_model_name","embedding_model_name"]),Array.isArray(i)&&w.validateFields(["multi_model_name"])):(Array.isArray(D)&&(D==null?void 0:D.length)==0&&w.validateFields(["model_name","plan_model_name","recommend_model_name","embedding_model_name"]),Array.isArray(u)&&(u==null?void 0:u.length)==0&&w.validateFields(["rerank_model_name"]),Array.isArray(i)&&(i==null?void 0:i.length)==0&&w.validateFields(["multi_model_name"]),Array.isArray(m)&&(m==null?void 0:m.length)==0&&w.validateFields(["embedding_model_name"]))},[u,D,i,m,t]);const je=async()=>{let g;if(t){k||T(!0);try{const $=await o(t);if($){const{configJson:L,...Z}=$,U=L&&JSON.parse(L),{knowledge_base_name:X,knowledge_base_name_source:G,selectedKnowledgeBase:ue,sensitiveWordIds:Y,database_name:le,graph_nb_name:z}=U;g={...Z,...U},A.current={knowledge_base_name:X,knowledge_base_name_source:G,selectedKnowledgeBase:ue,sensitiveWordIds:Y,database_name:le,graph_nb_name:z},j(g),w.setFieldsValue(g),T(!1)}}catch{}}else T(!1);await qe(g)},qe=async g=>{var $,L,Z,U;try{const[X,G,ue,Y,le]=await Promise.allSettled([x({pageNum:1,pageSize:9999,status:1,type:1}),x({pageNum:1,pageSize:9999,status:1,type:3}),x({pageNum:1,pageSize:9999,status:1,type:4}),_(),x({pageNum:1,pageSize:9999,status:1,type:2})]);if(X.status==="fulfilled"&&X.value){const P=((($=X.value)==null?void 0:$.records)||[]).map(ce=>({...ce,label:ce.modelName,value:ce.modelName}));l(P)}if(G.status==="fulfilled"&&G.value){const z=(((L=G.value)==null?void 0:L.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));a(z),z.length>0&&!(g!=null&&g.rerank_model_name)&&w.setFieldsValue({rerank_model_name:z[0].value})}if(ue.status==="fulfilled"&&ue.value){const z=(((Z=ue.value)==null?void 0:Z.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));E(z),z.length>0&&!(g!=null&&g.multi_model_name)&&w.setFieldsValue({multi_model_name:z[0].value})}if(le.status==="fulfilled"&&le.value){const z=(((U=le.value)==null?void 0:U.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));N(z),z.length>0&&!(g!=null&&g.embedding_model_name)&&w.setFieldsValue({embedding_model_name:z[0].value})}if(Y.status==="fulfilled"&&Y.value&&Y.value){const z=Y.value;Object.keys(ne).forEach(P=>{if(z.hasOwnProperty(P)){const{max:ce,min:We}=z[P];ne[P]={...ne[P],min:We,max:ce}}}),I(ne)}}catch(X){console.error("\u83B7\u53D6\u5217\u8868\u5931\u8D25:",X)}},He=async(g,$)=>await H($,t)?(be.warning("\u540D\u79F0\u91CD\u590D\uFF01",2),Promise.reject("\u540D\u79F0\u91CD\u590D")):Promise.resolve(),ae=(g,$)=>({validator(L,Z){return Z?Array.isArray(g)&&g.length===0||!g.find(U=>U.value==Z)?Promise.reject("\u6A21\u578B\u65E0\u6CD5\u4F7F\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.resolve():Array.isArray(g)&&g.length===0?Promise.reject("\u6682\u65E0\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.reject($)}}),ge=(g,$)=>{switch(g){case"knowledge_selected":A.current={...A.current,...$};break;case"sensitive_selected":A.current={...A.current,sensitiveWordIds:$};break;case"database_selected":A.current={...A.current,database_name:$};break;case"graph_selected":A.current={...A.current,graph_nb_name:$};break}},Ve=async()=>{var $;let g={};try{y(!0);const L=await w.validateFields(),{knowledge_base_name:Z,knowledge_base_name_source:U,selectedKnowledgeBase:X,sensitiveWordIds:G,database_name:ue,graph_nb_name:Y}=A.current;L.thinking=(($=D.find(z=>z.modelName==L.model_name))==null?void 0:$.thinking)||!1,f&&(L.enabled_nb_graph=!0),g={configJson:JSON.stringify({...L,knowledge_base_name:Z,knowledge_base_name_source:U,selectedKnowledgeBase:X,sensitiveWordIds:G,...h?{database_name:ue}:{},...f?{graph_nb_name:Y}:{}}),name:L.config_name,isDefault:L.isDefault,defaultAnswer:L.defaultAnswer,dependOnKb:L.dependOnKb,sensitiveWordIds:G},t?await ee(t,g)&&(be.success("\u66F4\u65B0\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back")):await V(g)&&(be.success("\u65B0\u589E\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back"))}catch(L){console.error("submit error",L)}finally{y(!1)}},Ke=he(()=>{const g={};return Object.keys(ne).forEach($=>{var L;g[$]=(L=ne[$])==null?void 0:L.default}),{...ou,...g}},[]);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(tu,{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"})]}),!k&&e(re,{type:"primary",onClick:()=>Ve(),loading:W,disabled:p,children:"\u786E\u5B9A"})]}),k?S&&e(S,{}):e(me,{style:{padding:20,height:"calc(100vh - 150px)",backgroundColor:"#fff"},form:w,layout:"vertical",initialValues:Ke,disabled:p,colon:!1,children:d(te,{gutter:24,style:{height:"100%"},children:[d(Q,{span:12,style:{borderRight:"1px solid #E5E6EB",padding:"10px 32px",height:"100%",overflowY:"auto"},children:[e(M,{label:"\u52A9\u624B\u540D\u79F0",name:"config_name",validateTrigger:"onBlur",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u52A9\u624B\u540D\u79F0"},{validator:He}],children:e(Fe,{placeholder:"\u8BF7\u8F93\u5165"})}),d(te,{gutter:16,children:[e(Q,{span:12,children:e(M,{label:"\u95EE\u7B54\u6A21\u578B",name:"model_name",rules:[{required:!0,message:""},ae(D,"\u8BF7\u9009\u62E9\u95EE\u7B54\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:D,notFoundContent:e(oe,{})})})}),e(Q,{span:12,children:e(M,{label:"\u89C4\u5212\u6A21\u578B",name:"plan_model_name",rules:[{required:!0,message:""},ae(D,"\u8BF7\u9009\u62E9\u89C4\u5212\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:D,notFoundContent:e(oe,{})})})})]}),d(te,{gutter:16,children:[e(Q,{span:12,children:e(M,{label:"\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B",name:"multi_model_name",rules:[{required:!0,message:""},ae(i,"\u8BF7\u9009\u62E9\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:i,notFoundContent:e(oe,{})})})}),e(Q,{span:12,children:e(M,{label:"Rerank\u6A21\u578B",name:"rerank_model_name",rules:[{required:!0,message:""},ae(u,"\u8BF7\u9009\u62E9Rerank\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:u,notFoundContent:e(oe,{})})})})]}),e(te,{gutter:16,children:e(Q,{span:24,children:e(M,{label:"\u5411\u91CF\u89E3\u6790\u6A21\u578B",name:"embedding_model_name",rules:[{required:!0,message:""},ae(m,"\u8BF7\u9009\u62E9\u5411\u91CF\u89E3\u6790\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:m,notFoundContent:e(oe,{})})})})}),e(M,{label:"\u5F00\u573A\u767D",name:"prologue",children:e(Fe.TextArea,{maxLength:50,showCount:!0,placeholder:"\u8BF7\u8F93\u5165\u5F00\u573A\u767D",autoSize:{minRows:2}})}),e(M,{label:"\u63D0\u793A\u8BCD",name:"system_prompt",tooltip:su,children:e(Fe.TextArea,{showCount:!0,rows:8,maxLength:3e3,autoSize:{minRows:10},placeholder:`\u4F8B\u5982\uFF1A${au}`})}),e(M,{name:"isDefault",valuePropName:"checked",normalize:g=>g===!0?1:0,children:e(De,{children:"\u9009\u62E9\u4E3A\u9ED8\u8BA4\u52A9\u624B"})})]}),d(Q,{span:12,style:{height:"100%",padding:"10px 32px",overflowY:"auto"},children:[d(Ae,{title:"\u68C0\u7D22\u4E0E\u751F\u6210\u53C2\u6570",children:[e(M,{label:"\u95EE\u9898\u63A8\u8350\u6A21\u578B",name:"recommend_model_name",rules:[{required:!0,message:""},ae(D,"\u8BF7\u9009\u62E9\u95EE\u9898\u63A8\u8350\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:D,notFoundContent:e(oe,{})})}),e(M,{label:"\u68C0\u7D22\u7B56\u7565",name:"search_policy",children:e(J,{options:iu,placeholder:"\u8BF7\u9009\u62E9"})}),d(te,{gutter:16,children:[e(ie,{label:"\u6E29\u5EA6",name:"temperature",configScale:C}),e(ie,{label:"\u591A\u6837\u6027",name:"top_p",configScale:C})]}),d(te,{gutter:16,children:[e(ie,{label:"\u53EC\u56DE\u6570",name:"top_k",configScale:C}),e(ie,{label:"\u76F8\u4F3C\u5EA6\u9608\u503C",name:"score_threshold",configScale:C})]}),d(te,{gutter:16,children:[e(ie,{label:"\u6700\u5927\u4EE4\u724C\u6570",name:"max_tokens",configScale:C}),e(ie,{label:"\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570",name:"max_round",configScale:C})]})]}),d(Ae,{title:"\u529F\u80FD\u5F00\u5173",children:[e(M,{label:"\u5F00\u542FFAQ\u4F18\u5148",name:"enabled_faq",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),B&&e(M,{label:"\u542F\u7528\u56FE\u8C31\u589E\u5F3A",name:"enabled_graph",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),e(M,{label:"\u5F00\u542F\u5F3A\u4F01\u4E1A\u77E5\u8BC6\u4F9D\u8D56",name:"dependOnKb",valuePropName:"checked",layout:"horizontal",tooltip:ru,normalize:g=>g===!0?1:0,children:e(de,{})}),e(M,{label:"\u5F00\u542F\u95EE\u9898\u6539\u5199",name:"enabled_question_rewrite",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),e(M,{label:"\u5F00\u542F\u6EAF\u6E90",name:"need_trace_source",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),e(M,{noStyle:!0,shouldUpdate:(g,$)=>g.need_trace_source!==$.need_trace_source,children:({getFieldValue:g})=>g("need_trace_source")?d(Te,{children:[e(M,{label:"\u6EAF\u6E90\u7B56\u7565",name:"trace_by_llm",layout:"horizontal",children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:cu})}),e(M,{name:"is_download",valuePropName:"checked",layout:"horizontal",children:e(De,{children:"\u5141\u8BB8\u4E0B\u8F7D\u6EAF\u6E90\u6587\u4EF6"})})]}):null})]}),d(Ae,{title:"\u8D44\u6E90\u7ED1\u5B9A",children:[e(Cu,{url:n,token:s,role:r,sectionData:F==null?void 0:F.sensitiveWordIds,eventsEmit:ge,defaultAnswer:F==null?void 0:F.defaultAnswer,form:w}),e(yu,{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:ge}),h&&e(bu,{url:n,token:s,role:r,disabled:p,sectionData:F==null?void 0:F.database_name,eventsEmit:ge}),f&&e(Au,{url:n,token:s,role:r,sectionData:F==null?void 0:F.graph_nb_name,eventsEmit:ge})]})]})]})})]})};export{Iu as C,nu as S};
|
|
157
|
+
`;const fe=Ue(({dataSource:n,value:s=[],onConfirm:r,maxCount:t=0,searchPlaceholder:h="\u641C\u7D22...",title:f="",showSearch:b=!0,filterOption:p,renderItem:c,renderSelectedItem:B,className:O,style:S,styles:w,height:F,width:j},D)=>{const l=Ge(),u=Ne(Ne({theme:R,mode:"light"},l),w),[a,i]=v(s),[E,m]=v("");K(()=>{i(s)},[s]),he(()=>new Set(s.map(o=>o.key)),[s]);const N=he(()=>new Set(a.map(o=>o.key)),[a]);Xe(D,()=>({getSelectedItems:()=>a,confirm:()=>{r==null||r(a)}}),[a,r]);const T=p||((o,x)=>{var H;if(!o)return!0;const _=o.toLowerCase();return x.label.toLowerCase().includes(_)||((H=x.tags)==null?void 0:H.some(V=>V.toLowerCase().includes(_)))||!1}),W=he(()=>(n||[]).filter(o=>T(E,o)),[n,E,T]),y=o=>{const x=N.has(o.key);let _;if(x)_=(a||[]).filter(H=>H.key!==o.key);else{if(t>0&&a.length>=t)return;_=[...a,o]}i(_)},C=(o,x)=>{i(_=>_.map(V=>V.key==o?{...V,tags:x}:V))},I=o=>{const x=(a||[]).filter(_=>_.key!==o.key);i(x)},A=o=>N.has(o);return t>0&&a.length>=t,d(hu,{$theme:u.theme||R,$width:j,$height:F,className:O,style:S,children:[d($e,{$theme:u.theme||R,style:{flex:1},children:[b&&e(fu,{$theme:u.theme||R,children:d("div",{style:{position:"relative"},children:[e(Fu,{children:e(nu,{size:16})}),e(gu,{$theme:u.theme||R,type:"text",placeholder:h,value:E,onChange:o=>m(o.target.value)})]})}),e(Ie,{children:W.length===0?e(Me,{$theme:u.theme||R,children:E?"\u672A\u627E\u5230\u5339\u914D\u9879":"\u6682\u65E0\u6570\u636E"}):W.map(o=>{const x=A(o.key);return d(Le,{$theme:u.theme||R,$selected:x,children:[e(ze,{$theme:u.theme||R,children:c?c(o):o.label}),x&&e(Pe,{$theme:u.theme||R,onClick:_=>{_.stopPropagation(),I(o)},disabled:!0,children:"\u5DF2\u6DFB\u52A0"}),!x&&e(Pe,{$theme:u.theme||R,onClick:_=>{_.stopPropagation(),y(o)},children:"\u6DFB\u52A0"})]},o.key)})})]}),d($e,{$theme:u.theme||R,style:{flex:1},children:[d(mu,{$theme:u.theme||R,children:[t>0?`\u5DF2\u9009\uFF1A${a.length}/${t}\u4E2A${f}`:`\u5DF2\u9009\uFF1A${a.length}\u4E2A${f}`,e(pu,{$theme:u.theme||R,onClick:o=>{o.stopPropagation(),i([])},children:"\u6E05\u7A7A"})]}),e(Ie,{children:a.length===0?e(Me,{$theme:u.theme||R,children:"\u6682\u65E0\u5DF2\u9009\u9879"}):a.map(o=>{var _,H,V;const x=ee=>C(o.key,ee);return d(Le,{$theme:u.theme||R,children:[e(ze,{$theme:u.theme||R,children:B?B(o,x):o.label}),e(Re,{size:14,color:((V=(H=(_=u.theme)==null?void 0:_.colors)==null?void 0:H.text)==null?void 0:V.secondary)||"#86909C",style:{cursor:"pointer"},onClick:ee=>{ee.stopPropagation(),I(o)}})]},o.key)})})]})]})});fe.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:Eu}=me,Cu=({url:n,token:s,role:r,eventsEmit:t,sectionData:h,defaultAnswer:f,form:b})=>{const[p,c]=v([]),[B,O]=v([]),[S,w]=v(!1),[F,j]=v(!1),D=se(null),{fetchSensitiveLibrary:l}=pe({url:n,token:s,role:r,eventsEmit:t});K(()=>{u()},[]),K(()=>{if(h&&(p==null?void 0:p.length)>0){let m=h?Array.isArray(h)?h:h.split(","):[],N=[];m.forEach(k=>{const T=(p||[]).find(W=>W.key===k);T&&N.push({key:T.key,label:T.label})}),O(N)}},[h,p]),K(()=>{f&&j(!0)},[f]);const u=async()=>{try{const m=await l({pageNo:1,pageSize:9999});if(m!=null&&m.records){const N=((m==null?void 0:m.records)||[]).map(k=>({key:k.id+"",label:k.name}));c(N)}}catch(m){console.error(m)}},a=(m,N)=>{switch(m){case"removeItem":const k=B.filter(T=>T.key!==N.key);O([...k]),i(k);break}},i=m=>{const N=m.map(k=>(k==null?void 0:k.key)||"").filter(k=>k).join(",");t&&t("sensitive_selected",N)},E=()=>{var N;const m=((N=D.current)==null?void 0:N.getSelectedItems())||[];O(m),w(!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(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>w(!0),children:"\u6DFB\u52A0"})]}),e(De,{checked:F,onChange:m=>{j(m.target.checked),m.target.checked?b.setFieldsValue({defaultAnswer:lu}):b.setFieldsValue({defaultAnswer:""})},style:{marginBottom:8,marginTop:8},children:"\u81EA\u5B9A\u4E49\u56DE\u590D"}),F&&e(Eu,{label:"\u81EA\u5B9A\u4E49\u56DE\u590D\u5185\u5BB9",name:"defaultAnswer",layout:"vertical",children:e(Fe.TextArea,{style:{height:"55px",resize:"none"}})}),(B==null?void 0:B.length)>0&&e(ye,{countText:(B==null?void 0:B.length)>0?`\u5DF2\u9009\uFF1A${B==null?void 0:B.length}\u4E2A\u654F\u611F\u8BCD\u5E93`:void 0,eventsEmit:a,data:B}),e(Be,{width:740,title:"\u9009\u62E9\u654F\u611F\u8BCD",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:S,onOk:E,onCancel:()=>w(!1),destroyOnHidden:!0,className:"assistant-config-resource-bind-modal",children:e(fe,{ref:D,dataSource:p,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,N)=>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})})]})})})]})},xe="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",Bu=({url:n,token:s,role:r,sectionData:t,createBy:h,eventsEmit:f})=>{const[b,p]=v(),[c,B]=v([]),[O,S]=v(!1),w=se(null),[F,j]=v(!1),[D,l]=v([]),u=se(new Map).current,{fetchKnowledgeBase:a,getBizLabelLabels:i}=pe({url:n,token:s,role:r,eventsEmit:f}),E=se(!1);K(()=>{E.current||(h?(m(h),E.current=!0):(m(),E.current=!0))},[h]),K(()=>{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 I=[];(C||[]).forEach(A=>{const o=((t==null?void 0:t.selectedKnowledgeBase)||[]).find(_=>_.name==A),x=(b||[]).find(_=>_.knowledge_base_name_source===A);if(x){const{key:_,label:H,knowledge_base_name:V,knowledge_base_name_source:ee}=x;I.push({key:_,label:H,knowledge_base_name:V,knowledge_base_name_source:ee,tags:o==null?void 0:o.labels})}}),B(I)}},[t,b]);const m=async y=>{try{const C=await a(y);if(C){const I=(C||[]).map(A=>({key:A.id,label:A.kbName,knowledge_base_name:A.primitiveName,knowledge_base_name_source:A.kbName}));p(I)}}catch(C){console.error(C)}},N=(y,C)=>{switch(y){case"removeItem":const I=c.filter(o=>o.key!==C.key);B([...I]),k(I);break;case"removeTag":const A=c.findIndex(o=>o.key==C.key);A!==-1&&(c[A]=C),B([...c]),k(c);break}},k=y=>{const C=(y||[]).map(o=>(o==null?void 0:o.knowledge_base_name)||"").filter(o=>o).join(";"),I=(y||[]).map(o=>(o==null?void 0:o.knowledge_base_name_source)||"").filter(o=>o).join(";"),A=(y||[]).filter(o=>{var x;return Array.isArray(o==null?void 0:o.tags)&&((x=o.tags)==null?void 0:x.length)>0}).map(o=>({id:o.key,name:o.label,knowledge_base_name_source:o.knowledge_base_name,labels:o.tags}));f&&f("knowledge_selected",{knowledge_base_name:C,knowledge_base_name_source:I,selectedKnowledgeBase:A})},T=()=>{var C;const y=((C=w.current)==null?void 0:C.getSelectedItems())||[];B(y),S(!1),k(y)},W=async(y,C)=>{if(y){const I=u.get(C);if(I){l(I);return}if(!F)try{j(!0);const A=await i({kbNames:[C]});if(Array.isArray(A)){const o=A.length?A[0].label:"",x=o?(o||"").split(",").map(_=>({label:_,value:_})):[];u.set(C,x),l(x)}j(!1)}catch(A){console.error("Error fetching data:",A),j(!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:xe}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u77E5\u8BC6\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>S(!0),children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(ye,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u77E5\u8BC6\u5E93`:void 0,eventsEmit:N,data:c}),e(Be,{width:740,className:"assistant-config-resource-bind-modal",title:"\u9009\u62E9\u77E5\u8BC6\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:O,onOk:T,onCancel:()=>S(!1),destroyOnHidden:!0,children:e(fe,{ref:w,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:xe,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:xe,alt:"add"}),d("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:y.label}),e(J,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:y.tags||[],onChange:I=>{C(I)},style:{width:250},options:D,loading:F,onOpenChange:I=>{W(I,y.knowledge_base_name)}})]})]})})})]})},yu=Ze.memo(Bu),_e="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",Oe=10,bu=({url:n,token:s,role:r,eventsEmit:t,sectionData:h,disabled:f})=>{const[b,p]=v([]),[c,B]=v([]),[O,S]=v(!1),w=se(null),{fetchDatabases:F}=pe({url:n,token:s,role:r,eventsEmit:t});K(()=>{j()},[]),K(()=>{if(h){let u=[];(h||[]).map(a=>{const i=(b||[]).find(E=>E.key===a.key);if(i){const{key:E,label:m}=i;u.push({key:E,label:m})}}),B(u)}},[h,b]);const j=async()=>{try{const u=await F();if(u){const a=(u||[]).map(i=>({key:i.primitiveName,label:i.name}));p(a)}}catch(u){console.error(u)}},D=(u,a)=>{switch(u){case"removeItem":const i=c.filter(E=>E.key!==a.key);B([...i]),t&&t("database_selected",i);break}},l=()=>{var a;const u=((a=w.current)==null?void 0:a.getSelectedItems())||[];B(u),S(!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:_e}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u6570\u636E\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>S(!0),disabled:c.length>=Oe||f,children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(ye,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u6570\u636E\u5E93`:void 0,eventsEmit:D,data:c}),e(Be,{width:740,title:"\u9009\u62E9\u6570\u636E\u5E93",className:"assistant-config-resource-bind-modal",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:O,onOk:l,onCancel:()=>S(!1),destroyOnHidden:!0,children:e(fe,{ref:w,dataSource:b,value:c,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u6570\u636E\u5E93",maxCount:Oe,renderItem:u=>d("div",{className:"flex ",children:[e("img",{src:_e,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:u.label,children:u.label})]}),renderSelectedItem:(u,a)=>d("div",{className:"flex items-center",children:[e("img",{src:_e,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:u.label})})]})})})]})},ve="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",Au=({url:n,token:s,role:r,eventsEmit:t,sectionData:h})=>{const[f,b]=v([]),[p,c]=v([]),[B,O]=v(!1),S=se(null),{fetchGraphs:w}=pe({url:n,token:s,role:r,eventsEmit:t});K(()=>{F()},[]),K(()=>{if(h){let u=[];(h||[]).map(a=>{const i=(f||[]).find(E=>E.key===a.index_name);if(i){const{key:E,label:m}=i;u.push({key:E,label:m})}}),c(u)}},[h,f]);const F=async()=>{try{const u=await w();if(u!=null&&u.dataList){const a=((u==null?void 0:u.dataList)||[]).map(i=>({key:i.schemaId,label:i.name}));b(a)}}catch(u){console.error(u)}},j=(u,a)=>{switch(u){case"removeItem":const i=p.filter(E=>E.key!==a.key);c([...i]),D(i);break}},D=u=>{const a=(u||[]).map(i=>({graph_name:i.label,index_name:i.key}));t&&t("graph_selected",a)},l=()=>{var a;const u=((a=S.current)==null?void 0:a.getSelectedItems())||[];c(u),O(!1),D(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:ve}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>O(!0),children:"\u6DFB\u52A0"})})]}),(p==null?void 0:p.length)>0&&e(ye,{countText:(p==null?void 0:p.length)>0?`\u5DF2\u9009\uFF1A${p==null?void 0:p.length}\u4E2A\u56FE\u8C31`:void 0,eventsEmit:j,data:p}),e(Be,{width:740,title:"\u9009\u62E9\u56FE\u8C31",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",className:"assistant-config-resource-bind-modal",open:B,onOk:l,destroyOnHidden:!0,onCancel:()=>O(!1),children:e(fe,{ref:S,dataSource:f,value:p,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31",renderItem:u=>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:u.label,children:u.label})]}),renderSelectedItem:u=>d("div",{className:"flex items-center",children:[e("img",{src:ve,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:u.label})})]})})})]})},wu=({value:n,onChange:s,min:r,max:t,step:h,disabled:f,sliderStyle:b,inputStyle:p,inputWidth:c=90})=>{const B=S=>{const w=Array.isArray(S)?S[0]:S;s==null||s(w)},O=S=>{s==null||s(S)};return d(uu,{style:{width:"100%"},children:[e(Ye,{min:r,max:t,step:h,disabled:f,value:n,onChange:B,style:{width:"200px",flex:1,...b}}),e(Qe,{min:r,max:t,step:h,disabled:f,controls:!1,value:n,onChange:O,style:{width:c,...p}})]})},{Item:xu}=me,ie=({label:n,name:s,configScale:r})=>{const t=he(()=>r[s],[r]),h=(f,b)=>({validator(p,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<f||c>b?Promise.reject(`\u8BF7\u8F93\u5165${f}\u5230${b}\u4E4B\u95F4\u7684\u6570\u5B57`):Promise.resolve()}});return e(Q,{span:12,children:e(xu,{label:n,name:s,tooltip:t.tooltip,rules:[{required:!0,message:""},h(t.min,t.max)],children:e(wu,{min:t.min,max:t.max,step:t.step})})})},{Item:M}=me,Iu=({url:n,token:s,role:r,id:t,showDatabase:h,showGraph:f,isShare:b,disabled:p,eventsEmit:c,showGraphEnhanced:B,CustomComponents:O})=>{const{ContentLoading:S}=O,[w]=me.useForm(),[F,j]=v(),[D,l]=v(),[u,a]=v(),[i,E]=v(),[m,N]=v(),[k,T]=v(!0),[W,y]=v(!1),[C,I]=v(ne),A=se({}),{getConfigById:o,fetchModels:x,fetchConfigItemLimit:_,checkName:H,addConversationAssistant:V,updateConversationAssistant:ee}=pe({url:n,token:s,role:r,eventsEmit:c});K(()=>{je()},[t]),K(()=>{t?(Array.isArray(D)&&Array.isArray(u)&&w.validateFields(["model_name","plan_model_name","recommend_model_name","rerank_model_name","multi_model_name","embedding_model_name"]),Array.isArray(i)&&w.validateFields(["multi_model_name"])):(Array.isArray(D)&&(D==null?void 0:D.length)==0&&w.validateFields(["model_name","plan_model_name","recommend_model_name","embedding_model_name"]),Array.isArray(u)&&(u==null?void 0:u.length)==0&&w.validateFields(["rerank_model_name"]),Array.isArray(i)&&(i==null?void 0:i.length)==0&&w.validateFields(["multi_model_name"]),Array.isArray(m)&&(m==null?void 0:m.length)==0&&w.validateFields(["embedding_model_name"]))},[u,D,i,m,t]);const je=async()=>{let g;if(t){k||T(!0);try{const $=await o(t);if($){const{configJson:L,...Z}=$,U=L&&JSON.parse(L),{knowledge_base_name:X,knowledge_base_name_source:G,selectedKnowledgeBase:ue,sensitiveWordIds:Y,database_name:le,graph_nb_name:z}=U;g={...Z,...U},A.current={knowledge_base_name:X,knowledge_base_name_source:G,selectedKnowledgeBase:ue,sensitiveWordIds:Y,database_name:le,graph_nb_name:z},j(g),w.setFieldsValue(g),T(!1)}}catch{}}else T(!1);await qe(g)},qe=async g=>{var $,L,Z,U;try{const[X,G,ue,Y,le]=await Promise.allSettled([x({pageNum:1,pageSize:9999,status:1,type:1}),x({pageNum:1,pageSize:9999,status:1,type:3}),x({pageNum:1,pageSize:9999,status:1,type:4}),_(),x({pageNum:1,pageSize:9999,status:1,type:2})]);if(X.status==="fulfilled"&&X.value){const P=((($=X.value)==null?void 0:$.records)||[]).map(ce=>({...ce,label:ce.modelName,value:ce.modelName}));l(P)}if(G.status==="fulfilled"&&G.value){const z=(((L=G.value)==null?void 0:L.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));a(z),z.length>0&&!(g!=null&&g.rerank_model_name)&&w.setFieldsValue({rerank_model_name:z[0].value})}if(ue.status==="fulfilled"&&ue.value){const z=(((Z=ue.value)==null?void 0:Z.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));E(z),z.length>0&&!(g!=null&&g.multi_model_name)&&w.setFieldsValue({multi_model_name:z[0].value})}if(le.status==="fulfilled"&&le.value){const z=(((U=le.value)==null?void 0:U.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));N(z),z.length>0&&!(g!=null&&g.embedding_model_name)&&w.setFieldsValue({embedding_model_name:z[0].value})}if(Y.status==="fulfilled"&&Y.value&&Y.value){const z=Y.value;Object.keys(ne).forEach(P=>{if(z.hasOwnProperty(P)){const{max:ce,min:We}=z[P];ne[P]={...ne[P],min:We,max:ce}}}),I(ne)}}catch(X){console.error("\u83B7\u53D6\u5217\u8868\u5931\u8D25:",X)}},He=async(g,$)=>await H($,t)?(be.warning("\u540D\u79F0\u91CD\u590D\uFF01",2),Promise.reject("\u540D\u79F0\u91CD\u590D")):Promise.resolve(),ae=(g,$)=>({validator(L,Z){return Z?Array.isArray(g)&&g.length===0||!g.find(U=>U.value==Z)?Promise.reject("\u6A21\u578B\u65E0\u6CD5\u4F7F\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.resolve():Array.isArray(g)&&g.length===0?Promise.reject("\u6682\u65E0\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.reject($)}}),ge=(g,$)=>{switch(g){case"knowledge_selected":A.current={...A.current,...$};break;case"sensitive_selected":A.current={...A.current,sensitiveWordIds:$};break;case"database_selected":A.current={...A.current,database_name:$};break;case"graph_selected":A.current={...A.current,graph_nb_name:$};break}},Ve=async()=>{var $;let g={};try{y(!0);const L=await w.validateFields(),{knowledge_base_name:Z,knowledge_base_name_source:U,selectedKnowledgeBase:X,sensitiveWordIds:G,database_name:ue,graph_nb_name:Y}=A.current;L.thinking=(($=D.find(z=>z.modelName==L.model_name))==null?void 0:$.thinking)||!1,f&&(L.enabled_nb_graph=!0),g={configJson:JSON.stringify({...L,knowledge_base_name:Z,knowledge_base_name_source:U,selectedKnowledgeBase:X,sensitiveWordIds:G,...h?{database_name:ue}:{},...f?{graph_nb_name:Y}:{}}),name:L.config_name,isDefault:L.isDefault,defaultAnswer:L.defaultAnswer,dependOnKb:L.dependOnKb,sensitiveWordIds:G},t?await ee(t,g)&&(be.success("\u66F4\u65B0\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back")):await V(g)&&(be.success("\u65B0\u589E\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back"))}catch(L){console.error("submit error",L)}finally{y(!1)}},Ke=he(()=>{const g={};return Object.keys(ne).forEach($=>{var L;g[$]=(L=ne[$])==null?void 0:L.default}),{...ou,...g}},[]);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(tu,{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"})]}),!k&&e(re,{type:"primary",onClick:()=>Ve(),loading:W,disabled:p,children:"\u786E\u5B9A"})]}),k?S&&e(S,{}):e(me,{style:{padding:20,height:"calc(100vh - 150px)",backgroundColor:"#fff"},form:w,layout:"vertical",initialValues:Ke,disabled:p,colon:!1,children:d(te,{gutter:24,style:{height:"100%"},children:[d(Q,{span:12,style:{borderRight:"1px solid #E5E6EB",padding:"10px 32px",height:"100%",overflowY:"auto"},children:[e(M,{label:"\u52A9\u624B\u540D\u79F0",name:"config_name",validateTrigger:"onBlur",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u52A9\u624B\u540D\u79F0"},{validator:He}],children:e(Fe,{placeholder:"\u8BF7\u8F93\u5165"})}),d(te,{gutter:16,children:[e(Q,{span:12,children:e(M,{label:"\u95EE\u7B54\u6A21\u578B",name:"model_name",rules:[{required:!0,message:""},ae(D,"\u8BF7\u9009\u62E9\u95EE\u7B54\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:D,notFoundContent:e(oe,{})})})}),e(Q,{span:12,children:e(M,{label:"\u89C4\u5212\u6A21\u578B",name:"plan_model_name",rules:[{required:!0,message:""},ae(D,"\u8BF7\u9009\u62E9\u89C4\u5212\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:D,notFoundContent:e(oe,{})})})})]}),d(te,{gutter:16,children:[e(Q,{span:12,children:e(M,{label:"\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B",name:"multi_model_name",rules:[{required:!0,message:""},ae(i,"\u8BF7\u9009\u62E9\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:i,notFoundContent:e(oe,{})})})}),e(Q,{span:12,children:e(M,{label:"Rerank\u6A21\u578B",name:"rerank_model_name",rules:[{required:!0,message:""},ae(u,"\u8BF7\u9009\u62E9Rerank\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:u,notFoundContent:e(oe,{})})})})]}),e(te,{gutter:16,children:e(Q,{span:24,children:e(M,{label:"\u5411\u91CF\u89E3\u6790\u6A21\u578B",name:"embedding_model_name",rules:[{required:!0,message:""},ae(m,"\u8BF7\u9009\u62E9\u5411\u91CF\u89E3\u6790\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:m,notFoundContent:e(oe,{})})})})}),e(M,{label:"\u5F00\u573A\u767D",name:"prologue",children:e(Fe.TextArea,{maxLength:50,showCount:!0,placeholder:"\u8BF7\u8F93\u5165\u5F00\u573A\u767D",autoSize:{minRows:2}})}),e(M,{label:"\u63D0\u793A\u8BCD",name:"system_prompt",tooltip:su,children:e(Fe.TextArea,{showCount:!0,rows:8,maxLength:3e3,autoSize:{minRows:10},placeholder:`\u4F8B\u5982\uFF1A${au}`})}),e(M,{name:"isDefault",valuePropName:"checked",normalize:g=>g===!0?1:0,children:e(De,{children:"\u9009\u62E9\u4E3A\u9ED8\u8BA4\u52A9\u624B"})})]}),d(Q,{span:12,style:{height:"100%",padding:"10px 32px",overflowY:"auto"},children:[d(Ae,{title:"\u68C0\u7D22\u4E0E\u751F\u6210\u53C2\u6570",children:[e(M,{label:"\u95EE\u9898\u63A8\u8350\u6A21\u578B",name:"recommend_model_name",rules:[{required:!0,message:""},ae(D,"\u8BF7\u9009\u62E9\u95EE\u9898\u63A8\u8350\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:D,notFoundContent:e(oe,{})})}),e(M,{label:"\u68C0\u7D22\u7B56\u7565",name:"search_policy",children:e(J,{options:iu,placeholder:"\u8BF7\u9009\u62E9"})}),d(te,{gutter:16,children:[e(ie,{label:"\u6E29\u5EA6",name:"temperature",configScale:C}),e(ie,{label:"\u591A\u6837\u6027",name:"top_p",configScale:C})]}),d(te,{gutter:16,children:[e(ie,{label:"\u53EC\u56DE\u6570",name:"top_k",configScale:C}),e(ie,{label:"\u76F8\u4F3C\u5EA6\u9608\u503C",name:"score_threshold",configScale:C})]}),d(te,{gutter:16,children:[e(ie,{label:"\u6700\u5927\u4EE4\u724C\u6570",name:"max_tokens",configScale:C}),e(ie,{label:"\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570",name:"max_round",configScale:C})]})]}),d(Ae,{title:"\u529F\u80FD\u5F00\u5173",children:[e(M,{label:"\u5F00\u542FFAQ\u4F18\u5148",name:"enabled_faq",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),B&&e(M,{label:"\u542F\u7528\u56FE\u8C31\u589E\u5F3A",name:"enabled_graph",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),e(M,{label:"\u5F00\u542F\u5F3A\u4F01\u4E1A\u77E5\u8BC6\u4F9D\u8D56",name:"dependOnKb",valuePropName:"checked",layout:"horizontal",tooltip:ru,normalize:g=>g===!0?1:0,children:e(de,{})}),e(M,{label:"\u5F00\u542F\u95EE\u9898\u6539\u5199",name:"enabled_question_rewrite",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),e(M,{label:"\u5F00\u542F\u6EAF\u6E90",name:"need_trace_source",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),e(M,{noStyle:!0,shouldUpdate:(g,$)=>g.need_trace_source!==$.need_trace_source,children:({getFieldValue:g})=>g("need_trace_source")?d(Te,{children:[e(M,{label:"\u6EAF\u6E90\u7B56\u7565",name:"trace_by_llm",layout:"horizontal",children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:cu})}),e(M,{name:"is_download",valuePropName:"checked",layout:"horizontal",children:e(De,{children:"\u5141\u8BB8\u4E0B\u8F7D\u6EAF\u6E90\u6587\u4EF6"})})]}):null})]}),d(Ae,{title:"\u8D44\u6E90\u7ED1\u5B9A",children:[e(Cu,{url:n,token:s,role:r,sectionData:F==null?void 0:F.sensitiveWordIds,eventsEmit:ge,defaultAnswer:F==null?void 0:F.defaultAnswer,form:w}),e(yu,{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:ge}),h&&e(bu,{url:n,token:s,role:r,disabled:p,sectionData:F==null?void 0:F.database_name,eventsEmit:ge}),f&&e(Au,{url:n,token:s,role:r,sectionData:F==null?void 0:F.graph_nb_name,eventsEmit:ge})]})]})]})})]})};export{Iu as C,nu as S};
|
package/assistantConfig.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"react/jsx-runtime";import"react";import{C as l}from"./assets/index-
|
|
1
|
+
import"react/jsx-runtime";import"react";import{C as l}from"./assets/index-DJF0hLwt.js";import"./assets/style-CRg0RQug.js";import"./assets/index-BRq6VK9v.js";import"./assets/x-D-pV1NCt.js";import"./assets/plus-CldFV1Lg.js";import"./assets/index-DNMf-zgr.js";import"react-dom";export{l as default};
|