mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-06-04 11:14:10 +08:00
feat: remove file and file[] restriction in code node (#17382)
This commit is contained in:
parent
4902ddaf87
commit
b3f4e90862
@ -6,6 +6,7 @@ from core.helper.code_executor.code_executor import CodeExecutionError, CodeExec
|
|||||||
from core.helper.code_executor.code_node_provider import CodeNodeProvider
|
from core.helper.code_executor.code_node_provider import CodeNodeProvider
|
||||||
from core.helper.code_executor.javascript.javascript_code_provider import JavascriptCodeProvider
|
from core.helper.code_executor.javascript.javascript_code_provider import JavascriptCodeProvider
|
||||||
from core.helper.code_executor.python3.python3_code_provider import Python3CodeProvider
|
from core.helper.code_executor.python3.python3_code_provider import Python3CodeProvider
|
||||||
|
from core.variables.segments import ArrayFileSegment
|
||||||
from core.workflow.entities.node_entities import NodeRunResult
|
from core.workflow.entities.node_entities import NodeRunResult
|
||||||
from core.workflow.nodes.base import BaseNode
|
from core.workflow.nodes.base import BaseNode
|
||||||
from core.workflow.nodes.code.entities import CodeNodeData
|
from core.workflow.nodes.code.entities import CodeNodeData
|
||||||
@ -49,6 +50,9 @@ class CodeNode(BaseNode[CodeNodeData]):
|
|||||||
for variable_selector in self.node_data.variables:
|
for variable_selector in self.node_data.variables:
|
||||||
variable_name = variable_selector.variable
|
variable_name = variable_selector.variable
|
||||||
variable = self.graph_runtime_state.variable_pool.get(variable_selector.value_selector)
|
variable = self.graph_runtime_state.variable_pool.get(variable_selector.value_selector)
|
||||||
|
if isinstance(variable, ArrayFileSegment):
|
||||||
|
variables[variable_name] = [v.to_dict() for v in variable.value] if variable.value else None
|
||||||
|
else:
|
||||||
variables[variable_name] = variable.to_object() if variable else None
|
variables[variable_name] = variable.to_object() if variable else None
|
||||||
# Run code
|
# Run code
|
||||||
try:
|
try:
|
||||||
|
@ -101,7 +101,7 @@ const useConfig = (id: string, payload: CodeNodeType) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const filterVar = useCallback((varPayload: Var) => {
|
const filterVar = useCallback((varPayload: Var) => {
|
||||||
return [VarType.string, VarType.number, VarType.secret, VarType.object, VarType.array, VarType.arrayNumber, VarType.arrayString, VarType.arrayObject].includes(varPayload.type)
|
return [VarType.string, VarType.number, VarType.secret, VarType.object, VarType.array, VarType.arrayNumber, VarType.arrayString, VarType.arrayObject, VarType.file, VarType.arrayFile].includes(varPayload.type)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// single run
|
// single run
|
||||||
|
Loading…
x
Reference in New Issue
Block a user