Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
7 changes: 5 additions & 2 deletions src/Text2Image/T2IEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public record class PreGenerationEventParams(T2IParamInput UserInput);
public static Action<PostGenerationEventParams> PostGenerateEvent;

/// <summary>Paramters for <see cref="PostGenerateEvent"/>.</summary>
public record class PostGenerationEventParams(MediaFile File, T2IParamInput UserInput, Action RefuseImage);
public record class PostGenerationEventParams(MediaFile File, T2IParamInput UserInput, Action RefuseImage, string BackendInternalHint = null);

/// <summary>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.</summary>
Expand Down Expand Up @@ -66,6 +66,9 @@ public Image Img

/// <summary>An action that will remove/discard this file as relevant.</summary>
public Action RefuseImage;

/// <summary>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.</summary>
public string BackendInternalHint;
}

/// <summary>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).</summary>
Expand Down Expand Up @@ -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.");
Expand Down
Loading