mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-25 15:55:18 +00:00
Merge branch 'batch-count' of https://github.com/m957ymj75urz/ComfyUI
This commit is contained in:
commit
10bbf208c4
@ -662,31 +662,33 @@ class ComfyApp {
|
|||||||
return { workflow, output };
|
return { workflow, output };
|
||||||
}
|
}
|
||||||
|
|
||||||
async queuePrompt(number) {
|
async queuePrompt(number, batchCount = 1) {
|
||||||
const p = await this.graphToPrompt();
|
for (let i = 0; i < batchCount; i++) {
|
||||||
|
const p = await this.graphToPrompt();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await api.queuePrompt(number, p);
|
await api.queuePrompt(number, p);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.ui.dialog.show(error.response || error.toString());
|
this.ui.dialog.show(error.response || error.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const n of p.workflow.nodes) {
|
for (const n of p.workflow.nodes) {
|
||||||
const node = graph.getNodeById(n.id);
|
const node = graph.getNodeById(n.id);
|
||||||
if (node.widgets) {
|
if (node.widgets) {
|
||||||
for (const widget of node.widgets) {
|
for (const widget of node.widgets) {
|
||||||
// Allow widgets to run callbacks after a prompt has been queued
|
// Allow widgets to run callbacks after a prompt has been queued
|
||||||
// e.g. random seed after every gen
|
// e.g. random seed after every gen
|
||||||
if (widget.afterQueued) {
|
if (widget.afterQueued) {
|
||||||
widget.afterQueued();
|
widget.afterQueued();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
this.canvas.draw(true, true);
|
this.canvas.draw(true, true);
|
||||||
await this.ui.queue.update();
|
await this.ui.queue.update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,6 +231,7 @@ export class ComfyUI {
|
|||||||
this.dialog = new ComfyDialog();
|
this.dialog = new ComfyDialog();
|
||||||
this.settings = new ComfySettingsDialog();
|
this.settings = new ComfySettingsDialog();
|
||||||
|
|
||||||
|
this.batchCount = 1;
|
||||||
this.queue = new ComfyList("Queue");
|
this.queue = new ComfyList("Queue");
|
||||||
this.history = new ComfyList("History");
|
this.history = new ComfyList("History");
|
||||||
|
|
||||||
@ -254,9 +255,35 @@ export class ComfyUI {
|
|||||||
$el("span", { $: (q) => (this.queueSize = q) }),
|
$el("span", { $: (q) => (this.queueSize = q) }),
|
||||||
$el("button.comfy-settings-btn", { textContent: "⚙️", onclick: () => this.settings.show() }),
|
$el("button.comfy-settings-btn", { textContent: "⚙️", onclick: () => this.settings.show() }),
|
||||||
]),
|
]),
|
||||||
$el("button.comfy-queue-btn", { textContent: "Queue Prompt", onclick: () => app.queuePrompt(0) }),
|
$el("button.comfy-queue-btn", { textContent: "Queue Prompt", onclick: () => app.queuePrompt(0, this.batchCount) }),
|
||||||
|
$el("div", {}, [
|
||||||
|
$el("label", { innerHTML: "Extra options"}, [
|
||||||
|
$el("input", { type: "checkbox",
|
||||||
|
onchange: (i) => {
|
||||||
|
document.getElementById('extraOptions').style.visibility = i.srcElement.checked ? "visible" : "collapse";
|
||||||
|
this.batchCount = i.srcElement.checked ? document.getElementById('batchCountInputRange').value : 1;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
$el("div", { id: "extraOptions", style: { width: "100%", visibility: "collapse" }}, [
|
||||||
|
$el("label", { innerHTML: "Batch count" }, [
|
||||||
|
$el("input", { id: "batchCountInputNumber", type: "number", value: this.batchCount, min: "1", style: { width: "35%", "margin-left": "0.4em" },
|
||||||
|
oninput: (i) => {
|
||||||
|
this.batchCount = i.target.value;
|
||||||
|
document.getElementById('batchCountInputRange').value = this.batchCount;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
$el("input", { id: "batchCountInputRange", type: "range", min: "1", max: "100", value: this.batchCount,
|
||||||
|
oninput: (i) => {
|
||||||
|
this.batchCount = i.srcElement.value;
|
||||||
|
document.getElementById('batchCountInputNumber').value = i.srcElement.value;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
$el("div.comfy-menu-btns", [
|
$el("div.comfy-menu-btns", [
|
||||||
$el("button", { textContent: "Queue Front", onclick: () => app.queuePrompt(-1) }),
|
$el("button", { textContent: "Queue Front", onclick: () => app.queuePrompt(-1, this.batchCount) }),
|
||||||
$el("button", {
|
$el("button", {
|
||||||
$: (b) => (this.queue.button = b),
|
$: (b) => (this.queue.button = b),
|
||||||
textContent: "View Queue",
|
textContent: "View Queue",
|
||||||
|
Loading…
Reference in New Issue
Block a user