Add cross-workflow image channel system with ImageReceiver node

Named channels allow PreviewToLoad to send images to a shared channel
(stored in channels.json) that ImageReceiver nodes can read from,
enabling cross-workflow image passing without brittle node IDs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 11:11:54 +01:00
parent 0559e16cf0
commit 33a5f9aa16
2 changed files with 175 additions and 44 deletions

View File

@@ -53,6 +53,34 @@ app.registerExtension({
app.graph.setDirtyCanvas(true, true);
});
this.addWidget("text", "channel", "default", () => {});
this.addWidget("button", "Send to Channel", null, () => {
const channelWidget = this.widgets?.find(w => w.name === "channel");
const channel = channelWidget?.value || "default";
const filename = this.last_input_filename;
if (!filename) {
console.warn("[PreviewToLoad] No filename available. Run the workflow first.");
return;
}
fetch("/jdl/channel/send", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ channel, filename }),
})
.then(r => r.json())
.then(data => {
if (data.ok) {
console.log(`[PreviewToLoad] Sent "${filename}" to channel "${channel}"`);
} else {
console.warn("[PreviewToLoad] Channel send failed:", data.error);
}
})
.catch(err => console.error("[PreviewToLoad] Channel send error:", err));
});
this.setSize(this.computeSize());
};