feat(web): workflow add code node

This commit is contained in:
zhaoying
2026-01-27 11:24:04 +08:00
parent 988a41f5e4
commit 3af183f6c3
17 changed files with 678 additions and 131 deletions

View File

@@ -284,7 +284,7 @@ export const nodeLibrary: NodeLibrary[] = [
config: {
input: {
type: 'variableList',
filterNodeTypes: ['knowledge-retrieval', 'iteration', 'loop'],
filterNodeTypes: ['knowledge-retrieval', 'iteration', 'loop', 'parameter-extractor', 'code'],
filterVariableNames: ['message']
},
parallel: {
@@ -431,7 +431,32 @@ export const nodeLibrary: NodeLibrary[] = [
}
}
},
// { type: "code_execution", icon: codeExecutionIcon },
{ type: "code", icon: codeExecutionIcon,
config: {
input_variables: {
type: 'inputList',
defaultValue: [{ name: 'arg1' }, { name: 'arg2' }]
},
language: {
type: 'select',
defaultValue: 'python3'
},
code: {
type: 'messageEditor',
isArray: false,
language: ['python3', 'javascript'],
titleVariant: 'borderless',
defaultValue: `def main(arg1: str, arg2: str):
return {
"result": arg1 + arg2,
}`
},
output_variables: {
type: 'outputList',
defaultValue: [{name: 'result', type: 'string'}]
},
}
},
{ type: "jinja-render", icon: templateRenderingIcon,
config: {
mapping: {
@@ -441,12 +466,12 @@ export const nodeLibrary: NodeLibrary[] = [
template: {
type: 'messageEditor',
isArray: false,
enableJinja2: true,
language: 'jinja2',
titleVariant: 'borderless',
defaultValue: "{{arg1}}"
},
}
}
},
]
},
// {