mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-10 13:32:36 +08:00
multiple workflows (combo version)
This commit is contained in:
parent
bc0360291f
commit
0d80c1f831
@ -1602,13 +1602,12 @@ export class ComfyApp {
|
||||
this.runningNodeId = null;
|
||||
}
|
||||
|
||||
switchWorkflow() {
|
||||
const workflow_count = 3;
|
||||
switchWorkflow(seleted_id) {
|
||||
const workflow_count = 5;
|
||||
|
||||
try {
|
||||
let current_workflow = "workflow_" + this.workflow_current_id;
|
||||
this.workflow_current_id += 1;
|
||||
this.workflow_current_id %= workflow_count;
|
||||
this.workflow_current_id = Math.min(Math.max(seleted_id, 0), workflow_count - 1);
|
||||
let next_workflow = "workflow_" + this.workflow_current_id;
|
||||
|
||||
localStorage.setItem("workflow_current_id", this.workflow_current_id);
|
||||
|
||||
@ -756,12 +756,19 @@ export class ComfyUI {
|
||||
}
|
||||
}
|
||||
}),
|
||||
$el("button", {
|
||||
id: "comfy-switch-workflow-button", textContent: "Workflow", onclick: () => {
|
||||
app.switchWorkflow();
|
||||
document.getElementById("comfy-switch-workflow-button").textContent = "Workflow " + app.workflow_current_id;
|
||||
$el("select", {
|
||||
id: "comfy-switch-workflow-combo", onchange: (event) => {
|
||||
app.switchWorkflow(event.target.selectedIndex);
|
||||
}
|
||||
}),
|
||||
},
|
||||
[
|
||||
$el("option", {value:'workflow_0'}, 'Workflow 0'),
|
||||
$el("option", {value:'workflow_1'}, 'Workflow 1'),
|
||||
$el("option", {value:'workflow_2'}, 'Workflow 2'),
|
||||
$el("option", {value:'workflow_3'}, 'Workflow 3'),
|
||||
$el("option", {value:'workflow_4'}, 'Workflow 4'),
|
||||
]
|
||||
),
|
||||
]);
|
||||
|
||||
const devMode = this.settings.addSetting({
|
||||
@ -779,9 +786,14 @@ export class ComfyUI {
|
||||
|
||||
setStatus(status) {
|
||||
this.queueSize.textContent = "Queue size: " + (status ? status.exec_info.queue_remaining : "ERR");
|
||||
const switch_btn = document.getElementById("comfy-switch-workflow-button");
|
||||
const switch_workflow_combo = document.getElementById("comfy-switch-workflow-combo");
|
||||
if (typeof app != "undefined") {
|
||||
// This assignment is actually only needed when launching the app.
|
||||
switch_workflow_combo.selectedIndex = app.workflow_current_id;
|
||||
}
|
||||
|
||||
if (status) {
|
||||
switch_btn.disabled = status.exec_info.queue_remaining ? true : false;
|
||||
switch_workflow_combo.disabled = status.exec_info.queue_remaining ? true : false;
|
||||
if (
|
||||
this.lastQueueSize != 0 &&
|
||||
status.exec_info.queue_remaining == 0 &&
|
||||
@ -792,7 +804,7 @@ export class ComfyUI {
|
||||
this.lastQueueSize = status.exec_info.queue_remaining;
|
||||
}
|
||||
else {
|
||||
switch_btn.disabled = false;
|
||||
switch_workflow_combo.disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,6 +102,7 @@ body {
|
||||
}
|
||||
|
||||
.comfy-menu button,
|
||||
.comfy-menu select,
|
||||
.comfy-modal button {
|
||||
font-size: 20px;
|
||||
}
|
||||
@ -117,11 +118,13 @@ body {
|
||||
color: var(--descrip-text) !important;
|
||||
}
|
||||
|
||||
.comfy-menu > button {
|
||||
.comfy-menu > button,
|
||||
.comfy-menu > select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.comfy-menu > button,
|
||||
.comfy-menu > select,
|
||||
.comfy-menu-btns button,
|
||||
.comfy-menu .comfy-list button,
|
||||
.comfy-modal button {
|
||||
@ -134,6 +137,7 @@ body {
|
||||
}
|
||||
|
||||
.comfy-menu > button:hover,
|
||||
.comfy-menu > select:hover,
|
||||
.comfy-menu-btns button:hover,
|
||||
.comfy-menu .comfy-list button:hover,
|
||||
.comfy-modal button:hover,
|
||||
@ -142,11 +146,15 @@ body {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button#comfy-switch-workflow-button:disabled {
|
||||
select#comfy-switch-workflow-combo:disabled {
|
||||
filter: brightness(1.0);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.comfy-menu select {
|
||||
text-align-last: center
|
||||
}
|
||||
|
||||
.comfy-menu span.drag-handle {
|
||||
width: 10px;
|
||||
height: 20px;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user