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
Revert the chat history for rewrite. (#4579)
Kevin Hucbc3c5297e68
diff --git a/agent/component/base.py b/agent/component/base.pyindex 33410bd086..ed6a511b1d 100644--- a/agent/component/base.py+++ b/agent/component/base.py@@ -483,7 +483,7 @@ class ComponentBase(ABC):if q["component_id"].lower().find("answer") == 0:txt = []- for r, c in self._canvas.history[::-1][:self._param.message_history_window_size]:+ for r, c in self._canvas.history[::-1][:self._param.message_history_window_size][::-1]:txt.append(f"{r.upper()}: {c}")txt = "\n".join(txt)self._param.inputs.append({"content": txt, "component_id": q["component_id"]})diff --git a/agent/component/rewrite.py b/agent/component/rewrite.pyindex 06a1f6b237..688664b8ac 100644--- a/agent/component/rewrite.py+++ b/agent/component/rewrite.py@@ -84,7 +84,7 @@ class RewriteQuestion(Generate, ABC):component_name = "RewriteQuestion"def _run(self, history, **kwargs):- hist = self._canvas.get_history(4)+ hist = self._canvas.get_history(self._param.message_history_window_size)conv = []for m in hist:if m["role"] not in ["user", "assistant"]:diff --git a/agent/templates/research_report.json b/agent/templates/research_report.jsonindex 120b151f27..ce6abcfa05 100644--- a/agent/templates/research_report.json+++ b/agent/templates/research_report.json@@ -717,7 +717,7 @@]},"label": "Template",- "name": "Artical"+ "name": "Article"},"dragging": false,"height": 160,diff --git a/agent/templates/seo_blog.json b/agent/templates/seo_blog.jsonindex b59251b56f..f8ac5ffdd6 100644--- a/agent/templates/seo_blog.json+++ b/agent/templates/seo_blog.json@@ -1153,7 +1153,7 @@],"presencePenaltyEnabled": true,"presence_penalty": 0.4,- "prompt": "You are an SEO expert who writes in a direct, practical, educational style that is factual rather than storytelling or narrative, focusing on explaining to {audience} the \"how\" and \"what is\" and \u201cwhy\u201d rather than narrating to the audience. \n - Please write at a sixth grade reading level. \n - ONLY output in Markdown format.\n - Use positive, present tense expressions and avoid using complex words and sentence structures that lack narrative, such as \"reveal\" and \"dig deep.\"\n - Next, please continue writing articles related to our topic with a concise title, {title_0}{title} {keywords_0}{keywords}. \n - Please AVOID repeating what has already been written and do not use the same sentence structure. \n - JUST write the body of the article based on the outline.\n - DO NOT include introduction, title.\n - DO NOT miss anything mentioned in artical outline, except introduction and title.\n - Please use the information I provide to create in-depth, interesting and unique content. Also, incorporate the references and data points I provided earlier into the article to increase its value to the reader.\n - MUST be in language of \"{keywords_0} {title_0}\".\n\n<article_outline>\n{outline}\n\n<article_body>",+ "prompt": "You are an SEO expert who writes in a direct, practical, educational style that is factual rather than storytelling or narrative, focusing on explaining to {audience} the \"how\" and \"what is\" and \u201cwhy\u201d rather than narrating to the audience. \n - Please write at a sixth grade reading level. \n - ONLY output in Markdown format.\n - Use positive, present tense expressions and avoid using complex words and sentence structures that lack narrative, such as \"reveal\" and \"dig deep.\"\n - Next, please continue writing articles related to our topic with a concise title, {title_0}{title} {keywords_0}{keywords}. \n - Please AVOID repeating what has already been written and do not use the same sentence structure. \n - JUST write the body of the article based on the outline.\n - DO NOT include introduction, title.\n - DO NOT miss anything mentioned in article outline, except introduction and title.\n - Please use the information I provide to create in-depth, interesting and unique content. Also, incorporate the references and data points I provided earlier into the article to increase its value to the reader.\n - MUST be in language of \"{keywords_0} {title_0}\".\n\n<article_outline>\n{outline}\n\n<article_body>","temperature": 0.1,"temperatureEnabled": true,"topPEnabled": true,@@ -1293,7 +1293,7 @@{"data": {"form": {- "text": "Let LLM to generate keywords to search. \nBased on the search result, the outline of the artical will be generated."+ "text": "Let LLM to generate keywords to search. \nBased on the search result, the outline of the article will be generated."},"label": "Note","name": "N: Words to search"