From d473a211d07f5eb14e0c8a09d35c0386e71c66c7 Mon Sep 17 00:00:00 2001 From: bennykok Date: Wed, 7 Feb 2024 13:20:10 +0800 Subject: [PATCH 1/7] fix: running locally cause a crash in after adding live status --- custom_routes.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/custom_routes.py b/custom_routes.py index 759a41f..6169626 100644 --- a/custom_routes.py +++ b/custom_routes.py @@ -358,12 +358,14 @@ async def send_json_override(self, event, data, sid=None): if event == 'executing' and data.get('node') is not None: node = data.get('node') - if 'last_updated_node' in prompt_metadata[prompt_id] and prompt_metadata[prompt_id]['last_updated_node'] == node: - return - prompt_metadata[prompt_id]['last_updated_node'] = node - class_type = prompt_metadata[prompt_id]['workflow_api'][node]['class_type'] - print("updating run live status", class_type) - await update_run_live_status(prompt_id, "Executing " + class_type) + + if 'prompt_id' in prompt_metadata: + if 'last_updated_node' in prompt_metadata[prompt_id] and prompt_metadata[prompt_id]['last_updated_node'] == node: + return + prompt_metadata[prompt_id]['last_updated_node'] = node + class_type = prompt_metadata[prompt_id]['workflow_api'][node]['class_type'] + print("updating run live status", class_type) + await update_run_live_status(prompt_id, "Executing " + class_type) if event == 'execution_error': # Careful this might not be fully awaited. From 1bc62a5fb47f8b7d3589d1f37d83f6c436555908 Mon Sep 17 00:00:00 2001 From: bennykok Date: Wed, 7 Feb 2024 18:17:22 +0800 Subject: [PATCH 2/7] fix: deps layout and comfyui-json --- web-plugin/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web-plugin/index.js b/web-plugin/index.js index c313607..cadbc38 100644 --- a/web-plugin/index.js +++ b/web-plugin/index.js @@ -1,7 +1,7 @@ import { app } from "./app.js"; import { api } from "./api.js"; import { ComfyWidgets, LGraphNode } from "./widgets.js"; -import { generateDependencyGraph } from "https://esm.sh/comfyui-json@0.1.8"; +import { generateDependencyGraph } from "https://esm.sh/comfyui-json@0.1.9"; /** @typedef {import('../../../web/types/comfy.js').ComfyExtension} ComfyExtension*/ /** @type {ComfyExtension} */ @@ -227,6 +227,11 @@ function createDynamicUIHtml(data) { }); html += ""; + // Models + html += `
`; + html += + '

Files

'; + Object.entries(data.files).forEach(([section, items]) => { html += `
From 3adf77617b365172ab0860238e3635ce0afb45e4 Mon Sep 17 00:00:00 2001 From: bennykok Date: Wed, 7 Feb 2024 19:55:05 +0800 Subject: [PATCH 3/7] fix(plugin): async file upload to make sure it is not blocking --- custom_routes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_routes.py b/custom_routes.py index 6169626..873180f 100644 --- a/custom_routes.py +++ b/custom_routes.py @@ -513,7 +513,9 @@ async def upload_file(prompt_id, filename, subfolder=None, content_type="image/p "Content-Length": str(len(data)), } response = requests.put(ok.get("url"), headers=headers, data=data) - print("upload file response", response.status_code) + async with aiohttp.ClientSession() as session: + async with session.put(ok.get("url"), headers=headers, data=data) as response: + print("upload file response", response.status) def have_pending_upload(prompt_id): if 'prompt_id' in prompt_metadata and 'uploading_nodes' in prompt_metadata[prompt_id] and len(prompt_metadata[prompt_id]['uploading_nodes']) > 0: From 7e86c203833ebf3591d8ac2f082ab306ebc4befa Mon Sep 17 00:00:00 2001 From: bennykok Date: Wed, 7 Feb 2024 23:50:00 +0800 Subject: [PATCH 4/7] fix(plugin): ensure the status of run is set to fail if the prompt validation failed --- custom_routes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_routes.py b/custom_routes.py index 873180f..9d54be7 100644 --- a/custom_routes.py +++ b/custom_routes.py @@ -118,6 +118,8 @@ async def comfy_deploy_run(request): "stack_trace": stack_trace } }) + # When there are critical errors, the prompt is actually not run + await update_run(prompt_id, Status.FAILED) return web.Response(status=500, reason=f"{error_type}: {e}, {stack_trace_short}") status = 200 From 5ddbfdf44bdf56da60fd5f8c4ddf910b3addf90c Mon Sep 17 00:00:00 2001 From: bennykok Date: Thu, 8 Feb 2024 22:54:37 +0800 Subject: [PATCH 5/7] feat(plugin): update comfyui json version, add missing nodes display --- web-plugin/index.js | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/web-plugin/index.js b/web-plugin/index.js index cadbc38..4f0503b 100644 --- a/web-plugin/index.js +++ b/web-plugin/index.js @@ -1,7 +1,7 @@ import { app } from "./app.js"; import { api } from "./api.js"; import { ComfyWidgets, LGraphNode } from "./widgets.js"; -import { generateDependencyGraph } from "https://esm.sh/comfyui-json@0.1.9"; +import { generateDependencyGraph } from "https://esm.sh/comfyui-json@0.1.14"; /** @typedef {import('../../../web/types/comfy.js').ComfyExtension} ComfyExtension*/ /** @type {ComfyExtension} */ @@ -184,12 +184,28 @@ function createDynamicUIHtml(data) { let html = '
'; const bgcolor = "var(--comfy-input-bg)"; + const evenBg = "var(--border-color)"; const textColor = "var(--input-text)"; // Custom Nodes html += `
`; html += '

Custom Nodes

'; + + if (data.missing_nodes?.length > 0) { + html += ` +
+

Missing Nodes

+

These nodes are not found with any matching custom_nodes in the ComfyUI Manager Database

+ ${data.missing_nodes + .map((node) => { + return `

${node}

`; + }) + .join("")} +
+ `; + } + Object.values(data.custom_nodes).forEach((node) => { html += `
@@ -346,10 +362,10 @@ function addButton() { "Generating dependency graph", "Please wait...", ); - deps = await generateDependencyGraph( - prompt.output, - snapshot, - async (file) => { + deps = await generateDependencyGraph({ + workflow_api: prompt.output, + snapshot: snapshot, + computeFileHash: async (file) => { console.log(file); loadingDialog.showLoading("Generating hash", file); const hash = await fetch( @@ -361,7 +377,7 @@ function addButton() { console.log(hash); return hash.file_hash; }, - async (file, hash, prevhash) => { + handleFileUpload: async (file, hash, prevhash) => { console.log("Uploading ", file); loadingDialog.showLoading("Uploading file", file); try { @@ -388,8 +404,8 @@ function addButton() { return undefined; } }, - existing_workflow.dependencies, - ); + existingDependencies: existing_workflow.dependencies, + }); loadingDialog.close(); From 4c32248d865c5dc5f5d0963606fa43058a0a258d Mon Sep 17 00:00:00 2001 From: bennykok Date: Thu, 8 Feb 2024 23:09:38 +0800 Subject: [PATCH 6/7] fix: External Text Input default value not working --- comfy-nodes/external_text.py | 4 +--- web/src/server/createRun.ts | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/comfy-nodes/external_text.py b/comfy-nodes/external_text.py index 72f6617..057b620 100644 --- a/comfy-nodes/external_text.py +++ b/comfy-nodes/external_text.py @@ -29,9 +29,7 @@ class ComfyUIDeployExternalText: CATEGORY = "text" def run(self, input_id, default_value=None): - if not input_id or len(input_id.strip()) == 0: - return [default_value] - return [input_id] + return [default_value] NODE_CLASS_MAPPINGS = {"ComfyUIDeployExternalText": ComfyUIDeployExternalText} diff --git a/web/src/server/createRun.ts b/web/src/server/createRun.ts index 1a802a8..6a40511 100644 --- a/web/src/server/createRun.ts +++ b/web/src/server/createRun.ts @@ -91,6 +91,11 @@ export const createRun = withServerPromise( if (node.inputs["input_id"] === key) { node.inputs["input_id"] = inputs[key]; } + + // Fix for external text default value + if (node.class_type == "ComfyUIDeployExternalText") { + node.inputs["default_value"] = inputs[key]; + } }); } } From 1939ff4153d018d7d31ec1aa9941b6f0d5b12c98 Mon Sep 17 00:00:00 2001 From: San45600 <99272387+San45600@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:11:58 +0800 Subject: [PATCH 7/7] fix: mobile sheet ui fix (#20) --- web/src/components/Navbar.tsx | 8 ++++++-- web/src/components/NavbarMenu.tsx | 11 ++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/web/src/components/Navbar.tsx b/web/src/components/Navbar.tsx index 52be0c8..3bfe537 100644 --- a/web/src/components/Navbar.tsx +++ b/web/src/components/Navbar.tsx @@ -29,6 +29,7 @@ export function Navbar() { const { organization } = useOrganization(); const _isDesktop = useMediaQuery("(min-width: 1024px)"); const [isDesktop, setIsDesktop] = useState(true); + const [isSheetOpen, setSheetOpen] = useState(false); useEffect(() => { setIsDesktop(_isDesktop); }, [_isDesktop]); @@ -36,7 +37,7 @@ export function Navbar() { <>
{!isDesktop && ( - + setSheetOpen(open)}>