From a838a5862b4ed8ecaa708739dd2b00254b911539 Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Tue, 11 Nov 2025 15:56:26 +0800 Subject: [PATCH] fix: agent show --- projects/app/src/pageComponents/app/constants.ts | 8 ++++++++ .../app/src/pageComponents/dashboard/agent/TypeTag.tsx | 5 ++--- .../app/src/pageComponents/dashboard/agent/context.tsx | 2 +- projects/app/src/pages/dashboard/create/index.tsx | 1 + projects/app/src/web/core/app/templates.ts | 8 ++++++++ 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/projects/app/src/pageComponents/app/constants.ts b/projects/app/src/pageComponents/app/constants.ts index ddaf2341a..9bd1a11eb 100644 --- a/projects/app/src/pageComponents/app/constants.ts +++ b/projects/app/src/pageComponents/app/constants.ts @@ -2,6 +2,14 @@ import { AppTypeEnum } from '@fastgpt/global/core/app/constants'; import { i18nT } from '@fastgpt/web/i18n/utils'; export const createAppTypeMap = { + [AppTypeEnum.agent]: { + type: AppTypeEnum.agent, + icon: 'core/app/type/workflowFill', + title: 'Agent', + intro: 'Agent', + description: 'Agent', + imgUrl: '/imgs/app/workflowPreview.svg' + }, [AppTypeEnum.workflow]: { type: AppTypeEnum.workflow, icon: 'core/app/type/workflowFill', diff --git a/projects/app/src/pageComponents/dashboard/agent/TypeTag.tsx b/projects/app/src/pageComponents/dashboard/agent/TypeTag.tsx index a4879a137..d6216374a 100644 --- a/projects/app/src/pageComponents/dashboard/agent/TypeTag.tsx +++ b/projects/app/src/pageComponents/dashboard/agent/TypeTag.tsx @@ -40,12 +40,11 @@ const AppTypeTag = ({ type }: { type: AppTypeEnum }) => { }, [AppTypeEnum.tool]: undefined, [AppTypeEnum.folder]: undefined, - [AppTypeEnum.hidden]: undefined, - [AppTypeEnum.agent]: undefined + [AppTypeEnum.hidden]: undefined }); const data = map.current[type as keyof typeof map.current]; - + console.log(type, data); return data ? ( { const isAgent = router.pathname.includes('/agent'); const formatType = isAgent ? !type || type === 'all' - ? [AppTypeEnum.folder, AppTypeEnum.simple, AppTypeEnum.workflow] + ? [AppTypeEnum.folder, AppTypeEnum.simple, AppTypeEnum.workflow, AppTypeEnum.agent] : [AppTypeEnum.folder, type] : !type || type === 'all' ? [ diff --git a/projects/app/src/pages/dashboard/create/index.tsx b/projects/app/src/pages/dashboard/create/index.tsx index cb97b8b3c..681063bfc 100644 --- a/projects/app/src/pages/dashboard/create/index.tsx +++ b/projects/app/src/pages/dashboard/create/index.tsx @@ -57,6 +57,7 @@ type FormType = { }; export type CreateAppType = + | AppTypeEnum.agent | AppTypeEnum.simple | AppTypeEnum.workflow | AppTypeEnum.workflowTool diff --git a/projects/app/src/web/core/app/templates.ts b/projects/app/src/web/core/app/templates.ts index 3ee67380a..dba1cc14e 100644 --- a/projects/app/src/web/core/app/templates.ts +++ b/projects/app/src/web/core/app/templates.ts @@ -13,7 +13,15 @@ import { } from '@fastgpt/global/core/workflow/type/io'; import { i18nT } from '@fastgpt/web/i18n/utils'; +// TODO: 需要做一个类型强制约束 export const emptyTemplates = { + [AppTypeEnum.agent]: { + avatar: 'core/app/type/simpleFill', + name: 'Agent', + nodes: [], + edges: [], + chatConfig: {} + }, [AppTypeEnum.simple]: { avatar: 'core/app/type/simpleFill', name: i18nT('app:template.simple_robot'),