ability to use flow.input within custom tool

This commit is contained in:
Henry 2023-12-26 16:00:46 +00:00
parent 6306904cfc
commit 5a76076ce4
3 changed files with 7 additions and 3 deletions

View File

@ -60,7 +60,7 @@ class CustomTool_Tools implements INode {
}
}
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
async init(nodeData: INodeData, input: string, options: ICommonObject): Promise<any> {
const selectedToolId = nodeData.inputs?.selectedTool as string
const customToolFunc = nodeData.inputs?.customToolFunc as string
@ -101,7 +101,8 @@ class CustomTool_Tools implements INode {
const flow = {
chatId: options.chatId, // id is uppercase (I)
chatflowId: options.chatflowid // id is lowercase (i)
chatflowId: options.chatflowid, // id is lowercase (i)
input
}
let dynamicStructuredTool = new DynamicStructuredTool(obj)

View File

@ -43,6 +43,9 @@ const HowToUseFunctionDialog = ({ show, onCancel }) => {
<li>
<code>$flow.chatflowId</code>
</li>
<li>
<code>$flow.input</code>
</li>
</ul>
</li>
<li style={{ marginTop: 10 }}>

View File

@ -33,7 +33,7 @@ import { HIDE_CANVAS_DIALOG, SHOW_CANVAS_DIALOG } from 'store/actions'
const exampleAPIFunc = `/*
* You can use any libraries imported in Flowise
* You can use properties specified in Output Schema as variables. Ex: Property = userid, Variable = $userid
* You can get default flow config: $flow.sessionId, $flow.chatId, $flow.chatflowId
* You can get default flow config: $flow.sessionId, $flow.chatId, $flow.chatflowId, $flow.input
* You can get custom variables: $vars.<variable-name>
* Must return a string value at the end of function
*/