fix: tool id (#13932)

This commit is contained in:
zxhlyh 2025-02-18 18:17:41 +08:00 • committed by GitHub
commit 3460c1dfbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 53 additions and 25 deletions

View file

@ -26,6 +26,7 @@ import { CollectionType } from '@/app/components/tools/types'
import { useGetLanguage } from '@/context/i18n'
import type { AgentNodeType } from '../nodes/agent/types'
import { useStrategyProviders } from '@/service/use-strategy'
import { canFindTool } from '@/utils'
export const useChecklist = (nodes: Node[], edges: Edge[]) => {
const { t } = useTranslation()
@ -51,7 +52,7 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {
moreDataForCheckValid = getToolCheckParams(node.data as ToolNodeType, buildInTools, customTools, workflowTools, language)
if (provider_type === CollectionType.builtIn)
toolIcon = buildInTools.find(tool => tool.id === node.data.provider_id)?.icon
toolIcon = buildInTools.find(tool => canFindTool(tool.id, node.data.provider_id || ''))?.icon
if (provider_type === CollectionType.custom)
toolIcon = customTools.find(tool => tool.id === node.data.provider_id)?.icon

View file

@ -58,6 +58,7 @@ import I18n from '@/context/i18n'
import { CollectionType } from '@/app/components/tools/types'
import { CUSTOM_ITERATION_START_NODE } from '@/app/components/workflow/nodes/iteration-start/constants'
import { useWorkflowConfig } from '@/service/use-workflow'
import { canFindTool } from '@/utils'
export const useIsChatMode = () => {
const appDetail = useAppStore(s => s.appDetail)
@ -608,11 +609,7 @@ export const useToolIcon = (data: Node['data']) => {
targetTools = customTools
else
targetTools = workflowTools
return targetTools.find((toolWithProvider) => {
return toolWithProvider.id === data.provider_id
|| toolWithProvider.id === `langgenius/${data.provider_id}/${data.provider_id}`
|| toolWithProvider.id === `langgenius/${data.provider_id}_tool/${data.provider_id}`
})?.icon
return targetTools.find(toolWithProvider => canFindTool(toolWithProvider.id, data.provider_id))?.icon
}
}, [data, buildInTools, customTools, workflowTools])