From a3d18d43ed18cd179353b69ec2cf6ffc588dd64a Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Mon, 10 Mar 2025 11:21:46 +0800 Subject: [PATCH] fix: tool name in agent (#15344) --- web/app/components/app/configuration/index.tsx | 7 ++++--- web/utils/index.ts | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index 87f71f54a0..502f6a8344 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -625,13 +625,14 @@ const Configuration: FC = () => { tools: modelConfig.agent_mode?.tools.filter((tool: any) => { return !tool.dataset }).map((tool: any) => { + const toolInCollectionList = collectionList.find(c => tool.provider_id === c.id) return { ...tool, isDeleted: res.deleted_tools?.some((deletedTool: any) => deletedTool.id === tool.id && deletedTool.tool_name === tool.tool_name), - notAuthor: collectionList.find(c => tool.provider_id === c.id)?.is_team_authorization === false, + notAuthor: toolInCollectionList?.is_team_authorization === false, ...(tool.provider_type === 'builtin' ? { - provider_id: correctToolProvider(tool.provider_name), - provider_name: correctToolProvider(tool.provider_name), + provider_id: correctToolProvider(tool.provider_name, !!toolInCollectionList), + provider_name: correctToolProvider(tool.provider_name, !!toolInCollectionList), } : {}), } }), diff --git a/web/utils/index.ts b/web/utils/index.ts index 9285d0bd03..4a0adce113 100644 --- a/web/utils/index.ts +++ b/web/utils/index.ts @@ -69,10 +69,13 @@ export const correctModelProvider = (provider: string) => { return `langgenius/${provider}/${provider}` } -export const correctToolProvider = (provider: string) => { +export const correctToolProvider = (provider: string, toolInCollectionList?: boolean) => { if (!provider) return '' + if (toolInCollectionList) + return provider + if (provider.includes('/')) return provider