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 mutiple retrieval component content (#2006)
H73a03287a57a
diff --git a/agent/component/base.py b/agent/component/base.pyindex 88c85c3fcc..103325016b 100644--- a/agent/component/base.py+++ b/agent/component/base.py@@ -448,8 +448,6 @@ class ComponentBase(ABC):if self.component_name.lower() == "generate" and self.get_component_name(u) == "retrieval":o = self._canvas.get_component(u)["obj"].output(allow_partial=False)[1]if o is not None:- if not "".join(o["content"]):- continueupstream_outs.append(o)continueif u not in self._canvas.get_component(self._id)["upstream"]: continuediff --git a/agent/component/generate.py b/agent/component/generate.pyindex 252526522b..dab99632a1 100644--- a/agent/component/generate.py+++ b/agent/component/generate.py@@ -66,6 +66,8 @@ class Generate(ComponentBase):return cpntsdef set_cite(self, retrieval_res, answer):+ retrieval_res.dropna(subset=["vector", "content_ltks"], inplace=True)+ retrieval_res["empty_response"].fillna("", inplace=True)answer, idx = retrievaler.insert_citations(answer, [ck["content_ltks"] for _, ck in retrieval_res.iterrows()],[ck["vector"] for _, ck in retrieval_res.iterrows()],LLMBundle(self._canvas.get_tenant_id(), LLMType.EMBEDDING,@@ -117,8 +119,10 @@ class Generate(ComponentBase):"obj"].component_name.lower() == "answer":return partial(self.stream_output, chat_mdl, prompt, retrieval_res)- if "empty_response" in retrieval_res.columns:- return Generate.be_output(input)+ if "empty_response" in retrieval_res.columns and not "".join(retrieval_res["content"]):+ res = {"content": "\n- ".join(retrieval_res["empty_response"]) if "\n- ".join(+ retrieval_res["empty_response"]) else "Nothing found in knowledgebase!", "reference": []}+ return Generate.be_output(res)ans = chat_mdl.chat(prompt, self._canvas.get_history(self._param.message_history_window_size),self._param.gen_conf())@@ -130,8 +134,9 @@ class Generate(ComponentBase):def stream_output(self, chat_mdl, prompt, retrieval_res):res = None- if "empty_response" in retrieval_res.columns and not "\n- ".join(retrieval_res["content"]):- res = {"content": "\n- ".join(retrieval_res["empty_response"]), "reference": []}+ if "empty_response" in retrieval_res.columns and not "".join(retrieval_res["content"]):+ res = {"content": "\n- ".join(retrieval_res["empty_response"]) if "\n- ".join(+ retrieval_res["empty_response"]) else "Nothing found in knowledgebase!", "reference": []}yield resself.set_output(res)return