yym68686 commited on
Commit
7477ff7
·
1 Parent(s): f3ea9b1

🐛 Bug: Fix the bug when the model list is empty.

Browse files
Files changed (1) hide show
  1. main.py +2 -1
main.py CHANGED
@@ -260,8 +260,9 @@ class ModelRequestHandler:
260
  config = app.state.config
261
  # api_keys_db = app.state.api_keys_db
262
  api_list = app.state.api_list
263
-
264
  api_index = api_list.index(token)
 
 
265
  provider_rules = []
266
 
267
  for model in config['api_keys'][api_index]['model']:
 
260
  config = app.state.config
261
  # api_keys_db = app.state.api_keys_db
262
  api_list = app.state.api_list
 
263
  api_index = api_list.index(token)
264
+ if not safe_get(config, 'api_keys', api_index, 'model'):
265
+ raise HTTPException(status_code=404, detail="No matching model found")
266
  provider_rules = []
267
 
268
  for model in config['api_keys'][api_index]['model']: