From ce2cd9469e9b2e053e470a1fb6e8a3302ff6ed64 Mon Sep 17 00:00:00 2001 From: nsde Date: Sat, 19 Aug 2023 17:53:48 +0200 Subject: [PATCH] Quicker models endpoint --- api/transfer.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/api/transfer.py b/api/transfer.py index 9d4c73d..44d1b26 100644 --- a/api/transfer.py +++ b/api/transfer.py @@ -28,6 +28,9 @@ async def handle(incoming_request): users = UserManager() path = incoming_request.url.path.replace('v1/v1/', 'v1/') + if '/models' in path: + return fastapi.responses.JSONResponse(content=models_list) + try: payload = await incoming_request.json() except json.decoder.JSONDecodeError: @@ -52,10 +55,6 @@ async def handle(incoming_request): if ban_reason: return await errors.error(403, f'Your NovaAI account has been banned. Reason: "{ban_reason}".', 'Contact the staff for an appeal.') - path_contains_models = '/models' in path - if path_contains_models: - return fastapi.responses.JSONResponse(content=models_list) - costs = config['costs'] cost = costs['other']