From 61096596bcbe7d2d74c8633f61c5087470e18c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E8=85=BE?= <101850389+hangters@users.noreply.github.com> Date: Mon, 29 Jul 2024 09:21:31 +0800 Subject: [PATCH] fix OpenAI llm return bug (#1728) ### What problem does this PR solve? fix OpenAI llm return bug ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/llm/chat_model.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py index 3612cc55d..48dc29ba0 100644 --- a/rag/llm/chat_model.py +++ b/rag/llm/chat_model.py @@ -62,6 +62,8 @@ class Base(ABC): **gen_conf) for resp in response: if not resp.choices:continue + if not resp.choices[0].delta.content: + resp.choices[0].delta.content = "" ans += resp.choices[0].delta.content total_tokens = ( (