mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 05:55:59 +08:00
fix bugs about multi input for generate (#1525)
### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
d4332643c4
commit
2a647162a8
@ -193,9 +193,13 @@ class Canvas(ABC):
|
|||||||
self.answer.append(c)
|
self.answer.append(c)
|
||||||
else:
|
else:
|
||||||
if DEBUG: print("RUN: ", c)
|
if DEBUG: print("RUN: ", c)
|
||||||
|
if cpn.component_name == "Generate":
|
||||||
|
cpids = cpn.get_dependent_components()
|
||||||
|
if any([c not in self.path[-1] for c in cpids]):
|
||||||
|
continue
|
||||||
ans = cpn.run(self.history, **kwargs)
|
ans = cpn.run(self.history, **kwargs)
|
||||||
self.path[-1].append(c)
|
self.path[-1].append(c)
|
||||||
ran += 1
|
ran += 1
|
||||||
|
|
||||||
prepare2run(self.components[self.path[-2][-1]]["downstream"])
|
prepare2run(self.components[self.path[-2][-1]]["downstream"])
|
||||||
while 0 <= ran < len(self.path[-1]):
|
while 0 <= ran < len(self.path[-1]):
|
||||||
|
@ -445,6 +445,7 @@ class ComponentBase(ABC):
|
|||||||
if DEBUG: print(self.component_name, reversed_cpnts[::-1])
|
if DEBUG: print(self.component_name, reversed_cpnts[::-1])
|
||||||
for u in reversed_cpnts[::-1]:
|
for u in reversed_cpnts[::-1]:
|
||||||
if self.get_component_name(u) in ["switch"]: continue
|
if self.get_component_name(u) in ["switch"]: continue
|
||||||
|
if u not in self._canvas.get_component(self._id)["upstream"]: continue
|
||||||
if self.component_name.lower().find("switch") < 0 \
|
if self.component_name.lower().find("switch") < 0 \
|
||||||
and self.get_component_name(u) in ["relevant", "categorize"]:
|
and self.get_component_name(u) in ["relevant", "categorize"]:
|
||||||
continue
|
continue
|
||||||
|
@ -63,6 +63,10 @@ class GenerateParam(ComponentParamBase):
|
|||||||
class Generate(ComponentBase):
|
class Generate(ComponentBase):
|
||||||
component_name = "Generate"
|
component_name = "Generate"
|
||||||
|
|
||||||
|
def get_dependent_components(self):
|
||||||
|
cpnts = [para["component_id"] for para in self._param.parameters]
|
||||||
|
return cpnts
|
||||||
|
|
||||||
def _run(self, history, **kwargs):
|
def _run(self, history, **kwargs):
|
||||||
chat_mdl = LLMBundle(self._canvas.get_tenant_id(), LLMType.CHAT, self._param.llm_id)
|
chat_mdl = LLMBundle(self._canvas.get_tenant_id(), LLMType.CHAT, self._param.llm_id)
|
||||||
prompt = self._param.prompt
|
prompt = self._param.prompt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user