From b817036343a14f4f52717396981fb95adaf530a4 Mon Sep 17 00:00:00 2001 From: Novice <857526207@qq.com> Date: Tue, 11 Mar 2025 20:30:03 +0800 Subject: [PATCH] fix: nesting of conditional branches causing streaming output error (#14065) --- .../workflow/nodes/answer/base_stream_processor.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/core/workflow/nodes/answer/base_stream_processor.py b/api/core/workflow/nodes/answer/base_stream_processor.py index 4759356ae1..f33ba6cd5d 100644 --- a/api/core/workflow/nodes/answer/base_stream_processor.py +++ b/api/core/workflow/nodes/answer/base_stream_processor.py @@ -57,11 +57,19 @@ class StreamProcessor(ABC): # The branch_identify parameter is added to ensure that # only nodes in the correct logical branch are included. + reachable_node_ids.append(edge.target_node_id) ids = self._fetch_node_ids_in_reachable_branch(edge.target_node_id, run_result.edge_source_handle) reachable_node_ids.extend(ids) else: + # if the condition edge in parallel, and the target node is not in parallel, we should not remove it + # Issues: #13626 + if ( + finished_node_id in self.graph.node_parallel_mapping + and edge.target_node_id not in self.graph.parallel_mapping + ): + continue unreachable_first_node_ids.append(edge.target_node_id) - + unreachable_first_node_ids = list(set(unreachable_first_node_ids) - set(reachable_node_ids)) for node_id in unreachable_first_node_ids: self._remove_node_ids_in_unreachable_branch(node_id, reachable_node_ids)