From 43133984e64da4ac229a9b54e66d3ea07373e8f6 Mon Sep 17 00:00:00 2001 From: xuyuan23 <643854343@qq.com> Date: Tue, 20 Feb 2024 12:01:47 +0800 Subject: [PATCH 1/5] fix: fix llm strategy value store format. store llm strategy value in json format --- dbgpt/serve/agent/db/gpts_app.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dbgpt/serve/agent/db/gpts_app.py b/dbgpt/serve/agent/db/gpts_app.py index 8bcd2de33..555435939 100644 --- a/dbgpt/serve/agent/db/gpts_app.py +++ b/dbgpt/serve/agent/db/gpts_app.py @@ -56,7 +56,9 @@ def from_dict(cls, d: Dict[str, Any]): resources=AgentResource.from_josn_list_str(d.get("resources", None)), prompt_template=d.get("prompt_template", None), llm_strategy=d.get("llm_strategy", None), - llm_strategy_value=d.get("llm_strategy_value", None), + llm_strategy_value=",".join(json.loads(d.get("llm_strategy_value"))) + if d.get("llm_strategy_value") + else None, created_at=d.get("created_at", None), updated_at=d.get("updated_at", None), ) @@ -483,7 +485,9 @@ def create(self, gpts_app: GptsApp): resources=json.dumps(resource_dicts, ensure_ascii=False), prompt_template=item.prompt_template, llm_strategy=item.llm_strategy, - llm_strategy_value=item.llm_strategy_value, + llm_strategy_value=json.dumps( + tuple(item.llm_strategy_value.split(",")) + ), created_at=item.created_at, updated_at=item.updated_at, ) @@ -525,7 +529,9 @@ def edit(self, gpts_app: GptsApp): resources=json.dumps(resource_dicts, ensure_ascii=False), prompt_template=item.prompt_template, llm_strategy=item.llm_strategy, - llm_strategy_value=item.llm_strategy_value, + llm_strategy_value=json.dumps( + tuple(item.llm_strategy_value.split(",")) + ), created_at=item.created_at, updated_at=item.updated_at, ) From bf93a4af4523048c5bd2f3a1d010468ba4fd51d5 Mon Sep 17 00:00:00 2001 From: lcxadml <864255598@qq.com> Date: Tue, 20 Feb 2024 15:43:48 +0800 Subject: [PATCH 2/5] feat: fix app list data --- dbgpt/app/static/404.html | 2 +- dbgpt/app/static/404/index.html | 2 +- .../_buildManifest.js | 2 +- .../_ssgManifest.js | 0 .../{_app-4fa488d6595180a9.js => _app-bd401791059b31a0.js} | 0 .../{app-90415a5fdf367a91.js => app-b095ed77f7fd2022.js} | 2 +- ...index-60038165daa70046.js => index-018bceca9c8a4ee9.js} | 0 ...ack-6d79785e1375a57a.js => webpack-27020bb4734c8351.js} | 2 +- dbgpt/app/static/agent/index.html | 2 +- dbgpt/app/static/app/index.html | 2 +- dbgpt/app/static/chat/index.html | 2 +- dbgpt/app/static/database/index.html | 2 +- dbgpt/app/static/flow/canvas/index.html | 2 +- dbgpt/app/static/flow/index.html | 2 +- dbgpt/app/static/index.html | 2 +- dbgpt/app/static/knowledge/chunk/index.html | 2 +- dbgpt/app/static/knowledge/index.html | 2 +- dbgpt/app/static/models/index.html | 2 +- dbgpt/app/static/prompt/index.html | 2 +- web/client/api/request.ts | 4 ++-- web/pages/app/index.tsx | 2 +- web/types/app.ts | 7 +++++++ 22 files changed, 26 insertions(+), 19 deletions(-) rename dbgpt/app/static/_next/static/{Pz72WCJeXl85v4kN2kstR => BuUzYaVTDY39gaUO-byZc}/_buildManifest.js (73%) rename dbgpt/app/static/_next/static/{Pz72WCJeXl85v4kN2kstR => BuUzYaVTDY39gaUO-byZc}/_ssgManifest.js (100%) rename dbgpt/app/static/_next/static/chunks/pages/{_app-4fa488d6595180a9.js => _app-bd401791059b31a0.js} (100%) rename dbgpt/app/static/_next/static/chunks/pages/{app-90415a5fdf367a91.js => app-b095ed77f7fd2022.js} (86%) rename dbgpt/app/static/_next/static/chunks/pages/{index-60038165daa70046.js => index-018bceca9c8a4ee9.js} (100%) rename dbgpt/app/static/_next/static/chunks/{webpack-6d79785e1375a57a.js => webpack-27020bb4734c8351.js} (63%) diff --git a/dbgpt/app/static/404.html b/dbgpt/app/static/404.html index e5bbdac8a..4b1c36d33 100644 --- a/dbgpt/app/static/404.html +++ b/dbgpt/app/static/404.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

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

404

This page could not be found.

\ No newline at end of file diff --git a/dbgpt/app/static/404/index.html b/dbgpt/app/static/404/index.html index e5bbdac8a..4b1c36d33 100644 --- a/dbgpt/app/static/404/index.html +++ b/dbgpt/app/static/404/index.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

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

404

This page could not be found.

\ No newline at end of file diff --git a/dbgpt/app/static/_next/static/Pz72WCJeXl85v4kN2kstR/_buildManifest.js b/dbgpt/app/static/_next/static/BuUzYaVTDY39gaUO-byZc/_buildManifest.js similarity index 73% rename from dbgpt/app/static/_next/static/Pz72WCJeXl85v4kN2kstR/_buildManifest.js rename to dbgpt/app/static/_next/static/BuUzYaVTDY39gaUO-byZc/_buildManifest.js index e1df88eb5..006cfdcba 100644 --- a/dbgpt/app/static/_next/static/Pz72WCJeXl85v4kN2kstR/_buildManifest.js +++ b/dbgpt/app/static/_next/static/BuUzYaVTDY39gaUO-byZc/_buildManifest.js @@ -1 +1 @@ -self.__BUILD_MANIFEST=function(s,c,a,e,t,n,f,d,k,h,i,b,u,j,p,o,g,l,r){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[p,s,c,e,a,h,f,d,o,"static/chunks/9305-f44429d5185a9fc7.js","static/chunks/7299-cb3b5c1ad528f20a.js","static/chunks/pages/index-60038165daa70046.js"],"/_error":["static/chunks/pages/_error-8095ba9e1bf12f30.js"],"/agent":[s,c,a,t,h,n,"static/chunks/pages/agent-ce4aada0ffb26742.js"],"/app":[i,s,c,e,a,t,n,b,u,"static/chunks/7958-ed34baf152e6e252.js",j,"static/chunks/pages/app-90415a5fdf367a91.js"],"/chat":["static/chunks/pages/chat-b09234393c5f8ad7.js"],"/database":[s,c,e,a,t,n,d,k,"static/chunks/7902-94d75aab69ac7c8d.js","static/chunks/pages/database-5b649049b3adcaf7.js"],"/flow":[i,b,u,j,"static/chunks/pages/flow-c83aa1081ec293f9.js"],"/flow/canvas":[p,i,s,c,e,a,f,d,b,k,u,g,o,"static/chunks/4350-1896c46dd5e9afe8.js",j,"static/chunks/pages/flow/canvas-70f324e20b0113c0.js"],"/knowledge":[l,s,c,a,t,h,n,d,k,r,g,"static/chunks/8660-25eebcb95c34109b.js","static/chunks/pages/knowledge-3b36ed0feb6e3138.js"],"/knowledge/chunk":[s,e,t,f,n,"static/chunks/pages/knowledge/chunk-148ca5920e6a3447.js"],"/models":[l,s,c,e,a,k,"static/chunks/3444-30181eacc7980e66.js","static/chunks/pages/models-a019e728f75142a1.js"],"/prompt":[s,c,e,a,f,r,"static/chunks/4733-cc041bf7a3d12e39.js","static/chunks/5396-3e98ef6b437678bd.js","static/chunks/pages/prompt-8ac6786093609ab9.js"],sortedPages:["/","/_app","/_error","/agent","/app","/chat","/database","/flow","/flow/canvas","/knowledge","/knowledge/chunk","/models","/prompt"]}}("static/chunks/7113-c0c4ee5dc30929ba.js","static/chunks/5503-c65f6d730754acc7.js","static/chunks/9479-21f588e1fd4e6b6d.js","static/chunks/1009-f20562de52b03b76.js","static/chunks/4442-2fd5fdaab894a502.js","static/chunks/5813-c6244a8eba7ef4ae.js","static/chunks/4810-1e930464030aee69.js","static/chunks/411-b5d3e7f64bee2335.js","static/chunks/8928-0e78def492052d13.js","static/chunks/4553-5a62c446efb06d63.js","static/chunks/971df74e-7436ff4085ebb785.js","static/chunks/7434-29506257e67e8077.js","static/chunks/9924-5bce555f07385e1f.js","static/css/b4846eed11c4725f.css","static/chunks/29107295-75edf0bf34e24b1e.js","static/chunks/2487-24749b0b156943d8.js","static/chunks/6485-a0f49ba464882399.js","static/chunks/75fc9c18-1d6133135d3d283c.js","static/chunks/8548-e633dfc38edeb044.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file +self.__BUILD_MANIFEST=function(s,c,a,e,t,n,f,d,k,b,h,i,u,j,p,o,g,l,r){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[p,s,c,e,a,b,f,d,o,"static/chunks/9305-f44429d5185a9fc7.js","static/chunks/7299-cb3b5c1ad528f20a.js","static/chunks/pages/index-018bceca9c8a4ee9.js"],"/_error":["static/chunks/pages/_error-8095ba9e1bf12f30.js"],"/agent":[s,c,a,t,b,n,"static/chunks/pages/agent-ce4aada0ffb26742.js"],"/app":[h,s,c,e,a,t,n,i,u,"static/chunks/7958-ed34baf152e6e252.js",j,"static/chunks/pages/app-b095ed77f7fd2022.js"],"/chat":["static/chunks/pages/chat-b09234393c5f8ad7.js"],"/database":[s,c,e,a,t,n,d,k,"static/chunks/7902-94d75aab69ac7c8d.js","static/chunks/pages/database-5b649049b3adcaf7.js"],"/flow":[h,i,u,j,"static/chunks/pages/flow-c83aa1081ec293f9.js"],"/flow/canvas":[p,h,s,c,e,a,f,d,i,k,u,g,o,"static/chunks/4350-1896c46dd5e9afe8.js",j,"static/chunks/pages/flow/canvas-70f324e20b0113c0.js"],"/knowledge":[l,s,c,a,t,b,n,d,k,r,g,"static/chunks/8660-25eebcb95c34109b.js","static/chunks/pages/knowledge-3b36ed0feb6e3138.js"],"/knowledge/chunk":[s,e,t,f,n,"static/chunks/pages/knowledge/chunk-148ca5920e6a3447.js"],"/models":[l,s,c,e,a,k,"static/chunks/3444-30181eacc7980e66.js","static/chunks/pages/models-a019e728f75142a1.js"],"/prompt":[s,c,e,a,f,r,"static/chunks/4733-cc041bf7a3d12e39.js","static/chunks/5396-3e98ef6b437678bd.js","static/chunks/pages/prompt-8ac6786093609ab9.js"],sortedPages:["/","/_app","/_error","/agent","/app","/chat","/database","/flow","/flow/canvas","/knowledge","/knowledge/chunk","/models","/prompt"]}}("static/chunks/7113-c0c4ee5dc30929ba.js","static/chunks/5503-c65f6d730754acc7.js","static/chunks/9479-21f588e1fd4e6b6d.js","static/chunks/1009-f20562de52b03b76.js","static/chunks/4442-2fd5fdaab894a502.js","static/chunks/5813-c6244a8eba7ef4ae.js","static/chunks/4810-1e930464030aee69.js","static/chunks/411-b5d3e7f64bee2335.js","static/chunks/8928-0e78def492052d13.js","static/chunks/4553-5a62c446efb06d63.js","static/chunks/971df74e-7436ff4085ebb785.js","static/chunks/7434-29506257e67e8077.js","static/chunks/9924-5bce555f07385e1f.js","static/css/b4846eed11c4725f.css","static/chunks/29107295-75edf0bf34e24b1e.js","static/chunks/2487-24749b0b156943d8.js","static/chunks/6485-a0f49ba464882399.js","static/chunks/75fc9c18-1d6133135d3d283c.js","static/chunks/8548-e633dfc38edeb044.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/dbgpt/app/static/_next/static/Pz72WCJeXl85v4kN2kstR/_ssgManifest.js b/dbgpt/app/static/_next/static/BuUzYaVTDY39gaUO-byZc/_ssgManifest.js similarity index 100% rename from dbgpt/app/static/_next/static/Pz72WCJeXl85v4kN2kstR/_ssgManifest.js rename to dbgpt/app/static/_next/static/BuUzYaVTDY39gaUO-byZc/_ssgManifest.js diff --git a/dbgpt/app/static/_next/static/chunks/pages/_app-4fa488d6595180a9.js b/dbgpt/app/static/_next/static/chunks/pages/_app-bd401791059b31a0.js similarity index 100% rename from dbgpt/app/static/_next/static/chunks/pages/_app-4fa488d6595180a9.js rename to dbgpt/app/static/_next/static/chunks/pages/_app-bd401791059b31a0.js diff --git a/dbgpt/app/static/_next/static/chunks/pages/app-90415a5fdf367a91.js b/dbgpt/app/static/_next/static/chunks/pages/app-b095ed77f7fd2022.js similarity index 86% rename from dbgpt/app/static/_next/static/chunks/pages/app-90415a5fdf367a91.js rename to dbgpt/app/static/_next/static/chunks/pages/app-b095ed77f7fd2022.js index 39477aa91..c7e4d0ba4 100644 --- a/dbgpt/app/static/_next/static/chunks/pages/app-90415a5fdf367a91.js +++ b/dbgpt/app/static/_next/static/chunks/pages/app-b095ed77f7fd2022.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6366],{89301:function(e,t,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/app",function(){return l(99786)}])},91085:function(e,t,l){"use strict";var a=l(85893),n=l(32983),s=l(71577),r=l(67421);t.Z=function(e){let{error:t,description:l,refresh:i}=e,{t:o}=(0,r.$G)();return(0,a.jsx)(n.Z,{image:"/empty.png",imageStyle:{width:320,height:320,margin:"0 auto",maxWidth:"100%",maxHeight:"100%"},className:"flex items-center justify-center flex-col h-full w-full",description:t?(0,a.jsx)(s.ZP,{type:"primary",onClick:i,children:o("try_again")}):null!=l?l:o("no_data")})}},26892:function(e,t,l){"use strict";var a=l(85893),n=l(67294),s=l(66309),r=l(83062),i=l(94184),o=l.n(i),c=l(25675),d=l.n(c);t.Z=(0,n.memo)(function(e){let{icon:t,iconBorder:l=!0,title:i,desc:c,tags:u,children:m,disabled:p,operations:x,className:h,...f}=e,v=(0,n.useMemo)(()=>t?"string"==typeof t?(0,a.jsx)(d(),{className:o()("w-11 h-11 rounded-full mr-4 object-contain bg-white",{"border border-gray-200":l}),width:44,height:44,src:t,alt:i}):t:null,[t]),g=(0,n.useMemo)(()=>u&&u.length?(0,a.jsx)("div",{className:"flex items-center mt-1 flex-wrap",children:u.map((e,t)=>{var l;return"string"==typeof e?(0,a.jsx)(s.Z,{className:"text-xs",bordered:!1,color:"default",children:e},t):(0,a.jsx)(s.Z,{className:"text-xs",bordered:null!==(l=e.border)&&void 0!==l&&l,color:e.color,children:e.text},t)})}):null,[u]);return(0,a.jsxs)("div",{className:o()("group/card relative flex flex-col w-72 rounded justify-between text-black bg-white shadow-[0_8px_16px_-10px_rgba(100,100,100,.08)] hover:shadow-[0_14px_20px_-10px_rgba(100,100,100,.15)] dark:bg-[#232734] dark:text-white dark:hover:border-white transition-[transfrom_shadow] duration-300 hover:-translate-y-1 min-h-fit",{"grayscale cursor-no-drop":p,"cursor-pointer":!p&&!!f.onClick},h),...f,children:[(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[v,(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:i}),g]})]}),c&&(0,a.jsx)(r.Z,{title:c,children:(0,a.jsx)("p",{className:"mt-2 text-sm text-gray-500 font-normal line-clamp-2",children:c})})]}),(0,a.jsxs)("div",{children:[m,x&&!!x.length&&(0,a.jsx)("div",{className:"flex flex-wrap items-center justify-center border-t border-solid border-gray-100 dark:border-theme-dark",children:x.map((e,t)=>(0,a.jsx)(r.Z,{title:e.label,children:(0,a.jsxs)("div",{className:"relative flex flex-1 items-center justify-center h-11 text-gray-400 hover:text-blue-500 transition-colors duration-300 cursor-pointer",onClick:t=>{var l;t.stopPropagation(),null===(l=e.onClick)||void 0===l||l.call(e)},children:[e.children,t{let{id:t,sourceX:l,sourceY:s,targetX:r,targetY:i,sourcePosition:o,targetPosition:c,style:d={},data:u,markerEnd:m}=e,[p,x,h]=(0,n.OQ)({sourceX:l,sourceY:s,sourcePosition:o,targetX:r,targetY:i,targetPosition:c}),f=(0,n._K)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.u5,{id:t,style:d,path:p,markerEnd:m}),(0,a.jsx)("foreignObject",{width:40,height:40,x:x-20,y:h-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(),f.setEdges(f.getEdges().filter(e=>e.id!==t))},children:"\xd7"})})]})}},23391:function(e,t,l){"use strict";var a=l(85893);l(67294);var n=l(36851),s=l(59819),r=l(99743),i=l(67919);l(4583),t.Z=e=>{let{flowData:t,minZoom:l}=e,o=(0,i.z5)(t);return(0,a.jsx)(n.x$,{nodes:o.nodes,edges:o.edges,edgeTypes:{buttonedge:r.Z},fitView:!0,minZoom:l||.1,children:(0,a.jsx)(s.A,{color:"#aaa",gap:16})})}},99786:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return $}});var a=l(85893),n=l(39479),s=l(85418),r=l(42075),i=l(36147),o=l(75081),c=l(79531),d=l(51009),u=l(44442),m=l(67294),p=l(67421);function x(){return(0,a.jsx)("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"5649",width:"1.5em",height:"1.5em",children:(0,a.jsx)("path",{d:"M810.666667 554.666667h-256v256h-85.333334v-256H213.333333v-85.333334h256V213.333333h85.333334v256h256v85.333334z","p-id":"5650",fill:"#bfbfbf"})})}var h=l(43893),f=l(71577),v=l(27704),g=l(85813),_=l(72269);function y(e){let{resourceTypeOptions:t,updateResourcesByIndex:l,index:n,resource:s}=e,{t:r}=(0,p.$G)(),[i,o]=(0,m.useState)(s.type||(null==t?void 0:t[0].label)),[u,x]=(0,m.useState)([]),[f,y]=(0,m.useState)({name:s.name,type:s.type,value:s.value,is_dynamic:s.is_dynamic||!1}),j=async()=>{let[e,t]=await (0,h.Vx)((0,h.RX)({type:i}));t?x(null==t?void 0:t.map(e=>({label:e,value:e}))):x([])},b=e=>{o(e)},w=(e,t)=>{f[t]=e,y(f),l(f,n)},N=()=>{l(null,n)};return(0,m.useEffect)(()=>{j(),w(f.type||i,"type")},[i]),(0,m.useEffect)(()=>{var e,t;w((null===(e=u[0])||void 0===e?void 0:e.label)||s.value,"value"),y({...f,value:(null===(t=u[0])||void 0===t?void 0:t.label)||s.value})},[u]),(0,a.jsx)(g.Z,{className:"mb-3 dark:bg-[#232734] border-gray-200",title:"Resource ".concat(n+1),extra:(0,a.jsx)(v.Z,{className:"text-[#ff1b2e] !text-lg",onClick:()=>{N()}}),children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center mb-6",children:[(0,a.jsxs)("div",{className:"font-bold mr-4 w-32 text-center",children:[(0,a.jsx)("span",{className:"text-[#ff4d4f] font-normal",children:"*"}),"\xa0",r("resource_name"),":"]}),(0,a.jsx)(c.default,{className:"w-1/3",required:!0,value:f.name,onInput:e=>{w(e.target.value,"name")}}),(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"font-bold w-32 text-center",children:r("resource_dynamic")}),(0,a.jsx)(_.Z,{defaultChecked:s.is_dynamic||!1,style:{background:f.is_dynamic?"#1677ff":"#ccc"},onChange:e=>{w(e,"is_dynamic")}})]})]}),(0,a.jsxs)("div",{className:"flex mb-5 items-center",children:[(0,a.jsxs)("div",{className:"font-bold mr-4 w-32 text-center",children:[r("resource_type"),": "]}),(0,a.jsx)(d.default,{className:"w-1/3",options:t,value:f.type||(null==t?void 0:t[0]),onChange:e=>{w(e,"type"),b(e)}}),(0,a.jsxs)("div",{className:"font-bold w-32 text-center",children:[r("resource_value"),":"]}),(null==u?void 0:u.length)>0?(0,a.jsx)(d.default,{value:f.value,className:"flex-1",options:u,onChange:e=>{w(e,"value")}}):(0,a.jsx)(c.default,{className:"flex-1",value:f.value||s.value,onInput:e=>{w(e.target.value,"value")}})]})]})})}function j(e){var t;let{resourceTypes:l,updateDetailsByAgentKey:n,detail:s,editResources:r}=e,{t:i}=(0,p.$G)(),[o,u]=(0,m.useState)([...null!=r?r:[]]),[x,v]=(0,m.useState)({...s,resources:[]}),[g,_]=(0,m.useState)([]),[j,b]=(0,m.useState)([]),w=(e,t)=>{u(l=>{let a=[...l];return e?a.map((l,a)=>t===a?e:l):a.filter((e,l)=>t!==l)})},N=async()=>{let[e,t]=await (0,h.Vx)((0,h.Vd)());t&&_(null==t?void 0:t.map(e=>({label:e,value:e})))},k=async e=>{let[t,l]=await (0,h.Vx)((0,h.m9)(e));if(l){var a;b(null!==(a=l.map(e=>({label:e,value:e})))&&void 0!==a?a:[])}};(0,m.useEffect)(()=>{N(),k(s.llm_strategy)},[]),(0,m.useEffect)(()=>{C(o,"resources")},[o]);let C=(e,t)=>{let l={...x};l[t]=e,v(l),n(s.key,l)},Z=(0,m.useMemo)(()=>null==l?void 0:l.map(e=>({label:e,value:e})),[l]);return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center mb-6 mt-6",children:[(0,a.jsx)("div",{className:"mr-2 w-16 text-center",children:"Prompt:"}),(0,a.jsx)(c.default,{required:!0,className:"mr-6 w-1/4",value:x.prompt_template,onChange:e=>{C(e.target.value,"prompt_template")}}),(0,a.jsx)("div",{className:"mr-2",children:"LLM Strategy:"}),(0,a.jsx)(d.default,{value:x.llm_strategy,options:g,className:"w-1/6 mr-6",onChange:e=>{C(e,"llm_strategy"),k(e)}}),j&&j.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mr-2",children:"LLM Strategy Value:"}),(0,a.jsx)(d.default,{value:(t=x.llm_strategy_value)?t.split(","):[],className:"w-1/4",mode:"multiple",options:j,onChange:e=>{if(!e||(null==e?void 0:e.length)===0)return C(null,"llm_strategy_value"),null;let t=e.reduce((e,t,l)=>0===l?t:"".concat(e,",").concat(t),"");C(t,"llm_strategy_value")}})]})]}),(0,a.jsx)("div",{className:"mb-3 text-lg font-bold",children:i("available_resources")}),o.map((e,t)=>(0,a.jsx)(y,{resource:e,index:t,updateResourcesByIndex:w,resourceTypeOptions:Z},t)),(0,a.jsx)(f.ZP,{type:"primary",className:"mt-2",size:"middle",onClick:()=>{u([...o,{name:"",type:"",introduce:"",value:"",is_dynamic:""}])},children:i("add_resource")})]})}var b=l(23391),w=l(41664),N=l.n(w),k=l(36609);function C(e){var t;let{onFlowsChange:l,teamContext:n}=e,[s,r]=(0,m.useState)(),[i,o]=(0,m.useState)(),[c,u]=(0,m.useState)(),p=async()=>{let[e,t]=await (0,h.Vx)((0,h.Wf)());if(t){var a;o(null==t?void 0:null===(a=t.items)||void 0===a?void 0:a.map(e=>({label:e.name,value:e.name}))),r(t.items),l(null==t?void 0:t.items[0])}};return(0,m.useEffect)(()=>{p()},[]),(0,m.useEffect)(()=>{u((null==s?void 0:s.find(e=>(null==n?void 0:n.name)===e.name))||(null==s?void 0:s[0]))},[n,s]),(0,a.jsxs)("div",{className:"w-full h-[300px]",children:[(0,a.jsx)("div",{className:"mr-24 mb-4 mt-2",children:"Flows:"}),(0,a.jsxs)("div",{className:"flex items-center mb-6",children:[(0,a.jsx)(d.default,{onChange:e=>{u(null==s?void 0:s.find(t=>e===t.name)),l(null==s?void 0:s.find(t=>e===t.name))},value:(null==c?void 0:c.name)||(null==i?void 0:null===(t=i[0])||void 0===t?void 0:t.value),className:"w-1/4",options:i}),(0,a.jsx)(N(),{href:"/flow/canvas/",className:"ml-6",children:(0,k.t)("edit_new_applications")}),(0,a.jsx)("div",{className:"text-gray-500 ml-16",children:null==c?void 0:c.description})]}),c&&(0,a.jsx)("div",{className:"w-full h-full border-[0.5px] border-dark-gray",children:(0,a.jsx)(b.Z,{flowData:null==c?void 0:c.flow_data})})]})}let Z=[{value:"zh",label:"中文"},{value:"en",label:"英文"}];function S(e){let{handleCancel:t,open:l,updateApps:f,type:v,app:g}=e,{t:_}=(0,p.$G)(),[y,b]=(0,m.useState)(!1),[w,N]=(0,m.useState)(),[k,S]=(0,m.useState)(),[E,V]=(0,m.useState)([]),[T,A]=(0,m.useState)([]),[P,q]=(0,m.useState)([...(null==g?void 0:g.details)||[]]),[z,F]=(0,m.useState)(),[I,O]=(0,m.useState)(),[D,$]=(0,m.useState)(g.team_modal||"auto_plan"),[G]=n.Z.useForm(),H=async e=>{await (0,h.Vx)("add"===v?(0,h.L5)(e):(0,h.KT)(e)),await f()},K=async()=>{let e=g.details,[t,l]=await (0,h.Vx)((0,h.Q5)());(null==e?void 0:e.length)>0&&V(null==e?void 0:e.map(e=>({label:null==e?void 0:e.agent_name,children:(0,a.jsx)(j,{editResources:"edit"===v&&e.resources,detail:{key:null==e?void 0:e.agent_name,llm_strategy:null==e?void 0:e.llm_strategy,agent_name:null==e?void 0:e.agent_name,prompt_template:null==e?void 0:e.prompt_template,llm_strategy_value:null==e?void 0:e.llm_strategy_value},updateDetailsByAgentKey:L,resourceTypes:l}),key:null==e?void 0:e.agent_name})))},M=async()=>{let[e,t]=await (0,h.Vx)((0,h.lz)());if(!t)return null;let l=t.map(e=>({value:e,label:e}));S(l)},R=async()=>{let[e,t]=await (0,h.Vx)((0,h.j8)());if(!t)return null;A(t.map(e=>({label:e.name,key:e.name,onClick:()=>{Q(e)},agent:e})).filter(e=>{var t,l;return g.details&&(null===(t=g.details)||void 0===t?void 0:t.length)!==0?null==g?void 0:null===(l=g.details)||void 0===l?void 0:l.every(t=>t.agent_name!==e.label):e}))},B=async()=>{let[e,t]=await (0,h.Vx)((0,h.Q5)());t&&O(t)};(0,m.useEffect)(()=>{M(),R(),B()},[]),(0,m.useEffect)(()=>{"edit"===v&&K()},[I]),(0,m.useEffect)(()=>{$(g.team_mode||"auto_plan")},[g]);let L=(e,t)=>{q(l=>l.map(l=>e===(l.agent_name||l.key)?t:l))},Q=async e=>{let t=e.name,[l,n]=await (0,h.Vx)((0,h.Q5)());N(t),q(e=>[...e,{key:t,name:"",llm_strategy:"priority"}]),V(e=>[...e,{label:t,children:(0,a.jsx)(j,{detail:{key:t,llm_strategy:"default",agent_name:t,prompt_template:"",llm_strategy_value:null},updateDetailsByAgentKey:L,resourceTypes:n}),key:t}]),A(t=>t.filter(t=>t.key!==e.name))},W=e=>{let t=w,l=-1;if(!E)return null;E.forEach((t,a)=>{t.key===e&&(l=a-1)});let a=E.filter(t=>t.key!==e);a.length&&t===e&&(t=l>=0?a[l].key:a[0].key),q(t=>null==t?void 0:t.filter(t=>(t.agent_name||t.key)!==e)),V(a),N(t),A(t=>[...t,{label:e,key:e,onClick:()=>{Q({name:e,describe:"",system_message:""})}}])},X=async()=>{let e=await G.validateFields();if(!e)return;b(!0);let l={...G.getFieldsValue()};if("edit"===v&&(l.app_code=g.app_code),"awel_layout"!==l.team_mode)l.details=P;else{let e={...z};delete e.flow_data,l.team_context=e}try{await H(l)}catch(e){return}b(!1),t()};return(0,a.jsx)("div",{children:(0,a.jsx)(i.default,{okText:_("Submit"),title:"edit"===v?"edit application":"add application",open:l,width:"65%",onCancel:t,onOk:X,destroyOnClose:!0,children:(0,a.jsx)(o.Z,{spinning:y,children:(0,a.jsxs)(n.Z,{form:G,preserve:!1,size:"large",className:"mt-4 max-h-[70vh] overflow-auto h-[90vh]",layout:"horizontal",labelAlign:"left",labelCol:{span:4},initialValues:{app_name:g.app_name,app_describe:g.app_describe,language:g.language||Z[0].value,team_mode:g.team_mode||"auto_plan"},autoComplete:"off",onFinish:X,children:[(0,a.jsx)(n.Z.Item,{label:"App Name",name:"app_name",rules:[{required:!0,message:_("Please_input_the_name")}],children:(0,a.jsx)(c.default,{placeholder:_("Please_input_the_name")})}),(0,a.jsx)(n.Z.Item,{label:_("Description"),name:"app_describe",rules:[{required:!0,message:_("Please_input_the_description")}],children:(0,a.jsx)(c.default.TextArea,{rows:3,placeholder:_("Please_input_the_description")})}),(0,a.jsxs)("div",{className:"flex w-full",children:[(0,a.jsx)(n.Z.Item,{labelCol:{span:7},label:_("language"),name:"language",className:"w-1/2",rules:[{required:!0}],children:(0,a.jsx)(d.default,{className:"w-2/3 ml-4",placeholder:_("language_select_tips"),options:Z})}),(0,a.jsx)(n.Z.Item,{label:_("team_modal"),name:"team_mode",className:"w-1/2",labelCol:{span:6},rules:[{required:!0}],children:(0,a.jsx)(d.default,{defaultValue:g.team_mode||"auto_plan",className:"ml-4 w-72",onChange:e=>{$(e)},placeholder:_("Please_input_the_work_modal"),options:k})})]}),"awel_layout"!==D?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-5",children:"Agents"}),(0,a.jsx)(u.Z,{addIcon:(0,a.jsx)(s.Z,{menu:{items:T},trigger:["click"],children:(0,a.jsx)("a",{className:"h-8 flex items-center",onClick:e=>e.preventDefault(),children:(0,a.jsx)(r.Z,{children:(0,a.jsx)(x,{})})})}),type:"editable-card",onChange:e=>{N(e)},activeKey:w,onEdit:(e,t)=>{"add"===t||W(e)},items:E})]}):(0,a.jsx)(C,{onFlowsChange:e=>{F(e)},teamContext:g.team_context})]})})})})}var E=l(28058),V=l(37017),T=l(90598),A=l(11163),P=l(41468),q=l(26892);let{confirm:z}=i.default,F={en:"英文",zh:"中文"};function I(e){let{updateApps:t,app:l,handleEdit:n,isCollected:s}=e,{model:r}=(0,m.useContext)(P.p),i=(0,A.useRouter)(),[o,c]=(0,m.useState)(l.is_collected),{setAgent:d}=(0,m.useContext)(P.p),{t:u}=(0,p.$G)(),x=()=>{z({title:u("Tips"),icon:(0,a.jsx)(E.Z,{}),content:"do you want delete the application?",okText:"Yes",okType:"danger",cancelText:"No",async onOk(){await (0,h.Vx)((0,h.Nl)({app_code:l.app_code})),t(s?{is_collected:s}:void 0)}})};(0,m.useEffect)(()=>{c(l.is_collected)},[l]);let f=async()=>{let[e]=await (0,h.Vx)("true"===o?(0,h.gD)({app_code:l.app_code}):(0,h.mo)({app_code:l.app_code}));e||(t(s?{is_collected:s}:void 0),c("true"===o?"false":"true"))},g=async()=>{null==d||d(l.app_code);let[,e]=await (0,h.Vx)((0,h.sW)({chat_mode:"chat_agent"}));e&&i.push("/chat/?scene=chat_agent&id=".concat(e.conv_uid).concat(r?"&model=".concat(r):""))};return(0,a.jsx)(q.Z,{title:l.app_name,icon:"/icons/node/vis.png",iconBorder:!1,desc:l.app_describe,tags:[{text:F[l.language],color:"default"},{text:l.team_mode,color:"default"}],onClick:()=>{n(l)},operations:[{label:u("Chat"),children:(0,a.jsx)(V.Z,{}),onClick:g},{label:u("collect"),children:(0,a.jsx)(T.Z,{className:"false"===l.is_collected?"text-gray-400":"text-yellow-400"}),onClick:f},{label:u("Delete"),children:(0,a.jsx)(v.Z,{}),onClick:()=>{x()}}]})}var O=l(24969),D=l(91085);function $(){let{t:e}=(0,p.$G)(),[t,l]=(0,m.useState)(!1),[n,s]=(0,m.useState)(!1),[r,i]=(0,m.useState)("app"),[c,d]=(0,m.useState)([]),[x,v]=(0,m.useState)(),[g,_]=(0,m.useState)("add"),y=()=>{_("add"),l(!0)},j=e=>{_("edit"),v(e),l(!0)},b=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(!0);let[t,l]=await (0,h.Vx)((0,h.yk)(e));if(t){s(!1);return}l&&(d(l||[]),s(!1))};(0,m.useEffect)(()=>{b()},[]);let w=t=>{let l=t.isCollected?c.every(e=>!e.is_collected):0===c.length;return(0,a.jsxs)("div",{children:[!t.isCollected&&(0,a.jsx)(f.ZP,{onClick:y,type:"primary",className:"mb-4",icon:(0,a.jsx)(O.Z,{}),children:e("create")}),l?(0,a.jsx)(D.Z,{}):(0,a.jsx)("div",{className:" w-full flex flex-wrap pb-0 gap-4",children:c.map((e,t)=>(0,a.jsx)(I,{handleEdit:j,app:e,updateApps:b,isCollected:"collected"===r},t))})]})},N=[{key:"app",label:"App",children:w({isCollected:!1})},{key:"collected",label:"Collected",children:w({isCollected:!0})}];return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(o.Z,{spinning:n,children:(0,a.jsxs)("div",{className:"h-screen w-full p-4 md:p-6 overflow-y-auto",children:[(0,a.jsx)(u.Z,{defaultActiveKey:"app",items:N,onChange:e=>{i(e),"collected"===e?b({is_collected:!0}):b()}}),t&&(0,a.jsx)(S,{app:"edit"===g?x:{},type:g,updateApps:b,open:t,handleCancel:()=>{l(!1)}})]})})})}},67919:function(e,t,l){"use strict";l.d(t,{Rv:function(){return r},VZ:function(){return a},Wf:function(){return n},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)},n=e=>{let{nodes:t,edges:l,...a}=e,n=t.map(e=>{let{positionAbsolute:t,...l}=e;return{position_absolute:t,...l}}),s=l.map(e=>{let{sourceHandle:t,targetHandle:l,...a}=e;return{source_handle:t,target_handle:l,...a}});return{nodes:n,edges:s,...a}},s=e=>{let{nodes:t,edges:l,...a}=e,n=t.map(e=>{let{position_absolute:t,...l}=e;return{positionAbsolute:t,...l}}),s=l.map(e=>{let{source_handle:t,target_handle:l,...a}=e;return{sourceHandle:t,targetHandle:l,...a}});return{nodes:n,edges:s,...a}},r=e=>{let{nodes:t,edges:l}=e,a=[!0,t[0],""];e:for(let e=0;el.targetHandle==="".concat(t[e].id,"|inputs|").concat(r))){a=[!1,t[e],"The input ".concat(s[r].type_name," of node ").concat(n.label," is required")];break e}for(let s=0;sl.targetHandle==="".concat(t[e].id,"|parameters|").concat(s))){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(n.label," is required")];break e}}else{a=[!1,t[e],"The parameter ".concat(i.type_name," of node ").concat(n.label," is required")];break e}}}return a}}},function(e){e.O(0,[8241,7113,5503,1009,9479,4442,5813,7434,9924,7958,9774,2888,179],function(){return e(e.s=89301)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6366],{89301:function(e,t,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/app",function(){return l(99786)}])},91085:function(e,t,l){"use strict";var a=l(85893),n=l(32983),s=l(71577),r=l(67421);t.Z=function(e){let{error:t,description:l,refresh:i}=e,{t:o}=(0,r.$G)();return(0,a.jsx)(n.Z,{image:"/empty.png",imageStyle:{width:320,height:320,margin:"0 auto",maxWidth:"100%",maxHeight:"100%"},className:"flex items-center justify-center flex-col h-full w-full",description:t?(0,a.jsx)(s.ZP,{type:"primary",onClick:i,children:o("try_again")}):null!=l?l:o("no_data")})}},26892:function(e,t,l){"use strict";var a=l(85893),n=l(67294),s=l(66309),r=l(83062),i=l(94184),o=l.n(i),c=l(25675),d=l.n(c);t.Z=(0,n.memo)(function(e){let{icon:t,iconBorder:l=!0,title:i,desc:c,tags:u,children:m,disabled:p,operations:x,className:h,...f}=e,v=(0,n.useMemo)(()=>t?"string"==typeof t?(0,a.jsx)(d(),{className:o()("w-11 h-11 rounded-full mr-4 object-contain bg-white",{"border border-gray-200":l}),width:44,height:44,src:t,alt:i}):t:null,[t]),g=(0,n.useMemo)(()=>u&&u.length?(0,a.jsx)("div",{className:"flex items-center mt-1 flex-wrap",children:u.map((e,t)=>{var l;return"string"==typeof e?(0,a.jsx)(s.Z,{className:"text-xs",bordered:!1,color:"default",children:e},t):(0,a.jsx)(s.Z,{className:"text-xs",bordered:null!==(l=e.border)&&void 0!==l&&l,color:e.color,children:e.text},t)})}):null,[u]);return(0,a.jsxs)("div",{className:o()("group/card relative flex flex-col w-72 rounded justify-between text-black bg-white shadow-[0_8px_16px_-10px_rgba(100,100,100,.08)] hover:shadow-[0_14px_20px_-10px_rgba(100,100,100,.15)] dark:bg-[#232734] dark:text-white dark:hover:border-white transition-[transfrom_shadow] duration-300 hover:-translate-y-1 min-h-fit",{"grayscale cursor-no-drop":p,"cursor-pointer":!p&&!!f.onClick},h),...f,children:[(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[v,(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:i}),g]})]}),c&&(0,a.jsx)(r.Z,{title:c,children:(0,a.jsx)("p",{className:"mt-2 text-sm text-gray-500 font-normal line-clamp-2",children:c})})]}),(0,a.jsxs)("div",{children:[m,x&&!!x.length&&(0,a.jsx)("div",{className:"flex flex-wrap items-center justify-center border-t border-solid border-gray-100 dark:border-theme-dark",children:x.map((e,t)=>(0,a.jsx)(r.Z,{title:e.label,children:(0,a.jsxs)("div",{className:"relative flex flex-1 items-center justify-center h-11 text-gray-400 hover:text-blue-500 transition-colors duration-300 cursor-pointer",onClick:t=>{var l;t.stopPropagation(),null===(l=e.onClick)||void 0===l||l.call(e)},children:[e.children,t{let{id:t,sourceX:l,sourceY:s,targetX:r,targetY:i,sourcePosition:o,targetPosition:c,style:d={},data:u,markerEnd:m}=e,[p,x,h]=(0,n.OQ)({sourceX:l,sourceY:s,sourcePosition:o,targetX:r,targetY:i,targetPosition:c}),f=(0,n._K)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.u5,{id:t,style:d,path:p,markerEnd:m}),(0,a.jsx)("foreignObject",{width:40,height:40,x:x-20,y:h-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(),f.setEdges(f.getEdges().filter(e=>e.id!==t))},children:"\xd7"})})]})}},23391:function(e,t,l){"use strict";var a=l(85893);l(67294);var n=l(36851),s=l(59819),r=l(99743),i=l(67919);l(4583),t.Z=e=>{let{flowData:t,minZoom:l}=e,o=(0,i.z5)(t);return(0,a.jsx)(n.x$,{nodes:o.nodes,edges:o.edges,edgeTypes:{buttonedge:r.Z},fitView:!0,minZoom:l||.1,children:(0,a.jsx)(s.A,{color:"#aaa",gap:16})})}},99786:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return $}});var a=l(85893),n=l(39479),s=l(85418),r=l(42075),i=l(36147),o=l(75081),c=l(79531),d=l(51009),u=l(44442),m=l(67294),p=l(67421);function x(){return(0,a.jsx)("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"5649",width:"1.5em",height:"1.5em",children:(0,a.jsx)("path",{d:"M810.666667 554.666667h-256v256h-85.333334v-256H213.333333v-85.333334h256V213.333333h85.333334v256h256v85.333334z","p-id":"5650",fill:"#bfbfbf"})})}var h=l(43893),f=l(71577),v=l(27704),g=l(85813),_=l(72269);function y(e){let{resourceTypeOptions:t,updateResourcesByIndex:l,index:n,resource:s}=e,{t:r}=(0,p.$G)(),[i,o]=(0,m.useState)(s.type||(null==t?void 0:t[0].label)),[u,x]=(0,m.useState)([]),[f,y]=(0,m.useState)({name:s.name,type:s.type,value:s.value,is_dynamic:s.is_dynamic||!1}),j=async()=>{let[e,t]=await (0,h.Vx)((0,h.RX)({type:i}));t?x(null==t?void 0:t.map(e=>({label:e,value:e}))):x([])},b=e=>{o(e)},w=(e,t)=>{f[t]=e,y(f),l(f,n)},N=()=>{l(null,n)};return(0,m.useEffect)(()=>{j(),w(f.type||i,"type")},[i]),(0,m.useEffect)(()=>{var e,t;w((null===(e=u[0])||void 0===e?void 0:e.label)||s.value,"value"),y({...f,value:(null===(t=u[0])||void 0===t?void 0:t.label)||s.value})},[u]),(0,a.jsx)(g.Z,{className:"mb-3 dark:bg-[#232734] border-gray-200",title:"Resource ".concat(n+1),extra:(0,a.jsx)(v.Z,{className:"text-[#ff1b2e] !text-lg",onClick:()=>{N()}}),children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center mb-6",children:[(0,a.jsxs)("div",{className:"font-bold mr-4 w-32 text-center",children:[(0,a.jsx)("span",{className:"text-[#ff4d4f] font-normal",children:"*"}),"\xa0",r("resource_name"),":"]}),(0,a.jsx)(c.default,{className:"w-1/3",required:!0,value:f.name,onInput:e=>{w(e.target.value,"name")}}),(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"font-bold w-32 text-center",children:r("resource_dynamic")}),(0,a.jsx)(_.Z,{defaultChecked:s.is_dynamic||!1,style:{background:f.is_dynamic?"#1677ff":"#ccc"},onChange:e=>{w(e,"is_dynamic")}})]})]}),(0,a.jsxs)("div",{className:"flex mb-5 items-center",children:[(0,a.jsxs)("div",{className:"font-bold mr-4 w-32 text-center",children:[r("resource_type"),": "]}),(0,a.jsx)(d.default,{className:"w-1/3",options:t,value:f.type||(null==t?void 0:t[0]),onChange:e=>{w(e,"type"),b(e)}}),(0,a.jsxs)("div",{className:"font-bold w-32 text-center",children:[r("resource_value"),":"]}),(null==u?void 0:u.length)>0?(0,a.jsx)(d.default,{value:f.value,className:"flex-1",options:u,onChange:e=>{w(e,"value")}}):(0,a.jsx)(c.default,{className:"flex-1",value:f.value||s.value,onInput:e=>{w(e.target.value,"value")}})]})]})})}function j(e){var t;let{resourceTypes:l,updateDetailsByAgentKey:n,detail:s,editResources:r}=e,{t:i}=(0,p.$G)(),[o,u]=(0,m.useState)([...null!=r?r:[]]),[x,v]=(0,m.useState)({...s,resources:[]}),[g,_]=(0,m.useState)([]),[j,b]=(0,m.useState)([]),w=(e,t)=>{u(l=>{let a=[...l];return e?a.map((l,a)=>t===a?e:l):a.filter((e,l)=>t!==l)})},N=async()=>{let[e,t]=await (0,h.Vx)((0,h.Vd)());t&&_(null==t?void 0:t.map(e=>({label:e,value:e})))},k=async e=>{let[t,l]=await (0,h.Vx)((0,h.m9)(e));if(l){var a;b(null!==(a=l.map(e=>({label:e,value:e})))&&void 0!==a?a:[])}};(0,m.useEffect)(()=>{N(),k(s.llm_strategy)},[]),(0,m.useEffect)(()=>{C(o,"resources")},[o]);let C=(e,t)=>{let l={...x};l[t]=e,v(l),n(s.key,l)},Z=(0,m.useMemo)(()=>null==l?void 0:l.map(e=>({label:e,value:e})),[l]);return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center mb-6 mt-6",children:[(0,a.jsx)("div",{className:"mr-2 w-16 text-center",children:"Prompt:"}),(0,a.jsx)(c.default,{required:!0,className:"mr-6 w-1/4",value:x.prompt_template,onChange:e=>{C(e.target.value,"prompt_template")}}),(0,a.jsx)("div",{className:"mr-2",children:"LLM Strategy:"}),(0,a.jsx)(d.default,{value:x.llm_strategy,options:g,className:"w-1/6 mr-6",onChange:e=>{C(e,"llm_strategy"),k(e)}}),j&&j.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mr-2",children:"LLM Strategy Value:"}),(0,a.jsx)(d.default,{value:(t=x.llm_strategy_value)?t.split(","):[],className:"w-1/4",mode:"multiple",options:j,onChange:e=>{if(!e||(null==e?void 0:e.length)===0)return C(null,"llm_strategy_value"),null;let t=e.reduce((e,t,l)=>0===l?t:"".concat(e,",").concat(t),"");C(t,"llm_strategy_value")}})]})]}),(0,a.jsx)("div",{className:"mb-3 text-lg font-bold",children:i("available_resources")}),o.map((e,t)=>(0,a.jsx)(y,{resource:e,index:t,updateResourcesByIndex:w,resourceTypeOptions:Z},t)),(0,a.jsx)(f.ZP,{type:"primary",className:"mt-2",size:"middle",onClick:()=>{u([...o,{name:"",type:"",introduce:"",value:"",is_dynamic:""}])},children:i("add_resource")})]})}var b=l(23391),w=l(41664),N=l.n(w),k=l(36609);function C(e){var t;let{onFlowsChange:l,teamContext:n}=e,[s,r]=(0,m.useState)(),[i,o]=(0,m.useState)(),[c,u]=(0,m.useState)(),p=async()=>{let[e,t]=await (0,h.Vx)((0,h.Wf)());if(t){var a;o(null==t?void 0:null===(a=t.items)||void 0===a?void 0:a.map(e=>({label:e.name,value:e.name}))),r(t.items),l(null==t?void 0:t.items[0])}};return(0,m.useEffect)(()=>{p()},[]),(0,m.useEffect)(()=>{u((null==s?void 0:s.find(e=>(null==n?void 0:n.name)===e.name))||(null==s?void 0:s[0]))},[n,s]),(0,a.jsxs)("div",{className:"w-full h-[300px]",children:[(0,a.jsx)("div",{className:"mr-24 mb-4 mt-2",children:"Flows:"}),(0,a.jsxs)("div",{className:"flex items-center mb-6",children:[(0,a.jsx)(d.default,{onChange:e=>{u(null==s?void 0:s.find(t=>e===t.name)),l(null==s?void 0:s.find(t=>e===t.name))},value:(null==c?void 0:c.name)||(null==i?void 0:null===(t=i[0])||void 0===t?void 0:t.value),className:"w-1/4",options:i}),(0,a.jsx)(N(),{href:"/flow/canvas/",className:"ml-6",children:(0,k.t)("edit_new_applications")}),(0,a.jsx)("div",{className:"text-gray-500 ml-16",children:null==c?void 0:c.description})]}),c&&(0,a.jsx)("div",{className:"w-full h-full border-[0.5px] border-dark-gray",children:(0,a.jsx)(b.Z,{flowData:null==c?void 0:c.flow_data})})]})}let Z=[{value:"zh",label:"中文"},{value:"en",label:"英文"}];function S(e){let{handleCancel:t,open:l,updateApps:f,type:v,app:g}=e,{t:_}=(0,p.$G)(),[y,b]=(0,m.useState)(!1),[w,N]=(0,m.useState)(),[k,S]=(0,m.useState)(),[E,V]=(0,m.useState)([]),[T,A]=(0,m.useState)([]),[P,q]=(0,m.useState)([...(null==g?void 0:g.details)||[]]),[z,F]=(0,m.useState)(),[I,O]=(0,m.useState)(),[D,$]=(0,m.useState)(g.team_modal||"auto_plan"),[G]=n.Z.useForm(),H=async e=>{await (0,h.Vx)("add"===v?(0,h.L5)(e):(0,h.KT)(e)),await f()},K=async()=>{let e=g.details,[t,l]=await (0,h.Vx)((0,h.Q5)());(null==e?void 0:e.length)>0&&V(null==e?void 0:e.map(e=>({label:null==e?void 0:e.agent_name,children:(0,a.jsx)(j,{editResources:"edit"===v&&e.resources,detail:{key:null==e?void 0:e.agent_name,llm_strategy:null==e?void 0:e.llm_strategy,agent_name:null==e?void 0:e.agent_name,prompt_template:null==e?void 0:e.prompt_template,llm_strategy_value:null==e?void 0:e.llm_strategy_value},updateDetailsByAgentKey:L,resourceTypes:l}),key:null==e?void 0:e.agent_name})))},M=async()=>{let[e,t]=await (0,h.Vx)((0,h.lz)());if(!t)return null;let l=t.map(e=>({value:e,label:e}));S(l)},R=async()=>{let[e,t]=await (0,h.Vx)((0,h.j8)());if(!t)return null;A(t.map(e=>({label:e.name,key:e.name,onClick:()=>{Q(e)},agent:e})).filter(e=>{var t,l;return g.details&&(null===(t=g.details)||void 0===t?void 0:t.length)!==0?null==g?void 0:null===(l=g.details)||void 0===l?void 0:l.every(t=>t.agent_name!==e.label):e}))},B=async()=>{let[e,t]=await (0,h.Vx)((0,h.Q5)());t&&O(t)};(0,m.useEffect)(()=>{M(),R(),B()},[]),(0,m.useEffect)(()=>{"edit"===v&&K()},[I]),(0,m.useEffect)(()=>{$(g.team_mode||"auto_plan")},[g]);let L=(e,t)=>{q(l=>l.map(l=>e===(l.agent_name||l.key)?t:l))},Q=async e=>{let t=e.name,[l,n]=await (0,h.Vx)((0,h.Q5)());N(t),q(e=>[...e,{key:t,name:"",llm_strategy:"priority"}]),V(e=>[...e,{label:t,children:(0,a.jsx)(j,{detail:{key:t,llm_strategy:"default",agent_name:t,prompt_template:"",llm_strategy_value:null},updateDetailsByAgentKey:L,resourceTypes:n}),key:t}]),A(t=>t.filter(t=>t.key!==e.name))},W=e=>{let t=w,l=-1;if(!E)return null;E.forEach((t,a)=>{t.key===e&&(l=a-1)});let a=E.filter(t=>t.key!==e);a.length&&t===e&&(t=l>=0?a[l].key:a[0].key),q(t=>null==t?void 0:t.filter(t=>(t.agent_name||t.key)!==e)),V(a),N(t),A(t=>[...t,{label:e,key:e,onClick:()=>{Q({name:e,describe:"",system_message:""})}}])},X=async()=>{let e=await G.validateFields();if(!e)return;b(!0);let l={...G.getFieldsValue()};if("edit"===v&&(l.app_code=g.app_code),"awel_layout"!==l.team_mode)l.details=P;else{let e={...z};delete e.flow_data,l.team_context=e}try{await H(l)}catch(e){return}b(!1),t()};return(0,a.jsx)("div",{children:(0,a.jsx)(i.default,{okText:_("Submit"),title:"edit"===v?"edit application":"add application",open:l,width:"65%",onCancel:t,onOk:X,destroyOnClose:!0,children:(0,a.jsx)(o.Z,{spinning:y,children:(0,a.jsxs)(n.Z,{form:G,preserve:!1,size:"large",className:"mt-4 max-h-[70vh] overflow-auto h-[90vh]",layout:"horizontal",labelAlign:"left",labelCol:{span:4},initialValues:{app_name:g.app_name,app_describe:g.app_describe,language:g.language||Z[0].value,team_mode:g.team_mode||"auto_plan"},autoComplete:"off",onFinish:X,children:[(0,a.jsx)(n.Z.Item,{label:"App Name",name:"app_name",rules:[{required:!0,message:_("Please_input_the_name")}],children:(0,a.jsx)(c.default,{placeholder:_("Please_input_the_name")})}),(0,a.jsx)(n.Z.Item,{label:_("Description"),name:"app_describe",rules:[{required:!0,message:_("Please_input_the_description")}],children:(0,a.jsx)(c.default.TextArea,{rows:3,placeholder:_("Please_input_the_description")})}),(0,a.jsxs)("div",{className:"flex w-full",children:[(0,a.jsx)(n.Z.Item,{labelCol:{span:7},label:_("language"),name:"language",className:"w-1/2",rules:[{required:!0}],children:(0,a.jsx)(d.default,{className:"w-2/3 ml-4",placeholder:_("language_select_tips"),options:Z})}),(0,a.jsx)(n.Z.Item,{label:_("team_modal"),name:"team_mode",className:"w-1/2",labelCol:{span:6},rules:[{required:!0}],children:(0,a.jsx)(d.default,{defaultValue:g.team_mode||"auto_plan",className:"ml-4 w-72",onChange:e=>{$(e)},placeholder:_("Please_input_the_work_modal"),options:k})})]}),"awel_layout"!==D?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-5",children:"Agents"}),(0,a.jsx)(u.Z,{addIcon:(0,a.jsx)(s.Z,{menu:{items:T},trigger:["click"],children:(0,a.jsx)("a",{className:"h-8 flex items-center",onClick:e=>e.preventDefault(),children:(0,a.jsx)(r.Z,{children:(0,a.jsx)(x,{})})})}),type:"editable-card",onChange:e=>{N(e)},activeKey:w,onEdit:(e,t)=>{"add"===t||W(e)},items:E})]}):(0,a.jsx)(C,{onFlowsChange:e=>{F(e)},teamContext:g.team_context})]})})})})}var E=l(28058),V=l(37017),T=l(90598),A=l(11163),P=l(41468),q=l(26892);let{confirm:z}=i.default,F={en:"英文",zh:"中文"};function I(e){let{updateApps:t,app:l,handleEdit:n,isCollected:s}=e,{model:r}=(0,m.useContext)(P.p),i=(0,A.useRouter)(),[o,c]=(0,m.useState)(l.is_collected),{setAgent:d}=(0,m.useContext)(P.p),{t:u}=(0,p.$G)(),x=()=>{z({title:u("Tips"),icon:(0,a.jsx)(E.Z,{}),content:"do you want delete the application?",okText:"Yes",okType:"danger",cancelText:"No",async onOk(){await (0,h.Vx)((0,h.Nl)({app_code:l.app_code})),t(s?{is_collected:s}:void 0)}})};(0,m.useEffect)(()=>{c(l.is_collected)},[l]);let f=async()=>{let[e]=await (0,h.Vx)("true"===o?(0,h.gD)({app_code:l.app_code}):(0,h.mo)({app_code:l.app_code}));e||(t(s?{is_collected:s}:void 0),c("true"===o?"false":"true"))},g=async()=>{null==d||d(l.app_code);let[,e]=await (0,h.Vx)((0,h.sW)({chat_mode:"chat_agent"}));e&&i.push("/chat/?scene=chat_agent&id=".concat(e.conv_uid).concat(r?"&model=".concat(r):""))};return(0,a.jsx)(q.Z,{title:l.app_name,icon:"/icons/node/vis.png",iconBorder:!1,desc:l.app_describe,tags:[{text:F[l.language],color:"default"},{text:l.team_mode,color:"default"}],onClick:()=>{n(l)},operations:[{label:u("Chat"),children:(0,a.jsx)(V.Z,{}),onClick:g},{label:u("collect"),children:(0,a.jsx)(T.Z,{className:"false"===l.is_collected?"text-gray-400":"text-yellow-400"}),onClick:f},{label:u("Delete"),children:(0,a.jsx)(v.Z,{}),onClick:()=>{x()}}]})}var O=l(24969),D=l(91085);function $(){let{t:e}=(0,p.$G)(),[t,l]=(0,m.useState)(!1),[n,s]=(0,m.useState)(!1),[r,i]=(0,m.useState)("app"),[c,d]=(0,m.useState)([]),[x,v]=(0,m.useState)(),[g,_]=(0,m.useState)("add"),y=()=>{_("add"),l(!0)},j=e=>{_("edit"),v(e),l(!0)},b=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(!0);let[t,l]=await (0,h.Vx)((0,h.yk)(e));if(t){s(!1);return}l&&(d(l.app_list||[]),s(!1))};(0,m.useEffect)(()=>{b()},[]);let w=t=>{let l=t.isCollected?c.every(e=>!e.is_collected):0===c.length;return(0,a.jsxs)("div",{children:[!t.isCollected&&(0,a.jsx)(f.ZP,{onClick:y,type:"primary",className:"mb-4",icon:(0,a.jsx)(O.Z,{}),children:e("create")}),l?(0,a.jsx)(D.Z,{}):(0,a.jsx)("div",{className:" w-full flex flex-wrap pb-0 gap-4",children:c.map((e,t)=>(0,a.jsx)(I,{handleEdit:j,app:e,updateApps:b,isCollected:"collected"===r},t))})]})},N=[{key:"app",label:"App",children:w({isCollected:!1})},{key:"collected",label:"Collected",children:w({isCollected:!0})}];return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(o.Z,{spinning:n,children:(0,a.jsxs)("div",{className:"h-screen w-full p-4 md:p-6 overflow-y-auto",children:[(0,a.jsx)(u.Z,{defaultActiveKey:"app",items:N,onChange:e=>{i(e),"collected"===e?b({is_collected:!0}):b()}}),t&&(0,a.jsx)(S,{app:"edit"===g?x:{},type:g,updateApps:b,open:t,handleCancel:()=>{l(!1)}})]})})})}},67919:function(e,t,l){"use strict";l.d(t,{Rv:function(){return r},VZ:function(){return a},Wf:function(){return n},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)},n=e=>{let{nodes:t,edges:l,...a}=e,n=t.map(e=>{let{positionAbsolute:t,...l}=e;return{position_absolute:t,...l}}),s=l.map(e=>{let{sourceHandle:t,targetHandle:l,...a}=e;return{source_handle:t,target_handle:l,...a}});return{nodes:n,edges:s,...a}},s=e=>{let{nodes:t,edges:l,...a}=e,n=t.map(e=>{let{position_absolute:t,...l}=e;return{positionAbsolute:t,...l}}),s=l.map(e=>{let{source_handle:t,target_handle:l,...a}=e;return{sourceHandle:t,targetHandle:l,...a}});return{nodes:n,edges:s,...a}},r=e=>{let{nodes:t,edges:l}=e,a=[!0,t[0],""];e:for(let e=0;el.targetHandle==="".concat(t[e].id,"|inputs|").concat(r))){a=[!1,t[e],"The input ".concat(s[r].type_name," of node ").concat(n.label," is required")];break e}for(let s=0;sl.targetHandle==="".concat(t[e].id,"|parameters|").concat(s))){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(n.label," is required")];break e}}else{a=[!1,t[e],"The parameter ".concat(i.type_name," of node ").concat(n.label," is required")];break e}}}return a}}},function(e){e.O(0,[8241,7113,5503,1009,9479,4442,5813,7434,9924,7958,9774,2888,179],function(){return e(e.s=89301)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/dbgpt/app/static/_next/static/chunks/pages/index-60038165daa70046.js b/dbgpt/app/static/_next/static/chunks/pages/index-018bceca9c8a4ee9.js similarity index 100% rename from dbgpt/app/static/_next/static/chunks/pages/index-60038165daa70046.js rename to dbgpt/app/static/_next/static/chunks/pages/index-018bceca9c8a4ee9.js diff --git a/dbgpt/app/static/_next/static/chunks/webpack-6d79785e1375a57a.js b/dbgpt/app/static/_next/static/chunks/webpack-27020bb4734c8351.js similarity index 63% rename from dbgpt/app/static/_next/static/chunks/webpack-6d79785e1375a57a.js rename to dbgpt/app/static/_next/static/chunks/webpack-27020bb4734c8351.js index bc5439fa9..148a41231 100644 --- a/dbgpt/app/static/_next/static/chunks/webpack-6d79785e1375a57a.js +++ b/dbgpt/app/static/_next/static/chunks/webpack-27020bb4734c8351.js @@ -1 +1 @@ -!function(){"use strict";var e,t,n,r,o,u,c,i,a,f,d,s,l={},b={};function p(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={id:e,loaded:!1,exports:{}},r=!0;try{l[e].call(n.exports,n,n.exports,p),r=!1}finally{r&&delete b[e]}return n.loaded=!0,n.exports}p.m=l,p.amdO={},e=[],p.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var c=1/0,u=0;u=o&&Object.keys(p.O).every(function(e){return p.O[e](n[a])})?n.splice(a--,1):(i=!1,o0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u=o&&Object.keys(p.O).every(function(e){return p.O[e](n[c])})?n.splice(c--,1):(a=!1,o
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/app/index.html b/dbgpt/app/static/app/index.html index 920369138..7504f9895 100644 --- a/dbgpt/app/static/app/index.html +++ b/dbgpt/app/static/app/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/chat/index.html b/dbgpt/app/static/chat/index.html index 02d7c4801..31d7d8502 100644 --- a/dbgpt/app/static/chat/index.html +++ b/dbgpt/app/static/chat/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/database/index.html b/dbgpt/app/static/database/index.html index 7f32aacee..0428fcdde 100644 --- a/dbgpt/app/static/database/index.html +++ b/dbgpt/app/static/database/index.html @@ -1 +1 @@ -
MySQL

MySQL

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

MSSQL

MSSQL

Powerful, scalable, secure relational database system by Microsoft.

DuckDB

DuckDB

In-memory analytical database with efficient query processing.

Sqlite

Sqlite

Lightweight embedded relational database with simplicity and portability.

ClickHouse

ClickHouse

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

Oracle

Oracle

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

Access

Access

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

MongoDB

MongoDB

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

ApacheDoris

ApacheDoris

A new-generation open-source real-time data warehouse.

StarRocks

StarRocks

An Open-Source, High-Performance Analytical Database.

DB2

DB2

Scalable, secure relational database system developed by IBM.

HBase

HBase

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

Redis

Redis

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

Cassandra

Cassandra

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

Couchbase

Couchbase

High-performance NoSQL document database with distributed architecture.

PostgreSQL

PostgreSQL

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

Spark

Spark

Unified engine for large-scale data analytics.

Space

Space

knowledge analytics.

\ No newline at end of file +
MySQL

MySQL

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

MSSQL

MSSQL

Powerful, scalable, secure relational database system by Microsoft.

DuckDB

DuckDB

In-memory analytical database with efficient query processing.

Sqlite

Sqlite

Lightweight embedded relational database with simplicity and portability.

ClickHouse

ClickHouse

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

Oracle

Oracle

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

Access

Access

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

MongoDB

MongoDB

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

ApacheDoris

ApacheDoris

A new-generation open-source real-time data warehouse.

StarRocks

StarRocks

An Open-Source, High-Performance Analytical Database.

DB2

DB2

Scalable, secure relational database system developed by IBM.

HBase

HBase

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

Redis

Redis

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

Cassandra

Cassandra

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

Couchbase

Couchbase

High-performance NoSQL document database with distributed architecture.

PostgreSQL

PostgreSQL

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

Spark

Spark

Unified engine for large-scale data analytics.

Space

Space

knowledge analytics.

\ No newline at end of file diff --git a/dbgpt/app/static/flow/canvas/index.html b/dbgpt/app/static/flow/canvas/index.html index 2be6b0d48..0a95b345c 100644 --- a/dbgpt/app/static/flow/canvas/index.html +++ b/dbgpt/app/static/flow/canvas/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/flow/index.html b/dbgpt/app/static/flow/index.html index 512732c4d..5090ec4e0 100644 --- a/dbgpt/app/static/flow/index.html +++ b/dbgpt/app/static/flow/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/index.html b/dbgpt/app/static/index.html index 431f1b372..5f002b342 100644 --- a/dbgpt/app/static/index.html +++ b/dbgpt/app/static/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/knowledge/chunk/index.html b/dbgpt/app/static/knowledge/chunk/index.html index f29056fb3..6e3557fad 100644 --- a/dbgpt/app/static/knowledge/chunk/index.html +++ b/dbgpt/app/static/knowledge/chunk/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/knowledge/index.html b/dbgpt/app/static/knowledge/index.html index e9ea4dbb0..1da102bd5 100644 --- a/dbgpt/app/static/knowledge/index.html +++ b/dbgpt/app/static/knowledge/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/models/index.html b/dbgpt/app/static/models/index.html index e908354ce..ec63873fc 100644 --- a/dbgpt/app/static/models/index.html +++ b/dbgpt/app/static/models/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/prompt/index.html b/dbgpt/app/static/prompt/index.html index e4b18d027..886d6f13b 100644 --- a/dbgpt/app/static/prompt/index.html +++ b/dbgpt/app/static/prompt/index.html @@ -1 +1 @@ -
NameSceneSub SceneContentOperation
No data
\ No newline at end of file +
NameSceneSub SceneContentOperation
No data
\ No newline at end of file diff --git a/web/client/api/request.ts b/web/client/api/request.ts index f49a7fb01..006069190 100644 --- a/web/client/api/request.ts +++ b/web/client/api/request.ts @@ -33,7 +33,7 @@ import { } from '@/types/knowledge'; import { UpdatePromptParams, IPrompt, PromptParams } from '@/types/prompt'; import { IFlow, IFlowNode, IFlowResponse, IFlowUpdateParam } from '@/types/flow'; -import { IAgent, IApp, ITeamModal } from '@/types/app'; +import { IAgent, IApp, IAppData, ITeamModal } from '@/types/app'; /** App */ export const postScenes = () => { @@ -283,7 +283,7 @@ export const addApp = (data: IApp) => { }; export const getAppList = (data: Record) => { - return POST, IApp[]>('/api/v1/app/list', data); + return POST, IAppData>('/api/v1/app/list', data); }; export const collectApp = (data: Record) => { diff --git a/web/pages/app/index.tsx b/web/pages/app/index.tsx index 2a02ae38c..a6a6b6d28 100644 --- a/web/pages/app/index.tsx +++ b/web/pages/app/index.tsx @@ -55,7 +55,7 @@ export default function App() { } if (!data) return; - setApps(data || []); + setApps(data.app_list || []); setSpinning(false); }; diff --git a/web/types/app.ts b/web/types/app.ts index fbf55a1bb..bd0b38d87 100644 --- a/web/types/app.ts +++ b/web/types/app.ts @@ -31,6 +31,13 @@ export type IApp = { is_collected: string; }; +export type IAppData = { + app_list: IApp[]; + current_page: number; + total_count: number; + total_page: number; +}; + // agent export type AgentParams = { agent_name: string; From a8c3fdc65f30bd4cf74e1119b0855d0abcafa214 Mon Sep 17 00:00:00 2001 From: xuyuan23 <643854343@qq.com> Date: Tue, 20 Feb 2024 16:02:19 +0800 Subject: [PATCH 3/5] feat: Apply paging queries to increase the total number of queries Apply paging queries to increase the total number of queries --- dbgpt/serve/agent/agents/controller.py | 2 +- dbgpt/serve/agent/db/gpts_app.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dbgpt/serve/agent/agents/controller.py b/dbgpt/serve/agent/agents/controller.py index a9ff6ea03..7f15d869b 100644 --- a/dbgpt/serve/agent/agents/controller.py +++ b/dbgpt/serve/agent/agents/controller.py @@ -90,7 +90,7 @@ def gpts_create(self, entity: GptsInstanceEntity): def get_dbgpts(self, user_code: str = None, sys_code: str = None): apps = self.gpts_app.app_list( GptsAppQuery(user_code=user_code, sys_code=sys_code) - ) + ).app_list return apps async def agent_chat( diff --git a/dbgpt/serve/agent/db/gpts_app.py b/dbgpt/serve/agent/db/gpts_app.py index 555435939..3b94c5f8c 100644 --- a/dbgpt/serve/agent/db/gpts_app.py +++ b/dbgpt/serve/agent/db/gpts_app.py @@ -137,6 +137,13 @@ class GptsAppQuery(GptsApp): is_collected: Optional[str] = None +class GptsAppResponse(BaseModel): + total_count: Optional[int] = 0 + total_page: Optional[int] = 0 + current_page: Optional[int] = 0 + app_list: Optional[List[GptsApp]] = [] + + class GptsAppCollection(BaseModel): app_code: Optional[str] = None user_code: Optional[str] = None @@ -341,6 +348,7 @@ def app_list(self, query: GptsAppQuery): app_qry = app_qry.filter(GptsAppEntity.sys_code == query.sys_code) if query.is_collected and query.is_collected.lower() in ("true", "false"): app_qry = app_qry.filter(GptsAppEntity.app_code.in_(app_codes)) + total_count = app_qry.count() app_qry = app_qry.order_by(GptsAppEntity.id.desc()) app_qry = app_qry.offset((query.page_no - 1) * query.page_size).limit( query.page_size @@ -350,6 +358,7 @@ def app_list(self, query: GptsAppQuery): result_app_codes = [res.app_code for res in results] app_details_group = self._group_app_details(result_app_codes, session) apps = [] + app_resp = GptsAppResponse() for app_info in results: app_details = app_details_group.get(app_info.app_code, []) @@ -378,7 +387,11 @@ def app_list(self, query: GptsAppQuery): } ) ) - return apps + app_resp.total_count = total_count + app_resp.app_list = apps + app_resp.current_page = query.page_no + app_resp.total_page = (total_count + query.page_size - 1) // query.page_size + return app_resp def _group_app_details(self, app_codes, session): app_detail_qry = session.query(GptsAppDetailEntity).filter( From 966a8b8f8a3d274522d900cf5f48bcc9414f935b Mon Sep 17 00:00:00 2001 From: xuyuan23 <643854343@qq.com> Date: Wed, 21 Feb 2024 17:54:48 +0800 Subject: [PATCH 4/5] fix: fix llm strategy store exception, use json format. fix llm strategy store exception, use json format. --- dbgpt/serve/agent/app/controller.py | 2 +- dbgpt/serve/agent/db/gpts_app.py | 31 ++++++++++++++++++----------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/dbgpt/serve/agent/app/controller.py b/dbgpt/serve/agent/app/controller.py index 5305c8632..6dc829802 100644 --- a/dbgpt/serve/agent/app/controller.py +++ b/dbgpt/serve/agent/app/controller.py @@ -39,7 +39,7 @@ async def create(gpts_app: GptsApp): @router.post("/v1/app/list") async def app_list(query: GptsAppQuery): try: - return Result.succ(gpts_dao.app_list(query)) + return Result.succ(gpts_dao.app_list(query, True)) except Exception as ex: return Result.failed(code="E000X", msg=f"query app error: {ex}") diff --git a/dbgpt/serve/agent/db/gpts_app.py b/dbgpt/serve/agent/db/gpts_app.py index 3b94c5f8c..fd0b27081 100644 --- a/dbgpt/serve/agent/db/gpts_app.py +++ b/dbgpt/serve/agent/db/gpts_app.py @@ -47,7 +47,14 @@ def _serialize(self, value): return value @classmethod - def from_dict(cls, d: Dict[str, Any]): + def from_dict(cls, d: Dict[str, Any], parse_llm_strategy: bool = False): + lsv = d.get("llm_strategy_value") + if parse_llm_strategy and lsv: + strategies = json.loads(lsv) + llm_strategy_value = ",".join(strategies) + else: + llm_strategy_value = d.get("llm_strategy_value", None) + return cls( app_code=d["app_code"], app_name=d["app_name"], @@ -56,9 +63,7 @@ def from_dict(cls, d: Dict[str, Any]): resources=AgentResource.from_josn_list_str(d.get("resources", None)), prompt_template=d.get("prompt_template", None), llm_strategy=d.get("llm_strategy", None), - llm_strategy_value=",".join(json.loads(d.get("llm_strategy_value"))) - if d.get("llm_strategy_value") - else None, + llm_strategy_value=llm_strategy_value, created_at=d.get("created_at", None), updated_at=d.get("updated_at", None), ) @@ -327,7 +332,7 @@ def list(self, query: GptsAppCollection): class GptsAppDao(BaseDao): - def app_list(self, query: GptsAppQuery): + def app_list(self, query: GptsAppQuery, parse_llm_strategy: bool = False): collection_dao = GptsAppCollectionDao() gpts_collections = collection_dao.list( GptsAppCollection.from_dict( @@ -381,7 +386,9 @@ def app_list(self, query: GptsAppQuery): "created_at": app_info.created_at, "updated_at": app_info.updated_at, "details": [ - GptsAppDetail.from_dict(item.to_dict()) + GptsAppDetail.from_dict( + item.to_dict(), parse_llm_strategy + ) for item in app_details ], } @@ -498,9 +505,9 @@ def create(self, gpts_app: GptsApp): resources=json.dumps(resource_dicts, ensure_ascii=False), prompt_template=item.prompt_template, llm_strategy=item.llm_strategy, - llm_strategy_value=json.dumps( - tuple(item.llm_strategy_value.split(",")) - ), + llm_strategy_value=None + if item.llm_strategy_value is None + else json.dumps(tuple(item.llm_strategy_value.split(","))), created_at=item.created_at, updated_at=item.updated_at, ) @@ -542,9 +549,9 @@ def edit(self, gpts_app: GptsApp): resources=json.dumps(resource_dicts, ensure_ascii=False), prompt_template=item.prompt_template, llm_strategy=item.llm_strategy, - llm_strategy_value=json.dumps( - tuple(item.llm_strategy_value.split(",")) - ), + llm_strategy_value=None + if item.llm_strategy_value is None + else json.dumps(tuple(item.llm_strategy_value.split(","))), created_at=item.created_at, updated_at=item.updated_at, ) From 37b6671f4042fbb707af94e96e2a7d53bca42126 Mon Sep 17 00:00:00 2001 From: lcxadml <864255598@qq.com> Date: Thu, 22 Feb 2024 10:09:21 +0800 Subject: [PATCH 5/5] feat: build --- dbgpt/app/static/404.html | 2 +- dbgpt/app/static/404/index.html | 2 +- .../{_app-bd401791059b31a0.js => _app-4fa488d6595180a9.js} | 0 .../{index-018bceca9c8a4ee9.js => index-60038165daa70046.js} | 0 ...{webpack-27020bb4734c8351.js => webpack-6d79785e1375a57a.js} | 2 +- .../_buildManifest.js | 2 +- .../_ssgManifest.js | 0 dbgpt/app/static/agent/index.html | 2 +- dbgpt/app/static/app/index.html | 2 +- dbgpt/app/static/chat/index.html | 2 +- dbgpt/app/static/database/index.html | 2 +- dbgpt/app/static/flow/canvas/index.html | 2 +- dbgpt/app/static/flow/index.html | 2 +- dbgpt/app/static/index.html | 2 +- dbgpt/app/static/knowledge/chunk/index.html | 2 +- dbgpt/app/static/knowledge/index.html | 2 +- dbgpt/app/static/models/index.html | 2 +- dbgpt/app/static/prompt/index.html | 2 +- 18 files changed, 15 insertions(+), 15 deletions(-) rename dbgpt/app/static/_next/static/chunks/pages/{_app-bd401791059b31a0.js => _app-4fa488d6595180a9.js} (100%) rename dbgpt/app/static/_next/static/chunks/pages/{index-018bceca9c8a4ee9.js => index-60038165daa70046.js} (100%) rename dbgpt/app/static/_next/static/chunks/{webpack-27020bb4734c8351.js => webpack-6d79785e1375a57a.js} (63%) rename dbgpt/app/static/_next/static/{BuUzYaVTDY39gaUO-byZc => keL3nrqI52pfjfXF2S3Vv}/_buildManifest.js (97%) rename dbgpt/app/static/_next/static/{BuUzYaVTDY39gaUO-byZc => keL3nrqI52pfjfXF2S3Vv}/_ssgManifest.js (100%) diff --git a/dbgpt/app/static/404.html b/dbgpt/app/static/404.html index 4b1c36d33..1762a9be4 100644 --- a/dbgpt/app/static/404.html +++ b/dbgpt/app/static/404.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

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

404

This page could not be found.

\ No newline at end of file diff --git a/dbgpt/app/static/404/index.html b/dbgpt/app/static/404/index.html index 4b1c36d33..1762a9be4 100644 --- a/dbgpt/app/static/404/index.html +++ b/dbgpt/app/static/404/index.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

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

404

This page could not be found.

\ No newline at end of file diff --git a/dbgpt/app/static/_next/static/chunks/pages/_app-bd401791059b31a0.js b/dbgpt/app/static/_next/static/chunks/pages/_app-4fa488d6595180a9.js similarity index 100% rename from dbgpt/app/static/_next/static/chunks/pages/_app-bd401791059b31a0.js rename to dbgpt/app/static/_next/static/chunks/pages/_app-4fa488d6595180a9.js diff --git a/dbgpt/app/static/_next/static/chunks/pages/index-018bceca9c8a4ee9.js b/dbgpt/app/static/_next/static/chunks/pages/index-60038165daa70046.js similarity index 100% rename from dbgpt/app/static/_next/static/chunks/pages/index-018bceca9c8a4ee9.js rename to dbgpt/app/static/_next/static/chunks/pages/index-60038165daa70046.js diff --git a/dbgpt/app/static/_next/static/chunks/webpack-27020bb4734c8351.js b/dbgpt/app/static/_next/static/chunks/webpack-6d79785e1375a57a.js similarity index 63% rename from dbgpt/app/static/_next/static/chunks/webpack-27020bb4734c8351.js rename to dbgpt/app/static/_next/static/chunks/webpack-6d79785e1375a57a.js index 148a41231..bc5439fa9 100644 --- a/dbgpt/app/static/_next/static/chunks/webpack-27020bb4734c8351.js +++ b/dbgpt/app/static/_next/static/chunks/webpack-6d79785e1375a57a.js @@ -1 +1 @@ -!function(){"use strict";var e,t,n,r,o,u,i,a,c,f,d,s,l={},b={};function p(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={id:e,loaded:!1,exports:{}},r=!0;try{l[e].call(n.exports,n,n.exports,p),r=!1}finally{r&&delete b[e]}return n.loaded=!0,n.exports}p.m=l,p.amdO={},e=[],p.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u=o&&Object.keys(p.O).every(function(e){return p.O[e](n[c])})?n.splice(c--,1):(a=!1,o0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var c=1/0,u=0;u=o&&Object.keys(p.O).every(function(e){return p.O[e](n[a])})?n.splice(a--,1):(i=!1,o
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/app/index.html b/dbgpt/app/static/app/index.html index 7504f9895..915409737 100644 --- a/dbgpt/app/static/app/index.html +++ b/dbgpt/app/static/app/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/chat/index.html b/dbgpt/app/static/chat/index.html index 31d7d8502..9865b5964 100644 --- a/dbgpt/app/static/chat/index.html +++ b/dbgpt/app/static/chat/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/database/index.html b/dbgpt/app/static/database/index.html index 0428fcdde..929990b2f 100644 --- a/dbgpt/app/static/database/index.html +++ b/dbgpt/app/static/database/index.html @@ -1 +1 @@ -
MySQL

MySQL

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

MSSQL

MSSQL

Powerful, scalable, secure relational database system by Microsoft.

DuckDB

DuckDB

In-memory analytical database with efficient query processing.

Sqlite

Sqlite

Lightweight embedded relational database with simplicity and portability.

ClickHouse

ClickHouse

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

Oracle

Oracle

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

Access

Access

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

MongoDB

MongoDB

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

ApacheDoris

ApacheDoris

A new-generation open-source real-time data warehouse.

StarRocks

StarRocks

An Open-Source, High-Performance Analytical Database.

DB2

DB2

Scalable, secure relational database system developed by IBM.

HBase

HBase

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

Redis

Redis

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

Cassandra

Cassandra

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

Couchbase

Couchbase

High-performance NoSQL document database with distributed architecture.

PostgreSQL

PostgreSQL

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

Spark

Spark

Unified engine for large-scale data analytics.

Space

Space

knowledge analytics.

\ No newline at end of file +
MySQL

MySQL

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

MSSQL

MSSQL

Powerful, scalable, secure relational database system by Microsoft.

DuckDB

DuckDB

In-memory analytical database with efficient query processing.

Sqlite

Sqlite

Lightweight embedded relational database with simplicity and portability.

ClickHouse

ClickHouse

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

Oracle

Oracle

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

Access

Access

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

MongoDB

MongoDB

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

ApacheDoris

ApacheDoris

A new-generation open-source real-time data warehouse.

StarRocks

StarRocks

An Open-Source, High-Performance Analytical Database.

DB2

DB2

Scalable, secure relational database system developed by IBM.

HBase

HBase

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

Redis

Redis

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

Cassandra

Cassandra

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

Couchbase

Couchbase

High-performance NoSQL document database with distributed architecture.

PostgreSQL

PostgreSQL

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

Spark

Spark

Unified engine for large-scale data analytics.

Space

Space

knowledge analytics.

\ No newline at end of file diff --git a/dbgpt/app/static/flow/canvas/index.html b/dbgpt/app/static/flow/canvas/index.html index 0a95b345c..44b792a65 100644 --- a/dbgpt/app/static/flow/canvas/index.html +++ b/dbgpt/app/static/flow/canvas/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/flow/index.html b/dbgpt/app/static/flow/index.html index 5090ec4e0..972ff5fc6 100644 --- a/dbgpt/app/static/flow/index.html +++ b/dbgpt/app/static/flow/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/index.html b/dbgpt/app/static/index.html index 5f002b342..8afb0d3bd 100644 --- a/dbgpt/app/static/index.html +++ b/dbgpt/app/static/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/knowledge/chunk/index.html b/dbgpt/app/static/knowledge/chunk/index.html index 6e3557fad..16d5b2603 100644 --- a/dbgpt/app/static/knowledge/chunk/index.html +++ b/dbgpt/app/static/knowledge/chunk/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/knowledge/index.html b/dbgpt/app/static/knowledge/index.html index 1da102bd5..62bbe43b1 100644 --- a/dbgpt/app/static/knowledge/index.html +++ b/dbgpt/app/static/knowledge/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/models/index.html b/dbgpt/app/static/models/index.html index ec63873fc..dca062d06 100644 --- a/dbgpt/app/static/models/index.html +++ b/dbgpt/app/static/models/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/dbgpt/app/static/prompt/index.html b/dbgpt/app/static/prompt/index.html index 886d6f13b..7c3b8df5e 100644 --- a/dbgpt/app/static/prompt/index.html +++ b/dbgpt/app/static/prompt/index.html @@ -1 +1 @@ -
NameSceneSub SceneContentOperation
No data
\ No newline at end of file +
NameSceneSub SceneContentOperation
No data
\ No newline at end of file