From 09fc4bba6170faf0fb7402a900cb69d4a7e51fff Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Thu, 20 Feb 2025 17:20:23 +0800 Subject: [PATCH] fix: agent tools setting (#14097) --- .../app/configuration/config/agent/agent-tools/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx index e4a0e9737f..323fc9729a 100644 --- a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx +++ b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx @@ -26,12 +26,12 @@ import { MAX_TOOLS_NUM } from '@/config' import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback' import Tooltip from '@/app/components/base/tooltip' import { DefaultToolIcon } from '@/app/components/base/icons/src/public/other' -// import AddToolModal from '@/app/components/tools/add-tool-modal' import ConfigCredential from '@/app/components/tools/setting/build-in/config-credentials' import { updateBuiltInToolCredential } from '@/service/tools' import cn from '@/utils/classnames' import ToolPicker from '@/app/components/workflow/block-selector/tool-picker' import type { ToolDefaultValue } from '@/app/components/workflow/block-selector/types' +import { canFindTool } from '@/utils' type AgentToolWithMoreInfo = AgentTool & { icon: any; collection?: Collection } | null const AgentTools: FC = () => { @@ -43,7 +43,7 @@ const AgentTools: FC = () => { const [currentTool, setCurrentTool] = useState(null) const currentCollection = useMemo(() => { if (!currentTool) return null - const collection = collectionList.find(collection => collection.id.split('/').pop() === currentTool?.provider_id.split('/').pop() && collection.type === currentTool?.provider_type) + const collection = collectionList.find(collection => canFindTool(collection.id, currentTool?.provider_id) && collection.type === currentTool?.provider_type) return collection }, [currentTool, collectionList]) const [isShowSettingTool, setIsShowSettingTool] = useState(false) @@ -51,7 +51,7 @@ const AgentTools: FC = () => { const tools = (modelConfig?.agentConfig?.tools as AgentTool[] || []).map((item) => { const collection = collectionList.find( collection => - collection.id.split('/').pop() === item.provider_id.split('/').pop() + canFindTool(collection.id, item.provider_id) && collection.type === item.provider_type, ) const icon = collection?.icon