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); }, }),