File size: 1,082 Bytes
6fecfbe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { app } from "../../scripts/app.js";
import { ComfyDialog, $el } from "../../scripts/ui.js";


$el("button", {
    id: "vyro-save-button",
    textContent: "Vyro Save",
    onclick: () => {
        let filename = "workflow.json";
        if (promptFilename.value) {
            filename = prompt("Save Vyro workflow as:", filename);
            if (!filename) return;
            if (!filename.toLowerCase().endsWith(".json")) {
                filename += ".json";
            }
        }
        const extra_data = JSON.stringify(app.graph.serialize(), null, 2); // convert the data to a JSON string
        const p = await app.graphToPrompt()
        const blob = new Blob([json], {type: "application/json"});
        const url = URL.createObjectURL(blob);
        const a = $el("a", {
            href: url,
            download: filename,
            style: {display: "none"},
            parent: document.body,
        });
        a.click();
        setTimeout(function () {
            a.remove();
            window.URL.revokeObjectURL(url);
        }, 0);
    },
}),