1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-04 07:52:46 +08:00

Updated a1111 pnginfo importer, supports:

- model name, other basic settings
 - clip skip
 - hr upscale
 - loras
 - embeddings
This commit is contained in:
pythongosssss
2023-03-12 21:36:42 +00:00
parent 6d6758e9e4
commit 85989c74e5
4 changed files with 285 additions and 3 deletions

View File

@@ -2,7 +2,7 @@ import { ComfyWidgets } from "./widgets.js";
import { ComfyUI } from "./ui.js";
import { api } from "./api.js";
import { defaultGraph } from "./defaultGraph.js";
import { getPngMetadata } from "./pnginfo.js";
import { getPngMetadata, importA1111 } from "./pnginfo.js";
class ComfyApp {
constructor() {
@@ -675,8 +675,12 @@ class ComfyApp {
async handleFile(file) {
if (file.type === "image/png") {
const pngInfo = await getPngMetadata(file);
if (pngInfo && pngInfo.workflow) {
this.loadGraphData(JSON.parse(pngInfo.workflow));
if (pngInfo) {
if (pngInfo.workflow) {
this.loadGraphData(JSON.parse(pngInfo.workflow));
} else if (pngInfo.parameters) {
importA1111(this.graph, pngInfo.parameters);
}
}
} else if (file.type === "application/json" || file.name.endsWith(".json")) {
const reader = new FileReader();