mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-04-19 12:39:59 +08:00
Fix: Resolved a bug where sibling components in Canvas were not restricted to fetching data from the upstream when parallel components were present. (#6315)
### What problem does this PR solve? Fix: Resolved a bug where sibling components in Canvas were not restricted to fetching data from the upstream when parallel components were present. Issue: When parallel components existed in Canvas, sibling components incorrectly fetched data without being limited to the upstream scope, causing data retrieval issues. Solution: Adjusted the data fetching logic to ensure sibling components only retrieve data from the upstream scope. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
95497b4aab
commit
6784e0dfee
@ -463,6 +463,8 @@ class ComponentBase(ABC):
|
||||
if len(self._canvas.path) > 1:
|
||||
reversed_cpnts.extend(self._canvas.path[-2])
|
||||
reversed_cpnts.extend(self._canvas.path[-1])
|
||||
up_cpns = self.get_upstream()
|
||||
reversed_up_cpnts = [cpn for cpn in reversed_cpnts if cpn in up_cpns]
|
||||
|
||||
if self._param.query:
|
||||
self._param.inputs = []
|
||||
@ -505,7 +507,7 @@ class ComponentBase(ABC):
|
||||
|
||||
upstream_outs = []
|
||||
|
||||
for u in reversed_cpnts[::-1]:
|
||||
for u in reversed_up_cpnts[::-1]:
|
||||
if self.get_component_name(u) in ["switch", "concentrator"]:
|
||||
continue
|
||||
if self.component_name.lower() == "generate" and self.get_component_name(u) == "retrieval":
|
||||
@ -565,8 +567,10 @@ class ComponentBase(ABC):
|
||||
if len(self._canvas.path) > 1:
|
||||
reversed_cpnts.extend(self._canvas.path[-2])
|
||||
reversed_cpnts.extend(self._canvas.path[-1])
|
||||
up_cpns = self.get_upstream()
|
||||
reversed_up_cpnts = [cpn for cpn in reversed_cpnts if cpn in up_cpns]
|
||||
|
||||
for u in reversed_cpnts[::-1]:
|
||||
for u in reversed_up_cpnts[::-1]:
|
||||
if self.get_component_name(u) in ["switch", "answer"]:
|
||||
continue
|
||||
return self._canvas.get_component(u)["obj"].output()[1]
|
||||
@ -584,3 +588,7 @@ class ComponentBase(ABC):
|
||||
def get_parent(self):
|
||||
pid = self._canvas.get_component(self._id)["parent_id"]
|
||||
return self._canvas.get_component(pid)["obj"]
|
||||
|
||||
def get_upstream(self):
|
||||
cpn_nms = self._canvas.get_component(self._id)['upstream']
|
||||
return cpn_nms
|
||||
|
Loading…
x
Reference in New Issue
Block a user