Skip to content

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

Fix:Setting the message_history_window_size to 0 does not take effect (#7842)

Stephen Huae171956e85e
diff --git a/agent/canvas.py b/agent/canvas.py
index 7fc6424566..8e94c639c3 100644
--- a/agent/canvas.py
+++ b/agent/canvas.py
@@ -304,6 +304,8 @@ class Canvas:
def get_history(self, window_size):
convs = []
+ if window_size <= 0:
+ return convs
for role, obj in self.history[window_size * -1:]:
if isinstance(obj, list) and obj and all([isinstance(o, dict) for o in obj]):
convs.append({"role": role, "content": '\n'.join([str(s.get("content", "")) for s in obj])})