diff --git a/packages/components/nodes/agentflow/Tool/Tool.ts b/packages/components/nodes/agentflow/Tool/Tool.ts index c37b1e01a..d8365b11c 100644 --- a/packages/components/nodes/agentflow/Tool/Tool.ts +++ b/packages/components/nodes/agentflow/Tool/Tool.ts @@ -187,7 +187,10 @@ class Tool_Agentflow implements INode { async run(nodeData: INodeData, input: string, options: ICommonObject): Promise { const selectedTool = (nodeData.inputs?.selectedTool as string) || (nodeData.inputs?.toolAgentflowSelectedTool as string) - const selectedToolConfig = nodeData.inputs?.selectedToolConfig as ICommonObject + const selectedToolConfig = + (nodeData?.inputs?.selectedToolConfig as ICommonObject) || + (nodeData?.inputs?.toolAgentflowSelectedToolConfig as ICommonObject) || + {} const toolInputArgs = nodeData.inputs?.toolInputArgs as IToolInputArgs[] const _toolUpdateState = nodeData.inputs?.toolUpdateState diff --git a/packages/ui/src/views/agentflowsv2/AgentFlowNode.jsx b/packages/ui/src/views/agentflowsv2/AgentFlowNode.jsx index d52639d42..a5d3fbbdd 100644 --- a/packages/ui/src/views/agentflowsv2/AgentFlowNode.jsx +++ b/packages/ui/src/views/agentflowsv2/AgentFlowNode.jsx @@ -401,8 +401,11 @@ const AgentFlowNode = ({ data }) => { { tools: data.inputs?.llmTools, toolProperty: 'llmSelectedTool' }, { tools: data.inputs?.agentTools, toolProperty: 'agentSelectedTool' }, { - tools: data.inputs?.selectedTool ? [{ selectedTool: data.inputs?.selectedTool }] : [], - toolProperty: 'selectedTool' + tools: + data.inputs?.selectedTool ?? data.inputs?.toolAgentflowSelectedTool + ? [{ selectedTool: data.inputs?.selectedTool ?? data.inputs?.toolAgentflowSelectedTool }] + : [], + toolProperty: ['selectedTool', 'toolAgentflowSelectedTool'] }, { tools: data.inputs?.agentKnowledgeVSEmbeddings, toolProperty: ['vectorStore', 'embeddingModel'] } ]