mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-22 12:07:00 +08:00
workflow saving/loading
This commit is contained in:
parent
b823baf2be
commit
ec3822b1f7
@ -58,16 +58,16 @@ class UserManager():
|
|||||||
if os.path.commonpath((root_dir, user_root)) != root_dir:
|
if os.path.commonpath((root_dir, user_root)) != root_dir:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
parent = user_root
|
|
||||||
|
|
||||||
if file is not None:
|
if file is not None:
|
||||||
# prevent leaving /{type}/{user}
|
# prevent leaving /{type}/{user}
|
||||||
path = os.path.abspath(os.path.join(user_root, file))
|
path = os.path.abspath(os.path.join(user_root, file))
|
||||||
if os.path.commonpath((user_root, path)) != user_root:
|
if os.path.commonpath((user_root, path)) != user_root:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
parent = os.path.split(path)[0]
|
||||||
|
|
||||||
if create_dir and not os.path.exists(parent):
|
if create_dir and not os.path.exists(parent):
|
||||||
os.mkdir(parent)
|
os.makedirs(parent, exist_ok=True)
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
@ -162,7 +162,12 @@ class UserManager():
|
|||||||
if not isinstance(path, str):
|
if not isinstance(path, str):
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
overwrite = request.query["overwrite"] != "false"
|
||||||
|
if not overwrite and os.path.exists(path):
|
||||||
|
return web.Response(status=409)
|
||||||
|
|
||||||
body = await request.read()
|
body = await request.read()
|
||||||
|
|
||||||
with open(path, "wb") as f:
|
with open(path, "wb") as f:
|
||||||
f.write(body)
|
f.write(body)
|
||||||
|
|
||||||
|
|||||||
@ -404,18 +404,19 @@ class ComfyApi extends EventTarget {
|
|||||||
* Stores a user data file for the current user
|
* Stores a user data file for the current user
|
||||||
* @param { string } file The name of the userdata file to save
|
* @param { string } file The name of the userdata file to save
|
||||||
* @param { unknown } data The data to save to the file
|
* @param { unknown } data The data to save to the file
|
||||||
* @param { RequestInit & { stringify?: boolean, throwOnError?: boolean } } [options]
|
* @param { RequestInit & { overwrite?: boolean, stringify?: boolean, throwOnError?: boolean } } [options]
|
||||||
* @returns { Promise<void> }
|
* @returns { Promise<Response> }
|
||||||
*/
|
*/
|
||||||
async storeUserData(file, data, options = { stringify: true, throwOnError: true }) {
|
async storeUserData(file, data, options = { overwrite: true, stringify: true, throwOnError: true }) {
|
||||||
const resp = await this.fetchApi(`/userdata/${encodeURIComponent(file)}`, {
|
const resp = await this.fetchApi(`/userdata/${encodeURIComponent(file)}?overwrite=${options?.overwrite}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: options?.stringify ? JSON.stringify(data) : data,
|
body: options?.stringify ? JSON.stringify(data) : data,
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
if (resp.status !== 200) {
|
if (resp.status !== 200 && options?.throwOnError !== false) {
|
||||||
throw new Error(`Error storing user data file '${file}': ${resp.status} ${(await resp).statusText}`);
|
throw new Error(`Error storing user data file '${file}': ${resp.status} ${(await resp).statusText}`);
|
||||||
}
|
}
|
||||||
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -40,6 +40,29 @@ export class ComfyApp {
|
|||||||
*/
|
*/
|
||||||
#processingQueue = false;
|
#processingQueue = false;
|
||||||
|
|
||||||
|
/** The name of the current workflow
|
||||||
|
* @type { string | null }
|
||||||
|
*/
|
||||||
|
#currentWorkflow = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Content Clipboard
|
||||||
|
* @type {serialized node object}
|
||||||
|
*/
|
||||||
|
static clipspace = null;
|
||||||
|
static clipspace_invalidate_handler = null;
|
||||||
|
static open_maskeditor = null;
|
||||||
|
static clipspace_return_node = null;
|
||||||
|
|
||||||
|
get currentWorkflow() {
|
||||||
|
return this.#currentWorkflow;
|
||||||
|
}
|
||||||
|
|
||||||
|
set currentWorkflow(value) {
|
||||||
|
this.#currentWorkflow = value ?? null;
|
||||||
|
api.dispatchEvent(new CustomEvent("workflowChanged", { detail: value ?? null }));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content Clipboard
|
* Content Clipboard
|
||||||
* @type {serialized node object}
|
* @type {serialized node object}
|
||||||
@ -1503,7 +1526,8 @@ export class ComfyApp {
|
|||||||
const loadWorkflow = async (json) => {
|
const loadWorkflow = async (json) => {
|
||||||
if (json) {
|
if (json) {
|
||||||
const workflow = JSON.parse(json);
|
const workflow = JSON.parse(json);
|
||||||
await this.loadGraphData(workflow);
|
const workflowName = localStorage.getItem("Comfy.LastWorkflow");
|
||||||
|
await this.loadGraphData(workflow, true, workflowName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1725,12 +1749,13 @@ export class ComfyApp {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the graph with the specified workflow data
|
* Populates the graph with the specified workflow data
|
||||||
* @param {*} graphData A serialized graph object
|
* @param {*} graphData A serialized graph object
|
||||||
* @param { boolean } clean If the graph state, e.g. images, should be cleared
|
* @param { boolean } clean If the graph state, e.g. images, should be cleared
|
||||||
|
* @param { string } name The name of the workflow
|
||||||
*/
|
*/
|
||||||
async loadGraphData(graphData, clean = true, keepOld = false) {
|
async loadGraphData(graphData, clean = true, name = null) {
|
||||||
if (clean !== false) {
|
if (clean !== false) {
|
||||||
this.clean();
|
this.clean();
|
||||||
}
|
}
|
||||||
@ -1749,6 +1774,9 @@ export class ComfyApp {
|
|||||||
graphData = structuredClone(graphData);
|
graphData = structuredClone(graphData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.currentWorkflow = name;
|
||||||
|
localStorage.setItem("Comfy.LastWorkflow", name ?? "");
|
||||||
|
|
||||||
const missingNodeTypes = [];
|
const missingNodeTypes = [];
|
||||||
await this.#invokeExtensionsAsync("beforeConfigureGraph", graphData, missingNodeTypes);
|
await this.#invokeExtensionsAsync("beforeConfigureGraph", graphData, missingNodeTypes);
|
||||||
for (let n of graphData.nodes) {
|
for (let n of graphData.nodes) {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
import { $el } from "../../ui.js";
|
import { $el } from "../../ui.js";
|
||||||
|
import { api } from "../../api.js";
|
||||||
import { addStylesheet, downloadBlob } from "../../utils.js";
|
import { addStylesheet, downloadBlob } from "../../utils.js";
|
||||||
import { ComfyButton } from "../components/button.js";
|
import { ComfyButton } from "../components/button.js";
|
||||||
import { ComfyButtonGroup } from "../components/buttonGroup.js";
|
import { ComfyButtonGroup } from "../components/buttonGroup.js";
|
||||||
@ -29,16 +30,16 @@ export class ComfyAppMenu {
|
|||||||
constructor(app) {
|
constructor(app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
|
this.workflows = new ComfyWorkflowsMenu(app);
|
||||||
const getSaveButton = (t) =>
|
const getSaveButton = (t) =>
|
||||||
new ComfyButton({
|
new ComfyButton({
|
||||||
icon: "content-save",
|
icon: "content-save",
|
||||||
tooltip: "Save the current workflow",
|
tooltip: "Save the current workflow",
|
||||||
action: () => this.exportWorkflow("workflow", "workflow"),
|
action: () => this.workflows.save(),
|
||||||
content: t,
|
content: t,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.logo = $el("h1.comfyui-logo.sm-hide", { title: "ComfyUI" }, "ComfyUI");
|
this.logo = $el("h1.comfyui-logo.sm-hide", { title: "ComfyUI" }, "ComfyUI");
|
||||||
this.workflows = new ComfyWorkflowsMenu(app);
|
|
||||||
this.element = $el("nav.comfyui-menu", { parent: document.body }, [
|
this.element = $el("nav.comfyui-menu", { parent: document.body }, [
|
||||||
this.logo,
|
this.logo,
|
||||||
this.workflows.element,
|
this.workflows.element,
|
||||||
@ -52,15 +53,7 @@ export class ComfyAppMenu {
|
|||||||
icon: "content-save-edit",
|
icon: "content-save-edit",
|
||||||
content: "Save As",
|
content: "Save As",
|
||||||
tooltip: "Save the current graph as a new workflow",
|
tooltip: "Save the current graph as a new workflow",
|
||||||
action: () => {
|
action: () => this.workflows.save(true),
|
||||||
let filename = prompt("Save workflow as:", "workflow");
|
|
||||||
if (!filename) return;
|
|
||||||
if (!filename.toLowerCase().endsWith(".json")) {
|
|
||||||
filename += ".json";
|
|
||||||
}
|
|
||||||
|
|
||||||
this.exportWorkflow("workflow", "workflow");
|
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
new ComfyButton({
|
new ComfyButton({
|
||||||
icon: "download",
|
icon: "download",
|
||||||
|
|||||||
@ -250,7 +250,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 490px) {
|
@media only screen and (max-width: 520px) {
|
||||||
.comfyui-workflows-label {
|
.comfyui-workflows-label {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@ -272,6 +272,7 @@
|
|||||||
/* Workflows */
|
/* Workflows */
|
||||||
.comfyui-workflows-button {
|
.comfyui-workflows-button {
|
||||||
flex-direction: row-reverse;
|
flex-direction: row-reverse;
|
||||||
|
max-width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-workflows-button.popup-open {
|
.comfyui-workflows-button.popup-open {
|
||||||
@ -282,16 +283,34 @@
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-workflows-button.unsaved .comfyui-workflows-label:after {
|
.comfyui-workflows-button>span {
|
||||||
content: "*";
|
flex: auto;
|
||||||
|
text-align: left;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-workflows-button-inner {
|
.comfyui-workflows-button-inner {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 7px;
|
gap: 7px;
|
||||||
}
|
}
|
||||||
|
.comfyui-workflows-label {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
direction: rtl;
|
||||||
|
flex: auto;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comfyui-workflows-button.unsaved .comfyui-workflows-label {
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comfyui-workflows-button.unsaved .comfyui-workflows-label:after {
|
||||||
|
content: "*";
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
.comfyui-workflows-button-inner .mdi-graph::before {
|
.comfyui-workflows-button-inner .mdi-graph::before {
|
||||||
transform: rotate(-90deg);
|
transform: rotate(-90deg);
|
||||||
}
|
}
|
||||||
@ -307,6 +326,16 @@
|
|||||||
border-bottom-left-radius: 4px;
|
border-bottom-left-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.comfyui-workflows-panel {
|
||||||
|
min-height: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comfyui-workflows-panel .lds-ring {
|
||||||
|
transform: translate(-50%);
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 75px;
|
||||||
|
}
|
||||||
.comfyui-workflows-actions {
|
.comfyui-workflows-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
@ -335,17 +364,21 @@
|
|||||||
.comfyui-workflows-tree {
|
.comfyui-workflows-tree {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
margin-bottom: 0;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.comfyui-workflows-tree:empty::after {
|
||||||
|
content: "No saved workflows";
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
.comfyui-workflows-tree>ul {
|
.comfyui-workflows-tree>ul {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-workflows-tree>ul ul {
|
.comfyui-workflows-tree>ul ul {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0 0 0 30px;
|
padding: 0 0 0 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-workflows-tree .closed>ul {
|
.comfyui-workflows-tree .closed>ul {
|
||||||
|
|||||||
@ -5,6 +5,11 @@ import { prop } from "../../utils.js";
|
|||||||
import { $el } from "../../ui.js";
|
import { $el } from "../../ui.js";
|
||||||
import { api } from "../../api.js";
|
import { api } from "../../api.js";
|
||||||
import { ComfyPopup } from "../components/popup.js";
|
import { ComfyPopup } from "../components/popup.js";
|
||||||
|
import { createSpinner } from "../spinner.js";
|
||||||
|
|
||||||
|
function trimJsonExt(name) {
|
||||||
|
return name.replace(/\.json$/, "");
|
||||||
|
}
|
||||||
|
|
||||||
export class ComfyWorkflowsMenu {
|
export class ComfyWorkflowsMenu {
|
||||||
element = $el("div.comfyui-workflows");
|
element = $el("div.comfyui-workflows");
|
||||||
@ -18,13 +23,39 @@ export class ComfyWorkflowsMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(app) {
|
constructor(app) {
|
||||||
|
this.app = app;
|
||||||
|
|
||||||
|
let ignoreChange = false;
|
||||||
|
let first = true;
|
||||||
|
api.addEventListener("workflowChanged", ({ detail }) => {
|
||||||
|
if (detail) {
|
||||||
|
this.unsaved = first ? localStorage.getItem("Comfy.LastWorkflowUnsaved") === "true" : false;
|
||||||
|
this.currentWorkflow = detail;
|
||||||
|
} else {
|
||||||
|
this.unsaved = true;
|
||||||
|
this.currentWorkflow = "Unsaved workflow";
|
||||||
|
}
|
||||||
|
first = false;
|
||||||
|
ignoreChange = true;
|
||||||
|
setTimeout(() => (ignoreChange = false), 5);
|
||||||
|
});
|
||||||
|
|
||||||
|
api.addEventListener("graphChanged", () => {
|
||||||
|
if (ignoreChange) {
|
||||||
|
ignoreChange = false;
|
||||||
|
} else {
|
||||||
|
this.unsaved = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const classList = {
|
const classList = {
|
||||||
"comfyui-workflows-button": true,
|
"comfyui-workflows-button": true,
|
||||||
"comfyui-button": true,
|
"comfyui-button": true,
|
||||||
unsaved: true,
|
unsaved: false,
|
||||||
};
|
};
|
||||||
|
this.workflowLabel = $el("span.comfyui-workflows-label", "Unsaved workflow");
|
||||||
this.button = new ComfyButton({
|
this.button = new ComfyButton({
|
||||||
content: $el("div.comfyui-workflows-button-inner", [$el("i.mdi.mdi-graph"), $el("span.comfyui-workflows-label", "Unsaved workflow")]),
|
content: $el("div.comfyui-workflows-button-inner", [$el("i.mdi.mdi-graph"), this.workflowLabel]),
|
||||||
icon: "chevron-down",
|
icon: "chevron-down",
|
||||||
classList,
|
classList,
|
||||||
});
|
});
|
||||||
@ -41,11 +72,48 @@ export class ComfyWorkflowsMenu {
|
|||||||
this.unsaved = prop(this, "unsaved", classList.unsaved, (v) => {
|
this.unsaved = prop(this, "unsaved", classList.unsaved, (v) => {
|
||||||
classList.unsaved = v;
|
classList.unsaved = v;
|
||||||
this.button.classList = classList;
|
this.button.classList = classList;
|
||||||
|
if (!first) {
|
||||||
|
localStorage.setItem("Comfy.LastWorkflowUnsaved", v);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
this.currentWorkflow = prop(this, "currentWorkflow", "", () => {
|
||||||
|
this.button.element.title = this.workflowLabel.textContent = trimJsonExt(this.currentWorkflow);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
save(saveAs) {
|
||||||
this.popup.open = true;
|
if (!saveAs && this.app.currentWorkflow) {
|
||||||
}, 500);
|
this.#saveWorkflow(this.app.currentWorkflow);
|
||||||
|
} else {
|
||||||
|
this.#saveWorkflow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} [filename]
|
||||||
|
*/
|
||||||
|
async #saveWorkflow(filename) {
|
||||||
|
let overwrite = true;
|
||||||
|
if (!filename) {
|
||||||
|
overwrite = false;
|
||||||
|
filename = prompt("Save workflow as:", this.app.currentWorkflow || "workflow");
|
||||||
|
if (!filename) return;
|
||||||
|
if (!filename.toLowerCase().endsWith(".json")) {
|
||||||
|
filename += ".json";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const p = await this.app.graphToPrompt();
|
||||||
|
const json = JSON.stringify(p.workflow, null, 2);
|
||||||
|
const res = await api.storeUserData("workflows/" + filename, json, { stringify: false, throwOnError: false, overwrite });
|
||||||
|
if (res.status === 409) {
|
||||||
|
if (!confirm(`Workflow '${filename}' already exists, do you want to overwrite it?`)) return;
|
||||||
|
await api.storeUserData("workflows/" + filename, json, { stringify: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
this.unsaved = false;
|
||||||
|
this.app.currentWorkflow = filename;
|
||||||
|
localStorage.setItem("Comfy.LastWorkflow", filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,10 +127,30 @@ export class ComfyWorkflowsContent {
|
|||||||
this.app = app;
|
this.app = app;
|
||||||
this.popup = popup;
|
this.popup = popup;
|
||||||
this.actions = $el("div.comfyui-workflows-actions", [
|
this.actions = $el("div.comfyui-workflows-actions", [
|
||||||
new ComfyButton({ content: "New Workflow", icon: "plus" }).element,
|
new ComfyButton({
|
||||||
new ComfyButton({ content: "Load Default" }).element,
|
content: "New Workflow",
|
||||||
|
icon: "plus",
|
||||||
|
action: () => {
|
||||||
|
app.currentWorkflow = null;
|
||||||
|
app.clean();
|
||||||
|
app.graph.clear();
|
||||||
|
popup.open = false;
|
||||||
|
},
|
||||||
|
}).element,
|
||||||
|
new ComfyButton({
|
||||||
|
content: "Load Default",
|
||||||
|
action: () => {
|
||||||
|
popup.open = false;
|
||||||
|
app.loadGraphData();
|
||||||
|
},
|
||||||
|
}).element,
|
||||||
]);
|
]);
|
||||||
this.load();
|
|
||||||
|
this.spinner = createSpinner();
|
||||||
|
this.element.replaceChildren(this.actions, this.spinner);
|
||||||
|
|
||||||
|
this.popup.addEventListener("open", () => this.load());
|
||||||
|
this.popup.addEventListener("close", () => this.element.replaceChildren(this.actions, this.spinner));
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadWorkflowsInfo() {
|
async loadWorkflowsInfo() {
|
||||||
@ -93,8 +181,10 @@ export class ComfyWorkflowsContent {
|
|||||||
|
|
||||||
this.favoritesElement = $el(
|
this.favoritesElement = $el(
|
||||||
"div.comfyui-workflows-favorites",
|
"div.comfyui-workflows-favorites",
|
||||||
favorites.map((f) => {
|
favorites
|
||||||
|
.map((f) => {
|
||||||
const entry = this.#fileLookup[f];
|
const entry = this.#fileLookup[f];
|
||||||
|
if (!entry) return null;
|
||||||
const res = new FileNode(
|
const res = new FileNode(
|
||||||
this,
|
this,
|
||||||
entry.path,
|
entry.path,
|
||||||
@ -113,6 +203,7 @@ export class ComfyWorkflowsContent {
|
|||||||
);
|
);
|
||||||
return res.element;
|
return res.element;
|
||||||
})
|
})
|
||||||
|
.filter(Boolean)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (current) {
|
if (current) {
|
||||||
@ -239,7 +330,7 @@ class FileNode {
|
|||||||
this.parent.favorites.delete(this.path);
|
this.parent.favorites.delete(this.path);
|
||||||
await this.parent.storeWorkflowsInfo();
|
await this.parent.storeWorkflowsInfo();
|
||||||
}
|
}
|
||||||
// await api.deleteUserData(fileName);
|
await api.deleteUserData(fileName);
|
||||||
this.remove();
|
this.remove();
|
||||||
} else {
|
} else {
|
||||||
btn.icon = "delete-empty";
|
btn.icon = "delete-empty";
|
||||||
@ -252,7 +343,7 @@ class FileNode {
|
|||||||
deleteButton.element.style.removeProperty("background");
|
deleteButton.element.style.removeProperty("background");
|
||||||
});
|
});
|
||||||
|
|
||||||
const loadWorkflow = async (e, insert) => {
|
const loadWorkflow = async (e) => {
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
const resp = await api.getUserData(fileName);
|
const resp = await api.getUserData(fileName);
|
||||||
if (resp.status !== 200) {
|
if (resp.status !== 200) {
|
||||||
@ -260,16 +351,16 @@ class FileNode {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const data = await resp.json();
|
const data = await resp.json();
|
||||||
// TODO: fix insert, LiteGraph has a dont clear parameter but it doesnt fix duplicate ids
|
await this.parent.app.loadGraphData(data, true, this.path);
|
||||||
await this.parent.app.loadGraphData(data, !insert, insert);
|
|
||||||
this.parent.popup.open = false;
|
this.parent.popup.open = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const name = this.part.replace(/\.json$/, "");
|
const name = trimJsonExt(this.part);
|
||||||
this.element = $el(
|
this.element = $el(
|
||||||
tagName + ".comfyui-workflows-tree-file",
|
tagName + ".comfyui-workflows-tree-file",
|
||||||
{
|
{
|
||||||
onclick: (e) => loadWorkflow(e, false),
|
onclick: (e) => loadWorkflow(e),
|
||||||
|
title: this.path,
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
this.nodeIcon,
|
this.nodeIcon,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user