diff --git a/paddlex/inference/pipelines/components/chat_server/openai_bot_chat.py b/paddlex/inference/pipelines/components/chat_server/openai_bot_chat.py index 358c591f1b..4356e13fe7 100644 --- a/paddlex/inference/pipelines/components/chat_server/openai_bot_chat.py +++ b/paddlex/inference/pipelines/components/chat_server/openai_bot_chat.py @@ -135,7 +135,13 @@ def generate_chat_results( temperature=temperature, top_p=0.001, ) - llm_result["content"] = chat_completion.choices[0].message.content + if isinstance(chat_completion, str): + chat_completion = json.loads(chat_completion) + llm_result["content"] = chat_completion["choices"][0]["delta"][ + "content" + ] + else: + llm_result["content"] = chat_completion.choices[0].message.content try: llm_result["reasoning_content"] = chat_completion.choices[ 0