From 6e7fb756183ada9c80b583d264c2c2e12f646923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=91=E5=B9=BB=E5=A4=A7=E8=84=91?= <47254718+Sci-fiBrain@users.noreply.github.com> Date: Wed, 9 Apr 2025 12:37:21 +0800 Subject: [PATCH] Fix: handle waiting tasks when upstream is switch/categorize/relevant and normal path fails (#6874) ### What problem does this PR solve? Fix the issue where waiting tasks couldn't be processed when upstream components were "switch", "categorize", or "relevant" and the normal processing path couldn't continue. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [ ] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe): --- agent/canvas.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/agent/canvas.py b/agent/canvas.py index d5c0c0513..3b22128b3 100644 --- a/agent/canvas.py +++ b/agent/canvas.py @@ -252,15 +252,15 @@ class Canvas: if loop: raise OverflowError(f"Too much loops: {loop}") + downstream = [] if cpn["obj"].component_name.lower() in ["switch", "categorize", "relevant"]: switch_out = cpn["obj"].output()[1].iloc[0, 0] assert switch_out in self.components, \ "{}'s output: {} not valid.".format(cpn_id, switch_out) - for m in prepare2run([switch_out]): - yield {"content": m, "running_status": True} - continue + downstream = [switch_out] + else: + downstream = cpn["downstream"] - downstream = cpn["downstream"] if not downstream and cpn.get("parent_id"): pid = cpn["parent_id"] _, o = cpn["obj"].output(allow_partial=False)