Fix the bug in the model matching rules.
Browse files
main.py
CHANGED
@@ -108,12 +108,19 @@ class ModelRequestHandler:
|
|
108 |
else:
|
109 |
for provider in config['providers']:
|
110 |
if model in provider['model'].keys():
|
111 |
-
provider_rules.append(provider['provider'])
|
112 |
|
113 |
provider_list = []
|
|
|
114 |
for provider in config['providers']:
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
return provider_list
|
118 |
|
119 |
async def request_model(self, request: RequestModel, token: str):
|
|
|
108 |
else:
|
109 |
for provider in config['providers']:
|
110 |
if model in provider['model'].keys():
|
111 |
+
provider_rules.append(provider['provider'] + "/" + model)
|
112 |
|
113 |
provider_list = []
|
114 |
+
# print("provider_rules", provider_rules)
|
115 |
for provider in config['providers']:
|
116 |
+
for item in provider_rules:
|
117 |
+
if provider['provider'] in item:
|
118 |
+
if "/" in item:
|
119 |
+
if item.split("/")[1] == model_name:
|
120 |
+
provider_list.append(provider)
|
121 |
+
else:
|
122 |
+
if model_name in provider['model'].keys():
|
123 |
+
provider_list.append(provider)
|
124 |
return provider_list
|
125 |
|
126 |
async def request_model(self, request: RequestModel, token: str):
|