Skip to content

Commit

Permalink
fix: droping self._remove_unreachable_nodes(event) to aviod if else s…
Browse files Browse the repository at this point in the history
…hort cut for answer node

Signed-off-by: yihong0618 <[email protected]>
  • Loading branch information
yihong0618 committed Dec 19, 2024
1 parent ee34206 commit 4407034
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 5 additions & 1 deletion api/core/workflow/nodes/answer/answer_stream_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ 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)
# 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
# self._remove_unreachable_nodes(event)

# generate stream outputs
yield from self._generate_stream_outputs_when_node_finished(event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,16 +488,14 @@ 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 isinstance(items[8], NodeRunStreamChunkEvent)
# assert items[6].chunk_content == "takato"
assert items[8].chunk_content == "takato"
assert items[7].route_node_state.node_id == "answer-1"
assert items[8].route_node_state.node_id == "answer-1"
assert items[8].route_node_state.node_run_result.outputs["answer"] == "1 takato"
Expand Down

0 comments on commit 4407034

Please sign in to comment.