Don't save prompt to action node

Doesn't serialize due to cyclic structure
This commit is contained in:
space-nuko
2023-05-06 18:15:41 -05:00
parent 69905b5d19
commit 0cf675f847

View File

@@ -8,12 +8,10 @@ import { get } from "svelte/store";
import queueState from "$lib/stores/queueState"; import queueState from "$lib/stores/queueState";
export interface ComfyQueueEventsProperties extends Record<any, any> { export interface ComfyQueueEventsProperties extends Record<any, any> {
prompt: SerializedPrompt | null
} }
export class ComfyQueueEvents extends ComfyGraphNode { export class ComfyQueueEvents extends ComfyGraphNode {
override properties: ComfyQueueEventsProperties = { override properties: ComfyQueueEventsProperties = {
prompt: null
} }
static slotLayout: SlotLayout = { static slotLayout: SlotLayout = {
@@ -24,16 +22,6 @@ export class ComfyQueueEvents extends ComfyGraphNode {
], ],
} }
override onPropertyChanged(property: string, value: any, prevValue?: any) {
if (property === "prompt") {
this.setOutputData(2, value)
}
}
override onExecute() {
this.setOutputData(2, this.properties.prompt)
}
private getActionParams(subgraph: string | null): any { private getActionParams(subgraph: string | null): any {
let queue = get(queueState) let queue = get(queueState)
let remaining = 0; let remaining = 0;
@@ -48,18 +36,15 @@ export class ComfyQueueEvents extends ComfyGraphNode {
} }
override beforeQueued(subgraph: string | null) { override beforeQueued(subgraph: string | null) {
this.setProperty("prompt", null)
this.triggerSlot(0, this.getActionParams(subgraph)) this.triggerSlot(0, this.getActionParams(subgraph))
} }
override afterQueued(p: SerializedPrompt, subgraph: string | null) { override afterQueued(p: SerializedPrompt, subgraph: string | null) {
this.setProperty("prompt", p)
this.triggerSlot(1, this.getActionParams(subgraph)) this.triggerSlot(1, this.getActionParams(subgraph))
} }
override onSerialize(o: SerializedLGraphNode) { override onSerialize(o: SerializedLGraphNode) {
super.onSerialize(o) super.onSerialize(o)
o.properties = { prompt: null }
} }
} }