update ui changes

This commit is contained in:
Henry
2023-12-21 17:28:25 +00:00
parent a2d4a3b8d0
commit f0cdf48d54
10 changed files with 223 additions and 42 deletions
@@ -85,26 +85,29 @@ class CustomTool_Tools implements INode {
// override variables defined in overrideConfig
// nodeData.inputs.variables is an Object, check each property and override the variable
if (nodeData?.inputs?.envVars) {
for (const propertyName of Object.getOwnPropertyNames(nodeData.inputs.envVars)) {
if (nodeData?.inputs?.vars) {
for (const propertyName of Object.getOwnPropertyNames(nodeData.inputs.vars)) {
const foundVar = variables.find((v) => v.name === propertyName)
if (foundVar) {
// even if the variable was defined as runtime, we override it with static value
foundVar.type = 'static'
foundVar.value = nodeData.inputs.envVars[propertyName]
foundVar.value = nodeData.inputs.vars[propertyName]
} else {
// add it the variables, if not found locally in the db
variables.push({ name: propertyName, type: 'static', value: nodeData.inputs.envVars[propertyName] })
variables.push({ name: propertyName, type: 'static', value: nodeData.inputs.vars[propertyName] })
}
}
}
const flow = {
chatId: options.chatId, // id is uppercase (I)
chatflowId: options.chatflowid // id is lowercase (i)
}
let dynamicStructuredTool = new DynamicStructuredTool(obj)
dynamicStructuredTool.setVariables(variables)
dynamicStructuredTool.setFlowObject(flow)
return dynamicStructuredTool
} catch (e) {
throw new Error(e)