diff --git a/pilot/server/static/404.html b/pilot/server/static/404.html index 908812152..0025ed2a9 100644 --- a/pilot/server/static/404.html +++ b/pilot/server/static/404.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/pilot/server/static/404/index.html b/pilot/server/static/404/index.html index 908812152..0025ed2a9 100644 --- a/pilot/server/static/404/index.html +++ b/pilot/server/static/404/index.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/pilot/server/static/_next/static/6KBZVUsQDSTOXHczAINub/_buildManifest.js b/pilot/server/static/_next/static/6KBZVUsQDSTOXHczAINub/_buildManifest.js new file mode 100644 index 000000000..d0c777097 --- /dev/null +++ b/pilot/server/static/_next/static/6KBZVUsQDSTOXHczAINub/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST=function(s,a,c,t,e,d,n,u,f,i){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[a,"static/chunks/673-9f0ceb79f1535087.js","static/chunks/pages/index-ad9fe4b8efe06ace.js"],"/_error":["static/chunks/pages/_error-dee72aff9b2e2c12.js"],"/chat":["static/chunks/pages/chat-cf7d95f63f5aacee.js"],"/database":[s,c,d,t,"static/chunks/566-493c6126d6ac9745.js","static/chunks/196-48d8c6ab3e99146c.js","static/chunks/pages/database-670b4fa76152da89.js"],"/datastores":[e,s,a,n,u,"static/chunks/241-4117dd68a591b7fa.js","static/chunks/pages/datastores-cc1916d2425430ee.js"],"/datastores/documents":[e,"static/chunks/75fc9c18-a784766a129ec5fb.js",s,a,n,c,f,d,t,i,u,"static/chunks/749-f876c99e30a851b8.js","static/chunks/pages/datastores/documents-6dd307574a33f39c.js"],"/datastores/documents/chunklist":[e,s,c,f,t,i,"static/chunks/pages/datastores/documents/chunklist-0fae5e5132233223.js"],sortedPages:["/","/_app","/_error","/chat","/database","/datastores","/datastores/documents","/datastores/documents/chunklist"]}}("static/chunks/215-c0761f73cb28fff6.js","static/chunks/913-e3ab2daf183d352e.js","static/chunks/902-4b12ce531524546f.js","static/chunks/455-597a8a48388a0d9b.js","static/chunks/29107295-90b90cb30c825230.js","static/chunks/908-33709e71961cb7a1.js","static/chunks/718-ae767ae95bca674e.js","static/chunks/589-8dfb35868cafc00b.js","static/chunks/289-06c0d9f538f77a71.js","static/chunks/34-c924e44753dd2c5b.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/pilot/server/static/_next/static/BgnWXjZjotJYvNPP1jjbr/_ssgManifest.js b/pilot/server/static/_next/static/6KBZVUsQDSTOXHczAINub/_ssgManifest.js similarity index 100% rename from pilot/server/static/_next/static/BgnWXjZjotJYvNPP1jjbr/_ssgManifest.js rename to pilot/server/static/_next/static/6KBZVUsQDSTOXHczAINub/_ssgManifest.js diff --git a/pilot/server/static/_next/static/BgnWXjZjotJYvNPP1jjbr/_buildManifest.js b/pilot/server/static/_next/static/BgnWXjZjotJYvNPP1jjbr/_buildManifest.js deleted file mode 100644 index 4b2718fa6..000000000 --- a/pilot/server/static/_next/static/BgnWXjZjotJYvNPP1jjbr/_buildManifest.js +++ /dev/null @@ -1 +0,0 @@ -self.__BUILD_MANIFEST=function(s,a,c,t,e,d,n,f,u,i){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[a,"static/chunks/673-9f0ceb79f1535087.js","static/chunks/pages/index-ad9fe4b8efe06ace.js"],"/_error":["static/chunks/pages/_error-dee72aff9b2e2c12.js"],"/chat":["static/chunks/pages/chat-cf7d95f63f5aacee.js"],"/database":[s,c,d,t,"static/chunks/566-1647c29b610cc91f.js","static/chunks/196-d506a604048bb099.js","static/chunks/pages/database-670b4fa76152da89.js"],"/datastores":[e,s,a,n,f,"static/chunks/241-4117dd68a591b7fa.js","static/chunks/pages/datastores-cc1916d2425430ee.js"],"/datastores/documents":[e,"static/chunks/75fc9c18-a784766a129ec5fb.js",s,a,n,c,u,d,t,i,f,"static/chunks/749-f876c99e30a851b8.js","static/chunks/pages/datastores/documents-ff1a926b0d785967.js"],"/datastores/documents/chunklist":[e,s,c,u,t,i,"static/chunks/pages/datastores/documents/chunklist-0fae5e5132233223.js"],sortedPages:["/","/_app","/_error","/chat","/database","/datastores","/datastores/documents","/datastores/documents/chunklist"]}}("static/chunks/215-f25b5ee565da557d.js","static/chunks/913-e3ab2daf183d352e.js","static/chunks/902-621cc1dcac80f833.js","static/chunks/455-46cbd68d6b40309e.js","static/chunks/29107295-90b90cb30c825230.js","static/chunks/908-8f37a17e21943efa.js","static/chunks/718-ae767ae95bca674e.js","static/chunks/589-8dfb35868cafc00b.js","static/chunks/289-06c0d9f538f77a71.js","static/chunks/34-88b40af245c4632a.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/pilot/server/static/_next/static/chunks/196-d506a604048bb099.js b/pilot/server/static/_next/static/chunks/196-48d8c6ab3e99146c.js similarity index 100% rename from pilot/server/static/_next/static/chunks/196-d506a604048bb099.js rename to pilot/server/static/_next/static/chunks/196-48d8c6ab3e99146c.js diff --git a/pilot/server/static/_next/static/chunks/215-f25b5ee565da557d.js b/pilot/server/static/_next/static/chunks/215-c0761f73cb28fff6.js similarity index 100% rename from pilot/server/static/_next/static/chunks/215-f25b5ee565da557d.js rename to pilot/server/static/_next/static/chunks/215-c0761f73cb28fff6.js diff --git a/pilot/server/static/_next/static/chunks/34-88b40af245c4632a.js b/pilot/server/static/_next/static/chunks/34-c924e44753dd2c5b.js similarity index 100% rename from pilot/server/static/_next/static/chunks/34-88b40af245c4632a.js rename to pilot/server/static/_next/static/chunks/34-c924e44753dd2c5b.js diff --git a/pilot/server/static/_next/static/chunks/392.30425092829b4bae.js b/pilot/server/static/_next/static/chunks/392.30425092829b4bae.js deleted file mode 100644 index 73e6080af..000000000 --- a/pilot/server/static/_next/static/chunks/392.30425092829b4bae.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[392],{35392:function(e,l,a){"use strict";a.r(l),a.d(l,{default:function(){return ed}});var t=a(85893),s=a(67294),n=a(41118),r=a(16789),i=a(80837),c=a(79172),o=a(30208),d=a(40911),u=a(51610),h=a(48665),m=a(577),x=a(1375),p=e=>{let l=(0,s.useReducer)((e,l)=>({...e,...l}),{...e});return l},v=a(58301),f=a(41468),g=e=>{let{queryAgentURL:l,channel:a,queryBody:t,initHistory:n=[]}=e,[r,i]=p({history:n}),{refreshDialogList:c,chatId:o}=(0,s.useContext)(f.p),d=new AbortController;(0,s.useEffect)(()=>{n&&n.length&&i({history:n})},[n]);let u=async(e,s)=>{if(!e)return;let n=[...r.history,{role:"human",context:e}],u=n.length;i({history:n});let h={conv_uid:o,...s,...t,user_input:e,channel:a};if(!(null==h?void 0:h.conv_uid)){v.ZP.error("conv_uid 不存在,请刷新后重试");return}try{await (0,x.L)("".concat("http://127.0.0.1:5000").concat("/api"+l),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h),signal:d.signal,openWhenHidden:!0,async onopen(e){if(n.length<=1){var l;c();let e=new URLSearchParams(window.location.search);e.delete("initMessage"),null===(l=window.history)||void 0===l||l.replaceState(null,"","?".concat(e.toString()))}(!e.ok||e.headers.get("content-type")!==x.a)&&e.status>=400&&e.status<500&&429!==e.status&&e.status},onclose(){console.log("onclose")},onerror(e){throw console.log("onerror"),Error(e)},onmessage:e=>{var l,a,t;if(e.data=null===(l=e.data)||void 0===l?void 0:l.replaceAll("\\n","\n"),"[DONE]"===e.data);else if(null===(a=e.data)||void 0===a?void 0:a.startsWith("[ERROR]"))i({history:[...n,{role:"view",context:null===(t=e.data)||void 0===t?void 0:t.replace("[ERROR]","")}]});else{let l=[...n];e.data&&((null==l?void 0:l[u])?l[u].context="".concat(e.data):l.push({role:"view",context:e.data}),i({history:l}))}}})}catch(e){console.log(e),i({history:[...n,{role:"view",context:"Sorry, We meet some error, please try agin later."}]})}};return{handleChatSubmit:u,history:r.history}},b=a(24339),j=a(14986),y=a(30322),w=a(75913),N=a(14553),Z=a(48699),_=a(13245),k=a(43458),C=a(47556),S=a(87536),P=a(39332),B=a(96486),E=a.n(B),L=a(99513),O=a(2166),M=a(50228),R=a(87547),z=a(35576),F=a(56986),U=a(93179),I=a(51792);let q={overrides:{code:e=>{let{children:l,className:a}=e;return(0,t.jsx)(U.Z,{language:"javascript",style:F.Z,children:l})},img:{props:{className:"my-2 !max-h-none"}},table:{props:{className:"my-2 border-collapse border border-slate-400 dark:border-slate-500 bg-white dark:bg-slate-800 text-sm shadow-sm"}},thead:{props:{className:"bg-slate-50 dark:bg-slate-700"}},th:{props:{className:"border border-slate-300 dark:border-slate-600 font-semibold !p-2 text-slate-900 dark:text-slate-200 !text-left"}},td:{props:{className:"border border-slate-300 dark:border-slate-700 !p-2 text-slate-500 dark:text-slate-400 !text-left"}}},wrapper:s.Fragment,namedCodesToUnicode:{amp:"&",apos:"'",gt:">",lt:"<",nbsp:"\xa0",quot:"“"}};var A=function(e){let{content:l,isChartChat:a,onLinkClick:s}=e,{context:n,model_name:r,role:i}=l,c="view"===i;return(0,t.jsxs)("div",{className:"overflow-x-auto w-full lg:w-4/5 xl:w-3/4 mx-auto flex px-2 py-2 sm:px-4 sm:py-6 rounded-xl ".concat(c?"bg-slate-100 dark:bg-[#353539]":""),children:[(0,t.jsx)("div",{className:"mr-2 flex items-center justify-center h-7 w-7 rounded-full text-lg sm:mr-4",children:c?(0,I.A)(r)||(0,t.jsx)(M.Z,{}):(0,t.jsx)(R.Z,{})}),(0,t.jsxs)("div",{className:"flex-1 items-center text-md leading-7",children:[a&&"object"==typeof n&&(0,t.jsxs)(t.Fragment,{children:["[".concat(n.template_name,"]: "),(0,t.jsx)(O.Z,{sx:{color:"#1677ff"},component:"button",onClick:s,children:n.template_introduce||"More Details"})]}),"string"==typeof n&&(0,t.jsx)(z.Z,{options:q,children:n.replaceAll("\\n","\n")})]})]})},D=e=>{let{messages:l,onSubmit:a,paramsObj:n={},clearInitMessage:r}=e,i=(0,P.useSearchParams)(),c=i&&i.get("initMessage"),o=i&&i.get("spaceNameOriginal"),{currentDialogue:d,scene:u,model:h}=(0,s.useContext)(f.p),m="chat_dashboard"===u,[x,p]=(0,s.useState)(!1),[v,g]=(0,s.useState)(""),[B,O]=(0,s.useState)(!1),[M,R]=(0,s.useState)(),[z,F]=(0,s.useState)(l),[U,q]=(0,s.useState)(""),D=(0,s.useRef)(null),V=(0,s.useMemo)(()=>Object.entries(n).map(e=>{let[l,a]=e;return{key:l,value:a}}),[n]),W=(0,S.cI)(),T=async e=>{let{query:l}=e;try{p(!0),W.reset(),await a(l,{select_param:"chat_excel"===u?null==d?void 0:d.select_param:n[v]})}catch(e){}finally{p(!1)}},H=async()=>{try{var e;let l=new URLSearchParams(window.location.search),a=l.get("initMessage");l.delete("initMessage"),null===(e=window.history)||void 0===e||e.replaceState(null,"","?".concat(l.toString())),await T({query:a})}catch(e){console.log(e)}finally{null==r||r()}},J=e=>{let l=e;try{l=JSON.parse(e)}catch(e){console.log(e)}return l};return(0,s.useEffect)(()=>{D.current&&D.current.scrollTo(0,D.current.scrollHeight)},[null==l?void 0:l.length]),(0,s.useEffect)(()=>{c&&l.length<=0&&H()},[H,c,l.length]),(0,s.useEffect)(()=>{(null==V?void 0:V.length)&&g(o||V[0].value)},[V,null==V?void 0:V.length,o]),(0,s.useEffect)(()=>{if(m){let e=E().cloneDeep(l);e.forEach(e=>{(null==e?void 0:e.role)==="view"&&"string"==typeof(null==e?void 0:e.context)&&(e.context=J(null==e?void 0:e.context))}),F(e.filter(e=>["view","human"].includes(e.role)))}else F(l.filter(e=>["view","human"].includes(e.role)))},[m,l]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{ref:D,className:"flex flex-1 overflow-y-auto pb-8 w-full flex-col",children:(0,t.jsx)("div",{className:"flex items-center flex-1 flex-col text-sm leading-6 text-slate-900 dark:text-slate-300 sm:text-base sm:leading-7",children:null==z?void 0:z.map((e,l)=>(0,t.jsx)(A,{content:e,isChartChat:m,onLinkClick:()=>{O(!0),R(l),q(JSON.stringify(null==e?void 0:e.context,null,2))}},l))})}),(0,t.jsx)("div",{className:"relative after:absolute after:-top-8 after:h-8 after:w-full after:bg-gradient-to-t after:from-white after:to-transparent dark:after:from-[#212121]",children:(0,t.jsxs)("form",{className:"flex flex-wrap w-full lg:w-4/5 xl:w-3/4 mx-auto py-2 sm:pt-6 sm:pb-10",onSubmit:e=>{e.stopPropagation(),W.handleSubmit(T)(e)},children:[!!(null==V?void 0:V.length)&&(0,t.jsx)("div",{className:"flex items-center max-w-[6rem] sm:max-w-[12rem] h-12 mr-2 mb-2",children:(0,t.jsx)(j.Z,{className:"h-full w-full",value:v,onChange:(e,l)=>{g(null!=l?l:"")},children:V.map(e=>(0,t.jsx)(y.Z,{value:e.value,children:e.key},e.key))})}),(0,t.jsx)(w.ZP,{disabled:"chat_excel"===u&&!(null==d?void 0:d.select_param),className:"flex-1 h-12",variant:"outlined",startDecorator:(0,I.A)(h||""),endDecorator:(0,t.jsx)(N.ZP,{type:"submit",children:x?(0,t.jsx)(Z.Z,{}):(0,t.jsx)(b.Z,{})}),...W.register("query")})]})}),(0,t.jsx)(_.Z,{open:B,onClose:()=>{O(!1)},children:(0,t.jsxs)(k.Z,{className:"w-1/2 h-[600px] flex items-center justify-center","aria-labelledby":"variant-modal-title","aria-describedby":"variant-modal-description",children:[(0,t.jsx)(L.Z,{className:"w-full h-[500px]",language:"json",value:U}),(0,t.jsx)(C.Z,{variant:"outlined",className:"w-full mt-2",onClick:()=>O(!1),children:"OK"})]})})]})},V=a(63012);function W(e){let{key:l,chart:a}=e;return(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)(n.Z,{className:"h-full",sx:{background:"transparent"},children:(0,t.jsxs)(o.Z,{className:"h-full",children:[(0,t.jsx)(d.ZP,{gutterBottom:!0,component:"div",children:a.chart_name}),(0,t.jsx)(d.ZP,{gutterBottom:!0,level:"body3",children:a.chart_desc}),(0,t.jsx)("div",{className:"h-[300px]",children:(0,t.jsx)(V.Chart,{autoFit:!0,data:a.values,children:(0,t.jsx)(V.LineAdvance,{shape:"smooth",point:!0,area:!0,position:"name*value",color:"type"})})})]})})},l)}function T(e){let{key:l,chart:a}=e;return(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)(n.Z,{className:"h-full",sx:{background:"transparent"},children:(0,t.jsxs)(o.Z,{className:"h-full",children:[(0,t.jsx)(d.ZP,{gutterBottom:!0,component:"div",children:a.chart_name}),(0,t.jsx)(d.ZP,{gutterBottom:!0,level:"body3",children:a.chart_desc}),(0,t.jsx)("div",{className:"h-[300px]",children:(0,t.jsxs)(V.Chart,{autoFit:!0,data:a.values,children:[(0,t.jsx)(V.Interval,{position:"name*value",style:{lineWidth:3,stroke:(0,V.getTheme)().colors10[0]}}),(0,t.jsx)(V.Tooltip,{shared:!0})]})})]})})},l)}var H=a(61685);function J(e){var l,a;let{key:s,chart:r}=e,i=(0,B.groupBy)(r.values,"type");return(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)(n.Z,{className:"h-full overflow-auto",sx:{background:"transparent"},children:(0,t.jsxs)(o.Z,{className:"h-full",children:[(0,t.jsx)(d.ZP,{gutterBottom:!0,component:"div",children:r.chart_name}),"\xb7",(0,t.jsx)(d.ZP,{gutterBottom:!0,level:"body3",children:r.chart_desc}),(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsxs)(H.Z,{"aria-label":"basic table",stripe:"odd",hoverRow:!0,borderAxis:"bothBetween",children:[(0,t.jsx)("thead",{children:(0,t.jsx)("tr",{children:Object.keys(i).map(e=>(0,t.jsx)("th",{children:e},e))})}),(0,t.jsx)("tbody",{children:null===(l=Object.values(i))||void 0===l?void 0:null===(a=l[0])||void 0===a?void 0:a.map((e,l)=>{var a;return(0,t.jsx)("tr",{children:null===(a=Object.keys(i))||void 0===a?void 0:a.map(e=>{var a;return(0,t.jsx)("td",{children:(null==i?void 0:null===(a=i[e])||void 0===a?void 0:a[l].value)||""},e)})},l)})})]})})]})})},s)}var $=a(43893),G=a(45247),K=a(94139),Q=a(65170),X=a(71577),Y=a(69814),ee=a(49591),el=a(88484),ea=a(29158),et=function(e){var l;let{convUid:a,chatMode:n,onComplete:r,...i}=e,[c,o]=(0,s.useState)(!1),[d,u]=(0,s.useState)([]),[h,m]=(0,s.useState)(),[x,p]=(0,s.useState)(),{model:g}=(0,s.useContext)(f.p),b=async e=>{var l;if(!e){v.ZP.error("Please select the *.(csv|xlsx|xls) file");return}if(!/\.(csv|xlsx|xls)$/.test(null!==(l=e.file.name)&&void 0!==l?l:"")){v.ZP.error("File type must be csv, xlsx or xls");return}u([e.file])},j=async()=>{o(!0),p("normal");try{let e=new FormData;e.append("doc_file",d[0]);let[l]=await (0,$.Vx)((0,$.qn)({convUid:a,chatMode:n,data:e,model:g,config:{timeout:36e5,onUploadProgress:e=>{let l=Math.ceil(e.loaded/(e.total||0)*100);m(l)}}}));if(l)return;v.ZP.success("success"),p("success"),null==r||r()}catch(e){p("exception"),v.ZP.error((null==e?void 0:e.message)||"Upload Error")}finally{o(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"h-full flex items-start",children:[(0,t.jsx)(K.Z,{placement:"topLeft",title:"Files cannot be changed after upload",children:(0,t.jsx)(Q.default,{disabled:c,className:"mr-1",beforeUpload:()=>!1,fileList:d,name:"file",accept:".csv,.xlsx,.xls",multiple:!1,onChange:b,showUploadList:{showDownloadIcon:!1,showPreviewIcon:!1,showRemoveIcon:!1},itemRender:()=>(0,t.jsx)(t.Fragment,{}),...i,children:(0,t.jsx)(X.ZP,{className:"flex justify-center items-center dark:bg-[#4e4f56] dark:text-gray-200",disabled:c,icon:(0,t.jsx)(ee.Z,{}),children:"Select File"})})}),(0,t.jsx)(X.ZP,{type:"primary",loading:c,className:"flex justify-center items-center dark:text-white",disabled:!d.length,icon:(0,t.jsx)(el.Z,{}),onClick:j,children:c?100===h?"Analysis":"Uploading":"Upload"})]}),!!d.length&&(0,t.jsxs)("div",{className:"mt-2 text-gray-500 text-sm flex items-center",children:[(0,t.jsx)(ea.Z,{className:"mr-2"}),(0,t.jsx)("span",{children:null===(l=d[0])||void 0===l?void 0:l.name})]}),"number"==typeof h&&(0,t.jsx)(Y.Z,{className:"mb-0",percent:h,size:"small",status:x})]})},es=function(e){let{onComplete:l}=e,{currentDialogue:a,scene:n,chatId:r}=(0,s.useContext)(f.p);return"chat_excel"!==n?null:(0,t.jsx)("div",{className:"max-w-xs h-full",children:a?(0,t.jsxs)("div",{className:"h-full flex overflow-hidden rounded",children:[(0,t.jsx)("div",{className:"h-full flex items-center justify-center px-3 py-2 bg-gray-600",children:(0,t.jsx)(ea.Z,{className:"text-white"})}),(0,t.jsx)("div",{className:"h-full bg-gray-100 px-3 py-2 text-xs rounded-tr rounded-br dark:text-gray-800 truncate",children:a.select_param})]}):(0,t.jsx)(et,{convUid:r,chatMode:n,onComplete:l})})},en=a(25709),er=a(43927);function ei(){let{isContract:e,setIsContract:l,scene:a}=(0,s.useContext)(f.p),n=a&&["chat_with_db_execute","chat_dashboard"].includes(a);return n?(0,t.jsx)("div",{className:"leading-[3rem] text-right h-12 flex justify-center",children:(0,t.jsx)("div",{className:"flex items-center cursor-pointer",children:(0,t.jsxs)("div",{className:"relative w-56 h-10 mx-auto p-2 flex justify-center items-center bg-[#ece9e0] rounded-3xl model-tab dark:text-violet-600 z-10 ".concat(e?"editor-tab":""),children:[(0,t.jsxs)("div",{className:"z-10 w-[50%] text-center cursor-pointer",onClick:()=>{l(!1)},children:[(0,t.jsx)("span",{children:"Preview"}),(0,t.jsx)(er.Z,{className:"ml-1"})]}),(0,t.jsxs)("div",{className:"z-10 w-[50%] text-center cursor-pointer",onClick:()=>{l(!0)},children:[(0,t.jsx)("span",{children:"Editor"}),(0,t.jsx)(en.Z,{className:"ml-1"})]})]})})}):null}a(23293);var ec=function(e){let{refreshHistory:l,modelChange:a,selectedModel:n}=e,{refreshDialogList:r,model:i}=(0,s.useContext)(f.p);return(0,t.jsxs)("div",{className:"w-full py-4 flex items-center justify-center border-b border-gray-100 gap-5",children:[(0,t.jsx)(es,{onComplete:()=>{null==r||r(),null==l||l()}}),(0,t.jsx)(I.Z,{size:"sm",onChange:a}),(0,t.jsx)(ei,{})]})};let eo=()=>(0,t.jsxs)(n.Z,{className:"h-full w-full flex bg-transparent",children:[(0,t.jsx)(r.Z,{animation:"wave",variant:"text",level:"body2"}),(0,t.jsx)(r.Z,{animation:"wave",variant:"text",level:"body2"}),(0,t.jsx)(i.Z,{ratio:"21/9",className:"flex-1",sx:{["& .".concat(c.Z.content)]:{height:"100%"}},children:(0,t.jsx)(r.Z,{variant:"overlay",className:"h-full"})})]});var ed=()=>{(0,P.useSearchParams)();let[e,l]=(0,s.useState)(!1),[a,r]=(0,s.useState)(),{refreshDialogList:i,scene:c,chatId:x,model:p,setModel:v}=(0,s.useContext)(f.p),{data:b=[],run:j}=(0,m.Z)(async()=>{l(!0);let[,e]=await (0,$.Vx)((0,$.$i)(x));l(!1);let a=(e||[]).filter(e=>"view"===e.role).slice(-1)[0];return a.model_name&&v(a.model_name),null!=e?e:[]},{ready:!!x,refreshDeps:[x]}),{history:y,handleChatSubmit:w}=g({queryAgentURL:"/v1/chat/completions",queryBody:{conv_uid:x,chat_mode:c||"chat_normal",model_name:p},initHistory:b}),{data:N={}}=(0,m.Z)(async()=>{let[,e]=await (0,$.Vx)((0,$.vD)(c));return null!=e?e:{}},{ready:!!c,refreshDeps:[x,c]});(0,s.useEffect)(()=>{if(y&&!(y.length<1))try{var e;let l=null==y?void 0:null===(e=y[y.length-1])||void 0===e?void 0:e.context,a=JSON.parse(l);r((null==a?void 0:a.template_name)==="report"?null==a?void 0:a.charts:void 0)}catch(e){r(void 0)}},[y]);let Z=(0,s.useMemo)(()=>{if(a){let e=[],l=null==a?void 0:a.filter(e=>"IndicatorValue"===e.chart_type);l.length>0&&e.push({charts:l,type:"IndicatorValue"});let t=null==a?void 0:a.filter(e=>"IndicatorValue"!==e.chart_type),s=t.length,n=0;return[[0],[1],[2],[1,2],[1,3],[2,1,2],[2,1,3],[3,1,3],[3,2,3]][s].forEach(l=>{if(l>0){let a=t.slice(n,n+l);n+=l,e.push({charts:a})}}),e}},[a]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ec,{selectedModel:p,refreshHistory:j,modelChange:e=>{v(e)}}),(0,t.jsx)(G.Z,{visible:e}),(0,t.jsxs)("div",{className:"px-4 flex flex-1 overflow-hidden",children:[a&&(0,t.jsx)("div",{className:"w-3/4",children:(0,t.jsx)("div",{className:"flex flex-col gap-3 h-full",children:null==Z?void 0:Z.map((e,l)=>(0,t.jsx)("div",{className:"".concat((null==e?void 0:e.type)!=="IndicatorValue"?"flex gap-3":""),children:e.charts.map(e=>"IndicatorValue"===e.chart_type?(0,t.jsx)("div",{className:"flex flex-row gap-3",children:e.values.map(e=>(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)(n.Z,{sx:{background:"transparent"},children:(0,t.jsxs)(o.Z,{className:"justify-around",children:[(0,t.jsx)(d.ZP,{gutterBottom:!0,component:"div",children:e.name}),(0,t.jsx)(d.ZP,{children:e.value})]})})},e.name))},e.chart_uid):"LineChart"===e.chart_type?(0,t.jsx)(W,{chart:e},e.chart_uid):"BarChart"===e.chart_type?(0,t.jsx)(T,{chart:e},e.chart_uid):"Table"===e.chart_type?(0,t.jsx)(J,{chart:e},e.chart_uid):void 0)},"chart_row_".concat(l)))})}),!a&&"chat_dashboard"===c&&(0,t.jsx)("div",{className:"w-3/4 p-6",children:(0,t.jsx)("div",{className:"flex flex-col gap-3 h-full",children:(0,t.jsxs)(u.Z,{container:!0,spacing:2,sx:{flexGrow:1},children:[(0,t.jsx)(u.Z,{xs:8,children:(0,t.jsx)(h.Z,{className:"h-full w-full",sx:{display:"flex",gap:2},children:(0,t.jsx)(eo,{})})}),(0,t.jsx)(u.Z,{xs:4,children:(0,t.jsx)(eo,{})}),(0,t.jsx)(u.Z,{xs:4,children:(0,t.jsx)(eo,{})}),(0,t.jsx)(u.Z,{xs:8,children:(0,t.jsx)(eo,{})})]})})}),(0,t.jsx)("div",{className:"".concat("chat_dashboard"===c?"w-1/3":"w-full"," flex flex-1 flex-col h-full"),children:(0,t.jsx)(D,{clearInitMessage:async()=>{await i()},messages:y,onSubmit:w,paramsObj:N})})]})]})}},51792:function(e,l,a){"use strict";a.d(l,{A:function(){return x}});var t=a(85893),s=a(41468),n=a(14986),r=a(30322),i=a(94184),c=a.n(i),o=a(25675),d=a.n(o),u=a(67294),h=a(67421);let m={proxyllm:{label:"Proxy LLM",icon:"/models/chatgpt.png"},"flan-t5-base":{label:"flan-t5-base",icon:"/models/google.png"},"vicuna-13b":{label:"vicuna-13b",icon:"/models/vicuna.jpeg"},"vicuna-7b":{label:"vicuna-7b",icon:"/models/vicuna.jpeg"},"vicuna-13b-v1.5":{label:"vicuna-13b-v1.5",icon:"/models/vicuna.jpeg"},"vicuna-7b-v1.5":{label:"vicuna-7b-v1.5",icon:"/models/vicuna.jpeg"},"codegen2-1b":{label:"codegen2-1B",icon:"/models/vicuna.jpeg"},"codet5p-2b":{label:"codet5p-2b",icon:"/models/vicuna.jpeg"},"chatglm-6b-int4":{label:"chatglm-6b-int4",icon:"/models/chatglm.png"},"chatglm-6b":{label:"chatglm-6b",icon:"/models/chatglm.png"},"chatglm2-6b":{label:"chatglm2-6b",icon:"/models/chatglm.png"},"chatglm2-6b-int4":{label:"chatglm2-6b-int4",icon:"/models/chatglm.png"},"guanaco-33b-merged":{label:"guanaco-33b-merged",icon:"/models/huggingface.svg"},"falcon-40b":{label:"falcon-40b",icon:"/models/falcon.jpeg"},"gorilla-7b":{label:"gorilla-7b",icon:"/models/gorilla.png"},"gptj-6b":{label:"ggml-gpt4all-j-v1.3-groovy.bin",icon:""},chatgpt_proxyllm:{label:"chatgpt_proxyllm",icon:"/models/chatgpt.png"},bard_proxyllm:{label:"bard_proxyllm",icon:"/models/bard.gif"},claude_proxyllm:{label:"claude_proxyllm",icon:"/models/claude.png"},wenxin_proxyllm:{label:"wenxin_proxyllm",icon:""},tongyi_proxyllm:{label:"tongyi_proxyllm",icon:"/models/qwen2.png"},zhipu_proxyllm:{label:"zhipu_proxyllm",icon:"/models/zhipu.png"},"llama-2-7b":{label:"Llama-2-7b-chat-hf",icon:"/models/llama.jpg"},"llama-2-13b":{label:"Llama-2-13b-chat-hf",icon:"/models/llama.jpg"},"llama-2-70b":{label:"Llama-2-70b-chat-hf",icon:"/models/llama.jpg"},"baichuan-13b":{label:"Baichuan-13B-Chat",icon:"/models/baichuan.png"},"baichuan-7b":{label:"baichuan-7b",icon:"/models/baichuan.png"},"baichuan2-7b":{label:"Baichuan2-7B-Chat",icon:"/models/baichuan.png"},"baichuan2-13b":{label:"Baichuan2-13B-Chat",icon:"/models/baichuan.png"},"wizardlm-13b":{label:"WizardLM-13B-V1.2",icon:"/models/wizardlm.png"},"llama-cpp":{label:"ggml-model-q4_0.bin",icon:"/models/huggingface.svg"}};function x(e){var l;return e?(0,t.jsx)(d(),{className:"rounded-full mr-2 border border-gray-200 object-contain bg-white",width:24,height:24,src:null===(l=m[e])||void 0===l?void 0:l.icon,alt:"llm"}):null}l.Z=function(e){let{size:l,onChange:a}=e,{t:i}=(0,h.$G)(),{modelList:o,model:d}=(0,u.useContext)(s.p);return!o||o.length<=0?null:(0,t.jsx)("div",{className:c()({"w-48":"sm"===l||"md"===l||!l,"w-60":"lg"===l}),children:(0,t.jsx)(n.Z,{size:l||"sm",placeholder:i("choose_model"),value:d||"",renderValue:function(e){return e?(0,t.jsxs)(t.Fragment,{children:[x(e.value),e.label]}):null},onChange:(e,l)=>{l&&(null==a||a(l))},children:o.map(e=>{var l;return(0,t.jsxs)(r.Z,{value:e,children:[x(e),(null===(l=m[e])||void 0===l?void 0:l.label)||e]},"model_".concat(e))})})})}},99513:function(e,l,a){"use strict";a.d(l,{Z:function(){return o}});var t=a(85893),s=a(63764),n=a(94184),r=a.n(n),i=a(67294),c=a(36782);function o(e){let{className:l,value:a,language:n="mysql",onChange:o,thoughts:d}=e,u=(0,i.useMemo)(()=>"mysql"!==n?a:d&&d.length>0?(0,c.WU)("-- ".concat(d," \n").concat(a)):(0,c.WU)(a),[a,d]);return(0,t.jsx)(s.ZP,{className:r()(l),value:u,language:n,onChange:o,theme:"vs-dark",options:{minimap:{enabled:!1},wordWrap:"on"}})}},45247:function(e,l,a){"use strict";var t=a(85893),s=a(48699);l.Z=function(e){let{visible:l}=e;return l?(0,t.jsx)("div",{className:"absolute w-full h-full top-0 left-0 flex justify-center items-center z-10 bg-white dark:bg-black bg-opacity-50 dark:bg-opacity-50",children:(0,t.jsx)(s.Z,{variant:"plain"})}):null}},23293:function(){}}]); \ No newline at end of file diff --git a/pilot/server/static/_next/static/chunks/392.a6a0e6711bdba089.js b/pilot/server/static/_next/static/chunks/392.a6a0e6711bdba089.js new file mode 100644 index 000000000..31a443754 --- /dev/null +++ b/pilot/server/static/_next/static/chunks/392.a6a0e6711bdba089.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[392],{35392:function(e,l,a){"use strict";a.r(l),a.d(l,{default:function(){return ed}});var t=a(85893),s=a(67294),n=a(41118),r=a(16789),i=a(80837),c=a(79172),o=a(30208),d=a(40911),u=a(51610),h=a(48665),m=a(577),x=a(1375),p=e=>{let l=(0,s.useReducer)((e,l)=>({...e,...l}),{...e});return l},v=a(58301),f=a(41468),g=e=>{let{queryAgentURL:l,channel:a,queryBody:t,initHistory:n=[]}=e,[r,i]=p({history:n}),{refreshDialogList:c,chatId:o,model:d}=(0,s.useContext)(f.p),u=new AbortController;(0,s.useEffect)(()=>{n&&n.length&&i({history:n})},[n]);let h=async(e,s)=>{if(!e)return;let n=[...r.history,{role:"human",context:e}],h=n.length;i({history:n});let m={conv_uid:o,...s,...t,user_input:e,channel:a};if(!(null==m?void 0:m.conv_uid)){v.ZP.error("conv_uid 不存在,请刷新后重试");return}try{await (0,x.L)("".concat("http://127.0.0.1:5000").concat("/api"+l),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m),signal:u.signal,openWhenHidden:!0,async onopen(e){if(n.length<=1){var l;c();let e=new URLSearchParams(window.location.search);e.delete("initMessage"),null===(l=window.history)||void 0===l||l.replaceState(null,"","?".concat(e.toString()))}(!e.ok||e.headers.get("content-type")!==x.a)&&e.status>=400&&e.status<500&&429!==e.status&&e.status},onclose(){console.log("onclose")},onerror(e){throw console.log("onerror"),Error(e)},onmessage:e=>{var l,a,t;if(e.data=null===(l=e.data)||void 0===l?void 0:l.replaceAll("\\n","\n"),"[DONE]"===e.data);else if(null===(a=e.data)||void 0===a?void 0:a.startsWith("[ERROR]"))i({history:[...n,{role:"view",context:null===(t=e.data)||void 0===t?void 0:t.replace("[ERROR]","")}]});else{let l=[...n];e.data&&((null==l?void 0:l[h])?l[h].context="".concat(e.data):l.push({role:"view",context:e.data,model_name:d}),i({history:l}))}}})}catch(e){console.log(e),i({history:[...n,{role:"view",context:"Sorry, We meet some error, please try agin later."}]})}};return{handleChatSubmit:h,history:r.history}},b=a(24339),j=a(14986),y=a(30322),w=a(75913),N=a(14553),Z=a(48699),_=a(13245),k=a(43458),C=a(47556),S=a(87536),P=a(39332),B=a(96486),E=a.n(B),L=a(99513),O=a(2166),M=a(50228),R=a(87547),z=a(35576),F=a(56986),U=a(93179),I=a(51792);let q={overrides:{code:e=>{let{children:l,className:a}=e;return(0,t.jsx)(U.Z,{language:"javascript",style:F.Z,children:l})},img:{props:{className:"my-2 !max-h-none"}},table:{props:{className:"my-2 border-collapse border border-slate-400 dark:border-slate-500 bg-white dark:bg-slate-800 text-sm shadow-sm"}},thead:{props:{className:"bg-slate-50 dark:bg-slate-700"}},th:{props:{className:"border border-slate-300 dark:border-slate-600 font-semibold !p-2 text-slate-900 dark:text-slate-200 !text-left"}},td:{props:{className:"border border-slate-300 dark:border-slate-700 !p-2 text-slate-500 dark:text-slate-400 !text-left"}}},wrapper:s.Fragment,namedCodesToUnicode:{amp:"&",apos:"'",gt:">",lt:"<",nbsp:"\xa0",quot:"“"}};var A=function(e){let{content:l,isChartChat:a,onLinkClick:s}=e,{context:n,model_name:r,role:i}=l,c="view"===i;return(0,t.jsxs)("div",{className:"overflow-x-auto w-full lg:w-4/5 xl:w-3/4 mx-auto flex px-2 py-2 sm:px-4 sm:py-6 rounded-xl ".concat(c?"bg-slate-100 dark:bg-[#353539]":""),children:[(0,t.jsx)("div",{className:"mr-2 flex items-center justify-center h-7 w-7 rounded-full text-lg sm:mr-4",children:c?(0,I.A)(r)||(0,t.jsx)(M.Z,{}):(0,t.jsx)(R.Z,{})}),(0,t.jsxs)("div",{className:"flex-1 items-center text-md leading-7",children:[a&&"object"==typeof n&&(0,t.jsxs)(t.Fragment,{children:["[".concat(n.template_name,"]: "),(0,t.jsx)(O.Z,{sx:{color:"#1677ff"},component:"button",onClick:s,children:n.template_introduce||"More Details"})]}),"string"==typeof n&&(0,t.jsx)(z.Z,{options:q,children:n.replaceAll("\\n","\n")})]})]})},D=e=>{let{messages:l,onSubmit:a,paramsObj:n={},clearInitMessage:r}=e,i=(0,P.useSearchParams)(),c=i&&i.get("initMessage"),o=i&&i.get("spaceNameOriginal"),{currentDialogue:d,scene:u,model:h}=(0,s.useContext)(f.p),m="chat_dashboard"===u,[x,p]=(0,s.useState)(!1),[v,g]=(0,s.useState)(""),[B,O]=(0,s.useState)(!1),[M,R]=(0,s.useState)(),[z,F]=(0,s.useState)(l),[U,q]=(0,s.useState)(""),D=(0,s.useRef)(null),V=(0,s.useMemo)(()=>Object.entries(n).map(e=>{let[l,a]=e;return{key:l,value:a}}),[n]),W=(0,S.cI)(),T=async e=>{let{query:l}=e;try{p(!0),W.reset(),await a(l,{select_param:"chat_excel"===u?null==d?void 0:d.select_param:n[v]})}catch(e){}finally{p(!1)}},H=async()=>{try{var e;let l=new URLSearchParams(window.location.search),a=l.get("initMessage");l.delete("initMessage"),null===(e=window.history)||void 0===e||e.replaceState(null,"","?".concat(l.toString())),await T({query:a})}catch(e){console.log(e)}finally{null==r||r()}},J=e=>{let l=e;try{l=JSON.parse(e)}catch(e){console.log(e)}return l};return(0,s.useEffect)(()=>{D.current&&D.current.scrollTo(0,D.current.scrollHeight)},[null==l?void 0:l.length]),(0,s.useEffect)(()=>{c&&l.length<=0&&H()},[H,c,l.length]),(0,s.useEffect)(()=>{(null==V?void 0:V.length)&&g(o||V[0].value)},[V,null==V?void 0:V.length,o]),(0,s.useEffect)(()=>{if(m){let e=E().cloneDeep(l);e.forEach(e=>{(null==e?void 0:e.role)==="view"&&"string"==typeof(null==e?void 0:e.context)&&(e.context=J(null==e?void 0:e.context))}),F(e.filter(e=>["view","human"].includes(e.role)))}else F(l.filter(e=>["view","human"].includes(e.role)))},[m,l]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{ref:D,className:"flex flex-1 overflow-y-auto pb-8 w-full flex-col",children:(0,t.jsx)("div",{className:"flex items-center flex-1 flex-col text-sm leading-6 text-slate-900 dark:text-slate-300 sm:text-base sm:leading-7",children:null==z?void 0:z.map((e,l)=>(0,t.jsx)(A,{content:e,isChartChat:m,onLinkClick:()=>{O(!0),R(l),q(JSON.stringify(null==e?void 0:e.context,null,2))}},l))})}),(0,t.jsx)("div",{className:"relative after:absolute after:-top-8 after:h-8 after:w-full after:bg-gradient-to-t after:from-white after:to-transparent dark:after:from-[#212121]",children:(0,t.jsxs)("form",{className:"flex flex-wrap w-full lg:w-4/5 xl:w-3/4 mx-auto py-2 sm:pt-6 sm:pb-10",onSubmit:e=>{e.stopPropagation(),W.handleSubmit(T)(e)},children:[!!(null==V?void 0:V.length)&&(0,t.jsx)("div",{className:"flex items-center max-w-[6rem] sm:max-w-[12rem] h-12 mr-2 mb-2",children:(0,t.jsx)(j.Z,{className:"h-full w-full",value:v,onChange:(e,l)=>{g(null!=l?l:"")},children:V.map(e=>(0,t.jsx)(y.Z,{value:e.value,children:e.key},e.key))})}),(0,t.jsx)(w.ZP,{disabled:"chat_excel"===u&&!(null==d?void 0:d.select_param),className:"flex-1 h-12",variant:"outlined",startDecorator:(0,I.A)(h||""),endDecorator:(0,t.jsx)(N.ZP,{type:"submit",children:x?(0,t.jsx)(Z.Z,{}):(0,t.jsx)(b.Z,{})}),...W.register("query")})]})}),(0,t.jsx)(_.Z,{open:B,onClose:()=>{O(!1)},children:(0,t.jsxs)(k.Z,{className:"w-1/2 h-[600px] flex items-center justify-center","aria-labelledby":"variant-modal-title","aria-describedby":"variant-modal-description",children:[(0,t.jsx)(L.Z,{className:"w-full h-[500px]",language:"json",value:U}),(0,t.jsx)(C.Z,{variant:"outlined",className:"w-full mt-2",onClick:()=>O(!1),children:"OK"})]})})]})},V=a(63012);function W(e){let{key:l,chart:a}=e;return(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)(n.Z,{className:"h-full",sx:{background:"transparent"},children:(0,t.jsxs)(o.Z,{className:"h-full",children:[(0,t.jsx)(d.ZP,{gutterBottom:!0,component:"div",children:a.chart_name}),(0,t.jsx)(d.ZP,{gutterBottom:!0,level:"body3",children:a.chart_desc}),(0,t.jsx)("div",{className:"h-[300px]",children:(0,t.jsx)(V.Chart,{autoFit:!0,data:a.values,children:(0,t.jsx)(V.LineAdvance,{shape:"smooth",point:!0,area:!0,position:"name*value",color:"type"})})})]})})},l)}function T(e){let{key:l,chart:a}=e;return(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)(n.Z,{className:"h-full",sx:{background:"transparent"},children:(0,t.jsxs)(o.Z,{className:"h-full",children:[(0,t.jsx)(d.ZP,{gutterBottom:!0,component:"div",children:a.chart_name}),(0,t.jsx)(d.ZP,{gutterBottom:!0,level:"body3",children:a.chart_desc}),(0,t.jsx)("div",{className:"h-[300px]",children:(0,t.jsxs)(V.Chart,{autoFit:!0,data:a.values,children:[(0,t.jsx)(V.Interval,{position:"name*value",style:{lineWidth:3,stroke:(0,V.getTheme)().colors10[0]}}),(0,t.jsx)(V.Tooltip,{shared:!0})]})})]})})},l)}var H=a(61685);function J(e){var l,a;let{key:s,chart:r}=e,i=(0,B.groupBy)(r.values,"type");return(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)(n.Z,{className:"h-full overflow-auto",sx:{background:"transparent"},children:(0,t.jsxs)(o.Z,{className:"h-full",children:[(0,t.jsx)(d.ZP,{gutterBottom:!0,component:"div",children:r.chart_name}),"\xb7",(0,t.jsx)(d.ZP,{gutterBottom:!0,level:"body3",children:r.chart_desc}),(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsxs)(H.Z,{"aria-label":"basic table",stripe:"odd",hoverRow:!0,borderAxis:"bothBetween",children:[(0,t.jsx)("thead",{children:(0,t.jsx)("tr",{children:Object.keys(i).map(e=>(0,t.jsx)("th",{children:e},e))})}),(0,t.jsx)("tbody",{children:null===(l=Object.values(i))||void 0===l?void 0:null===(a=l[0])||void 0===a?void 0:a.map((e,l)=>{var a;return(0,t.jsx)("tr",{children:null===(a=Object.keys(i))||void 0===a?void 0:a.map(e=>{var a;return(0,t.jsx)("td",{children:(null==i?void 0:null===(a=i[e])||void 0===a?void 0:a[l].value)||""},e)})},l)})})]})})]})})},s)}var $=a(43893),G=a(45247),K=a(94139),Q=a(65170),X=a(71577),Y=a(69814),ee=a(49591),el=a(88484),ea=a(29158),et=function(e){var l;let{convUid:a,chatMode:n,onComplete:r,...i}=e,[c,o]=(0,s.useState)(!1),[d,u]=(0,s.useState)([]),[h,m]=(0,s.useState)(),[x,p]=(0,s.useState)(),{model:g}=(0,s.useContext)(f.p),b=async e=>{var l;if(!e){v.ZP.error("Please select the *.(csv|xlsx|xls) file");return}if(!/\.(csv|xlsx|xls)$/.test(null!==(l=e.file.name)&&void 0!==l?l:"")){v.ZP.error("File type must be csv, xlsx or xls");return}u([e.file])},j=async()=>{o(!0),p("normal");try{let e=new FormData;e.append("doc_file",d[0]);let[l]=await (0,$.Vx)((0,$.qn)({convUid:a,chatMode:n,data:e,model:g,config:{timeout:36e5,onUploadProgress:e=>{let l=Math.ceil(e.loaded/(e.total||0)*100);m(l)}}}));if(l)return;v.ZP.success("success"),p("success"),null==r||r()}catch(e){p("exception"),v.ZP.error((null==e?void 0:e.message)||"Upload Error")}finally{o(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"h-full flex items-start",children:[(0,t.jsx)(K.Z,{placement:"topLeft",title:"Files cannot be changed after upload",children:(0,t.jsx)(Q.default,{disabled:c,className:"mr-1",beforeUpload:()=>!1,fileList:d,name:"file",accept:".csv,.xlsx,.xls",multiple:!1,onChange:b,showUploadList:{showDownloadIcon:!1,showPreviewIcon:!1,showRemoveIcon:!1},itemRender:()=>(0,t.jsx)(t.Fragment,{}),...i,children:(0,t.jsx)(X.ZP,{className:"flex justify-center items-center dark:bg-[#4e4f56] dark:text-gray-200",disabled:c,icon:(0,t.jsx)(ee.Z,{}),children:"Select File"})})}),(0,t.jsx)(X.ZP,{type:"primary",loading:c,className:"flex justify-center items-center dark:text-white",disabled:!d.length,icon:(0,t.jsx)(el.Z,{}),onClick:j,children:c?100===h?"Analysis":"Uploading":"Upload"})]}),!!d.length&&(0,t.jsxs)("div",{className:"mt-2 text-gray-500 text-sm flex items-center",children:[(0,t.jsx)(ea.Z,{className:"mr-2"}),(0,t.jsx)("span",{children:null===(l=d[0])||void 0===l?void 0:l.name})]}),"number"==typeof h&&(0,t.jsx)(Y.Z,{className:"mb-0",percent:h,size:"small",status:x})]})},es=function(e){let{onComplete:l}=e,{currentDialogue:a,scene:n,chatId:r}=(0,s.useContext)(f.p);return"chat_excel"!==n?null:(0,t.jsx)("div",{className:"max-w-xs h-full",children:a?(0,t.jsxs)("div",{className:"h-full flex overflow-hidden rounded",children:[(0,t.jsx)("div",{className:"h-full flex items-center justify-center px-3 py-2 bg-gray-600",children:(0,t.jsx)(ea.Z,{className:"text-white"})}),(0,t.jsx)("div",{className:"h-full bg-gray-100 px-3 py-2 text-xs rounded-tr rounded-br dark:text-gray-800 truncate",children:a.select_param})]}):(0,t.jsx)(et,{convUid:r,chatMode:n,onComplete:l})})},en=a(25709),er=a(43927);function ei(){let{isContract:e,setIsContract:l,scene:a}=(0,s.useContext)(f.p),n=a&&["chat_with_db_execute","chat_dashboard"].includes(a);return n?(0,t.jsx)("div",{className:"leading-[3rem] text-right h-12 flex justify-center",children:(0,t.jsx)("div",{className:"flex items-center cursor-pointer",children:(0,t.jsxs)("div",{className:"relative w-56 h-10 mx-auto p-2 flex justify-center items-center bg-[#ece9e0] rounded-3xl model-tab dark:text-violet-600 z-10 ".concat(e?"editor-tab":""),children:[(0,t.jsxs)("div",{className:"z-10 w-[50%] text-center cursor-pointer",onClick:()=>{l(!1)},children:[(0,t.jsx)("span",{children:"Preview"}),(0,t.jsx)(er.Z,{className:"ml-1"})]}),(0,t.jsxs)("div",{className:"z-10 w-[50%] text-center cursor-pointer",onClick:()=>{l(!0)},children:[(0,t.jsx)("span",{children:"Editor"}),(0,t.jsx)(en.Z,{className:"ml-1"})]})]})})}):null}a(23293);var ec=function(e){let{refreshHistory:l,modelChange:a,selectedModel:n}=e,{refreshDialogList:r,model:i}=(0,s.useContext)(f.p);return(0,t.jsxs)("div",{className:"w-full py-4 flex items-center justify-center border-b border-gray-100 gap-5",children:[(0,t.jsx)(es,{onComplete:()=>{null==r||r(),null==l||l()}}),(0,t.jsx)(I.Z,{size:"sm",onChange:a}),(0,t.jsx)(ei,{})]})};let eo=()=>(0,t.jsxs)(n.Z,{className:"h-full w-full flex bg-transparent",children:[(0,t.jsx)(r.Z,{animation:"wave",variant:"text",level:"body2"}),(0,t.jsx)(r.Z,{animation:"wave",variant:"text",level:"body2"}),(0,t.jsx)(i.Z,{ratio:"21/9",className:"flex-1",sx:{["& .".concat(c.Z.content)]:{height:"100%"}},children:(0,t.jsx)(r.Z,{variant:"overlay",className:"h-full"})})]});var ed=()=>{(0,P.useSearchParams)();let[e,l]=(0,s.useState)(!1),[a,r]=(0,s.useState)(),{refreshDialogList:i,scene:c,chatId:x,model:p,setModel:v}=(0,s.useContext)(f.p),{data:b=[],run:j}=(0,m.Z)(async()=>{l(!0);let[,e]=await (0,$.Vx)((0,$.$i)(x));l(!1);let a=(e||[]).filter(e=>"view"===e.role).slice(-1)[0];return a.model_name&&v(a.model_name),null!=e?e:[]},{ready:!!x,refreshDeps:[x]}),{history:y,handleChatSubmit:w}=g({queryAgentURL:"/v1/chat/completions",queryBody:{conv_uid:x,chat_mode:c||"chat_normal",model_name:p},initHistory:b}),{data:N={}}=(0,m.Z)(async()=>{let[,e]=await (0,$.Vx)((0,$.vD)(c));return null!=e?e:{}},{ready:!!c,refreshDeps:[x,c]});(0,s.useEffect)(()=>{if(y&&!(y.length<1))try{var e;let l=null==y?void 0:null===(e=y[y.length-1])||void 0===e?void 0:e.context,a=JSON.parse(l);r((null==a?void 0:a.template_name)==="report"?null==a?void 0:a.charts:void 0)}catch(e){r(void 0)}},[y]);let Z=(0,s.useMemo)(()=>{if(a){let e=[],l=null==a?void 0:a.filter(e=>"IndicatorValue"===e.chart_type);l.length>0&&e.push({charts:l,type:"IndicatorValue"});let t=null==a?void 0:a.filter(e=>"IndicatorValue"!==e.chart_type),s=t.length,n=0;return[[0],[1],[2],[1,2],[1,3],[2,1,2],[2,1,3],[3,1,3],[3,2,3]][s].forEach(l=>{if(l>0){let a=t.slice(n,n+l);n+=l,e.push({charts:a})}}),e}},[a]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ec,{selectedModel:p,refreshHistory:j,modelChange:e=>{v(e)}}),(0,t.jsx)(G.Z,{visible:e}),(0,t.jsxs)("div",{className:"px-4 flex flex-1 overflow-hidden",children:[a&&(0,t.jsx)("div",{className:"w-3/4",children:(0,t.jsx)("div",{className:"flex flex-col gap-3 h-full",children:null==Z?void 0:Z.map((e,l)=>(0,t.jsx)("div",{className:"".concat((null==e?void 0:e.type)!=="IndicatorValue"?"flex gap-3":""),children:e.charts.map(e=>"IndicatorValue"===e.chart_type?(0,t.jsx)("div",{className:"flex flex-row gap-3",children:e.values.map(e=>(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)(n.Z,{sx:{background:"transparent"},children:(0,t.jsxs)(o.Z,{className:"justify-around",children:[(0,t.jsx)(d.ZP,{gutterBottom:!0,component:"div",children:e.name}),(0,t.jsx)(d.ZP,{children:e.value})]})})},e.name))},e.chart_uid):"LineChart"===e.chart_type?(0,t.jsx)(W,{chart:e},e.chart_uid):"BarChart"===e.chart_type?(0,t.jsx)(T,{chart:e},e.chart_uid):"Table"===e.chart_type?(0,t.jsx)(J,{chart:e},e.chart_uid):void 0)},"chart_row_".concat(l)))})}),!a&&"chat_dashboard"===c&&(0,t.jsx)("div",{className:"w-3/4 p-6",children:(0,t.jsx)("div",{className:"flex flex-col gap-3 h-full",children:(0,t.jsxs)(u.Z,{container:!0,spacing:2,sx:{flexGrow:1},children:[(0,t.jsx)(u.Z,{xs:8,children:(0,t.jsx)(h.Z,{className:"h-full w-full",sx:{display:"flex",gap:2},children:(0,t.jsx)(eo,{})})}),(0,t.jsx)(u.Z,{xs:4,children:(0,t.jsx)(eo,{})}),(0,t.jsx)(u.Z,{xs:4,children:(0,t.jsx)(eo,{})}),(0,t.jsx)(u.Z,{xs:8,children:(0,t.jsx)(eo,{})})]})})}),(0,t.jsx)("div",{className:"".concat("chat_dashboard"===c?"w-1/3":"w-full"," flex flex-1 flex-col h-full"),children:(0,t.jsx)(D,{clearInitMessage:async()=>{await i()},messages:y,onSubmit:w,paramsObj:N})})]})]})}},51792:function(e,l,a){"use strict";a.d(l,{A:function(){return x}});var t=a(85893),s=a(41468),n=a(14986),r=a(30322),i=a(94184),c=a.n(i),o=a(25675),d=a.n(o),u=a(67294),h=a(67421);let m={proxyllm:{label:"Proxy LLM",icon:"/models/chatgpt.png"},"flan-t5-base":{label:"flan-t5-base",icon:"/models/google.png"},"vicuna-13b":{label:"vicuna-13b",icon:"/models/vicuna.jpeg"},"vicuna-7b":{label:"vicuna-7b",icon:"/models/vicuna.jpeg"},"vicuna-13b-v1.5":{label:"vicuna-13b-v1.5",icon:"/models/vicuna.jpeg"},"vicuna-7b-v1.5":{label:"vicuna-7b-v1.5",icon:"/models/vicuna.jpeg"},"codegen2-1b":{label:"codegen2-1B",icon:"/models/vicuna.jpeg"},"codet5p-2b":{label:"codet5p-2b",icon:"/models/vicuna.jpeg"},"chatglm-6b-int4":{label:"chatglm-6b-int4",icon:"/models/chatglm.png"},"chatglm-6b":{label:"chatglm-6b",icon:"/models/chatglm.png"},"chatglm2-6b":{label:"chatglm2-6b",icon:"/models/chatglm.png"},"chatglm2-6b-int4":{label:"chatglm2-6b-int4",icon:"/models/chatglm.png"},"guanaco-33b-merged":{label:"guanaco-33b-merged",icon:"/models/huggingface.svg"},"falcon-40b":{label:"falcon-40b",icon:"/models/falcon.jpeg"},"gorilla-7b":{label:"gorilla-7b",icon:"/models/gorilla.png"},"gptj-6b":{label:"ggml-gpt4all-j-v1.3-groovy.bin",icon:""},chatgpt_proxyllm:{label:"chatgpt_proxyllm",icon:"/models/chatgpt.png"},bard_proxyllm:{label:"bard_proxyllm",icon:"/models/bard.gif"},claude_proxyllm:{label:"claude_proxyllm",icon:"/models/claude.png"},wenxin_proxyllm:{label:"wenxin_proxyllm",icon:""},tongyi_proxyllm:{label:"tongyi_proxyllm",icon:"/models/qwen2.png"},zhipu_proxyllm:{label:"zhipu_proxyllm",icon:"/models/zhipu.png"},"llama-2-7b":{label:"Llama-2-7b-chat-hf",icon:"/models/llama.jpg"},"llama-2-13b":{label:"Llama-2-13b-chat-hf",icon:"/models/llama.jpg"},"llama-2-70b":{label:"Llama-2-70b-chat-hf",icon:"/models/llama.jpg"},"baichuan-13b":{label:"Baichuan-13B-Chat",icon:"/models/baichuan.png"},"baichuan-7b":{label:"baichuan-7b",icon:"/models/baichuan.png"},"baichuan2-7b":{label:"Baichuan2-7B-Chat",icon:"/models/baichuan.png"},"baichuan2-13b":{label:"Baichuan2-13B-Chat",icon:"/models/baichuan.png"},"wizardlm-13b":{label:"WizardLM-13B-V1.2",icon:"/models/wizardlm.png"},"llama-cpp":{label:"ggml-model-q4_0.bin",icon:"/models/huggingface.svg"}};function x(e){var l;return e?(0,t.jsx)(d(),{className:"rounded-full mr-2 border border-gray-200 object-contain bg-white",width:24,height:24,src:null===(l=m[e])||void 0===l?void 0:l.icon,alt:"llm"}):null}l.Z=function(e){let{size:l,onChange:a}=e,{t:i}=(0,h.$G)(),{modelList:o,model:d}=(0,u.useContext)(s.p);return!o||o.length<=0?null:(0,t.jsx)("div",{className:c()({"w-48":"sm"===l||"md"===l||!l,"w-60":"lg"===l}),children:(0,t.jsx)(n.Z,{size:l||"sm",placeholder:i("choose_model"),value:d||"",renderValue:function(e){return e?(0,t.jsxs)(t.Fragment,{children:[x(e.value),e.label]}):null},onChange:(e,l)=>{l&&(null==a||a(l))},children:o.map(e=>{var l;return(0,t.jsxs)(r.Z,{value:e,children:[x(e),(null===(l=m[e])||void 0===l?void 0:l.label)||e]},"model_".concat(e))})})})}},99513:function(e,l,a){"use strict";a.d(l,{Z:function(){return o}});var t=a(85893),s=a(63764),n=a(94184),r=a.n(n),i=a(67294),c=a(36782);function o(e){let{className:l,value:a,language:n="mysql",onChange:o,thoughts:d}=e,u=(0,i.useMemo)(()=>"mysql"!==n?a:d&&d.length>0?(0,c.WU)("-- ".concat(d," \n").concat(a)):(0,c.WU)(a),[a,d]);return(0,t.jsx)(s.ZP,{className:r()(l),value:u,language:n,onChange:o,theme:"vs-dark",options:{minimap:{enabled:!1},wordWrap:"on"}})}},45247:function(e,l,a){"use strict";var t=a(85893),s=a(48699);l.Z=function(e){let{visible:l}=e;return l?(0,t.jsx)("div",{className:"absolute w-full h-full top-0 left-0 flex justify-center items-center z-10 bg-white dark:bg-black bg-opacity-50 dark:bg-opacity-50",children:(0,t.jsx)(s.Z,{variant:"plain"})}):null}},23293:function(){}}]); \ No newline at end of file diff --git a/pilot/server/static/_next/static/chunks/455-46cbd68d6b40309e.js b/pilot/server/static/_next/static/chunks/455-597a8a48388a0d9b.js similarity index 100% rename from pilot/server/static/_next/static/chunks/455-46cbd68d6b40309e.js rename to pilot/server/static/_next/static/chunks/455-597a8a48388a0d9b.js diff --git a/pilot/server/static/_next/static/chunks/566-1647c29b610cc91f.js b/pilot/server/static/_next/static/chunks/566-493c6126d6ac9745.js similarity index 100% rename from pilot/server/static/_next/static/chunks/566-1647c29b610cc91f.js rename to pilot/server/static/_next/static/chunks/566-493c6126d6ac9745.js diff --git a/pilot/server/static/_next/static/chunks/902-621cc1dcac80f833.js b/pilot/server/static/_next/static/chunks/902-4b12ce531524546f.js similarity index 100% rename from pilot/server/static/_next/static/chunks/902-621cc1dcac80f833.js rename to pilot/server/static/_next/static/chunks/902-4b12ce531524546f.js diff --git a/pilot/server/static/_next/static/chunks/908-8f37a17e21943efa.js b/pilot/server/static/_next/static/chunks/908-33709e71961cb7a1.js similarity index 100% rename from pilot/server/static/_next/static/chunks/908-8f37a17e21943efa.js rename to pilot/server/static/_next/static/chunks/908-33709e71961cb7a1.js diff --git a/pilot/server/static/_next/static/chunks/pages/_app-1e5f0f7aa41ccfc1.js b/pilot/server/static/_next/static/chunks/pages/_app-9e94401ffc6cbdb6.js similarity index 100% rename from pilot/server/static/_next/static/chunks/pages/_app-1e5f0f7aa41ccfc1.js rename to pilot/server/static/_next/static/chunks/pages/_app-9e94401ffc6cbdb6.js diff --git a/pilot/server/static/_next/static/chunks/pages/datastores/documents-6dd307574a33f39c.js b/pilot/server/static/_next/static/chunks/pages/datastores/documents-6dd307574a33f39c.js new file mode 100644 index 000000000..456de846b --- /dev/null +++ b/pilot/server/static/_next/static/chunks/pages/datastores/documents-6dd307574a33f39c.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[413],{18050:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/datastores/documents",function(){return n(48120)}])},48120:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return H}});var s=n(85893),a=n(39332),i=n(67294),r=n(74312),o=n(3414),l=n(56385),c=n(70702),d=n(84229),x=n(2166),u=n(40911),g=n(47556),h=n(61685),m=n(77738),p=n(13245),j=n(48665),Z=n(75913),_=n(13009),f=n(74435),v=n(30381),w=n.n(v),y=n(64082),P=n(18967),b=n(53707),k=n(46907),C=n(7078),S=n(65170),R=n(74627),z=n(58301),B=n(60122),L=n(30119),T=n(577),D=n(32141),N=n(21400),F=n(4387),E=n(39217),I=n(65908),U=n(25675),O=n.n(U),A=n(67421),V=e=>{var t,n,a,r,l,d,x,u,h,m,f,v,w,y,P,b,k,C;let{spaceName:S}=e,[B,U]=(0,i.useState)(!1),[V,M]=(0,i.useState)({}),{t:W}=(0,A.$G)(),{data:H}=(0,T.Z)(()=>(0,L.PR)("/knowledge/".concat(S,"/arguments")),{onSuccess(e){M(e.data)}}),G=[{key:"Embedding",label:(0,s.jsxs)(j.Z,{children:[(0,s.jsx)(F.Z,{sx:{marginRight:"5px"}}),W("Embedding")]}),children:(0,s.jsxs)(j.Z,{children:[(0,s.jsxs)(c.Z,{direction:"row",justifyContent:"space-between",sx:{marginTop:"20px",marginBottom:"20px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",flex:"1 1 0",marginRight:"30px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("topk"),(0,s.jsx)(R.Z,{content:W("the_top_k_vectors"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:(null==H?void 0:null===(t=H.data)||void 0===t?void 0:null===(n=t.embedding)||void 0===n?void 0:n.topk)||"",onChange:e=>{V.embedding.topk=e.target.value,M({...V})}})})]}),(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",flex:"1 1 0"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("recall_score"),(0,s.jsx)(R.Z,{content:W("Set_a_threshold_score"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:""+(null==H?void 0:null===(a=H.data)||void 0===a?void 0:null===(r=a.embedding)||void 0===r?void 0:r.recall_score)||"",onChange:e=>{V.embedding.recall_score=e.target.value,M({...V})},disabled:!0})})]})]}),(0,s.jsxs)(c.Z,{direction:"row",justifyContent:"space-between",sx:{marginTop:"20px",marginBottom:"20px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",flex:"1 1 0",marginRight:"30px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("recall_type"),(0,s.jsx)(R.Z,{content:W("Recall_Type"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:(null==H?void 0:null===(l=H.data)||void 0===l?void 0:null===(d=l.embedding)||void 0===d?void 0:d.recall_type)||"",onChange:e=>{V.embedding.recall_type=e.target.value,M({...V})},disabled:!0})})]}),(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",flex:"1 1 0"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("model"),(0,s.jsx)(R.Z,{content:W("A_model_used"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:(null==H?void 0:null===(x=H.data)||void 0===x?void 0:null===(u=x.embedding)||void 0===u?void 0:u.model)||"",onChange:e=>{V.embedding.model=e.target.value,M({...V})},disabled:!0,startDecorator:(0,s.jsx)(O(),{src:"/huggingface_logo.svg",alt:"huggingface logo",width:20,height:20})})})]})]}),(0,s.jsxs)(c.Z,{direction:"row",justifyContent:"space-between",sx:{marginTop:"20px",marginBottom:"20px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",flex:"1 1 0",marginRight:"30px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("chunk_size"),(0,s.jsx)(R.Z,{content:W("The_size_of_the_data_chunks"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:(null==H?void 0:null===(h=H.data)||void 0===h?void 0:null===(m=h.embedding)||void 0===m?void 0:m.chunk_size)||"",onChange:e=>{V.embedding.chunk_size=e.target.value,M({...V})}})})]}),(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",flex:"1 1 0"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("chunk_overlap"),(0,s.jsx)(R.Z,{content:W("The_amount_of_overlap"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:(null==H?void 0:null===(f=H.data)||void 0===f?void 0:null===(v=f.embedding)||void 0===v?void 0:v.chunk_overlap)||"",onChange:e=>{V.embedding.chunk_overlap=e.target.value,M({...V})}})})]})]})]})},{key:"Prompt",label:(0,s.jsxs)(j.Z,{children:[(0,s.jsx)(E.Z,{sx:{marginRight:"5px"}}),W("Prompt")]}),children:(0,s.jsxs)(j.Z,{sx:{maxHeight:"600px",overflow:"auto","&::-webkit-scrollbar":{display:"none"}},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",marginTop:"20px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("scene"),(0,s.jsx)(R.Z,{content:W("A_contextual_parameter"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(_.Z,{defaultValue:(null==H?void 0:null===(w=H.data)||void 0===w?void 0:null===(y=w.prompt)||void 0===y?void 0:y.scene)||"",onChange:e=>{V.prompt.scene=e.target.value,M({...V})}})})]}),(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("template"),(0,s.jsx)(R.Z,{content:W("structure_or_format"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(_.Z,{defaultValue:(null==H?void 0:null===(P=H.data)||void 0===P?void 0:null===(b=P.prompt)||void 0===b?void 0:b.template)||"",onChange:e=>{V.prompt.template=e.target.value,M({...V})}})})]}),(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("max_token"),(0,s.jsx)(R.Z,{content:W("The_maximum_number_of_tokens"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:(null==H?void 0:null===(k=H.data)||void 0===k?void 0:null===(C=k.prompt)||void 0===C?void 0:C.max_token)||"",onChange:e=>{V.prompt.max_token=e.target.value,M({...V})}})})]})]})}];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(g.Z,{variant:"outlined",onClick:()=>U(!0),children:[(0,s.jsx)(N.Z,{sx:{marginRight:"6px",fontSize:"18px"}}),W("Arguments")]}),(0,s.jsx)(p.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center","z-index":1e3},open:B,onClose:()=>U(!1),children:(0,s.jsxs)(o.Z,{variant:"outlined",sx:{width:800,borderRadius:"md",p:3,boxShadow:"lg"},children:[(0,s.jsx)(I.Z,{defaultActiveKey:"Embedding",items:G}),(0,s.jsx)(c.Z,{direction:"row",justifyContent:"flex-start",sx:{marginTop:"20px",marginBottom:"20px"},children:(0,s.jsx)(g.Z,{variant:"outlined",onClick:()=>{(0,L.PR)("/knowledge/".concat(S,"/argument/save"),{argument:JSON.stringify(V)}).then(e=>{e.success?(window.location.reload(),z.ZP.success("success")):z.ZP.error(e.err_msg||"failed")})},children:W("Submit")})})]})})]})};let{Dragger:M}=S.default,W=(0,r.Z)(o.Z)(e=>{let{theme:t}=e;return{width:"50%",backgroundColor:"dark"===t.palette.mode?t.palette.background.level1:"#fff",...t.typography.body2,padding:t.spacing(1),textAlign:"center",borderRadius:4,color:t.vars.palette.text.secondary}});var H=()=>{let e=(0,a.useRouter)(),t=(0,a.useSearchParams)(),n=t&&t.get("name"),{mode:r}=(0,l.tv)(),[v,S]=(0,i.useState)(!1),[T,D]=(0,i.useState)(0),[N,F]=(0,i.useState)(""),[E,I]=(0,i.useState)([]),[U,O]=(0,i.useState)(""),[H,G]=(0,i.useState)(""),[Y,K]=(0,i.useState)(""),[X,$]=(0,i.useState)(""),[J,q]=(0,i.useState)(null),[Q,ee]=(0,i.useState)(0),[et,en]=(0,i.useState)(0),[es,ea]=(0,i.useState)(!0),{t:ei}=(0,A.$G)(),er=[ei("Choose_a_Datasource_type"),ei("Setup_the_Datasource")],eo=[{type:"text",title:ei("Text"),subTitle:ei("Fill your raw text")},{type:"webPage",title:ei("URL"),subTitle:ei("Fetch_the_content_of_a_URL")},{type:"file",title:ei("Document"),subTitle:ei("Upload_a_document")}];return(0,i.useEffect)(()=>{async function e(){let e=await (0,L.PR)("/knowledge/".concat(n,"/document/list"),{page:1,page_size:20});e.success&&(I(e.data.data),ee(e.data.total),en(e.data.page))}n&&e()},[n]),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsxs)(c.Z,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{marginBottom:"20px"},children:[(0,s.jsxs)(d.Z,{"aria-label":"breadcrumbs",children:[(0,s.jsx)(x.Z,{onClick:()=>{e.push("/datastores")},underline:"hover",color:"neutral",fontSize:"inherit",children:ei("Knowledge_Space")},"Knowledge Space"),(0,s.jsx)(u.ZP,{fontSize:"inherit",children:ei("Documents")})]}),(0,s.jsxs)(c.Z,{direction:"row",alignItems:"center",children:[(0,s.jsxs)(g.Z,{variant:"outlined",onClick:async()=>{var t,s;let a=await (0,L.PR)("/api/v1/chat/dialogue/new",{chat_mode:"chat_knowledge"});(null==a?void 0:a.success)&&(null==a?void 0:null===(t=a.data)||void 0===t?void 0:t.conv_uid)&&e.push("/chat?id=".concat(null==a?void 0:null===(s=a.data)||void 0===s?void 0:s.conv_uid,"&scene=chat_knowledge&spaceNameOriginal=").concat(n))},sx:{marginRight:"20px",backgroundColor:"rgb(39, 155, 255) !important",color:"white",border:"none"},children:[(0,s.jsx)(C.Z,{sx:{marginRight:"6px",fontSize:"18px"}}),ei("Chat")]}),(0,s.jsxs)(g.Z,{variant:"outlined",onClick:()=>S(!0),sx:{marginRight:"20px"},children:["+ ",ei("Add_Datasource")]}),n&&(0,s.jsx)(V,{spaceName:n})]})]}),E.length?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(h.Z,{color:"primary",variant:"plain",size:"sm",sx:{"& tbody tr: hover":{backgroundColor:"light"===r?"rgb(246, 246, 246)":"rgb(33, 33, 40)"},"& tbody tr: hover a":{textDecoration:"underline"},"& tr > *:last-child":{textAlign:"right"}},children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:ei("Name")}),(0,s.jsx)("th",{children:ei("Type")}),(0,s.jsx)("th",{children:ei("Size")}),(0,s.jsx)("th",{children:ei("Last_Synch")}),(0,s.jsx)("th",{children:ei("Status")}),(0,s.jsx)("th",{children:ei("Result")}),(0,s.jsx)("th",{style:{width:"30%"},children:ei("Operation")})]})}),(0,s.jsx)("tbody",{children:E.map(t=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:t.doc_name}),(0,s.jsx)("td",{children:(0,s.jsx)(m.Z,{size:"sm",variant:"solid",color:"neutral",sx:{opacity:.5},children:t.doc_type})}),(0,s.jsxs)("td",{children:[t.chunk_size," chunks"]}),(0,s.jsx)("td",{children:w()(t.last_sync).format("YYYY-MM-DD HH:MM:SS")}),(0,s.jsx)("td",{children:(0,s.jsx)(m.Z,{size:"sm",sx:{opacity:.5},variant:"solid",color:function(){switch(t.status){case"TODO":return"neutral";case"RUNNING":return"primary";case"FINISHED":return"success";case"FAILED":return"danger"}}(),children:t.status})}),(0,s.jsx)("td",{children:"TODO"===t.status||"RUNNING"===t.status?"":"FINISHED"===t.status?(0,s.jsx)(R.Z,{content:t.result,trigger:"hover",children:(0,s.jsx)(m.Z,{size:"sm",variant:"solid",color:"success",sx:{opacity:.5},children:"SUCCESS"})}):(0,s.jsx)(R.Z,{content:t.result,trigger:"hover",children:(0,s.jsx)(m.Z,{size:"sm",variant:"solid",color:"danger",sx:{opacity:.5},children:"FAILED"})})}),(0,s.jsx)("td",{children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(g.Z,{variant:"outlined",size:"sm",sx:{marginRight:"2px"},onClick:async()=>{let e=await (0,L.PR)("/knowledge/".concat(n,"/document/sync"),{doc_ids:[t.id]});e.success?z.ZP.success("success"):z.ZP.error(e.err_msg||"failed")},children:[ei("Synch"),(0,s.jsx)(b.Z,{})]}),(0,s.jsx)(g.Z,{variant:"outlined",size:"sm",sx:{marginRight:"2px"},onClick:()=>{e.push("/datastores/documents/chunklist?spacename=".concat(n,"&documentid=").concat(t.id))},children:ei("Details")}),(0,s.jsxs)(g.Z,{variant:"outlined",size:"sm",color:"danger",onClick:async()=>{let e=await (0,L.PR)("/knowledge/".concat(n,"/document/delete"),{doc_name:t.doc_name});if(e.success){z.ZP.success("success");let e=await (0,L.PR)("/knowledge/".concat(n,"/document/list"),{page:et,page_size:20});e.success&&(I(e.data.data),ee(e.data.total),en(e.data.page))}else z.ZP.error(e.err_msg||"failed")},children:[ei("Delete"),(0,s.jsx)(k.Z,{})]})]})})]},t.id))})]}),(0,s.jsx)(c.Z,{direction:"row",justifyContent:"flex-end",sx:{marginTop:"20px"},children:(0,s.jsx)(B.Z,{defaultPageSize:20,showSizeChanger:!1,current:et,total:Q,onChange:async e=>{let t=await (0,L.PR)("/knowledge/".concat(n,"/document/list"),{page:e,page_size:20});t.success&&(I(t.data.data),ee(t.data.total),en(t.data.page))},hideOnSinglePage:!0})})]}):(0,s.jsx)(s.Fragment,{}),(0,s.jsx)(p.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center","z-index":1e3},open:v,onClose:()=>S(!1),children:(0,s.jsxs)(o.Z,{variant:"outlined",sx:{width:800,borderRadius:"md",p:3,boxShadow:"lg"},children:[(0,s.jsx)(j.Z,{sx:{width:"100%"},children:(0,s.jsx)(c.Z,{spacing:2,direction:"row",children:er.map((e,t)=>(0,s.jsxs)(W,{sx:{fontWeight:T===t?"bold":"",color:T===t?"#2AA3FF":""},children:[t(0,s.jsxs)(o.Z,{sx:{boxSizing:"border-box",height:"80px",padding:"12px",display:"flex",flexDirection:"column",justifyContent:"space-between",border:"1px solid gray",borderRadius:"6px",marginBottom:"20px",cursor:"pointer"},onClick:()=>{F(e.type),D(1)},children:[(0,s.jsx)(o.Z,{sx:{fontSize:"20px",fontWeight:"bold"},children:e.title}),(0,s.jsx)(o.Z,{children:e.subTitle})]},e.type))})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(j.Z,{sx:{margin:"30px auto"},children:[ei("Name"),":",(0,s.jsx)(Z.ZP,{placeholder:ei("Please_input_the_name"),onChange:e=>G(e.target.value),sx:{marginBottom:"20px"}}),"webPage"===N?(0,s.jsxs)(s.Fragment,{children:[ei("Web_Page_URL"),":",(0,s.jsx)(Z.ZP,{placeholder:ei("Please_input_the_Web_Page_URL"),onChange:e=>O(e.target.value)})]}):"file"===N?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(M,{name:"file",multiple:!1,beforeUpload:()=>!1,onChange(e){if(0===e.fileList.length){q(null),G("");return}q(e.file),G(e.file.name)},children:[(0,s.jsx)("p",{className:"ant-upload-drag-icon",children:(0,s.jsx)(y.Z,{})}),(0,s.jsx)("p",{style:{color:"rgb(22, 108, 255)",fontSize:"20px"},children:ei("Select_or_Drop_file")}),(0,s.jsx)("p",{className:"ant-upload-hint",style:{color:"rgb(22, 108, 255)"},children:"PDF, PowerPoint, Excel, Word, Text, Markdown,"})]})}):(0,s.jsxs)(s.Fragment,{children:[ei("Text_Source"),":",(0,s.jsx)(Z.ZP,{placeholder:ei("Please_input_the_text_source"),onChange:e=>K(e.target.value),sx:{marginBottom:"20px"}}),ei("Text"),":",(0,s.jsx)(_.Z,{onChange:e=>$(e.target.value),minRows:4,maxRows:4,sx:{marginBottom:"20px"}})]}),(0,s.jsxs)(u.ZP,{component:"label",sx:{marginTop:"20px"},endDecorator:(0,s.jsx)(f.Z,{checked:es,onChange:e=>ea(e.target.checked)}),children:[ei("Synch"),":"]})]}),(0,s.jsxs)(c.Z,{direction:"row",justifyContent:"flex-start",alignItems:"center",sx:{marginBottom:"20px"},children:[(0,s.jsx)(g.Z,{variant:"outlined",sx:{marginRight:"20px"},onClick:()=>D(0),children:"< ".concat(ei("Back"))}),(0,s.jsx)(g.Z,{variant:"outlined",onClick:async()=>{if(""===H){z.ZP.error(ei("Please_input_the_name"));return}if("webPage"===N){if(""===U){z.ZP.error(ei("Please_input_the_Web_Page_URL"));return}let e=await (0,L.PR)("/knowledge/".concat(n,"/document/add"),{doc_name:H,content:U,doc_type:"URL"});if(e.success&&es&&(0,L.PR)("/knowledge/".concat(n,"/document/sync"),{doc_ids:[e.data]}),e.success){z.ZP.success("success"),S(!1);let e=await (0,L.PR)("/knowledge/".concat(n,"/document/list"),{page:et,page_size:20});e.success&&(I(e.data.data),ee(e.data.total),en(e.data.page))}else z.ZP.error(e.err_msg||"failed")}else if("file"===N){if(!J){z.ZP.error(ei("Please_select_a_file"));return}let e=new FormData;e.append("doc_name",H),e.append("doc_file",J),e.append("doc_type","DOCUMENT");let t=await (0,L.Ej)("/knowledge/".concat(n,"/document/upload"),e);if(t.success&&es&&(0,L.PR)("/knowledge/".concat(n,"/document/sync"),{doc_ids:[t.data]}),t.success){z.ZP.success("success"),S(!1);let e=await (0,L.PR)("/knowledge/".concat(n,"/document/list"),{page:et,page_size:20});e.success&&(I(e.data.data),ee(e.data.total),en(e.data.page))}else z.ZP.error(t.err_msg||"failed")}else{if(""===X){z.ZP.error(ei("Please_input_the_text"));return}let e=await (0,L.PR)("/knowledge/".concat(n,"/document/add"),{doc_name:H,source:Y,content:X,doc_type:"TEXT"});if(e.success&&es&&(0,L.PR)("/knowledge/".concat(n,"/document/sync"),{doc_ids:[e.data]}),e.success){z.ZP.success("success"),S(!1);let e=await (0,L.PR)("/knowledge/".concat(n,"/document/list"),{page:et,page_size:20});e.success&&(I(e.data.data),ee(e.data.total),en(e.data.page))}else z.ZP.error(e.err_msg||"failed")}},children:ei("Finish")})]})]})]})})]})}},30119:function(e,t,n){"use strict";n.d(t,{Tk:function(){return o},PR:function(){return l},Ej:function(){return c}});var s=n(58301),a=n(6154);let i=a.Z.create({baseURL:"http://127.0.0.1:5000"});i.defaults.timeout=1e4,i.interceptors.response.use(e=>e.data,e=>Promise.reject(e)),n(96486);let r={"content-type":"application/json"},o=(e,t)=>{if(t){let n=Object.keys(t).filter(e=>void 0!==t[e]&&""!==t[e]).map(e=>"".concat(e,"=").concat(t[e])).join("&");n&&(e+="?".concat(n))}return i.get("/api"+e,{headers:r}).then(e=>e).catch(e=>{s.ZP.error(e),Promise.reject(e)})},l=(e,t)=>i.post(e,t,{headers:r}).then(e=>e).catch(e=>{s.ZP.error(e),Promise.reject(e)}),c=(e,t)=>i.post(e,t).then(e=>e).catch(e=>{s.ZP.error(e),Promise.reject(e)})}},function(e){e.O(0,[662,885,215,913,718,902,289,908,455,34,589,749,774,888,179],function(){return e(e.s=18050)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/pilot/server/static/_next/static/chunks/pages/datastores/documents-ff1a926b0d785967.js b/pilot/server/static/_next/static/chunks/pages/datastores/documents-ff1a926b0d785967.js deleted file mode 100644 index 5421a3f9a..000000000 --- a/pilot/server/static/_next/static/chunks/pages/datastores/documents-ff1a926b0d785967.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[413],{18050:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/datastores/documents",function(){return n(48120)}])},48120:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return H}});var s=n(85893),a=n(39332),i=n(67294),r=n(74312),o=n(3414),l=n(56385),c=n(70702),d=n(84229),x=n(2166),u=n(40911),g=n(47556),h=n(61685),m=n(77738),p=n(13245),j=n(48665),Z=n(75913),_=n(13009),f=n(74435),v=n(30381),w=n.n(v),y=n(64082),P=n(18967),b=n(53707),k=n(46907),C=n(7078),S=n(65170),R=n(74627),z=n(58301),B=n(60122),L=n(30119),T=n(577),D=n(32141),N=n(21400),F=n(4387),E=n(39217),I=n(65908),U=n(25675),O=n.n(U),A=n(67421),V=e=>{var t,n,a,r,l,d,x,u,h,m,f,v,w,y,P,b,k,C;let{spaceName:S}=e,[B,U]=(0,i.useState)(!1),[V,M]=(0,i.useState)({}),{t:W}=(0,A.$G)(),{data:H}=(0,T.Z)(()=>(0,L.PR)("/knowledge/".concat(S,"/arguments")),{onSuccess(e){M(e.data)}}),G=[{key:"Embedding",label:(0,s.jsxs)(j.Z,{children:[(0,s.jsx)(F.Z,{sx:{marginRight:"5px"}}),W("Embedding")]}),children:(0,s.jsxs)(j.Z,{children:[(0,s.jsxs)(c.Z,{direction:"row",justifyContent:"space-between",sx:{marginTop:"20px",marginBottom:"20px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",flex:"1 1 0",marginRight:"30px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("topk"),(0,s.jsx)(R.Z,{content:W("the_top_k_vectors"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:(null==H?void 0:null===(t=H.data)||void 0===t?void 0:null===(n=t.embedding)||void 0===n?void 0:n.topk)||"",onChange:e=>{V.embedding.topk=e.target.value,M({...V})}})})]}),(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",flex:"1 1 0"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("recall_score"),(0,s.jsx)(R.Z,{content:W("Set_a_threshold_score"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:""+(null==H?void 0:null===(a=H.data)||void 0===a?void 0:null===(r=a.embedding)||void 0===r?void 0:r.recall_score)||"",onChange:e=>{V.embedding.recall_score=e.target.value,M({...V})},disabled:!0})})]})]}),(0,s.jsxs)(c.Z,{direction:"row",justifyContent:"space-between",sx:{marginTop:"20px",marginBottom:"20px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",flex:"1 1 0",marginRight:"30px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("recall_type"),(0,s.jsx)(R.Z,{content:W("Recall_Type"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:(null==H?void 0:null===(l=H.data)||void 0===l?void 0:null===(d=l.embedding)||void 0===d?void 0:d.recall_type)||"",onChange:e=>{V.embedding.recall_type=e.target.value,M({...V})},disabled:!0})})]}),(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",flex:"1 1 0"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("model"),(0,s.jsx)(R.Z,{content:W("A_model_used"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:(null==H?void 0:null===(x=H.data)||void 0===x?void 0:null===(u=x.embedding)||void 0===u?void 0:u.model)||"",onChange:e=>{V.embedding.model=e.target.value,M({...V})},disabled:!0,startDecorator:(0,s.jsx)(O(),{src:"/huggingface_logo.svg",alt:"huggingface logo",width:20,height:20})})})]})]}),(0,s.jsxs)(c.Z,{direction:"row",justifyContent:"space-between",sx:{marginTop:"20px",marginBottom:"20px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",flex:"1 1 0",marginRight:"30px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("chunk_size"),(0,s.jsx)(R.Z,{content:W("The_size_of_the_data_chunks"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:(null==H?void 0:null===(h=H.data)||void 0===h?void 0:null===(m=h.embedding)||void 0===m?void 0:m.chunk_size)||"",onChange:e=>{V.embedding.chunk_size=e.target.value,M({...V})}})})]}),(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",flex:"1 1 0"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("chunk_overlap"),(0,s.jsx)(R.Z,{content:W("The_amount_of_overlap"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:(null==H?void 0:null===(f=H.data)||void 0===f?void 0:null===(v=f.embedding)||void 0===v?void 0:v.chunk_overlap)||"",onChange:e=>{V.embedding.chunk_overlap=e.target.value,M({...V})}})})]})]})]})},{key:"Prompt",label:(0,s.jsxs)(j.Z,{children:[(0,s.jsx)(E.Z,{sx:{marginRight:"5px"}}),W("Prompt")]}),children:(0,s.jsxs)(j.Z,{sx:{maxHeight:"600px",overflow:"auto","&::-webkit-scrollbar":{display:"none"}},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px",marginTop:"20px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("scene"),(0,s.jsx)(R.Z,{content:W("A_contextual_parameter"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(_.Z,{defaultValue:(null==H?void 0:null===(w=H.data)||void 0===w?void 0:null===(y=w.prompt)||void 0===y?void 0:y.scene)||"",onChange:e=>{V.prompt.scene=e.target.value,M({...V})}})})]}),(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("template"),(0,s.jsx)(R.Z,{content:W("structure_or_format"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(_.Z,{defaultValue:(null==H?void 0:null===(P=H.data)||void 0===P?void 0:null===(b=P.prompt)||void 0===b?void 0:b.template)||"",onChange:e=>{V.prompt.template=e.target.value,M({...V})}})})]}),(0,s.jsxs)(j.Z,{sx:{marginBottom:"20px"},children:[(0,s.jsxs)(j.Z,{sx:{marginBottom:"10px"},children:[W("max_token"),(0,s.jsx)(R.Z,{content:W("The_maximum_number_of_tokens"),trigger:"hover",style:{marginLeft:"20px"},children:(0,s.jsx)(D.Z,{sx:{marginLeft:"10px"}})})]}),(0,s.jsx)(j.Z,{children:(0,s.jsx)(Z.ZP,{defaultValue:(null==H?void 0:null===(k=H.data)||void 0===k?void 0:null===(C=k.prompt)||void 0===C?void 0:C.max_token)||"",onChange:e=>{V.prompt.max_token=e.target.value,M({...V})}})})]})]})}];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(g.Z,{variant:"outlined",onClick:()=>U(!0),children:[(0,s.jsx)(N.Z,{sx:{marginRight:"6px",fontSize:"18px"}}),W("Arguments")]}),(0,s.jsx)(p.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center","z-index":1e3},open:B,onClose:()=>U(!1),children:(0,s.jsxs)(o.Z,{variant:"outlined",sx:{width:800,borderRadius:"md",p:3,boxShadow:"lg"},children:[(0,s.jsx)(I.Z,{defaultActiveKey:"Embedding",items:G}),(0,s.jsx)(c.Z,{direction:"row",justifyContent:"flex-start",sx:{marginTop:"20px",marginBottom:"20px"},children:(0,s.jsx)(g.Z,{variant:"outlined",onClick:()=>{(0,L.PR)("/knowledge/".concat(S,"/argument/save"),{argument:JSON.stringify(V)}).then(e=>{e.success?(window.location.reload(),z.ZP.success("success")):z.ZP.error(e.err_msg||"failed")})},children:W("Submit")})})]})})]})};let{Dragger:M}=S.default,W=(0,r.Z)(o.Z)(e=>{let{theme:t}=e;return{width:"50%",backgroundColor:"dark"===t.palette.mode?t.palette.background.level1:"#fff",...t.typography.body2,padding:t.spacing(1),textAlign:"center",borderRadius:4,color:t.vars.palette.text.secondary}});var H=()=>{let e=(0,a.useRouter)(),t=(0,a.useSearchParams)(),n=t&&t.get("name"),{mode:r}=(0,l.tv)(),[v,S]=(0,i.useState)(!1),[T,D]=(0,i.useState)(0),[N,F]=(0,i.useState)(""),[E,I]=(0,i.useState)([]),[U,O]=(0,i.useState)(""),[H,G]=(0,i.useState)(""),[Y,K]=(0,i.useState)(""),[X,$]=(0,i.useState)(""),[J,q]=(0,i.useState)(null),[Q,ee]=(0,i.useState)(0),[et,en]=(0,i.useState)(0),[es,ea]=(0,i.useState)(!0),{t:ei}=(0,A.$G)(),er=[ei("Choose_a_Datasource_type"),ei("Setup_the_Datasource")],eo=[{type:"text",title:ei("Text"),subTitle:ei("Fill your raw text")},{type:"webPage",title:ei("URL"),subTitle:ei("Fetch_the_content_of_a_URL")},{type:"file",title:ei("Document"),subTitle:ei("Upload_a_document")}];return(0,i.useEffect)(()=>{(async function(){let e=await (0,L.PR)("/knowledge/".concat(n,"/document/list"),{page:1,page_size:20});e.success&&(I(e.data.data),ee(e.data.total),en(e.data.page))})()},[]),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsxs)(c.Z,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{marginBottom:"20px"},children:[(0,s.jsxs)(d.Z,{"aria-label":"breadcrumbs",children:[(0,s.jsx)(x.Z,{onClick:()=>{e.push("/datastores")},underline:"hover",color:"neutral",fontSize:"inherit",children:ei("Knowledge_Space")},"Knowledge Space"),(0,s.jsx)(u.ZP,{fontSize:"inherit",children:ei("Documents")})]}),(0,s.jsxs)(c.Z,{direction:"row",alignItems:"center",children:[(0,s.jsxs)(g.Z,{variant:"outlined",onClick:async()=>{var t,s;let a=await (0,L.PR)("/api/v1/chat/dialogue/new",{chat_mode:"chat_knowledge"});(null==a?void 0:a.success)&&(null==a?void 0:null===(t=a.data)||void 0===t?void 0:t.conv_uid)&&e.push("/chat?id=".concat(null==a?void 0:null===(s=a.data)||void 0===s?void 0:s.conv_uid,"&scene=chat_knowledge&spaceNameOriginal=").concat(n))},sx:{marginRight:"20px",backgroundColor:"rgb(39, 155, 255) !important",color:"white",border:"none"},children:[(0,s.jsx)(C.Z,{sx:{marginRight:"6px",fontSize:"18px"}}),ei("Chat")]}),(0,s.jsxs)(g.Z,{variant:"outlined",onClick:()=>S(!0),sx:{marginRight:"20px"},children:["+ ",ei("Add_Datasource")]}),(0,s.jsx)(V,{spaceName:n||""})]})]}),E.length?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(h.Z,{color:"primary",variant:"plain",size:"sm",sx:{"& tbody tr: hover":{backgroundColor:"light"===r?"rgb(246, 246, 246)":"rgb(33, 33, 40)"},"& tbody tr: hover a":{textDecoration:"underline"},"& tr > *:last-child":{textAlign:"right"}},children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:ei("Name")}),(0,s.jsx)("th",{children:ei("Type")}),(0,s.jsx)("th",{children:ei("Size")}),(0,s.jsx)("th",{children:ei("Last_Synch")}),(0,s.jsx)("th",{children:ei("Status")}),(0,s.jsx)("th",{children:ei("Result")}),(0,s.jsx)("th",{style:{width:"30%"},children:ei("Operation")})]})}),(0,s.jsx)("tbody",{children:E.map(t=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:t.doc_name}),(0,s.jsx)("td",{children:(0,s.jsx)(m.Z,{size:"sm",variant:"solid",color:"neutral",sx:{opacity:.5},children:t.doc_type})}),(0,s.jsxs)("td",{children:[t.chunk_size," chunks"]}),(0,s.jsx)("td",{children:w()(t.last_sync).format("YYYY-MM-DD HH:MM:SS")}),(0,s.jsx)("td",{children:(0,s.jsx)(m.Z,{size:"sm",sx:{opacity:.5},variant:"solid",color:function(){switch(t.status){case"TODO":return"neutral";case"RUNNING":return"primary";case"FINISHED":return"success";case"FAILED":return"danger"}}(),children:t.status})}),(0,s.jsx)("td",{children:"TODO"===t.status||"RUNNING"===t.status?"":"FINISHED"===t.status?(0,s.jsx)(R.Z,{content:t.result,trigger:"hover",children:(0,s.jsx)(m.Z,{size:"sm",variant:"solid",color:"success",sx:{opacity:.5},children:"SUCCESS"})}):(0,s.jsx)(R.Z,{content:t.result,trigger:"hover",children:(0,s.jsx)(m.Z,{size:"sm",variant:"solid",color:"danger",sx:{opacity:.5},children:"FAILED"})})}),(0,s.jsx)("td",{children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(g.Z,{variant:"outlined",size:"sm",sx:{marginRight:"2px"},onClick:async()=>{let e=await (0,L.PR)("/knowledge/".concat(n,"/document/sync"),{doc_ids:[t.id]});e.success?z.ZP.success("success"):z.ZP.error(e.err_msg||"failed")},children:[ei("Synch"),(0,s.jsx)(b.Z,{})]}),(0,s.jsx)(g.Z,{variant:"outlined",size:"sm",sx:{marginRight:"2px"},onClick:()=>{e.push("/datastores/documents/chunklist?spacename=".concat(n,"&documentid=").concat(t.id))},children:ei("Details")}),(0,s.jsxs)(g.Z,{variant:"outlined",size:"sm",color:"danger",onClick:async()=>{let e=await (0,L.PR)("/knowledge/".concat(n,"/document/delete"),{doc_name:t.doc_name});if(e.success){z.ZP.success("success");let e=await (0,L.PR)("/knowledge/".concat(n,"/document/list"),{page:et,page_size:20});e.success&&(I(e.data.data),ee(e.data.total),en(e.data.page))}else z.ZP.error(e.err_msg||"failed")},children:[ei("Delete"),(0,s.jsx)(k.Z,{})]})]})})]},t.id))})]}),(0,s.jsx)(c.Z,{direction:"row",justifyContent:"flex-end",sx:{marginTop:"20px"},children:(0,s.jsx)(B.Z,{defaultPageSize:20,showSizeChanger:!1,current:et,total:Q,onChange:async e=>{let t=await (0,L.PR)("/knowledge/".concat(n,"/document/list"),{page:e,page_size:20});t.success&&(I(t.data.data),ee(t.data.total),en(t.data.page))},hideOnSinglePage:!0})})]}):(0,s.jsx)(s.Fragment,{}),(0,s.jsx)(p.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center","z-index":1e3},open:v,onClose:()=>S(!1),children:(0,s.jsxs)(o.Z,{variant:"outlined",sx:{width:800,borderRadius:"md",p:3,boxShadow:"lg"},children:[(0,s.jsx)(j.Z,{sx:{width:"100%"},children:(0,s.jsx)(c.Z,{spacing:2,direction:"row",children:er.map((e,t)=>(0,s.jsxs)(W,{sx:{fontWeight:T===t?"bold":"",color:T===t?"#2AA3FF":""},children:[t(0,s.jsxs)(o.Z,{sx:{boxSizing:"border-box",height:"80px",padding:"12px",display:"flex",flexDirection:"column",justifyContent:"space-between",border:"1px solid gray",borderRadius:"6px",marginBottom:"20px",cursor:"pointer"},onClick:()=>{F(e.type),D(1)},children:[(0,s.jsx)(o.Z,{sx:{fontSize:"20px",fontWeight:"bold"},children:e.title}),(0,s.jsx)(o.Z,{children:e.subTitle})]},e.type))})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(j.Z,{sx:{margin:"30px auto"},children:[ei("Name"),":",(0,s.jsx)(Z.ZP,{placeholder:ei("Please_input_the_name"),onChange:e=>G(e.target.value),sx:{marginBottom:"20px"}}),"webPage"===N?(0,s.jsxs)(s.Fragment,{children:[ei("Web_Page_URL"),":",(0,s.jsx)(Z.ZP,{placeholder:ei("Please_input_the_Web_Page_URL"),onChange:e=>O(e.target.value)})]}):"file"===N?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(M,{name:"file",multiple:!1,beforeUpload:()=>!1,onChange(e){if(0===e.fileList.length){q(null),G("");return}q(e.file),G(e.file.name)},children:[(0,s.jsx)("p",{className:"ant-upload-drag-icon",children:(0,s.jsx)(y.Z,{})}),(0,s.jsx)("p",{style:{color:"rgb(22, 108, 255)",fontSize:"20px"},children:ei("Select_or_Drop_file")}),(0,s.jsx)("p",{className:"ant-upload-hint",style:{color:"rgb(22, 108, 255)"},children:"PDF, PowerPoint, Excel, Word, Text, Markdown,"})]})}):(0,s.jsxs)(s.Fragment,{children:[ei("Text_Source"),":",(0,s.jsx)(Z.ZP,{placeholder:ei("Please_input_the_text_source"),onChange:e=>K(e.target.value),sx:{marginBottom:"20px"}}),ei("Text"),":",(0,s.jsx)(_.Z,{onChange:e=>$(e.target.value),minRows:4,maxRows:4,sx:{marginBottom:"20px"}})]}),(0,s.jsxs)(u.ZP,{component:"label",sx:{marginTop:"20px"},endDecorator:(0,s.jsx)(f.Z,{checked:es,onChange:e=>ea(e.target.checked)}),children:[ei("Synch"),":"]})]}),(0,s.jsxs)(c.Z,{direction:"row",justifyContent:"flex-start",alignItems:"center",sx:{marginBottom:"20px"},children:[(0,s.jsx)(g.Z,{variant:"outlined",sx:{marginRight:"20px"},onClick:()=>D(0),children:"< ".concat(ei("Back"))}),(0,s.jsx)(g.Z,{variant:"outlined",onClick:async()=>{if(""===H){z.ZP.error(ei("Please_input_the_name"));return}if("webPage"===N){if(""===U){z.ZP.error(ei("Please_input_the_Web_Page_URL"));return}let e=await (0,L.PR)("/knowledge/".concat(n,"/document/add"),{doc_name:H,content:U,doc_type:"URL"});if(e.success&&es&&(0,L.PR)("/knowledge/".concat(n,"/document/sync"),{doc_ids:[e.data]}),e.success){z.ZP.success("success"),S(!1);let e=await (0,L.PR)("/knowledge/".concat(n,"/document/list"),{page:et,page_size:20});e.success&&(I(e.data.data),ee(e.data.total),en(e.data.page))}else z.ZP.error(e.err_msg||"failed")}else if("file"===N){if(!J){z.ZP.error(ei("Please_select_a_file"));return}let e=new FormData;e.append("doc_name",H),e.append("doc_file",J),e.append("doc_type","DOCUMENT");let t=await (0,L.Ej)("/knowledge/".concat(n,"/document/upload"),e);if(t.success&&es&&(0,L.PR)("/knowledge/".concat(n,"/document/sync"),{doc_ids:[t.data]}),t.success){z.ZP.success("success"),S(!1);let e=await (0,L.PR)("/knowledge/".concat(n,"/document/list"),{page:et,page_size:20});e.success&&(I(e.data.data),ee(e.data.total),en(e.data.page))}else z.ZP.error(t.err_msg||"failed")}else{if(""===X){z.ZP.error(ei("Please_input_the_text"));return}let e=await (0,L.PR)("/knowledge/".concat(n,"/document/add"),{doc_name:H,source:Y,content:X,doc_type:"TEXT"});if(e.success&&es&&(0,L.PR)("/knowledge/".concat(n,"/document/sync"),{doc_ids:[e.data]}),e.success){z.ZP.success("success"),S(!1);let e=await (0,L.PR)("/knowledge/".concat(n,"/document/list"),{page:et,page_size:20});e.success&&(I(e.data.data),ee(e.data.total),en(e.data.page))}else z.ZP.error(e.err_msg||"failed")}},children:ei("Finish")})]})]})]})})]})}},30119:function(e,t,n){"use strict";n.d(t,{Tk:function(){return o},PR:function(){return l},Ej:function(){return c}});var s=n(58301),a=n(6154);let i=a.Z.create({baseURL:"http://127.0.0.1:5000"});i.defaults.timeout=1e4,i.interceptors.response.use(e=>e.data,e=>Promise.reject(e)),n(96486);let r={"content-type":"application/json"},o=(e,t)=>{if(t){let n=Object.keys(t).filter(e=>void 0!==t[e]&&""!==t[e]).map(e=>"".concat(e,"=").concat(t[e])).join("&");n&&(e+="?".concat(n))}return i.get("/api"+e,{headers:r}).then(e=>e).catch(e=>{s.ZP.error(e),Promise.reject(e)})},l=(e,t)=>i.post(e,t,{headers:r}).then(e=>e).catch(e=>{s.ZP.error(e),Promise.reject(e)}),c=(e,t)=>i.post(e,t).then(e=>e).catch(e=>{s.ZP.error(e),Promise.reject(e)})}},function(e){e.O(0,[662,885,215,913,718,902,289,908,455,34,589,749,774,888,179],function(){return e(e.s=18050)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/pilot/server/static/_next/static/chunks/webpack-0cf65532d81bd8c6.js b/pilot/server/static/_next/static/chunks/webpack-990975ec33d04f30.js similarity index 54% rename from pilot/server/static/_next/static/chunks/webpack-0cf65532d81bd8c6.js rename to pilot/server/static/_next/static/chunks/webpack-990975ec33d04f30.js index 3803763aa..4ac44cd45 100644 --- a/pilot/server/static/_next/static/chunks/webpack-0cf65532d81bd8c6.js +++ b/pilot/server/static/_next/static/chunks/webpack-990975ec33d04f30.js @@ -1 +1 @@ -!function(){"use strict";var e,t,n,r,o,u,i,c,a,f,s,d,l={},p={};function h(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={id:e,loaded:!1,exports:{}},r=!0;try{l[e].call(n.exports,n,n.exports,h),r=!1}finally{r&&delete p[e]}return n.loaded=!0,n.exports}h.m=l,e=[],h.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u=o&&Object.keys(h.O).every(function(e){return h.O[e](n[a])})?n.splice(a--,1):(c=!1,o0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u=o&&Object.keys(b.O).every(function(e){return b.O[e](n[a])})?n.splice(a--,1):(c=!1,o
\ No newline at end of file +
\ No newline at end of file diff --git a/pilot/server/static/database/index.html b/pilot/server/static/database/index.html index e308144fd..eb24b85d8 100644 --- a/pilot/server/static/database/index.html +++ b/pilot/server/static/database/index.html @@ -1 +1 @@ -
Mysql

Mysql

Comming soon

Fast, reliable, scalable open-source relational database management system.

MSSQL

MSSQL

Comming soon

Powerful, scalable, secure relational database system by Microsoft.

Duckdb

Duckdb

Comming soon

In-memory analytical database with efficient query processing.

Sqlite

Sqlite

Comming soon

Lightweight embedded relational database with simplicity and portability.

ClickHouse

ClickHouse

Comming soon

Columnar database for high-performance analytics and real-time queries.

Oracle

Oracle

Comming soon

Robust, scalable, secure relational database widely used in enterprises.

Access

Access

Comming soon

Easy-to-use relational database for small-scale applications by Microsoft.

MongoDB

MongoDB

Comming soon

Flexible, scalable NoSQL document database for web and mobile apps.

DB2

DB2

Comming soon

Scalable, secure relational database system developed by IBM.

HBase

HBase

Comming soon

Distributed, scalable NoSQL database for large structured/semi-structured data.

Redis

Redis

Comming soon

Fast, versatile in-memory data structure store as cache, DB, or broker.

Cassandra

Cassandra

Comming soon

Scalable, fault-tolerant distributed NoSQL database for large data.

Couchbase

Couchbase

Comming soon

High-performance NoSQL document database with distributed architecture.

Postgresql

Postgresql

Comming soon

Powerful open-source relational database with extensibility and SQL standards.

\ No newline at end of file +
Mysql

Mysql

Comming soon

Fast, reliable, scalable open-source relational database management system.

MSSQL

MSSQL

Comming soon

Powerful, scalable, secure relational database system by Microsoft.

Duckdb

Duckdb

Comming soon

In-memory analytical database with efficient query processing.

Sqlite

Sqlite

Comming soon

Lightweight embedded relational database with simplicity and portability.

ClickHouse

ClickHouse

Comming soon

Columnar database for high-performance analytics and real-time queries.

Oracle

Oracle

Comming soon

Robust, scalable, secure relational database widely used in enterprises.

Access

Access

Comming soon

Easy-to-use relational database for small-scale applications by Microsoft.

MongoDB

MongoDB

Comming soon

Flexible, scalable NoSQL document database for web and mobile apps.

DB2

DB2

Comming soon

Scalable, secure relational database system developed by IBM.

HBase

HBase

Comming soon

Distributed, scalable NoSQL database for large structured/semi-structured data.

Redis

Redis

Comming soon

Fast, versatile in-memory data structure store as cache, DB, or broker.

Cassandra

Cassandra

Comming soon

Scalable, fault-tolerant distributed NoSQL database for large data.

Couchbase

Couchbase

Comming soon

High-performance NoSQL document database with distributed architecture.

Postgresql

Postgresql

Comming soon

Powerful open-source relational database with extensibility and SQL standards.

\ No newline at end of file diff --git a/pilot/server/static/datastores/documents/chunklist/index.html b/pilot/server/static/datastores/documents/chunklist/index.html index e185da419..262229e7b 100644 --- a/pilot/server/static/datastores/documents/chunklist/index.html +++ b/pilot/server/static/datastores/documents/chunklist/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/pilot/server/static/datastores/documents/index.html b/pilot/server/static/datastores/documents/index.html index 6cfcf4609..4f29ea018 100644 --- a/pilot/server/static/datastores/documents/index.html +++ b/pilot/server/static/datastores/documents/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/pilot/server/static/datastores/index.html b/pilot/server/static/datastores/index.html index 15d09ceea..9cda61bda 100644 --- a/pilot/server/static/datastores/index.html +++ b/pilot/server/static/datastores/index.html @@ -1 +1 @@ -
+
space
\ No newline at end of file +
+
space
\ No newline at end of file diff --git a/pilot/server/static/index.html b/pilot/server/static/index.html index 99cf35480..377648e66 100644 --- a/pilot/server/static/index.html +++ b/pilot/server/static/index.html @@ -1 +1 @@ -
Revolutionizing Database Interactions with Private LLM Technology
\ No newline at end of file +
Revolutionizing Database Interactions with Private LLM Technology
\ No newline at end of file