返回提交历史
Modified
g4f/Provider/Yupp.py
+10
-0
XFEstudio/gpt4free
Handle ClientResponseError in Yupp provider
Adds specific handling for aiohttp ClientResponseError in the Yupp provider. Marks account as invalid on 500 Internal Server Error, otherwise increments error count and raises ProviderException for other errors.
2d552489
代码差异
1 个文件
+10
-0
@@ -6,6 +6,7 @@ import re
6
6
import os
7
7
import asyncio
8
8
import aiohttp
9
from aiohttp import ClientResponseError
9
10
10
11
from ..typing import AsyncResult, Messages, Optional, Dict, Any, List
11
12
from ..providers.base_provider import AsyncGeneratorProvider, ProviderModelMixin
@@ -407,6 +408,15 @@ class Yupp(AsyncGeneratorProvider, ProviderModelMixin):
407
408
else:
408
409
account["error_count"] += 1
409
410
continue
411
except ClientResponseError as e:
412
log_debug(f"Account ...{account['token'][-4:]} failed: {str(e)}")
413
# No Available Yupp credits
414
if e.status == 500 and 'Internal Server Error' in e.message:
415
account["is_valid"] = False
416
else:
417
async with account_rotation_lock:
418
account["error_count"] += 1
419
raise ProviderException(f"Yupp request failed: {str(e)}") from e
410
420
except Exception as e:
411
421
log_debug(f"Unexpected error with account ...{account['token'][-4:]}: {str(e)}")
412
422
async with account_rotation_lock: