Update defaultGraph

This commit is contained in:
space-nuko
2023-05-08 15:15:59 -05:00
parent f823818674
commit ec6e0f17b1
6 changed files with 7257 additions and 4174 deletions

View File

@@ -21,7 +21,7 @@
import queueState from "$lib/stores/queueState";
import ComfyUnlockUIButton from "./ComfyUnlockUIButton.svelte";
import ComfyGraphView from "./ComfyGraphView.svelte";
import { download } from "$lib/utils";
import { download, jsonToJsObject } from "$lib/utils";
import notify from "$lib/notify";
export let app: ComfyApp = undefined;
@@ -142,6 +142,7 @@
app.saveStateToLocalStorage();
notify("Saved to local storage.")
console.debug(jsonToJsObject(JSON.stringify(app.serialize(), null, 2)))
//
// const date = new Date();
// const formattedDate = date.toISOString().replace(/:/g, '-').replace(/\.\d{3}/g, '').replace('T', '_').replace("Z", "");

View File

@@ -586,7 +586,6 @@ export default class ComfyApp {
}
// Remove inputs connected to removed nodes
console.debug("[graphToPrompt] before prune", JSON.stringify(output))
for (const nodeId in output) {
for (const inputName in output[nodeId].inputs) {
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(promptToGraphVis({ workflow, output }))

File diff suppressed because it is too large Load Diff

View File

@@ -382,6 +382,7 @@ export class ComfyComboNode extends ComfyWidgetNode<string> {
override svelteComponentType = ComboWidget
override defaultValue = "A";
override saveUserState = false;
comboRefreshed: Writable<boolean>;
@@ -540,6 +541,7 @@ export class ComfyGalleryNode extends ComfyWidgetNode<GradioFileData[]> {
override svelteComponentType = GalleryWidget
override defaultValue = []
override copyFromInputLink = false;
override saveUserState = false;
override outputIndex = null;
override changedIndex = null;

View File

@@ -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:");
});
}

View File

@@ -9,8 +9,8 @@
import type { ComfyGalleryNode } from "$lib/nodes/ComfyWidgetNodes";
import type { FileData as GradioFileData } from "@gradio/upload";
import type { SelectData as GradioSelectData } from "@gradio/utils";
import { clamp } from "$lib/utils";
import { f7 } from "framework7-svelte";
import { clamp } from "$lib/utils";
import { f7 } from "framework7-svelte";
export let widget: WidgetLayout | null = null;
export let isMobile: boolean = false;