返回提交历史
Modified
g4f/Provider/needs_auth/Antigravity.py
+2
-1
Modified
g4f/Provider/needs_auth/GeminiCLI.py
+1
-0
Modified
g4f/api/__init__.py
+1
-1
XFEstudio/gpt4free
fix: improve error message parsing and enhance model count retrieval logic
54fef269
代码差异
3 个文件
+4
-2
@@ -1236,7 +1236,7 @@ class AntigravityProvider:
1236
1236
raise MissingAuthError("Unauthorized (401) from Antigravity API")
1237
1237
elif resp.status == 429:
1238
1238
try:
1239
message = (await resp.json()).get("error", {}).get("message", "")
1239
message = (await resp.json(content_type=None)).get("error", {}).get("message", "")
1240
1240
except Exception as e:
1241
1241
debug.error("Error parsing error message:", e)
1242
1242
message = await resp.text()
@@ -1287,6 +1287,7 @@ class AntigravityProvider:
1287
1287
for i, part in enumerate(tool_calls):
1288
1288
tc = part["functionCall"]
1289
1289
tool_call_obj = {
1290
"index": len(openai_tool_calls),
1290
1291
"id": tc.get("id", f"call_{i}_{tc.get('name', 'unknown')}"),
1291
1292
"type": "function",
1292
1293
"function": {
@@ -854,6 +854,7 @@ class GeminiCLIProvider():
854
854
for i, part in enumerate(tool_calls):
855
855
tc = part["functionCall"]
856
856
tool_call_obj = {
857
"index": len(openai_tool_calls),
857
858
"id": tc.get("id", f"call_{i}_{tc.get('name', 'unknown')}"),
858
859
"type": "function",
859
860
"function": {
@@ -403,7 +403,7 @@ class Api:
403
403
"audio": (model.get("id") if isinstance(model, dict) else model) in getattr(provider, "audio_models", []),
404
404
"video": (model.get("id") if isinstance(model, dict) else model) in getattr(provider, "video_models", []),
405
405
"type": "image" if (model.get("id") if isinstance(model, dict) else model) in getattr(provider, "image_models", []) else "chat",
406
"count": provider.models_count.get(model.get("id"), 0),
406
"count": provider.models_count.get(model.get("id") if isinstance(model, dict) else model, 0),
407
407
**(model if isinstance(model, dict) else {})
408
408
} for model in (models.values() if isinstance(models, dict) else models)]
409
409
}