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):
This commit is contained in:
科幻大脑 2025-04-09 12:37:21 +08:00 committed by GitHub
parent c26c38ee12
commit 6e7fb75618
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -252,15 +252,15 @@ class Canvas:
if loop: if loop:
raise OverflowError(f"Too much loops: {loop}") raise OverflowError(f"Too much loops: {loop}")
downstream = []
if cpn["obj"].component_name.lower() in ["switch", "categorize", "relevant"]: if cpn["obj"].component_name.lower() in ["switch", "categorize", "relevant"]:
switch_out = cpn["obj"].output()[1].iloc[0, 0] switch_out = cpn["obj"].output()[1].iloc[0, 0]
assert switch_out in self.components, \ assert switch_out in self.components, \
"{}'s output: {} not valid.".format(cpn_id, switch_out) "{}'s output: {} not valid.".format(cpn_id, switch_out)
for m in prepare2run([switch_out]): downstream = [switch_out]
yield {"content": m, "running_status": True} else:
continue downstream = cpn["downstream"]
downstream = cpn["downstream"]
if not downstream and cpn.get("parent_id"): if not downstream and cpn.get("parent_id"):
pid = cpn["parent_id"] pid = cpn["parent_id"]
_, o = cpn["obj"].output(allow_partial=False) _, o = cpn["obj"].output(allow_partial=False)