From a82e315d6c66f690cf86cffff9decd9ba06f1039 Mon Sep 17 00:00:00 2001 From: bennykok Date: Fri, 25 Oct 2024 19:38:49 +0800 Subject: [PATCH] fix: when file endpoint is null, skip uploading --- custom_routes.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/custom_routes.py b/custom_routes.py index d854121..68edcd3 100644 --- a/custom_routes.py +++ b/custom_routes.py @@ -1713,17 +1713,23 @@ async def upload_in_background( # await handle_upload(prompt_id, data, 'files', "content_type", "image/png") # await handle_upload(prompt_id, data, 'gifs', "format", "image/gif") # await handle_upload(prompt_id, data, 'mesh', "format", "application/octet-stream") - upload_tasks = [ - handle_upload(prompt_id, data, "images", "content_type", "image/png"), - handle_upload(prompt_id, data, "files", "content_type", "image/png"), - handle_upload(prompt_id, data, "gifs", "format", "image/gif"), - handle_upload( - prompt_id, data, "mesh", "format", "application/octet-stream" - ), - ] - - await asyncio.gather(*upload_tasks) + + file_upload_endpoint = prompt_metadata[prompt_id].file_upload_endpoint + + if file_upload_endpoint is not None and file_upload_endpoint != "": + upload_tasks = [ + handle_upload(prompt_id, data, "images", "content_type", "image/png"), + handle_upload(prompt_id, data, "files", "content_type", "image/png"), + handle_upload(prompt_id, data, "gifs", "format", "image/gif"), + handle_upload( + prompt_id, data, "mesh", "format", "application/octet-stream" + ), + ] + await asyncio.gather(*upload_tasks) + else: + print("No file upload endpoint, skipping file upload") + status_endpoint = prompt_metadata[prompt_id].status_endpoint token = prompt_metadata[prompt_id].token gpu_event_id = prompt_metadata[prompt_id].gpu_event_id or None