Update defaultGraph
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
import queueState from "$lib/stores/queueState";
|
import queueState from "$lib/stores/queueState";
|
||||||
import ComfyUnlockUIButton from "./ComfyUnlockUIButton.svelte";
|
import ComfyUnlockUIButton from "./ComfyUnlockUIButton.svelte";
|
||||||
import ComfyGraphView from "./ComfyGraphView.svelte";
|
import ComfyGraphView from "./ComfyGraphView.svelte";
|
||||||
import { download } from "$lib/utils";
|
import { download, jsonToJsObject } from "$lib/utils";
|
||||||
import notify from "$lib/notify";
|
import notify from "$lib/notify";
|
||||||
|
|
||||||
export let app: ComfyApp = undefined;
|
export let app: ComfyApp = undefined;
|
||||||
@@ -142,6 +142,7 @@
|
|||||||
|
|
||||||
app.saveStateToLocalStorage();
|
app.saveStateToLocalStorage();
|
||||||
notify("Saved to local storage.")
|
notify("Saved to local storage.")
|
||||||
|
console.debug(jsonToJsObject(JSON.stringify(app.serialize(), null, 2)))
|
||||||
//
|
//
|
||||||
// const date = new Date();
|
// const date = new Date();
|
||||||
// const formattedDate = date.toISOString().replace(/:/g, '-').replace(/\.\d{3}/g, '').replace('T', '_').replace("Z", "");
|
// const formattedDate = date.toISOString().replace(/:/g, '-').replace(/\.\d{3}/g, '').replace('T', '_').replace("Z", "");
|
||||||
|
|||||||
@@ -586,7 +586,6 @@ export default class ComfyApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove inputs connected to removed nodes
|
// Remove inputs connected to removed nodes
|
||||||
console.debug("[graphToPrompt] before prune", JSON.stringify(output))
|
|
||||||
for (const nodeId in output) {
|
for (const nodeId in output) {
|
||||||
for (const inputName in output[nodeId].inputs) {
|
for (const inputName in output[nodeId].inputs) {
|
||||||
if (Array.isArray(output[nodeId].inputs[inputName])
|
if (Array.isArray(output[nodeId].inputs[inputName])
|
||||||
@@ -598,7 +597,6 @@ export default class ComfyApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.debug("[graphToPrompt] after prune", JSON.stringify(output))
|
|
||||||
// console.debug({ workflow, output })
|
// console.debug({ workflow, output })
|
||||||
// console.debug(promptToGraphVis({ workflow, output }))
|
// console.debug(promptToGraphVis({ workflow, output }))
|
||||||
|
|
||||||
|
|||||||
11406
src/lib/defaultGraph.ts
11406
src/lib/defaultGraph.ts
File diff suppressed because it is too large
Load Diff
@@ -382,6 +382,7 @@ export class ComfyComboNode extends ComfyWidgetNode<string> {
|
|||||||
|
|
||||||
override svelteComponentType = ComboWidget
|
override svelteComponentType = ComboWidget
|
||||||
override defaultValue = "A";
|
override defaultValue = "A";
|
||||||
|
override saveUserState = false;
|
||||||
|
|
||||||
comboRefreshed: Writable<boolean>;
|
comboRefreshed: Writable<boolean>;
|
||||||
|
|
||||||
@@ -540,6 +541,7 @@ export class ComfyGalleryNode extends ComfyWidgetNode<GradioFileData[]> {
|
|||||||
override svelteComponentType = GalleryWidget
|
override svelteComponentType = GalleryWidget
|
||||||
override defaultValue = []
|
override defaultValue = []
|
||||||
override copyFromInputLink = false;
|
override copyFromInputLink = false;
|
||||||
|
override saveUserState = false;
|
||||||
override outputIndex = null;
|
override outputIndex = null;
|
||||||
override changedIndex = null;
|
override changedIndex = null;
|
||||||
|
|
||||||
|
|||||||
@@ -131,3 +131,17 @@ export function convertComfyOutputToGradio(output: GalleryOutput): GradioFileDat
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function jsonToJsObject(json: string): string {
|
||||||
|
// Try to parse, to see if it's real JSON
|
||||||
|
JSON.parse(json);
|
||||||
|
|
||||||
|
const regex = /\"([^"]+)\":/g;
|
||||||
|
const hyphenRegex = /-([a-z])/g;
|
||||||
|
|
||||||
|
return json.replace(regex, match => {
|
||||||
|
return match
|
||||||
|
.replace(hyphenRegex, g => g[1].toUpperCase())
|
||||||
|
.replace(regex, "$1:");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
import type { ComfyGalleryNode } from "$lib/nodes/ComfyWidgetNodes";
|
import type { ComfyGalleryNode } from "$lib/nodes/ComfyWidgetNodes";
|
||||||
import type { FileData as GradioFileData } from "@gradio/upload";
|
import type { FileData as GradioFileData } from "@gradio/upload";
|
||||||
import type { SelectData as GradioSelectData } from "@gradio/utils";
|
import type { SelectData as GradioSelectData } from "@gradio/utils";
|
||||||
import { clamp } from "$lib/utils";
|
import { clamp } from "$lib/utils";
|
||||||
import { f7 } from "framework7-svelte";
|
import { f7 } from "framework7-svelte";
|
||||||
|
|
||||||
export let widget: WidgetLayout | null = null;
|
export let widget: WidgetLayout | null = null;
|
||||||
export let isMobile: boolean = false;
|
export let isMobile: boolean = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user