diff --git a/dbgpt/app/static/web/404.html b/dbgpt/app/static/web/404.html index 54dc46777..b597d047e 100644 --- a/dbgpt/app/static/web/404.html +++ b/dbgpt/app/static/web/404.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/404/index.html b/dbgpt/app/static/web/404/index.html index 54dc46777..b597d047e 100644 --- a/dbgpt/app/static/web/404/index.html +++ b/dbgpt/app/static/web/404/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/_next/data/0AwACq0tze7EEEbXlkDxg/construct/prompt/add.json b/dbgpt/app/static/web/_next/data/lAu8kd1SK-x2erMF1jcoK/construct/prompt/add.json similarity index 100% rename from dbgpt/app/static/web/_next/data/0AwACq0tze7EEEbXlkDxg/construct/prompt/add.json rename to dbgpt/app/static/web/_next/data/lAu8kd1SK-x2erMF1jcoK/construct/prompt/add.json diff --git a/dbgpt/app/static/web/_next/data/0AwACq0tze7EEEbXlkDxg/construct/prompt/edit.json b/dbgpt/app/static/web/_next/data/lAu8kd1SK-x2erMF1jcoK/construct/prompt/edit.json similarity index 100% rename from dbgpt/app/static/web/_next/data/0AwACq0tze7EEEbXlkDxg/construct/prompt/edit.json rename to dbgpt/app/static/web/_next/data/lAu8kd1SK-x2erMF1jcoK/construct/prompt/edit.json diff --git a/dbgpt/app/static/web/_next/static/chunks/2648-69e5e8753b98e009.js b/dbgpt/app/static/web/_next/static/chunks/2648-137ba93003e100f4.js similarity index 100% rename from dbgpt/app/static/web/_next/static/chunks/2648-69e5e8753b98e009.js rename to dbgpt/app/static/web/_next/static/chunks/2648-137ba93003e100f4.js diff --git a/dbgpt/app/static/web/_next/static/chunks/4451.bd23057ea2e75db6.js b/dbgpt/app/static/web/_next/static/chunks/4451.565b22bb6b4eae28.js similarity index 98% rename from dbgpt/app/static/web/_next/static/chunks/4451.bd23057ea2e75db6.js rename to dbgpt/app/static/web/_next/static/chunks/4451.565b22bb6b4eae28.js index 473036f12..e2ae8f4f7 100644 --- a/dbgpt/app/static/web/_next/static/chunks/4451.bd23057ea2e75db6.js +++ b/dbgpt/app/static/web/_next/static/chunks/4451.565b22bb6b4eae28.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4451],{96991:function(e,t,l){"use strict";l.d(t,{Z:function(){return s}});var n=l(87462),a=l(67294),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 144H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm0 400H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zM464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm0 400H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16z"}}]},name:"appstore",theme:"filled"},r=l(13401),s=a.forwardRef(function(e,t){return a.createElement(r.Z,(0,n.Z)({},e,{ref:t,icon:i}))})},36986:function(e,t,l){"use strict";l.d(t,{Z:function(){return s}});var n=l(87462),a=l(67294),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-12-12-28.3-18.7-45.3-18.7H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 176h256v112H384V176zm128 554c-79.5 0-144-64.5-144-144s64.5-144 144-144 144 64.5 144 144-64.5 144-144 144zm0-224c-44.2 0-80 35.8-80 80s35.8 80 80 80 80-35.8 80-80-35.8-80-80-80z"}}]},name:"save",theme:"filled"},r=l(13401),s=a.forwardRef(function(e,t){return a.createElement(r.Z,(0,n.Z)({},e,{ref:t,icon:i}))})},49591:function(e,t,l){"use strict";l.d(t,{Z:function(){return s}});var n=l(87462),a=l(67294),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h360c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H184V184h656v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V144c0-17.7-14.3-32-32-32zM653.3 599.4l52.2-52.2a8.01 8.01 0 00-4.7-13.6l-179.4-21c-5.1-.6-9.5 3.7-8.9 8.9l21 179.4c.8 6.6 8.9 9.4 13.6 4.7l52.4-52.4 256.2 256.2c3.1 3.1 8.2 3.1 11.3 0l42.4-42.4c3.1-3.1 3.1-8.2 0-11.3L653.3 599.4z"}}]},name:"select",theme:"outlined"},r=l(13401),s=a.forwardRef(function(e,t){return a.createElement(r.Z,(0,n.Z)({},e,{ref:t,icon:i}))})},88484:function(e,t,l){"use strict";l.d(t,{Z:function(){return s}});var n=l(87462),a=l(67294),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},r=l(13401),s=a.forwardRef(function(e,t){return a.createElement(r.Z,(0,n.Z)({},e,{ref:t,icon:i}))})},99134:function(e,t,l){"use strict";var n=l(67294);let a=(0,n.createContext)({});t.Z=a},21584:function(e,t,l){"use strict";var n=l(67294),a=l(93967),i=l.n(a),r=l(53124),s=l(99134),o=l(6999),d=function(e,t){var l={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(l[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(l[n[a]]=e[n[a]]);return l};function c(e){return"number"==typeof e?`${e} ${e} auto`:/^\d+(\.\d+)?(px|em|rem|%)$/.test(e)?`0 0 ${e}`:e}let u=["xs","sm","md","lg","xl","xxl"],h=n.forwardRef((e,t)=>{let{getPrefixCls:l,direction:a}=n.useContext(r.E_),{gutter:h,wrap:m}=n.useContext(s.Z),{prefixCls:v,span:f,order:p,offset:x,push:y,pull:g,className:j,children:w,flex:b,style:_}=e,N=d(e,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),C=l("col",v),[$,Z,k]=(0,o.cG)(C),S={},O={};u.forEach(t=>{let l={},n=e[t];"number"==typeof n?l.span=n:"object"==typeof n&&(l=n||{}),delete N[t],O=Object.assign(Object.assign({},O),{[`${C}-${t}-${l.span}`]:void 0!==l.span,[`${C}-${t}-order-${l.order}`]:l.order||0===l.order,[`${C}-${t}-offset-${l.offset}`]:l.offset||0===l.offset,[`${C}-${t}-push-${l.push}`]:l.push||0===l.push,[`${C}-${t}-pull-${l.pull}`]:l.pull||0===l.pull,[`${C}-rtl`]:"rtl"===a}),l.flex&&(O[`${C}-${t}-flex`]=!0,S[`--${C}-${t}-flex`]=c(l.flex))});let E=i()(C,{[`${C}-${f}`]:void 0!==f,[`${C}-order-${p}`]:p,[`${C}-offset-${x}`]:x,[`${C}-push-${y}`]:y,[`${C}-pull-${g}`]:g},j,O,Z,k),P={};if(h&&h[0]>0){let e=h[0]/2;P.paddingLeft=e,P.paddingRight=e}return b&&(P.flex=c(b),!1!==m||P.minWidth||(P.minWidth=0)),$(n.createElement("div",Object.assign({},N,{style:Object.assign(Object.assign(Object.assign({},P),_),S),className:E,ref:t}),w))});t.Z=h},92820:function(e,t,l){"use strict";var n=l(67294),a=l(93967),i=l.n(a),r=l(74443),s=l(53124),o=l(99134),d=l(6999),c=function(e,t){var l={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(l[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(l[n[a]]=e[n[a]]);return l};function u(e,t){let[l,a]=n.useState("string"==typeof e?e:""),i=()=>{if("string"==typeof e&&a(e),"object"==typeof e)for(let l=0;l{i()},[JSON.stringify(e),t]),l}let h=n.forwardRef((e,t)=>{let{prefixCls:l,justify:a,align:h,className:m,style:v,children:f,gutter:p=0,wrap:x}=e,y=c(e,["prefixCls","justify","align","className","style","children","gutter","wrap"]),{getPrefixCls:g,direction:j}=n.useContext(s.E_),[w,b]=n.useState({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}),[_,N]=n.useState({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),C=u(h,_),$=u(a,_),Z=n.useRef(p),k=(0,r.ZP)();n.useEffect(()=>{let e=k.subscribe(e=>{N(e);let t=Z.current||0;(!Array.isArray(t)&&"object"==typeof t||Array.isArray(t)&&("object"==typeof t[0]||"object"==typeof t[1]))&&b(e)});return()=>k.unsubscribe(e)},[]);let S=g("row",l),[O,E,P]=(0,d.VM)(S),M=(()=>{let e=[void 0,void 0],t=Array.isArray(p)?p:[p,void 0];return t.forEach((t,l)=>{if("object"==typeof t)for(let n=0;n0?-(M[0]/2):void 0;I&&(V.marginLeft=I,V.marginRight=I);let[R,T]=M;V.rowGap=T;let D=n.useMemo(()=>({gutter:[R,T],wrap:x}),[R,T,x]);return O(n.createElement(o.Z.Provider,{value:D},n.createElement("div",Object.assign({},y,{className:z,style:Object.assign(Object.assign({},V),v),ref:t}),f)))});t.Z=h},6999:function(e,t,l){"use strict";l.d(t,{VM:function(){return c},cG:function(){return u}});var n=l(25446),a=l(83559),i=l(83262);let r=e=>{let{componentCls:t}=e;return{[t]:{position:"relative",maxWidth:"100%",minHeight:1}}},s=(e,t)=>{let{prefixCls:l,componentCls:n,gridColumns:a}=e,i={};for(let e=a;e>=0;e--)0===e?(i[`${n}${t}-${e}`]={display:"none"},i[`${n}-push-${e}`]={insetInlineStart:"auto"},i[`${n}-pull-${e}`]={insetInlineEnd:"auto"},i[`${n}${t}-push-${e}`]={insetInlineStart:"auto"},i[`${n}${t}-pull-${e}`]={insetInlineEnd:"auto"},i[`${n}${t}-offset-${e}`]={marginInlineStart:0},i[`${n}${t}-order-${e}`]={order:0}):(i[`${n}${t}-${e}`]=[{"--ant-display":"block",display:"block"},{display:"var(--ant-display)",flex:`0 0 ${e/a*100}%`,maxWidth:`${e/a*100}%`}],i[`${n}${t}-push-${e}`]={insetInlineStart:`${e/a*100}%`},i[`${n}${t}-pull-${e}`]={insetInlineEnd:`${e/a*100}%`},i[`${n}${t}-offset-${e}`]={marginInlineStart:`${e/a*100}%`},i[`${n}${t}-order-${e}`]={order:e});return i[`${n}${t}-flex`]={flex:`var(--${l}${t}-flex)`},i},o=(e,t)=>s(e,t),d=(e,t,l)=>({[`@media (min-width: ${(0,n.bf)(t)})`]:Object.assign({},o(e,l))}),c=(0,a.I$)("Grid",e=>{let{componentCls:t}=e;return{[t]:{display:"flex",flexFlow:"row wrap",minWidth:0,"&::before, &::after":{display:"flex"},"&-no-wrap":{flexWrap:"nowrap"},"&-start":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"flex-end"},"&-space-between":{justifyContent:"space-between"},"&-space-around":{justifyContent:"space-around"},"&-space-evenly":{justifyContent:"space-evenly"},"&-top":{alignItems:"flex-start"},"&-middle":{alignItems:"center"},"&-bottom":{alignItems:"flex-end"}}}},()=>({})),u=(0,a.I$)("Grid",e=>{let t=(0,i.IX)(e,{gridColumns:24}),l={"-sm":t.screenSMMin,"-md":t.screenMDMin,"-lg":t.screenLGMin,"-xl":t.screenXLMin,"-xxl":t.screenXXLMin};return[r(t),o(t,""),o(t,"-xs"),Object.keys(l).map(e=>d(t,l[e],e)).reduce((e,t)=>Object.assign(Object.assign({},e),t),{})]},()=>({}))},21332:function(e,t,l){"use strict";l.d(t,{_:function(){return V},a:function(){return M}});var n=l(85893),a=l(41468),i=l(64371),r=l(23430),s=l(67190),o=l(34041),d=l(71230),c=l(15746),u=l(42075),h=l(83062),m=l(14726),v=l(32983),f=l(96486),p=l(67294);let x=e=>{if(!e)return;let t=e.getContainer(),l=t.getElementsByTagName("canvas")[0];return l};var y=l(64352),g=l(8625);let j=e=>{let{charts:t,scopeOfCharts:l,ruleConfig:n}=e,a={};if(null==t||t.forEach(e=>{if(e.chartKnowledge.toSpec){let t=e.chartKnowledge.toSpec;e.chartKnowledge.toSpec=(e,l)=>({...t(e,l),dataProps:l})}else e.chartKnowledge.toSpec=(e,t)=>({dataProps:t});a[e.chartType]=e.chartKnowledge}),(null==l?void 0:l.exclude)&&l.exclude.forEach(e=>{Object.keys(a).includes(e)&&delete a[e]}),null==l?void 0:l.include){let e=l.include;Object.keys(a).forEach(t=>{e.includes(t)||delete a[t]})}let i={...l,custom:a},r={...n},s=new y.w({ckbCfg:i,ruleCfg:r});return s},w=e=>{var t;let{data:l,dataMetaMap:n,myChartAdvisor:a}=e,i=n?Object.keys(n).map(e=>({name:e,...n[e]})):null,r=new g.Z(l).info(),s=(0,f.size)(r)>2?null==r?void 0:r.filter(e=>"string"!==e.recommendation&&"date"!==e.recommendation||e.distinct&&e.distinct>1):r,o=null==a?void 0:a.adviseWithLog({data:l,dataProps:i,fields:null==s?void 0:s.map(e=>e.name)});return null!==(t=null==o?void 0:o.advices)&&void 0!==t?t:[]};function b(e,t){return t.every(t=>e.includes(t))}function _(e,t){let l=t.find(t=>t.name===e);return(null==l?void 0:l.recommendation)==="date"?t=>new Date(t[e]):e}function N(e){return e.find(e=>{var t;return e.levelOfMeasurements&&(t=e.levelOfMeasurements,["Time","Ordinal"].some(e=>t.includes(e)))})}function C(e){return e.find(e=>e.levelOfMeasurements&&b(e.levelOfMeasurements,["Nominal"]))}let $=e=>{let{data:t,xField:l}=e,n=(0,f.uniq)(t.map(e=>e[l]));return n.length<=1},Z=(e,t,l)=>{let{field4Split:n,field4X:a}=l;if((null==n?void 0:n.name)&&(null==a?void 0:a.name)){let l=e[n.name],i=t.filter(e=>n.name&&e[n.name]===l);return $({data:i,xField:a.name})?5:void 0}return(null==a?void 0:a.name)&&$({data:t,xField:a.name})?5:void 0},k=e=>{let{data:t,chartType:l,xField:n}=e,a=(0,f.cloneDeep)(t);try{if(l.includes("line")&&(null==n?void 0:n.name)&&"date"===n.recommendation)return a.sort((e,t)=>new Date(e[n.name]).getTime()-new Date(t[n.name]).getTime()),a;l.includes("line")&&(null==n?void 0:n.name)&&["float","integer"].includes(n.recommendation)&&a.sort((e,t)=>e[n.name]-t[n.name])}catch(e){console.error(e)}return a},S=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.map(e=>{let l={};return Object.keys(e).forEach(n=>{l[n]=e[n]===t?null:e[n]}),l})},O="multi_line_chart",E="multi_measure_line_chart",P=[{chartType:"multi_line_chart",chartKnowledge:{id:O,name:"multi_line_chart",alias:["multi_line_chart"],family:["LineCharts"],def:"multi_line_chart uses lines with segments to show changes in data in a ordinal dimension",purpose:["Comparison","Trend"],coord:["Cartesian2D"],category:["Statistic"],shape:["Lines"],dataPres:[{minQty:1,maxQty:1,fieldConditions:["Time","Ordinal"]},{minQty:1,maxQty:"*",fieldConditions:["Interval"]},{minQty:0,maxQty:1,fieldConditions:["Nominal"]}],channel:["Color","Direction","Position"],recRate:"Recommended",toSpec:(e,t)=>{var l,n;let a=N(t),i=C(t),r=null!==(l=null!=a?a:i)&&void 0!==l?l:t[0],s=t.filter(e=>e.name!==(null==r?void 0:r.name)),o=null!==(n=s.filter(e=>e.levelOfMeasurements&&b(e.levelOfMeasurements,["Interval"])))&&void 0!==n?n:[s[0]],d=s.filter(e=>!o.find(t=>t.name===e.name)).find(e=>e.levelOfMeasurements&&b(e.levelOfMeasurements,["Nominal"]));if(!r||!o)return null;let c={type:"view",autoFit:!0,data:k({data:e,chartType:O,xField:r}),children:[]};return o.forEach(l=>{let n={type:"line",encode:{x:_(r.name,t),y:l.name,size:t=>Z(t,e,{field4Split:d,field4X:r})},legend:{size:!1}};d&&(n.encode.color=d.name),c.children.push(n)}),c}},chineseName:"折线图"},{chartType:"multi_measure_column_chart",chartKnowledge:{id:"multi_measure_column_chart",name:"multi_measure_column_chart",alias:["multi_measure_column_chart"],family:["ColumnCharts"],def:"multi_measure_column_chart uses lines with segments to show changes in data in a ordinal dimension",purpose:["Comparison","Distribution"],coord:["Cartesian2D"],category:["Statistic"],shape:["Lines"],dataPres:[{minQty:1,maxQty:"*",fieldConditions:["Interval"]},{minQty:1,maxQty:1,fieldConditions:["Nominal"]}],channel:["Color","Direction","Position"],recRate:"Recommended",toSpec:(e,t)=>{try{let l=null==t?void 0:t.filter(e=>b(e.levelOfMeasurements,["Interval"])),n=C(t),a=N(t),i=null!=n?n:a;if(!i||!l)return null;let r={type:"view",data:e,children:[]};return null==l||l.forEach(e=>{let t={type:"interval",encode:{x:i.name,y:e.name,color:()=>e.name,series:()=>e.name}};r.children.push(t)}),r}catch(e){return console.log(e),null}}},chineseName:"折线图"},{chartType:"multi_measure_line_chart",chartKnowledge:{id:E,name:"multi_measure_line_chart",alias:["multi_measure_line_chart"],family:["LineCharts"],def:"multi_measure_line_chart uses lines with segments to show changes in data in a ordinal dimension",purpose:["Comparison","Distribution"],coord:["Cartesian2D"],category:["Statistic"],shape:["Lines"],dataPres:[{minQty:1,maxQty:"*",fieldConditions:["Interval"]},{minQty:1,maxQty:1,fieldConditions:["Nominal"]}],channel:["Color","Direction","Position"],recRate:"Recommended",toSpec:(e,t)=>{try{var l,n;let a=null!==(n=null!==(l=C(t))&&void 0!==l?l:N(t))&&void 0!==n?n:t[0],i=null==t?void 0:t.filter(e=>e.name!==(null==a?void 0:a.name)&&b(e.levelOfMeasurements,["Interval"]));if(!a||!i)return null;let r={type:"view",data:k({data:e,chartType:E,xField:a}),children:[]};return null==i||i.forEach(l=>{let n={type:"line",encode:{x:_(a.name,t),y:l.name,color:()=>l.name,series:()=>l.name,size:t=>Z(t,e,{field4X:a})},legend:{size:!1}};r.children.push(n)}),r}catch(e){return console.log(e),null}}},chineseName:"折线图"}],M=e=>"response_line_chart"===e?["multi_line_chart","multi_measure_line_chart"]:"response_bar_chart"===e?["multi_measure_column_chart"]:"response_pie_chart"===e?["pie_chart"]:"response_scatter_chart"===e?["scatter_plot"]:"response_area_chart"===e?["area_chart"]:"response_heatmap_chart"===e?["heatmap"]:[],{Option:z}=o.default,V=e=>{let{data:t,chartType:l,scopeOfCharts:y,ruleConfig:g}=e,b=S(t),{mode:_}=(0,p.useContext)(a.p),[N,C]=(0,p.useState)(),[$,Z]=(0,p.useState)([]),[O,E]=(0,p.useState)(),M=(0,p.useRef)();(0,p.useEffect)(()=>{C(j({charts:P,scopeOfCharts:{exclude:["area_chart","stacked_area_chart","percent_stacked_area_chart"]},ruleConfig:g}))},[g,y]);let V=e=>{if(!N)return[];let t=function(e){let{advices:t}=e;return t}({advices:e}),n=(0,f.uniq)((0,f.compact)((0,f.concat)(l,e.map(e=>e.type)))),a=n.map(e=>{let l=t.find(t=>t.type===e);if(l)return l;let n=N.dataAnalyzer.execute({data:b});if("data"in n){var a;let t=N.specGenerator.execute({data:n.data,dataProps:n.dataProps,chartTypeRecommendations:[{chartType:e,score:1}]});if("advices"in t)return null===(a=t.advices)||void 0===a?void 0:a[0]}}).filter(e=>null==e?void 0:e.spec);return a};(0,p.useEffect)(()=>{if(b&&N){var e;let t=w({data:b,myChartAdvisor:N}),l=V(t);Z(l),E(null===(e=l[0])||void 0===e?void 0:e.type)}},[JSON.stringify(b),N,l]);let I=(0,p.useMemo)(()=>{if((null==$?void 0:$.length)>0){var e,t,l,a;let i=null!=O?O:$[0].type,r=null!==(t=null===(e=null==$?void 0:$.find(e=>e.type===i))||void 0===e?void 0:e.spec)&&void 0!==t?t:void 0;if(r){if(r.data&&["line_chart","step_line_chart"].includes(i)){let e=null==N?void 0:N.dataAnalyzer.execute({data:b});e&&"dataProps"in e&&(r.data=k({data:r.data,xField:null===(a=e.dataProps)||void 0===a?void 0:a.find(e=>"date"===e.recommendation),chartType:i}))}return"pie_chart"===i&&(null==r?void 0:null===(l=r.encode)||void 0===l?void 0:l.color)&&(r.tooltip={title:{field:r.encode.color}}),(0,n.jsx)(s.k,{options:{...r,autoFit:!0,theme:_,height:300},ref:M},i)}}},[$,_,O]);return O?(0,n.jsxs)("div",{children:[(0,n.jsxs)(d.Z,{justify:"space-between",className:"mb-2",children:[(0,n.jsx)(c.Z,{children:(0,n.jsxs)(u.Z,{children:[(0,n.jsx)("span",{children:i.Z.t("Advices")}),(0,n.jsx)(o.default,{className:"w-52",value:O,placeholder:"Chart Switcher",onChange:e=>E(e),size:"small",children:null==$?void 0:$.map(e=>{let t=i.Z.t(e.type);return(0,n.jsx)(z,{value:e.type,children:(0,n.jsx)(h.Z,{title:t,placement:"right",children:(0,n.jsx)("div",{children:t})})},e.type)})})]})}),(0,n.jsx)(c.Z,{children:(0,n.jsx)(h.Z,{title:i.Z.t("Download"),children:(0,n.jsx)(m.ZP,{onClick:()=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Chart",l=document.createElement("a"),n="".concat(t,".png");setTimeout(()=>{let t=function(e){let t=x(e);if(t){let e=t.toDataURL("image/png");return e}}(e);if(t){l.addEventListener("click",()=>{l.download=n,l.href=t});let e=document.createEvent("MouseEvents");e.initEvent("click",!1,!1),l.dispatchEvent(e)}},16)})(M.current,i.Z.t(O)),icon:(0,n.jsx)(r.Z,{}),type:"text"})})})]}),(0,n.jsx)("div",{className:"flex",children:I})]}):(0,n.jsx)(v.Z,{image:v.Z.PRESENTED_IMAGE_SIMPLE,description:"暂无合适的可视化视图"})}},39156:function(e,t,l){"use strict";l.d(t,{_z:function(){return f._},ZP:function(){return p},aG:function(){return f.a}});var n=l(85893),a=l(41118),i=l(30208),r=l(40911),s=l(67294),o=l(41468),d=l(67190);function c(e){let{chart:t}=e,{mode:l}=(0,s.useContext)(o.p);return(0,n.jsx)("div",{className:"flex-1 min-w-0 p-4 bg-white dark:bg-theme-dark-container rounded",children:(0,n.jsxs)("div",{className:"h-full",children:[(0,n.jsx)("div",{className:"mb-2",children:t.chart_name}),(0,n.jsx)("div",{className:"opacity-80 text-sm mb-2",children:t.chart_desc}),(0,n.jsx)("div",{className:"h-[300px]",children:(0,n.jsx)(d.k,{style:{height:"100%"},options:{autoFit:!0,theme:l,type:"interval",data:t.values,encode:{x:"name",y:"value",color:"type"},axis:{x:{labelAutoRotate:!1}}}})})]})})}function u(e){let{chart:t}=e,{mode:l}=(0,s.useContext)(o.p);return(0,n.jsx)("div",{className:"flex-1 min-w-0 p-4 bg-white dark:bg-theme-dark-container rounded",children:(0,n.jsxs)("div",{className:"h-full",children:[(0,n.jsx)("div",{className:"mb-2",children:t.chart_name}),(0,n.jsx)("div",{className:"opacity-80 text-sm mb-2",children:t.chart_desc}),(0,n.jsx)("div",{className:"h-[300px]",children:(0,n.jsx)(d.k,{style:{height:"100%"},options:{autoFit:!0,theme:l,type:"view",data:t.values,children:[{type:"line",encode:{x:"name",y:"value",color:"type",shape:"smooth"}},{type:"area",encode:{x:"name",y:"value",color:"type",shape:"smooth"},legend:!1,style:{fillOpacity:.15}}],axis:{x:{labelAutoRotate:!1}}}})})]})})}var h=l(61685),m=l(96486);function v(e){var t,l;let{chart:a}=e,i=(0,m.groupBy)(a.values,"type");return(0,n.jsx)("div",{className:"flex-1 min-w-0 p-4 bg-white dark:bg-theme-dark-container rounded",children:(0,n.jsxs)("div",{className:"h-full",children:[(0,n.jsx)("div",{className:"mb-2",children:a.chart_name}),(0,n.jsx)("div",{className:"opacity-80 text-sm mb-2",children:a.chart_desc}),(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsxs)(h.Z,{"aria-label":"basic table",stripe:"odd",hoverRow:!0,borderAxis:"bothBetween",children:[(0,n.jsx)("thead",{children:(0,n.jsx)("tr",{children:Object.keys(i).map(e=>(0,n.jsx)("th",{children:e},e))})}),(0,n.jsx)("tbody",{children:null===(t=Object.values(i))||void 0===t?void 0:null===(l=t[0])||void 0===l?void 0:l.map((e,t)=>{var l;return(0,n.jsx)("tr",{children:null===(l=Object.keys(i))||void 0===l?void 0:l.map(e=>{var l;return(0,n.jsx)("td",{children:(null==i?void 0:null===(l=i[e])||void 0===l?void 0:l[t].value)||""},e)})},t)})})]})})]})})}var f=l(21332),p=function(e){let{chartsData:t}=e,l=(0,s.useMemo)(()=>{if(t){let e=[],l=null==t?void 0:t.filter(e=>"IndicatorValue"===e.chart_type);l.length>0&&e.push({charts:l,type:"IndicatorValue"});let n=null==t?void 0:t.filter(e=>"IndicatorValue"!==e.chart_type),a=n.length,i=0;return[[0],[1],[2],[1,2],[1,3],[2,1,2],[2,1,3],[3,1,3],[3,2,3]][a].forEach(t=>{if(t>0){let l=n.slice(i,i+t);i+=t,e.push({charts:l})}}),e}},[t]);return(0,n.jsx)("div",{className:"flex flex-col gap-3",children:null==l?void 0:l.map((e,t)=>(0,n.jsx)("div",{className:"".concat((null==e?void 0:e.type)!=="IndicatorValue"?"flex gap-3":""),children:e.charts.map(e=>"IndicatorValue"===e.chart_type||"IndicatorValue"===e.type?(0,n.jsx)("div",{className:"flex flex-row gap-3",children:e.values.map(e=>(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(a.Z,{sx:{background:"transparent"},children:(0,n.jsxs)(i.Z,{className:"justify-around",children:[(0,n.jsx)(r.ZP,{gutterBottom:!0,component:"div",children:e.name}),(0,n.jsx)(r.ZP,{children:e.value})]})})},e.name))},e.chart_uid):"LineChart"===e.chart_type||"LineChart"===e.type?(0,n.jsx)(u,{chart:e},e.chart_uid):"BarChart"===e.chart_type||"BarChart"===e.type?(0,n.jsx)(c,{chart:e},e.chart_uid):"Table"===e.chart_type||"TableChartData"===e.type?(0,n.jsx)(v,{chart:e},e.chart_uid):void 0)},"chart_row_".concat(t)))})}},96307:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return P}});var n=l(85893),a=l(30119),i=l(16165),r=l(65654),s=l(25278),o=l(39773),d=l(83062),c=l(34041),u=l(20863),h=l(14726),m=l(39332),v=l(67294),f=l(39156),p=l(34625),x=l(74434),y=function(){return(0,n.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 1024 1024",version:"1.1",children:(0,n.jsx)("path",{d:"M161.05472 919.3472h701.9008a58.71616 58.71616 0 0 0 58.65472-58.65472V180.40832a58.71616 58.71616 0 0 0-58.65472-58.65472H161.09568a58.03008 58.03008 0 0 0-41.4208 17.08032A58.1632 58.1632 0 0 0 102.4 180.30592v680.38656a58.64448 58.64448 0 0 0 58.65472 58.65472z m385.15712-589.568V190.08512h306.95424v660.93056H546.21184V329.7792zM170.83392 190.08512h306.95424v660.93056H170.83392V190.08512z"})})},g=function(){return(0,n.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 1024 1024",version:"1.1",children:(0,n.jsx)("path",{d:"M171.85792 110.9504a58.65472 58.65472 0 0 0-58.65472 58.65472v701.9008a58.7264 58.7264 0 0 0 58.65472 58.65472h680.28416a58.7264 58.7264 0 0 0 58.65472-58.65472V169.64608a57.98912 57.98912 0 0 0-17.08032-41.41056 58.1632 58.1632 0 0 0-41.472-17.27488H171.85792z m670.60736 750.77632H181.53472V554.77248h660.93056v306.95424z m0-375.38816H181.53472V179.38432h660.93056v306.95424z"})})},j=l(6171),w=l(18073),b=l(14313),_=l(36986),N=l(93967),C=l.n(N),$=l(91085);function Z(){return(0,n.jsxs)("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",children:[(0,n.jsx)("path",{d:"M512 64c-247.424 0-448 62.72-448 140.032v112c0 77.312 200.576 139.968 448 139.968s448-62.72 448-140.032v-112C960 126.72 759.424 64 512 64z m0 728c-247.424 0-448-62.72-448-140.032v168.064C64 897.28 264.576 960 512 960s448-62.72 448-140.032v-167.936c0 77.312-200.576 139.968-448 139.968z",fill:"#3699FF"}),(0,n.jsx)("path",{d:"M512 540.032c-247.424 0-448-62.72-448-140.032v168c0 77.312 200.576 140.032 448 140.032s448-62.72 448-140.032V400c0 77.312-200.576 140.032-448 140.032z",fill:"#3699FF",opacity:".32"})]})}function k(){return(0,n.jsx)("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",children:(0,n.jsx)("path",{d:"M39.385 204.83h346.571L252.054 976.74l-23.63 39.383h259.929v-31.506L614.379 204.83H771.91S960.951 220.584 984.581 0.038H236.3S94.52-7.84 39.384 204.83",fill:"#1296db"})})}function S(){return(0,n.jsxs)("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",children:[(0,n.jsx)("path",{d:"M149.2 99.7h726.6c27.7 0 50.1 22.4 50.1 50.1V336H99.1V149.8c0-27.6 22.4-50.1 50.1-50.1z",fill:"#1ECD93"}),(0,n.jsx)("path",{d:"M99.1 395h236.2v236.3H99.1zM99.1 690.3h236.2v236.2H149.2c-27.7 0-50.1-22.4-50.1-50.1V690.3zM394.4 395h236.2v236.3H394.4z",fill:"#1ECD93",fillOpacity:".5"}),(0,n.jsx)("path",{d:"M394.4 690.3h236.2v236.3H394.4z",fill:"#A1E6C9","data-spm-anchor-id":"a313x.search_index.0.i13.27343a81CqKUWU"}),(0,n.jsx)("path",{d:"M689.7 395h236.2v236.3H689.7z",fill:"#1ECD93",fillOpacity:".5"}),(0,n.jsx)("path",{d:"M689.7 690.3h236.2v186.1c0 27.7-22.4 50.1-50.1 50.1H689.7V690.3z",fill:"#A1E6C9","data-spm-anchor-id":"a313x.search_index.0.i17.27343a81CqKUWU"})]})}let{Search:O}=s.default;function E(e){let{layout:t="LR",editorValue:l,chartData:a,tableData:i,tables:r,handleChange:s}=e,d=(0,v.useMemo)(()=>a?(0,n.jsx)("div",{className:"flex-1 overflow-auto p-2",style:{flexShrink:0,overflow:"hidden"},children:(0,n.jsx)(f.ZP,{chartsData:[a]})}):null,[a]),{columns:c,dataSource:u}=(0,v.useMemo)(()=>{let{columns:e=[],values:t=[]}=null!=i?i:{},l=e.map(e=>({key:e,dataIndex:e,title:e})),n=t.map(t=>t.reduce((t,l,n)=>(t[e[n]]=l,t),{}));return{columns:l,dataSource:n}},[i]),h=(0,v.useMemo)(()=>{let e={},t=null==r?void 0:r.data,l=null==t?void 0:t.children;return null==l||l.forEach(t=>{e[t.title]=t.children.map(e=>({columnName:e.title,columnType:e.type}))}),{getTableList:async e=>e&&e!==(null==t?void 0:t.title)?[]:(null==l?void 0:l.map(e=>e.title))||[],getTableColumns:async t=>e[t]||[],getSchemaList:async()=>(null==t?void 0:t.title)?[null==t?void 0:t.title]:[]}},[r]);return(0,n.jsxs)("div",{className:C()("flex w-full flex-1 h-full gap-2 overflow-hidden",{"flex-col":"TB"===t,"flex-row":"LR"===t}),children:[(0,n.jsx)("div",{className:"flex-1 flex overflow-hidden rounded",children:(0,n.jsx)(x.Z,{value:(null==l?void 0:l.sql)||"",language:"mysql",onChange:s,thoughts:(null==l?void 0:l.thoughts)||"",session:h})}),(0,n.jsxs)("div",{className:"flex-1 h-full overflow-auto bg-white dark:bg-theme-dark-container rounded p-4",children:[(null==i?void 0:i.values.length)?(0,n.jsx)(o.Z,{bordered:!0,scroll:{x:"auto"},rowKey:c[0].key,columns:c,dataSource:u}):(0,n.jsx)("div",{className:"h-full flex justify-center items-center",children:(0,n.jsx)($.Z,{})}),d]})]})}var P=function(){var e,t,l,s,o;let[f,x]=(0,v.useState)([]),[N,$]=(0,v.useState)(""),[P,M]=(0,v.useState)(),[z,V]=(0,v.useState)(!0),[I,R]=(0,v.useState)(),[T,D]=(0,v.useState)(),[H,L]=(0,v.useState)(),[q,A]=(0,v.useState)(),[B,F]=(0,v.useState)(),[U,Q]=(0,v.useState)(!1),[G,K]=(0,v.useState)("TB"),W=(0,m.useSearchParams)(),X=null==W?void 0:W.get("id"),J=null==W?void 0:W.get("scene"),{data:Y}=(0,r.Z)(async()=>await (0,a.Tk)("/v1/editor/sql/rounds",{con_uid:X}),{onSuccess:e=>{var t,l;let n=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t[(null==e?void 0:null===(l=e.data)||void 0===l?void 0:l.length)-1];n&&M(null==n?void 0:n.round)}}),{run:ee,loading:et}=(0,r.Z)(async()=>{var e,t;let l=null===(e=null==Y?void 0:null===(t=Y.data)||void 0===t?void 0:t.find(e=>e.round===P))||void 0===e?void 0:e.db_name;return await (0,a.PR)("/api/v1/editor/sql/run",{db_name:l,sql:null==H?void 0:H.sql})},{manual:!0,onSuccess:e=>{var t,l;A({columns:null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.colunms,values:null==e?void 0:null===(l=e.data)||void 0===l?void 0:l.values})}}),{run:el,loading:en}=(0,r.Z)(async()=>{var e,t;let l=null===(e=null==Y?void 0:null===(t=Y.data)||void 0===t?void 0:t.find(e=>e.round===P))||void 0===e?void 0:e.db_name,n={db_name:l,sql:null==H?void 0:H.sql};return"chat_dashboard"===J&&(n.chart_type=null==H?void 0:H.showcase),await (0,a.PR)("/api/v1/editor/chart/run",n)},{manual:!0,ready:!!(null==H?void 0:H.sql),onSuccess:e=>{if(null==e?void 0:e.success){var t,l,n,a,i,r,s;A({columns:(null==e?void 0:null===(t=e.data)||void 0===t?void 0:null===(l=t.sql_data)||void 0===l?void 0:l.colunms)||[],values:(null==e?void 0:null===(n=e.data)||void 0===n?void 0:null===(a=n.sql_data)||void 0===a?void 0:a.values)||[]}),(null==e?void 0:null===(i=e.data)||void 0===i?void 0:i.chart_values)?R({type:null==e?void 0:null===(r=e.data)||void 0===r?void 0:r.chart_type,values:null==e?void 0:null===(s=e.data)||void 0===s?void 0:s.chart_values,title:null==H?void 0:H.title,description:null==H?void 0:H.thoughts}):R(void 0)}}}),{run:ea,loading:ei}=(0,r.Z)(async()=>{var e,t,l,n,i;let r=null===(e=null==Y?void 0:null===(t=Y.data)||void 0===t?void 0:t.find(e=>e.round===P))||void 0===e?void 0:e.db_name;return await (0,a.PR)("/api/v1/sql/editor/submit",{conv_uid:X,db_name:r,conv_round:P,old_sql:null==T?void 0:T.sql,old_speak:null==T?void 0:T.thoughts,new_sql:null==H?void 0:H.sql,new_speak:(null===(l=null==H?void 0:null===(n=H.thoughts)||void 0===n?void 0:n.match(/^\n--(.*)\n\n$/))||void 0===l?void 0:null===(i=l[1])||void 0===i?void 0:i.trim())||(null==H?void 0:H.thoughts)})},{manual:!0,onSuccess:e=>{(null==e?void 0:e.success)&&ee()}}),{run:er,loading:es}=(0,r.Z)(async()=>{var e,t,l,n,i,r;let s=null===(e=null==Y?void 0:null===(t=Y.data)||void 0===t?void 0:t.find(e=>e.round===P))||void 0===e?void 0:e.db_name;return await (0,a.PR)("/api/v1/chart/editor/submit",{conv_uid:X,chart_title:null==H?void 0:H.title,db_name:s,old_sql:null==T?void 0:null===(l=T[null!=B?B:0])||void 0===l?void 0:l.sql,new_chart_type:null==H?void 0:H.showcase,new_sql:null==H?void 0:H.sql,new_comment:(null===(n=null==H?void 0:null===(i=H.thoughts)||void 0===i?void 0:i.match(/^\n--(.*)\n\n$/))||void 0===n?void 0:null===(r=n[1])||void 0===r?void 0:r.trim())||(null==H?void 0:H.thoughts),gmt_create:new Date().getTime()})},{manual:!0,onSuccess:e=>{(null==e?void 0:e.success)&&el()}}),{data:eo}=(0,r.Z)(async()=>{var e,t;let l=null===(e=null==Y?void 0:null===(t=Y.data)||void 0===t?void 0:t.find(e=>e.round===P))||void 0===e?void 0:e.db_name;return await (0,a.Tk)("/v1/editor/db/tables",{db_name:l,page_index:1,page_size:200})},{ready:!!(null===(e=null==Y?void 0:null===(t=Y.data)||void 0===t?void 0:t.find(e=>e.round===P))||void 0===e?void 0:e.db_name),refreshDeps:[null===(l=null==Y?void 0:null===(s=Y.data)||void 0===s?void 0:s.find(e=>e.round===P))||void 0===l?void 0:l.db_name]}),{run:ed}=(0,r.Z)(async e=>await (0,a.Tk)("/v1/editor/sql",{con_uid:X,round:e}),{manual:!0,onSuccess:e=>{let t;try{if(Array.isArray(null==e?void 0:e.data))t=null==e?void 0:e.data,F(0);else if("string"==typeof(null==e?void 0:e.data)){let l=JSON.parse(null==e?void 0:e.data);t=l}else t=null==e?void 0:e.data}catch(e){console.log(e)}finally{D(t),Array.isArray(t)?L(null==t?void 0:t[Number(B||0)]):L(t)}}}),ec=(0,v.useMemo)(()=>{let e=(t,l)=>t.map(t=>{let a=t.title,i=a.indexOf(N),r=a.substring(0,i),s=a.slice(i+N.length),o=e=>{switch(e){case"db":return(0,n.jsx)(Z,{});case"table":return(0,n.jsx)(S,{});default:return(0,n.jsx)(k,{})}},c=i>-1?(0,n.jsx)(d.Z,{title:((null==t?void 0:t.comment)||(null==t?void 0:t.title))+((null==t?void 0:t.can_null)==="YES"?"(can null)":"(can't null)"),children:(0,n.jsxs)("div",{className:"flex items-center",children:[o(t.type),"\xa0\xa0\xa0",r,(0,n.jsx)("span",{className:"text-[#1677ff]",children:N}),s,"\xa0",(null==t?void 0:t.type)&&(0,n.jsx)("div",{className:"text-gray-400",children:null==t?void 0:t.type})]})}):(0,n.jsx)(d.Z,{title:((null==t?void 0:t.comment)||(null==t?void 0:t.title))+((null==t?void 0:t.can_null)==="YES"?"(can null)":"(can't null)"),children:(0,n.jsxs)("div",{className:"flex items-center",children:[o(t.type),"\xa0\xa0\xa0",a,"\xa0",(null==t?void 0:t.type)&&(0,n.jsx)("div",{className:"text-gray-400",children:null==t?void 0:t.type})]})});if(t.children){let n=l?String(l)+"_"+t.key:t.key;return{title:a,showTitle:c,key:n,children:e(t.children,n)}}return{title:a,showTitle:c,key:t.key}});return(null==eo?void 0:eo.data)?(x([null==eo?void 0:eo.data.key]),e([null==eo?void 0:eo.data])):[]},[N,eo]),eu=(0,v.useMemo)(()=>{let e=[],t=(l,n)=>{if(l&&!((null==l?void 0:l.length)<=0))for(let a=0;a{let l;for(let n=0;nt.key===e)?l=a.key:eh(e,a.children)&&(l=eh(e,a.children)))}return l};function em(e){let t;if(!e)return{sql:"",thoughts:""};let l=e&&e.match(/(--.*)?\n?([\s\S]*)/),n="";return l&&l.length>=3&&(n=l[1],t=l[2]),{sql:t,thoughts:n}}return(0,v.useEffect)(()=>{P&&ed(P)},[ed,P]),(0,v.useEffect)(()=>{T&&"chat_dashboard"===J&&B&&el()},[B,J,T,el]),(0,v.useEffect)(()=>{T&&"chat_dashboard"!==J&&ee()},[J,T,ee]),(0,n.jsxs)("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[(0,n.jsx)(p.Z,{}),(0,n.jsxs)("div",{className:"relative flex flex-1 p-4 pt-0 overflow-hidden",children:[(0,n.jsxs)("div",{className:"relative flex overflow-hidden mr-4",children:[(0,n.jsx)("div",{className:C()("h-full relative transition-[width] overflow-hidden",{"w-0":U,"w-64":!U}),children:(0,n.jsxs)("div",{className:"relative w-64 h-full overflow-hidden flex flex-col rounded bg-white dark:bg-theme-dark-container p-4",children:[(0,n.jsx)(c.default,{size:"middle",className:"w-full mb-2",value:P,options:null==Y?void 0:null===(o=Y.data)||void 0===o?void 0:o.map(e=>({label:e.round_name,value:e.round})),onChange:e=>{M(e)}}),(0,n.jsx)(O,{className:"mb-2",placeholder:"Search",onChange:e=>{let{value:t}=e.target;if(null==eo?void 0:eo.data){if(t){let e=eu.map(e=>e.title.indexOf(t)>-1?eh(e.key,ec):null).filter((e,t,l)=>e&&l.indexOf(e)===t);x(e)}else x([]);$(t),V(!0)}}}),ec&&ec.length>0&&(0,n.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,n.jsx)(u.Z,{onExpand:e=>{x(e),V(!1)},expandedKeys:f,autoExpandParent:z,treeData:ec,fieldNames:{title:"showTitle"}})})]})}),(0,n.jsx)("div",{className:"absolute right-0 top-0 translate-x-full h-full flex items-center justify-center opacity-0 hover:opacity-100 group-hover/side:opacity-100 transition-opacity",children:(0,n.jsx)("div",{className:"bg-white w-4 h-10 flex items-center justify-center dark:bg-theme-dark-container rounded-tr rounded-br z-10 text-xs cursor-pointer shadow-[4px_0_10px_rgba(0,0,0,0.06)] text-opacity-80",onClick:()=>{Q(!U)},children:U?(0,n.jsx)(w.Z,{}):(0,n.jsx)(j.Z,{})})})]}),(0,n.jsxs)("div",{className:"flex flex-col flex-1 max-w-full overflow-hidden",children:[(0,n.jsxs)("div",{className:"mb-2 bg-white dark:bg-theme-dark-container p-2 flex justify-between items-center",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(h.ZP,{className:"text-xs rounded-none",size:"small",type:"primary",icon:(0,n.jsx)(b.Z,{}),loading:et||en,onClick:async()=>{"chat_dashboard"===J?el():ee()},children:"Run"}),(0,n.jsx)(h.ZP,{className:"text-xs rounded-none",type:"primary",size:"small",loading:ei||es,icon:(0,n.jsx)(_.Z,{}),onClick:async()=>{"chat_dashboard"===J?await er():await ea()},children:"Save"})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(i.Z,{className:C()("flex items-center justify-center w-6 h-6 text-lg rounded",{"bg-theme-primary bg-opacity-10":"TB"===G}),component:g,onClick:()=>{K("TB")}}),(0,n.jsx)(i.Z,{className:C()("flex items-center justify-center w-6 h-6 text-lg rounded",{"bg-theme-primary bg-opacity-10":"LR"===G}),component:y,onClick:()=>{K("LR")}})]})]}),Array.isArray(T)?(0,n.jsxs)("div",{className:"flex flex-col h-full overflow-hidden",children:[(0,n.jsx)("div",{className:"w-full whitespace-nowrap overflow-x-auto bg-white dark:bg-theme-dark-container mb-2 text-[0px]",children:T.map((e,t)=>(0,n.jsx)(d.Z,{className:"inline-block",title:e.title,children:(0,n.jsx)("div",{className:C()("max-w-[240px] px-3 h-10 text-ellipsis overflow-hidden whitespace-nowrap text-sm leading-10 cursor-pointer font-semibold hover:text-theme-primary transition-colors mr-2 last-of-type:mr-0",{"border-b-2 border-solid border-theme-primary text-theme-primary":B===t}),onClick:()=>{F(t),L(null==T?void 0:T[t])},children:e.title})},e.title))}),(0,n.jsx)("div",{className:"flex flex-1 overflow-hidden",children:T.map((e,t)=>(0,n.jsx)("div",{className:C()("w-full overflow-hidden",{hidden:t!==B,"block flex-1":t===B}),children:(0,n.jsx)(E,{layout:G,editorValue:e,handleChange:e=>{let{sql:t,thoughts:l}=em(e);L(e=>Object.assign({},e,{sql:t,thoughts:l}))},tableData:q,chartData:I})},e.title))})]}):(0,n.jsx)(E,{layout:G,editorValue:T,handleChange:e=>{let{sql:t,thoughts:l}=em(e);L(e=>Object.assign({},e,{sql:t,thoughts:l}))},tableData:q,chartData:void 0,tables:eo})]})]})]})}},34625:function(e,t,l){"use strict";l.d(t,{Z:function(){return O}});var n=l(85893),a=l(41468),i=l(81799),r=l(82353),s=l(16165),o=l(96991),d=l(78045),c=l(67294);function u(){let{isContract:e,setIsContract:t,scene:l}=(0,c.useContext)(a.p),i=l&&["chat_with_db_execute","chat_dashboard"].includes(l);return i?(0,n.jsxs)(d.ZP.Group,{value:e,defaultValue:!0,buttonStyle:"solid",onChange:()=>{t(!e)},children:[(0,n.jsxs)(d.ZP.Button,{value:!1,children:[(0,n.jsx)(s.Z,{component:r.ig,className:"mr-1"}),"Preview"]}),(0,n.jsxs)(d.ZP.Button,{value:!0,children:[(0,n.jsx)(o.Z,{className:"mr-1"}),"Editor"]})]}):null}l(23293);var h=l(76212),m=l(65654),v=l(34041),f=l(67421),p=function(){let{t:e}=(0,f.$G)(),{agent:t,setAgent:l}=(0,c.useContext)(a.p),{data:i=[]}=(0,m.Z)(async()=>{let[,e]=await (0,h.Vx)((0,h.H4)());return null!=e?e:[]});return(0,n.jsx)(v.default,{className:"w-60",value:t,placeholder:e("Select_Plugins"),options:i.map(e=>({label:e.app_name,value:e.app_code})),allowClear:!0,onChange:e=>{null==l||l(e)}})},x=l(29158),y=l(49591),g=l(88484),j=l(45360),w=l(83062),b=l(23799),_=l(14726),N=function(e){var t;let{convUid:l,chatMode:i,onComplete:r,...s}=e,[o,d]=(0,c.useState)(!1),[u,m]=j.ZP.useMessage(),[v,f]=(0,c.useState)([]),[p,N]=(0,c.useState)(),{model:C}=(0,c.useContext)(a.p),$=async e=>{var t;if(!e){j.ZP.error("Please select the *.(csv|xlsx|xls) file");return}if(!/\.(csv|xlsx|xls)$/.test(null!==(t=e.file.name)&&void 0!==t?t:"")){j.ZP.error("File type must be csv, xlsx or xls");return}f([e.file])},Z=async()=>{d(!0);try{let e=new FormData;e.append("doc_file",v[0]),u.open({content:"Uploading ".concat(v[0].name),type:"loading",duration:0});let[t]=await (0,h.Vx)((0,h.qn)({convUid:l,chatMode:i,data:e,model:C,config:{timeout:36e5,onUploadProgress:e=>{let t=Math.ceil(e.loaded/(e.total||0)*100);N(t)}}}));if(t)return;j.ZP.success("success"),null==r||r()}catch(e){j.ZP.error((null==e?void 0:e.message)||"Upload Error")}finally{d(!1),u.destroy()}};return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"flex items-start gap-2",children:[m,(0,n.jsx)(w.Z,{placement:"bottom",title:"File cannot be changed after upload",children:(0,n.jsx)(b.default,{disabled:o,className:"mr-1",beforeUpload:()=>!1,fileList:v,name:"file",accept:".csv,.xlsx,.xls",multiple:!1,onChange:$,showUploadList:{showDownloadIcon:!1,showPreviewIcon:!1,showRemoveIcon:!1},itemRender:()=>(0,n.jsx)(n.Fragment,{}),...s,children:(0,n.jsx)(_.ZP,{className:"flex justify-center items-center",type:"primary",disabled:o,icon:(0,n.jsx)(y.Z,{}),children:"Select File"})})}),(0,n.jsx)(_.ZP,{type:"primary",loading:o,className:"flex justify-center items-center",disabled:!v.length,icon:(0,n.jsx)(g.Z,{}),onClick:Z,children:o?100===p?"Analysis":"Uploading":"Upload"}),!!v.length&&(0,n.jsxs)("div",{className:"mt-2 text-gray-500 text-sm flex items-center",onClick:()=>f([]),children:[(0,n.jsx)(x.Z,{className:"mr-2"}),(0,n.jsx)("span",{children:null===(t=v[0])||void 0===t?void 0:t.name})]})]})})},C=function(e){let{onComplete:t}=e,{currentDialogue:l,scene:i,chatId:r}=(0,c.useContext)(a.p);return"chat_excel"!==i?null:(0,n.jsx)("div",{className:"max-w-md h-full relative",children:l?(0,n.jsxs)("div",{className:"flex h-8 overflow-hidden rounded",children:[(0,n.jsx)("div",{className:"flex items-center justify-center px-2 bg-gray-600 text-lg",children:(0,n.jsx)(x.Z,{className:"text-white"})}),(0,n.jsx)("div",{className:"flex items-center justify-center px-3 bg-gray-100 text-xs rounded-tr rounded-br dark:text-gray-800 truncate",children:l.select_param})]}):(0,n.jsx)(N,{convUid:r,chatMode:i,onComplete:t})})},$=l(98978),Z=l(62418),k=l(2093),S=function(){let{scene:e,dbParam:t,setDbParam:l}=(0,c.useContext)(a.p),[i,r]=(0,c.useState)([]);(0,k.Z)(async()=>{let[,t]=await (0,h.Vx)((0,h.vD)(e));r(null!=t?t:[])},[e]);let s=(0,c.useMemo)(()=>{var e;return null===(e=i.map)||void 0===e?void 0:e.call(i,e=>({name:e.param,...Z.S$[e.type]}))},[i]);return((0,c.useEffect)(()=>{(null==s?void 0:s.length)&&!t&&l(s[0].name)},[s,l,t]),null==s?void 0:s.length)?(0,n.jsx)(v.default,{value:t,className:"w-36",onChange:e=>{l(e)},children:s.map(e=>(0,n.jsxs)(v.default.Option,{children:[(0,n.jsx)($.Z,{width:24,height:24,src:e.icon,label:e.label,className:"w-[1.5em] h-[1.5em] mr-1 inline-block mt-[-4px]"}),e.name]},e.name))}):null},O=function(e){let{refreshHistory:t,modelChange:l}=e,{scene:r,refreshDialogList:s}=(0,c.useContext)(a.p);return(0,n.jsxs)("div",{className:"w-full py-2 px-4 md:px-4 flex flex-wrap items-center justify-center gap-1 md:gap-4",children:[(0,n.jsx)(i.Z,{onChange:l}),(0,n.jsx)(S,{}),"chat_excel"===r&&(0,n.jsx)(C,{onComplete:()=>{null==s||s(),null==t||t()}}),"chat_agent"===r&&(0,n.jsx)(p,{}),(0,n.jsx)(u,{})]})}},81799:function(e,t,l){"use strict";l.d(t,{A:function(){return h}});var n=l(85893),a=l(41468),i=l(19284),r=l(34041),s=l(25675),o=l.n(s),d=l(67294),c=l(67421);let u="/models/huggingface.svg";function h(e,t){var l,a;let{width:r,height:s}=t||{};return e?(0,n.jsx)(o(),{className:"rounded-full border border-gray-200 object-contain bg-white inline-block",width:r||24,height:s||24,src:(null===(l=i.Hf[e])||void 0===l?void 0:l.icon)||u,alt:"llm"},(null===(a=i.Hf[e])||void 0===a?void 0:a.icon)||u):null}t.Z=function(e){let{onChange:t}=e,{t:l}=(0,c.$G)(),{modelList:s,model:o}=(0,d.useContext)(a.p);return!s||s.length<=0?null:(0,n.jsx)(r.default,{value:o,placeholder:l("choose_model"),className:"w-52",onChange:e=>{null==t||t(e)},children:s.map(e=>{var t;return(0,n.jsx)(r.default.Option,{children:(0,n.jsxs)("div",{className:"flex items-center",children:[h(e),(0,n.jsx)("span",{className:"ml-2",children:(null===(t=i.Hf[e])||void 0===t?void 0:t.label)||e})]})},e)})})}},91085:function(e,t,l){"use strict";var n=l(85893),a=l(32983),i=l(14726),r=l(93967),s=l.n(r),o=l(67421);t.Z=function(e){let{className:t,error:l,description:r,refresh:d}=e,{t:c}=(0,o.$G)();return(0,n.jsx)(a.Z,{image:"/empty.png",imageStyle:{width:320,height:196,margin:"0 auto",maxWidth:"100%",maxHeight:"100%"},className:s()("flex items-center justify-center flex-col h-full w-full",t),description:l?(0,n.jsx)(i.ZP,{type:"primary",onClick:d,children:c("try_again")}):null!=r?r:c("no_data")})}},30119:function(e,t,l){"use strict";l.d(t,{Tk:function(){return d},PR:function(){return c}});var n=l(62418),a=l(45360);l(96486);var i=l(87066),r=l(83454);let s=i.default.create({baseURL:r.env.API_BASE_URL});s.defaults.timeout=1e4,s.interceptors.response.use(e=>e.data,e=>Promise.reject(e));let o={"content-type":"application/json","User-Id":(0,n.n5)()},d=(e,t)=>{if(t){let l=Object.keys(t).filter(e=>void 0!==t[e]&&""!==t[e]).map(e=>"".concat(e,"=").concat(t[e])).join("&");l&&(e+="?".concat(l))}return s.get("/api"+e,{headers:o}).then(e=>e).catch(e=>{a.ZP.error(e),Promise.reject(e)})},c=(e,t)=>s.post(e,t,{headers:o}).then(e=>e).catch(e=>{a.ZP.error(e),Promise.reject(e)})},23293:function(){},36459:function(e,t,l){"use strict";function n(e){if(null==e)throw TypeError("Cannot destructure "+e)}l.d(t,{Z:function(){return n}})}}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4451],{96991:function(e,t,l){"use strict";l.d(t,{Z:function(){return s}});var n=l(87462),a=l(67294),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 144H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm0 400H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zM464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm0 400H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16z"}}]},name:"appstore",theme:"filled"},r=l(13401),s=a.forwardRef(function(e,t){return a.createElement(r.Z,(0,n.Z)({},e,{ref:t,icon:i}))})},36986:function(e,t,l){"use strict";l.d(t,{Z:function(){return s}});var n=l(87462),a=l(67294),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-12-12-28.3-18.7-45.3-18.7H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 176h256v112H384V176zm128 554c-79.5 0-144-64.5-144-144s64.5-144 144-144 144 64.5 144 144-64.5 144-144 144zm0-224c-44.2 0-80 35.8-80 80s35.8 80 80 80 80-35.8 80-80-35.8-80-80-80z"}}]},name:"save",theme:"filled"},r=l(13401),s=a.forwardRef(function(e,t){return a.createElement(r.Z,(0,n.Z)({},e,{ref:t,icon:i}))})},49591:function(e,t,l){"use strict";l.d(t,{Z:function(){return s}});var n=l(87462),a=l(67294),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h360c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H184V184h656v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V144c0-17.7-14.3-32-32-32zM653.3 599.4l52.2-52.2a8.01 8.01 0 00-4.7-13.6l-179.4-21c-5.1-.6-9.5 3.7-8.9 8.9l21 179.4c.8 6.6 8.9 9.4 13.6 4.7l52.4-52.4 256.2 256.2c3.1 3.1 8.2 3.1 11.3 0l42.4-42.4c3.1-3.1 3.1-8.2 0-11.3L653.3 599.4z"}}]},name:"select",theme:"outlined"},r=l(13401),s=a.forwardRef(function(e,t){return a.createElement(r.Z,(0,n.Z)({},e,{ref:t,icon:i}))})},88484:function(e,t,l){"use strict";l.d(t,{Z:function(){return s}});var n=l(87462),a=l(67294),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},r=l(13401),s=a.forwardRef(function(e,t){return a.createElement(r.Z,(0,n.Z)({},e,{ref:t,icon:i}))})},99134:function(e,t,l){"use strict";var n=l(67294);let a=(0,n.createContext)({});t.Z=a},21584:function(e,t,l){"use strict";var n=l(67294),a=l(93967),i=l.n(a),r=l(53124),s=l(99134),o=l(6999),d=function(e,t){var l={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(l[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(l[n[a]]=e[n[a]]);return l};function c(e){return"number"==typeof e?`${e} ${e} auto`:/^\d+(\.\d+)?(px|em|rem|%)$/.test(e)?`0 0 ${e}`:e}let u=["xs","sm","md","lg","xl","xxl"],h=n.forwardRef((e,t)=>{let{getPrefixCls:l,direction:a}=n.useContext(r.E_),{gutter:h,wrap:m}=n.useContext(s.Z),{prefixCls:v,span:f,order:p,offset:x,push:y,pull:g,className:j,children:w,flex:b,style:_}=e,N=d(e,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),C=l("col",v),[$,Z,k]=(0,o.cG)(C),S={},O={};u.forEach(t=>{let l={},n=e[t];"number"==typeof n?l.span=n:"object"==typeof n&&(l=n||{}),delete N[t],O=Object.assign(Object.assign({},O),{[`${C}-${t}-${l.span}`]:void 0!==l.span,[`${C}-${t}-order-${l.order}`]:l.order||0===l.order,[`${C}-${t}-offset-${l.offset}`]:l.offset||0===l.offset,[`${C}-${t}-push-${l.push}`]:l.push||0===l.push,[`${C}-${t}-pull-${l.pull}`]:l.pull||0===l.pull,[`${C}-rtl`]:"rtl"===a}),l.flex&&(O[`${C}-${t}-flex`]=!0,S[`--${C}-${t}-flex`]=c(l.flex))});let E=i()(C,{[`${C}-${f}`]:void 0!==f,[`${C}-order-${p}`]:p,[`${C}-offset-${x}`]:x,[`${C}-push-${y}`]:y,[`${C}-pull-${g}`]:g},j,O,Z,k),P={};if(h&&h[0]>0){let e=h[0]/2;P.paddingLeft=e,P.paddingRight=e}return b&&(P.flex=c(b),!1!==m||P.minWidth||(P.minWidth=0)),$(n.createElement("div",Object.assign({},N,{style:Object.assign(Object.assign(Object.assign({},P),_),S),className:E,ref:t}),w))});t.Z=h},92820:function(e,t,l){"use strict";var n=l(67294),a=l(93967),i=l.n(a),r=l(74443),s=l(53124),o=l(99134),d=l(6999),c=function(e,t){var l={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(l[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(l[n[a]]=e[n[a]]);return l};function u(e,t){let[l,a]=n.useState("string"==typeof e?e:""),i=()=>{if("string"==typeof e&&a(e),"object"==typeof e)for(let l=0;l{i()},[JSON.stringify(e),t]),l}let h=n.forwardRef((e,t)=>{let{prefixCls:l,justify:a,align:h,className:m,style:v,children:f,gutter:p=0,wrap:x}=e,y=c(e,["prefixCls","justify","align","className","style","children","gutter","wrap"]),{getPrefixCls:g,direction:j}=n.useContext(s.E_),[w,b]=n.useState({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}),[_,N]=n.useState({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),C=u(h,_),$=u(a,_),Z=n.useRef(p),k=(0,r.ZP)();n.useEffect(()=>{let e=k.subscribe(e=>{N(e);let t=Z.current||0;(!Array.isArray(t)&&"object"==typeof t||Array.isArray(t)&&("object"==typeof t[0]||"object"==typeof t[1]))&&b(e)});return()=>k.unsubscribe(e)},[]);let S=g("row",l),[O,E,P]=(0,d.VM)(S),M=(()=>{let e=[void 0,void 0],t=Array.isArray(p)?p:[p,void 0];return t.forEach((t,l)=>{if("object"==typeof t)for(let n=0;n0?-(M[0]/2):void 0;I&&(V.marginLeft=I,V.marginRight=I);let[R,T]=M;V.rowGap=T;let D=n.useMemo(()=>({gutter:[R,T],wrap:x}),[R,T,x]);return O(n.createElement(o.Z.Provider,{value:D},n.createElement("div",Object.assign({},y,{className:z,style:Object.assign(Object.assign({},V),v),ref:t}),f)))});t.Z=h},6999:function(e,t,l){"use strict";l.d(t,{VM:function(){return c},cG:function(){return u}});var n=l(25446),a=l(83559),i=l(83262);let r=e=>{let{componentCls:t}=e;return{[t]:{position:"relative",maxWidth:"100%",minHeight:1}}},s=(e,t)=>{let{prefixCls:l,componentCls:n,gridColumns:a}=e,i={};for(let e=a;e>=0;e--)0===e?(i[`${n}${t}-${e}`]={display:"none"},i[`${n}-push-${e}`]={insetInlineStart:"auto"},i[`${n}-pull-${e}`]={insetInlineEnd:"auto"},i[`${n}${t}-push-${e}`]={insetInlineStart:"auto"},i[`${n}${t}-pull-${e}`]={insetInlineEnd:"auto"},i[`${n}${t}-offset-${e}`]={marginInlineStart:0},i[`${n}${t}-order-${e}`]={order:0}):(i[`${n}${t}-${e}`]=[{"--ant-display":"block",display:"block"},{display:"var(--ant-display)",flex:`0 0 ${e/a*100}%`,maxWidth:`${e/a*100}%`}],i[`${n}${t}-push-${e}`]={insetInlineStart:`${e/a*100}%`},i[`${n}${t}-pull-${e}`]={insetInlineEnd:`${e/a*100}%`},i[`${n}${t}-offset-${e}`]={marginInlineStart:`${e/a*100}%`},i[`${n}${t}-order-${e}`]={order:e});return i[`${n}${t}-flex`]={flex:`var(--${l}${t}-flex)`},i},o=(e,t)=>s(e,t),d=(e,t,l)=>({[`@media (min-width: ${(0,n.bf)(t)})`]:Object.assign({},o(e,l))}),c=(0,a.I$)("Grid",e=>{let{componentCls:t}=e;return{[t]:{display:"flex",flexFlow:"row wrap",minWidth:0,"&::before, &::after":{display:"flex"},"&-no-wrap":{flexWrap:"nowrap"},"&-start":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"flex-end"},"&-space-between":{justifyContent:"space-between"},"&-space-around":{justifyContent:"space-around"},"&-space-evenly":{justifyContent:"space-evenly"},"&-top":{alignItems:"flex-start"},"&-middle":{alignItems:"center"},"&-bottom":{alignItems:"flex-end"}}}},()=>({})),u=(0,a.I$)("Grid",e=>{let t=(0,i.IX)(e,{gridColumns:24}),l={"-sm":t.screenSMMin,"-md":t.screenMDMin,"-lg":t.screenLGMin,"-xl":t.screenXLMin,"-xxl":t.screenXXLMin};return[r(t),o(t,""),o(t,"-xs"),Object.keys(l).map(e=>d(t,l[e],e)).reduce((e,t)=>Object.assign(Object.assign({},e),t),{})]},()=>({}))},21332:function(e,t,l){"use strict";l.d(t,{_:function(){return V},a:function(){return M}});var n=l(85893),a=l(41468),i=l(64371),r=l(23430),s=l(67190),o=l(34041),d=l(71230),c=l(15746),u=l(42075),h=l(83062),m=l(14726),v=l(32983),f=l(96486),p=l(67294);let x=e=>{if(!e)return;let t=e.getContainer(),l=t.getElementsByTagName("canvas")[0];return l};var y=l(64352),g=l(8625);let j=e=>{let{charts:t,scopeOfCharts:l,ruleConfig:n}=e,a={};if(null==t||t.forEach(e=>{if(e.chartKnowledge.toSpec){let t=e.chartKnowledge.toSpec;e.chartKnowledge.toSpec=(e,l)=>({...t(e,l),dataProps:l})}else e.chartKnowledge.toSpec=(e,t)=>({dataProps:t});a[e.chartType]=e.chartKnowledge}),(null==l?void 0:l.exclude)&&l.exclude.forEach(e=>{Object.keys(a).includes(e)&&delete a[e]}),null==l?void 0:l.include){let e=l.include;Object.keys(a).forEach(t=>{e.includes(t)||delete a[t]})}let i={...l,custom:a},r={...n},s=new y.w({ckbCfg:i,ruleCfg:r});return s},w=e=>{var t;let{data:l,dataMetaMap:n,myChartAdvisor:a}=e,i=n?Object.keys(n).map(e=>({name:e,...n[e]})):null,r=new g.Z(l).info(),s=(0,f.size)(r)>2?null==r?void 0:r.filter(e=>"string"!==e.recommendation&&"date"!==e.recommendation||e.distinct&&e.distinct>1):r,o=null==a?void 0:a.adviseWithLog({data:l,dataProps:i,fields:null==s?void 0:s.map(e=>e.name)});return null!==(t=null==o?void 0:o.advices)&&void 0!==t?t:[]};function b(e,t){return t.every(t=>e.includes(t))}function _(e,t){let l=t.find(t=>t.name===e);return(null==l?void 0:l.recommendation)==="date"?t=>new Date(t[e]):e}function N(e){return e.find(e=>{var t;return e.levelOfMeasurements&&(t=e.levelOfMeasurements,["Time","Ordinal"].some(e=>t.includes(e)))})}function C(e){return e.find(e=>e.levelOfMeasurements&&b(e.levelOfMeasurements,["Nominal"]))}let $=e=>{let{data:t,xField:l}=e,n=(0,f.uniq)(t.map(e=>e[l]));return n.length<=1},Z=(e,t,l)=>{let{field4Split:n,field4X:a}=l;if((null==n?void 0:n.name)&&(null==a?void 0:a.name)){let l=e[n.name],i=t.filter(e=>n.name&&e[n.name]===l);return $({data:i,xField:a.name})?5:void 0}return(null==a?void 0:a.name)&&$({data:t,xField:a.name})?5:void 0},k=e=>{let{data:t,chartType:l,xField:n}=e,a=(0,f.cloneDeep)(t);try{if(l.includes("line")&&(null==n?void 0:n.name)&&"date"===n.recommendation)return a.sort((e,t)=>new Date(e[n.name]).getTime()-new Date(t[n.name]).getTime()),a;l.includes("line")&&(null==n?void 0:n.name)&&["float","integer"].includes(n.recommendation)&&a.sort((e,t)=>e[n.name]-t[n.name])}catch(e){console.error(e)}return a},S=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.map(e=>{let l={};return Object.keys(e).forEach(n=>{l[n]=e[n]===t?null:e[n]}),l})},O="multi_line_chart",E="multi_measure_line_chart",P=[{chartType:"multi_line_chart",chartKnowledge:{id:O,name:"multi_line_chart",alias:["multi_line_chart"],family:["LineCharts"],def:"multi_line_chart uses lines with segments to show changes in data in a ordinal dimension",purpose:["Comparison","Trend"],coord:["Cartesian2D"],category:["Statistic"],shape:["Lines"],dataPres:[{minQty:1,maxQty:1,fieldConditions:["Time","Ordinal"]},{minQty:1,maxQty:"*",fieldConditions:["Interval"]},{minQty:0,maxQty:1,fieldConditions:["Nominal"]}],channel:["Color","Direction","Position"],recRate:"Recommended",toSpec:(e,t)=>{var l,n;let a=N(t),i=C(t),r=null!==(l=null!=a?a:i)&&void 0!==l?l:t[0],s=t.filter(e=>e.name!==(null==r?void 0:r.name)),o=null!==(n=s.filter(e=>e.levelOfMeasurements&&b(e.levelOfMeasurements,["Interval"])))&&void 0!==n?n:[s[0]],d=s.filter(e=>!o.find(t=>t.name===e.name)).find(e=>e.levelOfMeasurements&&b(e.levelOfMeasurements,["Nominal"]));if(!r||!o)return null;let c={type:"view",autoFit:!0,data:k({data:e,chartType:O,xField:r}),children:[]};return o.forEach(l=>{let n={type:"line",encode:{x:_(r.name,t),y:l.name,size:t=>Z(t,e,{field4Split:d,field4X:r})},legend:{size:!1}};d&&(n.encode.color=d.name),c.children.push(n)}),c}},chineseName:"折线图"},{chartType:"multi_measure_column_chart",chartKnowledge:{id:"multi_measure_column_chart",name:"multi_measure_column_chart",alias:["multi_measure_column_chart"],family:["ColumnCharts"],def:"multi_measure_column_chart uses lines with segments to show changes in data in a ordinal dimension",purpose:["Comparison","Distribution"],coord:["Cartesian2D"],category:["Statistic"],shape:["Lines"],dataPres:[{minQty:1,maxQty:"*",fieldConditions:["Interval"]},{minQty:1,maxQty:1,fieldConditions:["Nominal"]}],channel:["Color","Direction","Position"],recRate:"Recommended",toSpec:(e,t)=>{try{let l=null==t?void 0:t.filter(e=>b(e.levelOfMeasurements,["Interval"])),n=C(t),a=N(t),i=null!=n?n:a;if(!i||!l)return null;let r={type:"view",data:e,children:[]};return null==l||l.forEach(e=>{let t={type:"interval",encode:{x:i.name,y:e.name,color:()=>e.name,series:()=>e.name}};r.children.push(t)}),r}catch(e){return console.log(e),null}}},chineseName:"折线图"},{chartType:"multi_measure_line_chart",chartKnowledge:{id:E,name:"multi_measure_line_chart",alias:["multi_measure_line_chart"],family:["LineCharts"],def:"multi_measure_line_chart uses lines with segments to show changes in data in a ordinal dimension",purpose:["Comparison","Distribution"],coord:["Cartesian2D"],category:["Statistic"],shape:["Lines"],dataPres:[{minQty:1,maxQty:"*",fieldConditions:["Interval"]},{minQty:1,maxQty:1,fieldConditions:["Nominal"]}],channel:["Color","Direction","Position"],recRate:"Recommended",toSpec:(e,t)=>{try{var l,n;let a=null!==(n=null!==(l=C(t))&&void 0!==l?l:N(t))&&void 0!==n?n:t[0],i=null==t?void 0:t.filter(e=>e.name!==(null==a?void 0:a.name)&&b(e.levelOfMeasurements,["Interval"]));if(!a||!i)return null;let r={type:"view",data:k({data:e,chartType:E,xField:a}),children:[]};return null==i||i.forEach(l=>{let n={type:"line",encode:{x:_(a.name,t),y:l.name,color:()=>l.name,series:()=>l.name,size:t=>Z(t,e,{field4X:a})},legend:{size:!1}};r.children.push(n)}),r}catch(e){return console.log(e),null}}},chineseName:"折线图"}],M=e=>"response_line_chart"===e?["multi_line_chart","multi_measure_line_chart"]:"response_bar_chart"===e?["multi_measure_column_chart"]:"response_pie_chart"===e?["pie_chart"]:"response_scatter_chart"===e?["scatter_plot"]:"response_area_chart"===e?["area_chart"]:"response_heatmap_chart"===e?["heatmap"]:[],{Option:z}=o.default,V=e=>{let{data:t,chartType:l,scopeOfCharts:y,ruleConfig:g}=e,b=S(t),{mode:_}=(0,p.useContext)(a.p),[N,C]=(0,p.useState)(),[$,Z]=(0,p.useState)([]),[O,E]=(0,p.useState)(),M=(0,p.useRef)();(0,p.useEffect)(()=>{C(j({charts:P,scopeOfCharts:{exclude:["area_chart","stacked_area_chart","percent_stacked_area_chart"]},ruleConfig:g}))},[g,y]);let V=e=>{if(!N)return[];let t=function(e){let{advices:t}=e;return t}({advices:e}),n=(0,f.uniq)((0,f.compact)((0,f.concat)(l,e.map(e=>e.type)))),a=n.map(e=>{let l=t.find(t=>t.type===e);if(l)return l;let n=N.dataAnalyzer.execute({data:b});if("data"in n){var a;let t=N.specGenerator.execute({data:n.data,dataProps:n.dataProps,chartTypeRecommendations:[{chartType:e,score:1}]});if("advices"in t)return null===(a=t.advices)||void 0===a?void 0:a[0]}}).filter(e=>null==e?void 0:e.spec);return a};(0,p.useEffect)(()=>{if(b&&N){var e;let t=w({data:b,myChartAdvisor:N}),l=V(t);Z(l),E(null===(e=l[0])||void 0===e?void 0:e.type)}},[JSON.stringify(b),N,l]);let I=(0,p.useMemo)(()=>{if((null==$?void 0:$.length)>0){var e,t,l,a;let i=null!=O?O:$[0].type,r=null!==(t=null===(e=null==$?void 0:$.find(e=>e.type===i))||void 0===e?void 0:e.spec)&&void 0!==t?t:void 0;if(r){if(r.data&&["line_chart","step_line_chart"].includes(i)){let e=null==N?void 0:N.dataAnalyzer.execute({data:b});e&&"dataProps"in e&&(r.data=k({data:r.data,xField:null===(a=e.dataProps)||void 0===a?void 0:a.find(e=>"date"===e.recommendation),chartType:i}))}return"pie_chart"===i&&(null==r?void 0:null===(l=r.encode)||void 0===l?void 0:l.color)&&(r.tooltip={title:{field:r.encode.color}}),(0,n.jsx)(s.k,{options:{...r,autoFit:!0,theme:_,height:300},ref:M},i)}}},[$,_,O]);return O?(0,n.jsxs)("div",{children:[(0,n.jsxs)(d.Z,{justify:"space-between",className:"mb-2",children:[(0,n.jsx)(c.Z,{children:(0,n.jsxs)(u.Z,{children:[(0,n.jsx)("span",{children:i.Z.t("Advices")}),(0,n.jsx)(o.default,{className:"w-52",value:O,placeholder:"Chart Switcher",onChange:e=>E(e),size:"small",children:null==$?void 0:$.map(e=>{let t=i.Z.t(e.type);return(0,n.jsx)(z,{value:e.type,children:(0,n.jsx)(h.Z,{title:t,placement:"right",children:(0,n.jsx)("div",{children:t})})},e.type)})})]})}),(0,n.jsx)(c.Z,{children:(0,n.jsx)(h.Z,{title:i.Z.t("Download"),children:(0,n.jsx)(m.ZP,{onClick:()=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Chart",l=document.createElement("a"),n="".concat(t,".png");setTimeout(()=>{let t=function(e){let t=x(e);if(t){let e=t.toDataURL("image/png");return e}}(e);if(t){l.addEventListener("click",()=>{l.download=n,l.href=t});let e=document.createEvent("MouseEvents");e.initEvent("click",!1,!1),l.dispatchEvent(e)}},16)})(M.current,i.Z.t(O)),icon:(0,n.jsx)(r.Z,{}),type:"text"})})})]}),(0,n.jsx)("div",{className:"flex",children:I})]}):(0,n.jsx)(v.Z,{image:v.Z.PRESENTED_IMAGE_SIMPLE,description:"暂无合适的可视化视图"})}},39156:function(e,t,l){"use strict";l.d(t,{_z:function(){return f._},ZP:function(){return p},aG:function(){return f.a}});var n=l(85893),a=l(41118),i=l(30208),r=l(40911),s=l(67294),o=l(41468),d=l(67190);function c(e){let{chart:t}=e,{mode:l}=(0,s.useContext)(o.p);return(0,n.jsx)("div",{className:"flex-1 min-w-0 p-4 bg-white dark:bg-theme-dark-container rounded",children:(0,n.jsxs)("div",{className:"h-full",children:[(0,n.jsx)("div",{className:"mb-2",children:t.chart_name}),(0,n.jsx)("div",{className:"opacity-80 text-sm mb-2",children:t.chart_desc}),(0,n.jsx)("div",{className:"h-[300px]",children:(0,n.jsx)(d.k,{style:{height:"100%"},options:{autoFit:!0,theme:l,type:"interval",data:t.values,encode:{x:"name",y:"value",color:"type"},axis:{x:{labelAutoRotate:!1}}}})})]})})}function u(e){let{chart:t}=e,{mode:l}=(0,s.useContext)(o.p);return(0,n.jsx)("div",{className:"flex-1 min-w-0 p-4 bg-white dark:bg-theme-dark-container rounded",children:(0,n.jsxs)("div",{className:"h-full",children:[(0,n.jsx)("div",{className:"mb-2",children:t.chart_name}),(0,n.jsx)("div",{className:"opacity-80 text-sm mb-2",children:t.chart_desc}),(0,n.jsx)("div",{className:"h-[300px]",children:(0,n.jsx)(d.k,{style:{height:"100%"},options:{autoFit:!0,theme:l,type:"view",data:t.values,children:[{type:"line",encode:{x:"name",y:"value",color:"type",shape:"smooth"}},{type:"area",encode:{x:"name",y:"value",color:"type",shape:"smooth"},legend:!1,style:{fillOpacity:.15}}],axis:{x:{labelAutoRotate:!1}}}})})]})})}var h=l(61685),m=l(96486);function v(e){var t,l;let{chart:a}=e,i=(0,m.groupBy)(a.values,"type");return(0,n.jsx)("div",{className:"flex-1 min-w-0 p-4 bg-white dark:bg-theme-dark-container rounded",children:(0,n.jsxs)("div",{className:"h-full",children:[(0,n.jsx)("div",{className:"mb-2",children:a.chart_name}),(0,n.jsx)("div",{className:"opacity-80 text-sm mb-2",children:a.chart_desc}),(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsxs)(h.Z,{"aria-label":"basic table",stripe:"odd",hoverRow:!0,borderAxis:"bothBetween",children:[(0,n.jsx)("thead",{children:(0,n.jsx)("tr",{children:Object.keys(i).map(e=>(0,n.jsx)("th",{children:e},e))})}),(0,n.jsx)("tbody",{children:null===(t=Object.values(i))||void 0===t?void 0:null===(l=t[0])||void 0===l?void 0:l.map((e,t)=>{var l;return(0,n.jsx)("tr",{children:null===(l=Object.keys(i))||void 0===l?void 0:l.map(e=>{var l;return(0,n.jsx)("td",{children:(null==i?void 0:null===(l=i[e])||void 0===l?void 0:l[t].value)||""},e)})},t)})})]})})]})})}var f=l(21332),p=function(e){let{chartsData:t}=e,l=(0,s.useMemo)(()=>{if(t){let e=[],l=null==t?void 0:t.filter(e=>"IndicatorValue"===e.chart_type);l.length>0&&e.push({charts:l,type:"IndicatorValue"});let n=null==t?void 0:t.filter(e=>"IndicatorValue"!==e.chart_type),a=n.length,i=0;return[[0],[1],[2],[1,2],[1,3],[2,1,2],[2,1,3],[3,1,3],[3,2,3]][a].forEach(t=>{if(t>0){let l=n.slice(i,i+t);i+=t,e.push({charts:l})}}),e}},[t]);return(0,n.jsx)("div",{className:"flex flex-col gap-3",children:null==l?void 0:l.map((e,t)=>(0,n.jsx)("div",{className:"".concat((null==e?void 0:e.type)!=="IndicatorValue"?"flex gap-3":""),children:e.charts.map(e=>"IndicatorValue"===e.chart_type||"IndicatorValue"===e.type?(0,n.jsx)("div",{className:"flex flex-row gap-3",children:e.values.map(e=>(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(a.Z,{sx:{background:"transparent"},children:(0,n.jsxs)(i.Z,{className:"justify-around",children:[(0,n.jsx)(r.ZP,{gutterBottom:!0,component:"div",children:e.name}),(0,n.jsx)(r.ZP,{children:e.value})]})})},e.name))},e.chart_uid):"LineChart"===e.chart_type||"LineChart"===e.type?(0,n.jsx)(u,{chart:e},e.chart_uid):"BarChart"===e.chart_type||"BarChart"===e.type?(0,n.jsx)(c,{chart:e},e.chart_uid):"Table"===e.chart_type||"TableChartData"===e.type?(0,n.jsx)(v,{chart:e},e.chart_uid):void 0)},"chart_row_".concat(t)))})}},96307:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return P}});var n=l(85893),a=l(30119),i=l(16165),r=l(65654),s=l(25278),o=l(39773),d=l(83062),c=l(34041),u=l(20863),h=l(14726),m=l(39332),v=l(67294),f=l(39156),p=l(34625),x=l(74434),y=function(){return(0,n.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 1024 1024",version:"1.1",children:(0,n.jsx)("path",{d:"M161.05472 919.3472h701.9008a58.71616 58.71616 0 0 0 58.65472-58.65472V180.40832a58.71616 58.71616 0 0 0-58.65472-58.65472H161.09568a58.03008 58.03008 0 0 0-41.4208 17.08032A58.1632 58.1632 0 0 0 102.4 180.30592v680.38656a58.64448 58.64448 0 0 0 58.65472 58.65472z m385.15712-589.568V190.08512h306.95424v660.93056H546.21184V329.7792zM170.83392 190.08512h306.95424v660.93056H170.83392V190.08512z"})})},g=function(){return(0,n.jsx)("svg",{width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 1024 1024",version:"1.1",children:(0,n.jsx)("path",{d:"M171.85792 110.9504a58.65472 58.65472 0 0 0-58.65472 58.65472v701.9008a58.7264 58.7264 0 0 0 58.65472 58.65472h680.28416a58.7264 58.7264 0 0 0 58.65472-58.65472V169.64608a57.98912 57.98912 0 0 0-17.08032-41.41056 58.1632 58.1632 0 0 0-41.472-17.27488H171.85792z m670.60736 750.77632H181.53472V554.77248h660.93056v306.95424z m0-375.38816H181.53472V179.38432h660.93056v306.95424z"})})},j=l(6171),w=l(18073),b=l(14313),_=l(36986),N=l(93967),C=l.n(N),$=l(91085);function Z(){return(0,n.jsxs)("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",children:[(0,n.jsx)("path",{d:"M512 64c-247.424 0-448 62.72-448 140.032v112c0 77.312 200.576 139.968 448 139.968s448-62.72 448-140.032v-112C960 126.72 759.424 64 512 64z m0 728c-247.424 0-448-62.72-448-140.032v168.064C64 897.28 264.576 960 512 960s448-62.72 448-140.032v-167.936c0 77.312-200.576 139.968-448 139.968z",fill:"#3699FF"}),(0,n.jsx)("path",{d:"M512 540.032c-247.424 0-448-62.72-448-140.032v168c0 77.312 200.576 140.032 448 140.032s448-62.72 448-140.032V400c0 77.312-200.576 140.032-448 140.032z",fill:"#3699FF",opacity:".32"})]})}function k(){return(0,n.jsx)("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",children:(0,n.jsx)("path",{d:"M39.385 204.83h346.571L252.054 976.74l-23.63 39.383h259.929v-31.506L614.379 204.83H771.91S960.951 220.584 984.581 0.038H236.3S94.52-7.84 39.384 204.83",fill:"#1296db"})})}function S(){return(0,n.jsxs)("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",children:[(0,n.jsx)("path",{d:"M149.2 99.7h726.6c27.7 0 50.1 22.4 50.1 50.1V336H99.1V149.8c0-27.6 22.4-50.1 50.1-50.1z",fill:"#1ECD93"}),(0,n.jsx)("path",{d:"M99.1 395h236.2v236.3H99.1zM99.1 690.3h236.2v236.2H149.2c-27.7 0-50.1-22.4-50.1-50.1V690.3zM394.4 395h236.2v236.3H394.4z",fill:"#1ECD93",fillOpacity:".5"}),(0,n.jsx)("path",{d:"M394.4 690.3h236.2v236.3H394.4z",fill:"#A1E6C9","data-spm-anchor-id":"a313x.search_index.0.i13.27343a81CqKUWU"}),(0,n.jsx)("path",{d:"M689.7 395h236.2v236.3H689.7z",fill:"#1ECD93",fillOpacity:".5"}),(0,n.jsx)("path",{d:"M689.7 690.3h236.2v186.1c0 27.7-22.4 50.1-50.1 50.1H689.7V690.3z",fill:"#A1E6C9","data-spm-anchor-id":"a313x.search_index.0.i17.27343a81CqKUWU"})]})}let{Search:O}=s.default;function E(e){let{layout:t="LR",editorValue:l,chartData:a,tableData:i,tables:r,handleChange:s}=e,d=(0,v.useMemo)(()=>a?(0,n.jsx)("div",{className:"flex-1 overflow-auto p-2",style:{flexShrink:0,overflow:"hidden"},children:(0,n.jsx)(f.ZP,{chartsData:[a]})}):null,[a]),{columns:c,dataSource:u}=(0,v.useMemo)(()=>{let{columns:e=[],values:t=[]}=null!=i?i:{},l=e.map(e=>({key:e,dataIndex:e,title:e})),n=t.map(t=>t.reduce((t,l,n)=>(t[e[n]]=l,t),{}));return{columns:l,dataSource:n}},[i]),h=(0,v.useMemo)(()=>{let e={},t=null==r?void 0:r.data,l=null==t?void 0:t.children;return null==l||l.forEach(t=>{e[t.title]=t.children.map(e=>({columnName:e.title,columnType:e.type}))}),{getTableList:async e=>e&&e!==(null==t?void 0:t.title)?[]:(null==l?void 0:l.map(e=>e.title))||[],getTableColumns:async t=>e[t]||[],getSchemaList:async()=>(null==t?void 0:t.title)?[null==t?void 0:t.title]:[]}},[r]);return(0,n.jsxs)("div",{className:C()("flex w-full flex-1 h-full gap-2 overflow-hidden",{"flex-col":"TB"===t,"flex-row":"LR"===t}),children:[(0,n.jsx)("div",{className:"flex-1 flex overflow-hidden rounded",children:(0,n.jsx)(x.Z,{value:(null==l?void 0:l.sql)||"",language:"mysql",onChange:s,thoughts:(null==l?void 0:l.thoughts)||"",session:h})}),(0,n.jsxs)("div",{className:"flex-1 h-full overflow-auto bg-white dark:bg-theme-dark-container rounded p-4",children:[(null==i?void 0:i.values.length)?(0,n.jsx)(o.Z,{bordered:!0,scroll:{x:"auto"},rowKey:c[0].key,columns:c,dataSource:u}):(0,n.jsx)("div",{className:"h-full flex justify-center items-center",children:(0,n.jsx)($.Z,{})}),d]})]})}var P=function(){var e,t,l,s,o;let[f,x]=(0,v.useState)([]),[N,$]=(0,v.useState)(""),[P,M]=(0,v.useState)(),[z,V]=(0,v.useState)(!0),[I,R]=(0,v.useState)(),[T,D]=(0,v.useState)(),[H,L]=(0,v.useState)(),[q,A]=(0,v.useState)(),[B,F]=(0,v.useState)(),[U,Q]=(0,v.useState)(!1),[G,K]=(0,v.useState)("TB"),W=(0,m.useSearchParams)(),X=null==W?void 0:W.get("id"),J=null==W?void 0:W.get("scene"),{data:Y}=(0,r.Z)(async()=>await (0,a.Tk)("/v1/editor/sql/rounds",{con_uid:X}),{onSuccess:e=>{var t,l;let n=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t[(null==e?void 0:null===(l=e.data)||void 0===l?void 0:l.length)-1];n&&M(null==n?void 0:n.round)}}),{run:ee,loading:et}=(0,r.Z)(async()=>{var e,t;let l=null===(e=null==Y?void 0:null===(t=Y.data)||void 0===t?void 0:t.find(e=>e.round===P))||void 0===e?void 0:e.db_name;return await (0,a.PR)("/api/v1/editor/sql/run",{db_name:l,sql:null==H?void 0:H.sql})},{manual:!0,onSuccess:e=>{var t,l;A({columns:null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.colunms,values:null==e?void 0:null===(l=e.data)||void 0===l?void 0:l.values})}}),{run:el,loading:en}=(0,r.Z)(async()=>{var e,t;let l=null===(e=null==Y?void 0:null===(t=Y.data)||void 0===t?void 0:t.find(e=>e.round===P))||void 0===e?void 0:e.db_name,n={db_name:l,sql:null==H?void 0:H.sql};return"chat_dashboard"===J&&(n.chart_type=null==H?void 0:H.showcase),await (0,a.PR)("/api/v1/editor/chart/run",n)},{manual:!0,ready:!!(null==H?void 0:H.sql),onSuccess:e=>{if(null==e?void 0:e.success){var t,l,n,a,i,r,s;A({columns:(null==e?void 0:null===(t=e.data)||void 0===t?void 0:null===(l=t.sql_data)||void 0===l?void 0:l.colunms)||[],values:(null==e?void 0:null===(n=e.data)||void 0===n?void 0:null===(a=n.sql_data)||void 0===a?void 0:a.values)||[]}),(null==e?void 0:null===(i=e.data)||void 0===i?void 0:i.chart_values)?R({type:null==e?void 0:null===(r=e.data)||void 0===r?void 0:r.chart_type,values:null==e?void 0:null===(s=e.data)||void 0===s?void 0:s.chart_values,title:null==H?void 0:H.title,description:null==H?void 0:H.thoughts}):R(void 0)}}}),{run:ea,loading:ei}=(0,r.Z)(async()=>{var e,t,l,n,i;let r=null===(e=null==Y?void 0:null===(t=Y.data)||void 0===t?void 0:t.find(e=>e.round===P))||void 0===e?void 0:e.db_name;return await (0,a.PR)("/api/v1/sql/editor/submit",{conv_uid:X,db_name:r,conv_round:P,old_sql:null==T?void 0:T.sql,old_speak:null==T?void 0:T.thoughts,new_sql:null==H?void 0:H.sql,new_speak:(null===(l=null==H?void 0:null===(n=H.thoughts)||void 0===n?void 0:n.match(/^\n--(.*)\n\n$/))||void 0===l?void 0:null===(i=l[1])||void 0===i?void 0:i.trim())||(null==H?void 0:H.thoughts)})},{manual:!0,onSuccess:e=>{(null==e?void 0:e.success)&&ee()}}),{run:er,loading:es}=(0,r.Z)(async()=>{var e,t,l,n,i,r;let s=null===(e=null==Y?void 0:null===(t=Y.data)||void 0===t?void 0:t.find(e=>e.round===P))||void 0===e?void 0:e.db_name;return await (0,a.PR)("/api/v1/chart/editor/submit",{conv_uid:X,chart_title:null==H?void 0:H.title,db_name:s,old_sql:null==T?void 0:null===(l=T[null!=B?B:0])||void 0===l?void 0:l.sql,new_chart_type:null==H?void 0:H.showcase,new_sql:null==H?void 0:H.sql,new_comment:(null===(n=null==H?void 0:null===(i=H.thoughts)||void 0===i?void 0:i.match(/^\n--(.*)\n\n$/))||void 0===n?void 0:null===(r=n[1])||void 0===r?void 0:r.trim())||(null==H?void 0:H.thoughts),gmt_create:new Date().getTime()})},{manual:!0,onSuccess:e=>{(null==e?void 0:e.success)&&el()}}),{data:eo}=(0,r.Z)(async()=>{var e,t;let l=null===(e=null==Y?void 0:null===(t=Y.data)||void 0===t?void 0:t.find(e=>e.round===P))||void 0===e?void 0:e.db_name;return await (0,a.Tk)("/v1/editor/db/tables",{db_name:l,page_index:1,page_size:200})},{ready:!!(null===(e=null==Y?void 0:null===(t=Y.data)||void 0===t?void 0:t.find(e=>e.round===P))||void 0===e?void 0:e.db_name),refreshDeps:[null===(l=null==Y?void 0:null===(s=Y.data)||void 0===s?void 0:s.find(e=>e.round===P))||void 0===l?void 0:l.db_name]}),{run:ed}=(0,r.Z)(async e=>await (0,a.Tk)("/v1/editor/sql",{con_uid:X,round:e}),{manual:!0,onSuccess:e=>{let t;try{if(Array.isArray(null==e?void 0:e.data))t=null==e?void 0:e.data,F(0);else if("string"==typeof(null==e?void 0:e.data)){let l=JSON.parse(null==e?void 0:e.data);t=l}else t=null==e?void 0:e.data}catch(e){console.log(e)}finally{D(t),Array.isArray(t)?L(null==t?void 0:t[Number(B||0)]):L(t)}}}),ec=(0,v.useMemo)(()=>{let e=(t,l)=>t.map(t=>{let a=t.title,i=a.indexOf(N),r=a.substring(0,i),s=a.slice(i+N.length),o=e=>{switch(e){case"db":return(0,n.jsx)(Z,{});case"table":return(0,n.jsx)(S,{});default:return(0,n.jsx)(k,{})}},c=i>-1?(0,n.jsx)(d.Z,{title:((null==t?void 0:t.comment)||(null==t?void 0:t.title))+((null==t?void 0:t.can_null)==="YES"?"(can null)":"(can't null)"),children:(0,n.jsxs)("div",{className:"flex items-center",children:[o(t.type),"\xa0\xa0\xa0",r,(0,n.jsx)("span",{className:"text-[#1677ff]",children:N}),s,"\xa0",(null==t?void 0:t.type)&&(0,n.jsx)("div",{className:"text-gray-400",children:null==t?void 0:t.type})]})}):(0,n.jsx)(d.Z,{title:((null==t?void 0:t.comment)||(null==t?void 0:t.title))+((null==t?void 0:t.can_null)==="YES"?"(can null)":"(can't null)"),children:(0,n.jsxs)("div",{className:"flex items-center",children:[o(t.type),"\xa0\xa0\xa0",a,"\xa0",(null==t?void 0:t.type)&&(0,n.jsx)("div",{className:"text-gray-400",children:null==t?void 0:t.type})]})});if(t.children){let n=l?String(l)+"_"+t.key:t.key;return{title:a,showTitle:c,key:n,children:e(t.children,n)}}return{title:a,showTitle:c,key:t.key}});return(null==eo?void 0:eo.data)?(x([null==eo?void 0:eo.data.key]),e([null==eo?void 0:eo.data])):[]},[N,eo]),eu=(0,v.useMemo)(()=>{let e=[],t=(l,n)=>{if(l&&!((null==l?void 0:l.length)<=0))for(let a=0;a{let l;for(let n=0;nt.key===e)?l=a.key:eh(e,a.children)&&(l=eh(e,a.children)))}return l};function em(e){let t;if(!e)return{sql:"",thoughts:""};let l=e&&e.match(/(--.*)?\n?([\s\S]*)/),n="";return l&&l.length>=3&&(n=l[1],t=l[2]),{sql:t,thoughts:n}}return(0,v.useEffect)(()=>{P&&ed(P)},[ed,P]),(0,v.useEffect)(()=>{T&&"chat_dashboard"===J&&B&&el()},[B,J,T,el]),(0,v.useEffect)(()=>{T&&"chat_dashboard"!==J&&ee()},[J,T,ee]),(0,n.jsxs)("div",{className:"flex flex-col w-full h-full overflow-hidden",children:[(0,n.jsx)(p.Z,{}),(0,n.jsxs)("div",{className:"relative flex flex-1 p-4 pt-0 overflow-hidden",children:[(0,n.jsxs)("div",{className:"relative flex overflow-hidden mr-4",children:[(0,n.jsx)("div",{className:C()("h-full relative transition-[width] overflow-hidden",{"w-0":U,"w-64":!U}),children:(0,n.jsxs)("div",{className:"relative w-64 h-full overflow-hidden flex flex-col rounded bg-white dark:bg-theme-dark-container p-4",children:[(0,n.jsx)(c.default,{size:"middle",className:"w-full mb-2",value:P,options:null==Y?void 0:null===(o=Y.data)||void 0===o?void 0:o.map(e=>({label:e.round_name,value:e.round})),onChange:e=>{M(e)}}),(0,n.jsx)(O,{className:"mb-2",placeholder:"Search",onChange:e=>{let{value:t}=e.target;if(null==eo?void 0:eo.data){if(t){let e=eu.map(e=>e.title.indexOf(t)>-1?eh(e.key,ec):null).filter((e,t,l)=>e&&l.indexOf(e)===t);x(e)}else x([]);$(t),V(!0)}}}),ec&&ec.length>0&&(0,n.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,n.jsx)(u.Z,{onExpand:e=>{x(e),V(!1)},expandedKeys:f,autoExpandParent:z,treeData:ec,fieldNames:{title:"showTitle"}})})]})}),(0,n.jsx)("div",{className:"absolute right-0 top-0 translate-x-full h-full flex items-center justify-center opacity-0 hover:opacity-100 group-hover/side:opacity-100 transition-opacity",children:(0,n.jsx)("div",{className:"bg-white w-4 h-10 flex items-center justify-center dark:bg-theme-dark-container rounded-tr rounded-br z-10 text-xs cursor-pointer shadow-[4px_0_10px_rgba(0,0,0,0.06)] text-opacity-80",onClick:()=>{Q(!U)},children:U?(0,n.jsx)(w.Z,{}):(0,n.jsx)(j.Z,{})})})]}),(0,n.jsxs)("div",{className:"flex flex-col flex-1 max-w-full overflow-hidden",children:[(0,n.jsxs)("div",{className:"mb-2 bg-white dark:bg-theme-dark-container p-2 flex justify-between items-center",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(h.ZP,{className:"text-xs rounded-none",size:"small",type:"primary",icon:(0,n.jsx)(b.Z,{}),loading:et||en,onClick:async()=>{"chat_dashboard"===J?el():ee()},children:"Run"}),(0,n.jsx)(h.ZP,{className:"text-xs rounded-none",type:"primary",size:"small",loading:ei||es,icon:(0,n.jsx)(_.Z,{}),onClick:async()=>{"chat_dashboard"===J?await er():await ea()},children:"Save"})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(i.Z,{className:C()("flex items-center justify-center w-6 h-6 text-lg rounded",{"bg-theme-primary bg-opacity-10":"TB"===G}),component:g,onClick:()=>{K("TB")}}),(0,n.jsx)(i.Z,{className:C()("flex items-center justify-center w-6 h-6 text-lg rounded",{"bg-theme-primary bg-opacity-10":"LR"===G}),component:y,onClick:()=>{K("LR")}})]})]}),Array.isArray(T)?(0,n.jsxs)("div",{className:"flex flex-col h-full overflow-hidden",children:[(0,n.jsx)("div",{className:"w-full whitespace-nowrap overflow-x-auto bg-white dark:bg-theme-dark-container mb-2 text-[0px]",children:T.map((e,t)=>(0,n.jsx)(d.Z,{className:"inline-block",title:e.title,children:(0,n.jsx)("div",{className:C()("max-w-[240px] px-3 h-10 text-ellipsis overflow-hidden whitespace-nowrap text-sm leading-10 cursor-pointer font-semibold hover:text-theme-primary transition-colors mr-2 last-of-type:mr-0",{"border-b-2 border-solid border-theme-primary text-theme-primary":B===t}),onClick:()=>{F(t),L(null==T?void 0:T[t])},children:e.title})},e.title))}),(0,n.jsx)("div",{className:"flex flex-1 overflow-hidden",children:T.map((e,t)=>(0,n.jsx)("div",{className:C()("w-full overflow-hidden",{hidden:t!==B,"block flex-1":t===B}),children:(0,n.jsx)(E,{layout:G,editorValue:e,handleChange:e=>{let{sql:t,thoughts:l}=em(e);L(e=>Object.assign({},e,{sql:t,thoughts:l}))},tableData:q,chartData:I})},e.title))})]}):(0,n.jsx)(E,{layout:G,editorValue:T,handleChange:e=>{let{sql:t,thoughts:l}=em(e);L(e=>Object.assign({},e,{sql:t,thoughts:l}))},tableData:q,chartData:void 0,tables:eo})]})]})]})}},34625:function(e,t,l){"use strict";l.d(t,{Z:function(){return O}});var n=l(85893),a=l(41468),i=l(81799),r=l(82353),s=l(16165),o=l(96991),d=l(78045),c=l(67294);function u(){let{isContract:e,setIsContract:t,scene:l}=(0,c.useContext)(a.p),i=l&&["chat_with_db_execute","chat_dashboard"].includes(l);return i?(0,n.jsxs)(d.ZP.Group,{value:e,defaultValue:!0,buttonStyle:"solid",onChange:()=>{t(!e)},children:[(0,n.jsxs)(d.ZP.Button,{value:!1,children:[(0,n.jsx)(s.Z,{component:r.ig,className:"mr-1"}),"Preview"]}),(0,n.jsxs)(d.ZP.Button,{value:!0,children:[(0,n.jsx)(o.Z,{className:"mr-1"}),"Editor"]})]}):null}l(23293);var h=l(76212),m=l(65654),v=l(34041),f=l(67421),p=function(){let{t:e}=(0,f.$G)(),{agent:t,setAgent:l}=(0,c.useContext)(a.p),{data:i=[]}=(0,m.Z)(async()=>{let[,e]=await (0,h.Vx)((0,h.H4)());return null!=e?e:[]});return(0,n.jsx)(v.default,{className:"w-60",value:t,placeholder:e("Select_Plugins"),options:i.map(e=>({label:e.app_name,value:e.app_code})),allowClear:!0,onChange:e=>{null==l||l(e)}})},x=l(29158),y=l(49591),g=l(88484),j=l(45360),w=l(83062),b=l(23799),_=l(14726),N=function(e){var t;let{convUid:l,chatMode:i,onComplete:r,...s}=e,[o,d]=(0,c.useState)(!1),[u,m]=j.ZP.useMessage(),[v,f]=(0,c.useState)([]),[p,N]=(0,c.useState)(),{model:C}=(0,c.useContext)(a.p),$=async e=>{var t;if(!e){j.ZP.error("Please select the *.(csv|xlsx|xls) file");return}if(!/\.(csv|xlsx|xls)$/.test(null!==(t=e.file.name)&&void 0!==t?t:"")){j.ZP.error("File type must be csv, xlsx or xls");return}f([e.file])},Z=async()=>{d(!0);try{let e=new FormData;e.append("doc_file",v[0]),u.open({content:"Uploading ".concat(v[0].name),type:"loading",duration:0});let[t]=await (0,h.Vx)((0,h.qn)({convUid:l,chatMode:i,data:e,model:C,config:{timeout:36e5,onUploadProgress:e=>{let t=Math.ceil(e.loaded/(e.total||0)*100);N(t)}}}));if(t)return;j.ZP.success("success"),null==r||r()}catch(e){j.ZP.error((null==e?void 0:e.message)||"Upload Error")}finally{d(!1),u.destroy()}};return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"flex items-start gap-2",children:[m,(0,n.jsx)(w.Z,{placement:"bottom",title:"File cannot be changed after upload",children:(0,n.jsx)(b.default,{disabled:o,className:"mr-1",beforeUpload:()=>!1,fileList:v,name:"file",accept:".csv,.xlsx,.xls",multiple:!1,onChange:$,showUploadList:{showDownloadIcon:!1,showPreviewIcon:!1,showRemoveIcon:!1},itemRender:()=>(0,n.jsx)(n.Fragment,{}),...s,children:(0,n.jsx)(_.ZP,{className:"flex justify-center items-center",type:"primary",disabled:o,icon:(0,n.jsx)(y.Z,{}),children:"Select File"})})}),(0,n.jsx)(_.ZP,{type:"primary",loading:o,className:"flex justify-center items-center",disabled:!v.length,icon:(0,n.jsx)(g.Z,{}),onClick:Z,children:o?100===p?"Analysis":"Uploading":"Upload"}),!!v.length&&(0,n.jsxs)("div",{className:"mt-2 text-gray-500 text-sm flex items-center",onClick:()=>f([]),children:[(0,n.jsx)(x.Z,{className:"mr-2"}),(0,n.jsx)("span",{children:null===(t=v[0])||void 0===t?void 0:t.name})]})]})})},C=function(e){let{onComplete:t}=e,{currentDialogue:l,scene:i,chatId:r}=(0,c.useContext)(a.p);return"chat_excel"!==i?null:(0,n.jsx)("div",{className:"max-w-md h-full relative",children:l?(0,n.jsxs)("div",{className:"flex h-8 overflow-hidden rounded",children:[(0,n.jsx)("div",{className:"flex items-center justify-center px-2 bg-gray-600 text-lg",children:(0,n.jsx)(x.Z,{className:"text-white"})}),(0,n.jsx)("div",{className:"flex items-center justify-center px-3 bg-gray-100 text-xs rounded-tr rounded-br dark:text-gray-800 truncate",children:l.select_param})]}):(0,n.jsx)(N,{convUid:r,chatMode:i,onComplete:t})})},$=l(98978),Z=l(62418),k=l(2093),S=function(){let{scene:e,dbParam:t,setDbParam:l}=(0,c.useContext)(a.p),[i,r]=(0,c.useState)([]);(0,k.Z)(async()=>{let[,t]=await (0,h.Vx)((0,h.vD)(e));r(null!=t?t:[])},[e]);let s=(0,c.useMemo)(()=>{var e;return null===(e=i.map)||void 0===e?void 0:e.call(i,e=>({name:e.param,...Z.S$[e.type]}))},[i]);return((0,c.useEffect)(()=>{(null==s?void 0:s.length)&&!t&&l(s[0].name)},[s,l,t]),null==s?void 0:s.length)?(0,n.jsx)(v.default,{value:t,className:"w-36",onChange:e=>{l(e)},children:s.map(e=>(0,n.jsxs)(v.default.Option,{children:[(0,n.jsx)($.Z,{width:24,height:24,src:e.icon,label:e.label,className:"w-[1.5em] h-[1.5em] mr-1 inline-block mt-[-4px]"}),e.name]},e.name))}):null},O=function(e){let{refreshHistory:t,modelChange:l}=e,{scene:r,refreshDialogList:s}=(0,c.useContext)(a.p);return(0,n.jsxs)("div",{className:"w-full py-2 px-4 md:px-4 flex flex-wrap items-center justify-center gap-1 md:gap-4",children:[(0,n.jsx)(i.Z,{onChange:l}),(0,n.jsx)(S,{}),"chat_excel"===r&&(0,n.jsx)(C,{onComplete:()=>{null==s||s(),null==t||t()}}),"chat_agent"===r&&(0,n.jsx)(p,{}),(0,n.jsx)(u,{})]})}},81799:function(e,t,l){"use strict";l.d(t,{A:function(){return h}});var n=l(85893),a=l(41468),i=l(19284),r=l(34041),s=l(25675),o=l.n(s),d=l(67294),c=l(67421);let u="/models/huggingface.svg";function h(e,t){var l,a;let{width:r,height:s}=t||{};return e?(0,n.jsx)(o(),{className:"rounded-full border border-gray-200 object-contain bg-white inline-block",width:r||24,height:s||24,src:(null===(l=i.Hf[e])||void 0===l?void 0:l.icon)||u,alt:"llm"},(null===(a=i.Hf[e])||void 0===a?void 0:a.icon)||u):null}t.Z=function(e){let{onChange:t}=e,{t:l}=(0,c.$G)(),{modelList:s,model:o}=(0,d.useContext)(a.p);return!s||s.length<=0?null:(0,n.jsx)(r.default,{value:o,placeholder:l("choose_model"),className:"w-52",onChange:e=>{null==t||t(e)},children:s.map(e=>{var t;return(0,n.jsx)(r.default.Option,{children:(0,n.jsxs)("div",{className:"flex items-center",children:[h(e),(0,n.jsx)("span",{className:"ml-2",children:(null===(t=i.Hf[e])||void 0===t?void 0:t.label)||e})]})},e)})})}},91085:function(e,t,l){"use strict";var n=l(85893),a=l(32983),i=l(14726),r=l(93967),s=l.n(r),o=l(67421);t.Z=function(e){let{className:t,error:l,description:r,refresh:d}=e,{t:c}=(0,o.$G)();return(0,n.jsx)(a.Z,{image:"/empty.png",imageStyle:{width:320,height:196,margin:"0 auto",maxWidth:"100%",maxHeight:"100%"},className:s()("flex items-center justify-center flex-col h-full w-full",t),description:l?(0,n.jsx)(i.ZP,{type:"primary",onClick:d,children:c("try_again")}):null!=r?r:c("no_data")})}},30119:function(e,t,l){"use strict";l.d(t,{Tk:function(){return c},PR:function(){return u}});var n,a=l(62418),i=l(45360);l(96486);var r=l(87066),s=l(83454);let o=r.default.create({baseURL:null!==(n=s.env.API_BASE_URL)&&void 0!==n?n:""});o.defaults.timeout=1e4,o.interceptors.response.use(e=>e.data,e=>Promise.reject(e));let d={"content-type":"application/json","User-Id":(0,a.n5)()},c=(e,t)=>{if(t){let l=Object.keys(t).filter(e=>void 0!==t[e]&&""!==t[e]).map(e=>"".concat(e,"=").concat(t[e])).join("&");l&&(e+="?".concat(l))}return o.get("/api"+e,{headers:d}).then(e=>e).catch(e=>{i.ZP.error(e),Promise.reject(e)})},u=(e,t)=>o.post(e,t,{headers:d}).then(e=>e).catch(e=>{i.ZP.error(e),Promise.reject(e)})},23293:function(){},36459:function(e,t,l){"use strict";function n(e){if(null==e)throw TypeError("Cannot destructure "+e)}l.d(t,{Z:function(){return n}})}}]); \ No newline at end of file diff --git a/dbgpt/app/static/web/_next/static/chunks/4769.5653cbc64ff693b3.js b/dbgpt/app/static/web/_next/static/chunks/4769.a6c83b023618d049.js similarity index 97% rename from dbgpt/app/static/web/_next/static/chunks/4769.5653cbc64ff693b3.js rename to dbgpt/app/static/web/_next/static/chunks/4769.a6c83b023618d049.js index 8619ec448..d73fd7ea1 100644 --- a/dbgpt/app/static/web/_next/static/chunks/4769.5653cbc64ff693b3.js +++ b/dbgpt/app/static/web/_next/static/chunks/4769.a6c83b023618d049.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4769],{36517:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return eI}});var n=l(85893),a=l(41468),s=l(76212),r=l(43446),o=l(62418),i=l(2093),c=l(93967),d=l.n(c),u=l(39332),x=l(67294),m=l(39156),h=l(91085),p=l(45247),f=()=>{let{history:e,setHistory:t,chatId:l,model:n,docId:o}=(0,x.useContext)(a.p),{chat:i}=(0,r.Z)({queryAgentURL:"/knowledge/document/summary"}),c=(0,x.useCallback)(async e=>{let[,a]=await (0,s.Vx)((0,s.$i)(l)),r=[...a,{role:"human",context:"",model_name:n,order:0,time_stamp:0},{role:"view",context:"",model_name:n,order:0,time_stamp:0,retry:!0}],c=r.length-1;t([...r]),await i({data:{doc_id:e||o,model_name:n},chatId:l,onMessage:e=>{r[c].context=e,t([...r])}})},[e,n,o,l]);return c},v=l(87740),g=l(57132),j=l(66478),w=l(14553),b=l(45360),y=l(83062),Z=l(85576),_=l(20640),N=l.n(_),C=l(96486),P=l(67421),k=l(27496),S=l(25278),R=l(14726),E=l(11163),I=l(82353),D=l(1051);function F(e){let{document:t}=e;switch(t.status){case"RUNNING":return(0,n.jsx)(I.Rp,{});case"FINISHED":default:return(0,n.jsx)(I.s2,{});case"FAILED":return(0,n.jsx)(D.Z,{})}}function M(e){let{documents:t,dbParam:l}=e,a=(0,E.useRouter)(),s=e=>{a.push("/knowledge/chunk/?spaceName=".concat(l,"&id=").concat(e))};return(null==t?void 0:t.length)?(0,n.jsx)("div",{className:"absolute flex overflow-scroll h-12 top-[-35px] w-full z-10",children:t.map(e=>{let t;switch(e.status){case"RUNNING":t="#2db7f5";break;case"FINISHED":default:t="#87d068";break;case"FAILED":t="#f50"}return(0,n.jsx)(y.Z,{title:e.result,children:(0,n.jsxs)(R.ZP,{style:{color:t},onClick:()=>{s(e.id)},className:"shrink flex items-center mr-3",children:[(0,n.jsx)(F,{document:e}),e.doc_name]})},e.id)})}):null}var U=l(5392),L=l(23799);function O(e){let{dbParam:t,setDocId:l}=(0,x.useContext)(a.p),{onUploadFinish:r,handleFinish:o}=e,i=f(),[c,d]=(0,x.useState)(!1),u=async e=>{d(!0);let n=new FormData;n.append("doc_name",e.file.name),n.append("doc_file",e.file),n.append("doc_type","DOCUMENT");let a=await (0,s.Vx)((0,s.iG)(t||"default",n));if(!a[1]){d(!1);return}l(a[1]),r(),d(!1),null==o||o(!0),await i(a[1]),null==o||o(!1)};return(0,n.jsx)(L.default,{customRequest:u,showUploadList:!1,maxCount:1,multiple:!1,className:"absolute z-10 top-2 left-2",accept:".pdf,.ppt,.pptx,.xls,.xlsx,.doc,.docx,.txt,.md",children:(0,n.jsx)(R.ZP,{loading:c,size:"small",shape:"circle",icon:(0,n.jsx)(U.Z,{})})})}var $=l(30119),A=l(65654),V=l(2487),G=l(28459),z=l(55241),H=l(99859),q=l(34041),B=l(12652);let T=e=>{let{data:t,loading:l,submit:a,close:s}=e,{t:r}=(0,P.$G)(),o=e=>()=>{a(e),s()};return(0,n.jsx)("div",{style:{maxHeight:400,overflow:"auto"},children:(0,n.jsx)(V.Z,{dataSource:null==t?void 0:t.data,loading:l,rowKey:e=>e.prompt_name,renderItem:e=>(0,n.jsx)(V.Z.Item,{onClick:o(e.content),children:(0,n.jsx)(y.Z,{title:e.content,children:(0,n.jsx)(V.Z.Item.Meta,{style:{cursor:"copy"},title:e.prompt_name,description:r("Prompt_Info_Scene")+":".concat(e.chat_scene,",")+r("Prompt_Info_Sub_Scene")+":".concat(e.sub_chat_scene)})})},e.prompt_name)})})};var J=e=>{let{submit:t}=e,{t:l}=(0,P.$G)(),[a,s]=(0,x.useState)(!1),[r,o]=(0,x.useState)("common"),{data:i,loading:c}=(0,A.Z)(()=>(0,$.PR)("/prompt/list",{prompt_type:r}),{refreshDeps:[r],onError:e=>{b.ZP.error(null==e?void 0:e.message)}});return(0,n.jsx)(G.ZP,{theme:{components:{Popover:{minWidth:250}}},children:(0,n.jsx)(z.Z,{title:(0,n.jsx)(H.default.Item,{label:"Prompt "+l("Type"),children:(0,n.jsx)(q.default,{style:{width:150},value:r,onChange:e=>{o(e)},options:[{label:l("Public")+" Prompts",value:"common"},{label:l("Private")+" Prompts",value:"private"}]})}),content:(0,n.jsx)(T,{data:i,loading:c,submit:t,close:()=>{s(!1)}}),placement:"topRight",trigger:"click",open:a,onOpenChange:e=>{s(e)},children:(0,n.jsx)(y.Z,{title:l("Click_Select")+" Prompt",children:(0,n.jsx)(B.Z,{className:"bottom-[30%]"})})})})},Q=function(e){let{children:t,loading:l,onSubmit:r,handleFinish:o,placeholder:i,...c}=e,{dbParam:d,scene:u}=(0,x.useContext)(a.p),[m,h]=(0,x.useState)(""),p=(0,x.useMemo)(()=>"chat_knowledge"===u,[u]),[f,v]=(0,x.useState)([]),g=(0,x.useRef)(0);async function j(){if(!d)return null;let[e,t]=await (0,s.Vx)((0,s._Q)(d,{page:1,page_size:g.current}));v((null==t?void 0:t.data)||[])}(0,x.useEffect)(()=>{p&&j()},[d]);let w=async()=>{g.current+=1,await j()};return(0,n.jsxs)("div",{className:"flex-1 relative",children:[(0,n.jsx)(M,{documents:f,dbParam:d}),p&&(0,n.jsx)(O,{handleFinish:o,onUploadFinish:w,className:"absolute z-10 top-2 left-2"}),(0,n.jsx)(S.default.TextArea,{className:"flex-1 ".concat(p?"pl-10":""," pr-10"),size:"large",value:m,autoSize:{minRows:1,maxRows:4},...c,onPressEnter:e=>{if(m.trim()&&13===e.keyCode){if(e.shiftKey){e.preventDefault(),h(e=>e+"\n");return}r(m),setTimeout(()=>{h("")},0)}},onChange:e=>{if("number"==typeof c.maxLength){h(e.target.value.substring(0,c.maxLength));return}h(e.target.value)},placeholder:i}),(0,n.jsx)(R.ZP,{className:"ml-2 flex items-center justify-center absolute right-0 bottom-0",size:"large",type:"text",loading:l,icon:(0,n.jsx)(k.Z,{}),onClick:()=>{r(m)}}),(0,n.jsx)(J,{submit:e=>{h(m+e)}}),t]})},W=l(87554),K=l(14660),X=l(30853),Y=(0,x.memo)(function(e){var t;let{content:l}=e,{scene:s}=(0,x.useContext)(a.p),r="view"===l.role;return(0,n.jsx)("div",{className:d()("relative w-full p-2 md:p-4 rounded-xl break-words",{"bg-white dark:bg-[#232734]":r,"lg:w-full xl:w-full pl-0":["chat_with_db_execute","chat_dashboard"].includes(s)}),children:r?(0,n.jsx)(W.Z,{components:X.Z,rehypePlugins:[K.Z],children:null==(t=l.context)?void 0:t.replace(/]+)>/gi,"").replace(/]+)>/gi,"")}):(0,n.jsx)("div",{className:"",children:l.context})})}),ee=l(24019),et=l(50888),el=l(97937),en=l(63606),ea=l(50228),es=l(87547),er=l(89035),eo=l(66309),ei=l(55186),ec=l(81799);let ed={todo:{bgClass:"bg-gray-500",icon:(0,n.jsx)(ee.Z,{className:"ml-2"})},runing:{bgClass:"bg-blue-500",icon:(0,n.jsx)(et.Z,{className:"ml-2"})},failed:{bgClass:"bg-red-500",icon:(0,n.jsx)(el.Z,{className:"ml-2"})},completed:{bgClass:"bg-green-500",icon:(0,n.jsx)(en.Z,{className:"ml-2"})}};function eu(e){return e.replaceAll("\\n","\n").replace(/]+)>/gi,"
").replace(/]+)>/gi,"")}var ex=(0,x.memo)(function(e){let{children:t,content:l,isChartChat:s,onLinkClick:r}=e,{scene:o}=(0,x.useContext)(a.p),{context:i,model_name:c,role:u}=l,m="view"===u,{relations:h,value:p,cachePluginContext:f}=(0,x.useMemo)(()=>{if("string"!=typeof i)return{relations:[],value:"",cachePluginContext:[]};let[e,t]=i.split(" relations:"),l=t?t.split(","):[],n=[],a=0,s=e.replace(/]*>[^<]*<\/dbgpt-view>/gi,e=>{try{var t;let l=e.replaceAll("\n","\\n").replace(/<[^>]*>|<\/[^>]*>/gm,""),s=JSON.parse(l),r="".concat(a,"");return n.push({...s,result:eu(null!==(t=s.result)&&void 0!==t?t:"")}),a++,r}catch(t){return console.log(t.message,t),e}});return{relations:l,cachePluginContext:n,value:s}},[i]),v=(0,x.useMemo)(()=>({"custom-view"(e){var t;let{children:l}=e,a=+l.toString();if(!f[a])return l;let{name:s,status:r,err_msg:o,result:i}=f[a],{bgClass:c,icon:u}=null!==(t=ed[r])&&void 0!==t?t:{};return(0,n.jsxs)("div",{className:"bg-white dark:bg-[#212121] rounded-lg overflow-hidden my-2 flex flex-col lg:max-w-[80%]",children:[(0,n.jsxs)("div",{className:d()("flex px-4 md:px-6 py-2 items-center text-white text-sm",c),children:[s,u]}),i?(0,n.jsx)("div",{className:"px-4 md:px-6 py-4 text-sm",children:(0,n.jsx)(W.Z,{components:X.Z,rehypePlugins:[K.Z],remarkPlugins:[ei.Z],children:null!=i?i:""})}):(0,n.jsx)("div",{className:"px-4 md:px-6 py-4 text-sm",children:o})]})}}),[i,f]);return m||i?(0,n.jsxs)("div",{className:d()("relative flex flex-wrap w-full p-2 md:p-4 rounded-xl break-words",{"bg-white dark:bg-[#232734]":m,"lg:w-full xl:w-full pl-0":["chat_with_db_execute","chat_dashboard"].includes(o)}),children:[(0,n.jsx)("div",{className:"mr-2 flex flex-shrink-0 items-center justify-center h-7 w-7 rounded-full text-lg sm:mr-4",children:m?(0,ec.A)(c)||(0,n.jsx)(ea.Z,{}):(0,n.jsx)(es.Z,{})}),(0,n.jsxs)("div",{className:"flex-1 overflow-hidden items-center text-md leading-8 pb-2",children:[!m&&"string"==typeof i&&i,m&&s&&"object"==typeof i&&(0,n.jsxs)("div",{children:["[".concat(i.template_name,"]: "),(0,n.jsxs)("span",{className:"text-theme-primary cursor-pointer",onClick:r,children:[(0,n.jsx)(er.Z,{className:"mr-1"}),i.template_introduce||"More Details"]})]}),m&&"string"==typeof i&&(0,n.jsx)(W.Z,{components:{...X.Z,...v},rehypePlugins:[K.Z],remarkPlugins:[ei.Z],children:eu(p)}),!!(null==h?void 0:h.length)&&(0,n.jsx)("div",{className:"flex flex-wrap mt-2",children:null==h?void 0:h.map((e,t)=>(0,n.jsx)(eo.Z,{color:"#108ee9",children:e},e+t))})]}),t]}):(0,n.jsx)("div",{className:"h-12"})}),em=l(59301),eh=l(41132),ep=l(74312),ef=l(3414),ev=l(72868),eg=l(59562),ej=l(25359),ew=l(7203),eb=l(48665),ey=l(26047),eZ=l(99056),e_=l(57814),eN=l(64415),eC=l(21694),eP=l(40911),ek=e=>{var t;let{conv_index:l,question:r,knowledge_space:o,select_param:i}=e,{t:c}=(0,P.$G)(),{chatId:d}=(0,x.useContext)(a.p),[u,m]=(0,x.useState)(""),[h,p]=(0,x.useState)(4),[f,v]=(0,x.useState)(""),g=(0,x.useRef)(null),[Z,_]=b.ZP.useMessage(),N=(0,x.useCallback)((e,t)=>{t?(0,s.Vx)((0,s.Eb)(d,l)).then(e=>{var t,l,n,a;let s=null!==(t=e[1])&&void 0!==t?t:{};m(null!==(l=s.ques_type)&&void 0!==l?l:""),p(parseInt(null!==(n=s.score)&&void 0!==n?n:"4")),v(null!==(a=s.messages)&&void 0!==a?a:"")}).catch(e=>{console.log(e)}):(m(""),p(4),v(""))},[d,l]),C=(0,ep.Z)(ef.Z)(e=>{let{theme:t}=e;return{backgroundColor:"dark"===t.palette.mode?"#FBFCFD":"#0E0E10",...t.typography["body-sm"],padding:t.spacing(1),display:"flex",alignItems:"center",justifyContent:"center",borderRadius:4,width:"100%",height:"100%"}});return(0,n.jsxs)(ev.L,{onOpenChange:N,children:[_,(0,n.jsx)(y.Z,{title:c("Rating"),children:(0,n.jsx)(eg.Z,{slots:{root:w.ZP},slotProps:{root:{variant:"plain",color:"primary"}},sx:{borderRadius:40},children:(0,n.jsx)(em.Z,{})})}),(0,n.jsxs)(ej.Z,{children:[(0,n.jsx)(ew.Z,{disabled:!0,sx:{minHeight:0}}),(0,n.jsx)(eb.Z,{sx:{width:"100%",maxWidth:350,display:"grid",gap:3,padding:1},children:(0,n.jsx)("form",{onSubmit:e=>{e.preventDefault(),(0,s.Vx)((0,s.VC)({data:{conv_uid:d,conv_index:l,question:r,knowledge_space:o,score:h,ques_type:u,messages:f}})).then(e=>{Z.open({type:"success",content:"save success"})}).catch(e=>{Z.open({type:"error",content:"save error"})})},children:(0,n.jsxs)(ey.Z,{container:!0,spacing:.5,columns:13,sx:{flexGrow:1},children:[(0,n.jsx)(ey.Z,{xs:3,children:(0,n.jsx)(C,{children:c("Q_A_Category")})}),(0,n.jsx)(ey.Z,{xs:10,children:(0,n.jsx)(eZ.Z,{action:g,value:u,placeholder:"Choose one…",onChange:(e,t)=>m(null!=t?t:""),...u&&{endDecorator:(0,n.jsx)(w.ZP,{size:"sm",variant:"plain",color:"neutral",onMouseDown:e=>{e.stopPropagation()},onClick:()=>{var e;m(""),null===(e=g.current)||void 0===e||e.focusVisible()},children:(0,n.jsx)(eh.Z,{})}),indicator:null},sx:{width:"100%"},children:i&&(null===(t=Object.keys(i))||void 0===t?void 0:t.map(e=>(0,n.jsx)(e_.Z,{value:e,children:i[e]},e)))})}),(0,n.jsx)(ey.Z,{xs:3,children:(0,n.jsx)(C,{children:(0,n.jsx)(y.Z,{title:(0,n.jsx)(eb.Z,{children:(0,n.jsx)("div",{children:c("feed_back_desc")})}),variant:"solid",placement:"left",children:c("Q_A_Rating")})})}),(0,n.jsx)(ey.Z,{xs:10,sx:{pl:0,ml:0},children:(0,n.jsx)(eN.Z,{"aria-label":"Custom",step:1,min:0,max:5,valueLabelFormat:function(e){return({0:c("Lowest"),1:c("Missed"),2:c("Lost"),3:c("Incorrect"),4:c("Verbose"),5:c("Best")})[e]},valueLabelDisplay:"on",marks:[{value:0,label:"0"},{value:1,label:"1"},{value:2,label:"2"},{value:3,label:"3"},{value:4,label:"4"},{value:5,label:"5"}],sx:{width:"90%",pt:3,m:2,ml:1},onChange:e=>{var t;return p(null===(t=e.target)||void 0===t?void 0:t.value)},value:h})}),(0,n.jsx)(ey.Z,{xs:13,children:(0,n.jsx)(eC.Z,{placeholder:c("Please_input_the_text"),value:f,onChange:e=>v(e.target.value),minRows:2,maxRows:4,endDecorator:(0,n.jsx)(eP.ZP,{level:"body-xs",sx:{ml:"auto"},children:c("input_count")+f.length+c("input_unit")}),sx:{width:"100%",fontSize:14}})}),(0,n.jsx)(ey.Z,{xs:13,children:(0,n.jsx)(j.Z,{type:"submit",variant:"outlined",sx:{width:"100%",height:"100%"},children:c("submit")})})]})})})]})]})},eS=l(74434),eR=e=>{var t,l;let{messages:r,onSubmit:c}=e,{dbParam:m,currentDialogue:p,scene:_,model:k,refreshDialogList:S,chatId:R,agent:E,docId:I}=(0,x.useContext)(a.p),{t:D}=(0,P.$G)(),F=(0,u.useSearchParams)(),M=null!==(t=F&&F.get("select_param"))&&void 0!==t?t:"",U=null!==(l=F&&F.get("spaceNameOriginal"))&&void 0!==l?l:"",[L,O]=(0,x.useState)(!1),[$,A]=(0,x.useState)(!1),[V,G]=(0,x.useState)(r),[z,H]=(0,x.useState)(""),[q,B]=(0,x.useState)(),T=(0,x.useRef)(null),J=(0,x.useMemo)(()=>"chat_dashboard"===_,[_]),W=f(),K=(0,x.useMemo)(()=>{switch(_){case"chat_agent":return E;case"chat_excel":return null==p?void 0:p.select_param;case"chat_flow":return M;default:return U||m}},[_,E,p,m,U,M]),X=async e=>{if(!L&&e.trim()){if("chat_agent"===_&&!E){b.ZP.warning(D("choice_agent_tip"));return}try{O(!0),await c(e,{select_param:null!=K?K:""})}finally{O(!1)}}},ee=e=>{try{return JSON.parse(e)}catch(t){return e}},[et,el]=b.ZP.useMessage(),en=async e=>{let t=null==e?void 0:e.replace(/\trelations:.*/g,""),l=N()(t);l?t?et.open({type:"success",content:D("copy_success")}):et.open({type:"warning",content:D("copy_nothing")}):et.open({type:"error",content:D("copy_failed")})},ea=async()=>{!L&&I&&(O(!0),await W(I),O(!1))};return(0,i.Z)(async()=>{let e=(0,o.a_)();e&&e.id===R&&(await X(e.message),S(),localStorage.removeItem(o.rU))},[R]),(0,x.useEffect)(()=>{let e=r;J&&(e=(0,C.cloneDeep)(r).map(e=>((null==e?void 0:e.role)==="view"&&"string"==typeof(null==e?void 0:e.context)&&(e.context=ee(null==e?void 0:e.context)),e))),G(e.filter(e=>["view","human"].includes(e.role)))},[J,r]),(0,x.useEffect)(()=>{(0,s.Vx)((0,s.Lu)()).then(e=>{var t;B(null!==(t=e[1])&&void 0!==t?t:{})}).catch(e=>{console.log(e)})},[]),(0,x.useEffect)(()=>{setTimeout(()=>{var e;null===(e=T.current)||void 0===e||e.scrollTo(0,T.current.scrollHeight)},50)},[r]),(0,n.jsxs)(n.Fragment,{children:[el,(0,n.jsx)("div",{ref:T,className:"flex flex-1 overflow-y-auto pb-8 w-full flex-col",children:(0,n.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:V.length?V.map((e,t)=>{var l;return"chat_agent"===_?(0,n.jsx)(Y,{content:e},t):(0,n.jsx)(ex,{content:e,isChartChat:J,onLinkClick:()=>{A(!0),H(JSON.stringify(null==e?void 0:e.context,null,2))},children:"view"===e.role&&(0,n.jsxs)("div",{className:"flex w-full border-t border-gray-200 dark:border-theme-dark",children:["chat_knowledge"===_&&e.retry?(0,n.jsxs)(j.Z,{onClick:ea,slots:{root:w.ZP},slotProps:{root:{variant:"plain",color:"primary"}},children:[(0,n.jsx)(v.Z,{}),"\xa0",(0,n.jsx)("span",{className:"text-sm",children:D("Retry")})]}):null,(0,n.jsxs)("div",{className:"flex w-full flex-row-reverse",children:[(0,n.jsx)(ek,{select_param:q,conv_index:Math.ceil((t+1)/2),question:null===(l=null==V?void 0:V.filter(t=>(null==t?void 0:t.role)==="human"&&(null==t?void 0:t.order)===e.order)[0])||void 0===l?void 0:l.context,knowledge_space:U||m||""}),(0,n.jsx)(y.Z,{title:D("Copy_Btn"),children:(0,n.jsx)(j.Z,{onClick:()=>en(null==e?void 0:e.context),slots:{root:w.ZP},slotProps:{root:{variant:"plain",color:"primary"}},sx:{borderRadius:40},children:(0,n.jsx)(g.Z,{})})})]})]})},t)}):(0,n.jsx)(h.Z,{description:"Start a conversation"})})}),(0,n.jsx)("div",{className:d()("relative after:absolute after:-top-8 after:h-8 after:w-full after:bg-gradient-to-t after:from-theme-light after:to-transparent dark:after:from-theme-dark",{"cursor-not-allowed":"chat_excel"===_&&!(null==p?void 0:p.select_param)}),children:(0,n.jsxs)("div",{className:"flex flex-wrap w-full py-2 sm:pt-6 sm:pb-10 items-center",children:[k&&(0,n.jsx)("div",{className:"mr-2 flex",children:(0,ec.A)(k)}),(0,n.jsx)(Q,{loading:L,onSubmit:X,handleFinish:O})]})}),(0,n.jsx)(Z.default,{title:"JSON Editor",open:$,width:"60%",cancelButtonProps:{hidden:!0},onOk:()=>{A(!1)},onCancel:()=>{A(!1)},children:(0,n.jsx)(eS.Z,{className:"w-full h-[500px]",language:"json",value:z})})]})},eE=l(34625),eI=()=>{var e;let t=(0,u.useSearchParams)(),{scene:l,chatId:c,model:f,agent:v,setModel:g,history:j,setHistory:w}=(0,x.useContext)(a.p),{chat:b}=(0,r.Z)({}),y=null!==(e=t&&t.get("initMessage"))&&void 0!==e?e:"",[Z,_]=(0,x.useState)(!1),[N,C]=(0,x.useState)(),P=async()=>{_(!0);let[,e]=await (0,s.Vx)((0,s.$i)(c));w(null!=e?e:[]),_(!1)},k=e=>{var t;let l=null===(t=e[e.length-1])||void 0===t?void 0:t.context;if(l)try{let e="string"==typeof l?JSON.parse(l):l;C((null==e?void 0:e.template_name)==="report"?null==e?void 0:e.charts:void 0)}catch(e){console.log(e),C([])}};(0,i.Z)(async()=>{let e=(0,o.a_)();e&&e.id===c||await P()},[y,c]),(0,x.useEffect)(()=>{var e,t;if(!j.length)return;let l=null===(e=null===(t=j.filter(e=>"view"===e.role))||void 0===t?void 0:t.slice(-1))||void 0===e?void 0:e[0];(null==l?void 0:l.model_name)&&g(l.model_name),k(j)},[j.length]),(0,x.useEffect)(()=>()=>{w([])},[]);let S=(0,x.useCallback)((e,t)=>new Promise(n=>{let a=[...j,{role:"human",context:e,model_name:f,order:0,time_stamp:0},{role:"view",context:"",model_name:f,order:0,time_stamp:0}],s=a.length-1;w([...a]),b({data:{...t,chat_mode:l||"chat_normal",model_name:f,user_input:e},chatId:c,onMessage:e=>{(null==t?void 0:t.incremental)?a[s].context+=e:a[s].context=e,w([...a])},onDone:()=>{k(a),n()},onClose:()=>{k(a),n()},onError:e=>{a[s].context=e,w([...a]),n()}})}),[j,b,c,f,v,l]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.Z,{visible:Z}),(0,n.jsx)(eE.Z,{refreshHistory:P,modelChange:e=>{g(e)}}),(0,n.jsxs)("div",{className:"px-4 flex flex-1 flex-wrap overflow-hidden relative",children:[!!(null==N?void 0:N.length)&&(0,n.jsx)("div",{className:"w-full pb-4 xl:w-3/4 h-1/2 xl:pr-4 xl:h-full overflow-y-auto",children:(0,n.jsx)(m.ZP,{chartsData:N})}),!(null==N?void 0:N.length)&&"chat_dashboard"===l&&(0,n.jsx)(h.Z,{className:"w-full xl:w-3/4 h-1/2 xl:h-full"}),(0,n.jsx)("div",{className:d()("flex flex-1 flex-col overflow-hidden",{"px-0 xl:pl-4 h-1/2 w-full xl:w-auto xl:h-full border-t xl:border-t-0 xl:border-l dark:border-gray-800":"chat_dashboard"===l,"h-full lg:px-8":"chat_dashboard"!==l}),children:(0,n.jsx)(eR,{messages:j,onSubmit:S})})]})]})}},34625:function(e,t,l){"use strict";l.d(t,{Z:function(){return R}});var n=l(85893),a=l(41468),s=l(81799),r=l(82353),o=l(16165),i=l(96991),c=l(78045),d=l(67294);function u(){let{isContract:e,setIsContract:t,scene:l}=(0,d.useContext)(a.p),s=l&&["chat_with_db_execute","chat_dashboard"].includes(l);return s?(0,n.jsxs)(c.ZP.Group,{value:e,defaultValue:!0,buttonStyle:"solid",onChange:()=>{t(!e)},children:[(0,n.jsxs)(c.ZP.Button,{value:!1,children:[(0,n.jsx)(o.Z,{component:r.ig,className:"mr-1"}),"Preview"]}),(0,n.jsxs)(c.ZP.Button,{value:!0,children:[(0,n.jsx)(i.Z,{className:"mr-1"}),"Editor"]})]}):null}l(23293);var x=l(76212),m=l(65654),h=l(34041),p=l(67421),f=function(){let{t:e}=(0,p.$G)(),{agent:t,setAgent:l}=(0,d.useContext)(a.p),{data:s=[]}=(0,m.Z)(async()=>{let[,e]=await (0,x.Vx)((0,x.H4)());return null!=e?e:[]});return(0,n.jsx)(h.default,{className:"w-60",value:t,placeholder:e("Select_Plugins"),options:s.map(e=>({label:e.app_name,value:e.app_code})),allowClear:!0,onChange:e=>{null==l||l(e)}})},v=l(29158),g=l(49591),j=l(88484),w=l(45360),b=l(83062),y=l(23799),Z=l(14726),_=function(e){var t;let{convUid:l,chatMode:s,onComplete:r,...o}=e,[i,c]=(0,d.useState)(!1),[u,m]=w.ZP.useMessage(),[h,p]=(0,d.useState)([]),[f,_]=(0,d.useState)(),{model:N}=(0,d.useContext)(a.p),C=async e=>{var t;if(!e){w.ZP.error("Please select the *.(csv|xlsx|xls) file");return}if(!/\.(csv|xlsx|xls)$/.test(null!==(t=e.file.name)&&void 0!==t?t:"")){w.ZP.error("File type must be csv, xlsx or xls");return}p([e.file])},P=async()=>{c(!0);try{let e=new FormData;e.append("doc_file",h[0]),u.open({content:"Uploading ".concat(h[0].name),type:"loading",duration:0});let[t]=await (0,x.Vx)((0,x.qn)({convUid:l,chatMode:s,data:e,model:N,config:{timeout:36e5,onUploadProgress:e=>{let t=Math.ceil(e.loaded/(e.total||0)*100);_(t)}}}));if(t)return;w.ZP.success("success"),null==r||r()}catch(e){w.ZP.error((null==e?void 0:e.message)||"Upload Error")}finally{c(!1),u.destroy()}};return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"flex items-start gap-2",children:[m,(0,n.jsx)(b.Z,{placement:"bottom",title:"File cannot be changed after upload",children:(0,n.jsx)(y.default,{disabled:i,className:"mr-1",beforeUpload:()=>!1,fileList:h,name:"file",accept:".csv,.xlsx,.xls",multiple:!1,onChange:C,showUploadList:{showDownloadIcon:!1,showPreviewIcon:!1,showRemoveIcon:!1},itemRender:()=>(0,n.jsx)(n.Fragment,{}),...o,children:(0,n.jsx)(Z.ZP,{className:"flex justify-center items-center",type:"primary",disabled:i,icon:(0,n.jsx)(g.Z,{}),children:"Select File"})})}),(0,n.jsx)(Z.ZP,{type:"primary",loading:i,className:"flex justify-center items-center",disabled:!h.length,icon:(0,n.jsx)(j.Z,{}),onClick:P,children:i?100===f?"Analysis":"Uploading":"Upload"}),!!h.length&&(0,n.jsxs)("div",{className:"mt-2 text-gray-500 text-sm flex items-center",onClick:()=>p([]),children:[(0,n.jsx)(v.Z,{className:"mr-2"}),(0,n.jsx)("span",{children:null===(t=h[0])||void 0===t?void 0:t.name})]})]})})},N=function(e){let{onComplete:t}=e,{currentDialogue:l,scene:s,chatId:r}=(0,d.useContext)(a.p);return"chat_excel"!==s?null:(0,n.jsx)("div",{className:"max-w-md h-full relative",children:l?(0,n.jsxs)("div",{className:"flex h-8 overflow-hidden rounded",children:[(0,n.jsx)("div",{className:"flex items-center justify-center px-2 bg-gray-600 text-lg",children:(0,n.jsx)(v.Z,{className:"text-white"})}),(0,n.jsx)("div",{className:"flex items-center justify-center px-3 bg-gray-100 text-xs rounded-tr rounded-br dark:text-gray-800 truncate",children:l.select_param})]}):(0,n.jsx)(_,{convUid:r,chatMode:s,onComplete:t})})},C=l(98978),P=l(62418),k=l(2093),S=function(){let{scene:e,dbParam:t,setDbParam:l}=(0,d.useContext)(a.p),[s,r]=(0,d.useState)([]);(0,k.Z)(async()=>{let[,t]=await (0,x.Vx)((0,x.vD)(e));r(null!=t?t:[])},[e]);let o=(0,d.useMemo)(()=>{var e;return null===(e=s.map)||void 0===e?void 0:e.call(s,e=>({name:e.param,...P.S$[e.type]}))},[s]);return((0,d.useEffect)(()=>{(null==o?void 0:o.length)&&!t&&l(o[0].name)},[o,l,t]),null==o?void 0:o.length)?(0,n.jsx)(h.default,{value:t,className:"w-36",onChange:e=>{l(e)},children:o.map(e=>(0,n.jsxs)(h.default.Option,{children:[(0,n.jsx)(C.Z,{width:24,height:24,src:e.icon,label:e.label,className:"w-[1.5em] h-[1.5em] mr-1 inline-block mt-[-4px]"}),e.name]},e.name))}):null},R=function(e){let{refreshHistory:t,modelChange:l}=e,{scene:r,refreshDialogList:o}=(0,d.useContext)(a.p);return(0,n.jsxs)("div",{className:"w-full py-2 px-4 md:px-4 flex flex-wrap items-center justify-center gap-1 md:gap-4",children:[(0,n.jsx)(s.Z,{onChange:l}),(0,n.jsx)(S,{}),"chat_excel"===r&&(0,n.jsx)(N,{onComplete:()=>{null==o||o(),null==t||t()}}),"chat_agent"===r&&(0,n.jsx)(f,{}),(0,n.jsx)(u,{})]})}},81799:function(e,t,l){"use strict";l.d(t,{A:function(){return x}});var n=l(85893),a=l(41468),s=l(19284),r=l(34041),o=l(25675),i=l.n(o),c=l(67294),d=l(67421);let u="/models/huggingface.svg";function x(e,t){var l,a;let{width:r,height:o}=t||{};return e?(0,n.jsx)(i(),{className:"rounded-full border border-gray-200 object-contain bg-white inline-block",width:r||24,height:o||24,src:(null===(l=s.Hf[e])||void 0===l?void 0:l.icon)||u,alt:"llm"},(null===(a=s.Hf[e])||void 0===a?void 0:a.icon)||u):null}t.Z=function(e){let{onChange:t}=e,{t:l}=(0,d.$G)(),{modelList:o,model:i}=(0,c.useContext)(a.p);return!o||o.length<=0?null:(0,n.jsx)(r.default,{value:i,placeholder:l("choose_model"),className:"w-52",onChange:e=>{null==t||t(e)},children:o.map(e=>{var t;return(0,n.jsx)(r.default.Option,{children:(0,n.jsxs)("div",{className:"flex items-center",children:[x(e),(0,n.jsx)("span",{className:"ml-2",children:(null===(t=s.Hf[e])||void 0===t?void 0:t.label)||e})]})},e)})})}},91085:function(e,t,l){"use strict";var n=l(85893),a=l(32983),s=l(14726),r=l(93967),o=l.n(r),i=l(67421);t.Z=function(e){let{className:t,error:l,description:r,refresh:c}=e,{t:d}=(0,i.$G)();return(0,n.jsx)(a.Z,{image:"/empty.png",imageStyle:{width:320,height:196,margin:"0 auto",maxWidth:"100%",maxHeight:"100%"},className:o()("flex items-center justify-center flex-col h-full w-full",t),description:l?(0,n.jsx)(s.ZP,{type:"primary",onClick:c,children:d("try_again")}):null!=r?r:d("no_data")})}},45247:function(e,t,l){"use strict";var n=l(85893),a=l(50888);t.Z=function(e){let{visible:t}=e;return t?(0,n.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 backdrop-blur-sm text-3xl animate-fade animate-duration-200",children:(0,n.jsx)(a.Z,{})}):null}},2440:function(e,t,l){"use strict";var n=l(25519);t.Z=()=>{var e;return JSON.parse(null!==(e=localStorage.getItem(n.C9))&&void 0!==e?e:"")}},30119:function(e,t,l){"use strict";l.d(t,{Tk:function(){return c},PR:function(){return d}});var n=l(62418),a=l(45360);l(96486);var s=l(87066),r=l(83454);let o=s.default.create({baseURL:r.env.API_BASE_URL});o.defaults.timeout=1e4,o.interceptors.response.use(e=>e.data,e=>Promise.reject(e));let i={"content-type":"application/json","User-Id":(0,n.n5)()},c=(e,t)=>{if(t){let l=Object.keys(t).filter(e=>void 0!==t[e]&&""!==t[e]).map(e=>"".concat(e,"=").concat(t[e])).join("&");l&&(e+="?".concat(l))}return o.get("/api"+e,{headers:i}).then(e=>e).catch(e=>{a.ZP.error(e),Promise.reject(e)})},d=(e,t)=>o.post(e,t,{headers:i}).then(e=>e).catch(e=>{a.ZP.error(e),Promise.reject(e)})},23293:function(){}}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4769],{36517:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return eI}});var n=l(85893),a=l(41468),s=l(76212),r=l(43446),o=l(62418),i=l(2093),c=l(93967),d=l.n(c),u=l(39332),x=l(67294),m=l(39156),h=l(91085),p=l(45247),f=()=>{let{history:e,setHistory:t,chatId:l,model:n,docId:o}=(0,x.useContext)(a.p),{chat:i}=(0,r.Z)({queryAgentURL:"/knowledge/document/summary"}),c=(0,x.useCallback)(async e=>{let[,a]=await (0,s.Vx)((0,s.$i)(l)),r=[...a,{role:"human",context:"",model_name:n,order:0,time_stamp:0},{role:"view",context:"",model_name:n,order:0,time_stamp:0,retry:!0}],c=r.length-1;t([...r]),await i({data:{doc_id:e||o,model_name:n},chatId:l,onMessage:e=>{r[c].context=e,t([...r])}})},[e,n,o,l]);return c},v=l(87740),g=l(57132),j=l(66478),w=l(14553),b=l(45360),y=l(83062),Z=l(85576),_=l(20640),N=l.n(_),C=l(96486),P=l(67421),k=l(27496),S=l(25278),R=l(14726),E=l(11163),I=l(82353),D=l(1051);function F(e){let{document:t}=e;switch(t.status){case"RUNNING":return(0,n.jsx)(I.Rp,{});case"FINISHED":default:return(0,n.jsx)(I.s2,{});case"FAILED":return(0,n.jsx)(D.Z,{})}}function M(e){let{documents:t,dbParam:l}=e,a=(0,E.useRouter)(),s=e=>{a.push("/knowledge/chunk/?spaceName=".concat(l,"&id=").concat(e))};return(null==t?void 0:t.length)?(0,n.jsx)("div",{className:"absolute flex overflow-scroll h-12 top-[-35px] w-full z-10",children:t.map(e=>{let t;switch(e.status){case"RUNNING":t="#2db7f5";break;case"FINISHED":default:t="#87d068";break;case"FAILED":t="#f50"}return(0,n.jsx)(y.Z,{title:e.result,children:(0,n.jsxs)(R.ZP,{style:{color:t},onClick:()=>{s(e.id)},className:"shrink flex items-center mr-3",children:[(0,n.jsx)(F,{document:e}),e.doc_name]})},e.id)})}):null}var U=l(5392),L=l(23799);function O(e){let{dbParam:t,setDocId:l}=(0,x.useContext)(a.p),{onUploadFinish:r,handleFinish:o}=e,i=f(),[c,d]=(0,x.useState)(!1),u=async e=>{d(!0);let n=new FormData;n.append("doc_name",e.file.name),n.append("doc_file",e.file),n.append("doc_type","DOCUMENT");let a=await (0,s.Vx)((0,s.iG)(t||"default",n));if(!a[1]){d(!1);return}l(a[1]),r(),d(!1),null==o||o(!0),await i(a[1]),null==o||o(!1)};return(0,n.jsx)(L.default,{customRequest:u,showUploadList:!1,maxCount:1,multiple:!1,className:"absolute z-10 top-2 left-2",accept:".pdf,.ppt,.pptx,.xls,.xlsx,.doc,.docx,.txt,.md",children:(0,n.jsx)(R.ZP,{loading:c,size:"small",shape:"circle",icon:(0,n.jsx)(U.Z,{})})})}var $=l(30119),A=l(65654),V=l(2487),G=l(28459),z=l(55241),H=l(99859),q=l(34041),B=l(12652);let T=e=>{let{data:t,loading:l,submit:a,close:s}=e,{t:r}=(0,P.$G)(),o=e=>()=>{a(e),s()};return(0,n.jsx)("div",{style:{maxHeight:400,overflow:"auto"},children:(0,n.jsx)(V.Z,{dataSource:null==t?void 0:t.data,loading:l,rowKey:e=>e.prompt_name,renderItem:e=>(0,n.jsx)(V.Z.Item,{onClick:o(e.content),children:(0,n.jsx)(y.Z,{title:e.content,children:(0,n.jsx)(V.Z.Item.Meta,{style:{cursor:"copy"},title:e.prompt_name,description:r("Prompt_Info_Scene")+":".concat(e.chat_scene,",")+r("Prompt_Info_Sub_Scene")+":".concat(e.sub_chat_scene)})})},e.prompt_name)})})};var J=e=>{let{submit:t}=e,{t:l}=(0,P.$G)(),[a,s]=(0,x.useState)(!1),[r,o]=(0,x.useState)("common"),{data:i,loading:c}=(0,A.Z)(()=>(0,$.PR)("/prompt/list",{prompt_type:r}),{refreshDeps:[r],onError:e=>{b.ZP.error(null==e?void 0:e.message)}});return(0,n.jsx)(G.ZP,{theme:{components:{Popover:{minWidth:250}}},children:(0,n.jsx)(z.Z,{title:(0,n.jsx)(H.default.Item,{label:"Prompt "+l("Type"),children:(0,n.jsx)(q.default,{style:{width:150},value:r,onChange:e=>{o(e)},options:[{label:l("Public")+" Prompts",value:"common"},{label:l("Private")+" Prompts",value:"private"}]})}),content:(0,n.jsx)(T,{data:i,loading:c,submit:t,close:()=>{s(!1)}}),placement:"topRight",trigger:"click",open:a,onOpenChange:e=>{s(e)},children:(0,n.jsx)(y.Z,{title:l("Click_Select")+" Prompt",children:(0,n.jsx)(B.Z,{className:"bottom-[30%]"})})})})},Q=function(e){let{children:t,loading:l,onSubmit:r,handleFinish:o,placeholder:i,...c}=e,{dbParam:d,scene:u}=(0,x.useContext)(a.p),[m,h]=(0,x.useState)(""),p=(0,x.useMemo)(()=>"chat_knowledge"===u,[u]),[f,v]=(0,x.useState)([]),g=(0,x.useRef)(0);async function j(){if(!d)return null;let[e,t]=await (0,s.Vx)((0,s._Q)(d,{page:1,page_size:g.current}));v((null==t?void 0:t.data)||[])}(0,x.useEffect)(()=>{p&&j()},[d]);let w=async()=>{g.current+=1,await j()};return(0,n.jsxs)("div",{className:"flex-1 relative",children:[(0,n.jsx)(M,{documents:f,dbParam:d}),p&&(0,n.jsx)(O,{handleFinish:o,onUploadFinish:w,className:"absolute z-10 top-2 left-2"}),(0,n.jsx)(S.default.TextArea,{className:"flex-1 ".concat(p?"pl-10":""," pr-10"),size:"large",value:m,autoSize:{minRows:1,maxRows:4},...c,onPressEnter:e=>{if(m.trim()&&13===e.keyCode){if(e.shiftKey){e.preventDefault(),h(e=>e+"\n");return}r(m),setTimeout(()=>{h("")},0)}},onChange:e=>{if("number"==typeof c.maxLength){h(e.target.value.substring(0,c.maxLength));return}h(e.target.value)},placeholder:i}),(0,n.jsx)(R.ZP,{className:"ml-2 flex items-center justify-center absolute right-0 bottom-0",size:"large",type:"text",loading:l,icon:(0,n.jsx)(k.Z,{}),onClick:()=>{r(m)}}),(0,n.jsx)(J,{submit:e=>{h(m+e)}}),t]})},W=l(87554),K=l(14660),X=l(30853),Y=(0,x.memo)(function(e){var t;let{content:l}=e,{scene:s}=(0,x.useContext)(a.p),r="view"===l.role;return(0,n.jsx)("div",{className:d()("relative w-full p-2 md:p-4 rounded-xl break-words",{"bg-white dark:bg-[#232734]":r,"lg:w-full xl:w-full pl-0":["chat_with_db_execute","chat_dashboard"].includes(s)}),children:r?(0,n.jsx)(W.Z,{components:X.Z,rehypePlugins:[K.Z],children:null==(t=l.context)?void 0:t.replace(/]+)>/gi,"
").replace(/]+)>/gi,"")}):(0,n.jsx)("div",{className:"",children:l.context})})}),ee=l(24019),et=l(50888),el=l(97937),en=l(63606),ea=l(50228),es=l(87547),er=l(89035),eo=l(66309),ei=l(55186),ec=l(81799);let ed={todo:{bgClass:"bg-gray-500",icon:(0,n.jsx)(ee.Z,{className:"ml-2"})},runing:{bgClass:"bg-blue-500",icon:(0,n.jsx)(et.Z,{className:"ml-2"})},failed:{bgClass:"bg-red-500",icon:(0,n.jsx)(el.Z,{className:"ml-2"})},completed:{bgClass:"bg-green-500",icon:(0,n.jsx)(en.Z,{className:"ml-2"})}};function eu(e){return e.replaceAll("\\n","\n").replace(/]+)>/gi,"
").replace(/]+)>/gi,"")}var ex=(0,x.memo)(function(e){let{children:t,content:l,isChartChat:s,onLinkClick:r}=e,{scene:o}=(0,x.useContext)(a.p),{context:i,model_name:c,role:u}=l,m="view"===u,{relations:h,value:p,cachePluginContext:f}=(0,x.useMemo)(()=>{if("string"!=typeof i)return{relations:[],value:"",cachePluginContext:[]};let[e,t]=i.split(" relations:"),l=t?t.split(","):[],n=[],a=0,s=e.replace(/]*>[^<]*<\/dbgpt-view>/gi,e=>{try{var t;let l=e.replaceAll("\n","\\n").replace(/<[^>]*>|<\/[^>]*>/gm,""),s=JSON.parse(l),r="".concat(a,"");return n.push({...s,result:eu(null!==(t=s.result)&&void 0!==t?t:"")}),a++,r}catch(t){return console.log(t.message,t),e}});return{relations:l,cachePluginContext:n,value:s}},[i]),v=(0,x.useMemo)(()=>({"custom-view"(e){var t;let{children:l}=e,a=+l.toString();if(!f[a])return l;let{name:s,status:r,err_msg:o,result:i}=f[a],{bgClass:c,icon:u}=null!==(t=ed[r])&&void 0!==t?t:{};return(0,n.jsxs)("div",{className:"bg-white dark:bg-[#212121] rounded-lg overflow-hidden my-2 flex flex-col lg:max-w-[80%]",children:[(0,n.jsxs)("div",{className:d()("flex px-4 md:px-6 py-2 items-center text-white text-sm",c),children:[s,u]}),i?(0,n.jsx)("div",{className:"px-4 md:px-6 py-4 text-sm",children:(0,n.jsx)(W.Z,{components:X.Z,rehypePlugins:[K.Z],remarkPlugins:[ei.Z],children:null!=i?i:""})}):(0,n.jsx)("div",{className:"px-4 md:px-6 py-4 text-sm",children:o})]})}}),[i,f]);return m||i?(0,n.jsxs)("div",{className:d()("relative flex flex-wrap w-full p-2 md:p-4 rounded-xl break-words",{"bg-white dark:bg-[#232734]":m,"lg:w-full xl:w-full pl-0":["chat_with_db_execute","chat_dashboard"].includes(o)}),children:[(0,n.jsx)("div",{className:"mr-2 flex flex-shrink-0 items-center justify-center h-7 w-7 rounded-full text-lg sm:mr-4",children:m?(0,ec.A)(c)||(0,n.jsx)(ea.Z,{}):(0,n.jsx)(es.Z,{})}),(0,n.jsxs)("div",{className:"flex-1 overflow-hidden items-center text-md leading-8 pb-2",children:[!m&&"string"==typeof i&&i,m&&s&&"object"==typeof i&&(0,n.jsxs)("div",{children:["[".concat(i.template_name,"]: "),(0,n.jsxs)("span",{className:"text-theme-primary cursor-pointer",onClick:r,children:[(0,n.jsx)(er.Z,{className:"mr-1"}),i.template_introduce||"More Details"]})]}),m&&"string"==typeof i&&(0,n.jsx)(W.Z,{components:{...X.Z,...v},rehypePlugins:[K.Z],remarkPlugins:[ei.Z],children:eu(p)}),!!(null==h?void 0:h.length)&&(0,n.jsx)("div",{className:"flex flex-wrap mt-2",children:null==h?void 0:h.map((e,t)=>(0,n.jsx)(eo.Z,{color:"#108ee9",children:e},e+t))})]}),t]}):(0,n.jsx)("div",{className:"h-12"})}),em=l(59301),eh=l(41132),ep=l(74312),ef=l(3414),ev=l(72868),eg=l(59562),ej=l(25359),ew=l(7203),eb=l(48665),ey=l(26047),eZ=l(99056),e_=l(57814),eN=l(64415),eC=l(21694),eP=l(40911),ek=e=>{var t;let{conv_index:l,question:r,knowledge_space:o,select_param:i}=e,{t:c}=(0,P.$G)(),{chatId:d}=(0,x.useContext)(a.p),[u,m]=(0,x.useState)(""),[h,p]=(0,x.useState)(4),[f,v]=(0,x.useState)(""),g=(0,x.useRef)(null),[Z,_]=b.ZP.useMessage(),N=(0,x.useCallback)((e,t)=>{t?(0,s.Vx)((0,s.Eb)(d,l)).then(e=>{var t,l,n,a;let s=null!==(t=e[1])&&void 0!==t?t:{};m(null!==(l=s.ques_type)&&void 0!==l?l:""),p(parseInt(null!==(n=s.score)&&void 0!==n?n:"4")),v(null!==(a=s.messages)&&void 0!==a?a:"")}).catch(e=>{console.log(e)}):(m(""),p(4),v(""))},[d,l]),C=(0,ep.Z)(ef.Z)(e=>{let{theme:t}=e;return{backgroundColor:"dark"===t.palette.mode?"#FBFCFD":"#0E0E10",...t.typography["body-sm"],padding:t.spacing(1),display:"flex",alignItems:"center",justifyContent:"center",borderRadius:4,width:"100%",height:"100%"}});return(0,n.jsxs)(ev.L,{onOpenChange:N,children:[_,(0,n.jsx)(y.Z,{title:c("Rating"),children:(0,n.jsx)(eg.Z,{slots:{root:w.ZP},slotProps:{root:{variant:"plain",color:"primary"}},sx:{borderRadius:40},children:(0,n.jsx)(em.Z,{})})}),(0,n.jsxs)(ej.Z,{children:[(0,n.jsx)(ew.Z,{disabled:!0,sx:{minHeight:0}}),(0,n.jsx)(eb.Z,{sx:{width:"100%",maxWidth:350,display:"grid",gap:3,padding:1},children:(0,n.jsx)("form",{onSubmit:e=>{e.preventDefault(),(0,s.Vx)((0,s.VC)({data:{conv_uid:d,conv_index:l,question:r,knowledge_space:o,score:h,ques_type:u,messages:f}})).then(e=>{Z.open({type:"success",content:"save success"})}).catch(e=>{Z.open({type:"error",content:"save error"})})},children:(0,n.jsxs)(ey.Z,{container:!0,spacing:.5,columns:13,sx:{flexGrow:1},children:[(0,n.jsx)(ey.Z,{xs:3,children:(0,n.jsx)(C,{children:c("Q_A_Category")})}),(0,n.jsx)(ey.Z,{xs:10,children:(0,n.jsx)(eZ.Z,{action:g,value:u,placeholder:"Choose one…",onChange:(e,t)=>m(null!=t?t:""),...u&&{endDecorator:(0,n.jsx)(w.ZP,{size:"sm",variant:"plain",color:"neutral",onMouseDown:e=>{e.stopPropagation()},onClick:()=>{var e;m(""),null===(e=g.current)||void 0===e||e.focusVisible()},children:(0,n.jsx)(eh.Z,{})}),indicator:null},sx:{width:"100%"},children:i&&(null===(t=Object.keys(i))||void 0===t?void 0:t.map(e=>(0,n.jsx)(e_.Z,{value:e,children:i[e]},e)))})}),(0,n.jsx)(ey.Z,{xs:3,children:(0,n.jsx)(C,{children:(0,n.jsx)(y.Z,{title:(0,n.jsx)(eb.Z,{children:(0,n.jsx)("div",{children:c("feed_back_desc")})}),variant:"solid",placement:"left",children:c("Q_A_Rating")})})}),(0,n.jsx)(ey.Z,{xs:10,sx:{pl:0,ml:0},children:(0,n.jsx)(eN.Z,{"aria-label":"Custom",step:1,min:0,max:5,valueLabelFormat:function(e){return({0:c("Lowest"),1:c("Missed"),2:c("Lost"),3:c("Incorrect"),4:c("Verbose"),5:c("Best")})[e]},valueLabelDisplay:"on",marks:[{value:0,label:"0"},{value:1,label:"1"},{value:2,label:"2"},{value:3,label:"3"},{value:4,label:"4"},{value:5,label:"5"}],sx:{width:"90%",pt:3,m:2,ml:1},onChange:e=>{var t;return p(null===(t=e.target)||void 0===t?void 0:t.value)},value:h})}),(0,n.jsx)(ey.Z,{xs:13,children:(0,n.jsx)(eC.Z,{placeholder:c("Please_input_the_text"),value:f,onChange:e=>v(e.target.value),minRows:2,maxRows:4,endDecorator:(0,n.jsx)(eP.ZP,{level:"body-xs",sx:{ml:"auto"},children:c("input_count")+f.length+c("input_unit")}),sx:{width:"100%",fontSize:14}})}),(0,n.jsx)(ey.Z,{xs:13,children:(0,n.jsx)(j.Z,{type:"submit",variant:"outlined",sx:{width:"100%",height:"100%"},children:c("submit")})})]})})})]})]})},eS=l(74434),eR=e=>{var t,l;let{messages:r,onSubmit:c}=e,{dbParam:m,currentDialogue:p,scene:_,model:k,refreshDialogList:S,chatId:R,agent:E,docId:I}=(0,x.useContext)(a.p),{t:D}=(0,P.$G)(),F=(0,u.useSearchParams)(),M=null!==(t=F&&F.get("select_param"))&&void 0!==t?t:"",U=null!==(l=F&&F.get("spaceNameOriginal"))&&void 0!==l?l:"",[L,O]=(0,x.useState)(!1),[$,A]=(0,x.useState)(!1),[V,G]=(0,x.useState)(r),[z,H]=(0,x.useState)(""),[q,B]=(0,x.useState)(),T=(0,x.useRef)(null),J=(0,x.useMemo)(()=>"chat_dashboard"===_,[_]),W=f(),K=(0,x.useMemo)(()=>{switch(_){case"chat_agent":return E;case"chat_excel":return null==p?void 0:p.select_param;case"chat_flow":return M;default:return U||m}},[_,E,p,m,U,M]),X=async e=>{if(!L&&e.trim()){if("chat_agent"===_&&!E){b.ZP.warning(D("choice_agent_tip"));return}try{O(!0),await c(e,{select_param:null!=K?K:""})}finally{O(!1)}}},ee=e=>{try{return JSON.parse(e)}catch(t){return e}},[et,el]=b.ZP.useMessage(),en=async e=>{let t=null==e?void 0:e.replace(/\trelations:.*/g,""),l=N()(t);l?t?et.open({type:"success",content:D("copy_success")}):et.open({type:"warning",content:D("copy_nothing")}):et.open({type:"error",content:D("copy_failed")})},ea=async()=>{!L&&I&&(O(!0),await W(I),O(!1))};return(0,i.Z)(async()=>{let e=(0,o.a_)();e&&e.id===R&&(await X(e.message),S(),localStorage.removeItem(o.rU))},[R]),(0,x.useEffect)(()=>{let e=r;J&&(e=(0,C.cloneDeep)(r).map(e=>((null==e?void 0:e.role)==="view"&&"string"==typeof(null==e?void 0:e.context)&&(e.context=ee(null==e?void 0:e.context)),e))),G(e.filter(e=>["view","human"].includes(e.role)))},[J,r]),(0,x.useEffect)(()=>{(0,s.Vx)((0,s.Lu)()).then(e=>{var t;B(null!==(t=e[1])&&void 0!==t?t:{})}).catch(e=>{console.log(e)})},[]),(0,x.useEffect)(()=>{setTimeout(()=>{var e;null===(e=T.current)||void 0===e||e.scrollTo(0,T.current.scrollHeight)},50)},[r]),(0,n.jsxs)(n.Fragment,{children:[el,(0,n.jsx)("div",{ref:T,className:"flex flex-1 overflow-y-auto pb-8 w-full flex-col",children:(0,n.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:V.length?V.map((e,t)=>{var l;return"chat_agent"===_?(0,n.jsx)(Y,{content:e},t):(0,n.jsx)(ex,{content:e,isChartChat:J,onLinkClick:()=>{A(!0),H(JSON.stringify(null==e?void 0:e.context,null,2))},children:"view"===e.role&&(0,n.jsxs)("div",{className:"flex w-full border-t border-gray-200 dark:border-theme-dark",children:["chat_knowledge"===_&&e.retry?(0,n.jsxs)(j.Z,{onClick:ea,slots:{root:w.ZP},slotProps:{root:{variant:"plain",color:"primary"}},children:[(0,n.jsx)(v.Z,{}),"\xa0",(0,n.jsx)("span",{className:"text-sm",children:D("Retry")})]}):null,(0,n.jsxs)("div",{className:"flex w-full flex-row-reverse",children:[(0,n.jsx)(ek,{select_param:q,conv_index:Math.ceil((t+1)/2),question:null===(l=null==V?void 0:V.filter(t=>(null==t?void 0:t.role)==="human"&&(null==t?void 0:t.order)===e.order)[0])||void 0===l?void 0:l.context,knowledge_space:U||m||""}),(0,n.jsx)(y.Z,{title:D("Copy_Btn"),children:(0,n.jsx)(j.Z,{onClick:()=>en(null==e?void 0:e.context),slots:{root:w.ZP},slotProps:{root:{variant:"plain",color:"primary"}},sx:{borderRadius:40},children:(0,n.jsx)(g.Z,{})})})]})]})},t)}):(0,n.jsx)(h.Z,{description:"Start a conversation"})})}),(0,n.jsx)("div",{className:d()("relative after:absolute after:-top-8 after:h-8 after:w-full after:bg-gradient-to-t after:from-theme-light after:to-transparent dark:after:from-theme-dark",{"cursor-not-allowed":"chat_excel"===_&&!(null==p?void 0:p.select_param)}),children:(0,n.jsxs)("div",{className:"flex flex-wrap w-full py-2 sm:pt-6 sm:pb-10 items-center",children:[k&&(0,n.jsx)("div",{className:"mr-2 flex",children:(0,ec.A)(k)}),(0,n.jsx)(Q,{loading:L,onSubmit:X,handleFinish:O})]})}),(0,n.jsx)(Z.default,{title:"JSON Editor",open:$,width:"60%",cancelButtonProps:{hidden:!0},onOk:()=>{A(!1)},onCancel:()=>{A(!1)},children:(0,n.jsx)(eS.Z,{className:"w-full h-[500px]",language:"json",value:z})})]})},eE=l(34625),eI=()=>{var e;let t=(0,u.useSearchParams)(),{scene:l,chatId:c,model:f,agent:v,setModel:g,history:j,setHistory:w}=(0,x.useContext)(a.p),{chat:b}=(0,r.Z)({}),y=null!==(e=t&&t.get("initMessage"))&&void 0!==e?e:"",[Z,_]=(0,x.useState)(!1),[N,C]=(0,x.useState)(),P=async()=>{_(!0);let[,e]=await (0,s.Vx)((0,s.$i)(c));w(null!=e?e:[]),_(!1)},k=e=>{var t;let l=null===(t=e[e.length-1])||void 0===t?void 0:t.context;if(l)try{let e="string"==typeof l?JSON.parse(l):l;C((null==e?void 0:e.template_name)==="report"?null==e?void 0:e.charts:void 0)}catch(e){console.log(e),C([])}};(0,i.Z)(async()=>{let e=(0,o.a_)();e&&e.id===c||await P()},[y,c]),(0,x.useEffect)(()=>{var e,t;if(!j.length)return;let l=null===(e=null===(t=j.filter(e=>"view"===e.role))||void 0===t?void 0:t.slice(-1))||void 0===e?void 0:e[0];(null==l?void 0:l.model_name)&&g(l.model_name),k(j)},[j.length]),(0,x.useEffect)(()=>()=>{w([])},[]);let S=(0,x.useCallback)((e,t)=>new Promise(n=>{let a=[...j,{role:"human",context:e,model_name:f,order:0,time_stamp:0},{role:"view",context:"",model_name:f,order:0,time_stamp:0}],s=a.length-1;w([...a]),b({data:{...t,chat_mode:l||"chat_normal",model_name:f,user_input:e},chatId:c,onMessage:e=>{(null==t?void 0:t.incremental)?a[s].context+=e:a[s].context=e,w([...a])},onDone:()=>{k(a),n()},onClose:()=>{k(a),n()},onError:e=>{a[s].context=e,w([...a]),n()}})}),[j,b,c,f,v,l]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.Z,{visible:Z}),(0,n.jsx)(eE.Z,{refreshHistory:P,modelChange:e=>{g(e)}}),(0,n.jsxs)("div",{className:"px-4 flex flex-1 flex-wrap overflow-hidden relative",children:[!!(null==N?void 0:N.length)&&(0,n.jsx)("div",{className:"w-full pb-4 xl:w-3/4 h-1/2 xl:pr-4 xl:h-full overflow-y-auto",children:(0,n.jsx)(m.ZP,{chartsData:N})}),!(null==N?void 0:N.length)&&"chat_dashboard"===l&&(0,n.jsx)(h.Z,{className:"w-full xl:w-3/4 h-1/2 xl:h-full"}),(0,n.jsx)("div",{className:d()("flex flex-1 flex-col overflow-hidden",{"px-0 xl:pl-4 h-1/2 w-full xl:w-auto xl:h-full border-t xl:border-t-0 xl:border-l dark:border-gray-800":"chat_dashboard"===l,"h-full lg:px-8":"chat_dashboard"!==l}),children:(0,n.jsx)(eR,{messages:j,onSubmit:S})})]})]})}},34625:function(e,t,l){"use strict";l.d(t,{Z:function(){return R}});var n=l(85893),a=l(41468),s=l(81799),r=l(82353),o=l(16165),i=l(96991),c=l(78045),d=l(67294);function u(){let{isContract:e,setIsContract:t,scene:l}=(0,d.useContext)(a.p),s=l&&["chat_with_db_execute","chat_dashboard"].includes(l);return s?(0,n.jsxs)(c.ZP.Group,{value:e,defaultValue:!0,buttonStyle:"solid",onChange:()=>{t(!e)},children:[(0,n.jsxs)(c.ZP.Button,{value:!1,children:[(0,n.jsx)(o.Z,{component:r.ig,className:"mr-1"}),"Preview"]}),(0,n.jsxs)(c.ZP.Button,{value:!0,children:[(0,n.jsx)(i.Z,{className:"mr-1"}),"Editor"]})]}):null}l(23293);var x=l(76212),m=l(65654),h=l(34041),p=l(67421),f=function(){let{t:e}=(0,p.$G)(),{agent:t,setAgent:l}=(0,d.useContext)(a.p),{data:s=[]}=(0,m.Z)(async()=>{let[,e]=await (0,x.Vx)((0,x.H4)());return null!=e?e:[]});return(0,n.jsx)(h.default,{className:"w-60",value:t,placeholder:e("Select_Plugins"),options:s.map(e=>({label:e.app_name,value:e.app_code})),allowClear:!0,onChange:e=>{null==l||l(e)}})},v=l(29158),g=l(49591),j=l(88484),w=l(45360),b=l(83062),y=l(23799),Z=l(14726),_=function(e){var t;let{convUid:l,chatMode:s,onComplete:r,...o}=e,[i,c]=(0,d.useState)(!1),[u,m]=w.ZP.useMessage(),[h,p]=(0,d.useState)([]),[f,_]=(0,d.useState)(),{model:N}=(0,d.useContext)(a.p),C=async e=>{var t;if(!e){w.ZP.error("Please select the *.(csv|xlsx|xls) file");return}if(!/\.(csv|xlsx|xls)$/.test(null!==(t=e.file.name)&&void 0!==t?t:"")){w.ZP.error("File type must be csv, xlsx or xls");return}p([e.file])},P=async()=>{c(!0);try{let e=new FormData;e.append("doc_file",h[0]),u.open({content:"Uploading ".concat(h[0].name),type:"loading",duration:0});let[t]=await (0,x.Vx)((0,x.qn)({convUid:l,chatMode:s,data:e,model:N,config:{timeout:36e5,onUploadProgress:e=>{let t=Math.ceil(e.loaded/(e.total||0)*100);_(t)}}}));if(t)return;w.ZP.success("success"),null==r||r()}catch(e){w.ZP.error((null==e?void 0:e.message)||"Upload Error")}finally{c(!1),u.destroy()}};return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"flex items-start gap-2",children:[m,(0,n.jsx)(b.Z,{placement:"bottom",title:"File cannot be changed after upload",children:(0,n.jsx)(y.default,{disabled:i,className:"mr-1",beforeUpload:()=>!1,fileList:h,name:"file",accept:".csv,.xlsx,.xls",multiple:!1,onChange:C,showUploadList:{showDownloadIcon:!1,showPreviewIcon:!1,showRemoveIcon:!1},itemRender:()=>(0,n.jsx)(n.Fragment,{}),...o,children:(0,n.jsx)(Z.ZP,{className:"flex justify-center items-center",type:"primary",disabled:i,icon:(0,n.jsx)(g.Z,{}),children:"Select File"})})}),(0,n.jsx)(Z.ZP,{type:"primary",loading:i,className:"flex justify-center items-center",disabled:!h.length,icon:(0,n.jsx)(j.Z,{}),onClick:P,children:i?100===f?"Analysis":"Uploading":"Upload"}),!!h.length&&(0,n.jsxs)("div",{className:"mt-2 text-gray-500 text-sm flex items-center",onClick:()=>p([]),children:[(0,n.jsx)(v.Z,{className:"mr-2"}),(0,n.jsx)("span",{children:null===(t=h[0])||void 0===t?void 0:t.name})]})]})})},N=function(e){let{onComplete:t}=e,{currentDialogue:l,scene:s,chatId:r}=(0,d.useContext)(a.p);return"chat_excel"!==s?null:(0,n.jsx)("div",{className:"max-w-md h-full relative",children:l?(0,n.jsxs)("div",{className:"flex h-8 overflow-hidden rounded",children:[(0,n.jsx)("div",{className:"flex items-center justify-center px-2 bg-gray-600 text-lg",children:(0,n.jsx)(v.Z,{className:"text-white"})}),(0,n.jsx)("div",{className:"flex items-center justify-center px-3 bg-gray-100 text-xs rounded-tr rounded-br dark:text-gray-800 truncate",children:l.select_param})]}):(0,n.jsx)(_,{convUid:r,chatMode:s,onComplete:t})})},C=l(98978),P=l(62418),k=l(2093),S=function(){let{scene:e,dbParam:t,setDbParam:l}=(0,d.useContext)(a.p),[s,r]=(0,d.useState)([]);(0,k.Z)(async()=>{let[,t]=await (0,x.Vx)((0,x.vD)(e));r(null!=t?t:[])},[e]);let o=(0,d.useMemo)(()=>{var e;return null===(e=s.map)||void 0===e?void 0:e.call(s,e=>({name:e.param,...P.S$[e.type]}))},[s]);return((0,d.useEffect)(()=>{(null==o?void 0:o.length)&&!t&&l(o[0].name)},[o,l,t]),null==o?void 0:o.length)?(0,n.jsx)(h.default,{value:t,className:"w-36",onChange:e=>{l(e)},children:o.map(e=>(0,n.jsxs)(h.default.Option,{children:[(0,n.jsx)(C.Z,{width:24,height:24,src:e.icon,label:e.label,className:"w-[1.5em] h-[1.5em] mr-1 inline-block mt-[-4px]"}),e.name]},e.name))}):null},R=function(e){let{refreshHistory:t,modelChange:l}=e,{scene:r,refreshDialogList:o}=(0,d.useContext)(a.p);return(0,n.jsxs)("div",{className:"w-full py-2 px-4 md:px-4 flex flex-wrap items-center justify-center gap-1 md:gap-4",children:[(0,n.jsx)(s.Z,{onChange:l}),(0,n.jsx)(S,{}),"chat_excel"===r&&(0,n.jsx)(N,{onComplete:()=>{null==o||o(),null==t||t()}}),"chat_agent"===r&&(0,n.jsx)(f,{}),(0,n.jsx)(u,{})]})}},81799:function(e,t,l){"use strict";l.d(t,{A:function(){return x}});var n=l(85893),a=l(41468),s=l(19284),r=l(34041),o=l(25675),i=l.n(o),c=l(67294),d=l(67421);let u="/models/huggingface.svg";function x(e,t){var l,a;let{width:r,height:o}=t||{};return e?(0,n.jsx)(i(),{className:"rounded-full border border-gray-200 object-contain bg-white inline-block",width:r||24,height:o||24,src:(null===(l=s.Hf[e])||void 0===l?void 0:l.icon)||u,alt:"llm"},(null===(a=s.Hf[e])||void 0===a?void 0:a.icon)||u):null}t.Z=function(e){let{onChange:t}=e,{t:l}=(0,d.$G)(),{modelList:o,model:i}=(0,c.useContext)(a.p);return!o||o.length<=0?null:(0,n.jsx)(r.default,{value:i,placeholder:l("choose_model"),className:"w-52",onChange:e=>{null==t||t(e)},children:o.map(e=>{var t;return(0,n.jsx)(r.default.Option,{children:(0,n.jsxs)("div",{className:"flex items-center",children:[x(e),(0,n.jsx)("span",{className:"ml-2",children:(null===(t=s.Hf[e])||void 0===t?void 0:t.label)||e})]})},e)})})}},91085:function(e,t,l){"use strict";var n=l(85893),a=l(32983),s=l(14726),r=l(93967),o=l.n(r),i=l(67421);t.Z=function(e){let{className:t,error:l,description:r,refresh:c}=e,{t:d}=(0,i.$G)();return(0,n.jsx)(a.Z,{image:"/empty.png",imageStyle:{width:320,height:196,margin:"0 auto",maxWidth:"100%",maxHeight:"100%"},className:o()("flex items-center justify-center flex-col h-full w-full",t),description:l?(0,n.jsx)(s.ZP,{type:"primary",onClick:c,children:d("try_again")}):null!=r?r:d("no_data")})}},45247:function(e,t,l){"use strict";var n=l(85893),a=l(50888);t.Z=function(e){let{visible:t}=e;return t?(0,n.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 backdrop-blur-sm text-3xl animate-fade animate-duration-200",children:(0,n.jsx)(a.Z,{})}):null}},2440:function(e,t,l){"use strict";var n=l(25519);t.Z=()=>{var e;return JSON.parse(null!==(e=localStorage.getItem(n.C9))&&void 0!==e?e:"")}},30119:function(e,t,l){"use strict";l.d(t,{Tk:function(){return d},PR:function(){return u}});var n,a=l(62418),s=l(45360);l(96486);var r=l(87066),o=l(83454);let i=r.default.create({baseURL:null!==(n=o.env.API_BASE_URL)&&void 0!==n?n:""});i.defaults.timeout=1e4,i.interceptors.response.use(e=>e.data,e=>Promise.reject(e));let c={"content-type":"application/json","User-Id":(0,a.n5)()},d=(e,t)=>{if(t){let l=Object.keys(t).filter(e=>void 0!==t[e]&&""!==t[e]).map(e=>"".concat(e,"=").concat(t[e])).join("&");l&&(e+="?".concat(l))}return i.get("/api"+e,{headers:c}).then(e=>e).catch(e=>{s.ZP.error(e),Promise.reject(e)})},u=(e,t)=>i.post(e,t,{headers:c}).then(e=>e).catch(e=>{s.ZP.error(e),Promise.reject(e)})},23293:function(){}}]); \ No newline at end of file diff --git a/dbgpt/app/static/web/_next/static/chunks/pages/construct/flow/canvas-a8ec2bde7b845941.js b/dbgpt/app/static/web/_next/static/chunks/pages/construct/flow/canvas-2773219a62a506f3.js similarity index 61% rename from dbgpt/app/static/web/_next/static/chunks/pages/construct/flow/canvas-a8ec2bde7b845941.js rename to dbgpt/app/static/web/_next/static/chunks/pages/construct/flow/canvas-2773219a62a506f3.js index 1cc56eb1f..94e037f1a 100644 --- a/dbgpt/app/static/web/_next/static/chunks/pages/construct/flow/canvas-a8ec2bde7b845941.js +++ b/dbgpt/app/static/web/_next/static/chunks/pages/construct/flow/canvas-2773219a62a506f3.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1767],{94617:function(e,t,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/construct/flow/canvas",function(){return l(66084)}])},45247:function(e,t,l){"use strict";var a=l(85893),r=l(50888);t.Z=function(e){let{visible:t}=e;return t?(0,a.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 backdrop-blur-sm text-3xl animate-fade animate-duration-200",children:(0,a.jsx)(r.Z,{})}):null}},99743:function(e,t,l){"use strict";var a=l(85893);l(67294);var r=l(36851);t.Z=e=>{let{id:t,sourceX:l,sourceY:n,targetX:s,targetY:i,sourcePosition:o,targetPosition:d,style:c={},markerEnd:u}=e,[p,m,f]=(0,r.OQ)({sourceX:l,sourceY:n,sourcePosition:o,targetX:s,targetY:i,targetPosition:d}),v=(0,r._K)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.u5,{id:t,style:c,path:p,markerEnd:u}),(0,a.jsx)("foreignObject",{width:40,height:40,x:m-20,y:f-20,className:"bg-transparent w-10 h-10 relative",requiredExtensions:"http://www.w3.org/1999/xhtml",children:(0,a.jsx)("button",{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-5 h-5 rounded-full bg-stone-400 dark:bg-zinc-700 cursor-pointer text-sm",onClick:e=>{e.stopPropagation(),v.setEdges(v.getEdges().filter(e=>e.id!==t))},children:"\xd7"})})]})}},66084:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return e0}});var a=l(85893),r=l(76212),n=l(45247),s=l(41468),i=l(62418),o=l(14313),d=l(94155),c=l(25278),u=l(21612),p=l(40411),m=l(42075),f=l(72269),v=l(47221),x=l(93967),h=l.n(x),g=l(67294),j=l(67421),b=l(2487),w=l(7134),y=l(32983),_=e=>{let{nodes:t}=e,{t:l}=(0,j.$G)();return(null==t?void 0:t.length)>0?(0,a.jsx)(b.Z,{className:"overflow-hidden overflow-y-auto w-full",size:"small",itemLayout:"horizontal",dataSource:t,renderItem:e=>(0,a.jsx)(b.Z.Item,{className:"cursor-move hover:bg-[#F1F5F9] dark:hover:bg-theme-dark p-0 py-2",draggable:!0,onDragStart:t=>{t.dataTransfer.setData("application/reactflow",JSON.stringify(e)),t.dataTransfer.effectAllowed="move"},children:(0,a.jsx)(b.Z.Item.Meta,{className:"flex items-center justify-center",avatar:(0,a.jsx)(w.C,{src:"/icons/node/vis.png",size:"large"}),title:(0,a.jsx)("p",{className:"line-clamp-1 font-medium",children:e.label}),description:(0,a.jsx)("p",{className:"line-clamp-2",children:e.description})})})}):(0,a.jsx)(y.Z,{className:"px-2",description:l("no_node")})};let{Search:N}=c.default,{Sider:Z}=u.default,k=JSON.stringify({order:"higher-order"}),C={display:"flex",alignItems:"center",justifyContent:"center",width:16,height:48,position:"absolute",top:"50%",transform:"translateY(-50%)",border:"1px solid #d6d8da",borderRadius:8,right:-8};var I=()=>{let{t:e}=(0,j.$G)(),{mode:t}=(0,g.useContext)(s.p),[l,n]=(0,g.useState)(!1),[c,u]=(0,g.useState)(""),[x,b]=(0,g.useState)([]),[w,y]=(0,g.useState)([]),[I,S]=(0,g.useState)([]),[F,P]=(0,g.useState)([]),[E,V]=(0,g.useState)(!1);async function z(e){let[t,l]=await (0,r.Vx)((0,r.As)(e));if(l&&l.length>0){localStorage.setItem(i.zN,JSON.stringify(l));let e=l.filter(e=>"operator"===e.flow_type),t=l.filter(e=>"resource"===e.flow_type);b(e),y(t),S(A(e)),P(A(t))}}(0,g.useEffect)(()=>{z(k)},[]);let O=(0,g.useMemo)(()=>l?{...C,right:-16,borderRadius:"0px 8px 8px 0",borderLeft:"1px solid #d5e5f6"}:{...C,borderLeft:"1px solid #d6d8da"},[l]);function A(e){let t=[],l={};return e.forEach(e=>{let{category:a,category_label:r}=e;l[a]||(l[a]={category:a,categoryLabel:r,nodes:[]},t.push(l[a])),l[a].nodes.push(e)}),t}let D=(0,g.useMemo)(()=>{if(!c)return I.map(e=>{let{category:t,categoryLabel:l,nodes:r}=e;return{key:t,label:l,children:(0,a.jsx)(_,{nodes:r}),extra:(0,a.jsx)(p.Z,{showZero:!0,count:r.length||0,style:{backgroundColor:r.length>0?"#52c41a":"#7f9474"}})}});{let e=x.filter(e=>e.label.toLowerCase().includes(c.toLowerCase()));return A(e).map(e=>{let{category:t,categoryLabel:l,nodes:r}=e;return{key:t,label:l,children:(0,a.jsx)(_,{nodes:r}),extra:(0,a.jsx)(p.Z,{showZero:!0,count:r.length||0,style:{backgroundColor:r.length>0?"#52c41a":"#7f9474"}})}})}},[I,c]),T=(0,g.useMemo)(()=>{if(!c)return F.map(e=>{let{category:t,categoryLabel:l,nodes:r}=e;return{key:t,label:l,children:(0,a.jsx)(_,{nodes:r}),extra:(0,a.jsx)(p.Z,{showZero:!0,count:r.length||0,style:{backgroundColor:r.length>0?"#52c41a":"#7f9474"}})}});{let e=w.filter(e=>e.label.toLowerCase().includes(c.toLowerCase()));return A(e).map(e=>{let{category:t,categoryLabel:l,nodes:r}=e;return{key:t,label:l,children:(0,a.jsx)(_,{nodes:r}),extra:(0,a.jsx)(p.Z,{showZero:!0,count:r.length||0,style:{backgroundColor:r.length>0?"#52c41a":"#7f9474"}})}})}},[F,c]);return(0,a.jsx)(Z,{className:"flex justify-center items-start nodrag bg-[#ffffff80] border-r border-[#d5e5f6] dark:bg-[#ffffff29] dark:border-[#ffffff66]",theme:t,width:280,collapsible:!0,collapsed:l,collapsedWidth:0,trigger:l?(0,a.jsx)(o.Z,{className:"text-base"}):(0,a.jsx)(d.Z,{className:"text-base"}),zeroWidthTriggerStyle:O,onCollapse:e=>n(e),children:(0,a.jsxs)(m.Z,{direction:"vertical",className:"w-[280px] pt-4 px-4 overflow-hidden overflow-y-auto scrollbar-default",children:[(0,a.jsxs)("div",{className:"flex justify-between align-middle",children:[(0,a.jsx)("p",{className:"w-full text-base font-semibold text-[#1c2533] dark:text-[rgba(255,255,255,0.85)] line-clamp-1",children:e("add_node")}),(0,a.jsx)(f.Z,{checkedChildren:"高阶",unCheckedChildren:"全部",onClick:function(){E?z(k):z(),V(!E)},className:h()("w-20",{"bg-zinc-400":E}),defaultChecked:!0})]}),(0,a.jsx)(N,{placeholder:"Search node",onSearch:function(e){u(e)},allowClear:!0}),(0,a.jsx)("h2",{className:"font-semibold",children:e("operators")}),(0,a.jsx)(v.Z,{size:"small",bordered:!1,className:"max-h-[calc((100vh-156px)/2)] overflow-hidden overflow-y-auto scrollbar-default",defaultActiveKey:[""],items:D}),(0,a.jsx)("h2",{className:"font-semibold",children:e("resource")}),(0,a.jsx)(v.Z,{size:"small",bordered:!1,className:"max-h-[calc((100vh-156px)/2)] overflow-hidden overflow-y-auto scrollbar-default",defaultActiveKey:[""],items:T})]})})},S=l(99743),F=l(67919),P=l(24969),E=l(3089),V=l(34041),z=l(99859),O=l(3303),A=l(13457),D=l(14726),T=l(85576),L=l(96486);let{Option:M}=V.default,q=["str","int","float","bool","ref"],R=e=>{let{flowInfo:t,setFlowInfo:l}=e,{t:n}=(0,j.$G)(),[s,i]=(0,g.useState)(!1),[o]=z.default.useForm(),[d,u]=(0,g.useState)(["str"]),[p,f]=(0,g.useState)([]);(0,g.useEffect)(()=>{v()},[]);let v=async()=>{let[e,t]=await (0,r.Vx)((0,r.RR)());if(e)return;let l=null==t?void 0:t.map(e=>{let{key:t,label:l,scope:a}=e;return{value:t,label:l,scope:a,isLeaf:!1}});f(l)},x=(e,t)=>{var l,a;let r=e.target.value,n=null===(l=null===(a=null==r?void 0:r.split("_"))||void 0===a?void 0:a.map(e=>e.charAt(0).toUpperCase()+e.slice(1)))||void 0===l?void 0:l.join(" ");o.setFields([{name:["parameters",t,"label"],value:n}])},h=(e,t)=>{let l=[...d];l[t]=e,u(l)},b=e=>{let t=e[e.length-1],{value:l,scope:a}=t;setTimeout(async()=>{let[e,n]=await (0,r.Vx)((0,r.gt)({key:l,scope:a}));if(e)return;if((null==n?void 0:n.total_count)===0){t.isLeaf=!0;return}let s=(0,L.uniqBy)(null==n?void 0:n.items,"name");t.children=null==s?void 0:s.map(e=>({value:null==e?void 0:e.name,label:e.label,item:e})),f([...p])},1e3)},w=(e,t,l)=>{var a,r,n;if((null==e?void 0:e.length)!==2)return;let[s,i]=t,d=null==s?void 0:null===(a=s.children)||void 0===a?void 0:a.find(e=>{let{value:t}=e;return t===(null==i?void 0:i.value)}),c=(0,F.Av)(null==d?void 0:d.item),u=o.getFieldValue("parameters"),p=null==u?void 0:u[l];p&&(p.value=c,p.category=null==d?void 0:null===(r=d.item)||void 0===r?void 0:r.category,p.value_type=null==d?void 0:null===(n=d.item)||void 0===n?void 0:n.value_type,o.setFieldsValue({parameters:[...u]}))},y=(e,t)=>{switch(e){case"ref":return(0,a.jsx)(O.Z,{placeholder:"Select Value",options:p,loadData:b,onChange:(e,l)=>w(e,l,t),changeOnSelect:!0});case"str":default:return(0,a.jsx)(c.default,{placeholder:"Parameter Value"});case"int":return(0,a.jsx)(A.Z,{step:1,placeholder:"Parameter Value",parser:e=>(null==e?void 0:e.replace(/[^\-?\d]/g,""))||0,style:{width:"100%"}});case"float":return(0,a.jsx)(A.Z,{placeholder:"Parameter Value",style:{width:"100%"}});case"bool":return(0,a.jsxs)(V.default,{placeholder:"Select Value",children:[(0,a.jsx)(M,{value:!0,children:"True"}),(0,a.jsx)(M,{value:!1,children:"False"})]})}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(D.ZP,{type:"primary",className:"flex items-center justify-center rounded-full left-4 top-4",style:{zIndex:1050},icon:(0,a.jsx)(P.Z,{}),onClick:()=>i(!0)}),(0,a.jsx)(T.default,{title:n("Add_Global_Variable_of_Flow"),width:1e3,open:s,styles:{body:{minHeight:"40vh",maxHeight:"65vh",overflow:"scroll",backgroundColor:"rgba(0,0,0,0.02)",padding:"0 8px",borderRadius:4}},onCancel:()=>i(!1),footer:[(0,a.jsx)(D.ZP,{onClick:()=>i(!1),children:n("cancel")},"cancel"),(0,a.jsx)(D.ZP,{type:"primary",onClick:()=>o.submit(),children:n("verify")},"submit")],children:(0,a.jsx)(z.default,{name:"dynamic_form_nest_item",onFinish:e=>{let a={...t,variables:(null==e?void 0:e.parameters)||[]};l(a),i(!1)},form:o,autoComplete:"off",layout:"vertical",className:"mt-8",initialValues:{parameters:(null==t?void 0:t.variables)||[{}]},children:(0,a.jsx)(z.default.List,{name:"parameters",children:(e,t)=>{let{add:l,remove:r}=t;return(0,a.jsxs)(a.Fragment,{children:[e.map((e,t)=>{let{key:l,name:n,...s}=e;return(0,a.jsxs)(m.Z,{className:"hover:bg-gray-100 pt-2 pl-2",children:[(0,a.jsx)(z.default.Item,{...s,name:[n,"name"],label:"参数 ".concat(t+1," 名称"),style:{width:140},rules:[{required:!0,message:"Missing parameter name"},{pattern:/^[a-zA-Z0-9]+(_[a-zA-Z0-9]+)*$/,message:"名称必须是字母、数字或下划线,并使用下划线分隔多个单词"}],children:(0,a.jsx)(c.default,{placeholder:"Parameter Name",onChange:e=>x(e,t)})}),(0,a.jsx)(z.default.Item,{...s,name:[n,"label"],label:"标题",style:{width:130},rules:[{required:!0,message:"Missing parameter label"}],children:(0,a.jsx)(c.default,{placeholder:"Parameter Label"})}),(0,a.jsx)(z.default.Item,{...s,name:[n,"value_type"],label:"类型",style:{width:100},rules:[{required:!0,message:"Missing parameter type"}],children:(0,a.jsx)(V.default,{placeholder:"Select",onChange:e=>h(e,t),children:q.map(e=>(0,a.jsx)(M,{value:e,children:e},e))})}),(0,a.jsx)(z.default.Item,{...s,name:[n,"value"],label:"值",style:{width:320},rules:[{required:!0,message:"Missing parameter value"}],children:y(d[t],t)}),(0,a.jsx)(z.default.Item,{...s,name:[n,"description"],label:"描述",style:{width:170},children:(0,a.jsx)(c.default,{placeholder:"Parameter Description"})}),(0,a.jsx)(E.Z,{onClick:()=>r(n)}),(0,a.jsx)(z.default.Item,{name:[n,"key"],hidden:!0,initialValue:"dbgpt.core.flow.params"}),(0,a.jsx)(z.default.Item,{name:[n,"scope"],hidden:!0,initialValue:"flow_priv"}),(0,a.jsx)(z.default.Item,{name:[n,"category"],hidden:!0,initialValue:"common"})]},l)}),(0,a.jsx)(z.default.Item,{children:(0,a.jsx)(D.ZP,{type:"dashed",onClick:()=>l(),block:!0,icon:(0,a.jsx)(P.Z,{}),children:n("Add_Parameter")})})]})}})})})]})};var G=l(45360),$=l(78045),J=l(83454);let B=e=>{let{reactFlow:t,flowInfo:l,isExportFlowModalOpen:r,setIsExportFlowModalOpen:n}=e,{t:s}=(0,j.$G)(),[i]=z.default.useForm(),[o,d]=G.ZP.useMessage(),u=async e=>{if("json"===e.format){let l=t.toObject(),a=new Blob([JSON.stringify(l)],{type:"text/plain;charset=utf-8"}),r=URL.createObjectURL(a),n=document.createElement("a");n.href=r,n.download=e.file_name||"flow.json",n.click()}else{let t="".concat(J.env.API_BASE_URL,"/api/v2/serve/awel/flow/export/").concat(e.uid,"?export_type=").concat(e.export_type,"&format=").concat(e.format);window.open(t)}o.success(s("Export_Flow_Success")),n(!1)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T.default,{title:s("Export_Flow"),open:r,onCancel:()=>n(!1),footer:[(0,a.jsx)(D.ZP,{onClick:()=>n(!1),children:s("cancel")},"cancel"),(0,a.jsx)(D.ZP,{type:"primary",onClick:()=>i.submit(),children:s("verify")},"submit")],children:(0,a.jsxs)(z.default,{form:i,className:"mt-6",labelCol:{span:6},wrapperCol:{span:16},onFinish:u,initialValues:{export_type:"json",format:"file",uid:null==l?void 0:l.uid},children:[(0,a.jsx)(z.default.Item,{label:s("Export_File_Type"),name:"export_type",children:(0,a.jsxs)($.ZP.Group,{children:[(0,a.jsx)($.ZP,{value:"json",children:"JSON"}),(0,a.jsx)($.ZP,{value:"dbgpts",children:"DBGPTS"})]})}),(0,a.jsx)(z.default.Item,{label:s("Export_File_Format"),name:"format",children:(0,a.jsxs)($.ZP.Group,{children:[(0,a.jsx)($.ZP,{value:"file",children:"File"}),(0,a.jsx)($.ZP,{value:"json",children:"JSON"})]})}),(0,a.jsx)(z.default.Item,{hidden:!0,name:"uid",children:(0,a.jsx)(c.default,{})})]})}),d]})};var U=l(39773);let H=e=>{let{isFlowTemplateModalOpen:t,setIsFlowTemplateModalOpen:l}=e,{t:n}=(0,j.$G)(),[s,i]=(0,g.useState)([]),o=e=>{(null==e?void 0:e.name)&&(localStorage.setItem("importFlowData",JSON.stringify(e)),e0(),l(!1))},d=[{title:n("Template_Name"),dataIndex:"name",key:"name"},{title:n("Template_Label"),dataIndex:"label",key:"label"},{title:n("Template_Description"),dataIndex:"description",key:"description"},{title:n("Template_Action"),key:"action",render:(e,t)=>(0,a.jsx)(m.Z,{size:"middle",children:(0,a.jsx)(D.ZP,{type:"link",onClick:()=>{o(t)},block:!0,children:n("Import_From_Template")})})}];return(0,g.useEffect)(()=>{(0,r.MJ)().then(e=>{var t,l;console.log(e),i(null==e?void 0:null===(t=e.data)||void 0===t?void 0:null===(l=t.data)||void 0===l?void 0:l.items)})},[]),(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(T.default,{className:"w-[700px]",title:n("Import_From_Template"),open:t,onCancel:()=>l(!1),cancelButtonProps:{className:"hidden"},okButtonProps:{className:"hidden"},children:[(0,a.jsx)(U.Z,{className:"w-full",dataSource:s,columns:d}),";"]})})};var K=l(88484),W=l(23799);let Y=e=>{let{isImportModalOpen:t,setIsImportFlowModalOpen:l}=e,{t:n}=(0,j.$G)(),[s]=z.default.useForm(),[i,o]=G.ZP.useMessage(),[d,c]=(0,g.useState)([]);(0,g.useEffect)(()=>{t&&(s.resetFields(),c([]))},[t,s]);let u=async e=>{var t;e.file=null===(t=e.file)||void 0===t?void 0:t[0];let a=new FormData;d.forEach(t=>{a.append("file",t),a.append("save_flow",e.save_flow)});let[,,s]=await (0,r.Vx)((0,r._Y)(a));(null==s?void 0:s.success)?(i.success(n("Import_Flow_Success")),localStorage.setItem("importFlowData",JSON.stringify(null==s?void 0:s.data)),e0()):(null==s?void 0:s.err_msg)&&i.error(null==s?void 0:s.err_msg),l(!1)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T.default,{title:n("Import_Flow"),open:t,onCancel:()=>l(!1),footer:[(0,a.jsx)(D.ZP,{onClick:()=>l(!1),children:n("cancel")},"cancel"),(0,a.jsx)(D.ZP,{type:"primary",onClick:()=>s.submit(),children:n("verify")},"submit")],children:(0,a.jsxs)(z.default,{form:s,className:"mt-6",labelCol:{span:6},wrapperCol:{span:16},onFinish:u,initialValues:{save_flow:!1},children:[(0,a.jsx)(z.default.Item,{name:"file",label:n("Select_File"),valuePropName:"fileList",getValueFromEvent:e=>Array.isArray(e)?e:e&&e.fileList,rules:[{required:!0,message:"Please upload a file"}],children:(0,a.jsx)(W.default,{onRemove:e=>{let t=d.indexOf(e),l=d.slice();l.splice(t,1),c(l)},beforeUpload:e=>(c([...d,e]),!1),fileList:d,accept:".json,.zip",maxCount:1,children:(0,a.jsxs)(D.ZP,{icon:(0,a.jsx)(K.Z,{}),children:[" ",n("Upload")]})})}),(0,a.jsx)(z.default.Item,{name:"save_flow",label:n("Save_After_Import"),hidden:!0,children:(0,a.jsxs)($.ZP.Group,{children:[(0,a.jsx)($.ZP,{value:!0,children:n("Yes")}),(0,a.jsx)($.ZP,{value:!1,children:n("No")})]})})]})}),o]})};var X=l(84567),Q=l(11163);let{TextArea:ee}=c.default,et=e=>{let{reactFlow:t,isSaveFlowModalOpen:l,flowInfo:n,setIsSaveFlowModalOpen:s}=e,{t:i}=(0,j.$G)(),o=(0,Q.useRouter)(),[d]=z.default.useForm(),[u,p]=G.ZP.useMessage(),[m,f]=(0,g.useState)(!1),[v,x]=(0,g.useState)(o.query.id||"");async function h(){let{name:e,label:l,description:a="",editable:c=!1,state:p="deployed"}=d.getFieldsValue(),m=(0,F.Wf)(t.toObject());if(v){let[,,t]=await (0,r.Vx)((0,r.ao)(v.toString(),{name:e,label:l,description:a,editable:c,uid:v.toString(),flow_data:m,state:p,variables:null==n?void 0:n.variables}));(null==t?void 0:t.success)?u.success(i("save_flow_success")):(null==t?void 0:t.err_msg)&&u.error(null==t?void 0:t.err_msg)}else{let[t,s]=await (0,r.Vx)((0,r.zd)({name:e,label:l,description:a,editable:c,flow_data:m,state:p,variables:null==n?void 0:n.variables}));(null==s?void 0:s.uid)&&(u.success(i("save_flow_success")),o.push("/construct/flow/canvas?id=".concat(s.uid),void 0,{shallow:!0}))}s(!1)}return(0,g.useEffect)(()=>{x(o.query.id||"")},[o.query.id]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T.default,{title:i("flow_modal_title"),open:l,onCancel:()=>s(!1),footer:[(0,a.jsx)(D.ZP,{onClick:()=>s(!1),children:i("cancel")},"cancel"),(0,a.jsx)(D.ZP,{type:"primary",onClick:()=>d.submit(),children:i("verify")},"submit")],children:(0,a.jsxs)(z.default,{name:"flow_form",form:d,labelCol:{span:6},wrapperCol:{span:16},className:"mt-6 max-w-2xl",initialValues:{remember:!0},onFinish:h,autoComplete:"off",children:[(0,a.jsx)(z.default.Item,{label:"Title",name:"label",initialValue:null==n?void 0:n.label,rules:[{required:!0,message:"Please input flow title!"}],children:(0,a.jsx)(c.default,{onChange:function(e){let t=e.target.value,l=t.replace(/\s+/g,"_").replace(/[^a-z0-9_-]/g,"").toLowerCase();d.setFieldsValue({name:l})}})}),(0,a.jsx)(z.default.Item,{label:"Name",name:"name",initialValue:null==n?void 0:n.name,rules:[{required:!0,message:"Please input flow name!"},()=>({validator:(e,t)=>/^[a-zA-Z0-9_\-]+$/.test(t)?Promise.resolve():Promise.reject("Can only contain numbers, letters, underscores, and dashes")})],children:(0,a.jsx)(c.default,{})}),(0,a.jsx)(z.default.Item,{label:"Description",initialValue:null==n?void 0:n.description,name:"description",children:(0,a.jsx)(ee,{rows:3})}),(0,a.jsx)(z.default.Item,{label:"Editable",name:"editable",initialValue:(null==n?void 0:n.editable)||!0,valuePropName:"checked",children:(0,a.jsx)(X.Z,{})}),(0,a.jsx)(z.default.Item,{hidden:!0,name:"state",children:(0,a.jsx)(c.default,{})}),(0,a.jsx)(z.default.Item,{label:"Deploy",children:(0,a.jsx)(X.Z,{defaultChecked:(null==n?void 0:n.state)==="deployed"||(null==n?void 0:n.state)==="running",checked:m,onChange:e=>{let t=e.target.checked;d.setFieldValue("state",t?"deployed":"developing"),f(t)}})})]})}),p]})};var el=l(57132),ea=l(48689),er=l(45605),en=l(55241),es=l(83062),ei=l(25675),eo=l.n(ei),ed=l(36851),ec=e=>{let{children:t,className:l}=e;return(0,a.jsx)("div",{className:h()("flex justify-center items-center w-8 h-8 rounded-full dark:bg-zinc-700 hover:bg-stone-200 dark:hover:bg-zinc-900",l),children:t})},eu=l(45030),ep=l(86738),em=e=>{let{optional:t}=e;return t?null:(0,a.jsx)("span",{className:"text-red-600 align-middle inline-block",children:"\xa0*"})},ef=e=>{let{node:t,data:l,type:r,label:n,index:s}=e,{t:o}=(0,j.$G)(),d=(0,ed._K)(),[c,u]=g.useState([]);function p(){let e=localStorage.getItem(i.zN);if(!e)return;let a=JSON.parse(e),r=l.type_cls,s=[];"inputs"===n?s=a.filter(e=>"operator"===e.flow_type).filter(e=>{var t;return null===(t=e.outputs)||void 0===t?void 0:t.some(e=>e.type_cls===r&&e.is_list===(null==l?void 0:l.is_list))}):"parameters"===n?s=a.filter(e=>"resource"===e.flow_type).filter(e=>{var t;return null===(t=e.parent_cls)||void 0===t?void 0:t.includes(r)}):"outputs"===n&&("operator"===t.flow_type?s=a.filter(e=>"operator"===e.flow_type).filter(e=>{var t;return null===(t=e.inputs)||void 0===t?void 0:t.some(e=>e.type_cls===r&&e.is_list===(null==l?void 0:l.is_list))}):"resource"===t.flow_type&&(s=a.filter(e=>{var l,a;return(null===(l=e.inputs)||void 0===l?void 0:l.some(e=>{var l;return null===(l=t.parent_cls)||void 0===l?void 0:l.includes(e.type_cls)}))||(null===(a=e.parameters)||void 0===a?void 0:a.some(e=>{var l;return null===(l=t.parent_cls)||void 0===l?void 0:l.includes(e.type_cls)}))}))),u(s)}return(0,a.jsxs)("div",{className:h()("relative flex items-center",{"justify-start":"parameters"===n||"inputs"===n,"justify-end":"outputs"===n}),children:[(0,a.jsx)(ed.HH,{className:h()("w-2 h-2","source"===r?"-mr-4":"-ml-4"),type:r,position:"source"===r?ed.Ly.Right:ed.Ly.Left,id:"".concat(t.id,"|").concat(n,"|").concat(s),isValidConnection:e=>(function(e){var t,l;let{sourceHandle:a,targetHandle:r,source:n,target:s}=e,i=d.getNode(n),c=d.getNode(s),{flow_type:u}=null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},{flow_type:p}=null!==(l=null==c?void 0:c.data)&&void 0!==l?l:{},m=null==a?void 0:a.split("|")[1],f=null==r?void 0:r.split("|")[1],v=null==a?void 0:a.split("|")[2],x=null==r?void 0:r.split("|")[2],h=null==c?void 0:c.data[f][x].type_cls;if(u===p&&"operator"===u){let e=null==i?void 0:i.data[m][v].type_cls,t=null==i?void 0:i.data[m][v].is_list,l=null==c?void 0:c.data[f][x].is_list;return e===h&&t===l}if("resource"===u&&("operator"===p||"resource"===p)){let e=null==i?void 0:i.data.parent_cls;return e.includes(h)}return G.ZP.warning(o("connect_warning")),!1})(e)}),(0,a.jsxs)(eu.Z,{className:h()("bg-white dark:bg-[#232734] w-full px-2 py-1 rounded text-neutral-500",{"text-right":"outputs"===n}),children:[(0,a.jsx)(ep.Z,{placement:"left",icon:null,showCancel:!1,okButtonProps:{className:"hidden"},title:o("related_nodes"),description:(0,a.jsx)("div",{className:"w-60",children:(0,a.jsx)(_,{nodes:c})}),children:["inputs","parameters"].includes(n)&&(0,a.jsx)(P.Z,{className:"cursor-pointer",onClick:p})}),"outputs"!==n&&(0,a.jsx)(em,{optional:l.optional}),l.type_name,l.description&&(0,a.jsx)(es.Z,{title:l.description,children:(0,a.jsx)(er.Z,{className:"ml-2 cursor-pointer"})}),(0,a.jsx)(ep.Z,{placement:"right",icon:null,showCancel:!1,okButtonProps:{className:"hidden"},title:o("related_nodes"),description:(0,a.jsx)("div",{className:"w-60",children:(0,a.jsx)(_,{nodes:c})}),children:["outputs"].includes(n)&&(0,a.jsx)(P.Z,{className:"ml-2 cursor-pointer",onClick:p})})]})]})};let ev=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(O.Z,{...l,options:e.options,placeholder:"please select",className:"w-full nodrag"})},ex=e=>{var t,l;let r=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(null===(l=e.options)||void 0===l?void 0:l.length)>0&&(0,a.jsx)("div",{className:"bg-white p-2 rounded",children:(0,a.jsx)(X.Z.Group,{...r,options:e.options})})};var eh=l(63764);let eg=e=>{var t,l,r,n,s,i,o,d;let{t:c}=(0,j.$G)(),u=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{}),[p,m]=(0,g.useState)(!1),f=(0,g.useMemo)(()=>{var t,l,a,r;return(null==e?void 0:null===(t=e.ui)||void 0===t?void 0:null===(l=t.editor)||void 0===l?void 0:l.width)?(null==e?void 0:null===(a=e.ui)||void 0===a?void 0:null===(r=a.editor)||void 0===r?void 0:r.width)+100:"80%"},[null==e?void 0:null===(l=e.ui)||void 0===l?void 0:null===(r=l.editor)||void 0===r?void 0:r.width]);return(0,a.jsxs)("div",{className:"p-2 text-sm",children:[(0,a.jsx)(D.ZP,{type:"default",onClick:()=>{m(!0)},children:c("Open_Code_Editor")}),(0,a.jsx)(T.default,{title:c("Code_Editor"),width:f,open:p,onOk:()=>{m(!1)},onCancel:()=>{m(!1)},children:(0,a.jsx)(z.default.Item,{name:null==e?void 0:e.name,children:(0,a.jsx)(eh.ZP,{...u,width:(null==e?void 0:null===(n=e.ui)||void 0===n?void 0:null===(s=n.editor)||void 0===s?void 0:s.width)||"100%",height:(null==e?void 0:null===(i=e.ui)||void 0===i?void 0:null===(o=i.editor)||void 0===o?void 0:o.height)||200,defaultLanguage:null==e?void 0:null===(d=e.ui)||void 0===d?void 0:d.language,theme:"vs-dark",options:{minimap:{enabled:!1},wordWrap:"on"}})})})]})};var ej=l(69935);let eb=e=>{var t;let{data:l,formValuesChange:r}=e,n=(0,F.It)((null===(t=l.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(ej.default,{onChange:(e,t)=>{r({[l.name]:t})},...n,className:"w-full",placeholder:"please select a date"})};var ew=l(70342);let ey=e=>{let t=e.match(/^icon:(\w+)$/);if(t){let e=t[1],l=ew[e];return l?(0,a.jsx)(l,{}):null}return null},e_=e=>{var t,l,r;let n=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return n.prefix=ey((null===(l=e.ui)||void 0===l?void 0:null===(r=l.attr)||void 0===r?void 0:r.prefix)||""),(0,a.jsx)(c.default,{...n,className:"w-full",placeholder:"please input",allowClear:!0})},{Password:eN}=c.default,eZ=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(eN,{...l,placeholder:"input password"})},ek=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)("div",{className:"bg-white p-2 rounded",children:(0,a.jsx)($.ZP.Group,{...l,options:e.options})})},eC=e=>{var t;let l=(0,F.It)((null==e?void 0:null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(V.default,{...l,className:"w-full nodrag",placeholder:"please select",options:e.options})};var eI=l(30568);let eS=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(a.Fragment,{children:e.is_list?(0,a.jsx)(eI.Z,{range:!0,className:"mt-8 nodrag",...l}):(0,a.jsx)(eI.Z,{className:"mt-8 nodrag",...l})})},{TextArea:eF}=c.default,eP=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(eF,{className:"nowheel mb-3",...l})};var eE=l(68351);let eV=e=>{var t;let{data:l,formValuesChange:r}=e,n=(0,F.It)((null===(t=l.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(eE.Z,{...n,onChange:(e,t)=>{r({time:t},{force:!0})},className:"w-full",placeholder:"please select a moment"})};var ez=l(59847);let eO=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(ez.Z,{...l,className:"w-full nodrag",treeDefaultExpandAll:!0,treeData:e.options})};var eA=l(83454);let eD=e=>{var t,l,n,s;let{t:i}=(0,j.$G)(),o=(0,g.useRef)([]),{data:d,formValuesChange:c}=e,[u,p]=(0,g.useState)([]);(0,g.useEffect)(()=>{if(d.value){let e=[];"string"==typeof d.value?e.push(d.value):e=d.value;let t={uris:e};(0,r.Jx)(t).then(e=>{let t=[];for(let l=0;l{console.log(e)})}},[]);let m=(0,F.It)((null===(t=d.ui)||void 0===t?void 0:t.attr)||{}),[f,v]=(0,g.useState)(!1),[x,h]=(0,g.useState)(""),b=e=>{o.current.length===d.ui.attr.max_count&&o.current.pop(),o.current.push(e),1===d.ui.attr.max_count?c({[d.name]:o.current.toString()}):c({[d.name]:o.current})},w={name:"files",action:eA.env.API_BASE_URL+d.ui.action,headers:{authorization:"authorization-text"},defaultFileList:u,onChange(e){v(!0),"uploading"!==e.file.status&&v(!1),"done"===e.file.status?(v(!1),G.ZP.success("".concat(e.file.response.data[0].file_name," ").concat(i("Upload_Data_Successfully"))),b(e.file.response.data[0].uri)):"error"===e.file.status&&(v(!1),G.ZP.error("".concat(e.file.response.data[0].file_name," ").concat(i("Upload_Data_Failed"))))}};return!x&&(null===(l=d.ui)||void 0===l?void 0:l.file_types)&&Array.isArray(null===(n=d.ui)||void 0===n?void 0:n.file_types)&&h(null===(s=d.ui)||void 0===s?void 0:s.file_types.toString()),(0,a.jsx)("div",{className:"p-2 text-sm text-center",children:(0,a.jsx)(W.default,{onRemove:e=>{let t=o.current.indexOf(e.response.data[0].uri);-1!==t&&o.current.splice(t,1),v(!1),1===d.ui.attr.max_count?c({[d.name]:o.current.toString()}):c({[d.name]:o.current})},...w,...m,multiple:!!d.is_list,accept:x,children:(0,a.jsx)(D.ZP,{loading:f,icon:(0,a.jsx)(K.Z,{}),children:i("Upload_Data")})})})},eT=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(c.default,{...l,className:"w-full",placeholder:"please input",allowClear:!0})};var eL=e=>{let{formValuesChange:t,node:l,paramData:r,label:n,index:s}=e;return"resource"===r.category?(0,a.jsx)(ef,{node:l,data:r,type:"target",label:n,index:s}):"common"===r.category?(null==r?void 0:r.ui)?function(e,t){var l;let{refresh_depends:r,ui_type:n}=e.ui,s=null!==(l=e.value)&&void 0!==l?l:e.default;return"slider"===n&&e.is_list&&(s=[0,1]),(0,a.jsx)(z.default.Item,{className:"mb-2",initialValue:s,name:e.name,rules:[{required:!e.optional}],label:(0,a.jsx)("span",{className:"text-neutral-500",children:e.label}),...r&&{dependencies:r},...e.description&&{tooltip:{title:e.description,icon:(0,a.jsx)(er.Z,{})}},children:function(e,t,l){switch(e){case"select":return eC(t);case"cascader":return ev(t);case"checkbox":return ex(t);case"radio":return ek(t);case"input":return e_(t);case"text_area":return eP(t);case"slider":return eS(t);case"date_picker":return eb({data:t,formValuesChange:l});case"time_picker":return eV({data:t,formValuesChange:l});case"tree_select":return eO(t);case"password":return eZ(t);case"upload":return eD({data:t,formValuesChange:l});case"variables":return eT(t);case"code_editor":return eg(t);default:return null}}(n,e,t)})}(r,t):function(e){var t,l;let r=null!==(t=e.value)&&void 0!==t?t:e.default;switch(e.type_name){case"int":case"float":return(0,a.jsx)(z.default.Item,{className:"mb-2 text-sm",name:e.name,initialValue:r,rules:[{required:!e.optional}],label:(0,a.jsx)("span",{className:"text-neutral-500",children:e.label}),tooltip:e.description?{title:e.description,icon:(0,a.jsx)(er.Z,{})}:"",children:(0,a.jsx)(A.Z,{className:"w-full nodrag"})});case"str":return(0,a.jsx)(z.default.Item,{className:"mb-2 text-sm",name:e.name,initialValue:r,rules:[{required:!e.optional}],label:(0,a.jsx)("span",{className:"text-neutral-500",children:e.label}),tooltip:e.description?{title:e.description,icon:(0,a.jsx)(er.Z,{})}:"",children:(null===(l=e.options)||void 0===l?void 0:l.length)>0?(0,a.jsx)(V.default,{className:"w-full nodrag",options:e.options.map(e=>({label:e.label,value:e.value}))}):(0,a.jsx)(c.default,{className:"w-full"})});case"bool":return r="True"===(r="False"!==r&&r)||r,(0,a.jsx)(z.default.Item,{className:"mb-2 text-sm",name:e.name,initialValue:r,rules:[{required:!e.optional}],label:(0,a.jsx)("span",{className:"text-neutral-500",children:e.label}),tooltip:e.description?{title:e.description,icon:(0,a.jsx)(er.Z,{})}:"",children:(0,a.jsx)(X.Z,{className:"ml-2"})})}}(r):void 0};function eM(e){let{label:t}=e;return(0,a.jsx)("div",{className:"w-full h-8 align-middle font-semibold",children:t})}var eq=l(12906),eR=l(43008),eG=l(57546),e$=l(60219),eJ=l(58638),eB=l(26855),eU=l(96074),eH=l(39332),eK=l(24885),eW=l(59819);l(4583);let eY={customNode:e=>{var t,l,n,s;let{data:i}=e,{inputs:o,outputs:d,parameters:c,flow_type:u}=i,[p,m]=(0,g.useState)(!1),f=(0,ed._K)(),[v]=z.default.useForm();async function x(e,t){let l=c.filter(t=>{var l;let{ui:a}=t;return null==a?void 0:null===(l=a.refresh_depends)||void 0===l?void 0:l.includes(e)});(null==l?void 0:l.length)!==0&&l.forEach(async l=>{let a={id:(0,F._g)(null==i?void 0:i.id),type_name:i.type_name,type_cls:i.type_cls,flow_type:"operator",refresh:[{name:l.name,depends:[{name:e,value:t,has_value:!0}]}]},[n,s]=await (0,r.Vx)((0,r.ks)(a));s&&f.setNodes(e=>e.map(e=>e.id===i.id?{...e,data:{...e.data,parameters:s.parameters}}:e))})}function j(e){let[t,l]=Object.entries(e)[0];c.forEach(e=>{e.name===t&&(e.value=l)}),l&&x(t,l)}return(0,a.jsx)(en.Z,{placement:"rightTop",trigger:["hover"],content:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ec,{className:"hover:text-blue-500",children:(0,a.jsx)(el.Z,{className:"h-full text-lg cursor-pointer",onClick:function(e){e.preventDefault(),e.stopPropagation();let t=f.getNodes(),l=t.find(e=>e.id===i.id);if(l){let e=(0,F.VZ)(l,t),a=(0,L.cloneDeep)(l),r={...a,id:e,position:{x:a.position.x+400,y:a.position.y},positionAbsolute:{x:a.positionAbsolute.x+400,y:a.positionAbsolute.y},data:{...a.data,id:e},selected:!1};f.setNodes(e=>[...e,r])}}})}),(0,a.jsx)(ec,{className:"mt-2 hover:text-red-500",children:(0,a.jsx)(ea.Z,{className:"h-full text-lg cursor-pointer",onClick:function(e){e.preventDefault(),e.stopPropagation(),f.setNodes(e=>e.filter(e=>e.id!==i.id)),f.setEdges(e=>e.filter(e=>e.source!==i.id&&e.target!==i.id))}})}),(0,a.jsx)(ec,{className:"mt-2",children:(0,a.jsx)(es.Z,{title:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"font-bold",children:i.label}),(0,a.jsx)("p",{children:i.description})]}),placement:"right",children:(0,a.jsx)(er.Z,{className:"h-full text-lg cursor-pointer"})})})]}),children:(0,a.jsxs)("div",{className:h()("h-auto rounded-xl shadow-md px-2 py-4 border bg-white dark:bg-zinc-800 cursor-grab flex flex-col space-y-2 text-sm",{"w-80":(null==i?void 0:null===(t=i.tags)||void 0===t?void 0:t.ui_size)==="middle"||!(null==i?void 0:null===(l=i.tags)||void 0===l?void 0:l.ui_size),"w-[256px]":(null==i?void 0:null===(n=i.tags)||void 0===n?void 0:n.ui_size)==="small","w-[530px]":(null==i?void 0:null===(s=i.tags)||void 0===s?void 0:s.ui_size)==="large","border-blue-500":i.selected||p,"border-stone-400 dark:border-white":!i.selected&&!p,"border-dashed":"operator"!==u,"border-red-600":i.invalid}),onMouseEnter:function(){m(!0)},onMouseLeave:function(){m(!1)},children:[(0,a.jsxs)("div",{className:"flex flex-row items-center",children:[(0,a.jsx)(eo(),{src:"/icons/node/vis.png",width:24,height:24,alt:""}),(0,a.jsx)("p",{className:"ml-2 text-lg font-bold text-ellipsis overflow-hidden whitespace-nowrap",children:i.label})]}),(null==o?void 0:o.length)>0&&(0,a.jsxs)("div",{className:"bg-zinc-100 dark:bg-zinc-700 rounded p-2",children:[(0,a.jsx)(eM,{label:"Inputs"}),(0,a.jsx)("div",{className:"flex flex-col space-y-2",children:null==o?void 0:o.map((e,t)=>(0,a.jsx)(ef,{node:i,data:e,type:"target",label:"inputs",index:t},"".concat(i.id,"_input_").concat(t)))})]}),(null==c?void 0:c.length)>0&&(0,a.jsxs)("div",{className:"bg-zinc-100 dark:bg-zinc-700 rounded p-2",children:[(0,a.jsx)(eM,{label:"Parameters"}),(0,a.jsx)(z.default,{form:v,layout:"vertical",onValuesChange:j,className:"flex flex-col space-y-3 text-neutral-500",children:null==c?void 0:c.map((e,t)=>(0,a.jsx)(eL,{formValuesChange:j,node:i,paramData:e,label:"parameters",index:t},"".concat(i.id,"_param_").concat(t)))})]}),"operator"===u&&(null==d?void 0:d.length)>0?(0,a.jsxs)("div",{className:"bg-zinc-100 dark:bg-zinc-700 rounded p-2",children:[(0,a.jsx)(eM,{label:"Outputs"}),null==d?void 0:d.map((e,t)=>(0,a.jsx)(ef,{node:i,data:e,type:"source",label:"outputs",index:t},"".concat(i.id,"_input_").concat(t)))]}):"resource"===u?(0,a.jsxs)("div",{className:"bg-zinc-100 dark:bg-zinc-700 rounded p-2",children:[(0,a.jsx)(eM,{label:"Outputs"}),(0,a.jsx)(ef,{node:i,data:i,type:"source",label:"outputs",index:0},"".concat(i.id,"_input_0"))]}):void 0]})})}},eX={buttonedge:S.Z},eQ=()=>{let{t:e}=(0,j.$G)(),t=(0,eH.useSearchParams)(),l=(null==t?void 0:t.get("id"))||"",s=(0,ed._K)(),[i,o]=G.ZP.useMessage(),d=(0,g.useRef)(null),[c,u,p]=(0,ed.Rr)([]),[f,v,x]=(0,ed.ll)([]),[h,b]=(0,g.useState)(),[w,y]=(0,g.useState)(!1),[_,N]=(0,g.useState)(!1),[Z,k]=(0,g.useState)(!1),[C,S]=(0,g.useState)(!1),[P,E]=(0,g.useState)(!1);if(localStorage.getItem("importFlowData")){let e=JSON.parse(localStorage.getItem("importFlowData")||"");localStorage.removeItem("importFlowData"),y(!0);let t=(0,F.z5)(e.flow_data);b(e),u(t.nodes),v(t.edges),y(!1)}async function V(){y(!0);let[e,t]=await (0,r.Vx)((0,r._d)(l));if(t){let e=(0,F.z5)(t.flow_data);b(t),u(e.nodes),v(e.edges)}y(!1)}(0,g.useEffect)(()=>{l&&V()},[l]),(0,g.useEffect)(()=>{let e=e=>{e.returnValue=G.ZP};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}},[]);let z=(0,g.useCallback)(e=>{var t,l;e.preventDefault();let a=d.current.getBoundingClientRect(),r=null===(t=null===(l=document.getElementsByClassName("ant-layout-sider"))||void 0===l?void 0:l[0])||void 0===t?void 0:t.offsetWidth,n=e.dataTransfer.getData("application/reactflow");if(!n||void 0===n)return;let i=JSON.parse(n),o=s.screenToFlowPosition({x:e.clientX-a.left+r,y:e.clientY-a.top}),c=(0,F.VZ)(i,s.getNodes());i.id=c;let p={id:c,position:o,type:"customNode",data:i};u(e=>e.concat(p).map(e=>(e.id===p.id?e.data={...e.data,selected:!0}:e.data={...e.data,selected:!1},e)))},[s]),O=(0,g.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},[]);function A(){let t=s.toObject(),[l,r,n]=(0,F.Rv)(t);if(!r){i.open({type:"warning",content:e("Please_Add_Nodes_First")});return}if(!l&&n)return u(e=>e.map(e=>({...e,data:{...e.data,invalid:e.id===(null==r?void 0:r.id)}}))),eB.ZP.error({message:"Error",description:n,icon:(0,a.jsx)(eq.Z,{className:"text-red-600"})});N(!0)}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-row",children:[(0,a.jsx)(I,{}),(0,a.jsxs)("div",{className:"flex flex-col flex-1",children:[(0,a.jsx)(m.Z,{className:"my-2 mx-4 flex flex-row justify-end",children:(()=>{let t=[{title:e("template"),icon:(0,a.jsx)(eR.Z,{className:"block text-xl",onClick:()=>E(!0)})},{title:e("Import"),icon:(0,a.jsx)(eG.Z,{className:"block text-xl",onClick:()=>S(!0)})},{title:e("save"),icon:(0,a.jsx)(e$.Z,{className:"block text-xl",onClick:A})}];return""!==l&&t.unshift({title:e("Export"),icon:(0,a.jsx)(eJ.Z,{className:"block text-xl",onClick:()=>k(!0)})}),t})().map(e=>{let{title:t,icon:l}=e;return(0,a.jsx)(es.Z,{title:t,className:"w-8 h-8 rounded-md bg-stone-300 dark:bg-zinc-700 dark:text-zinc-200 hover:text-blue-500 dark:hover:text-zinc-100",children:l},t)})}),(0,a.jsx)(eU.Z,{className:"mt-0 mb-0"}),(0,a.jsx)("div",{className:"h-[calc(100vh-48px)] w-full",ref:d,children:(0,a.jsxs)(ed.x$,{nodes:c,edges:f,nodeTypes:eY,edgeTypes:eX,onNodesChange:p,onEdgesChange:x,onNodeClick:function(e,t){s.setNodes(e=>e.map(e=>(e.id===t.id?e.data={...e.data,selected:!0}:e.data={...e.data,selected:!1},e)))},onConnect:function(e){let t={...e,type:"buttonedge",id:"".concat(e.source,"|").concat(e.target)};v(e=>(0,ed.Z_)(t,e))},onDrop:z,onDragOver:O,minZoom:.1,fitView:!0,deleteKeyCode:["Backspace","Delete"],children:[(0,a.jsx)(eK.Z,{className:"flex flex-row items-center",position:"bottom-center"}),(0,a.jsx)(eW.A,{color:"#aaa",gap:16}),(0,a.jsx)(R,{flowInfo:h,setFlowInfo:b})]})})]})]}),(0,a.jsx)(n.Z,{visible:w}),(0,a.jsx)(et,{reactFlow:s,flowInfo:h,isSaveFlowModalOpen:_,setIsSaveFlowModalOpen:N}),(0,a.jsx)(B,{reactFlow:s,flowInfo:h,isExportFlowModalOpen:Z,setIsExportFlowModalOpen:k}),(0,a.jsx)(Y,{setNodes:u,setEdges:v,isImportModalOpen:C,setIsImportFlowModalOpen:S}),(0,a.jsx)(H,{isFlowTemplateModalOpen:P,setIsFlowTemplateModalOpen:E}),o]})};function e0(){return(0,a.jsx)(ed.tV,{children:(0,a.jsx)(eQ,{})})}},67919:function(e,t,l){"use strict";l.d(t,{Av:function(){return d},It:function(){return o},Rv:function(){return i},VZ:function(){return a},Wf:function(){return n},_g:function(){return r},z5:function(){return s}});let a=(e,t)=>{let l=0;return t.forEach(t=>{t.data.name===e.name&&l++}),"".concat(e.id,"_").concat(l)},r=e=>e.replace(/_\d+$/,""),n=e=>{let{nodes:t,edges:l,...a}=e,r=t.map(e=>{let{positionAbsolute:t,...l}=e;return{position_absolute:t,...l}}),n=l.map(e=>{let{sourceHandle:t,targetHandle:l,...a}=e;return{source_handle:t,target_handle:l,...a}});return{nodes:r,edges:n,...a}},s=e=>{let{nodes:t,edges:l,...a}=e,r=t.map(e=>{let{position_absolute:t,...l}=e;return{positionAbsolute:t,...l}}),n=l.map(e=>{let{source_handle:t,target_handle:l,...a}=e;return{sourceHandle:t,targetHandle:l,...a}});return{nodes:r,edges:n,...a}},i=e=>{let{nodes:t,edges:l}=e,a=[!0,t[0],""];e:for(let e=0;el.targetHandle==="".concat(t[e].id,"|inputs|").concat(s))){a=[!1,t[e],"The input ".concat(n[s].type_name," of node ").concat(r.label," is required")];break e}for(let n=0;nl.targetHandle==="".concat(t[e].id,"|parameters|").concat(n))){if(!i.optional&&"common"===i.category&&(void 0===i.value||null===i.value)){a=[!1,t[e],"The parameter ".concat(i.type_name," of node ").concat(r.label," is required")];break e}}else{a=[!1,t[e],"The parameter ".concat(i.type_name," of node ").concat(r.label," is required")];break e}}}return a},o=e=>(function e(t){if(Array.isArray(t))return t.map(t=>e(t));if(t&&"object"==typeof t&&!Array.isArray(t)){let l={};for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)){let r=a.replace(/_([a-z])/g,(e,t)=>t.toUpperCase());l[r]=e(t[a])}return l}return t})(e);function d(e){let t=new Set(["@","#","%",":"]),l={key:e.key||"",name:e.name||"",scope:e.scope||"",scope_key:e.scope_key||"",sys_code:e.sys_code||"",user_name:e.user_name||""};for(let[e,a]of Object.entries(l))a&&[...t].some(e=>a.includes(e))&&(l[e]=a.replace(/@/g,"\\@").replace(/#/g,"\\#").replace(/%/g,"\\%").replace(/:/g,"\\:"));let{key:a,name:r,scope:n,scope_key:s,sys_code:i,user_name:o}=l,d="".concat(a);return r&&(d+="".concat(":").concat(r)),(n||s)&&(d+="".concat("@").concat(n),s&&(d+="".concat(":").concat(s))),i&&(d+="".concat("#").concat(i)),o&&(d+="".concat("%").concat(o)),"${".concat(d,"}")}}},function(e){e.O(0,[3662,8241,2648,3791,2913,5278,8791,4330,1049,5030,4041,9859,3799,2684,1300,4567,9773,3457,5782,7873,3764,1278,1010,2070,9774,2888,179],function(){return e(e.s=94617)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1767],{94617:function(e,t,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/construct/flow/canvas",function(){return l(66084)}])},45247:function(e,t,l){"use strict";var a=l(85893),r=l(50888);t.Z=function(e){let{visible:t}=e;return t?(0,a.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 backdrop-blur-sm text-3xl animate-fade animate-duration-200",children:(0,a.jsx)(r.Z,{})}):null}},99743:function(e,t,l){"use strict";var a=l(85893);l(67294);var r=l(36851);t.Z=e=>{let{id:t,sourceX:l,sourceY:n,targetX:s,targetY:i,sourcePosition:o,targetPosition:d,style:c={},markerEnd:u}=e,[p,m,f]=(0,r.OQ)({sourceX:l,sourceY:n,sourcePosition:o,targetX:s,targetY:i,targetPosition:d}),v=(0,r._K)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.u5,{id:t,style:c,path:p,markerEnd:u}),(0,a.jsx)("foreignObject",{width:40,height:40,x:m-20,y:f-20,className:"bg-transparent w-10 h-10 relative",requiredExtensions:"http://www.w3.org/1999/xhtml",children:(0,a.jsx)("button",{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-5 h-5 rounded-full bg-stone-400 dark:bg-zinc-700 cursor-pointer text-sm",onClick:e=>{e.stopPropagation(),v.setEdges(v.getEdges().filter(e=>e.id!==t))},children:"\xd7"})})]})}},66084:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return e0}});var a=l(85893),r=l(76212),n=l(45247),s=l(41468),i=l(62418),o=l(14313),d=l(94155),c=l(25278),u=l(21612),p=l(40411),m=l(42075),f=l(72269),v=l(47221),x=l(93967),h=l.n(x),g=l(67294),j=l(67421),b=l(2487),w=l(7134),y=l(32983),_=e=>{let{nodes:t}=e,{t:l}=(0,j.$G)();return(null==t?void 0:t.length)>0?(0,a.jsx)(b.Z,{className:"overflow-hidden overflow-y-auto w-full",size:"small",itemLayout:"horizontal",dataSource:t,renderItem:e=>(0,a.jsx)(b.Z.Item,{className:"cursor-move hover:bg-[#F1F5F9] dark:hover:bg-theme-dark p-0 py-2",draggable:!0,onDragStart:t=>{t.dataTransfer.setData("application/reactflow",JSON.stringify(e)),t.dataTransfer.effectAllowed="move"},children:(0,a.jsx)(b.Z.Item.Meta,{className:"flex items-center justify-center",avatar:(0,a.jsx)(w.C,{src:"/icons/node/vis.png",size:"large"}),title:(0,a.jsx)("p",{className:"line-clamp-1 font-medium",children:e.label}),description:(0,a.jsx)("p",{className:"line-clamp-2",children:e.description})})})}):(0,a.jsx)(y.Z,{className:"px-2",description:l("no_node")})};let{Search:N}=c.default,{Sider:Z}=u.default,k=JSON.stringify({order:"higher-order"}),C={display:"flex",alignItems:"center",justifyContent:"center",width:16,height:48,position:"absolute",top:"50%",transform:"translateY(-50%)",border:"1px solid #d6d8da",borderRadius:8,right:-8};var I=()=>{let{t:e}=(0,j.$G)(),{mode:t}=(0,g.useContext)(s.p),[l,n]=(0,g.useState)(!1),[c,u]=(0,g.useState)(""),[x,b]=(0,g.useState)([]),[w,y]=(0,g.useState)([]),[I,S]=(0,g.useState)([]),[F,P]=(0,g.useState)([]),[E,V]=(0,g.useState)(!1);async function z(e){let[t,l]=await (0,r.Vx)((0,r.As)(e));if(l&&l.length>0){localStorage.setItem(i.zN,JSON.stringify(l));let e=l.filter(e=>"operator"===e.flow_type),t=l.filter(e=>"resource"===e.flow_type);b(e),y(t),S(A(e)),P(A(t))}}(0,g.useEffect)(()=>{z(k)},[]);let O=(0,g.useMemo)(()=>l?{...C,right:-16,borderRadius:"0px 8px 8px 0",borderLeft:"1px solid #d5e5f6"}:{...C,borderLeft:"1px solid #d6d8da"},[l]);function A(e){let t=[],l={};return e.forEach(e=>{let{category:a,category_label:r}=e;l[a]||(l[a]={category:a,categoryLabel:r,nodes:[]},t.push(l[a])),l[a].nodes.push(e)}),t}let D=(0,g.useMemo)(()=>{if(!c)return I.map(e=>{let{category:t,categoryLabel:l,nodes:r}=e;return{key:t,label:l,children:(0,a.jsx)(_,{nodes:r}),extra:(0,a.jsx)(p.Z,{showZero:!0,count:r.length||0,style:{backgroundColor:r.length>0?"#52c41a":"#7f9474"}})}});{let e=x.filter(e=>e.label.toLowerCase().includes(c.toLowerCase()));return A(e).map(e=>{let{category:t,categoryLabel:l,nodes:r}=e;return{key:t,label:l,children:(0,a.jsx)(_,{nodes:r}),extra:(0,a.jsx)(p.Z,{showZero:!0,count:r.length||0,style:{backgroundColor:r.length>0?"#52c41a":"#7f9474"}})}})}},[I,c]),T=(0,g.useMemo)(()=>{if(!c)return F.map(e=>{let{category:t,categoryLabel:l,nodes:r}=e;return{key:t,label:l,children:(0,a.jsx)(_,{nodes:r}),extra:(0,a.jsx)(p.Z,{showZero:!0,count:r.length||0,style:{backgroundColor:r.length>0?"#52c41a":"#7f9474"}})}});{let e=w.filter(e=>e.label.toLowerCase().includes(c.toLowerCase()));return A(e).map(e=>{let{category:t,categoryLabel:l,nodes:r}=e;return{key:t,label:l,children:(0,a.jsx)(_,{nodes:r}),extra:(0,a.jsx)(p.Z,{showZero:!0,count:r.length||0,style:{backgroundColor:r.length>0?"#52c41a":"#7f9474"}})}})}},[F,c]);return(0,a.jsx)(Z,{className:"flex justify-center items-start nodrag bg-[#ffffff80] border-r border-[#d5e5f6] dark:bg-[#ffffff29] dark:border-[#ffffff66]",theme:t,width:280,collapsible:!0,collapsed:l,collapsedWidth:0,trigger:l?(0,a.jsx)(o.Z,{className:"text-base"}):(0,a.jsx)(d.Z,{className:"text-base"}),zeroWidthTriggerStyle:O,onCollapse:e=>n(e),children:(0,a.jsxs)(m.Z,{direction:"vertical",className:"w-[280px] pt-4 px-4 overflow-hidden overflow-y-auto scrollbar-default",children:[(0,a.jsxs)("div",{className:"flex justify-between align-middle",children:[(0,a.jsx)("p",{className:"w-full text-base font-semibold text-[#1c2533] dark:text-[rgba(255,255,255,0.85)] line-clamp-1",children:e("add_node")}),(0,a.jsx)(f.Z,{checkedChildren:"高阶",unCheckedChildren:"全部",onClick:function(){E?z(k):z(),V(!E)},className:h()("w-20",{"bg-zinc-400":E}),defaultChecked:!0})]}),(0,a.jsx)(N,{placeholder:"Search node",onSearch:function(e){u(e)},allowClear:!0}),(0,a.jsx)("h2",{className:"font-semibold",children:e("operators")}),(0,a.jsx)(v.Z,{size:"small",bordered:!1,className:"max-h-[calc((100vh-156px)/2)] overflow-hidden overflow-y-auto scrollbar-default",defaultActiveKey:[""],items:D}),(0,a.jsx)("h2",{className:"font-semibold",children:e("resource")}),(0,a.jsx)(v.Z,{size:"small",bordered:!1,className:"max-h-[calc((100vh-156px)/2)] overflow-hidden overflow-y-auto scrollbar-default",defaultActiveKey:[""],items:T})]})})},S=l(99743),F=l(67919),P=l(24969),E=l(3089),V=l(34041),z=l(99859),O=l(3303),A=l(13457),D=l(14726),T=l(85576),L=l(96486);let{Option:M}=V.default,q=["str","int","float","bool","ref"],R=e=>{let{flowInfo:t,setFlowInfo:l}=e,{t:n}=(0,j.$G)(),[s,i]=(0,g.useState)(!1),[o]=z.default.useForm(),[d,u]=(0,g.useState)(["str"]),[p,f]=(0,g.useState)([]);(0,g.useEffect)(()=>{v()},[]);let v=async()=>{let[e,t]=await (0,r.Vx)((0,r.RR)());if(e)return;let l=null==t?void 0:t.map(e=>{let{key:t,label:l,scope:a}=e;return{value:t,label:l,scope:a,isLeaf:!1}});f(l)},x=(e,t)=>{var l,a;let r=e.target.value,n=null===(l=null===(a=null==r?void 0:r.split("_"))||void 0===a?void 0:a.map(e=>e.charAt(0).toUpperCase()+e.slice(1)))||void 0===l?void 0:l.join(" ");o.setFields([{name:["parameters",t,"label"],value:n}])},h=(e,t)=>{let l=[...d];l[t]=e,u(l)},b=e=>{let t=e[e.length-1],{value:l,scope:a}=t;setTimeout(async()=>{let[e,n]=await (0,r.Vx)((0,r.gt)({key:l,scope:a}));if(e)return;if((null==n?void 0:n.total_count)===0){t.isLeaf=!0;return}let s=(0,L.uniqBy)(null==n?void 0:n.items,"name");t.children=null==s?void 0:s.map(e=>({value:null==e?void 0:e.name,label:e.label,item:e})),f([...p])},1e3)},w=(e,t,l)=>{var a,r,n;if((null==e?void 0:e.length)!==2)return;let[s,i]=t,d=null==s?void 0:null===(a=s.children)||void 0===a?void 0:a.find(e=>{let{value:t}=e;return t===(null==i?void 0:i.value)}),c=(0,F.Av)(null==d?void 0:d.item),u=o.getFieldValue("parameters"),p=null==u?void 0:u[l];p&&(p.value=c,p.category=null==d?void 0:null===(r=d.item)||void 0===r?void 0:r.category,p.value_type=null==d?void 0:null===(n=d.item)||void 0===n?void 0:n.value_type,o.setFieldsValue({parameters:[...u]}))},y=(e,t)=>{switch(e){case"ref":return(0,a.jsx)(O.Z,{placeholder:"Select Value",options:p,loadData:b,onChange:(e,l)=>w(e,l,t),changeOnSelect:!0});case"str":default:return(0,a.jsx)(c.default,{placeholder:"Parameter Value"});case"int":return(0,a.jsx)(A.Z,{step:1,placeholder:"Parameter Value",parser:e=>(null==e?void 0:e.replace(/[^\-?\d]/g,""))||0,style:{width:"100%"}});case"float":return(0,a.jsx)(A.Z,{placeholder:"Parameter Value",style:{width:"100%"}});case"bool":return(0,a.jsxs)(V.default,{placeholder:"Select Value",children:[(0,a.jsx)(M,{value:!0,children:"True"}),(0,a.jsx)(M,{value:!1,children:"False"})]})}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(D.ZP,{type:"primary",className:"flex items-center justify-center rounded-full left-4 top-4",style:{zIndex:1050},icon:(0,a.jsx)(P.Z,{}),onClick:()=>i(!0)}),(0,a.jsx)(T.default,{title:n("Add_Global_Variable_of_Flow"),width:1e3,open:s,styles:{body:{minHeight:"40vh",maxHeight:"65vh",overflow:"scroll",backgroundColor:"rgba(0,0,0,0.02)",padding:"0 8px",borderRadius:4}},onCancel:()=>i(!1),footer:[(0,a.jsx)(D.ZP,{onClick:()=>i(!1),children:n("cancel")},"cancel"),(0,a.jsx)(D.ZP,{type:"primary",onClick:()=>o.submit(),children:n("verify")},"submit")],children:(0,a.jsx)(z.default,{name:"dynamic_form_nest_item",onFinish:e=>{let a={...t,variables:(null==e?void 0:e.parameters)||[]};l(a),i(!1)},form:o,autoComplete:"off",layout:"vertical",className:"mt-8",initialValues:{parameters:(null==t?void 0:t.variables)||[{}]},children:(0,a.jsx)(z.default.List,{name:"parameters",children:(e,t)=>{let{add:l,remove:r}=t;return(0,a.jsxs)(a.Fragment,{children:[e.map((e,t)=>{let{key:l,name:n,...s}=e;return(0,a.jsxs)(m.Z,{className:"hover:bg-gray-100 pt-2 pl-2",children:[(0,a.jsx)(z.default.Item,{...s,name:[n,"name"],label:"参数 ".concat(t+1," 名称"),style:{width:140},rules:[{required:!0,message:"Missing parameter name"},{pattern:/^[a-zA-Z0-9]+(_[a-zA-Z0-9]+)*$/,message:"名称必须是字母、数字或下划线,并使用下划线分隔多个单词"}],children:(0,a.jsx)(c.default,{placeholder:"Parameter Name",onChange:e=>x(e,t)})}),(0,a.jsx)(z.default.Item,{...s,name:[n,"label"],label:"标题",style:{width:130},rules:[{required:!0,message:"Missing parameter label"}],children:(0,a.jsx)(c.default,{placeholder:"Parameter Label"})}),(0,a.jsx)(z.default.Item,{...s,name:[n,"value_type"],label:"类型",style:{width:100},rules:[{required:!0,message:"Missing parameter type"}],children:(0,a.jsx)(V.default,{placeholder:"Select",onChange:e=>h(e,t),children:q.map(e=>(0,a.jsx)(M,{value:e,children:e},e))})}),(0,a.jsx)(z.default.Item,{...s,name:[n,"value"],label:"值",style:{width:320},rules:[{required:!0,message:"Missing parameter value"}],children:y(d[t],t)}),(0,a.jsx)(z.default.Item,{...s,name:[n,"description"],label:"描述",style:{width:170},children:(0,a.jsx)(c.default,{placeholder:"Parameter Description"})}),(0,a.jsx)(E.Z,{onClick:()=>r(n)}),(0,a.jsx)(z.default.Item,{name:[n,"key"],hidden:!0,initialValue:"dbgpt.core.flow.params"}),(0,a.jsx)(z.default.Item,{name:[n,"scope"],hidden:!0,initialValue:"flow_priv"}),(0,a.jsx)(z.default.Item,{name:[n,"category"],hidden:!0,initialValue:"common"})]},l)}),(0,a.jsx)(z.default.Item,{children:(0,a.jsx)(D.ZP,{type:"dashed",onClick:()=>l(),block:!0,icon:(0,a.jsx)(P.Z,{}),children:n("Add_Parameter")})})]})}})})})]})};var G=l(45360),$=l(78045),J=l(83454);let B=e=>{let{reactFlow:t,flowInfo:l,isExportFlowModalOpen:r,setIsExportFlowModalOpen:n}=e,{t:s}=(0,j.$G)(),[i]=z.default.useForm(),[o,d]=G.ZP.useMessage(),u=async e=>{if("json"===e.format){let l=t.toObject(),a=new Blob([JSON.stringify(l)],{type:"text/plain;charset=utf-8"}),r=URL.createObjectURL(a),n=document.createElement("a");n.href=r,n.download=e.file_name||"flow.json",n.click()}else{var l;let t="".concat(null!==(l=J.env.API_BASE_URL)&&void 0!==l?l:"","/api/v2/serve/awel/flow/export/").concat(e.uid,"?export_type=").concat(e.export_type,"&format=").concat(e.format);window.open(t)}o.success(s("Export_Flow_Success")),n(!1)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T.default,{title:s("Export_Flow"),open:r,onCancel:()=>n(!1),footer:[(0,a.jsx)(D.ZP,{onClick:()=>n(!1),children:s("cancel")},"cancel"),(0,a.jsx)(D.ZP,{type:"primary",onClick:()=>i.submit(),children:s("verify")},"submit")],children:(0,a.jsxs)(z.default,{form:i,className:"mt-6",labelCol:{span:6},wrapperCol:{span:16},onFinish:u,initialValues:{export_type:"json",format:"file",uid:null==l?void 0:l.uid},children:[(0,a.jsx)(z.default.Item,{label:s("Export_File_Type"),name:"export_type",children:(0,a.jsxs)($.ZP.Group,{children:[(0,a.jsx)($.ZP,{value:"json",children:"JSON"}),(0,a.jsx)($.ZP,{value:"dbgpts",children:"DBGPTS"})]})}),(0,a.jsx)(z.default.Item,{label:s("Export_File_Format"),name:"format",children:(0,a.jsxs)($.ZP.Group,{children:[(0,a.jsx)($.ZP,{value:"file",children:"File"}),(0,a.jsx)($.ZP,{value:"json",children:"JSON"})]})}),(0,a.jsx)(z.default.Item,{hidden:!0,name:"uid",children:(0,a.jsx)(c.default,{})})]})}),d]})};var U=l(39773);let H=e=>{let{isFlowTemplateModalOpen:t,setIsFlowTemplateModalOpen:l}=e,{t:n}=(0,j.$G)(),[s,i]=(0,g.useState)([]),o=e=>{(null==e?void 0:e.name)&&(localStorage.setItem("importFlowData",JSON.stringify(e)),e0(),l(!1))},d=[{title:n("Template_Name"),dataIndex:"name",key:"name"},{title:n("Template_Label"),dataIndex:"label",key:"label"},{title:n("Template_Description"),dataIndex:"description",key:"description"},{title:n("Template_Action"),key:"action",render:(e,t)=>(0,a.jsx)(m.Z,{size:"middle",children:(0,a.jsx)(D.ZP,{type:"link",onClick:()=>{o(t)},block:!0,children:n("Import_From_Template")})})}];return(0,g.useEffect)(()=>{(0,r.MJ)().then(e=>{var t,l;console.log(e),i(null==e?void 0:null===(t=e.data)||void 0===t?void 0:null===(l=t.data)||void 0===l?void 0:l.items)})},[]),(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(T.default,{className:"w-[700px]",title:n("Import_From_Template"),open:t,onCancel:()=>l(!1),cancelButtonProps:{className:"hidden"},okButtonProps:{className:"hidden"},children:[(0,a.jsx)(U.Z,{className:"w-full",dataSource:s,columns:d}),";"]})})};var K=l(88484),W=l(23799);let Y=e=>{let{isImportModalOpen:t,setIsImportFlowModalOpen:l}=e,{t:n}=(0,j.$G)(),[s]=z.default.useForm(),[i,o]=G.ZP.useMessage(),[d,c]=(0,g.useState)([]);(0,g.useEffect)(()=>{t&&(s.resetFields(),c([]))},[t,s]);let u=async e=>{var t;e.file=null===(t=e.file)||void 0===t?void 0:t[0];let a=new FormData;d.forEach(t=>{a.append("file",t),a.append("save_flow",e.save_flow)});let[,,s]=await (0,r.Vx)((0,r._Y)(a));(null==s?void 0:s.success)?(i.success(n("Import_Flow_Success")),localStorage.setItem("importFlowData",JSON.stringify(null==s?void 0:s.data)),e0()):(null==s?void 0:s.err_msg)&&i.error(null==s?void 0:s.err_msg),l(!1)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T.default,{title:n("Import_Flow"),open:t,onCancel:()=>l(!1),footer:[(0,a.jsx)(D.ZP,{onClick:()=>l(!1),children:n("cancel")},"cancel"),(0,a.jsx)(D.ZP,{type:"primary",onClick:()=>s.submit(),children:n("verify")},"submit")],children:(0,a.jsxs)(z.default,{form:s,className:"mt-6",labelCol:{span:6},wrapperCol:{span:16},onFinish:u,initialValues:{save_flow:!1},children:[(0,a.jsx)(z.default.Item,{name:"file",label:n("Select_File"),valuePropName:"fileList",getValueFromEvent:e=>Array.isArray(e)?e:e&&e.fileList,rules:[{required:!0,message:"Please upload a file"}],children:(0,a.jsx)(W.default,{onRemove:e=>{let t=d.indexOf(e),l=d.slice();l.splice(t,1),c(l)},beforeUpload:e=>(c([...d,e]),!1),fileList:d,accept:".json,.zip",maxCount:1,children:(0,a.jsxs)(D.ZP,{icon:(0,a.jsx)(K.Z,{}),children:[" ",n("Upload")]})})}),(0,a.jsx)(z.default.Item,{name:"save_flow",label:n("Save_After_Import"),hidden:!0,children:(0,a.jsxs)($.ZP.Group,{children:[(0,a.jsx)($.ZP,{value:!0,children:n("Yes")}),(0,a.jsx)($.ZP,{value:!1,children:n("No")})]})})]})}),o]})};var X=l(84567),Q=l(11163);let{TextArea:ee}=c.default,et=e=>{let{reactFlow:t,isSaveFlowModalOpen:l,flowInfo:n,setIsSaveFlowModalOpen:s}=e,{t:i}=(0,j.$G)(),o=(0,Q.useRouter)(),[d]=z.default.useForm(),[u,p]=G.ZP.useMessage(),[m,f]=(0,g.useState)(!1),[v,x]=(0,g.useState)(o.query.id||"");async function h(){let{name:e,label:l,description:a="",editable:c=!1,state:p="deployed"}=d.getFieldsValue(),m=(0,F.Wf)(t.toObject());if(v){let[,,t]=await (0,r.Vx)((0,r.ao)(v.toString(),{name:e,label:l,description:a,editable:c,uid:v.toString(),flow_data:m,state:p,variables:null==n?void 0:n.variables}));(null==t?void 0:t.success)?u.success(i("save_flow_success")):(null==t?void 0:t.err_msg)&&u.error(null==t?void 0:t.err_msg)}else{let[t,s]=await (0,r.Vx)((0,r.zd)({name:e,label:l,description:a,editable:c,flow_data:m,state:p,variables:null==n?void 0:n.variables}));(null==s?void 0:s.uid)&&(u.success(i("save_flow_success")),o.push("/construct/flow/canvas?id=".concat(s.uid),void 0,{shallow:!0}))}s(!1)}return(0,g.useEffect)(()=>{x(o.query.id||"")},[o.query.id]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T.default,{title:i("flow_modal_title"),open:l,onCancel:()=>s(!1),footer:[(0,a.jsx)(D.ZP,{onClick:()=>s(!1),children:i("cancel")},"cancel"),(0,a.jsx)(D.ZP,{type:"primary",onClick:()=>d.submit(),children:i("verify")},"submit")],children:(0,a.jsxs)(z.default,{name:"flow_form",form:d,labelCol:{span:6},wrapperCol:{span:16},className:"mt-6 max-w-2xl",initialValues:{remember:!0},onFinish:h,autoComplete:"off",children:[(0,a.jsx)(z.default.Item,{label:"Title",name:"label",initialValue:null==n?void 0:n.label,rules:[{required:!0,message:"Please input flow title!"}],children:(0,a.jsx)(c.default,{onChange:function(e){let t=e.target.value,l=t.replace(/\s+/g,"_").replace(/[^a-z0-9_-]/g,"").toLowerCase();d.setFieldsValue({name:l})}})}),(0,a.jsx)(z.default.Item,{label:"Name",name:"name",initialValue:null==n?void 0:n.name,rules:[{required:!0,message:"Please input flow name!"},()=>({validator:(e,t)=>/^[a-zA-Z0-9_\-]+$/.test(t)?Promise.resolve():Promise.reject("Can only contain numbers, letters, underscores, and dashes")})],children:(0,a.jsx)(c.default,{})}),(0,a.jsx)(z.default.Item,{label:"Description",initialValue:null==n?void 0:n.description,name:"description",children:(0,a.jsx)(ee,{rows:3})}),(0,a.jsx)(z.default.Item,{label:"Editable",name:"editable",initialValue:(null==n?void 0:n.editable)||!0,valuePropName:"checked",children:(0,a.jsx)(X.Z,{})}),(0,a.jsx)(z.default.Item,{hidden:!0,name:"state",children:(0,a.jsx)(c.default,{})}),(0,a.jsx)(z.default.Item,{label:"Deploy",children:(0,a.jsx)(X.Z,{defaultChecked:(null==n?void 0:n.state)==="deployed"||(null==n?void 0:n.state)==="running",checked:m,onChange:e=>{let t=e.target.checked;d.setFieldValue("state",t?"deployed":"developing"),f(t)}})})]})}),p]})};var el=l(57132),ea=l(48689),er=l(45605),en=l(55241),es=l(83062),ei=l(25675),eo=l.n(ei),ed=l(36851),ec=e=>{let{children:t,className:l}=e;return(0,a.jsx)("div",{className:h()("flex justify-center items-center w-8 h-8 rounded-full dark:bg-zinc-700 hover:bg-stone-200 dark:hover:bg-zinc-900",l),children:t})},eu=l(45030),ep=l(86738),em=e=>{let{optional:t}=e;return t?null:(0,a.jsx)("span",{className:"text-red-600 align-middle inline-block",children:"\xa0*"})},ef=e=>{let{node:t,data:l,type:r,label:n,index:s}=e,{t:o}=(0,j.$G)(),d=(0,ed._K)(),[c,u]=g.useState([]);function p(){let e=localStorage.getItem(i.zN);if(!e)return;let a=JSON.parse(e),r=l.type_cls,s=[];"inputs"===n?s=a.filter(e=>"operator"===e.flow_type).filter(e=>{var t;return null===(t=e.outputs)||void 0===t?void 0:t.some(e=>e.type_cls===r&&e.is_list===(null==l?void 0:l.is_list))}):"parameters"===n?s=a.filter(e=>"resource"===e.flow_type).filter(e=>{var t;return null===(t=e.parent_cls)||void 0===t?void 0:t.includes(r)}):"outputs"===n&&("operator"===t.flow_type?s=a.filter(e=>"operator"===e.flow_type).filter(e=>{var t;return null===(t=e.inputs)||void 0===t?void 0:t.some(e=>e.type_cls===r&&e.is_list===(null==l?void 0:l.is_list))}):"resource"===t.flow_type&&(s=a.filter(e=>{var l,a;return(null===(l=e.inputs)||void 0===l?void 0:l.some(e=>{var l;return null===(l=t.parent_cls)||void 0===l?void 0:l.includes(e.type_cls)}))||(null===(a=e.parameters)||void 0===a?void 0:a.some(e=>{var l;return null===(l=t.parent_cls)||void 0===l?void 0:l.includes(e.type_cls)}))}))),u(s)}return(0,a.jsxs)("div",{className:h()("relative flex items-center",{"justify-start":"parameters"===n||"inputs"===n,"justify-end":"outputs"===n}),children:[(0,a.jsx)(ed.HH,{className:h()("w-2 h-2","source"===r?"-mr-4":"-ml-4"),type:r,position:"source"===r?ed.Ly.Right:ed.Ly.Left,id:"".concat(t.id,"|").concat(n,"|").concat(s),isValidConnection:e=>(function(e){var t,l;let{sourceHandle:a,targetHandle:r,source:n,target:s}=e,i=d.getNode(n),c=d.getNode(s),{flow_type:u}=null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},{flow_type:p}=null!==(l=null==c?void 0:c.data)&&void 0!==l?l:{},m=null==a?void 0:a.split("|")[1],f=null==r?void 0:r.split("|")[1],v=null==a?void 0:a.split("|")[2],x=null==r?void 0:r.split("|")[2],h=null==c?void 0:c.data[f][x].type_cls;if(u===p&&"operator"===u){let e=null==i?void 0:i.data[m][v].type_cls,t=null==i?void 0:i.data[m][v].is_list,l=null==c?void 0:c.data[f][x].is_list;return e===h&&t===l}if("resource"===u&&("operator"===p||"resource"===p)){let e=null==i?void 0:i.data.parent_cls;return e.includes(h)}return G.ZP.warning(o("connect_warning")),!1})(e)}),(0,a.jsxs)(eu.Z,{className:h()("bg-white dark:bg-[#232734] w-full px-2 py-1 rounded text-neutral-500",{"text-right":"outputs"===n}),children:[(0,a.jsx)(ep.Z,{placement:"left",icon:null,showCancel:!1,okButtonProps:{className:"hidden"},title:o("related_nodes"),description:(0,a.jsx)("div",{className:"w-60",children:(0,a.jsx)(_,{nodes:c})}),children:["inputs","parameters"].includes(n)&&(0,a.jsx)(P.Z,{className:"cursor-pointer",onClick:p})}),"outputs"!==n&&(0,a.jsx)(em,{optional:l.optional}),l.type_name,l.description&&(0,a.jsx)(es.Z,{title:l.description,children:(0,a.jsx)(er.Z,{className:"ml-2 cursor-pointer"})}),(0,a.jsx)(ep.Z,{placement:"right",icon:null,showCancel:!1,okButtonProps:{className:"hidden"},title:o("related_nodes"),description:(0,a.jsx)("div",{className:"w-60",children:(0,a.jsx)(_,{nodes:c})}),children:["outputs"].includes(n)&&(0,a.jsx)(P.Z,{className:"ml-2 cursor-pointer",onClick:p})})]})]})};let ev=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(O.Z,{...l,options:e.options,placeholder:"please select",className:"w-full nodrag"})},ex=e=>{var t,l;let r=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(null===(l=e.options)||void 0===l?void 0:l.length)>0&&(0,a.jsx)("div",{className:"bg-white p-2 rounded",children:(0,a.jsx)(X.Z.Group,{...r,options:e.options})})};var eh=l(63764);let eg=e=>{var t,l,r,n,s,i,o,d;let{t:c}=(0,j.$G)(),u=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{}),[p,m]=(0,g.useState)(!1),f=(0,g.useMemo)(()=>{var t,l,a,r;return(null==e?void 0:null===(t=e.ui)||void 0===t?void 0:null===(l=t.editor)||void 0===l?void 0:l.width)?(null==e?void 0:null===(a=e.ui)||void 0===a?void 0:null===(r=a.editor)||void 0===r?void 0:r.width)+100:"80%"},[null==e?void 0:null===(l=e.ui)||void 0===l?void 0:null===(r=l.editor)||void 0===r?void 0:r.width]);return(0,a.jsxs)("div",{className:"p-2 text-sm",children:[(0,a.jsx)(D.ZP,{type:"default",onClick:()=>{m(!0)},children:c("Open_Code_Editor")}),(0,a.jsx)(T.default,{title:c("Code_Editor"),width:f,open:p,onOk:()=>{m(!1)},onCancel:()=>{m(!1)},children:(0,a.jsx)(z.default.Item,{name:null==e?void 0:e.name,children:(0,a.jsx)(eh.ZP,{...u,width:(null==e?void 0:null===(n=e.ui)||void 0===n?void 0:null===(s=n.editor)||void 0===s?void 0:s.width)||"100%",height:(null==e?void 0:null===(i=e.ui)||void 0===i?void 0:null===(o=i.editor)||void 0===o?void 0:o.height)||200,defaultLanguage:null==e?void 0:null===(d=e.ui)||void 0===d?void 0:d.language,theme:"vs-dark",options:{minimap:{enabled:!1},wordWrap:"on"}})})})]})};var ej=l(69935);let eb=e=>{var t;let{data:l,formValuesChange:r}=e,n=(0,F.It)((null===(t=l.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(ej.default,{onChange:(e,t)=>{r({[l.name]:t})},...n,className:"w-full",placeholder:"please select a date"})};var ew=l(70342);let ey=e=>{let t=e.match(/^icon:(\w+)$/);if(t){let e=t[1],l=ew[e];return l?(0,a.jsx)(l,{}):null}return null},e_=e=>{var t,l,r;let n=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return n.prefix=ey((null===(l=e.ui)||void 0===l?void 0:null===(r=l.attr)||void 0===r?void 0:r.prefix)||""),(0,a.jsx)(c.default,{...n,className:"w-full",placeholder:"please input",allowClear:!0})},{Password:eN}=c.default,eZ=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(eN,{...l,placeholder:"input password"})},ek=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)("div",{className:"bg-white p-2 rounded",children:(0,a.jsx)($.ZP.Group,{...l,options:e.options})})},eC=e=>{var t;let l=(0,F.It)((null==e?void 0:null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(V.default,{...l,className:"w-full nodrag",placeholder:"please select",options:e.options})};var eI=l(30568);let eS=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(a.Fragment,{children:e.is_list?(0,a.jsx)(eI.Z,{range:!0,className:"mt-8 nodrag",...l}):(0,a.jsx)(eI.Z,{className:"mt-8 nodrag",...l})})},{TextArea:eF}=c.default,eP=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(eF,{className:"nowheel mb-3",...l})};var eE=l(68351);let eV=e=>{var t;let{data:l,formValuesChange:r}=e,n=(0,F.It)((null===(t=l.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(eE.Z,{...n,onChange:(e,t)=>{r({time:t},{force:!0})},className:"w-full",placeholder:"please select a moment"})};var ez=l(59847);let eO=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(ez.Z,{...l,className:"w-full nodrag",treeDefaultExpandAll:!0,treeData:e.options})};var eA=l(83454);let eD=e=>{var t,l,n,s,i;let{t:o}=(0,j.$G)(),d=(0,g.useRef)([]),{data:c,formValuesChange:u}=e,[p,m]=(0,g.useState)([]);(0,g.useEffect)(()=>{if(c.value){let e=[];"string"==typeof c.value?e.push(c.value):e=c.value;let t={uris:e};(0,r.Jx)(t).then(e=>{let t=[];for(let l=0;l{console.log(e)})}},[]);let f=(0,F.It)((null===(t=c.ui)||void 0===t?void 0:t.attr)||{}),[v,x]=(0,g.useState)(!1),[h,b]=(0,g.useState)(""),w=e=>{d.current.length===c.ui.attr.max_count&&d.current.pop(),d.current.push(e),1===c.ui.attr.max_count?u({[c.name]:d.current.toString()}):u({[c.name]:d.current})},y={name:"files",action:null!==(s=eA.env.API_BASE_URL)&&void 0!==s?s:""+c.ui.action,headers:{authorization:"authorization-text"},defaultFileList:p,onChange(e){x(!0),"uploading"!==e.file.status&&x(!1),"done"===e.file.status?(x(!1),G.ZP.success("".concat(e.file.response.data[0].file_name," ").concat(o("Upload_Data_Successfully"))),w(e.file.response.data[0].uri)):"error"===e.file.status&&(x(!1),G.ZP.error("".concat(e.file.response.data[0].file_name," ").concat(o("Upload_Data_Failed"))))}};return!h&&(null===(l=c.ui)||void 0===l?void 0:l.file_types)&&Array.isArray(null===(n=c.ui)||void 0===n?void 0:n.file_types)&&b(null===(i=c.ui)||void 0===i?void 0:i.file_types.toString()),(0,a.jsx)("div",{className:"p-2 text-sm text-center",children:(0,a.jsx)(W.default,{onRemove:e=>{let t=d.current.indexOf(e.response.data[0].uri);-1!==t&&d.current.splice(t,1),x(!1),1===c.ui.attr.max_count?u({[c.name]:d.current.toString()}):u({[c.name]:d.current})},...y,...f,multiple:!!c.is_list,accept:h,children:(0,a.jsx)(D.ZP,{loading:v,icon:(0,a.jsx)(K.Z,{}),children:o("Upload_Data")})})})},eT=e=>{var t;let l=(0,F.It)((null===(t=e.ui)||void 0===t?void 0:t.attr)||{});return(0,a.jsx)(c.default,{...l,className:"w-full",placeholder:"please input",allowClear:!0})};var eL=e=>{let{formValuesChange:t,node:l,paramData:r,label:n,index:s}=e;return"resource"===r.category?(0,a.jsx)(ef,{node:l,data:r,type:"target",label:n,index:s}):"common"===r.category?(null==r?void 0:r.ui)?function(e,t){var l;let{refresh_depends:r,ui_type:n}=e.ui,s=null!==(l=e.value)&&void 0!==l?l:e.default;return"slider"===n&&e.is_list&&(s=[0,1]),(0,a.jsx)(z.default.Item,{className:"mb-2",initialValue:s,name:e.name,rules:[{required:!e.optional}],label:(0,a.jsx)("span",{className:"text-neutral-500",children:e.label}),...r&&{dependencies:r},...e.description&&{tooltip:{title:e.description,icon:(0,a.jsx)(er.Z,{})}},children:function(e,t,l){switch(e){case"select":return eC(t);case"cascader":return ev(t);case"checkbox":return ex(t);case"radio":return ek(t);case"input":return e_(t);case"text_area":return eP(t);case"slider":return eS(t);case"date_picker":return eb({data:t,formValuesChange:l});case"time_picker":return eV({data:t,formValuesChange:l});case"tree_select":return eO(t);case"password":return eZ(t);case"upload":return eD({data:t,formValuesChange:l});case"variables":return eT(t);case"code_editor":return eg(t);default:return null}}(n,e,t)})}(r,t):function(e){var t,l;let r=null!==(t=e.value)&&void 0!==t?t:e.default;switch(e.type_name){case"int":case"float":return(0,a.jsx)(z.default.Item,{className:"mb-2 text-sm",name:e.name,initialValue:r,rules:[{required:!e.optional}],label:(0,a.jsx)("span",{className:"text-neutral-500",children:e.label}),tooltip:e.description?{title:e.description,icon:(0,a.jsx)(er.Z,{})}:"",children:(0,a.jsx)(A.Z,{className:"w-full nodrag"})});case"str":return(0,a.jsx)(z.default.Item,{className:"mb-2 text-sm",name:e.name,initialValue:r,rules:[{required:!e.optional}],label:(0,a.jsx)("span",{className:"text-neutral-500",children:e.label}),tooltip:e.description?{title:e.description,icon:(0,a.jsx)(er.Z,{})}:"",children:(null===(l=e.options)||void 0===l?void 0:l.length)>0?(0,a.jsx)(V.default,{className:"w-full nodrag",options:e.options.map(e=>({label:e.label,value:e.value}))}):(0,a.jsx)(c.default,{className:"w-full"})});case"bool":return r="True"===(r="False"!==r&&r)||r,(0,a.jsx)(z.default.Item,{className:"mb-2 text-sm",name:e.name,initialValue:r,rules:[{required:!e.optional}],label:(0,a.jsx)("span",{className:"text-neutral-500",children:e.label}),tooltip:e.description?{title:e.description,icon:(0,a.jsx)(er.Z,{})}:"",children:(0,a.jsx)(X.Z,{className:"ml-2"})})}}(r):void 0};function eM(e){let{label:t}=e;return(0,a.jsx)("div",{className:"w-full h-8 align-middle font-semibold",children:t})}var eq=l(12906),eR=l(43008),eG=l(57546),e$=l(60219),eJ=l(58638),eB=l(26855),eU=l(96074),eH=l(39332),eK=l(24885),eW=l(59819);l(4583);let eY={customNode:e=>{var t,l,n,s;let{data:i}=e,{inputs:o,outputs:d,parameters:c,flow_type:u}=i,[p,m]=(0,g.useState)(!1),f=(0,ed._K)(),[v]=z.default.useForm();async function x(e,t){let l=c.filter(t=>{var l;let{ui:a}=t;return null==a?void 0:null===(l=a.refresh_depends)||void 0===l?void 0:l.includes(e)});(null==l?void 0:l.length)!==0&&l.forEach(async l=>{let a={id:(0,F._g)(null==i?void 0:i.id),type_name:i.type_name,type_cls:i.type_cls,flow_type:"operator",refresh:[{name:l.name,depends:[{name:e,value:t,has_value:!0}]}]},[n,s]=await (0,r.Vx)((0,r.ks)(a));s&&f.setNodes(e=>e.map(e=>e.id===i.id?{...e,data:{...e.data,parameters:s.parameters}}:e))})}function j(e){let[t,l]=Object.entries(e)[0];c.forEach(e=>{e.name===t&&(e.value=l)}),l&&x(t,l)}return(0,a.jsx)(en.Z,{placement:"rightTop",trigger:["hover"],content:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ec,{className:"hover:text-blue-500",children:(0,a.jsx)(el.Z,{className:"h-full text-lg cursor-pointer",onClick:function(e){e.preventDefault(),e.stopPropagation();let t=f.getNodes(),l=t.find(e=>e.id===i.id);if(l){let e=(0,F.VZ)(l,t),a=(0,L.cloneDeep)(l),r={...a,id:e,position:{x:a.position.x+400,y:a.position.y},positionAbsolute:{x:a.positionAbsolute.x+400,y:a.positionAbsolute.y},data:{...a.data,id:e},selected:!1};f.setNodes(e=>[...e,r])}}})}),(0,a.jsx)(ec,{className:"mt-2 hover:text-red-500",children:(0,a.jsx)(ea.Z,{className:"h-full text-lg cursor-pointer",onClick:function(e){e.preventDefault(),e.stopPropagation(),f.setNodes(e=>e.filter(e=>e.id!==i.id)),f.setEdges(e=>e.filter(e=>e.source!==i.id&&e.target!==i.id))}})}),(0,a.jsx)(ec,{className:"mt-2",children:(0,a.jsx)(es.Z,{title:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"font-bold",children:i.label}),(0,a.jsx)("p",{children:i.description})]}),placement:"right",children:(0,a.jsx)(er.Z,{className:"h-full text-lg cursor-pointer"})})})]}),children:(0,a.jsxs)("div",{className:h()("h-auto rounded-xl shadow-md px-2 py-4 border bg-white dark:bg-zinc-800 cursor-grab flex flex-col space-y-2 text-sm",{"w-80":(null==i?void 0:null===(t=i.tags)||void 0===t?void 0:t.ui_size)==="middle"||!(null==i?void 0:null===(l=i.tags)||void 0===l?void 0:l.ui_size),"w-[256px]":(null==i?void 0:null===(n=i.tags)||void 0===n?void 0:n.ui_size)==="small","w-[530px]":(null==i?void 0:null===(s=i.tags)||void 0===s?void 0:s.ui_size)==="large","border-blue-500":i.selected||p,"border-stone-400 dark:border-white":!i.selected&&!p,"border-dashed":"operator"!==u,"border-red-600":i.invalid}),onMouseEnter:function(){m(!0)},onMouseLeave:function(){m(!1)},children:[(0,a.jsxs)("div",{className:"flex flex-row items-center",children:[(0,a.jsx)(eo(),{src:"/icons/node/vis.png",width:24,height:24,alt:""}),(0,a.jsx)("p",{className:"ml-2 text-lg font-bold text-ellipsis overflow-hidden whitespace-nowrap",children:i.label})]}),(null==o?void 0:o.length)>0&&(0,a.jsxs)("div",{className:"bg-zinc-100 dark:bg-zinc-700 rounded p-2",children:[(0,a.jsx)(eM,{label:"Inputs"}),(0,a.jsx)("div",{className:"flex flex-col space-y-2",children:null==o?void 0:o.map((e,t)=>(0,a.jsx)(ef,{node:i,data:e,type:"target",label:"inputs",index:t},"".concat(i.id,"_input_").concat(t)))})]}),(null==c?void 0:c.length)>0&&(0,a.jsxs)("div",{className:"bg-zinc-100 dark:bg-zinc-700 rounded p-2",children:[(0,a.jsx)(eM,{label:"Parameters"}),(0,a.jsx)(z.default,{form:v,layout:"vertical",onValuesChange:j,className:"flex flex-col space-y-3 text-neutral-500",children:null==c?void 0:c.map((e,t)=>(0,a.jsx)(eL,{formValuesChange:j,node:i,paramData:e,label:"parameters",index:t},"".concat(i.id,"_param_").concat(t)))})]}),"operator"===u&&(null==d?void 0:d.length)>0?(0,a.jsxs)("div",{className:"bg-zinc-100 dark:bg-zinc-700 rounded p-2",children:[(0,a.jsx)(eM,{label:"Outputs"}),null==d?void 0:d.map((e,t)=>(0,a.jsx)(ef,{node:i,data:e,type:"source",label:"outputs",index:t},"".concat(i.id,"_input_").concat(t)))]}):"resource"===u?(0,a.jsxs)("div",{className:"bg-zinc-100 dark:bg-zinc-700 rounded p-2",children:[(0,a.jsx)(eM,{label:"Outputs"}),(0,a.jsx)(ef,{node:i,data:i,type:"source",label:"outputs",index:0},"".concat(i.id,"_input_0"))]}):void 0]})})}},eX={buttonedge:S.Z},eQ=()=>{let{t:e}=(0,j.$G)(),t=(0,eH.useSearchParams)(),l=(null==t?void 0:t.get("id"))||"",s=(0,ed._K)(),[i,o]=G.ZP.useMessage(),d=(0,g.useRef)(null),[c,u,p]=(0,ed.Rr)([]),[f,v,x]=(0,ed.ll)([]),[h,b]=(0,g.useState)(),[w,y]=(0,g.useState)(!1),[_,N]=(0,g.useState)(!1),[Z,k]=(0,g.useState)(!1),[C,S]=(0,g.useState)(!1),[P,E]=(0,g.useState)(!1);if(localStorage.getItem("importFlowData")){let e=JSON.parse(localStorage.getItem("importFlowData")||"");localStorage.removeItem("importFlowData"),y(!0);let t=(0,F.z5)(e.flow_data);b(e),u(t.nodes),v(t.edges),y(!1)}async function V(){y(!0);let[e,t]=await (0,r.Vx)((0,r._d)(l));if(t){let e=(0,F.z5)(t.flow_data);b(t),u(e.nodes),v(e.edges)}y(!1)}(0,g.useEffect)(()=>{l&&V()},[l]),(0,g.useEffect)(()=>{let e=e=>{e.returnValue=G.ZP};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}},[]);let z=(0,g.useCallback)(e=>{var t,l;e.preventDefault();let a=d.current.getBoundingClientRect(),r=null===(t=null===(l=document.getElementsByClassName("ant-layout-sider"))||void 0===l?void 0:l[0])||void 0===t?void 0:t.offsetWidth,n=e.dataTransfer.getData("application/reactflow");if(!n||void 0===n)return;let i=JSON.parse(n),o=s.screenToFlowPosition({x:e.clientX-a.left+r,y:e.clientY-a.top}),c=(0,F.VZ)(i,s.getNodes());i.id=c;let p={id:c,position:o,type:"customNode",data:i};u(e=>e.concat(p).map(e=>(e.id===p.id?e.data={...e.data,selected:!0}:e.data={...e.data,selected:!1},e)))},[s]),O=(0,g.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},[]);function A(){let t=s.toObject(),[l,r,n]=(0,F.Rv)(t);if(!r){i.open({type:"warning",content:e("Please_Add_Nodes_First")});return}if(!l&&n)return u(e=>e.map(e=>({...e,data:{...e.data,invalid:e.id===(null==r?void 0:r.id)}}))),eB.ZP.error({message:"Error",description:n,icon:(0,a.jsx)(eq.Z,{className:"text-red-600"})});N(!0)}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-row",children:[(0,a.jsx)(I,{}),(0,a.jsxs)("div",{className:"flex flex-col flex-1",children:[(0,a.jsx)(m.Z,{className:"my-2 mx-4 flex flex-row justify-end",children:(()=>{let t=[{title:e("template"),icon:(0,a.jsx)(eR.Z,{className:"block text-xl",onClick:()=>E(!0)})},{title:e("Import"),icon:(0,a.jsx)(eG.Z,{className:"block text-xl",onClick:()=>S(!0)})},{title:e("save"),icon:(0,a.jsx)(e$.Z,{className:"block text-xl",onClick:A})}];return""!==l&&t.unshift({title:e("Export"),icon:(0,a.jsx)(eJ.Z,{className:"block text-xl",onClick:()=>k(!0)})}),t})().map(e=>{let{title:t,icon:l}=e;return(0,a.jsx)(es.Z,{title:t,className:"w-8 h-8 rounded-md bg-stone-300 dark:bg-zinc-700 dark:text-zinc-200 hover:text-blue-500 dark:hover:text-zinc-100",children:l},t)})}),(0,a.jsx)(eU.Z,{className:"mt-0 mb-0"}),(0,a.jsx)("div",{className:"h-[calc(100vh-48px)] w-full",ref:d,children:(0,a.jsxs)(ed.x$,{nodes:c,edges:f,nodeTypes:eY,edgeTypes:eX,onNodesChange:p,onEdgesChange:x,onNodeClick:function(e,t){s.setNodes(e=>e.map(e=>(e.id===t.id?e.data={...e.data,selected:!0}:e.data={...e.data,selected:!1},e)))},onConnect:function(e){let t={...e,type:"buttonedge",id:"".concat(e.source,"|").concat(e.target)};v(e=>(0,ed.Z_)(t,e))},onDrop:z,onDragOver:O,minZoom:.1,fitView:!0,deleteKeyCode:["Backspace","Delete"],children:[(0,a.jsx)(eK.Z,{className:"flex flex-row items-center",position:"bottom-center"}),(0,a.jsx)(eW.A,{color:"#aaa",gap:16}),(0,a.jsx)(R,{flowInfo:h,setFlowInfo:b})]})})]})]}),(0,a.jsx)(n.Z,{visible:w}),(0,a.jsx)(et,{reactFlow:s,flowInfo:h,isSaveFlowModalOpen:_,setIsSaveFlowModalOpen:N}),(0,a.jsx)(B,{reactFlow:s,flowInfo:h,isExportFlowModalOpen:Z,setIsExportFlowModalOpen:k}),(0,a.jsx)(Y,{setNodes:u,setEdges:v,isImportModalOpen:C,setIsImportFlowModalOpen:S}),(0,a.jsx)(H,{isFlowTemplateModalOpen:P,setIsFlowTemplateModalOpen:E}),o]})};function e0(){return(0,a.jsx)(ed.tV,{children:(0,a.jsx)(eQ,{})})}},67919:function(e,t,l){"use strict";l.d(t,{Av:function(){return d},It:function(){return o},Rv:function(){return i},VZ:function(){return a},Wf:function(){return n},_g:function(){return r},z5:function(){return s}});let a=(e,t)=>{let l=0;return t.forEach(t=>{t.data.name===e.name&&l++}),"".concat(e.id,"_").concat(l)},r=e=>e.replace(/_\d+$/,""),n=e=>{let{nodes:t,edges:l,...a}=e,r=t.map(e=>{let{positionAbsolute:t,...l}=e;return{position_absolute:t,...l}}),n=l.map(e=>{let{sourceHandle:t,targetHandle:l,...a}=e;return{source_handle:t,target_handle:l,...a}});return{nodes:r,edges:n,...a}},s=e=>{let{nodes:t,edges:l,...a}=e,r=t.map(e=>{let{position_absolute:t,...l}=e;return{positionAbsolute:t,...l}}),n=l.map(e=>{let{source_handle:t,target_handle:l,...a}=e;return{sourceHandle:t,targetHandle:l,...a}});return{nodes:r,edges:n,...a}},i=e=>{let{nodes:t,edges:l}=e,a=[!0,t[0],""];e:for(let e=0;el.targetHandle==="".concat(t[e].id,"|inputs|").concat(s))){a=[!1,t[e],"The input ".concat(n[s].type_name," of node ").concat(r.label," is required")];break e}for(let n=0;nl.targetHandle==="".concat(t[e].id,"|parameters|").concat(n))){if(!i.optional&&"common"===i.category&&(void 0===i.value||null===i.value)){a=[!1,t[e],"The parameter ".concat(i.type_name," of node ").concat(r.label," is required")];break e}}else{a=[!1,t[e],"The parameter ".concat(i.type_name," of node ").concat(r.label," is required")];break e}}}return a},o=e=>(function e(t){if(Array.isArray(t))return t.map(t=>e(t));if(t&&"object"==typeof t&&!Array.isArray(t)){let l={};for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)){let r=a.replace(/_([a-z])/g,(e,t)=>t.toUpperCase());l[r]=e(t[a])}return l}return t})(e);function d(e){let t=new Set(["@","#","%",":"]),l={key:e.key||"",name:e.name||"",scope:e.scope||"",scope_key:e.scope_key||"",sys_code:e.sys_code||"",user_name:e.user_name||""};for(let[e,a]of Object.entries(l))a&&[...t].some(e=>a.includes(e))&&(l[e]=a.replace(/@/g,"\\@").replace(/#/g,"\\#").replace(/%/g,"\\%").replace(/:/g,"\\:"));let{key:a,name:r,scope:n,scope_key:s,sys_code:i,user_name:o}=l,d="".concat(a);return r&&(d+="".concat(":").concat(r)),(n||s)&&(d+="".concat("@").concat(n),s&&(d+="".concat(":").concat(s))),i&&(d+="".concat("#").concat(i)),o&&(d+="".concat("%").concat(o)),"${".concat(d,"}")}}},function(e){e.O(0,[3662,8241,2648,3791,2913,5278,8791,4330,1049,5030,4041,9859,3799,2684,1300,4567,9773,3457,5782,7873,3764,1278,1010,2070,9774,2888,179],function(){return e(e.s=94617)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/InputContainer-b4ab9b55219e1aa0.js b/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/InputContainer-ee3c87c14da505d8.js similarity index 96% rename from dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/InputContainer-b4ab9b55219e1aa0.js rename to dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/InputContainer-ee3c87c14da505d8.js index c6dd95016..34256cccd 100644 --- a/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/InputContainer-b4ab9b55219e1aa0.js +++ b/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/InputContainer-ee3c87c14da505d8.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3882],{69487:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/mobile/chat/components/InputContainer",function(){return n(74638)}])},2440:function(e,t,n){"use strict";var r=n(25519);t.Z=()=>{var e;return JSON.parse(null!==(e=localStorage.getItem(r.C9))&&void 0!==e?e:"")}},39718:function(e,t,n){"use strict";var r=n(85893),c=n(19284),a=n(25675),l=n.n(a),u=n(67294);t.Z=(0,u.memo)(e=>{let{width:t,height:n,model:a}=e,s=(0,u.useMemo)(()=>{let e=null==a?void 0:a.replaceAll("-","_").split("_")[0],t=Object.keys(c.Me);for(let n=0;n{let{width:t,height:n,scene:u}=e,s=(0,l.useCallback)(()=>{switch(u){case"chat_knowledge":return c.je;case"chat_with_db_execute":return c.zM;case"chat_excel":return c.DL;case"chat_with_db_qa":case"chat_dba":return c.RD;case"chat_dashboard":return c.In;case"chat_agent":return c.si;case"chat_normal":return c.O7;default:return}},[u]);return(0,r.jsx)(a.Z,{className:"w-".concat(t||7," h-").concat(n||7),component:s()})}},70065:function(e,t,n){"use strict";var r=n(91321);let c=(0,r.Z)({scriptUrl:"//at.alicdn.com/t/a/font_4440880_ljyggdw605.js"});t.Z=c}},function(e){e.O(0,[2648,3791,2913,5278,8791,4330,1049,5030,3799,2684,6231,5005,3913,9774,2888,179],function(){return e(e.s=69487)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3882],{69487:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/mobile/chat/components/InputContainer",function(){return n(74638)}])},2440:function(e,t,n){"use strict";var r=n(25519);t.Z=()=>{var e;return JSON.parse(null!==(e=localStorage.getItem(r.C9))&&void 0!==e?e:"")}},39718:function(e,t,n){"use strict";var r=n(85893),c=n(19284),a=n(25675),l=n.n(a),u=n(67294);t.Z=(0,u.memo)(e=>{let{width:t,height:n,model:a}=e,s=(0,u.useMemo)(()=>{let e=null==a?void 0:a.replaceAll("-","_").split("_")[0],t=Object.keys(c.Me);for(let n=0;n{let{width:t,height:n,scene:u}=e,s=(0,l.useCallback)(()=>{switch(u){case"chat_knowledge":return c.je;case"chat_with_db_execute":return c.zM;case"chat_excel":return c.DL;case"chat_with_db_qa":case"chat_dba":return c.RD;case"chat_dashboard":return c.In;case"chat_agent":return c.si;case"chat_normal":return c.O7;default:return}},[u]);return(0,r.jsx)(a.Z,{className:"w-".concat(t||7," h-").concat(n||7),component:s()})}},70065:function(e,t,n){"use strict";var r=n(91321);let c=(0,r.Z)({scriptUrl:"//at.alicdn.com/t/a/font_4440880_ljyggdw605.js"});t.Z=c}},function(e){e.O(0,[2648,3791,2913,5278,8791,4330,1049,5030,3799,2684,6231,6047,3913,9774,2888,179],function(){return e(e.s=69487)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/ModelSelector-b563164808b51b5d.js b/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/ModelSelector-bfb7411da144d132.js similarity index 96% rename from dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/ModelSelector-b563164808b51b5d.js rename to dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/ModelSelector-bfb7411da144d132.js index 8badaebae..fc2c1432e 100644 --- a/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/ModelSelector-b563164808b51b5d.js +++ b/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/ModelSelector-bfb7411da144d132.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2767],{96052:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/mobile/chat/components/ModelSelector",function(){return n(7001)}])},2440:function(e,t,n){"use strict";var r=n(25519);t.Z=()=>{var e;return JSON.parse(null!==(e=localStorage.getItem(r.C9))&&void 0!==e?e:"")}},39718:function(e,t,n){"use strict";var r=n(85893),c=n(19284),a=n(25675),l=n.n(a),u=n(67294);t.Z=(0,u.memo)(e=>{let{width:t,height:n,model:a}=e,s=(0,u.useMemo)(()=>{let e=null==a?void 0:a.replaceAll("-","_").split("_")[0],t=Object.keys(c.Me);for(let n=0;n{let{width:t,height:n,scene:u}=e,s=(0,l.useCallback)(()=>{switch(u){case"chat_knowledge":return c.je;case"chat_with_db_execute":return c.zM;case"chat_excel":return c.DL;case"chat_with_db_qa":case"chat_dba":return c.RD;case"chat_dashboard":return c.In;case"chat_agent":return c.si;case"chat_normal":return c.O7;default:return}},[u]);return(0,r.jsx)(a.Z,{className:"w-".concat(t||7," h-").concat(n||7),component:s()})}},70065:function(e,t,n){"use strict";var r=n(91321);let c=(0,r.Z)({scriptUrl:"//at.alicdn.com/t/a/font_4440880_ljyggdw605.js"});t.Z=c}},function(e){e.O(0,[2648,3791,2913,5278,8791,4330,1049,5030,3799,2684,6231,6047,3913,9774,2888,179],function(){return e(e.s=96052)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2767],{96052:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/mobile/chat/components/ModelSelector",function(){return n(7001)}])},2440:function(e,t,n){"use strict";var r=n(25519);t.Z=()=>{var e;return JSON.parse(null!==(e=localStorage.getItem(r.C9))&&void 0!==e?e:"")}},39718:function(e,t,n){"use strict";var r=n(85893),c=n(19284),a=n(25675),l=n.n(a),u=n(67294);t.Z=(0,u.memo)(e=>{let{width:t,height:n,model:a}=e,s=(0,u.useMemo)(()=>{let e=null==a?void 0:a.replaceAll("-","_").split("_")[0],t=Object.keys(c.Me);for(let n=0;n{let{width:t,height:n,scene:u}=e,s=(0,l.useCallback)(()=>{switch(u){case"chat_knowledge":return c.je;case"chat_with_db_execute":return c.zM;case"chat_excel":return c.DL;case"chat_with_db_qa":case"chat_dba":return c.RD;case"chat_dashboard":return c.In;case"chat_agent":return c.si;case"chat_normal":return c.O7;default:return}},[u]);return(0,r.jsx)(a.Z,{className:"w-".concat(t||7," h-").concat(n||7),component:s()})}},70065:function(e,t,n){"use strict";var r=n(91321);let c=(0,r.Z)({scriptUrl:"//at.alicdn.com/t/a/font_4440880_ljyggdw605.js"});t.Z=c}},function(e){e.O(0,[2648,3791,2913,5278,8791,4330,1049,5030,3799,2684,6231,1437,3913,9774,2888,179],function(){return e(e.s=96052)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/Resource-8eabb2034817672d.js b/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/Resource-f78b23a9336485cc.js similarity index 96% rename from dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/Resource-8eabb2034817672d.js rename to dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/Resource-f78b23a9336485cc.js index 64a1c44f8..42c341b85 100644 --- a/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/Resource-8eabb2034817672d.js +++ b/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/Resource-f78b23a9336485cc.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5247],{44813:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/mobile/chat/components/Resource",function(){return n(73749)}])},2440:function(e,t,n){"use strict";var r=n(25519);t.Z=()=>{var e;return JSON.parse(null!==(e=localStorage.getItem(r.C9))&&void 0!==e?e:"")}},39718:function(e,t,n){"use strict";var r=n(85893),c=n(19284),a=n(25675),l=n.n(a),u=n(67294);t.Z=(0,u.memo)(e=>{let{width:t,height:n,model:a}=e,s=(0,u.useMemo)(()=>{let e=null==a?void 0:a.replaceAll("-","_").split("_")[0],t=Object.keys(c.Me);for(let n=0;n{let{width:t,height:n,scene:u}=e,s=(0,l.useCallback)(()=>{switch(u){case"chat_knowledge":return c.je;case"chat_with_db_execute":return c.zM;case"chat_excel":return c.DL;case"chat_with_db_qa":case"chat_dba":return c.RD;case"chat_dashboard":return c.In;case"chat_agent":return c.si;case"chat_normal":return c.O7;default:return}},[u]);return(0,r.jsx)(a.Z,{className:"w-".concat(t||7," h-").concat(n||7),component:s()})}},70065:function(e,t,n){"use strict";var r=n(91321);let c=(0,r.Z)({scriptUrl:"//at.alicdn.com/t/a/font_4440880_ljyggdw605.js"});t.Z=c}},function(e){e.O(0,[2648,3791,2913,5278,8791,4330,1049,5030,3799,2684,6231,1390,3913,9774,2888,179],function(){return e(e.s=44813)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5247],{44813:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/mobile/chat/components/Resource",function(){return n(73749)}])},2440:function(e,t,n){"use strict";var r=n(25519);t.Z=()=>{var e;return JSON.parse(null!==(e=localStorage.getItem(r.C9))&&void 0!==e?e:"")}},39718:function(e,t,n){"use strict";var r=n(85893),c=n(19284),a=n(25675),l=n.n(a),u=n(67294);t.Z=(0,u.memo)(e=>{let{width:t,height:n,model:a}=e,s=(0,u.useMemo)(()=>{let e=null==a?void 0:a.replaceAll("-","_").split("_")[0],t=Object.keys(c.Me);for(let n=0;n{let{width:t,height:n,scene:u}=e,s=(0,l.useCallback)(()=>{switch(u){case"chat_knowledge":return c.je;case"chat_with_db_execute":return c.zM;case"chat_excel":return c.DL;case"chat_with_db_qa":case"chat_dba":return c.RD;case"chat_dashboard":return c.In;case"chat_agent":return c.si;case"chat_normal":return c.O7;default:return}},[u]);return(0,r.jsx)(a.Z,{className:"w-".concat(t||7," h-").concat(n||7),component:s()})}},70065:function(e,t,n){"use strict";var r=n(91321);let c=(0,r.Z)({scriptUrl:"//at.alicdn.com/t/a/font_4440880_ljyggdw605.js"});t.Z=c}},function(e){e.O(0,[2648,3791,2913,5278,8791,4330,1049,5030,3799,2684,6231,5005,3913,9774,2888,179],function(){return e(e.s=44813)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/Thermometer-04a472728f531300.js b/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/Thermometer-a4374c6abef1bc3f.js similarity index 96% rename from dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/Thermometer-04a472728f531300.js rename to dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/Thermometer-a4374c6abef1bc3f.js index ad603880d..50bc0f31a 100644 --- a/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/Thermometer-04a472728f531300.js +++ b/dbgpt/app/static/web/_next/static/chunks/pages/mobile/chat/components/Thermometer-a4374c6abef1bc3f.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9622],{59843:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/mobile/chat/components/Thermometer",function(){return n(97109)}])},2440:function(e,t,n){"use strict";var r=n(25519);t.Z=()=>{var e;return JSON.parse(null!==(e=localStorage.getItem(r.C9))&&void 0!==e?e:"")}},39718:function(e,t,n){"use strict";var r=n(85893),c=n(19284),a=n(25675),l=n.n(a),u=n(67294);t.Z=(0,u.memo)(e=>{let{width:t,height:n,model:a}=e,s=(0,u.useMemo)(()=>{let e=null==a?void 0:a.replaceAll("-","_").split("_")[0],t=Object.keys(c.Me);for(let n=0;n{let{width:t,height:n,scene:u}=e,s=(0,l.useCallback)(()=>{switch(u){case"chat_knowledge":return c.je;case"chat_with_db_execute":return c.zM;case"chat_excel":return c.DL;case"chat_with_db_qa":case"chat_dba":return c.RD;case"chat_dashboard":return c.In;case"chat_agent":return c.si;case"chat_normal":return c.O7;default:return}},[u]);return(0,r.jsx)(a.Z,{className:"w-".concat(t||7," h-").concat(n||7),component:s()})}},70065:function(e,t,n){"use strict";var r=n(91321);let c=(0,r.Z)({scriptUrl:"//at.alicdn.com/t/a/font_4440880_ljyggdw605.js"});t.Z=c}},function(e){e.O(0,[2648,3791,2913,5278,8791,4330,1049,5030,3799,2684,6231,1437,3913,9774,2888,179],function(){return e(e.s=59843)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9622],{59843:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/mobile/chat/components/Thermometer",function(){return n(97109)}])},2440:function(e,t,n){"use strict";var r=n(25519);t.Z=()=>{var e;return JSON.parse(null!==(e=localStorage.getItem(r.C9))&&void 0!==e?e:"")}},39718:function(e,t,n){"use strict";var r=n(85893),c=n(19284),a=n(25675),l=n.n(a),u=n(67294);t.Z=(0,u.memo)(e=>{let{width:t,height:n,model:a}=e,s=(0,u.useMemo)(()=>{let e=null==a?void 0:a.replaceAll("-","_").split("_")[0],t=Object.keys(c.Me);for(let n=0;n{let{width:t,height:n,scene:u}=e,s=(0,l.useCallback)(()=>{switch(u){case"chat_knowledge":return c.je;case"chat_with_db_execute":return c.zM;case"chat_excel":return c.DL;case"chat_with_db_qa":case"chat_dba":return c.RD;case"chat_dashboard":return c.In;case"chat_agent":return c.si;case"chat_normal":return c.O7;default:return}},[u]);return(0,r.jsx)(a.Z,{className:"w-".concat(t||7," h-").concat(n||7),component:s()})}},70065:function(e,t,n){"use strict";var r=n(91321);let c=(0,r.Z)({scriptUrl:"//at.alicdn.com/t/a/font_4440880_ljyggdw605.js"});t.Z=c}},function(e){e.O(0,[2648,3791,2913,5278,8791,4330,1049,5030,3799,2684,6231,1390,3913,9774,2888,179],function(){return e(e.s=59843)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/dbgpt/app/static/web/_next/static/chunks/webpack-798ac886a0da97d1.js b/dbgpt/app/static/web/_next/static/chunks/webpack-5e1dfdf4fdf4140e.js similarity index 98% rename from dbgpt/app/static/web/_next/static/chunks/webpack-798ac886a0da97d1.js rename to dbgpt/app/static/web/_next/static/chunks/webpack-5e1dfdf4fdf4140e.js index 647f4a92a..7ffe17277 100644 --- a/dbgpt/app/static/web/_next/static/chunks/webpack-798ac886a0da97d1.js +++ b/dbgpt/app/static/web/_next/static/chunks/webpack-5e1dfdf4fdf4140e.js @@ -1 +1 @@ -!function(){"use strict";var e,c,t,a,f,n,d,b,r,s,u,i,o={},l={};function h(e){var c=l[e];if(void 0!==c)return c.exports;var t=l[e]={id:e,loaded:!1,exports:{}},a=!0;try{o[e].call(t.exports,t,t.exports,h),a=!1}finally{a&&delete l[e]}return t.loaded=!0,t.exports}h.m=o,h.amdO={},e=[],h.O=function(c,t,a,f){if(t){f=f||0;for(var n=e.length;n>0&&e[n-1][2]>f;n--)e[n]=e[n-1];e[n]=[t,a,f];return}for(var d=1/0,n=0;n=f&&Object.keys(h.O).every(function(e){return h.O[e](t[r])})?t.splice(r--,1):(b=!1,f0&&e[n-1][2]>f;n--)e[n]=e[n-1];e[n]=[t,a,f];return}for(var d=1/0,n=0;n=f&&Object.keys(h.O).every(function(e){return h.O[e](t[r])})?t.splice(r--,1):(b=!1,f
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/agent/index.html b/dbgpt/app/static/web/construct/agent/index.html index 05dbc52ae..34544f1b3 100644 --- a/dbgpt/app/static/web/construct/agent/index.html +++ b/dbgpt/app/static/web/construct/agent/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/app/components/create-app-modal/index.html b/dbgpt/app/static/web/construct/app/components/create-app-modal/index.html index e5686aa78..45a0dbffa 100644 --- a/dbgpt/app/static/web/construct/app/components/create-app-modal/index.html +++ b/dbgpt/app/static/web/construct/app/components/create-app-modal/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/app/extra/components/AwelLayout/index.html b/dbgpt/app/static/web/construct/app/extra/components/AwelLayout/index.html index c36f7d763..206fdea15 100644 --- a/dbgpt/app/static/web/construct/app/extra/components/AwelLayout/index.html +++ b/dbgpt/app/static/web/construct/app/extra/components/AwelLayout/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/app/extra/components/NativeApp/index.html b/dbgpt/app/static/web/construct/app/extra/components/NativeApp/index.html index d7cd563ac..e59d0e3ab 100644 --- a/dbgpt/app/static/web/construct/app/extra/components/NativeApp/index.html +++ b/dbgpt/app/static/web/construct/app/extra/components/NativeApp/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/app/extra/components/RecommendQuestions/index.html b/dbgpt/app/static/web/construct/app/extra/components/RecommendQuestions/index.html index 0caac7e4a..990638445 100644 --- a/dbgpt/app/static/web/construct/app/extra/components/RecommendQuestions/index.html +++ b/dbgpt/app/static/web/construct/app/extra/components/RecommendQuestions/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/app/extra/components/auto-plan/DetailsCard/index.html b/dbgpt/app/static/web/construct/app/extra/components/auto-plan/DetailsCard/index.html index 2c2d73735..3324a13b9 100644 --- a/dbgpt/app/static/web/construct/app/extra/components/auto-plan/DetailsCard/index.html +++ b/dbgpt/app/static/web/construct/app/extra/components/auto-plan/DetailsCard/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/app/extra/components/auto-plan/ResourceContent/index.html b/dbgpt/app/static/web/construct/app/extra/components/auto-plan/ResourceContent/index.html index 86285779e..9dd5e9c3f 100644 --- a/dbgpt/app/static/web/construct/app/extra/components/auto-plan/ResourceContent/index.html +++ b/dbgpt/app/static/web/construct/app/extra/components/auto-plan/ResourceContent/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/app/extra/components/auto-plan/ResourcesCard/index.html b/dbgpt/app/static/web/construct/app/extra/components/auto-plan/ResourcesCard/index.html index be21b7eb1..1a6f06c36 100644 --- a/dbgpt/app/static/web/construct/app/extra/components/auto-plan/ResourcesCard/index.html +++ b/dbgpt/app/static/web/construct/app/extra/components/auto-plan/ResourcesCard/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/app/extra/components/auto-plan/index.html b/dbgpt/app/static/web/construct/app/extra/components/auto-plan/index.html index 8515c0e8e..533026f1b 100644 --- a/dbgpt/app/static/web/construct/app/extra/components/auto-plan/index.html +++ b/dbgpt/app/static/web/construct/app/extra/components/auto-plan/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/app/extra/config/index.html b/dbgpt/app/static/web/construct/app/extra/config/index.html index b20ef6944..f70723e3d 100644 --- a/dbgpt/app/static/web/construct/app/extra/config/index.html +++ b/dbgpt/app/static/web/construct/app/extra/config/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/app/extra/index.html b/dbgpt/app/static/web/construct/app/extra/index.html index 1b6680e92..7fa49f7b4 100644 --- a/dbgpt/app/static/web/construct/app/extra/index.html +++ b/dbgpt/app/static/web/construct/app/extra/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/app/index.html b/dbgpt/app/static/web/construct/app/index.html index 255294171..9552d5262 100644 --- a/dbgpt/app/static/web/construct/app/index.html +++ b/dbgpt/app/static/web/construct/app/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/database/index.html b/dbgpt/app/static/web/construct/database/index.html index c252c9e4c..f80415b7f 100644 --- a/dbgpt/app/static/web/construct/database/index.html +++ b/dbgpt/app/static/web/construct/database/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/dbgpts/index.html b/dbgpt/app/static/web/construct/dbgpts/index.html index 48627af07..24699a721 100644 --- a/dbgpt/app/static/web/construct/dbgpts/index.html +++ b/dbgpt/app/static/web/construct/dbgpts/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/flow/canvas/index.html b/dbgpt/app/static/web/construct/flow/canvas/index.html index fa1c8fbb8..284ebb796 100644 --- a/dbgpt/app/static/web/construct/flow/canvas/index.html +++ b/dbgpt/app/static/web/construct/flow/canvas/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/flow/index.html b/dbgpt/app/static/web/construct/flow/index.html index f38949f27..5f8de352f 100644 --- a/dbgpt/app/static/web/construct/flow/index.html +++ b/dbgpt/app/static/web/construct/flow/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/index.html b/dbgpt/app/static/web/construct/index.html index 566f63396..cb6935bb1 100644 --- a/dbgpt/app/static/web/construct/index.html +++ b/dbgpt/app/static/web/construct/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/knowledge/chunk/index.html b/dbgpt/app/static/web/construct/knowledge/chunk/index.html index d670698d6..848734553 100644 --- a/dbgpt/app/static/web/construct/knowledge/chunk/index.html +++ b/dbgpt/app/static/web/construct/knowledge/chunk/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/knowledge/index.html b/dbgpt/app/static/web/construct/knowledge/index.html index c8f41b5b8..2d140bf43 100644 --- a/dbgpt/app/static/web/construct/knowledge/index.html +++ b/dbgpt/app/static/web/construct/knowledge/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/models/index.html b/dbgpt/app/static/web/construct/models/index.html index f96edac1d..f89eecbb9 100644 --- a/dbgpt/app/static/web/construct/models/index.html +++ b/dbgpt/app/static/web/construct/models/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/prompt/add/index.html b/dbgpt/app/static/web/construct/prompt/add/index.html index fa1d90347..04f0637f3 100644 --- a/dbgpt/app/static/web/construct/prompt/add/index.html +++ b/dbgpt/app/static/web/construct/prompt/add/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/prompt/edit/index.html b/dbgpt/app/static/web/construct/prompt/edit/index.html index c094911a0..c2a46bd1a 100644 --- a/dbgpt/app/static/web/construct/prompt/edit/index.html +++ b/dbgpt/app/static/web/construct/prompt/edit/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/construct/prompt/index.html b/dbgpt/app/static/web/construct/prompt/index.html index 25795953b..b1a1f6f16 100644 --- a/dbgpt/app/static/web/construct/prompt/index.html +++ b/dbgpt/app/static/web/construct/prompt/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/evaluation/index.html b/dbgpt/app/static/web/evaluation/index.html index 8bd944b00..c71969d62 100644 --- a/dbgpt/app/static/web/evaluation/index.html +++ b/dbgpt/app/static/web/evaluation/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/index.html b/dbgpt/app/static/web/index.html index 5b55c7efb..d49a53f02 100644 --- a/dbgpt/app/static/web/index.html +++ b/dbgpt/app/static/web/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/knowledge/graph/index.html b/dbgpt/app/static/web/knowledge/graph/index.html index d0bbf6c6b..d60489147 100644 --- a/dbgpt/app/static/web/knowledge/graph/index.html +++ b/dbgpt/app/static/web/knowledge/graph/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/mobile/chat/components/ChatDialog/index.html b/dbgpt/app/static/web/mobile/chat/components/ChatDialog/index.html index 77125f9c0..9746c3743 100644 --- a/dbgpt/app/static/web/mobile/chat/components/ChatDialog/index.html +++ b/dbgpt/app/static/web/mobile/chat/components/ChatDialog/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/mobile/chat/components/Content/index.html b/dbgpt/app/static/web/mobile/chat/components/Content/index.html index c4b0d6f14..8e74d61d7 100644 --- a/dbgpt/app/static/web/mobile/chat/components/Content/index.html +++ b/dbgpt/app/static/web/mobile/chat/components/Content/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/mobile/chat/components/DislikeDrawer/index.html b/dbgpt/app/static/web/mobile/chat/components/DislikeDrawer/index.html index bf07963d1..c2df12a6c 100644 --- a/dbgpt/app/static/web/mobile/chat/components/DislikeDrawer/index.html +++ b/dbgpt/app/static/web/mobile/chat/components/DislikeDrawer/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/mobile/chat/components/Feedback/index.html b/dbgpt/app/static/web/mobile/chat/components/Feedback/index.html index 806013f48..4fe786aeb 100644 --- a/dbgpt/app/static/web/mobile/chat/components/Feedback/index.html +++ b/dbgpt/app/static/web/mobile/chat/components/Feedback/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/mobile/chat/components/Header/index.html b/dbgpt/app/static/web/mobile/chat/components/Header/index.html index 2f4646c26..7ae734625 100644 --- a/dbgpt/app/static/web/mobile/chat/components/Header/index.html +++ b/dbgpt/app/static/web/mobile/chat/components/Header/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/mobile/chat/components/InputContainer/index.html b/dbgpt/app/static/web/mobile/chat/components/InputContainer/index.html index 562b76443..35b6b53b1 100644 --- a/dbgpt/app/static/web/mobile/chat/components/InputContainer/index.html +++ b/dbgpt/app/static/web/mobile/chat/components/InputContainer/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/mobile/chat/components/ModelSelector/index.html b/dbgpt/app/static/web/mobile/chat/components/ModelSelector/index.html index 7812aecc4..7dca7626d 100644 --- a/dbgpt/app/static/web/mobile/chat/components/ModelSelector/index.html +++ b/dbgpt/app/static/web/mobile/chat/components/ModelSelector/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/mobile/chat/components/OptionIcon/index.html b/dbgpt/app/static/web/mobile/chat/components/OptionIcon/index.html index e7965d8d9..cc17881df 100644 --- a/dbgpt/app/static/web/mobile/chat/components/OptionIcon/index.html +++ b/dbgpt/app/static/web/mobile/chat/components/OptionIcon/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/mobile/chat/components/Resource/index.html b/dbgpt/app/static/web/mobile/chat/components/Resource/index.html index a493d849f..a7d371466 100644 --- a/dbgpt/app/static/web/mobile/chat/components/Resource/index.html +++ b/dbgpt/app/static/web/mobile/chat/components/Resource/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/mobile/chat/components/Thermometer/index.html b/dbgpt/app/static/web/mobile/chat/components/Thermometer/index.html index 09c6606a0..060d4cbf1 100644 --- a/dbgpt/app/static/web/mobile/chat/components/Thermometer/index.html +++ b/dbgpt/app/static/web/mobile/chat/components/Thermometer/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/web/mobile/chat/index.html b/dbgpt/app/static/web/mobile/chat/index.html index 88a725bda..f9aa12405 100644 --- a/dbgpt/app/static/web/mobile/chat/index.html +++ b/dbgpt/app/static/web/mobile/chat/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/web/components/flow/canvas-modal/export-flow-modal.tsx b/web/components/flow/canvas-modal/export-flow-modal.tsx index 21f60efbe..c5d3f025f 100644 --- a/web/components/flow/canvas-modal/export-flow-modal.tsx +++ b/web/components/flow/canvas-modal/export-flow-modal.tsx @@ -32,7 +32,7 @@ export const ExportFlowModal: React.FC = ({ a.download = values.file_name || 'flow.json'; a.click(); } else { - const linkUrl = `${process.env.API_BASE_URL}/api/v2/serve/awel/flow/export/${values.uid}?export_type=${values.export_type}&format=${values.format}`; + const linkUrl = `${process.env.API_BASE_URL ?? ''}/api/v2/serve/awel/flow/export/${values.uid}?export_type=${values.export_type}&format=${values.format}`; window.open(linkUrl); } messageApi.success(t('Export_Flow_Success')); diff --git a/web/components/flow/node-renderer/upload.tsx b/web/components/flow/node-renderer/upload.tsx index 2085dac09..a91b2ce30 100644 --- a/web/components/flow/node-renderer/upload.tsx +++ b/web/components/flow/node-renderer/upload.tsx @@ -77,7 +77,7 @@ export const renderUpload = (params: Props) => { const props: UploadProps = { name: 'files', - action: process.env.API_BASE_URL + data.ui.action, + action: process.env.API_BASE_URL ?? '' + data.ui.action, headers: { authorization: 'authorization-text', }, diff --git a/web/utils/ctx-axios.ts b/web/utils/ctx-axios.ts index 94c01767c..ceb60f651 100644 --- a/web/utils/ctx-axios.ts +++ b/web/utils/ctx-axios.ts @@ -1,7 +1,7 @@ import axios from 'axios'; const api = axios.create({ - baseURL: process.env.API_BASE_URL, + baseURL: process.env.API_BASE_URL ?? '', }); api.defaults.timeout = 10000;