Update app.py
Browse files
app.py
CHANGED
|
@@ -206,7 +206,7 @@ def get_all_models(api_key, sub_type):
|
|
| 206 |
)
|
| 207 |
return []
|
| 208 |
|
| 209 |
-
def select_key(
|
| 210 |
"""
|
| 211 |
根据请求类型和模型名称选择合适的 KEY,
|
| 212 |
并实现轮询和重试机制。
|
|
@@ -219,7 +219,7 @@ def select_key(request_type, model_name):
|
|
| 219 |
key = available_keys[current_index % len(available_keys)]
|
| 220 |
current_index += 1
|
| 221 |
|
| 222 |
-
if key_is_valid(key
|
| 223 |
model_key_indices[model_name] = current_index
|
| 224 |
return key
|
| 225 |
else:
|
|
@@ -235,9 +235,6 @@ def key_is_valid(key, request_type):
|
|
| 235 |
检查 KEY 是否有效,
|
| 236 |
根据不同的请求类型进行不同的检查。
|
| 237 |
"""
|
| 238 |
-
if request_type == "invalid":
|
| 239 |
-
return False
|
| 240 |
-
|
| 241 |
return total_balance > 0
|
| 242 |
|
| 243 |
def check_authorization(request):
|
|
|
|
| 206 |
)
|
| 207 |
return []
|
| 208 |
|
| 209 |
+
def select_key(model_name):
|
| 210 |
"""
|
| 211 |
根据请求类型和模型名称选择合适的 KEY,
|
| 212 |
并实现轮询和重试机制。
|
|
|
|
| 219 |
key = available_keys[current_index % len(available_keys)]
|
| 220 |
current_index += 1
|
| 221 |
|
| 222 |
+
if key_is_valid(key):
|
| 223 |
model_key_indices[model_name] = current_index
|
| 224 |
return key
|
| 225 |
else:
|
|
|
|
| 235 |
检查 KEY 是否有效,
|
| 236 |
根据不同的请求类型进行不同的检查。
|
| 237 |
"""
|
|
|
|
|
|
|
|
|
|
| 238 |
return total_balance > 0
|
| 239 |
|
| 240 |
def check_authorization(request):
|