Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue Multiple Paths Between IF/ELSE Branches #11646

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion api/core/workflow/nodes/answer/answer_stream_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def process(self, generator: Generator[GraphEngineEvent, None, None]) -> Generat

del self.current_stream_chunk_generating_node_ids[event.route_node_state.node_id]

# remove unreachable nodes
self._remove_unreachable_nodes(event)

# generate stream outputs
Expand Down
8 changes: 7 additions & 1 deletion api/core/workflow/nodes/answer/base_stream_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ def _remove_unreachable_nodes(self, event: NodeRunSucceededEvent) -> None:
and edge.run_condition.branch_identify
and run_result.edge_source_handle == edge.run_condition.branch_identify
):
reachable_node_ids.extend(self._fetch_node_ids_in_reachable_branch(edge.target_node_id))
# remove unreachable nodes
# FIXME: because of the code branch can combine directly, so for answer node
# we remove the node maybe shortcut the answer node, so comment this code for now
# there is not effect on the answer node and the workflow, when we have a better solution
# we can open this code. Issues: #11542 #9560 #10638 #10564

# reachable_node_ids.extend(self._fetch_node_ids_in_reachable_branch(edge.target_node_id))
continue
else:
unreachable_first_node_ids.append(edge.target_node_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,12 @@ def test_run_branch(mock_close, mock_remove):
items = []
generator = graph_engine.run()
for item in generator:
# print(type(item), item)
items.append(item)

assert len(items) == 10
assert items[3].route_node_state.node_id == "if-else-1"
assert items[4].route_node_state.node_id == "if-else-1"
assert isinstance(items[5], NodeRunStreamChunkEvent)
assert items[5].chunk_content == "1 "
assert isinstance(items[6], NodeRunStreamChunkEvent)
assert items[6].chunk_content == "takato"
assert items[7].route_node_state.node_id == "answer-1"
Expand Down
Loading