From 7ed9efcd4ee24e77e460e12c2b480e48c7f19f61 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Fri, 6 Jun 2025 17:55:13 +0800 Subject: [PATCH] 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) --- rag/llm/cv_model.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rag/llm/cv_model.py b/rag/llm/cv_model.py index 4314f7848..9be83ace5 100644 --- a/rag/llm/cv_model.py +++ b/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(