mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-21 23:47:06 +08:00
Save widget names in the workflow JSON
Currently, any external tooling will have a hard time converting workflow JSON files to the API format. The main reason is that widgets_values is an array and mapping values from that array to widget names requires loading node types from the object_info endpoint as well. However, object_info depends on the plugins installed and thus may miss some of the nodes in the workflow. This change adds widget_names to the JSON, allowing direct conversion of workflow files to API format without prior knowledge of all node types. This could also help with compatibility in the future. Resolves #2275
This commit is contained in:
parent
b249862080
commit
da4cb7125a
@ -2593,8 +2593,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.widgets && this.serialize_widgets) {
|
if (this.widgets && this.serialize_widgets) {
|
||||||
|
o.widgets_names = [];
|
||||||
o.widgets_values = [];
|
o.widgets_values = [];
|
||||||
for (var i = 0; i < this.widgets.length; ++i) {
|
for (var i = 0; i < this.widgets.length; ++i) {
|
||||||
|
o.widgets_names[i] = this.widgets[i].name;
|
||||||
if(this.widgets[i])
|
if(this.widgets[i])
|
||||||
o.widgets_values[i] = this.widgets[i].value;
|
o.widgets_values[i] = this.widgets[i].value;
|
||||||
else
|
else
|
||||||
|
|||||||
@ -13,6 +13,7 @@ export const defaultGraph = {
|
|||||||
inputs: [{ name: "clip", type: "CLIP", link: 5 }],
|
inputs: [{ name: "clip", type: "CLIP", link: 5 }],
|
||||||
outputs: [{ name: "CONDITIONING", type: "CONDITIONING", links: [6], slot_index: 0 }],
|
outputs: [{ name: "CONDITIONING", type: "CONDITIONING", links: [6], slot_index: 0 }],
|
||||||
properties: {},
|
properties: {},
|
||||||
|
widget_names: ["text"],
|
||||||
widgets_values: ["text, watermark"],
|
widgets_values: ["text, watermark"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -26,6 +27,7 @@ export const defaultGraph = {
|
|||||||
inputs: [{ name: "clip", type: "CLIP", link: 3 }],
|
inputs: [{ name: "clip", type: "CLIP", link: 3 }],
|
||||||
outputs: [{ name: "CONDITIONING", type: "CONDITIONING", links: [4], slot_index: 0 }],
|
outputs: [{ name: "CONDITIONING", type: "CONDITIONING", links: [4], slot_index: 0 }],
|
||||||
properties: {},
|
properties: {},
|
||||||
|
widget_names: ["text"],
|
||||||
widgets_values: ["beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"],
|
widgets_values: ["beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -38,6 +40,7 @@ export const defaultGraph = {
|
|||||||
mode: 0,
|
mode: 0,
|
||||||
outputs: [{ name: "LATENT", type: "LATENT", links: [2], slot_index: 0 }],
|
outputs: [{ name: "LATENT", type: "LATENT", links: [2], slot_index: 0 }],
|
||||||
properties: {},
|
properties: {},
|
||||||
|
widget_names: ["width","height","batch_size"],
|
||||||
widgets_values: [512, 512, 1],
|
widgets_values: [512, 512, 1],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -56,6 +59,7 @@ export const defaultGraph = {
|
|||||||
],
|
],
|
||||||
outputs: [{ name: "LATENT", type: "LATENT", links: [7], slot_index: 0 }],
|
outputs: [{ name: "LATENT", type: "LATENT", links: [7], slot_index: 0 }],
|
||||||
properties: {},
|
properties: {},
|
||||||
|
widget_names: ["seed","","steps","cfg","sampler_name","scheduler","denoise"],
|
||||||
widgets_values: [156680208700286, true, 20, 8, "euler", "normal", 1],
|
widgets_values: [156680208700286, true, 20, 8, "euler", "normal", 1],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -98,6 +102,7 @@ export const defaultGraph = {
|
|||||||
{ name: "VAE", type: "VAE", links: [8], slot_index: 2 },
|
{ name: "VAE", type: "VAE", links: [8], slot_index: 2 },
|
||||||
],
|
],
|
||||||
properties: {},
|
properties: {},
|
||||||
|
widget_names: ["ckpt_name"],
|
||||||
widgets_values: ["v1-5-pruned-emaonly.ckpt"],
|
widgets_values: ["v1-5-pruned-emaonly.ckpt"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
1
web/types/litegraph.d.ts
vendored
1
web/types/litegraph.d.ts
vendored
@ -588,6 +588,7 @@ export type SerializedLGraphNode<T extends LGraphNode = LGraphNode> = {
|
|||||||
outputs: T["outputs"];
|
outputs: T["outputs"];
|
||||||
title: T["title"];
|
title: T["title"];
|
||||||
properties: T["properties"];
|
properties: T["properties"];
|
||||||
|
widgets_names?: IWidget["name"][];
|
||||||
widgets_values?: IWidget["value"][];
|
widgets_values?: IWidget["value"][];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user