From 445dce436374d087d407985eebf1731008cd5e6b Mon Sep 17 00:00:00 2001 From: Yinquan WANG <81215927+yqwang96@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:26:04 +0800 Subject: [PATCH] [Bug]: unnecessary auto-increment calculations in the tokens statistics of the chat model (#2969) ### What problem does this PR solve? the details is shown in https://github.com/infiniflow/ragflow/issues/2968 ### Type of change - [X] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Kevin Hu --- rag/llm/chat_model.py | 1 - 1 file changed, 1 deletion(-) 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 @@ def chat_streamly(self, system, history, gen_conf): 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