fix custom tool not selected

This commit is contained in:
Henry 2025-05-31 16:58:40 +01:00
parent 633f330c49
commit d68fe04d5e
2 changed files with 12 additions and 12 deletions

View File

@ -28,7 +28,7 @@ class Tool_Agentflow implements INode {
constructor() { constructor() {
this.label = 'Tool' this.label = 'Tool'
this.name = 'toolAgentflow' this.name = 'toolAgentflow'
this.version = 1.0 this.version = 1.1
this.type = 'Tool' this.type = 'Tool'
this.category = 'Agent Flows' this.category = 'Agent Flows'
this.description = 'Tools allow LLM to interact with external systems' this.description = 'Tools allow LLM to interact with external systems'
@ -37,7 +37,7 @@ class Tool_Agentflow implements INode {
this.inputs = [ this.inputs = [
{ {
label: 'Tool', label: 'Tool',
name: 'selectedTool', name: 'toolAgentflowSelectedTool',
type: 'asyncOptions', type: 'asyncOptions',
loadMethod: 'listTools', loadMethod: 'listTools',
loadConfig: true loadConfig: true
@ -64,7 +64,7 @@ class Tool_Agentflow implements INode {
} }
], ],
show: { show: {
selectedTool: '.+' toolAgentflowSelectedTool: '.+'
} }
}, },
{ {
@ -124,7 +124,7 @@ class Tool_Agentflow implements INode {
}, },
async listToolInputArgs(nodeData: INodeData, options: ICommonObject): Promise<INodeOptionsValue[]> { async listToolInputArgs(nodeData: INodeData, options: ICommonObject): Promise<INodeOptionsValue[]> {
const currentNode = options.currentNode as ICommonObject const currentNode = options.currentNode as ICommonObject
const selectedTool = currentNode?.inputs?.selectedTool as string const selectedTool = (currentNode?.inputs?.selectedTool as string) || (currentNode?.inputs?.toolAgentflowSelectedTool as string)
const selectedToolConfig = currentNode?.inputs?.selectedToolConfig as ICommonObject const selectedToolConfig = currentNode?.inputs?.selectedToolConfig as ICommonObject
const nodeInstanceFilePath = options.componentNodes[selectedTool].filePath as string const nodeInstanceFilePath = options.componentNodes[selectedTool].filePath as string
@ -183,7 +183,7 @@ class Tool_Agentflow implements INode {
} }
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<any> { async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<any> {
const selectedTool = nodeData.inputs?.selectedTool as string 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
const toolInputArgs = nodeData.inputs?.toolInputArgs as IToolInputArgs[] const toolInputArgs = nodeData.inputs?.toolInputArgs as IToolInputArgs[]

View File

@ -526,7 +526,7 @@
"data": { "data": {
"id": "toolAgentflow_0", "id": "toolAgentflow_0",
"label": "Slack Reply", "label": "Slack Reply",
"version": 1, "version": 1.1,
"name": "toolAgentflow", "name": "toolAgentflow",
"type": "Tool", "type": "Tool",
"color": "#d4a373", "color": "#d4a373",
@ -536,11 +536,11 @@
"inputParams": [ "inputParams": [
{ {
"label": "Tool", "label": "Tool",
"name": "selectedTool", "name": "toolAgentflowSelectedTool",
"type": "asyncOptions", "type": "asyncOptions",
"loadMethod": "listTools", "loadMethod": "listTools",
"loadConfig": true, "loadConfig": true,
"id": "toolAgentflow_0-input-selectedTool-asyncOptions", "id": "toolAgentflow_0-input-toolAgentflowSelectedTool-asyncOptions",
"display": true "display": true
}, },
{ {
@ -565,7 +565,7 @@
} }
], ],
"show": { "show": {
"selectedTool": ".+" "toolAgentflowSelectedTool": ".+"
}, },
"id": "toolAgentflow_0-input-toolInputArgs-array", "id": "toolAgentflow_0-input-toolInputArgs-array",
"display": true "display": true
@ -599,7 +599,7 @@
], ],
"inputAnchors": [], "inputAnchors": [],
"inputs": { "inputs": {
"selectedTool": "slackMCP", "toolAgentflowSelectedTool": "slackMCP",
"toolInputArgs": [ "toolInputArgs": [
{ {
"inputArgName": "channel_id", "inputArgName": "channel_id",
@ -611,9 +611,9 @@
} }
], ],
"toolUpdateState": "", "toolUpdateState": "",
"selectedToolConfig": { "toolAgentflowSelectedToolConfig": {
"mcpActions": "[\"slack_post_message\"]", "mcpActions": "[\"slack_post_message\"]",
"selectedTool": "slackMCP" "toolAgentflowSelectedTool": "slackMCP"
} }
}, },
"outputAnchors": [ "outputAnchors": [