Merge pull request #8 from XJF2332/v3_migrated

migrated to ComfyUI V3 schema
This commit is contained in:
Tropfchen
2026-02-07 21:39:28 +01:00
committed by GitHub
3 changed files with 44 additions and 44 deletions
+1 -1
View File
@@ -161,4 +161,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear # and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ /.idea
+4 -8
View File
@@ -1,11 +1,10 @@
from .node import EmbeddingPicker from pathlib import Path
from .node import comfy_entrypoint
NODE_CLASS_MAPPINGS = {"EmbeddingPicker": EmbeddingPicker} WEB_DIRECTORY = "./js"
NODE_DISPLAY_NAME_MAPPINGS = {"EmbeddingPicker": "Embedding Picker"} __all__ = ["WEB_DIRECTORY", "comfy_entrypoint"]
# ------------------------ Remove copied web extension ------------------------- # ------------------------ Remove copied web extension -------------------------
from pathlib import Path
node_dir = Path(__file__).resolve().parent node_dir = Path(__file__).resolve().parent
comfy_dir = node_dir.parent.parent comfy_dir = node_dir.parent.parent
destination_dir = comfy_dir / "web" / "extensions" / "tropfchen" destination_dir = comfy_dir / "web" / "extensions" / "tropfchen"
@@ -13,7 +12,4 @@ destination_path = destination_dir / "epQuickNodes.js"
if destination_path.exists(): if destination_path.exists():
destination_path.unlink() destination_path.unlink()
# --------------------------- Install web extension ---------------------------- # --------------------------- Install web extension ----------------------------
WEB_DIRECTORY = "./js"
__all__ = ["WEB_DIRECTORY"]
+39 -35
View File
@@ -1,53 +1,57 @@
from pathlib import Path from pathlib import Path
import folder_paths import folder_paths
from comfy_api.latest import io, ComfyExtension, ui
class EmbeddingPicker: class EmbeddingPicker(io.ComfyNode):
def __init__(self):
pass
@classmethod @classmethod
def INPUT_TYPES(self): def define_schema(cls) -> io.Schema:
embeddings = folder_paths.get_filename_list("embeddings") embeddings = folder_paths.get_filename_list("embeddings")
return { return io.Schema(
"required": { node_id="EmbeddingPicker",
"embedding": ((embeddings),), display_name="Embedding Picker",
"emphasis": ( category="utils",
"FLOAT", inputs=[
{ io.Combo.Input("embedding", options=embeddings),
"default": 1.0,
"min": 0.0, io.Float.Input(
"max": 3.0, "emphasis",
"step": 0.05, default=1.0,
}, min=0.0,
max=3.0,
step=0.05
), ),
"append": (
"BOOLEAN",
{"default": False, "label_on": "true ", "label_off": "false "},
),
"text": ("STRING", {"multiline": True}),
},
}
RETURN_TYPES = ("STRING",) io.Boolean.Input("append", default=False),
RETURN_NAMES = ("text",)
FUNCTION = "concat_embedding"
OUTPUT_NODE = False
CATEGORY = "utils" io.String.Input("text", multiline=True)
],
outputs=[
io.String.Output("text")
]
)
def concat_embedding(self, text, embedding, emphasis, append): @classmethod
def execute(cls, text, embedding, emphasis, append) -> io.NodeOutput:
if emphasis < 0.05: if emphasis < 0.05:
return (text,) return io.NodeOutput(text)
emb = "embedding:" + Path(embedding).stem emb = "embedding:" + Path(embedding).stem
emphasis = f"{emphasis:.3f}" emphasis_str = f"{emphasis:.3f}"
if emphasis != "1.000": if emphasis_str != "1.000":
emb = f"({emb}:{emphasis})" emb = f"({emb}:{emphasis_str})"
output = f"{text}, {emb}" if append else f"{emb}, {text}" output = f"{text}, {emb}" if append else f"{emb}, {text}"
return (output,) return io.NodeOutput(output)
class EmbeddingPickerExtension(ComfyExtension):
async def get_node_list(self) -> list[type[io.ComfyNode]]:
return [EmbeddingPicker]
async def comfy_entrypoint() -> ComfyExtension:
return EmbeddingPickerExtension()