@gientech/modual 2.1.12 → 2.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +761 -761
- package/assets/{GientechStreamReader-CoQaXcHK.js → GientechStreamReader-BRrzGvlY.js} +2 -2
- package/assets/database.svg +11 -11
- package/assets/database_add.svg +53 -53
- package/assets/database_connect.svg +66 -66
- package/assets/database_upload.svg +29 -29
- package/assets/databse.svg +6 -6
- package/assets/defaultWeLogo.svg +14 -14
- package/assets/graph.svg +4 -4
- package/assets/{index-Cqjn7TCr.js → index-D7Xktzjl.js} +2 -2
- package/assets/{index-CqK3Ppmi.js → index-iToxgF6w.js} +536 -152
- package/assets/knowledge.svg +4 -4
- package/assets/mysql.svg +14 -14
- package/assets/sensitive.svg +5 -5
- package/assets/style.css +1 -1
- package/chat.js +2 -2
- package/database.js +2 -2
- package/databaseId.js +1 -1
- package/index.js +1 -1
- package/package.json +6 -6
- package/streamFilesReader.js +1 -1
- package/worker/pdf.worker.min.js +21 -21
package/chat.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as ee,jsxs as ut,Fragment as Ac}from"react/jsx-runtime";import*as C from"react";import we,{forwardRef as Oi,createElement as ec,createContext as cs,version as Fz,useMemo as Gt,useContext as hr,useState as nt,useRef as et,Children as SF,useEffect as Et,useCallback as ql,useImperativeHandle as $c,useLayoutEffect as AF,cloneElement as $F,isValidElement as OF,PureComponent as Pz,Component as Iz}from"react";import{a as cl,g as Bz,au as MF,l as NF,an as Rz,aN as _z,B as ki,aA as jz,f as _E,u as Lz,a5 as zz,aC as Hz,bw as Wz,A as Vz,bx as IS,aQ as DF,b as Mr,I as Wu,i as sC,T as Ks,a6 as Gz,F as Ia,aK as bd,by as TF,bz as Uz,h as qz,bA as Ug}from"./assets/index-BRq6VK9v.js";import{N as Kr,d as BS,c as FF,T as Yz,e as Xz}from"./assets/index-DzFAvwdY.js";import*as Kz from"react-dom";import RS,{flushSync as jE,createPortal as PF,unstable_batchedUpdates as Zz}from"react-dom";import{D as Qz,
|
|
1
|
+
import{jsx as ee,jsxs as ut,Fragment as Ac}from"react/jsx-runtime";import*as C from"react";import we,{forwardRef as Oi,createElement as ec,createContext as cs,version as Fz,useMemo as Gt,useContext as hr,useState as nt,useRef as et,Children as SF,useEffect as Et,useCallback as ql,useImperativeHandle as $c,useLayoutEffect as AF,cloneElement as $F,isValidElement as OF,PureComponent as Pz,Component as Iz}from"react";import{a as cl,g as Bz,au as MF,l as NF,an as Rz,aN as _z,B as ki,aA as jz,f as _E,u as Lz,a5 as zz,aC as Hz,bw as Wz,A as Vz,bx as IS,aQ as DF,b as Mr,I as Wu,i as sC,T as Ks,a6 as Gz,F as Ia,aK as bd,by as TF,bz as Uz,h as qz,bA as Ug}from"./assets/index-BRq6VK9v.js";import{N as Kr,d as BS,c as FF,T as Yz,e as Xz}from"./assets/index-DzFAvwdY.js";import*as Kz from"react-dom";import RS,{flushSync as jE,createPortal as PF,unstable_batchedUpdates as Zz}from"react-dom";import{D as Qz,W as Jz,T as eH,F as tH,O as _S}from"./assets/index-iToxgF6w.js";import{u as pa}from"./assets/index-CpW6Dhpp.js";import{P as nH}from"./assets/plus-CldFV1Lg.js";import{S as LE}from"./assets/index-B2DbErCc.js";import{X as lC}from"./assets/x-D-pV1NCt.js";import{A as rH,s as gr,M as cC,S as Ud}from"./assets/style-CRg0RQug.js";import{g as jS,P as oH,a as uC}from"./assets/index-D7Xktzjl.js";import{C as iH,G as IF,c as aH,r as sH}from"./assets/GientechStreamReader-BRrzGvlY.js";import{B as qEe}from"./assets/GientechStreamReader-BRrzGvlY.js";import{P as lH,S as cH}from"./assets/index-B3zi0w0x.js";/* empty css */import{D as BF}from"./assets/index-BQi5haCb.js";import"./database.js";import"./databaseTable.js";import"./modelManage.js";import"./sensitive.js";import"./assets/index-DNMf-zgr.js";import"./assets/index-DDz1HJaH.js";import"./assets/index-BfDZSwG3.js";/**
|
|
2
2
|
* @license lucide-react v0.456.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -589,7 +589,7 @@ ${v.substring(X)}`;y(ie),requestAnimationFrame(()=>{q.selectionStart=q.selection
|
|
|
589
589
|
border-color: ${n.primary};
|
|
590
590
|
box-shadow: 0 0 0 2px ${n.primary}1A;
|
|
591
591
|
}
|
|
592
|
-
`};function Voe({config:e,styles:t}){if(!e)return null;const n=JSON.parse(e.configJson),r=Gt(()=>{var o;return{...sC.colors,...(o=t==null?void 0:t.theme)==null?void 0:o.colors}},[t]);return ut("div",{className:"w-[340px] rounded-xl p-4 animate-fade-in bg-white",children:[ut("div",{className:"flex items-center mb-2",children:[ee("span",{className:"text-md font-bold truncate mr-2",style:{color:r.primary},children:n.config_name||"\u52A9\u624B\u914D\u7F6E"}),ee("span",{className:"text-xs truncate rounded px-2 py-0.5",style:{backgroundColor:`${r.primary}1A`,color:r.disabled},children:n.model_name})]}),ee("div",{className:"border-b my-2",style:{borderColor:r.border}}),ut("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-700 mb-2",style:{color:r.text},children:[ut("div",{children:["\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570\uFF1A",ee("span",{className:"font-semibold",children:n.max_round})]}),ut("div",{children:["\u6700\u5927\u4EE4\u724C\u6570\uFF1A",ee("span",{className:"font-semibold",children:n.max_tokens})]}),ut("div",{children:["\u6E29\u5EA6\uFF1A",ee("span",{className:"font-semibold",children:n.temperature})]}),ut("div",{children:["\u53EC\u56DE\u6570\uFF1A",ee("span",{className:"font-semibold",children:n.top_k})]}),ut("div",{children:["\u591A\u6837\u6027\uFF1A",ee("span",{className:"font-semibold",children:n.top_p})]}),ut("div",{children:["\u76F8\u4F3C\u5EA6\u9608\u503C\uFF1A",ee("span",{className:"font-semibold",children:n.score_threshold})]})]}),ut("div",{className:"mb-2",children:[ee("div",{className:"text-xs text-gray-400 mb-1",style:{color:r.disabled},children:"\u5173\u8054\u77E5\u8BC6\u5E93\uFF1A"}),ee("div",{className:"flex flex-wrap gap-1",children:n.knowledge_base_name?n.knowledge_base_name.split(";").map((o,i)=>ee("span",{className:"px-2 py-0.5 rounded-full text-xs",style:{backgroundColor:`${r.primary}1A`,color:r.primary},children:o},i)):ee("span",{className:"text-gray-300",style:{color:r.disabled},children:"\u65E0"})})]}),ut("div",{className:"mb-2",children:[ee("div",{className:"text-xs text-gray-400 mb-1",style:{color:r.disabled},children:"\u5F00\u542F\u529F\u80FD:"}),ut("div",{className:"flex flex-wrap gap-2 text-xs mt-2",children:[!!n.enabled_faq&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"FAQ"}),!!n.enabled_graph&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u56FE\u8C31"}),!!n.dependOnKb&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u5F3A\u77E5\u8BC6\u4F9D\u8D56"}),!!n.enabled_table_select&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u8868\u683C\u7B5B\u9009"}),!!n.enabled_rerank&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u7CBE\u6392\u6A21\u5F0F"}),!!n.need_trace_source&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u6EAF\u6E90"}),!!n.is_download&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u4E0B\u8F7D\u6EAF\u6E90"})]})]})]})}function Goe(e,t=[],n=60){const[r,o]=nt("");return Et(()=>{o("");let i=0;const a=setInterval(()=>{o(s=>i>=e.length?(clearInterval(a),s):(i++,e.slice(0,i)))},n);return()=>clearInterval(a)},[e,...t]),r}function Uoe(e){const{assistantList:t,eventsEmit:n,styles:r,selectedId:o,onSelectAssistant:i,productLogo:a}=e,[s,l]=nt(1),[c,u]=nt(!1),[d,f]=nt(""),h=c||d.trim()?6:12,m=et(),p=et(!1),g=et(null),v=et(null),y=et("");Et(()=>{o&&m.current!==o&&(n==null||n("conversation:new_assistant_change",{assistantId:o}),m.current=o)},[o,n]);const b=Gt(()=>pa(),[]);Et(()=>{var $;if(($=r==null?void 0:r.theme)!=null&&$.colors){const M=document.createElement("style");return M.innerHTML=Woe(r.theme.colors,b),M.id=`g-welcome-styles-${b}`,document.head.appendChild(M),()=>{const N=document.getElementById(M.id);N&&N.remove()}}},[r,b]);const w=Gt(()=>t.find($=>$.id===o),[t,o]),x=Gt(()=>JSON.parse((w==null?void 0:w.configJson)||"{}"),[w]),E=Gt(()=>{if(!d.trim())return t||[];const $=d.toLowerCase().trim();return(t||[]).filter(M=>{var D,T;const N=((D=M.name)==null?void 0:D.toLowerCase())||"";try{const I=((T=JSON.parse(M.configJson||"{}").config_name)==null?void 0:T.toLowerCase())||"";return N.includes($)||I.includes($)}catch{return N.includes($)}})},[t,d]),k=Math.ceil(((E==null?void 0:E.length)||0)/h),S=(E==null?void 0:E.slice((s-1)*h,s*h))||[];Et(()=>{if(o&&o!==v.current){if(p.current&&g.current!==null){v.current=o;return}const $=d.trim()?E:t;if($&&$.length>0){const M=$.findIndex(N=>N.id===o);if(M!==-1){const N=Math.floor(M/h)+1;l(N),v.current=o}}}},[o,t,E,h,d]),Et(()=>{if(d!==y.current){if(p.current&&g.current!==null){l(g.current),p.current=!1,g.current=null,y.current=d;return}if(v.current===o){y.current=d;return}p.current||(d.trim()&&(v.current=null),l(1)),y.current=d}},[d,o]),Et(()=>{k>0&&s>k&&l(k)},[k,s]);const O=x.prologue||"\u60A8\u597D\uFF0C\u6B22\u8FCE\u4F7F\u7528\u5C0F\u9CB8\u667A\u80FD\u95EE\u7B54",A=Goe(O,[o],30);return ut("div",{className:`flex flex-col relative items-center justify-center h-full w-full g-welcome-${b}`,children:[ee("img",{src:a||zoe,alt:"logo",className:"mb-4",style:{width:68,height:68}}),ee("div",{className:"text-3xl font-bold mb-2 g-welcome-title",children:A}),!o&&ee("div",{className:"flex mb-2 g-welcome-subtitle",children:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u667A\u80FD\u52A9\u624B"}),ut("div",{style:{maxWidth:"1200px"},className:`flex mt-8 flex-wrap gap-3
|
|
592
|
+
`};function Voe({config:e,styles:t}){if(!e)return null;const n=JSON.parse(e.configJson),r=Gt(()=>{var o;return{...sC.colors,...(o=t==null?void 0:t.theme)==null?void 0:o.colors}},[t]);return ut("div",{className:"w-[340px] rounded-xl p-4 animate-fade-in bg-white",children:[ut("div",{className:"flex items-center mb-2",children:[ee("span",{className:"text-md font-bold truncate mr-2",style:{color:r.primary},children:n.config_name||"\u52A9\u624B\u914D\u7F6E"}),ee("span",{className:"text-xs truncate rounded px-2 py-0.5",style:{backgroundColor:`${r.primary}1A`,color:r.disabled},children:n.model_name})]}),ee("div",{className:"border-b my-2",style:{borderColor:r.border}}),ut("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-700 mb-2",style:{color:r.text},children:[ut("div",{children:["\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570\uFF1A",ee("span",{className:"font-semibold",children:n.max_round})]}),ut("div",{children:["\u6700\u5927\u4EE4\u724C\u6570\uFF1A",ee("span",{className:"font-semibold",children:n.max_tokens})]}),ut("div",{children:["\u6E29\u5EA6\uFF1A",ee("span",{className:"font-semibold",children:n.temperature})]}),ut("div",{children:["\u53EC\u56DE\u6570\uFF1A",ee("span",{className:"font-semibold",children:n.top_k})]}),ut("div",{children:["\u591A\u6837\u6027\uFF1A",ee("span",{className:"font-semibold",children:n.top_p})]}),ut("div",{children:["\u76F8\u4F3C\u5EA6\u9608\u503C\uFF1A",ee("span",{className:"font-semibold",children:n.score_threshold})]})]}),ut("div",{className:"mb-2",children:[ee("div",{className:"text-xs text-gray-400 mb-1",style:{color:r.disabled},children:"\u5173\u8054\u77E5\u8BC6\u5E93\uFF1A"}),ee("div",{className:"flex flex-wrap gap-1",children:n.knowledge_base_name?n.knowledge_base_name.split(";").map((o,i)=>ee("span",{className:"px-2 py-0.5 rounded-full text-xs",style:{backgroundColor:`${r.primary}1A`,color:r.primary},children:o},i)):ee("span",{className:"text-gray-300",style:{color:r.disabled},children:"\u65E0"})})]}),ut("div",{className:"mb-2",children:[ee("div",{className:"text-xs text-gray-400 mb-1",style:{color:r.disabled},children:"\u5F00\u542F\u529F\u80FD:"}),ut("div",{className:"flex flex-wrap gap-2 text-xs mt-2",children:[!!n.enabled_faq&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"FAQ"}),!!n.enabled_graph&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u56FE\u8C31"}),!!n.dependOnKb&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u5F3A\u77E5\u8BC6\u4F9D\u8D56"}),!!n.enabled_table_select&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u8868\u683C\u7B5B\u9009"}),!!n.enabled_rerank&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u7CBE\u6392\u6A21\u5F0F"}),!!n.need_trace_source&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u6EAF\u6E90"}),!!n.is_download&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u4E0B\u8F7D\u6EAF\u6E90"})]})]})]})}function Goe(e,t=[],n=60){const[r,o]=nt("");return Et(()=>{o("");let i=0;const a=setInterval(()=>{o(s=>i>=e.length?(clearInterval(a),s):(i++,e.slice(0,i)))},n);return()=>clearInterval(a)},[e,...t]),r}function Uoe(e){const{assistantList:t,eventsEmit:n,styles:r,selectedId:o,onSelectAssistant:i,productLogo:a}=e,[s,l]=nt(1),[c,u]=nt(!1),[d,f]=nt(""),h=c||d.trim()?6:12,m=et(),p=et(!1),g=et(null),v=et(null),y=et("");Et(()=>{o&&m.current!==o&&(n==null||n("conversation:new_assistant_change",{assistantId:o}),m.current=o)},[o,n]);const b=Gt(()=>pa(),[]);Et(()=>{var $;if(($=r==null?void 0:r.theme)!=null&&$.colors){const M=document.createElement("style");return M.innerHTML=Woe(r.theme.colors,b),M.id=`g-welcome-styles-${b}`,document.head.appendChild(M),()=>{const N=document.getElementById(M.id);N&&N.remove()}}},[r,b]);const w=Gt(()=>t.find($=>$.id===o),[t,o]),x=Gt(()=>JSON.parse((w==null?void 0:w.configJson)||"{}"),[w]),E=Gt(()=>{if(!d.trim())return t||[];const $=d.toLowerCase().trim();return(t||[]).filter(M=>{var D,T;const N=((D=M.name)==null?void 0:D.toLowerCase())||"";try{const I=((T=JSON.parse(M.configJson||"{}").config_name)==null?void 0:T.toLowerCase())||"";return N.includes($)||I.includes($)}catch{return N.includes($)}})},[t,d]),k=Math.ceil(((E==null?void 0:E.length)||0)/h),S=(E==null?void 0:E.slice((s-1)*h,s*h))||[];Et(()=>{if(o&&o!==v.current){if(p.current&&g.current!==null){v.current=o;return}const $=d.trim()?E:t;if($&&$.length>0){const M=$.findIndex(N=>N.id===o);if(M!==-1){const N=Math.floor(M/h)+1;l(N),v.current=o}}}},[o,t,E,h,d]),Et(()=>{if(d!==y.current){if(p.current&&g.current!==null){l(g.current),p.current=!1,g.current=null,y.current=d;return}if(v.current===o){y.current=d;return}p.current||(d.trim()&&(v.current=null),l(1)),y.current=d}},[d,o]),Et(()=>{k>0&&s>k&&l(k)},[k,s]);const O=x.prologue||"\u60A8\u597D\uFF0C\u6B22\u8FCE\u4F7F\u7528\u5C0F\u9CB8\u667A\u80FD\u95EE\u7B54",A=Goe(O,[o],30);return ut("div",{className:`flex flex-col relative items-center justify-center h-full w-full g-welcome-${b}`,children:[ee("img",{src:a||zoe,alt:"logo",className:"mb-4",style:{width:68,height:68}}),ee("div",{className:"text-3xl font-bold mb-2 g-welcome-title",children:A}),!o&&ee("div",{className:"flex mb-2 g-welcome-subtitle",children:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u667A\u80FD\u52A9\u624B"}),ut("div",{style:{maxWidth:"1200px"},className:`flex mt-8 flex-wrap gap-3\r
|
|
593
593
|
max-w-[1200px] px-8 w-full mx-auto justify-center mb-4`,children:[c?ee("div",{className:"flex items-center gap-2 px-5 w-full",style:{flexBasis:"100%"},children:ee(Wu,{className:"g-welcome-search-input w-full",placeholder:"\u641C\u7D22\u52A9\u624B\u540D\u79F0",prefix:ee(LE,{size:16}),suffix:ee("button",{type:"button",onClick:()=>{u(!1),f("")},style:{background:"transparent",border:"none",cursor:"pointer"},children:ee(lC,{size:14})}),value:d,onChange:$=>f($.target.value),autoFocus:!0})}):ee("button",{type:"button",className:"g-welcome-search-btn",onClick:()=>u(!0),children:ee(LE,{size:16})}),S&&S.length>0?ee(Ac,{children:S.map($=>{const M=o===$.id;let N=$.icon;try{const D=JSON.parse($.configJson||"{}");N=N||D.icon||D.avatar||D.logo}catch{}return N=N||Hoe,ee(uC,{content:()=>ee(Voe,{config:t.find(D=>D.id===$.id),styles:r}),trigger:"hover",placement:"bottom",children:ut("button",{type:"button",className:`g-welcome-btn px-3 cursor-pointer rounded-full border font-medium min-w-[160px] text-sm transition-all flex items-center gap-2 ${M?"active":""}`,onClick:()=>{i==null||i($.id);const D=c||d.trim(),P=(D?t:d.trim()?E:t).findIndex(I=>I.id===$.id);if(P!==-1){const R=Math.floor(P/(D?12:h))+1;l(R),v.current=$.id,D&&(g.current=R,p.current=!0,setTimeout(()=>{f(""),u(!1)},100))}},title:$.name,children:[ee("span",{className:"icon-badge",children:ee("img",{src:N,alt:"icon",style:{width:16,height:16,borderRadius:4}})}),ee("span",{className:"truncate max-w-[180px]",children:$.name})]})},$.id)})}):ee("div",{className:"g-welcome-subtitle",children:"\u6682\u65E0\u53EF\u7528\u52A9\u624B"})]}),k>1&&ut("div",{className:"flex items-center gap-2",children:[ee("button",{type:"button",className:"g-welcome-pagination-btn",onClick:()=>l($=>Math.max(1,$-1)),disabled:s===1,children:ee(iH,{size:16})}),ee("div",{className:"flex items-center gap-1",children:(()=>{const $=[];if(k<=7)for(let N=1;N<=k;N++)$.push(N);else if($.push(1),s<=4){for(let N=2;N<=5;N++)$.push(N);$.push("..."),$.push(k)}else if(s>=k-3){$.push("...");for(let N=k-4;N<=k;N++)$.push(N)}else{$.push("...");for(let N=s-1;N<=s+1;N++)$.push(N);$.push("..."),$.push(k)}return $.map((N,D)=>{if(N==="...")return ee("span",{className:"g-welcome-pagination-text px-1",children:"..."},`ellipsis-${D}`);const T=N;return ee("button",{type:"button",className:`g-welcome-pagination-btn ${s===T?"active":""}`,onClick:()=>l(T),children:T},T)})})()}),ee("button",{type:"button",className:"g-welcome-pagination-btn",onClick:()=>l($=>Math.min(k,$+1)),disabled:s===k,children:ee(FF,{size:16})})]})]})}async function qoe(e,t){const n=e.getReader();let r;for(;!(r=await n.read()).done;)t(r.value)}function Yoe(e){let t,n,r,o=!1;return function(a){t===void 0?(t=a,n=0,r=-1):t=Koe(t,a);const s=t.length;let l=0;for(;n<s;){o&&(t[n]===10&&(l=++n),o=!1);let c=-1;for(;n<s&&c===-1;++n)switch(t[n]){case 58:r===-1&&(r=n-l);break;case 13:o=!0;case 10:c=n;break}if(c===-1)break;e(t.subarray(l,c),r),l=n,r=-1}l===s?t=void 0:l!==0&&(t=t.subarray(l),n-=l)}}function Xoe(e,t,n){let r=VA();const o=new TextDecoder;return function(a,s){if(a.length===0)n==null||n(r),r=VA();else if(s>0){const l=o.decode(a.subarray(0,s)),c=s+(a[s+1]===32?2:1),u=o.decode(a.subarray(c));switch(l){case"data":r.data=r.data?r.data+`
|
|
594
594
|
`+u:u;break;case"event":r.event=u;break;case"id":e(r.id=u);break;case"retry":const d=parseInt(u,10);isNaN(d)||t(r.retry=d);break}}}}function Koe(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function VA(){return{data:"",event:"",id:"",retry:void 0}}var Zoe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const dw="text/event-stream",Qoe=1e3,GA="last-event-id";function Joe(e,t){var{signal:n,headers:r,onopen:o,onmessage:i,onclose:a,onerror:s,openWhenHidden:l,fetch:c}=t,u=Zoe(t,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((d,f)=>{const h=Object.assign({},r);h.accept||(h.accept=dw);let m;function p(){m.abort(),document.hidden||x()}l||document.addEventListener("visibilitychange",p);let g=Qoe,v=0;function y(){document.removeEventListener("visibilitychange",p),window.clearTimeout(v),m.abort()}n==null||n.addEventListener("abort",()=>{y(),d()});const b=c??window.fetch,w=o??eie;async function x(){var E;m=new AbortController;try{const k=await b(e,Object.assign(Object.assign({},u),{headers:h,signal:m.signal}));await w(k),await qoe(k.body,Yoe(Xoe(S=>{S?h[GA]=S:delete h[GA]},S=>{g=S},i))),a==null||a(),y(),d()}catch(k){if(!m.signal.aborted)try{const S=(E=s==null?void 0:s(k))!==null&&E!==void 0?E:g;window.clearTimeout(v),v=window.setTimeout(x,S)}catch(S){y(),f(S)}}}x()})}function eie(e){const t=e.headers.get("content-type");if(!(t!=null&&t.startsWith(dw)))throw new Error(`Expected content-type to be ${dw}, Actual: ${t}`)}class Bm extends Error{}let Do=null,ia=null,Ar=[],Il,Bl,Rm=new Map;const tie=({baseUrl:e,token:t,CSRFToken:n,setChatData:r,activeSessionId:o,setAppStatus:i,setConversationList:a})=>{const s=g=>{if(!g)return!1;if(typeof g=="string"){const v=g.trim();return v!==""&&v!=="[]"&&v!=="null"}return!0},l=({content:g,status:v,respTime:y,filePaths:b,reference:w,webReference:x,knowledgeBases:E,graphReference:k,databaseReference:S,llmType:O,resultType:A,queryId:$,tokens:M,chain:N,enableCot:D,chainRespTime:T})=>{r(P=>{var W;if(!P[0])return P;const I=P[0],R=I.messages||[],H=R.length-1;if(H<0)return P;const V=R[H];if(V.istype!=="ai")return P;let L=R.slice();if(b!=null&&b.length){const q=R.length-2;if(q>=0&&((W=R[q])==null?void 0:W.istype)==="user"){const U={...R[q],filePaths:b};L[q]=U}}const _=$&&$!==V.queryId,j=v===1&&V.status===2,F=_||j?s(k)?k:null:k!==void 0&&s(k)?k:V.graphReference;v===2&&k!==void 0&&console.log("[AichatUseController] reset_chat status=2 \u65F6\u7684 graphReference:",{graphReference:k,isValid:s(k),lastMessageGraphReference:V.graphReference,finalGraphReference:F,isNewQuery:_,isRestart:j});let B;_?B=g:j?B="":v===4||v===2&&!g?B=V.content||"":B=(V.content||"")+g;const z={...V,content:B,status:v,respTime:y,filePaths:b,reference:_||j?w||"[]":w,webReference:_||j?x||"[]":x,knowledgeBases:_||j?E||"[]":E,graphReference:F,databaseReference:_||j?S!==void 0?S:null:S!==void 0?S:V.databaseReference,resultType:A,llmType:O,tokens:M,queryId:$||V.queryId||pa(32),chain:_||j?N!==void 0?N:void 0:N!==void 0?N:V.chain,enableCot:D!==void 0?D:V.enableCot,chainRespTime:T!==void 0?T:V.chainRespTime};return z.clientSideId=z.clientSideId||z.queryId+"-ai",L[H]=z,[{...I,isNew:!1,messages:L},...P.slice(1)]})},c=g=>{if(g instanceof Bm)throw i(v=>({...v,display:"error",sender:"ready"})),Do&&(Do.abort(),Do=null),ia=null,g};return{updateUserFilesMessage:({currentFiles:g})=>{r(v=>{if(!v[0])return v;const y=v[0],b=y.messages||[];if(!b.length)return v;const w=b.length-2;if(w<0||b[w].istype!=="user")return v;const E=b.slice();return E[w]={...b[w],currentFiles:g},[{...y,messages:E},...v.slice(1)]})},api_startChat_re:(g,v)=>{Do&&Do.abort(),Do=new AbortController,ia=g.sessionId,Ar=[],Il=void 0,Bl=void 0,Rm=new Map;const y=`${e}/qa/ai/question_re`;console.log("data",g);const b={...g};Joe(y,{method:"post",signal:Do.signal,headers:{"Content-Type":"application/json",Accept:"text/event-stream",Authorization:t||"","X-CSRF-TOKEN-IN":n||""},openWhenHidden:!0,body:JSON.stringify(b),onopen:async w=>{if(w.status===500)throw new Bm("Internal Server Error");if(!w.ok)throw new Bm(`HTTP error: ${w.status}`)},onmessage:w=>{var F,B,z,G;const x=JSON.parse(w.data);if(ia!==x.sessionId){console.log("[AichatUseController] \u6D41\u5F0F\u8BF7\u6C42\u7684 sessionId \u5DF2\u4E0D\u5339\u914D\uFF0C\u5FFD\u7565\u6570\u636E",{currentStreamSessionId:ia,receivedSessionId:x.sessionId,activeSessionId:o});return}if(o!==x.sessionId)return;const{reply:E,resultType:k,respTime:S,reference:O,webReference:A,graphReference:$,knowledgeBases:M,filePaths:N,status:D,docs:T,llmType:P,databaseReference:I,businessType:R,nodeStatus:H,enableCot:V,chainRespTime:L}=x;if(D===4&&R){H===2&&typeof L=="number"&&L>0&&Rm.set(R,L);const W=H===2&&typeof L=="number"&&L>0?L:void 0;Ar=Jz(Ar,{businessType:R,nodeStatus:H,reply:E,respTime:W,chainRespTime:W}),console.log("[AichatUseController] status=4 \u805A\u5408\u601D\u7EF4\u94FE\u6570\u636E:",{businessType:R,nodeStatus:H,content:(F=E==null?void 0:E.content)==null?void 0:F.substring(0,50),currentThoughtNodesCount:Ar.length,chainRespTime:H===2?L:void 0})}else D===1&&R&&console.log("[AichatUseController] status=1 \u8DF3\u8FC7\u601D\u7EF4\u94FE\u805A\u5408:",{businessType:R,content:(B=E==null?void 0:E.content)==null?void 0:B.substring(0,50),note:"status=1 \u7684\u5185\u5BB9\u5E94\u8BE5\u53BB\u6B63\u6587\uFF0C\u4E0D\u662F\u601D\u7EF4\u94FE"});if(typeof V=="number"&&(Il=V),D===1||D===2){const W=Array.from(Rm.values()).reduce((q,U)=>q+U,0);W>0&&(Bl=W)}const _=N?JSON.parse(N):[];D===2&&E&&E.content&&(E.content.includes("\u6A21\u578B\u6682\u65E0\u6CD5\u8FD4\u56DE")||E.content.includes("\u5931\u8D25")||E.content.includes("\u9519\u8BEF")||E.content.includes("\u8BF7\u7A0D\u540E\u518D\u8BD5"))&&i(W=>({...W,display:"ready",sender:"ready"}));const j=s($)?$:void 0;if(D===2&&console.log("[AichatUseController] status=2 \u65F6\u7684 graphReference:",{graphReference:$,type:typeof $,isValid:s($),finalGraphReference:j}),D===4){const W=Ar.length>0?Ar.map(q=>({businessType:q.businessType,nodeStatus:q.nodeStatus,content:q.content})):void 0;console.log("[AichatUseController] status=4 \u66F4\u65B0\u601D\u7EF4\u94FE:",{businessType:R,chainLength:(W==null?void 0:W.length)||0,replyContentLength:((z=E==null?void 0:E.content)==null?void 0:z.length)||0,note:"status=4 \u65F6\uFF0Creply.content \u5E94\u8BE5\u805A\u5408\u5230\u601D\u7EF4\u94FE\uFF0C\u4E0D\u66F4\u65B0\u6B63\u6587"}),l({content:"",status:D,respTime:S,filePaths:_,reference:O||T||"",webReference:A||"",knowledgeBases:M||"",graphReference:j,databaseReference:I,llmType:P,resultType:k,queryId:x.queryId,tokens:x.tokens,chain:W,enableCot:Il,chainRespTime:Bl})}else if(D===1){Ar.length>0&&(Ar=Ar.map(q=>({...q,nodeStatus:2}))),console.log("[AichatUseController] status=1 \u66F4\u65B0\u6B63\u6587:",{businessType:R,content:(G=E==null?void 0:E.content)==null?void 0:G.substring(0,50),thoughtNodesCount:Ar.length,note:"status=1 \u65F6\uFF0Creply.content \u5E94\u8BE5\u53BB\u6B63\u6587\uFF0C\u601D\u7EF4\u94FE\u8282\u70B9\u72B6\u6001\u66F4\u65B0\u4E3A\u5B8C\u6210"});const W=Ar.length>0?Ar.map(q=>({businessType:q.businessType,nodeStatus:q.nodeStatus,content:q.content})):void 0;l({content:E.content||"",status:D,respTime:S,filePaths:_,reference:O||T||"",webReference:A||"",graphReference:j,knowledgeBases:M||"",databaseReference:I??null,llmType:P,resultType:k,queryId:x.queryId,tokens:x.tokens,chain:W??void 0,enableCot:Il,chainRespTime:Bl})}else if(D===2){Ar.length>0&&(Ar=Ar.map(q=>({...q,nodeStatus:2})));const W=Ar.length>0?Ar.map(q=>({businessType:q.businessType,nodeStatus:q.nodeStatus,content:q.content})):void 0;if(l({content:E.content||"",status:2,respTime:S,filePaths:_,reference:O||T||"",webReference:A||"",knowledgeBases:M||"",graphReference:j,databaseReference:I,llmType:P,resultType:k,queryId:x.queryId,tokens:x.tokens,chain:W,enableCot:Il,chainRespTime:Bl}),Ar=[],i(q=>({...q,display:"ready",sender:"ready"})),v){const q=S||Date.now();console.log("[AichatUseController] \u6D88\u606F\u53D1\u9001\u6210\u529F\uFF0CgmtModified:",q),v(q)}}else{const W=Ar.length>0?Ar.map(q=>({businessType:q.businessType,nodeStatus:q.nodeStatus,content:q.content,respTime:q.respTime,chainRespTime:q.respTime})):void 0;l({content:E.content||"",status:D,respTime:S,filePaths:_,reference:O||T||"",knowledgeBases:M||"",webReference:A||"",graphReference:j,databaseReference:I,llmType:P,resultType:k,queryId:x.queryId,tokens:x.tokens,chain:W,enableCot:Il,chainRespTime:Bl})}},onerror:c,onclose:()=>{ia===g.sessionId&&(ia=null)}})},addEmptyMessage:({queryId:g,content:v,filePaths:y,currentFiles:b})=>{r(w=>{const x=new Date().toISOString(),E=g||pa(32),k={istype:"user",content:v,time:x,queryId:E,clientSideId:E+"-user",filePaths:y||"",currentFiles:b||[]},S={istype:"ai",content:"",time:new Date(Date.now()+1).toISOString(),streaming:!0,status:0,queryId:E,clientSideId:E+"-ai"},O=w.find(A=>A.id===o);return O?O.messages.push(k,S):console.warn("addEmptyMessage called without an active session."),[...w]})},setLastEmptyMessage:({now:g})=>{r(v=>{if(!v[0])return v;const y=v[0],b=y.messages||[];if(!b.length)return v;const w=b.length-1;if(w<0)return v;const x=b[w];if(x.istype!=="ai")return v;const E=b.slice();return E[w]={...x,istype:"ai",content:"",time:g,streaming:!0,status:0},[{...y,messages:E},...v.slice(1)]})},stopStream:()=>{Do&&(Do.abort(),Do=null),ia=null,i(g=>({...g,display:"ready",sender:"ready"}))},cancelStreamBySessionId:g=>Do&&ia===g?(console.log("[AichatUseController] \u5207\u6362\u4F1A\u8BDD\uFF0C\u53D6\u6D88\u6B63\u5728\u8FDB\u884C\u7684\u6D41\u5F0F\u8BF7\u6C42",g),Do.abort(),Do=null,ia=null,i(v=>({...v,display:"ready",sender:"ready"})),!0):!1}},nie=1e3,rie=3e3;function oie({url:e,token:t,CSRFToken:n,onError:r,activeSessionId:o}){const[i,a]=nt([]),[s,l]=nt(()=>({uploadedFiles:[]})),c=et(!1),u=async p=>{var g,v;if(!p)return null;try{const y=await Mr.get(`${e}/index/knowledgeBase/file/getFilesBysessionId?sessionId=${p}`,{headers:{Authorization:t}});console.log("[DEBUG] \u83B7\u53D6\u4E34\u65F6\u6587\u4EF6\u5217\u8868 res:",(g=y==null?void 0:y.data)==null?void 0:g.data),l({uploadedFiles:((v=y==null?void 0:y.data)==null?void 0:v.data)||[]})}catch(y){throw console.error("\u83B7\u53D6\u4E34\u65F6\u6587\u4EF6\u5217\u8868\u5931\u8D25:",y),y}},d=ql((p,g)=>{const v=p.join(",");let y=0,b=null;b=()=>{c.current=!0};const w=async()=>{if(!c.current){if(y>=nie){c.current||g.onFail("\u6587\u4EF6\u89E3\u6790\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");return}y++;try{const x=await Mr.get(`${e}/index/knowledgeBase/file/getFileStatusByUids?uids=${v}`,{headers:{Authorization:t}});if(c.current)return;if(x.data.success){const E=x.data.data;c.current||g.onStatusUpdate(E),E.every(S=>{const O=S.fileParseStatus??S.status;return O===3||O===4})?c.current||g.onComplete():c.current||setTimeout(w,rie)}else c.current||g.onFail(x.data.errorMsg||"\u67E5\u8BE2\u6587\u4EF6\u72B6\u6001\u5931\u8D25")}catch(x){if(r==null||r(x),c.current)return;g.onFail("\u67E5\u8BE2\u6587\u4EF6\u72B6\u6001\u65F6\u53D1\u751F\u7F51\u7EDC\u9519\u8BEF")}}};return w(),b},[e,t,r]),f=ql(async(p,g)=>{if(!p){console.warn("[DEBUG] \u7F3A\u5C11uid\uFF0C\u65E0\u6CD5\u5220\u9664\u4E34\u65F6\u6587\u4EF6");return}Loe({url:e,token:t,CSRFToken:n},{uid:p,queryId:g},(v,y)=>{v?(gr.success("\u6587\u4EF6\u5DF2\u4ECE\u4E34\u65F6\u77E5\u8BC6\u5E93\u79FB\u9664"),u(o)):(console.log("[DEBUG] removeFilefromTempUpload \u56DE\u8C03 false\uFF0Cres:",y),gr.error("\u6587\u4EF6\u79FB\u9664\u5931\u8D25"))})},[e,t,n,o]),h=ql(()=>{c.current=!1},[]),m=ql(()=>{c.current=!0},[]);return{fileManagerData:s,fileStatuses:i,setFileManagerData:l,setFileStatuses:a,pollFileStatus:d,handleRemoveFromTemp:f,resetStopFlag:h,setStopFlag:m,stoppedRef:c,getTempFileList:u}}function iie({fileManagerData:e,styles:t,eventsEmit:n}){const[r,o]=nt(!1),[i,a]=nt(!1),s=Gt(()=>{var m;const c=((m=e.uploadedFiles)==null?void 0:m.length)||0;if(c===0)return null;const u=p=>p?p<1024?`${p}B`:p<1024*1024?`${(p/1024).toFixed(0)}KB`:isNaN(p)?p||"":`${(p/1024/1024).toFixed(1)}MB`:"",d=p=>{var v;const g=((v=p.split(".").pop())==null?void 0:v.toUpperCase())||"";return g==="DOCX"||g==="DOC"?"DOC":g==="XLSX"||g==="XLS"?"XLS":g==="PPTX"||g==="PPT"?"PPT":g==="JPG"||g==="JPEG"?"JPG":g},f=p=>{var v;switch(((v=p.split(".").pop())==null?void 0:v.toLowerCase())||""){case"docx":case"doc":return ee(Kr,{type:"rag/word",size:32});case"jpg":case"jpeg":case"png":case"gif":case"bmp":case"webp":case"svg":case"ico":return ee(Kr,{type:"rag/pic",size:32});case"pptx":case"ppt":return ee(Kr,{type:"rag/ppt",size:32});case"xls":case"xlsx":case"xlsm":case"xlsb":case"xltx":case"xltm":case"xlt":case"xlam":return ee(Kr,{type:"rag/excel",size:32});case"csv":return ee(Kr,{type:"rag/csv",size:32});case"pdf":return ee(Kr,{type:"rag/pdf",size:32});case"txt":return ee(Kr,{type:"rag/txt",size:32});case"md":return ee(Kr,{type:"rag/txt",size:32});case"json":return ee(Kr,{type:"rag/json",size:32});case"html":case"htm":return ee(Kr,{type:"rag/url",size:32});default:return ee(Kr,{type:"rag/file",size:32})}},h=ut("div",{className:"bg-white rounded-lg",style:{width:"280px",maxHeight:"400px",overflowY:"auto",padding:"8px"},children:[ee("div",{className:"text-sm font-semibold",style:{color:"#333",fontWeight:700,fontSize:"16px"},children:"\u4E34\u65F6\u77E5\u8BC6\u5E93\u6587\u6863"}),ee("div",{style:{fontSize:"12px",color:"#86909C",marginTop:"4px"},children:"\u4E34\u65F6\u77E5\u8BC6\u5E93\u5185\u5BB9\u4E3A\u672C\u6B21\u4F1A\u8BDD\u4E0A\u4F20\u6587\u4EF6\uFF0C\u5220\u9664\u540E\u5C06\u4E0D\u518D\u751F\u6548\u3002"}),ee("div",{className:"flex flex-col gap-3",children:e.uploadedFiles.map((p,g)=>{var x,E,k;const v=p.name||((x=p.file)==null?void 0:x.name)||p.fileName||((E=p.file)==null?void 0:E.fileName)||"",y=((k=p.file)==null?void 0:k.size)||p.size||0,b=f(v),w=d(v);return ut("div",{className:"fileItem flex items-center cursor-pointer rounded transition-colors",style:{padding:"8px",border:"1px solid transparent",height:"56px"},onClick:()=>{var $;o(!1);const S=(($=(v||"").split(".").pop())==null?void 0:$.toLowerCase())||"",O=p.convertedFilePath||p.parseUrl||p.parsedFilePath,A=p.url||p.filePath||p.convertedFilePath;!O&&p.uid?n("referenceFile_question",{data:{...p,file_name:v,file_type:S,url:A,convertedFilePath:p.convertedFilePath,filePath:p.url||p.filePath,parsedFilePath:p.parsedFilePath||p.convertedFilePath,pdfPages:p.pdfPages||0,size:p.size||u(y),metadata:{...p.metadata||{},source:A,convertedFilePath:p.convertedFilePath,filePath:p.url||p.filePath,name:v,pdfPages:p.pdfPages||0,size:p.size||u(y)}}}):n("reference_file:click",{file:v,file_type:S,url:p.url||p.filePath,parse_url:O,retrieve_tags:p.retrieveTags||[],file_id:p.uid||p.file_id,uid:p.uid,parsed_file_type:S,type:S,isUploadFile:!0,pdfPages:p.pdfPages||0,metadata:p.metadata||{convertedFilePath:p.convertedFilePath,filePath:p.url||p.filePath,name:v,pdfPages:p.pdfPages||0}})},children:[ee("div",{style:{width:"32px",height:"32px",marginRight:"12px"},children:b}),ut("div",{className:"flex-1 min-w-0",children:[ut("div",{className:"flex justify-between items-center",children:[ee("div",{className:"text-sm font-medium truncate",style:{color:"#333",marginBottom:"4px"},title:v,children:v}),ee(LF,{title:"\u786E\u8BA4\u4ECE\u4E34\u65F6\u5BF9\u8BDD\u77E5\u8BC6\u5E93\u79FB\u9664\u8BE5\u6587\u4EF6\uFF1F",onConfirm:S=>{S.stopPropagation(),n&&n("uploaded_file:removeFromTemp",{file:p})},okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",children:ee(lC,{size:14,style:{cursor:"pointer",marginLeft:"8px",color:"#999"},onClick:S=>S.stopPropagation()})})]}),ut("div",{className:"text-xs",style:{color:"#999",fontSize:"12px"},children:[w," ",u(y)]})]})]},p.uid||g)})})]});return ut("div",{className:"flex items-center",children:[ee(uC,{content:h,trigger:"click",placement:"bottomRight",overlayClassName:"file-list-popover",open:r,onOpenChange:o,children:ee(Ks,{title:ee("div",{style:{width:"108px",fontSize:"12px"},children:"\u67E5\u770B\u4E34\u65F6\u77E5\u8BC6\u5E93\u6587\u6863"}),placement:"top",color:"#5F5E6B",children:ee("div",{className:"flex items-center cursor-pointer hover:opacity-80 transition-opacity",children:ut("div",{className:"linshiBtn",style:{width:"119px",height:"32px",border:"1px solid #E5E6EB",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},children:[ee(dH,{size:16,style:{color:"#1D2129"}}),ee("div",{style:{color:"#1D2129",fontSize:"12px",margin:"0 4px"},children:"\u4E34\u65F6\u77E5\u8BC6\u5E93"}),ee("div",{style:{width:"18px",height:"18px",borderRadius:"100%",backgroundColor:"#DBEAFE",fontSize:"10px",color:"#4E6EF2",fontWeight:500,display:"flex",justifyContent:"center",alignItems:"center"},children:c})]})})})}),ee("div",{style:{borderRight:"1px solid #DDE0E5",height:"16px",margin:"0 8px"}}),ee(Ks,{title:ut("div",{style:{width:"204px",fontSize:"12px"},children:[ee("div",{children:"\u5F00\u542F\uFF1A\u56DE\u7B54\u4EC5\u57FA\u4E8E\u4E34\u65F6\u77E5\u8BC6\u5E93\u68C0\u7D22\u5185\u5BB9 "}),ee("div",{children:"\u5173\u95ED\uFF1A\u56DE\u7B54\u57FA\u4E8E\u4F01\u4E1A\u77E5\u8BC6\u5E93\u68C0\u7D22\u5185\u5BB9 "})]}),placement:"top",color:"#5F5E6B",children:ee(Gz,{checkedChildren:"\u5F00",unCheckedChildren:"\u5173",checked:i,onChange:p=>{a(p),n("TempKnowledgeBase",p)}})})]})},[e.uploadedFiles,t,n,r]),l=et(e.uploadedFiles||[]);return Et(()=>{var d;if(!((d=e==null?void 0:e.uploadedFiles)!=null&&d.length))return;const c=JSON.stringify(l.current||[]),u=JSON.stringify(e.uploadedFiles||[]);c!==u&&(l.current=e.uploadedFiles||[],a(!0),n("TempKnowledgeBase",!0))},[e.uploadedFiles]),{FileDisplayTools:s,setFileListPopoverOpen:o}}const aie="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACRSURBVHgB7ZJBCsQgDEWTmQvMncT7dOuqmY3iai6kMN31UmIjdNFFKuk+DwKahP9ABDAMQyTnvHCtT/ZjjIs0e0nN1hr03kkjGTu8+0PEjzR/S81a6+6cQz6S9x5KKdsknLi+IQRSC07JfybRhE8FM4k2fICgIKVE/MYrF427NlwtuEpOgSr8MUNy9x0Nw7jnAFsnZ7Uu5CkqAAAAAElFTkSuQmCC",{TextArea:UA}=Wu,{useForm:sie}=Ia,m9={\u56DE\u7B54\u4E0D\u4F73:"ansPoor",\u683C\u5F0F\u95EE\u9898:"formatError",\u7406\u89E3\u95EE\u9898\u6709\u8BEF:"harmfulInfo",\u5176\u4ED6:"othres"},lie=({open:e,setOpen:t,feedBackList:n,handleConfirm:r})=>{const o={header:{padding:"20px 24px",borderBottom:"1px solid #F0F0F0",margin:0},body:{padding:"16px 24px 20px 24px",borderBottom:"1px solid #F0F0F0"},mask:{},footer:{padding:"16px 24px",margin:0},content:{padding:0,borderRadius:"4px",width:"563px"}},[i]=sie(),[a,s]=nt({}),l=async()=>{try{const u=await i.validateFields();t(!1);const d={...u};Object.entries(a||{}).forEach(f=>{const[h,m]=f;m&&(d[m9[h]]=m)}),r(d)}catch(u){console.log(u);return}};Et(()=>{e||(i.resetFields(),s(null))},[e]);const c=Gt(()=>{var u;return(u=JSON.parse(localStorage.getItem("gitech_ril:rag_ai")||"{}"))==null?void 0:u.userInfo},[e]);return ee(bd,{modal:{styles:o},children:ut(cC,{open:e,onCancel:()=>t(!1),title:ee("div",{className:"text-[16px] text-[#2A2A2A] font-bold leading-[1]",children:"\u611F\u8C22\u60A8\u7684\u53CD\u9988\uFF01\u8FD9\u5C06\u5E2E\u52A9\u6211\u4EEC\u4E0D\u65AD\u4F18\u5316\u4E0E\u63D0\u5347\u3002"}),destroyOnHidden:!0,footer:ut("div",{children:[ee(ki,{className:"mr-[16px] w-[76px]",onClick:()=>{t(!1)},children:"\u53D6\u6D88"}),ee(ki,{type:"primary",className:"w-[76px] border-none",onClick:l,children:"\u786E\u8BA4"})]}),children:[ee(cie,{feedBackList:n,treeSelectResult:a,setTreeSelectResult:s}),ut(Ia,{form:i,layout:"vertical",children:[ee(Ia.Item,{name:"supplementExplain",label:"\u8865\u5145\u63CF\u8FF0",children:ee(UA,{})})," ",ee(Ia.Item,{name:"idealAnswer",label:"\u60A8\u89C9\u5F97\u66F4\u597D\u7684\u56DE\u7B54\u662F\u4EC0\u4E48\uFF1F",children:ee(UA,{})}),c&&ut(Ac,{children:[ee(Ia.Item,{name:"userPhone",label:"\u8054\u7CFB\u7535\u8BDD",initialValue:c==null?void 0:c.phone,children:ee(Wu,{disabled:!0})}),ee(Ia.Item,{name:"deptName",label:"\u90E8\u95E8",initialValue:c==null?void 0:c.deptName,children:ee(Wu,{disabled:!0})})]})]})]})})},cie=({feedBackList:e,treeSelectResult:t,setTreeSelectResult:n})=>{const[r,o]=nt(!1),[i,a]=nt([]),[s,l]=nt([]),[c,u]=nt([]),[d,f]=nt(null),h=Gt(()=>(l([]),d!=null&&d.items?[{title:"\u5168\u9009",key:"\u5168\u9009",children:d.items.map(p=>({title:p,key:p}))}]:[]),[d]),m=p=>{u(g=>Array.isArray(g)&&Array.isArray(s)?Object.entries(t).reduce((y,b)=>{const[w,x]=b,k=(x?x.split(";"):[]).filter(S=>S!==p);return n(S=>({...S||{},[w]:k.join(";")})),[...y,...k]},[]):g)};return Et(()=>{if(a(["\u5168\u9009"]),!t||!(d!=null&&d.que_name))return;const p=t[d.que_name]||"",g=p?p.split(";"):[];l(g)},[h,r]),Et(()=>{t===null&&(u([]),f(null),l([]))},[t]),Et(()=>{console.log("treeSelectResult",t),console.log("selectedValue",c),console.log("feedBackList",e),console.log("pKey",m9),console.log("selectedParent",d)},[t,c]),ut("div",{className:"relative mb-[24px] z-20",children:[ut("div",{className:"absolute w-full z-10",children:[ut("div",{className:"h-[32px] box-border flex items-center justify-between border-[1px] border-solid border-[#D9D9D9] rounded-[4px] cursor-pointer",onClick:()=>o(!r),children:[ee("div",{className:"ml-[16px]",children:"\u95EE\u9898\u7C7B\u578B"}),ee("img",{src:aie,width:24,height:24,className:"mr-[16px]"})]}),ut("div",{style:{display:r?"":"none"},className:"h-[288px] rounded-[4px] shadow-md mt-[4px] bg-white",children:[ut("div",{className:"h-[248px] flex",style:{borderBottom:"1px solid #F0F0F0"},children:[ee("div",{className:"w-[203px] px-[8px] py-[8px]",style:{borderRight:"1px solid #F0F0F0"},children:e.map((p,g)=>{var v;return ut("div",{className:"rounded-[4px] h-[32px] cursor-pointer flex items-center",style:{backgroundColor:(d==null?void 0:d.que_name)===p.que_name?"#E6F4FF":""},children:[ee("div",{className:"h-full w-full leading-[32px]",onClick:()=>{f(p)},children:ut("div",{className:"ml-[8px] text-[14px] text-[#2A2A2A]",children:[p.que_name,"(",t&&t[p.que_name]?t[p.que_name].split(";").length:0,"/",(v=p==null?void 0:p.items)==null?void 0:v.length,")"]})}),ee(FF,{className:"mr-[8px] w-3 h-3 text-[rgba(0,0,0,0.45)]"})]},g)})}),ee("div",{className:"selfTree h-full flex-1 mt-[8px] ml-[16px]",children:ee(eH,{checkable:!0,defaultSelectedKeys:["0-1"],treeData:h,blockNode:!0,checkedKeys:s,expandedKeys:i,onCheck:p=>{Array.isArray(p)&&n(g=>({...g||{},[(d==null?void 0:d.que_name)||""]:(p||[]).filter(v=>v!=="\u5168\u9009").join(";")})),l(p)}})})]}),ut("div",{className:"flex justify-end h-[40px] items-center",children:[ee(ki,{size:"small",className:"mr-[8px]",onClick:()=>o(!1),children:"\u53D6\u6D88"}),ee(ki,{size:"small",type:"primary",className:"border-none mr-[16px]",onClick:()=>{u(p=>Array.isArray(p)&&Array.isArray(s)?Object.values(t).reduce((v,y)=>[...v,...y?y.split(";"):[]],[]):p),o(!1)},children:"\u786E\u8BA4"})]})]})]}),ee("div",{className:"h-[32px]"}),!!(c!=null&&c.length)&&ut("div",{children:[ut("div",{className:"mt-[5px] text-[12px] text-[#555555]",children:["\u5DF2\u9009\u62E9 ",c.length," \u4E2A"]}),(c||[]).map(p=>{let g="";return Object.entries(t||{}).forEach(v=>{const[y,b]=v;b.indexOf(p)>-1&&(g=y)}),ut(Yz,{closable:!0,className:"mt-[5px]",onClose:()=>m(p),children:[g,"\uFF08",p,"\uFF09"]},p)})]})]})};function uie({title:e,subtitle:t}){const[n,r]=nt(0);return Et(()=>{let o;return n<98?o=setTimeout(()=>{r(i=>i+Math.random()*6+1)},80):n<100&&(o=setTimeout(()=>r(100),400)),()=>clearTimeout(o)},[n]),ut("div",{className:"flex flex-col justify-center items-center min-h-screen bg-gradient-to-br from-[#EEF4FF] via-white to-[#F5F8FF]",children:[ut("div",{className:"mb-8 flex flex-col items-center",children:[ee("div",{className:"mt-6 text-2xl font-semibold text-[#222222] tracking-wide",children:e||"\u5C0F\u9CB8\u667A\u80FD\u4F1A\u8BDD\u52A9\u624B"}),ee("div",{className:"mt-2 text-sm text-[#555555]",children:t||"\u8BA9\u667A\u80FD\u5BF9\u8BDD\u66F4\u7B80\u5355"})]}),ut("div",{className:"relative w-80 max-w-sm",children:[ee("div",{className:"w-full h-2 bg-[#EEF4FF] rounded-full overflow-hidden shadow-inner",children:ee("div",{className:"h-full bg-gradient-to-r from-[#2B69FF] to-[#8F91FF] transition-all duration-300 ease-out",style:{width:`${Math.min(n,100)}%`}})}),ut("div",{className:"absolute -right-2 top-5 text-sm text-[#555555]",children:[Math.min(Math.round(n),100),"%"]})]}),ut("div",{className:"mt-8 flex flex-col items-center gap-2",children:[ee("div",{className:"text-sm text-[#555555] animate-pulse",children:"\u6B63\u5728\u521D\u59CB\u5316\u5E94\u7528"}),ee("div",{className:"text-xs text-[#888888]",children:"\u9996\u6B21\u52A0\u8F7D\u53EF\u80FD\u9700\u8981\u4E00\u4E9B\u65F6\u95F4\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85"})]})]})}const v9=document.createElement("style");v9.textContent=`
|
|
595
595
|
.animate-bounce-slow {
|
package/database.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as Z,jsx as c,Fragment as De}from"react/jsx-runtime";import{useState as y,useMemo as T,useRef as K,useEffect as me}from"react";import{J as Q,s as ge,m as be}from"./assets/index-DzFAvwdY.js";import{b as ye,T as Ee,d as Fe,i as O}from"./assets/index-BRq6VK9v.js";import{O as $}from"./assets/index-DDz1HJaH.js";import{M as ee,s as H}from"./assets/style-CRg0RQug.js";/* empty css */import"react-dom";const pe=({url:m,token:z,role:B,eventsEmit:F})=>{const l=ye.create({baseURL:m,timeout:1e6});return l.interceptors.request.use(e=>{let t=z;return!t&&!["user/login","user/kaptcha","user/regist"].some(u=>e.url.includes(u))?(F&&F("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(e.headers.Authorization=t||"",e.headers.userName=B==="\u672A\u767B\u5F55\u7528\u6237"?"":B,e)}),l.interceptors.response.use(e=>{const t=["user/kaptcha"],r=e.data;if(t.some(p=>e.config.url&&e.config.url.includes(p))||r.size&&r.type)return r;const{success:u,errorMsg:g,errorCode:D}=r;return u?r:(F&&F("request:error_business",{errorCode:D,errorMsg:g||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:r}),!1)},async e=>{var t,r,u,g,D,p,A,h,N;if(e.message==="canceled")return Promise.reject(e);if(F){let d="request:error_network",v={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:e};((t=e==null?void 0:e.response)==null?void 0:t.status)===401?(d="request:error_auth",v={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:e,redirect:"/login"}):(((u=(r=e==null?void 0:e.response)==null?void 0:r.data)==null?void 0:u.errorCode)==="30013"||((D=(g=e==null?void 0:e.response)==null?void 0:g.data)==null?void 0:D.errorCode)==="30023")&&(d="request:error_business",v={errorCode:(A=(p=e==null?void 0:e.response)==null?void 0:p.data)==null?void 0:A.errorCode,errorMsg:((N=(h=e==null?void 0:e.response)==null?void 0:h.data)==null?void 0:N.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:e}),F(d,v)}return console.log("Error occurs",e),Promise.reject(e)}),{getDatabaseList:async e=>{try{const t=await l.get(`/queryPageDBList?${new URLSearchParams(e).toString()}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("getDatabaseList error:",t)}},getShareDatabaseList:async e=>{try{const t=await l.get(`/queryShareDBList?${new URLSearchParams(e).toString()}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("getShareDatabaseList error:",t)}},delDatabaseById:async(e,t)=>{const r=q(t);try{const u=await l.delete(`/${r}/deleteDB/${e}`),{success:g,data:D}=u;if(g)return D}catch(u){console.log("delDatabaseById error:",u)}},saveDatabase:async(e,t)=>{const r=q(t);try{const u=await l.post(`/${r}/saveDBInfo`,e),{success:g,data:D}=u;if(g)return D}catch(u){console.log("saveDatabase error:",u)}},testConnection:async e=>{try{const t=await l.post("/directDB/testConnect",e),{success:r,data:u}=t;if(r)return u}catch(t){console.log("testConnection error:",t)}},syncSchema:async e=>{try{const t=await l.get(`/directDB/syncSchema/${e}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("syncSchema error:",t)}}}},q=m=>m=="DataTable"?"dataTable":"directDB",Ie="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCAzNiAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE0IDEyQzE0IDEwLjg5NTQgMTQuODk1NCAxMCAxNiAxMEgyOUMzMS4yMDkxIDEwIDMzIDExLjc5MDkgMzMgMTRWMjZDMzMgMzAuNDE4MyAyOS40MTgzIDM0IDI1IDM0SDE2QzE0Ljg5NTQgMzQgMTQgMzMuMTA0NiAxNCAzMlYxMloiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl80NDcyXzE4MDUyKSIvPgo8Zm9yZWlnbk9iamV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lvbj0iMiIvPgo8ZmVDb21wb3NpdGUgaW4yPSJoYXJkQWxwaGEiIG9wZXJhdG9yPSJvdXQiLz4KPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAuMzk2MDc4IDAgMCAwIDAgMC45ODQzMTQgMCAwIDAgMC40IDAiLz4KPGZlQmxlbmQgbW9kZT0ibm9ybWFsIiBpbjI9IkJhY2tncm91bmRJbWFnZUZpeCIgcmVzdWx0PSJlZmZlY3QxX2Ryb3BTaGFkb3dfNDQ3Ml8xODA1MiIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluPSJTb3VyY2VHcmFwaGljIiBpbjI9ImVmZmVjdDFfZHJvcFNoYWRvd180NDcyXzE4MDUyIiByZXN1bHQ9InNoYXBlIi8+CjwvZmlsdGVyPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfNDQ3Ml8xODA1MiIgeDE9IjIzLjUiIHkxPSIxMCIgeDI9IjIzLjUiIHkyPSIzNCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgo8c3RvcCBzdG9wLWNvbG9yPSIjNjRBMEZEIi8+CjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzAxNUFGRiIvPgo8L2xpbmVhckdyYWRpZW50Pgo8L2RlZnM+Cjwvc3ZnPgo=",fe=""+new URL("assets/database_connect.svg",import.meta.url).href,Me=""+new URL("assets/mysql.svg",import.meta.url).href,Ce=""+new URL("assets/SQLServer.png",import.meta.url).href,Ae=""+new URL("assets/PostgreSQL.png",import.meta.url).href,he=""+new URL("assets/Doris.png",import.meta.url).href,Be=[{label:"MySQL",value:"MySQL",icon:Me},{label:"PostgreSQL",value:"PostgreSQL",icon:Ae},{label:"SQLServer",value:"SQLServer",icon:Ce},{label:"Doris",value:"Doris",icon:he}],we=({drawerTitle:m,drawerVisible:z,isConnectSuccess:B,handleDrawerClose:F,dbInfo:l,dbType:n,eventsEmit:f})=>{const[G,W]=y(!1),[R,w]=y(!1),[e,t]=y({}),[r,u]=y(!1),g=T(()=>({id:n,layout:"vertical",formWidth:"500px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",counter:150,required:!1,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""}]}),[n,l]),D=T(()=>({id:n,layout:"vertical",formWidth:"470px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",required:!1,counter:150,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""},{id:"db-info",label:"\u76F4\u8FDE\u6570\u636E\u6E90\u4FE1\u606F",type:"title",level:2},{id:"dbType",name:"dbType",label:"\u6570\u636E\u6E90\u7C7B\u578B",type:"select",disabled:!!l,required:!0,options:Be.map(a=>{const{label:i,value:I,icon:x}=a;return{label:i,value:I,render:()=>Z("div",{className:"flex items-center gap-2",children:[c("img",{src:x,width:24}),c("span",{children:i})]})}})},{id:"dbHost",name:"dbHost",label:"\u4E3B\u673A\u5730\u5740",type:"input",required:!0,disabled:!!l,placeholder:"\u8BF7\u8F93\u5165IP\u5730\u5740\u6216\u8005\u57DF\u540D"},{id:"dbPort",name:"dbPort",label:"\u7AEF\u53E3\u53F7",type:"number",required:!0,disabled:!!l,placeholder:"\u8BF7\u8F93\u5165\u7AEF\u53E3\u540D\u79F0"},{id:"dbDatabase",name:"dbDatabase",label:"\u8FDE\u63A5\u6570\u636E\u5E93\u540D",disabled:!!l,placeholder:"\u8BF7\u8F93\u5165\u8FDE\u63A5\u6570\u636E\u5E93\u540D",required:!0,type:"input"},{type:"col",children:[{id:"dbUser",type:"input",name:"dbUser",label:"\u7528\u6237\u540D",disabled:!!l,placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D",required:!0},{id:"dbPassword",type:"password",name:"dbPassword",label:"\u5BC6\u7801",placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801",required:!0,disabled:r?!1:!!l}]}]}),[n,l,r]),p=K(null),A=(a,i,I)=>{switch(console.log("[Form] eventsEmit:",a,i,I),a){case"form:ready":i.formRef&&(p.current=i.formRef);break;case"form_field_change":console.log("\u5B57\u6BB5\u503C\u53D8\u5316:",i),t(x=>({...x,[i.fieldId]:i.value}));break;case"form_validation_error":console.log("\u8868\u5355\u9A8C\u8BC1\u9519\u8BEF:",i);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",a,i)}f==null||f(a,i,I)},h=async()=>{try{W(!0);const a=await p.current.getAllData();a.isValid&&(console.log(a,"==="),n=="DirectDB"&&m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!r&&(a.fields=a.fields.filter(i=>i.name=="name"||i.name=="description")),await f("form_submitted",a,void 0),u(!1))}catch(a){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",a)}finally{W(!1)}},N=async()=>{try{w(!0);const a=await p.current.getAllData();if(a.isValid){const i=a.fields.reduce((I,x)=>(I[x.name]=x.value,I),{});await f("form:connect_test",i,void 0)}}catch{w(!1)}finally{w(!1)}},d=T(()=>{const a=n=="DataTable"?g:D;return{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:a.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:a.id,type:"form",size:"md",formWidth:a.formWidth,formConfig:{layout:a.layout,showReset:!1,showSubmit:!1,formWidth:a.formWidth,getFormData:()=>({...e,timestamp:new Date().toISOString(),formId:a.id}),onFieldChange:(i,I)=>{A("form_field_change",{fieldId:i,value:I},void 0)},onValidationError:i=>{A("form_validation_error",i,void 0)}}}],dataSource:[{id:a.id,fields:a.fields,defaultValues:{...l}}],eventsEmit:A}},[n,g,D,z,l]),v=T(()=>n=="DirectDB"?l?r&&!B:!B:!1,[n,B,r,z]);return Z(ee,{title:m,width:620,onCancel:()=>{F(),u(!1)},open:z,destroyOnHidden:!0,footer:Z("div",{className:"flex justify-end gap-3",style:{justifyContent:"end"},children:[c(Q,{mode:"default",label:"\u53D6\u6D88",onClick:()=>{F(),u(!1)}}),c(Q,{mode:"primary",label:"\u786E\u8BA4",loading:G,disabled:v,onClick:h})]}),children:[c($,{...d},"example-form"),n==="DirectDB"&&c(De,{children:m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!r?c(Q,{mode:"primary",className:"mt-[10px]",label:"\u4FEE\u6539\u5BC6\u7801",onClick:()=>{u(!0),p.current.setValues({dbPassword:void 0})}}):c(Ee,{title:"\u9700\u901A\u8FC7\u6D4B\u8BD5\u624D\u53EF\u521B\u5EFA\u6210\u529F",children:c(Q,{mode:"primary",className:"mt-[10px]",label:"\u8FDE\u63A5\u6D4B\u8BD5",loading:R,onClick:N})})})]})},Ne=""+new URL("assets/empty.png",import.meta.url).href,{confirm:ve}=ee,xe=Fe.div`
|
|
1
|
+
import{jsxs as L,jsx as n,Fragment as De}from"react/jsx-runtime";import{useState as F,useMemo as W,useRef as $,useEffect as me}from"react";import{J,s as be,m as ye}from"./assets/index-DzFAvwdY.js";import{b as Fe,T as Ie,d as ge,i as O}from"./assets/index-BRq6VK9v.js";import{O as K}from"./assets/index-DDz1HJaH.js";import{M as ee,s as R}from"./assets/style-CRg0RQug.js";/* empty css */import"react-dom";const Ee=({url:m,token:v,role:B,eventsEmit:g})=>{const c=Fe.create({baseURL:m,timeout:1e6});return c.interceptors.request.use(e=>{let t=v;return!t&&!["user/login","user/kaptcha","user/regist"].some(u=>e.url.includes(u))?(g&&g("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(e.headers.Authorization=t||"",e.headers.userName=B==="\u672A\u767B\u5F55\u7528\u6237"?"":B,e)}),c.interceptors.response.use(e=>{const t=["user/kaptcha"],r=e.data;if(t.some(E=>e.config.url&&e.config.url.includes(E))||r.size&&r.type)return r;const{success:u,errorMsg:b,errorCode:D}=r;return u?r:(g&&g("request:error_business",{errorCode:D,errorMsg:b||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:r}),!1)},async e=>{var t,r,u,b,D,E,C,h,w;if(e.message==="canceled")return Promise.reject(e);if(g){let d="request:error_network",j={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:e};((t=e==null?void 0:e.response)==null?void 0:t.status)===401?(d="request:error_auth",j={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:e,redirect:"/login"}):(((u=(r=e==null?void 0:e.response)==null?void 0:r.data)==null?void 0:u.errorCode)==="30013"||((D=(b=e==null?void 0:e.response)==null?void 0:b.data)==null?void 0:D.errorCode)==="30023")&&(d="request:error_business",j={errorCode:(C=(E=e==null?void 0:e.response)==null?void 0:E.data)==null?void 0:C.errorCode,errorMsg:((w=(h=e==null?void 0:e.response)==null?void 0:h.data)==null?void 0:w.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:e}),g(d,j)}return console.log("Error occurs",e),Promise.reject(e)}),{getDatabaseList:async e=>{try{const t=await c.get(`/queryPageDBList?${new URLSearchParams(e).toString()}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("getDatabaseList error:",t)}},getShareDatabaseList:async e=>{try{const t=await c.get(`/queryShareDBList?${new URLSearchParams(e).toString()}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("getShareDatabaseList error:",t)}},delDatabaseById:async(e,t)=>{const r=q(t);try{const u=await c.delete(`/${r}/deleteDB/${e}`),{success:b,data:D}=u;if(b)return D}catch(u){console.log("delDatabaseById error:",u)}},saveDatabase:async(e,t)=>{const r=q(t);try{const u=await c.post(`/${r}/saveDBInfo`,e),{success:b,data:D}=u;if(b)return D}catch(u){console.log("saveDatabase error:",u)}},testConnection:async e=>{try{const t=await c.post("/directDB/testConnect",e),{success:r,data:u}=t;if(r)return u}catch(t){console.log("testConnection error:",t)}},syncSchema:async e=>{try{const t=await c.get(`/directDB/syncSchema/${e}`),{success:r,data:u}=t;if(r)return u}catch(t){console.log("syncSchema error:",t)}}}},q=m=>m=="DataTable"?"dataTable":"directDB",Me="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD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o8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiMwMTVBRkYiLz4NCjwvbGluZWFyR3JhZGllbnQ+DQo8L2RlZnM+DQo8L3N2Zz4NCg==",pe=""+new URL("assets/database_connect.svg",import.meta.url).href,fe=""+new URL("assets/mysql.svg",import.meta.url).href,Ae=""+new URL("assets/SQLServer.png",import.meta.url).href,Ce=""+new URL("assets/PostgreSQL.png",import.meta.url).href,he=""+new URL("assets/Doris.png",import.meta.url).href,Be=[{label:"MySQL",value:"MySQL",icon:fe},{label:"PostgreSQL",value:"PostgreSQL",icon:Ce},{label:"SQLServer",value:"SQLServer",icon:Ae},{label:"Doris",value:"Doris",icon:he}],Ne=({drawerTitle:m,drawerVisible:v,isConnectSuccess:B,handleDrawerClose:g,dbInfo:c,dbType:l,eventsEmit:p})=>{const[Q,V]=F(!1),[G,N]=F(!1),[e,t]=F({}),[r,u]=F(!1),b=W(()=>({id:l,layout:"vertical",formWidth:"500px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",counter:150,required:!1,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""}]}),[l,c]),D=W(()=>({id:l,layout:"vertical",formWidth:"470px",fields:[{id:"name",name:"name",label:"\u6570\u636E\u5E93\u540D\u79F0",type:"input",required:!0,placeholder:"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7",validate:a=>{if(!a)return"\u6570\u636E\u5E93\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";if(!/[\u4E00-\u9FA5A-Za-z0-9\W]/.test(a))return"\u4EC5\u652F\u6301\u6C49\u5B57\u3001\u6570\u5B57\u3001\u82F1\u6587\u3001\u7B26\u53F7"},counter:100},{id:"description",name:"description",label:"\u6570\u636E\u5E93\u63CF\u8FF0",type:"textarea",required:!1,counter:150,placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u5E93\u63CF\u8FF0,\u6B64\u63CF\u8FF0\u4EC5\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u6570\u636E\u5E93,\u4E0D\u4F1A\u5F71\u54CD\u6570\u636E\u5E93\u8C03\u7528",defaultValue:""},{id:"db-info",label:"\u76F4\u8FDE\u6570\u636E\u6E90\u4FE1\u606F",type:"title",level:2},{id:"dbType",name:"dbType",label:"\u6570\u636E\u6E90\u7C7B\u578B",type:"select",disabled:!!c,required:!0,options:Be.map(a=>{const{label:i,value:M,icon:k}=a;return{label:i,value:M,render:()=>L("div",{className:"flex items-center gap-2",children:[n("img",{src:k,width:24}),n("span",{children:i})]})}})},{id:"dbHost",name:"dbHost",label:"\u4E3B\u673A\u5730\u5740",type:"input",required:!0,disabled:!!c,placeholder:"\u8BF7\u8F93\u5165IP\u5730\u5740\u6216\u8005\u57DF\u540D"},{id:"dbPort",name:"dbPort",label:"\u7AEF\u53E3\u53F7",type:"number",required:!0,disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u7AEF\u53E3\u540D\u79F0"},{id:"dbDatabase",name:"dbDatabase",label:"\u8FDE\u63A5\u6570\u636E\u5E93\u540D",disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u8FDE\u63A5\u6570\u636E\u5E93\u540D",required:!0,type:"input"},{type:"col",children:[{id:"dbUser",type:"input",name:"dbUser",label:"\u7528\u6237\u540D",disabled:!!c,placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D",required:!0},{id:"dbPassword",type:"password",name:"dbPassword",label:"\u5BC6\u7801",placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801",required:!0,disabled:r?!1:!!c}]}]}),[l,c,r]),E=$(null),C=(a,i,M)=>{switch(console.log("[Form] eventsEmit:",a,i,M),a){case"form:ready":i.formRef&&(E.current=i.formRef);break;case"form_field_change":console.log("\u5B57\u6BB5\u503C\u53D8\u5316:",i),t(k=>({...k,[i.fieldId]:i.value}));break;case"form_validation_error":console.log("\u8868\u5355\u9A8C\u8BC1\u9519\u8BEF:",i);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",a,i)}p==null||p(a,i,M)},h=async()=>{try{V(!0);const a=await E.current.getAllData();a.isValid&&(console.log(a,"==="),l=="DirectDB"&&m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!r&&(a.fields=a.fields.filter(i=>i.name=="name"||i.name=="description")),await p("form_submitted",a,void 0),u(!1))}catch(a){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",a)}finally{V(!1)}},w=async()=>{try{N(!0);const a=await E.current.getAllData();if(a.isValid){const i=a.fields.reduce((M,k)=>(M[k.name]=k.value,M),{});await p("form:connect_test",i,void 0)}}catch{N(!1)}finally{N(!1)}},d=W(()=>{const a=l=="DataTable"?b:D;return{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:a.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:a.id,type:"form",size:"md",formWidth:a.formWidth,formConfig:{layout:a.layout,showReset:!1,showSubmit:!1,formWidth:a.formWidth,getFormData:()=>({...e,timestamp:new Date().toISOString(),formId:a.id}),onFieldChange:(i,M)=>{C("form_field_change",{fieldId:i,value:M},void 0)},onValidationError:i=>{C("form_validation_error",i,void 0)}}}],dataSource:[{id:a.id,fields:a.fields,defaultValues:{...c}}],eventsEmit:C}},[l,b,D,v,c]),j=W(()=>l=="DirectDB"?c?r&&!B:!B:!1,[l,B,r,v]);return L(ee,{title:m,width:620,onCancel:()=>{g(),u(!1)},open:v,destroyOnHidden:!0,footer:L("div",{className:"flex justify-end gap-3",style:{justifyContent:"end"},children:[n(J,{mode:"default",label:"\u53D6\u6D88",onClick:()=>{g(),u(!1)}}),n(J,{mode:"primary",label:"\u786E\u8BA4",loading:Q,disabled:j,onClick:h})]}),children:[n(K,{...d},"example-form"),l==="DirectDB"&&n(De,{children:m=="\u7F16\u8F91\u6570\u636E\u5E93"&&!r?n(J,{mode:"primary",className:"mt-[10px]",label:"\u4FEE\u6539\u5BC6\u7801",onClick:()=>{u(!0),E.current.setValues({dbPassword:void 0})}}):n(Ie,{title:"\u9700\u901A\u8FC7\u6D4B\u8BD5\u624D\u53EF\u521B\u5EFA\u6210\u529F",children:n(J,{mode:"primary",className:"mt-[10px]",label:"\u8FDE\u63A5\u6D4B\u8BD5",loading:G,onClick:w})})})]})},we=""+new URL("assets/empty.png",import.meta.url).href,{confirm:je}=ee,ke=ge.div`
|
|
2
2
|
width: 282px;
|
|
3
3
|
height: 81px;
|
|
4
4
|
display: flex;
|
|
@@ -17,4 +17,4 @@ import{jsxs as Z,jsx as c,Fragment as De}from"react/jsx-runtime";import{useState
|
|
|
17
17
|
background-color: #F1F5FF;
|
|
18
18
|
};
|
|
19
19
|
border: 1px solid #EBEBEB
|
|
20
|
-
`,
|
|
20
|
+
`,xe=[{key:"add_file_db",label:"\u4E0A\u4F20\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0A\u4F20Excel\u3001csv\u7B49\u683C\u5F0F\u6570\u636E\u8868\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:Me},{key:"add_direct_db",label:"\u76F4\u8FDE\u6570\u636E\u5E93",dsc:"\u901A\u8FC7\u4E0E\u5DF2\u6709\u4E1A\u52A1\u5EFA\u7ACB\u8FDE\u63A5\u521B\u5EFA\u6570\u636E\u5E93\u3002",icon:pe}],Ge=m=>{const{url:v,token:B,role:g,CustomComponents:c,getBtnDisabled:l}=m,[p,Q]=F("my-db"),[V,G]=F({app:"ready",container:"ready",content:"ready"}),[N,e]=F(!1),[t,r]=F([{id:"my-db",data:[]},{id:"shared-db",data:[]}]),u=$(null),[b,D]=F(!1),[E,C]=F(""),[h,w]=F("DataTable"),[d,j]=F(),[a,i]=F(!1),{getDatabaseList:M,delDatabaseById:k,saveDatabase:ue,testConnection:te,getShareDatabaseList:ae,syncSchema:se}=Ee({url:v,token:B,role:g,eventsEmit:m.eventsEmit}),H=W(()=>[{label:"\u6211\u7684\u6570\u636E\u5E93",id:"my-db",type:"card",cardType:"database",rowHeight:220,viewPageSize:12,viewBehavior:"pagination",actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}],toolbar:[{type:"customized",key:"add",render:()=>n(be,{mode:"primary",label:"\u521B\u5EFA\u6570\u636E\u5E93",actions:xe.map(o=>({key:o.key,component:n(ke,{children:L("div",{className:"flex flex-grow",children:[n("div",{className:"mr-[6px]",children:n("img",{src:o.icon})}),L("div",{children:[n("div",{className:"text-base font-bold mb-1 text-[14px]",children:o.label}),n("div",{className:"text-[#888] text-[10px]",children:o.dsc})]})]})},o.key)})),eventEmit:Y})},{type:"fuzzy_search",key:"search",label:"\u8F93\u5165\u540D\u79F0\u641C\u7D22",searchKeys:["name","description"],position:"right"}]},{label:"\u5171\u4EAB\u6570\u636E\u5E93",id:"shared-db",type:"card",cardType:"database",rowHeight:240,toolbar:[{type:"fuzzy_search",key:"search",label:"\u641C\u7D22",position:"right"}],actions:[{label:"\u7F16\u8F91",key:"edit"},{label:"\u5220\u9664",key:"delete"}]}],[t]);me(()=>{G(o=>({...o,content:"loading"})),re()},[]);const re=async()=>{var o,s,f,y;try{const[A,z]=await Promise.allSettled([M({pageNo:1,pageSize:999}),ae({pageNo:1,pageSize:999})]);let T=[];if(A.status==="fulfilled"&&A.value&&(o=A.value)!=null&&o.records){const x=X((s=A.value)==null?void 0:s.records);T.push({id:"my-db",data:x||[]})}if(z.status==="fulfilled"&&z.value&&(f=z.value)!=null&&f.records){const x=X((y=z.value)==null?void 0:y.records);T.push({id:"shared-db",data:x||[]})}r(T),G(x=>({...x,content:"ready"}))}catch(A){console.log("[DatabaseApiError] getDatabaseList:",A)}},X=o=>(o||[]).map(s=>{const f=U("shared-db").map((y,A)=>({...y,key:y.type==="divider"?`${y.key}_${s.id}`:y.key,disabled:l&&l(y.key=="edit"?7:4,s.permission)}));return s.datasourceType=="DirectDB"&&f.push({label:"\u540C\u6B65\u8868\u7ED3\u6784",key:"sync_schema",disabled:l&&l(7,s.permission)}),console.log("[DatabaseViewAdopter] actions:",f),{...s,actions:f||[]}}),ie="admin",oe=()=>L("div",{className:"flex flex-col items-center justify-center h-full",children:[n("div",{className:"text-xl font-semibold mb-3",style:{color:"#374151"},children:n("img",{src:we,width:120})}),n("div",{className:"text-base mb-6",style:{color:"#6b7280"},children:"\u6682\u65E0\u6570\u636E\uFF0C\u8BF7\u5148\u6DFB\u52A0\u6570\u636E\u5E93"})]}),U=o=>{const s=H.find(y=>y.id===o);return(s==null?void 0:s.actions)||[]},ce=W(()=>{var s;const o=((s=t==null?void 0:t.find(f=>f.id===p))==null?void 0:s.data)||[];return N?[]:o},[p,t,N]),_=()=>{D(!1),i(!1),j(void 0)},ne=async o=>{console.log("[DatabaseViewAdopter] \u6D4B\u8BD5\u8FDE\u63A5:",o);const s=await te(o);return s&&(i(!0),R.success("\u8FDE\u63A5\u6D4B\u8BD5\u6210\u529F\uFF01")),s};async function Y(o,s,f){var y,A,z,T,x;switch(console.log("[DatabaseViewAdopter] mergedEventsEmit",o,s),o){case"card_delete":je({title:"\u786E\u8BA4\u5220\u9664\u6570\u636E\u5E93\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u6570\u636E\u5E93\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88",async onOk(){await k(s.id,s.datasourceType)&&(u!=null&&u.current)&&(u==null||u.current.appFn.removeItem(s.id))},onCancel(){console.log("Cancel")}});break;case"card_edit":C("\u7F16\u8F91\u6570\u636E\u5E93"),D(!0),w(s.datasourceType),delete s.render,j(s);break;case"select":Q(s.id);break;case"filesDir_clicked":Q(s.id);break;case"dropdown_action":C("\u521B\u5EFA\u6570\u636E\u5E93"),D(!0),s.key=="add_file_db"?w("DataTable"):w("DirectDB");break;case"form_submitted":try{const S=s.fields.reduce((Z,I)=>(Z[I.name]=I.value,Z),{}),le=d?{id:d==null?void 0:d.id,...S}:S,P=await ue(le,h);if(P){if(d){const Z={...d,...S,datasourceType:h,actions:U("my-db").map((I,de)=>({...I,key:I.type==="divider"?`${I.key}_${P}`:I.key,allow:!0}))};(A=(y=u==null?void 0:u.current)==null?void 0:y.appFn)==null||A.updateItem(Z,d==null?void 0:d.id),R.success("\u6570\u636E\u5E93\u7F16\u8F91\u6210\u529F\uFF01")}else{const Z={...S,...P,createBy:ie,datasourceType:h,actions:U("my-db").map((I,de)=>({...I,key:I.type==="divider"?`${I.key}_${P}`:I.key,allow:!0}))};(T=(z=u==null?void 0:u.current)==null?void 0:z.appFn)==null||T.addItem(Z,{animate:!0,position:"start"}),R.success("\u6570\u636E\u5E93\u521B\u5EFA\u6210\u529F\uFF01")}return P}}catch(S){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",S)}finally{_()}break;case"form:connect_test":return await ne(s);case"toolbar_test_empty":console.log("[DatabaseViewAdopter] toolbar_test_empty \u4E8B\u4EF6\u89E6\u53D1"),e(!N);break;case"card_sync_schema":await se(s.id)&&(i(!0),R.success("\u540C\u6B65\u8868\u7ED3\u6784\u6210\u529F\uFF01"));break;default:(x=m.eventsEmit)==null||x.call(m,o,s);break}}return L(ye,{title:"\u6570\u636E\u5E93\u7BA1\u7406",children:[n(K,{ref:u,label:"",model:"tabs",defaultActiveId:p,views:H,dataSource:ce,eventsEmit:Y,status:V,CustomComponents:{EmptyData:oe,...c},styles:{theme:{...O,colors:{...O.colors,listBackground:"#ffffff"}},mode:"light"}},"db"),n(Ne,{drawerTitle:E,drawerVisible:b,isConnectSuccess:a,dbType:h,dbInfo:d,handleDrawerClose:_,eventsEmit:Y})]})};export{Ge as default};
|
package/databaseId.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"react/jsx-runtime";import"react";import"./assets/index-CpW6Dhpp.js";import"./assets/index-DzFAvwdY.js";import"./assets/index-BRq6VK9v.js";import"./assets/index-DDz1HJaH.js";/* empty css */import"./assets/style-CRg0RQug.js";import{D as g}from"./assets/index-
|
|
1
|
+
import"react/jsx-runtime";import"react";import"./assets/index-CpW6Dhpp.js";import"./assets/index-DzFAvwdY.js";import"./assets/index-BRq6VK9v.js";import"./assets/index-DDz1HJaH.js";/* empty css */import"./assets/style-CRg0RQug.js";import{D as g}from"./assets/index-D7Xktzjl.js";import"./assets/index-BfDZSwG3.js";import"react-dom";import"./assets/index-iToxgF6w.js";import"./assets/index-B3zi0w0x.js";import"./assets/index-DNMf-zgr.js";import"./assets/index-BQi5haCb.js";import"./assets/x-D-pV1NCt.js";export{g as default};
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DrawerType as y}from"./chat.js";import"./database.js";import"./assets/index-
|
|
1
|
+
import{DrawerType as y}from"./chat.js";import"./database.js";import"./assets/index-D7Xktzjl.js";import"./databaseTable.js";import"react/jsx-runtime";import"react";import"./modelManage.js";import"./sensitive.js";import{G as F,B as P}from"./assets/GientechStreamReader-BRrzGvlY.js";import"./assets/index-B2DbErCc.js";import{i as S}from"./assets/index-BRq6VK9v.js";import"./assets/index-DzFAvwdY.js";import"react-dom";import"./assets/index-iToxgF6w.js";import"./assets/index-B3zi0w0x.js";import"./assets/index-DNMf-zgr.js";import"./assets/index-CpW6Dhpp.js";import"./assets/plus-CldFV1Lg.js";import"./assets/x-D-pV1NCt.js";import"./assets/style-CRg0RQug.js";/* empty css */import"./assets/index-BQi5haCb.js";import"./assets/index-DDz1HJaH.js";import"./assets/index-BfDZSwG3.js";export{y as DrawerType,F as GientechStreamReader,S as defaultTheme,P as registerPDFWorker};
|
package/package.json
CHANGED
|
@@ -3,15 +3,11 @@
|
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"style": "assets/style.css",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "2.1.
|
|
6
|
+
"version": "2.1.13",
|
|
7
7
|
"author": "hanfeng_Zhang",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"types": "index.d.ts",
|
|
11
|
-
"scripts": {
|
|
12
|
-
"test": "yarn link",
|
|
13
|
-
"disconnect": "yarn unlink"
|
|
14
|
-
},
|
|
15
11
|
"peerDependencies": {
|
|
16
12
|
"react": ">=18",
|
|
17
13
|
"react-dom": ">=18"
|
|
@@ -64,5 +60,9 @@
|
|
|
64
60
|
},
|
|
65
61
|
"./style.css": "./assets/style.css",
|
|
66
62
|
"./assets/style.css": "./assets/style.css"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"test": "yarn link",
|
|
66
|
+
"disconnect": "yarn unlink"
|
|
67
67
|
}
|
|
68
|
-
}
|
|
68
|
+
}
|
package/streamFilesReader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as d,B as f}from"./assets/GientechStreamReader-
|
|
1
|
+
import{G as d,B as f}from"./assets/GientechStreamReader-BRrzGvlY.js";import"react/jsx-runtime";import"react";import"./assets/index-BRq6VK9v.js";import"react-dom";import"./assets/index-iToxgF6w.js";import"./assets/index-DzFAvwdY.js";import"./assets/index-B3zi0w0x.js";import"./assets/index-DNMf-zgr.js";import"./assets/x-D-pV1NCt.js";export{d as GientechStreamReader,f as registerPDFWorker};
|