Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Feature (canvas): Add mind tagging support (#11359)

天海蒼灆9f715d6bc271
diff --git a/api/db/services/canvas_service.py b/api/db/services/canvas_service.py
index 5a0f82c2b0..db8e160689 100644
--- a/api/db/services/canvas_service.py
+++ b/api/db/services/canvas_service.py
@@ -223,6 +223,10 @@ def completion(tenant_id, agent_id, session_id=None, **kwargs):
ans["session_id"] = session_id
if ans["event"] == "message":
txt += ans["data"]["content"]
+ if ans["data"].get("start_to_think", False):
+ txt += "<think>"
+ elif ans["data"].get("end_to_think", False):
+ txt += "</think>"
yield "data:" + json.dumps(ans, ensure_ascii=False) + "\n\n"
conv.message.append({"role": "assistant", "content": txt, "created_at": time.time(), "id": message_id})