Don't serialize huge prompts

This commit is contained in:
space-nuko
2023-05-04 20:55:48 -05:00
parent df0a93ecb0
commit 70efb85a3f
3 changed files with 3303 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
import { LiteGraph, type ContextMenuItem, type LGraphNode, type Vector2, LConnectionKind, LLink, LGraphCanvas, type SlotType, TitleMode, type SlotLayout, BuiltInSlotType, type ITextWidget } from "@litegraph-ts/core";
import { LiteGraph, type ContextMenuItem, type LGraphNode, type Vector2, LConnectionKind, LLink, LGraphCanvas, type SlotType, TitleMode, type SlotLayout, BuiltInSlotType, type ITextWidget, type SerializedLGraphNode } from "@litegraph-ts/core";
import ComfyGraphNode from "./ComfyGraphNode";
import { Watch } from "@litegraph-ts/nodes-basic";
import type { SerializedPrompt } from "$lib/components/ComfyApp";
@@ -33,6 +33,11 @@ export class ComfyAfterQueuedAction extends ComfyGraphNode {
this.setProperty("value", p)
this.triggerSlot(0, "bang")
}
override onSerialize(o: SerializedLGraphNode) {
super.onSerialize(o)
o.properties = { prompt: null }
}
}
LiteGraph.registerNodeType({

View File

@@ -33,7 +33,8 @@ export default class ComfyGraphNode extends LGraphNode {
const ty = Object.values(LiteGraph.registered_node_types)
.find(v => v.class === widgetNode)
if (ty)
(serInput as any).widgetNodeType = ty.type
(serInput as any).widgetNodeType = ty.type;
(serInput as any).defaultWidgetNode = null
}
}
}