From 67f25b2353cde0c318f0450d5c3222091a988625 Mon Sep 17 00:00:00 2001 From: Emmanuel Morales <31712515+EmmanuelMr18@users.noreply.github.com> Date: Sun, 19 Jan 2025 17:26:41 -0600 Subject: [PATCH] chore: refresh models when getting object_info This is a WIP that will be used to refresh the models when execution comfyUI without having to stop the server and start a new one --- web-plugin/index.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/web-plugin/index.js b/web-plugin/index.js index 1b745db..8aafa2c 100644 --- a/web-plugin/index.js +++ b/web-plugin/index.js @@ -1999,6 +1999,25 @@ api.fetchApi = async (route, options) => { } } + if (route.startsWith("/object_info") && ext.native_mode) { + const info = await getSelectedWorkflowInfo(); + console.log("info, ", info); + if (info) { + const data = { + refresh_private: true, + refresh_public: true + } + await fetch("/comfyui-deploy/refresh-models", { + method: "POST", + headers: { + Authorization: `Bearer ${info.cd_token}`, + "Content-Type": "application/json", + }, + body: JSON.stringify(data), + }); + } + } + return await orginal_fetch_api.call(api, route, options); }; @@ -2157,4 +2176,4 @@ function createMenuRightButton(config) { } button.setAttribute('data-pd-tooltip', config.tooltip) return button -} \ No newline at end of file +}