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
Binary file added .github/assets/example_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/example_wf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/io_nodes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/lineage_large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/retrieval_nodes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/webui_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@
4. Run Embeddr-CLI with `embeddr serve`
5. Run ComfyUI


## Usage


### Use New Load & Save Image

![Example IO](.github/assets/io_nodes.png)

![Example](.github/assets/example_2.png)

### Retrieve from your collections

![Example Retrieval](.github/assets/retrieval_nodes.png)


### Access more info on the [WebUI](https://github.com/embeddr-net/embeddr-cli)

![Example Lineage](.github/assets/lineage_large.png)

## Development

To get a development version working.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[project]
name = "embeddr-extension"
description = "Embeddr ComfyUI Extension"
version = "1.2.0"
version = "1.2.1"
license = { file = "LICENSE.md" }
dependencies = []
requires-python = ">=3.8"
Expand Down
1 change: 1 addition & 0 deletions ui/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { app } from "../../../scripts/app.js";
import EmbeddrPanel from "./components/panels/EmbeddrPanel.js";
import { GlobalDialog } from "./components/GlobalDialog";
import "./nodes/EmbeddrLoadImage.js";
import "./nodes/EmbeddrMergeIds.js";
// @ts-ignore
import "./globals.css";

Expand Down
67 changes: 67 additions & 0 deletions ui/nodes/EmbeddrMergeIds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { app } from "../../../scripts/app.js";

const _ID = "embeddr.MergeIDs";
const _PREFIX = "id";
const _TYPE = "STRING";

app.registerExtension({
name: "embeddr.dynamic_merge_ids",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
if (nodeData.name !== _ID) {
return;
}

// Add initial input on creation
const onNodeCreated = nodeType.prototype.onNodeCreated;
nodeType.prototype.onNodeCreated = function () {
const me = onNodeCreated?.apply(this);
// Start with one dynamic input if none exist
if (!this.inputs || this.inputs.length === 0) {
this.addInput(`${_PREFIX}1`, _TYPE);
}
return me;
};

// Handle connections
const onConnectionsChange = nodeType.prototype.onConnectionsChange;
nodeType.prototype.onConnectionsChange = function (
slotType,
slotIdx,
event,
linkInfo,
nodeSlot
) {
const me = onConnectionsChange?.apply(this, arguments);

// Only care about inputs (slotType 1)
if (slotType !== 1) return me;

const inputs = this.inputs || [];
const lastInput = inputs[inputs.length - 1];

// If last input is connected, add a new one
if (lastInput && lastInput.link) {
this.addInput(`${_PREFIX}${inputs.length + 1}`, _TYPE);
}

// Compact: Remove unconnected inputs that are NOT the last one
// Iterate backwards to avoid index issues
for (let i = inputs.length - 2; i >= 0; i--) {
if (!inputs[i].link) {
this.removeInput(i);
}
}

// Rename all inputs to be sequential
for (let i = 0; i < this.inputs.length; i++) {
this.inputs[i].name = `${_PREFIX}${i + 1}`;
}

if (this.graph) {
this.graph.setDirtyCanvas(true);
}

return me;
};
},
});
Loading