yym68686 commited on
Commit
93aef2a
·
1 Parent(s): 3e22716

Fix the bug in the matching model algorithm.

Browse files
Files changed (2) hide show
  1. main.py +5 -1
  2. utils.py +1 -1
main.py CHANGED
@@ -94,9 +94,13 @@ class ModelRequestHandler:
94
  if "/" in model:
95
  provider_name = model.split("/")[0]
96
  model = model.split("/")[1]
 
97
  for provider in config['providers']:
98
  if provider['provider'] == provider_name:
99
- models_list = provider['model'].keys()
 
 
 
100
  if (model and model_name in models_list) or (model == "*" and model_name in models_list):
101
  provider_rules.append(provider_name)
102
  else:
 
94
  if "/" in model:
95
  provider_name = model.split("/")[0]
96
  model = model.split("/")[1]
97
+ models_list = []
98
  for provider in config['providers']:
99
  if provider['provider'] == provider_name:
100
+ models_list.extend(list(provider['model'].keys()))
101
+ # print("models_list", models_list)
102
+ # print("model_name", model_name)
103
+ # print("model", model)
104
  if (model and model_name in models_list) or (model == "*" and model_name in models_list):
105
  provider_rules.append(provider_name)
106
  else:
utils.py CHANGED
@@ -17,7 +17,7 @@ def update_config(config_data):
17
  config_data['providers'][index] = provider
18
  api_keys_db = config_data['api_keys']
19
  api_list = [item["api"] for item in api_keys_db]
20
- # logger.info(json.dumps(conf, indent=4, ensure_ascii=False))
21
  return config_data, api_keys_db, api_list
22
 
23
  # 读取YAML配置文件
 
17
  config_data['providers'][index] = provider
18
  api_keys_db = config_data['api_keys']
19
  api_list = [item["api"] for item in api_keys_db]
20
+ # logger.info(json.dumps(config_data, indent=4, ensure_ascii=False))
21
  return config_data, api_keys_db, api_list
22
 
23
  # 读取YAML配置文件