diff --git a/__pycache__/nodes.cpython-311.pyc b/__pycache__/nodes.cpython-311.pyc index d957b89..925b1e7 100644 Binary files a/__pycache__/nodes.cpython-311.pyc and b/__pycache__/nodes.cpython-311.pyc differ diff --git a/nodes.py b/nodes.py index c3e7c47..db24065 100644 --- a/nodes.py +++ b/nodes.py @@ -215,6 +215,28 @@ def _make_node(model_def: dict): return ReplicateModelNode +class ReplicateTextEncode: + """Prompt-Passthrough (Text rein → Text raus). + + Client-Apps wie ComfyChair erkennen den positiven Prompt nur an Nodes, + deren class_type 'TextEncode' oder 'Prompt' enthält — die generierten + Replicate_*-Nodes fallen durch diesen Filter. Prompt daher über diesen + Node in den prompt-Input des Modell-Nodes leiten. + """ + + CATEGORY = CATEGORY_ROOT + FUNCTION = "run" + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("text",) + + @classmethod + def INPUT_TYPES(cls): + return {"required": {"text": ("STRING", {"multiline": True, "default": ""})}} + + def run(self, text): + return (text,) + + class ReplicateCustom: """Beliebiges Replicate-Modell per ID aufrufen — der Escape-Hatch.""" @@ -261,8 +283,14 @@ def _load_catalog() -> dict: return json.load(fh) -NODE_CLASS_MAPPINGS = {"ReplicateCustom": ReplicateCustom} -NODE_DISPLAY_NAME_MAPPINGS = {"ReplicateCustom": "Replicate Custom (beliebige Modell-ID)"} +NODE_CLASS_MAPPINGS = { + "ReplicateCustom": ReplicateCustom, + "ReplicateTextEncode": ReplicateTextEncode, +} +NODE_DISPLAY_NAME_MAPPINGS = { + "ReplicateCustom": "Replicate Custom (beliebige Modell-ID)", + "ReplicateTextEncode": "Prompt (Replicate Select)", +} for _model in _load_catalog()["models"]: _cls = _make_node(_model) diff --git a/pyproject.toml b/pyproject.toml index 1fcd8f4..2a493ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-replicate-select" description = "Kuratierte Replicate-Modelle als ComfyUI-Nodes (Bild, Video, Upscale, TTS, Lipsync) + Custom-Node für beliebige Modell-IDs." -version = "0.2.0" +version = "0.2.1" dependencies = ["replicate>=1.0.7"] [tool.comfy] diff --git a/templates/LTX-2_Replicate.json b/templates/LTX-2_Replicate.json index acaff10..72a9e78 100644 --- a/templates/LTX-2_Replicate.json +++ b/templates/LTX-2_Replicate.json @@ -6,6 +6,15 @@ "seed": 0 }, "nodes": { + "0": { + "class_type": "ReplicateTextEncode", + "inputs": { + "text": "{{positive_prompt}}" + }, + "_meta": { + "title": "Positive Prompt" + } + }, "1": { "class_type": "LoadImage", "inputs": { @@ -18,7 +27,10 @@ "2": { "class_type": "Replicate_lightricks_ltx_2_distilled", "inputs": { - "prompt": "{{positive_prompt}}", + "prompt": [ + "0", + 0 + ], "image": [ "1", 0 @@ -31,4 +43,4 @@ } } } -} \ No newline at end of file +} diff --git a/templates/Qwen_Image_Edit_Plus_Replicate.json b/templates/Qwen_Image_Edit_Plus_Replicate.json index 3d0dd39..aafb2c7 100644 --- a/templates/Qwen_Image_Edit_Plus_Replicate.json +++ b/templates/Qwen_Image_Edit_Plus_Replicate.json @@ -6,6 +6,15 @@ "seed": 0 }, "nodes": { + "0": { + "class_type": "ReplicateTextEncode", + "inputs": { + "text": "{{positive_prompt}}" + }, + "_meta": { + "title": "Positive Prompt" + } + }, "1": { "class_type": "LoadImage", "inputs": { @@ -22,7 +31,10 @@ "1", 0 ], - "prompt": "{{positive_prompt}}", + "prompt": [ + "0", + 0 + ], "aspect_ratio": "{{aspect_ratio}}", "seed": "{{seed}}" }, @@ -44,4 +56,4 @@ } } } -} \ No newline at end of file +} diff --git a/templates/Wan_2.2_i2v_fast_Replicate.json b/templates/Wan_2.2_i2v_fast_Replicate.json index f6284ee..cacf699 100644 --- a/templates/Wan_2.2_i2v_fast_Replicate.json +++ b/templates/Wan_2.2_i2v_fast_Replicate.json @@ -8,6 +8,15 @@ "seed": 0 }, "nodes": { + "0": { + "class_type": "ReplicateTextEncode", + "inputs": { + "text": "{{positive_prompt}}" + }, + "_meta": { + "title": "Positive Prompt" + } + }, "1": { "class_type": "LoadImage", "inputs": { @@ -20,7 +29,10 @@ "2": { "class_type": "Replicate_wan_video_wan_2_2_i2v_fast", "inputs": { - "prompt": "{{positive_prompt}}", + "prompt": [ + "0", + 0 + ], "image": [ "1", 0 @@ -35,4 +47,4 @@ } } } -} \ No newline at end of file +} diff --git a/templates/Wan_2.2_t2v_fast_Replicate.json b/templates/Wan_2.2_t2v_fast_Replicate.json index 3212b8e..d2c52ea 100644 --- a/templates/Wan_2.2_t2v_fast_Replicate.json +++ b/templates/Wan_2.2_t2v_fast_Replicate.json @@ -9,10 +9,22 @@ "seed": 0 }, "nodes": { + "0": { + "class_type": "ReplicateTextEncode", + "inputs": { + "text": "{{positive_prompt}}" + }, + "_meta": { + "title": "Positive Prompt" + } + }, "1": { "class_type": "Replicate_wan_video_wan_2_2_t2v_fast", "inputs": { - "prompt": "{{positive_prompt}}", + "prompt": [ + "0", + 0 + ], "aspect_ratio": "{{aspect_ratio}}", "resolution": "{{resolution}}", "num_frames": "{{num_frames}}", @@ -24,4 +36,4 @@ } } } -} \ No newline at end of file +} diff --git a/templates/Z-Image_Turbo_Replicate.json b/templates/Z-Image_Turbo_Replicate.json index a686fc2..20276c0 100644 --- a/templates/Z-Image_Turbo_Replicate.json +++ b/templates/Z-Image_Turbo_Replicate.json @@ -8,10 +8,22 @@ "seed": 0 }, "nodes": { + "0": { + "class_type": "ReplicateTextEncode", + "inputs": { + "text": "{{positive_prompt}}" + }, + "_meta": { + "title": "Positive Prompt" + } + }, "1": { "class_type": "Replicate_prunaai_z_image_turbo", "inputs": { - "prompt": "{{positive_prompt}}", + "prompt": [ + "0", + 0 + ], "width": "{{width}}", "height": "{{height}}", "num_inference_steps": "{{steps}}", @@ -35,4 +47,4 @@ } } } -} \ No newline at end of file +} diff --git a/templates/Z-Image_Turbo_img2img_Replicate.json b/templates/Z-Image_Turbo_img2img_Replicate.json index 30e13e5..1b9bd7f 100644 --- a/templates/Z-Image_Turbo_img2img_Replicate.json +++ b/templates/Z-Image_Turbo_img2img_Replicate.json @@ -7,6 +7,15 @@ "seed": 0 }, "nodes": { + "0": { + "class_type": "ReplicateTextEncode", + "inputs": { + "text": "{{positive_prompt}}" + }, + "_meta": { + "title": "Positive Prompt" + } + }, "1": { "class_type": "LoadImage", "inputs": { @@ -19,7 +28,10 @@ "2": { "class_type": "Replicate_prunaai_z_image_turbo_img2img", "inputs": { - "prompt": "{{positive_prompt}}", + "prompt": [ + "0", + 0 + ], "image": [ "1", 0 @@ -46,4 +58,4 @@ } } } -} \ No newline at end of file +}