TEMP refactor file passing

This commit is contained in:
space-nuko
2023-05-13 16:19:42 -05:00
parent 0656ae1d3a
commit 05bcce5573
14 changed files with 241 additions and 555 deletions

View File

@@ -32,7 +32,7 @@ import { download, jsonToJsObject, promptToGraphVis, range, workflowToGraphVis }
import notify from "$lib/notify";
import configState from "$lib/stores/configState";
import { blankGraph } from "$lib/defaultGraph";
import type { GalleryOutput } from "$lib/nodes/ComfyWidgetNodes";
import type { ComfyExecutionResult } from "$lib/nodes/ComfyWidgetNodes";
export const COMFYBOX_SERIAL_VERSION = 1;
@@ -71,7 +71,7 @@ export type SerializedPrompt = {
output: SerializedPromptInputsAll
}
export type SerializedPromptOutputs = Record<NodeID, GalleryOutput>
export type SerializedPromptOutputs = Record<NodeID, ComfyExecutionResult>
export type Progress = {
value: number,
@@ -347,7 +347,7 @@ export default class ComfyApp {
this.lGraph.setDirtyCanvas(true, false);
});
this.api.addEventListener("executed", (promptID: PromptID, nodeID: NodeID, output: GalleryOutput) => {
this.api.addEventListener("executed", (promptID: PromptID, nodeID: NodeID, output: ComfyExecutionResult) => {
this.nodeOutputs[nodeID] = output;
const node = this.lGraph.getNodeById(nodeID) as ComfyGraphNode;
if (node?.onExecuted) {
@@ -409,7 +409,8 @@ export default class ComfyApp {
}
setColor("IMAGE", "rebeccapurple")
setColor("COMFY_IMAGE_FILE", "chartreuse")
setColor("COMFYBOX_IMAGES", "lime")
setColor("COMFYBOX_IMAGE", "green")
setColor(BuiltInSlotType.EVENT, "lightseagreen")
setColor(BuiltInSlotType.ACTION, "lightseagreen")
}

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import UploadText from "$lib/components/gradio/app/UploadText.svelte";
import type { GalleryOutputEntry } from "$lib/nodes/ComfyWidgetNodes";
import type { ComfyImageLocation } from "$lib/nodes/ComfyWidgetNodes";
import notify from "$lib/notify";
import { convertComfyOutputEntryToGradio, convertComfyOutputToComfyURL, type ComfyUploadImageAPIResponse } from "$lib/utils";
import { Block, BlockLabel } from "@gradio/atoms";
@@ -9,7 +9,7 @@
import { ModifyUpload, Upload } from "@gradio/upload";
import { createEventDispatcher, tick } from "svelte";
export let value: GalleryOutputEntry[] | null = null;
export let value: ComfyImageLocation[] | null = null;
export let imgWidth: number = 0;
export let imgHeight: number = 0;
export let imgElem: HTMLImageElement | null = null
@@ -28,9 +28,9 @@
let uploaded: boolean = false;
const dispatch = createEventDispatcher<{
change: GalleryOutputEntry[];
change: ComfyImageLocation[];
uploading: undefined;
uploaded: GalleryOutputEntry[];
uploaded: ComfyImageLocation[];
upload_error: any;
clear: undefined;
}>();
@@ -60,7 +60,7 @@
interface GradioUploadResponse {
error?: string;
files?: Array<GalleryOutputEntry>;
files?: Array<ComfyImageLocation>;
}
async function upload_files(root: string, files: Array<File>): Promise<GradioUploadResponse> {