浏览代码

Fix: QWenCV issue. (#8106)

### What problem does this PR solve?

Close #8097

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.19.1
Kevin Hu 4 个月前
父节点
当前提交
7ed9efcd4e
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7
    2
      rag/llm/cv_model.py

+ 7
- 2
rag/llm/cv_model.py 查看文件

@@ -323,7 +323,9 @@ class QWenCV(Base):
ans = ""
tk_count = 0
if response.status_code == HTTPStatus.OK:
ans += response.output.choices[0]['message']['content']
ans = response.output.choices[0]['message']['content']
if isinstance(ans, list):
ans = ans[0]["text"] if ans else ""
tk_count += response.usage.total_tokens
if response.output.choices[0].get("finish_reason", "") == "length":
ans += "...\nFor the content length reason, it stopped, continue?" if is_english(
@@ -352,7 +354,10 @@ class QWenCV(Base):
stream=True)
for resp in response:
if resp.status_code == HTTPStatus.OK:
ans = resp.output.choices[0]['message']['content']
cnt = resp.output.choices[0]['message']['content']
if isinstance(cnt, list):
cnt = cnt[0]["text"] if ans else ""
ans += cnt
tk_count = resp.usage.total_tokens
if resp.output.choices[0].get("finish_reason", "") == "length":
ans += "...\nFor the content length reason, it stopped, continue?" if is_english(

正在加载...
取消
保存