XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

Fix chunk handling in Backend_Api to ensure content is properly yielded as a string

cd8c096f
hlohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +2 -2
Modified g4f/gui/server/backend_api.py +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: