From 07dab962da9e3c50cc29a4ea14db618b0a7db0a4 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 19 Mar 2023 00:03:18 -0400 Subject: [PATCH] Add an auto queue checkbox. This will auto queue the current prompt when the queue hits zero. --- web/scripts/ui.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web/scripts/ui.js b/web/scripts/ui.js index c056371e..51f9b52c 100644 --- a/web/scripts/ui.js +++ b/web/scripts/ui.js @@ -232,6 +232,7 @@ export class ComfyUI { this.settings = new ComfySettingsDialog(); this.batchCount = 1; + this.lastQueueSize = 0; this.queue = new ComfyList("Queue"); this.history = new ComfyList("History"); @@ -262,6 +263,7 @@ export class ComfyUI { onchange: (i) => { document.getElementById('extraOptions').style.display = i.srcElement.checked ? "block" : "none"; this.batchCount = i.srcElement.checked ? document.getElementById('batchCountInputRange').value : 1; + document.getElementById('autoQueueCheckbox').checked = false; } }) ]) @@ -280,6 +282,8 @@ export class ComfyUI { document.getElementById('batchCountInputNumber').value = i.srcElement.value; } }), + $el("input", { id: "autoQueueCheckbox", type: "checkbox", checked: false, title: "automatically queue prompt when the queue size hits 0", + }) ]), ]), $el("div.comfy-menu-btns", [ @@ -332,5 +336,11 @@ export class ComfyUI { setStatus(status) { this.queueSize.textContent = "Queue size: " + (status ? status.exec_info.queue_remaining : "ERR"); + if (status) { + if (this.lastQueueSize != 0 && status.exec_info.queue_remaining == 0 && document.getElementById('autoQueueCheckbox').checked) { + app.queuePrompt(0, this.batchCount); + } + this.lastQueueSize = status.exec_info.queue_remaining + } } }