返回提交历史
Modified
g4f/Provider/needs_auth/PuterJS.py
+1
-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
代码差异
1 个文件
+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", {})