openai: fix empty models list on query present in url (#4139)

This commit is contained in:
hronoas 2023-10-16 23:02:47 +03:00 committed by GitHub
parent f17f7a6913
commit db7ecdd274
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -128,7 +128,7 @@ class Handler(BaseHTTPRequestHandler):
if self.path.startswith('/v1/engines') or self.path.startswith('/v1/models'): if self.path.startswith('/v1/engines') or self.path.startswith('/v1/models'):
is_legacy = 'engines' in self.path is_legacy = 'engines' in self.path
is_list = self.path in ['/v1/engines', '/v1/models'] is_list = self.path.split('?')[0].split('#')[0] in ['/v1/engines', '/v1/models']
if is_legacy and not is_list: if is_legacy and not is_list:
model_name = self.path[self.path.find('/v1/engines/') + len('/v1/engines/'):] model_name = self.path[self.path.find('/v1/engines/') + len('/v1/engines/'):]
resp = OAImodels.load_model(model_name) resp = OAImodels.load_model(model_name)