From 1bfbd91708c2227960c4a30d84f9ac91940b256e Mon Sep 17 00:00:00 2001 From: bennykok Date: Sun, 3 Mar 2024 16:17:34 -0800 Subject: [PATCH] feat(plugin): add models endpoints for listing out all folder paths for debug usecase --- custom_routes.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/custom_routes.py b/custom_routes.py index 5e3f401..928fd35 100644 --- a/custom_routes.py +++ b/custom_routes.py @@ -282,6 +282,19 @@ async def compute_sha256_checksum(filepath): sha256.update(chunk) return sha256.hexdigest() +@server.PromptServer.instance.routes.get('/comfyui-deploy/models') +async def get_installed_models(request): + # Directly return the list of paths as JSON + new_dict = {} + for key, value in folder_paths.folder_names_and_paths.items(): + # Convert set to list for JSON compatibility + # for path in value[0]: + file_list = folder_paths.get_filename_list(key) + value_json_compatible = (value[0], list(value[1]), file_list) + new_dict[key] = value_json_compatible + # print(new_dict) + return web.json_response(new_dict) + # This is start uploading the files to Comfy Deploy @server.PromptServer.instance.routes.post('/comfyui-deploy/upload-file') async def upload_file_endpoint(request):