返回提交历史
Modified
g4f/gui/server/backend_api.py
+2
-2
XFEstudio/gpt4free
Fix chunk handling in Backend_Api to ensure content is properly yielded as a string
cd8c096f
代码差异
1 个文件
+2
-2
@@ -186,8 +186,8 @@ class Backend_Api(Api):
186
186
stream=True,
187
187
)
188
188
for chunk in response:
189
if chunk.choices and chunk.choices[0].delta:
190
yield f"data: {json.dumps({'type': 'content', 'content': chunk.choices[0].delta.content})}\n\n"
189
if chunk.choices[0].delta.content:
190
yield f"data: {json.dumps({'type': 'content', 'content': str(chunk.choices[0].delta.content)})}\n\n"
191
191
except GeneratorExit:
192
192
pass
193
193
except Exception as e: