Make SaveImageKJ work with prefix replacement

This commit is contained in:
kijai 2024-12-10 12:52:12 +02:00
parent 1a39ccde72
commit 6eb9211091
2 changed files with 13 additions and 1 deletions

View File

@ -2332,7 +2332,7 @@ class SaveImageKJ:
OUTPUT_NODE = True
CATEGORY = "image"
CATEGORY = "KJNodes/image"
DESCRIPTION = "Saves the input images to your ComfyUI output directory."
def save_images(self, images, output_folder, filename_prefix="ComfyUI", prompt=None, extra_pnginfo=None, caption=None, caption_file_extension=".txt"):

View File

@ -1,4 +1,5 @@
import { app } from "../../../scripts/app.js";
import { applyTextReplacements } from "../../../scripts/utils.js";
app.registerExtension({
name: "KJNodes.jsnodes",
@ -335,6 +336,17 @@ app.registerExtension({
this.addWidget("button", "Stop mic capture", null, stopMicrophoneCapture);
};
break;
case "SaveImageKJ":
const onNodeCreated = nodeType.prototype.onNodeCreated;
nodeType.prototype.onNodeCreated = function() {
const r = onNodeCreated ? onNodeCreated.apply(this, arguments) : void 0;
const widget = this.widgets.find((w) => w.name === "filename_prefix");
widget.serializeValue = () => {
return applyTextReplacements(app, widget.value);
};
return r;
};
break;
}