Append to gallery if multiple prompts in queue

This commit is contained in:
space-nuko
2023-04-25 07:46:58 -07:00
parent b8f38e5281
commit 8dc8755403
2 changed files with 14 additions and 1 deletions

View File

@@ -32,7 +32,7 @@ class ComfyImageNode extends ComfyGraphNode {
let entry: ComfyGalleryEntry = [url + params, null] let entry: ComfyGalleryEntry = [url + params, null]
return entry return entry
}); });
this._galleryWidget.setValue(galleryItems) this._galleryWidget.addImages(galleryItems);
} }
} }

View File

@@ -1,6 +1,8 @@
import { get } from "svelte/store";
import type { WidgetPanelOptions } from "@litegraph-ts/core"; import type { WidgetPanelOptions } from "@litegraph-ts/core";
import ComfyWidget from "./ComfyWidget"; import ComfyWidget from "./ComfyWidget";
import type { ComfyImageResult } from "$lib/nodes/ComfySaveImageNode"; import type { ComfyImageResult } from "$lib/nodes/ComfySaveImageNode";
import queueState from "$lib/stores/queueState";
export type ComfyGalleryEntry = [string, string | null]; // <img> src and alt/title, gradio format export type ComfyGalleryEntry = [string, string | null]; // <img> src and alt/title, gradio format
@@ -10,4 +12,15 @@ export interface ComfyGalleryWidgetOptions extends WidgetPanelOptions {
export default class ComfyGalleryWidget extends ComfyWidget<ComfyGalleryWidgetOptions, ComfyGalleryEntry[]> { export default class ComfyGalleryWidget extends ComfyWidget<ComfyGalleryWidgetOptions, ComfyGalleryEntry[]> {
override type = "comfy/gallery"; override type = "comfy/gallery";
override isVirtual = true; override isVirtual = true;
addImages(images: ComfyImageResult[]) {
this.setValue(this.value.concat(images));
}
override afterQueued() {
let queue = get(queueState)
if (!(typeof queue.queueRemaining === "number" && queue.queueRemaining > 1)) {
this.setValue([])
}
}
} }