[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 <kevinhu.sh@gmail.com>
This commit is contained in:
Yinquan WANG 2024-10-22 16:26:04 +08:00 committed by GitHub
parent 1fce6caf80
commit 445dce4363
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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