diff --git a/src/BuiltinExtensions/ComfyUIBackend/ComfyUIAPIAbstractBackend.cs b/src/BuiltinExtensions/ComfyUIBackend/ComfyUIAPIAbstractBackend.cs index abf94e193..ff883adb1 100644 --- a/src/BuiltinExtensions/ComfyUIBackend/ComfyUIAPIAbstractBackend.cs +++ b/src/BuiltinExtensions/ComfyUIBackend/ComfyUIAPIAbstractBackend.cs @@ -516,7 +516,7 @@ async Task doInterruptNow() ["comfy_index"] = index }; } - takeOutput(new T2IEngine.ImageOutput() { File = new Image(output[preBytes..], mediaType), IsReal = isReal, GenTimeMS = firstStep == 0 ? -1 : (Environment.TickCount64 - firstStep) }); + takeOutput(new T2IEngine.ImageOutput() { File = new Image(output[preBytes..], mediaType), IsReal = isReal, BackendInternalHint = currentNode, GenTimeMS = firstStep == 0 ? -1 : (Environment.TickCount64 - firstStep) }); } else { diff --git a/src/Text2Image/T2IEngine.cs b/src/Text2Image/T2IEngine.cs index c0fc4d84b..9c095f0d1 100644 --- a/src/Text2Image/T2IEngine.cs +++ b/src/Text2Image/T2IEngine.cs @@ -29,7 +29,7 @@ public record class PreGenerationEventParams(T2IParamInput UserInput); public static Action PostGenerateEvent; /// Paramters for . - public record class PostGenerationEventParams(MediaFile File, T2IParamInput UserInput, Action RefuseImage); + public record class PostGenerationEventParams(MediaFile File, T2IParamInput UserInput, Action RefuseImage, string BackendInternalHint = null); /// Extension event, fired after a batch of images were generated. /// Use "RefuseImage" to mark an image as removed. Note that it may have already been shown to a user, when the live result websocket API is in use. @@ -66,6 +66,9 @@ public Image Img /// An action that will remove/discard this file as relevant. public Action RefuseImage; + + /// Optional text identifying some internal hint from the backend, such as a Comfy Node ID. Format or content not guaranteed, use with caution and validation checks. + public string BackendInternalHint; } /// List of functions that take a pair of userinput and backend, and returns true if they can fit together, or false if the pair is not valid (add to user_input.RefusalReasons if so). @@ -221,7 +224,7 @@ string format(long t) copyInput.ExtraMeta["intermediate"] = "intermediate output"; } bool refuse = false; - PostGenerateEvent?.Invoke(new(img.File, copyInput, () => refuse = true)); + PostGenerateEvent?.Invoke(new(img.File, copyInput, () => refuse = true, img.BackendInternalHint)); if (refuse) { Logs.Info($"Refused an image.");