feat: add tool requirements to flow

This commit is contained in:
Joel 2025-10-24 17:49:29 +08:00
parent c264d9152f
commit 0a7b59f500
1 changed files with 11 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import type { LLMNodeType } from '@/app/components/workflow/nodes/llm/types'
import type { ToolNodeType } from '@/app/components/workflow/nodes/tool/types'
import { BlockEnum } from '@/app/components/workflow/types'
import { MARKETPLACE_API_PREFIX } from '@/config'
import type { TryAppInfo } from '@/service/try-app'
@ -55,6 +56,16 @@ const useGetRequirements = ({ appDetail, appId }: Params) => {
iconUrl: getIconUrl(modelProviderAndName[0], modelProviderAndName[1]),
}
}))
const toolNodes = nodes.filter(node => node.data.type === BlockEnum.Tool)
requirements.push(...toolNodes.map((node) => {
const data = node.data as ToolNodeType
const toolProviderAndName = data.provider_id.split('/')
return {
name: data.tool_label,
iconUrl: getIconUrl(toolProviderAndName[0], toolProviderAndName[1]),
}
}))
}
const uniqueRequirements = uniqBy(requirements, 'name')