浏览代码

Update misc.py

Include empty delta object on openai_chat_chunk_message_template per OpenAI API documentation. 

https://platform.openai.com/docs/api-reference/chat/streaming#chat/streaming
Orion 3 月之前
父节点
当前提交
95f4d99e3b
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      backend/open_webui/utils/misc.py

+ 1 - 0
backend/open_webui/utils/misc.py

@@ -149,6 +149,7 @@ def openai_chat_chunk_message_template(
         template["choices"][0]["delta"] = {"content": message}
     else:
         template["choices"][0]["finish_reason"] = "stop"
+        template["choices"][0]["delta"] = {}
 
     if usage:
         template["usage"] = usage