Basic vanilla workflow converter

This commit is contained in:
space-nuko
2023-05-21 14:11:12 -05:00
parent c3ab3aa69a
commit cad8b420f6
9 changed files with 329 additions and 86 deletions

View File

@@ -15,6 +15,11 @@ export type AutoConfigOptions = {
setWidgetTitle?: boolean
}
export type SerializedComfyWidgetNode = {
comfyValue?: any
shownOutputProperties?: ComfyWidgetNode["shownOutputProperties"]
} & SerializedLGraphNode
/*
* NOTE: If you want to add a new widget but it has the same input/output type
* as another one of the existing widgets, best to create a new "variant" of
@@ -35,6 +40,11 @@ export interface ComfyWidgetProperties extends ComfyGraphNodeProperties {
defaultValue: any
}
export type ShownOutputProperty = {
type: string,
outputName: string
}
/*
* A node that is tied to a UI widget in the frontend. When the frontend's
* widget is changed, the value of the first output in the node is updated
@@ -72,7 +82,7 @@ export default abstract class ComfyWidgetNode<T = any> extends ComfyGraphNode {
// shownInputProperties: string[] = []
/** Names of properties to add as outputs */
private shownOutputProperties: Record<string, { type: string, outputName: string }> = {}
private shownOutputProperties: Record<string, ShownOutputProperty> = {}
outputProperties: { name: string, type: string }[] = []
override isBackendNode = false;
@@ -328,7 +338,7 @@ export default abstract class ComfyWidgetNode<T = any> extends ComfyGraphNode {
clampOneConfig(input: IComfyInputSlot) { }
override onSerialize(o: SerializedLGraphNode) {
override onSerialize(o: SerializedComfyWidgetNode) {
(o as any).comfyValue = get(this.value);
(o as any).shownOutputProperties = this.shownOutputProperties
super.onSerialize(o);