RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix bugs about multi input for generate (#1525)
Kevin Hu2a647162a8c3
diff --git a/graph/canvas.py b/graph/canvas.pyindex 530bb6fbe5..9b8f4c62ce 100644--- a/graph/canvas.py+++ b/graph/canvas.py@@ -193,9 +193,13 @@ class Canvas(ABC):self.answer.append(c)else: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]):+ continueans = cpn.run(self.history, **kwargs)self.path[-1].append(c)- ran += 1+ ran += 1prepare2run(self.components[self.path[-2][-1]]["downstream"])while 0 <= ran < len(self.path[-1]):diff --git a/graph/component/base.py b/graph/component/base.pyindex 7c0b42e1ed..82e2f18c72 100644--- a/graph/component/base.py+++ b/graph/component/base.py@@ -445,6 +445,7 @@ class ComponentBase(ABC):if DEBUG: print(self.component_name, reversed_cpnts[::-1])for u in reversed_cpnts[::-1]:if self.get_component_name(u) in ["switch"]: continue+ if u not in self._canvas.get_component(self._id)["upstream"]: continueif self.component_name.lower().find("switch") < 0 \and self.get_component_name(u) in ["relevant", "categorize"]:continuediff --git a/graph/component/generate.py b/graph/component/generate.pyindex 8b6525112e..693bdba7a6 100644--- a/graph/component/generate.py+++ b/graph/component/generate.py@@ -63,6 +63,10 @@ class GenerateParam(ComponentParamBase):class Generate(ComponentBase):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):chat_mdl = LLMBundle(self._canvas.get_tenant_id(), LLMType.CHAT, self._param.llm_id)prompt = self._param.prompt