Upload app.py
Browse files
app.py
CHANGED
|
@@ -1125,15 +1125,11 @@ def ask_ai(problem: str, sympy_info: dict, history: list) -> str:
|
|
| 1125 |
continue
|
| 1126 |
except requests.exceptions.HTTPError as e:
|
| 1127 |
code = e.response.status_code if e.response else 0
|
| 1128 |
-
|
| 1129 |
-
|
| 1130 |
-
|
| 1131 |
-
|
| 1132 |
-
|
| 1133 |
-
continue
|
| 1134 |
-
else:
|
| 1135 |
-
last_error = f"⚠️ {provider_name} HTTP {code}"
|
| 1136 |
-
continue
|
| 1137 |
except Exception as e:
|
| 1138 |
last_error = f"⚠️ {provider_name} error: {str(e)}"
|
| 1139 |
continue
|
|
|
|
| 1125 |
continue
|
| 1126 |
except requests.exceptions.HTTPError as e:
|
| 1127 |
code = e.response.status_code if e.response else 0
|
| 1128 |
+
# Skip to next provider for ALL these codes:
|
| 1129 |
+
# 429 = rate limit, 401 = invalid key, 402 = no credits
|
| 1130 |
+
# 403 = forbidden, 503 = service down, 500 = server error
|
| 1131 |
+
last_error = f"⚠️ {provider_name} HTTP {code}"
|
| 1132 |
+
continue # always try next provider
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1133 |
except Exception as e:
|
| 1134 |
last_error = f"⚠️ {provider_name} error: {str(e)}"
|
| 1135 |
continue
|