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 <think> in keywords or question auto-generations. (#5021)
Kevin Hu810f997276b7
diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.pyindex d3993b63da..0c60d5a83b 100644--- a/api/db/services/dialog_service.py+++ b/api/db/services/dialog_service.py@@ -570,6 +570,7 @@ Requirements:kwd = chat_mdl.chat(prompt, msg[1:], {"temperature": 0.2})if isinstance(kwd, tuple):kwd = kwd[0]+ kwd = re.sub(r"<think>.*</think>", "", kwd)if kwd.find("**ERROR**") >= 0:return ""return kwd@@ -599,6 +600,7 @@ Requirements:kwd = chat_mdl.chat(prompt, msg[1:], {"temperature": 0.2})if isinstance(kwd, tuple):kwd = kwd[0]+ kwd = re.sub(r"<think>.*</think>", "", kwd)if kwd.find("**ERROR**") >= 0:return ""return kwd@@ -669,6 +671,7 @@ Output: What's the weather in Rochester on {tomorrow}?###############"""ans = chat_mdl.chat(prompt, [{"role": "user", "content": "Output: "}], {"temperature": 0.2})+ ans = re.sub(r"<think>.*</think>", "", ans)return ans if ans.find("**ERROR**") < 0 else messages[-1]["content"]@@ -793,6 +796,7 @@ Output:kwd = chat_mdl.chat(prompt, msg[1:], {"temperature": 0.5})if isinstance(kwd, tuple):kwd = kwd[0]+ kwd = re.sub(r"<think>.*</think>", "", kwd)if kwd.find("**ERROR**") >= 0:raise Exception(kwd)