mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-15 03:27:24 +08:00
Fix restoring outputs with combinatorial batches
This commit is contained in:
parent
b185b9cac7
commit
a72722d471
@ -564,7 +564,7 @@ class PromptQueue:
|
|||||||
prompt = self.currently_running.pop(item_id)
|
prompt = self.currently_running.pop(item_id)
|
||||||
self.history[prompt[1]] = { "prompt": prompt, "outputs": {} }
|
self.history[prompt[1]] = { "prompt": prompt, "outputs": {} }
|
||||||
for o in outputs:
|
for o in outputs:
|
||||||
self.history[prompt[1]]["outputs"][o] = outputs[o]
|
self.history[prompt[1]]["outputs"][o] = outputs[o]
|
||||||
self.server.queue_updated()
|
self.server.queue_updated()
|
||||||
|
|
||||||
def get_current_queue(self):
|
def get_current_queue(self):
|
||||||
|
|||||||
@ -353,28 +353,34 @@ export class ComfyApp {
|
|||||||
|
|
||||||
node.prototype.onDrawBackground = function (ctx) {
|
node.prototype.onDrawBackground = function (ctx) {
|
||||||
if (!this.flags.collapsed) {
|
if (!this.flags.collapsed) {
|
||||||
const output = app.nodeOutputs[this.id + ""];
|
// Outputs returned by the frontend for each node are a list, one for each combinatorial batch run.
|
||||||
if (output && output.images) {
|
// With no combinatorial outputs, it's a list of length 1.
|
||||||
if (this.images !== output.images) {
|
// For now select only the first batch output.
|
||||||
this.images = output.images;
|
const batchOutputs = app.nodeOutputs[this.id + ""];
|
||||||
this.imgs = null;
|
if (batchOutputs && batchOutputs.length > 0) {
|
||||||
this.imageIndex = null;
|
const output = batchOutputs[0];
|
||||||
Promise.all(
|
if (output && output.images) {
|
||||||
output.images.map((src) => {
|
if (this.images !== output.images) {
|
||||||
return new Promise((r) => {
|
this.images = output.images;
|
||||||
const img = new Image();
|
this.imgs = null;
|
||||||
img.onload = () => r(img);
|
this.imageIndex = null;
|
||||||
img.onerror = () => r(null);
|
Promise.all(
|
||||||
img.src = "/view?" + new URLSearchParams(src).toString();
|
output.images.map((src) => {
|
||||||
});
|
return new Promise((r) => {
|
||||||
})
|
const img = new Image();
|
||||||
).then((imgs) => {
|
img.onload = () => r(img);
|
||||||
if (this.images === output.images) {
|
img.onerror = () => r(null);
|
||||||
this.imgs = imgs.filter(Boolean);
|
img.src = "/view?" + new URLSearchParams(src).toString();
|
||||||
this.setSizeForImage?.();
|
});
|
||||||
app.graph.setDirtyCanvas(true);
|
})
|
||||||
}
|
).then((imgs) => {
|
||||||
});
|
if (this.images === output.images) {
|
||||||
|
this.imgs = imgs.filter(Boolean);
|
||||||
|
this.setSizeForImage?.();
|
||||||
|
app.graph.setDirtyCanvas(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user