From 4ec9a87e4645336ef8f63feab4c2c2ff6474ff3c Mon Sep 17 00:00:00 2001 From: -LAN- Date: Thu, 25 Jul 2024 00:32:39 +0800 Subject: [PATCH] fix(api/core/workflow/nodes/iteration/iteration_node.py): Extend output in iteration if output is a array. (#6647) Signed-off-by: -LAN- --- api/core/workflow/nodes/iteration/iteration_node.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/core/workflow/nodes/iteration/iteration_node.py b/api/core/workflow/nodes/iteration/iteration_node.py index fcd853a4bd..54dfe8b7f4 100644 --- a/api/core/workflow/nodes/iteration/iteration_node.py +++ b/api/core/workflow/nodes/iteration/iteration_node.py @@ -106,7 +106,11 @@ class IterationNode(BaseIterationNode): variable_pool.remove([self.node_id] + output_selector[1:]) state.current_output = output if output is not None: - state.outputs.append(output) + # NOTE: This is a temporary patch to process double nested list (for example, DALL-E output in iteration). + if isinstance(output, list): + state.outputs.extend(output) + else: + state.outputs.append(output) @classmethod def _extract_variable_selector_to_variable_mapping(cls, node_data: IterationNodeData) -> dict[str, list[str]]: