Przeglądaj źródła

fix: refine handling of constant and mixed input types in ToolManager and ToolNodeData (#22903)

tags/1.7.1
Yeuoly 3 miesięcy temu
rodzic
commit
9237976988
No account linked to committer's email address

+ 3
- 1
api/core/tools/tool_manager.py Wyświetl plik

if variable is None: if variable is None:
raise ToolParameterError(f"Variable {tool_input.value} does not exist") raise ToolParameterError(f"Variable {tool_input.value} does not exist")
parameter_value = variable.value parameter_value = variable.value
elif tool_input.type in {"mixed", "constant"}:
elif tool_input.type == "constant":
parameter_value = tool_input.value
elif tool_input.type == "mixed":
segment_group = variable_pool.convert_template(str(tool_input.value)) segment_group = variable_pool.convert_template(str(tool_input.value))
parameter_value = segment_group.text parameter_value = segment_group.text
else: else:

+ 1
- 1
api/core/workflow/nodes/tool/entities.py Wyświetl plik

for val in value: for val in value:
if not isinstance(val, str): if not isinstance(val, str):
raise ValueError("value must be a list of strings") raise ValueError("value must be a list of strings")
elif typ == "constant" and not isinstance(value, str | int | float | bool):
elif typ == "constant" and not isinstance(value, str | int | float | bool | dict):
raise ValueError("value must be a string, int, float, or bool") raise ValueError("value must be a string, int, float, or bool")
return typ return typ



+ 3
- 3
web/app/components/workflow/nodes/_base/components/form-input-item.tsx Wyświetl plik

...value, ...value,
[variable]: { [variable]: {
...varInput, ...varInput,
...newValue,
value: newValue,
}, },
}) })
} }
<AppSelector <AppSelector
disabled={readOnly} disabled={readOnly}
scope={scope || 'all'} scope={scope || 'all'}
value={varInput as any}
value={varInput?.value}
onSelect={handleAppOrModelSelect} onSelect={handleAppOrModelSelect}
/> />
)} )}
popupClassName='!w-[387px]' popupClassName='!w-[387px]'
isAdvancedMode isAdvancedMode
isInWorkflow isInWorkflow
value={varInput}
value={varInput?.value}
setModel={handleAppOrModelSelect} setModel={handleAppOrModelSelect}
readonly={readOnly} readonly={readOnly}
scope={scope} scope={scope}

Ładowanie…
Anuluj
Zapisz