diff --git a/packages/components/nodes/tools/CustomTool/CustomTool.ts b/packages/components/nodes/tools/CustomTool/CustomTool.ts index 26b306271..c070df317 100644 --- a/packages/components/nodes/tools/CustomTool/CustomTool.ts +++ b/packages/components/nodes/tools/CustomTool/CustomTool.ts @@ -36,7 +36,7 @@ class CustomTool_Tools implements INode { //@ts-ignore loadMethods = { - async listTools(nodeData: INodeData, options: ICommonObject): Promise { + async listTools(_: INodeData, options: ICommonObject): Promise { const returnData: INodeOptionsValue[] = [] const appDataSource = options.appDataSource as DataSource @@ -60,8 +60,9 @@ class CustomTool_Tools implements INode { } } - async init(nodeData: INodeData, input: string, options: ICommonObject): Promise { + async init(nodeData: INodeData, _: string, options: ICommonObject): Promise { const selectedToolId = nodeData.inputs?.selectedTool as string + const customToolFunc = nodeData.inputs?.customToolFunc as string const appDataSource = options.appDataSource as DataSource const databaseEntities = options.databaseEntities as IDatabaseEntity @@ -78,6 +79,7 @@ class CustomTool_Tools implements INode { schema: z.object(convertSchemaToZod(tool.schema)), code: tool.func } + if (customToolFunc) obj.code = customToolFunc return new DynamicStructuredTool(obj) } catch (e) { throw new Error(e) diff --git a/packages/ui/src/views/tools/ToolDialog.js b/packages/ui/src/views/tools/ToolDialog.js index 5e286789b..2b67f6d4d 100644 --- a/packages/ui/src/views/tools/ToolDialog.js +++ b/packages/ui/src/views/tools/ToolDialog.js @@ -495,7 +495,7 @@ const ToolDialog = ({ show, dialogProps, onUseTemplate, onCancel, onConfirm }) = Javascript Function