yym68686 commited on
Commit
47f4668
·
1 Parent(s): e154153

Fix the bug in the model matching rules.

Browse files
Files changed (1) hide show
  1. main.py +10 -3
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
- if model_name in provider['model'].keys() and (provider_rules and provider['provider'] in provider_rules):
116
- provider_list.append(provider)
 
 
 
 
 
 
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):