Skip to content

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

[Bug]: unnecessary auto-increment calculations in the tokens statistics of the chat model (#2969)

Yinquan WANG445dce436374
diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py
index 1dbf509351..d6589e0ab8 100644
--- a/rag/llm/chat_model.py
+++ b/rag/llm/chat_model.py
@@ -68,7 +68,6 @@ class Base(ABC):
resp.choices[0].delta.content = ""
ans += resp.choices[0].delta.content
- total_tokens += 1
if not hasattr(resp, "usage") or not resp.usage:
total_tokens = (
total_tokens