More region widget fixes

This commit is contained in:
space-nuko
2023-05-23 17:29:33 -05:00
parent e3c73ce18a
commit a3d4e4bca7
8 changed files with 68 additions and 23 deletions

View File

@@ -356,6 +356,24 @@ export default class ComfyApp {
ComfyApp.registerDefaultSlotHandlers(nodeId, nodeDef)
}
ComfyApp.registerComfyBoxSlotTypes()
}
static registerComfyBoxSlotTypes() {
const reg = (type: string) => {
const lowerType = type.toLowerCase();
if (!LiteGraph.slot_types_in.includes(lowerType)) {
LiteGraph.slot_types_in.push(lowerType);
}
if (!LiteGraph.slot_types_out.includes(type)) {
LiteGraph.slot_types_out.push(type);
}
}
reg("COMFYBOX_IMAGE")
reg("COMFYBOX_IMAGES")
reg("COMFYBOX_REGION")
}
static registerDefaultSlotHandlers(nodeId: string, nodeDef: ComfyNodeDef) {
@@ -771,7 +789,9 @@ export default class ComfyApp {
const promptFilename = get(configState).promptForWorkflowName;
let filename = "workflow.json";
const title = workflow.attrs.title.trim() || "workflow"
let filename = `${title}.json`;
if (promptFilename) {
filename = prompt("Save workflow as:", filename);
if (!filename) return;
@@ -782,7 +802,7 @@ export default class ComfyApp {
else {
const date = new Date();
const formattedDate = date.toISOString().replace(/:/g, '-').replace(/\.\d{3}/g, '').replace('T', '_').replace("Z", "");
filename = `workflow - ${formattedDate}.json`
filename = `${title} - ${formattedDate}.json`
}
const indent = 2

View File

@@ -150,7 +150,7 @@
let submessage = `Nodes: ${Object.keys(entry.prompt).length}`
if (Object.keys(entry.outputs).length > 0) {
const imageCount = Object.values(entry.outputs).flatMap(o => o.images).length
const imageCount = Object.values(entry.outputs).filter(o => o.images).flatMap(o => o.images).length
submessage = `Images: ${imageCount}`
}
@@ -172,14 +172,24 @@
result.images = thumbnails.map(convertComfyOutputToComfyURL);
}
const outputs = Object.values(entry.outputs)
.filter(o => o.images)
.flatMap(o => o.images)
.map(convertComfyOutputToComfyURL);
if (outputs) {
result.images = result.images.concat(outputs)
}
return result;
}
function convertCompletedEntry(entry: CompletedQueueEntry): QueueUIEntry {
const result = convertEntry(entry.entry, entry.status);
const images = Object.values(entry.entry.outputs).flatMap(o => o.images)
.map(convertComfyOutputToComfyURL);
const images = Object.values(entry.entry.outputs)
.filter(o => o.images)
.flatMap(o => o.images)
.map(convertComfyOutputToComfyURL);
result.images = images
if (entry.message)

View File

@@ -15,6 +15,7 @@
export let label: string;
export let root: string = "";
export let root_url: null | string = null;
export let scrollOnUpdate = false;
export let value: Array<string> | Array<FileData> | null = null;
export let style: Styles = {
grid_cols: [2],
@@ -120,6 +121,7 @@
let container: HTMLDivElement;
async function scroll_to_img(index: number | null) {
if (!scrollOnUpdate) return;
if (typeof index !== "number") return;
await tick();