From 845f4d41c200b2613d4e0b674de809f228db4ae4 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Fri, 1 Aug 2025 23:44:18 +0800 Subject: [PATCH] fix: tool not clone (#5364) * fix: tool not clone * perf: check invalid db tool --- packages/service/core/app/plugin/controller.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/service/core/app/plugin/controller.ts b/packages/service/core/app/plugin/controller.ts index 77b258780..09ada54bf 100644 --- a/packages/service/core/app/plugin/controller.ts +++ b/packages/service/core/app/plugin/controller.ts @@ -41,11 +41,11 @@ import type { } from '@fastgpt/global/core/workflow/type/io'; import { isProduction } from '@fastgpt/global/common/system/constants'; import { Output_Template_Error_Message } from '@fastgpt/global/core/workflow/template/output'; -import type { RuntimeNodeItemType } from '@fastgpt/global/core/workflow/runtime/type'; import { splitCombinePluginId } from '@fastgpt/global/core/app/plugin/utils'; import { getMCPToolRuntimeNode } from '@fastgpt/global/core/app/mcpTools/utils'; import { AppTypeEnum } from '@fastgpt/global/core/app/constants'; import { getMCPChildren } from '../mcp'; +import { cloneDeep } from 'lodash'; type ChildAppType = SystemPluginTemplateItemType & { teamId?: string; @@ -562,8 +562,9 @@ export const getSystemTools = async (): Promise }; }); + // TODO: Check the app exists const dbPlugins = systemPluginsArray - .filter((item) => item.customConfig) + .filter((item) => item.customConfig?.associatedPluginId) .map((item) => dbPluginFormat(item)); const plugins = [...formatTools, ...dbPlugins]; @@ -584,7 +585,7 @@ export const getSystemToolById = async (id: string): Promise item.id === pluginId); if (tool) { - return tool; + return cloneDeep(tool); } return Promise.reject(PluginErrEnum.unExist); }