🐛 Bug: Fix the bug where the permissions control for model distributors is incorrect.
Browse files
main.py
CHANGED
@@ -620,9 +620,14 @@ class ModelRequestHandler:
|
|
620 |
models_list.extend(list(provider['model'].keys()))
|
621 |
# print("models_list", models_list)
|
622 |
# print("model_name", model_name)
|
|
|
623 |
# print("model", model)
|
624 |
-
if
|
625 |
-
|
|
|
|
|
|
|
|
|
626 |
else:
|
627 |
for provider in config['providers']:
|
628 |
if model in provider['model'].keys():
|
@@ -666,7 +671,7 @@ class ModelRequestHandler:
|
|
666 |
# print("matching_providers", json.dumps(matching_providers, indent=4, ensure_ascii=False))
|
667 |
if not matching_providers:
|
668 |
raise HTTPException(status_code=404, detail="No matching model found")
|
669 |
-
|
670 |
# 检查是否启用轮询
|
671 |
api_index = api_list.index(token)
|
672 |
weights = safe_get(config, 'api_keys', api_index, "weights")
|
|
|
620 |
models_list.extend(list(provider['model'].keys()))
|
621 |
# print("models_list", models_list)
|
622 |
# print("model_name", model_name)
|
623 |
+
# print("model_name_split", model_name_split)
|
624 |
# print("model", model)
|
625 |
+
if model_name_split == "*":
|
626 |
+
if model_name in models_list:
|
627 |
+
provider_rules.append(provider_name)
|
628 |
+
elif model_name_split == model_name:
|
629 |
+
if model_name in models_list:
|
630 |
+
provider_rules.append(provider_name)
|
631 |
else:
|
632 |
for provider in config['providers']:
|
633 |
if model in provider['model'].keys():
|
|
|
671 |
# print("matching_providers", json.dumps(matching_providers, indent=4, ensure_ascii=False))
|
672 |
if not matching_providers:
|
673 |
raise HTTPException(status_code=404, detail="No matching model found")
|
674 |
+
# exit(0)
|
675 |
# 检查是否启用轮询
|
676 |
api_index = api_list.index(token)
|
677 |
weights = safe_get(config, 'api_keys', api_index, "weights")
|