Upload 2 files
Browse files
app.py
CHANGED
|
@@ -365,11 +365,11 @@ def handle_api_error(error, attempt, current_api_key):
|
|
| 365 |
else:
|
| 366 |
delay = min(RETRY_DELAY * (2 ** attempt), MAX_RETRY_DELAY)
|
| 367 |
logger.warning(
|
| 368 |
-
f"{current_api_key[:8]} ... {current_api_key[-3:]} → {status_code}
|
| 369 |
)
|
| 370 |
switch_api_key()
|
| 371 |
time.sleep(delay)
|
| 372 |
-
return
|
| 373 |
|
| 374 |
elif isinstance(error, requests.exceptions.ConnectionError):
|
| 375 |
delay = min(RETRY_DELAY * (2 ** attempt), MAX_RETRY_DELAY)
|
|
|
|
| 365 |
else:
|
| 366 |
delay = min(RETRY_DELAY * (2 ** attempt), MAX_RETRY_DELAY)
|
| 367 |
logger.warning(
|
| 368 |
+
f"{current_api_key[:8]} ... {current_api_key[-3:]} → {status_code} 未知错误/模型不可用 → {delay} 秒后重试..."
|
| 369 |
)
|
| 370 |
switch_api_key()
|
| 371 |
time.sleep(delay)
|
| 372 |
+
return 2, None
|
| 373 |
|
| 374 |
elif isinstance(error, requests.exceptions.ConnectionError):
|
| 375 |
delay = min(RETRY_DELAY * (2 ** attempt), MAX_RETRY_DELAY)
|