Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: handle values in output arrays for CodeNode transformation (#20437)

Yeuolyd4408e0f541e
diff --git a/api/core/workflow/nodes/code/code_node.py b/api/core/workflow/nodes/code/code_node.py
index 804c05f9f4b..59dae792e8d 100644
--- a/api/core/workflow/nodes/code/code_node.py
+++ b/api/core/workflow/nodes/code/code_node.py
@@ -167,8 +167,11 @@ class CodeNode(BaseNode[CodeNodeData]):
value=value,
variable=f"{prefix}.{output_name}[{i}]" if prefix else f"{output_name}[{i}]",
)
- elif isinstance(first_element, dict) and all(
- value is None or isinstance(value, dict) for value in output_value
+ elif (
+ isinstance(first_element, dict)
+ and all(value is None or isinstance(value, dict) for value in output_value)
+ or isinstance(first_element, list)
+ and all(value is None or isinstance(value, list) for value in output_value)
):
for i, value in enumerate(output_value):
if value is not None: