瀏覽代碼

fix: ERROR: 'CompletionUsage' object has no attribute 'get' (#1736)

### What problem does this PR solve?

_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.9.0
Wang Baoling 1 年之前
父節點
當前提交
74ebc497c1
No account linked to committer's email address
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      rag/llm/chat_model.py

+ 1
- 1
rag/llm/chat_model.py 查看文件

@@ -183,7 +183,7 @@ class BaiChuanChat(Base):
if resp.choices[0].finish_reason == "stop":
if not resp.choices[0].delta.content:
continue
total_tokens = resp.usage.get('total_tokens', 0)
total_tokens = resp.usage.total_tokens
if not resp.choices[0].delta.content:
continue
ans += resp.choices[0].delta.content

Loading…
取消
儲存