Prepare for multiple workflows
This commit is contained in:
@@ -8,7 +8,7 @@ import ComfyGraphNode, { type ComfyGraphNodeProperties } from "./ComfyGraphNode"
|
||||
import type { ComfyWidgetNode } from "$lib/nodes/widgets";
|
||||
import type { NotifyOptions } from "$lib/notify";
|
||||
import type { FileData as GradioFileData } from "@gradio/upload";
|
||||
import { type ComfyExecutionResult, type ComfyImageLocation, convertComfyOutputToGradio, type ComfyUploadImageAPIResponse, parseWhateverIntoComfyImageLocations } from "$lib/utils";
|
||||
import { type SerializedPromptOutput, type ComfyImageLocation, convertComfyOutputToGradio, type ComfyUploadImageAPIResponse, parseWhateverIntoComfyImageLocations } from "$lib/utils";
|
||||
|
||||
export class ComfyQueueEvents extends ComfyGraphNode {
|
||||
static slotLayout: SlotLayout = {
|
||||
@@ -63,7 +63,7 @@ LiteGraph.registerNodeType({
|
||||
})
|
||||
|
||||
export interface ComfyStoreImagesActionProperties extends ComfyGraphNodeProperties {
|
||||
images: ComfyExecutionResult | null
|
||||
images: SerializedPromptOutput | null
|
||||
}
|
||||
|
||||
export class ComfyStoreImagesAction extends ComfyGraphNode {
|
||||
@@ -90,7 +90,7 @@ export class ComfyStoreImagesAction extends ComfyGraphNode {
|
||||
if (action !== "store" || !param || !("images" in param))
|
||||
return;
|
||||
|
||||
this.setProperty("images", param as ComfyExecutionResult)
|
||||
this.setProperty("images", param as SerializedPromptOutput)
|
||||
this.setOutputData(0, this.properties.images)
|
||||
}
|
||||
}
|
||||
@@ -223,7 +223,7 @@ export class ComfyNotifyAction extends ComfyGraphNode {
|
||||
// native notifications.
|
||||
if (param != null && typeof param === "object") {
|
||||
if ("images" in param) {
|
||||
const output = param as ComfyExecutionResult;
|
||||
const output = param as SerializedPromptOutput;
|
||||
const converted = convertComfyOutputToGradio(output);
|
||||
if (converted.length > 0)
|
||||
options.imageUrl = converted[0].data;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { BuiltInSlotShape, BuiltInSlotType, type SerializedLGraphNode } from "@l
|
||||
import type IComfyInputSlot from "$lib/IComfyInputSlot";
|
||||
import type { ComfyInputConfig } from "$lib/IComfyInputSlot";
|
||||
import { iterateNodeDefOutputs, type ComfyNodeDef, iterateNodeDefInputs } from "$lib/ComfyNodeDef";
|
||||
import type { ComfyExecutionResult } from "$lib/utils";
|
||||
import type { SerializedPromptOutput } from "$lib/utils";
|
||||
|
||||
/*
|
||||
* Base class for any node with configuration sent by the backend.
|
||||
@@ -111,7 +111,7 @@ export class ComfyBackendNode extends ComfyGraphNode {
|
||||
}
|
||||
}
|
||||
|
||||
override onExecuted(outputData: ComfyExecutionResult) {
|
||||
override onExecuted(outputData: SerializedPromptOutput) {
|
||||
console.warn("onExecuted outputs", outputData)
|
||||
this.triggerSlot(0, outputData)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { SerializedPrompt } from "$lib/components/ComfyApp";
|
||||
import { LGraph, LGraphNode, LLink, LiteGraph, NodeMode, type INodeInputSlot, type SerializedLGraphNode, type Vector2, type INodeOutputSlot, LConnectionKind, type SlotType, LGraphCanvas, getStaticPropertyOnInstance, type PropertyLayout, type SlotLayout } from "@litegraph-ts/core";
|
||||
import type { SvelteComponentDev } from "svelte/internal";
|
||||
import type { ComfyWidgetNode } from "$lib/nodes/widgets";
|
||||
import type { ComfyExecutionResult, ComfyImageLocation } from "$lib/utils"
|
||||
import type { SerializedPromptOutput, ComfyImageLocation } from "$lib/utils"
|
||||
import type IComfyInputSlot from "$lib/IComfyInputSlot";
|
||||
import uiState from "$lib/stores/uiState";
|
||||
import { get } from "svelte/store";
|
||||
@@ -48,7 +48,7 @@ export default class ComfyGraphNode extends LGraphNode {
|
||||
* Triggered when the backend sends a finished output back with this node's ID.
|
||||
* Valid for output nodes like SaveImage and PreviewImage.
|
||||
*/
|
||||
onExecuted?(output: ComfyExecutionResult): void;
|
||||
onExecuted?(output: SerializedPromptOutput): void;
|
||||
|
||||
/*
|
||||
* When a prompt is queued, this will be called on the node if it can
|
||||
|
||||
Reference in New Issue
Block a user