mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 09:01:09 +03:00
Feature/Custom Tool OverrideConfig (#1979)
add ability to override custom tool
This commit is contained in:
@@ -63,6 +63,9 @@ class CustomTool_Tools implements INode {
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const selectedToolId = nodeData.inputs?.selectedTool as string
|
||||
const customToolFunc = nodeData.inputs?.customToolFunc as string
|
||||
const customToolName = nodeData.inputs?.customToolName as string
|
||||
const customToolDesc = nodeData.inputs?.customToolDesc as string
|
||||
const customToolSchema = nodeData.inputs?.customToolSchema as string
|
||||
|
||||
const appDataSource = options.appDataSource as DataSource
|
||||
const databaseEntities = options.databaseEntities as IDatabaseEntity
|
||||
@@ -80,6 +83,12 @@ class CustomTool_Tools implements INode {
|
||||
code: tool.func
|
||||
}
|
||||
if (customToolFunc) obj.code = customToolFunc
|
||||
if (customToolName) obj.name = customToolName
|
||||
if (customToolDesc) obj.description = customToolDesc
|
||||
if (customToolSchema) {
|
||||
const zodSchemaFunction = new Function('z', `return ${customToolSchema}`)
|
||||
obj.schema = zodSchemaFunction(z)
|
||||
}
|
||||
|
||||
const variables = await getVars(appDataSource, databaseEntities, nodeData)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user