Yinquan WANG Kevin Hu commited on
Commit
c31ab66
·
1 Parent(s): fa11d40

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

Browse files

### 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 <[email protected]>

Files changed (1) hide show
  1. rag/llm/chat_model.py +0 -1
rag/llm/chat_model.py CHANGED
@@ -68,7 +68,6 @@ class Base(ABC):
68
  resp.choices[0].delta.content = ""
69
  ans += resp.choices[0].delta.content
70
 
71
- total_tokens += 1
72
  if not hasattr(resp, "usage") or not resp.usage:
73
  total_tokens = (
74
  total_tokens
 
68
  resp.choices[0].delta.content = ""
69
  ans += resp.choices[0].delta.content
70
 
 
71
  if not hasattr(resp, "usage") or not resp.usage:
72
  total_tokens = (
73
  total_tokens