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

XFEstudio/gpt4free

fix: handle missing "result" key in PuterJS response

- Modified `PuterJS.py` in the `g4f/Provider/needs_auth` directory. - In the `PuterJS` class, updated the handling of the `result` dictionary in the response. - Changed the assignment of `choice` to use `result.get("result", {})` instead of directly assigning `result`. - Ensured that `choice` is an empty dictionary if the `result` key is missing in the response.

b188e8fb
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +1 -1
Modified g4f/Provider/needs_auth/PuterJS.py +1 -1
@@ -427,7 +427,7 @@ class PuterJS(AsyncGeneratorProvider, ProviderModelMixin):
427 427 if "choices" in result:
428 428 choice = result["choices"][0]
429 429 elif "result" in result:
430 choice = result
430 choice = result.get("result", {})
431 431 else:
432 432 raise ResponseError(result)
433 433 message = choice.get("message", {})