yym68686 commited on
Commit
fc14950
·
1 Parent(s): d62232c

Fix the issue where the original model name cannot be requested.

Browse files
Files changed (3) hide show
  1. .github/workflows/main.yml +5 -4
  2. main.py +3 -3
  3. utils.py +2 -1
.github/workflows/main.yml CHANGED
@@ -5,15 +5,16 @@ on:
5
  branches:
6
  - main
7
  paths:
8
- - Dockerfile
9
- - .dockerignore
10
- - requirements.txt
11
  - main.py
 
12
  - models.py
13
  - request.py
 
14
  - response.py
15
- - .github/workflows/main.yml
 
16
  - docker-compose.yml
 
17
 
18
  jobs:
19
  build-and-push:
 
5
  branches:
6
  - main
7
  paths:
 
 
 
8
  - main.py
9
+ - utils.py
10
  - models.py
11
  - request.py
12
+ - Dockerfile
13
  - response.py
14
+ - .dockerignore
15
+ - requirements.txt
16
  - docker-compose.yml
17
+ - .github/workflows/main.yml
18
 
19
  jobs:
20
  build-and-push:
main.py CHANGED
@@ -92,12 +92,12 @@ class ModelRequestHandler:
92
  model = model.split("/")[1]
93
  for provider in config['providers']:
94
  if provider['provider'] == provider_name:
95
- models_list = provider['model'].keys()
96
- if (model and model_name == model) or (model == "*" and model_name in models_list):
97
  provider_rules.append(provider_name)
98
  provider_list = []
99
  for provider in config['providers']:
100
- if model_name in provider['model'].keys() and ((provider_rules and provider['provider'] in provider_rules) or provider_rules == []):
101
  provider_list.append(provider)
102
  return provider_list
103
 
 
92
  model = model.split("/")[1]
93
  for provider in config['providers']:
94
  if provider['provider'] == provider_name:
95
+ models_list = list(provider['model'].keys()) + list(provider['model'].values())
96
+ if (model and model_name in models_list) or (model == "*" and model_name in models_list):
97
  provider_rules.append(provider_name)
98
  provider_list = []
99
  for provider in config['providers']:
100
+ if model_name in list(provider['model'].keys()) + list(provider['model'].values()) and ((provider_rules and provider['provider'] in provider_rules) or provider_rules == []):
101
  provider_list.append(provider)
102
  return provider_list
103
 
utils.py CHANGED
@@ -14,7 +14,8 @@ def load_config():
14
  if type(model) == str:
15
  model_dict[model] = model
16
  if type(model) == dict:
17
- model_dict.update({value: key for key, value in model.items()})
 
18
  provider['model'] = model_dict
19
  conf['providers'][index] = provider
20
  api_keys_db = conf['api_keys']
 
14
  if type(model) == str:
15
  model_dict[model] = model
16
  if type(model) == dict:
17
+ model_dict.update({new: old for old, new in model.items()})
18
+ model_dict.update({old: old for old, new in model.items()})
19
  provider['model'] = model_dict
20
  conf['providers'][index] = provider
21
  api_keys_db = conf['api_keys']