Feature/Custom Tool OverrideConfig (#1979)
add ability to override custom tool
This commit is contained in:
parent
cd4c659009
commit
bb7373ee62
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue