comfyanonymous / ComfyUI

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
https://www.comfy.org/
GNU General Public License v3.0
51.21k stars 5.39k forks source link

how to understand the schema of workflow(json)? #1681

Open xingren23 opened 11 months ago

xingren23 commented 11 months ago

When analyzing a JSON file of a workflow, I encountered an issue where I couldn't understand the meanings of various fields within the "widgets_values" array,eg KSampler Node,[156680208700286,"randomize",20,8, "euler", "normal",1]

              {
        id: 3,
        type: "KSampler",
        pos: [863, 186],
        size: { 0: 315, 1: 262 },
        flags: {},
        order: 4,
        mode: 0,
        inputs: [
            { name: "model", type: "MODEL", link: 1 },
            { name: "positive", type: "CONDITIONING", link: 4 },
            { name: "negative", type: "CONDITIONING", link: 6 },
            { name: "latent_image", type: "LATENT", link: 2 },
        ],
        outputs: [{ name: "LATENT", type: "LATENT", links: [7], slot_index: 0 }],
        properties: {},
        widgets_values: [156680208700286, "randomize", 20, 8, "euler", "normal", 1],
    },

i know, i could get node info from '/object_info' api, but how to mapping the widgets_values to input of node?

chrisgoringe commented 11 months ago

Unofficial, but I’ve recorded my understanding here https://github.com/chrisgoringe/Comfy-Custom-Node-How-To/wiki/js_internals_prompt