zeta
commited on
Commit
·
bdd215f
1
Parent(s):
9b5984b
refactor: revise round-robin and auto-retry logic in API request handling
Browse files- Change auto_retry default to true
- Implement explicit boolean check for auto_retry configuration
- Retain use_round_robin default and configuration logic
main.py
CHANGED
@@ -182,14 +182,15 @@ class ModelRequestHandler:
|
|
182 |
if not matching_providers:
|
183 |
raise HTTPException(status_code=404, detail="No matching model found")
|
184 |
|
185 |
-
#
|
186 |
api_index = api_list.index(token)
|
187 |
use_round_robin = True
|
188 |
-
auto_retry =
|
189 |
if config['api_keys'][api_index].get("preferences"):
|
190 |
if config['api_keys'][api_index]["preferences"].get("USE_ROUND_ROBIN") == False:
|
191 |
use_round_robin = False
|
192 |
-
|
|
|
193 |
|
194 |
return await self.try_all_providers(request, matching_providers, use_round_robin, auto_retry)
|
195 |
|
|
|
182 |
if not matching_providers:
|
183 |
raise HTTPException(status_code=404, detail="No matching model found")
|
184 |
|
185 |
+
# 检查是否启用轮询
|
186 |
api_index = api_list.index(token)
|
187 |
use_round_robin = True
|
188 |
+
auto_retry = True
|
189 |
if config['api_keys'][api_index].get("preferences"):
|
190 |
if config['api_keys'][api_index]["preferences"].get("USE_ROUND_ROBIN") == False:
|
191 |
use_round_robin = False
|
192 |
+
if config['api_keys'][api_index]["preferences"].get("AUTO_RETRY") == False:
|
193 |
+
auto_retry = False
|
194 |
|
195 |
return await self.try_all_providers(request, matching_providers, use_round_robin, auto_retry)
|
196 |
|