From 6593a179f9473c48db5c58e8d976732403990799 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Thu, 25 Jun 2026 04:28:05 +0200 Subject: [PATCH] Remove vision_position switch Roll back the before/after-prompt vision placement toggle. Co-Authored-By: Claude Opus 4.8 --- README.md | 1 - nodes.py | 16 ++-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 58011db..c9ca1b3 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,6 @@ downstream of this node — that works generically at the sampler level.) | `image1…N` | IMAGE | Optional reference images; slots grow as you connect them. | | `mask1…N` | MASK | Optional per-image mask; crops `imageN` to the masked bounding box. | | `mask_padding` | FLOAT | Context kept around the mask, as a fraction of image size per side (`0` = tight, default). | -| `vision_position` | CHOICE | Put the image tokens `before prompt` (default) or `after prompt` in the user turn. | | `vision_megapixels` | FLOAT | Max size before the vision encoder; references are downscaled to this cap, never upscaled (default `1.0`). | Output is a standard `CONDITIONING` for the Krea2 sampler. With no images connected it diff --git a/nodes.py b/nodes.py index c13606a..96d78f7 100644 --- a/nodes.py +++ b/nodes.py @@ -60,12 +60,6 @@ class TextEncodeKrea2: "image size added on EACH side. 0 = tight crop to the mask; 0.1 = ~10% " "margin of surroundings. Only applies when a mask is connected.", }), - "vision_position": (["before prompt", "after prompt"], { - "default": "before prompt", - "tooltip": "Where the image (vision) tokens go in the user turn relative to your " - "text. 'before prompt' = image then text (default); 'after prompt' = " - "text then image. No effect when no image is connected.", - }), }, } @@ -122,8 +116,7 @@ class TextEncodeKrea2: return image[:, y0:y1 + 1, x0:x1 + 1, :] - def encode(self, clip, prompt, vision_megapixels=1.0, mask_padding=0.0, - vision_position="before prompt", **kwargs): + def encode(self, clip, prompt, vision_megapixels=1.0, mask_padding=0.0, **kwargs): images = self._collect_indexed(kwargs, "image") masks = self._collect_indexed(kwargs, "mask") ordered = sorted(images.keys()) @@ -151,12 +144,7 @@ class TextEncodeKrea2: else: image_prompt += "<|vision_start|><|image_pad|><|vision_end|>" - if vision_position == "after prompt": - text = prompt + image_prompt - else: - text = image_prompt + prompt - - tokens = clip.tokenize(text, images=images_vl, llama_template=KREA2_TEMPLATE) + tokens = clip.tokenize(image_prompt + prompt, images=images_vl, llama_template=KREA2_TEMPLATE) conditioning = clip.encode_from_tokens_scheduled(tokens) return (conditioning,)