Text Condition
A ComfyUI node in Zuellni/Text with 7 inputs and 4 outputs.
- images
- latents
- masks
- IMAGES
- LATENTS
- MASKS
- RESULT
The pack's text nodes exist for one job: letting an LLM (running in text-generation-webui) generate and manipulate prompts mid-workflow. That works great right up until the LLM hands back garbage - an empty string, a prompt that's 3 words, a number way out of range. Text Condition is the gate that catches it. It compares two values with a range of operators, passes your tensors through if the check succeeds, and can kill the whole run if it fails.
What it is
Text Condition takes var_1 and var_2 (strings), a condition operator, and an interrupt toggle. It evaluates the comparison and returns RESULT as the string "true" or "false", plus passthrough copies of any images/latents/masks you connected. If the result is false and interrupt is on, it raises an interrupt and stops generation - everything downstream halts.
The operators
Nine of them, and here's the part people miss: if both values parse as floats, it compares them numerically. The node tries float(var_1) / float(var_2) first and falls back to strings. So var_1 = "64", var_2 = "128", condition < correctly evaluates true, even though they arrived as strings. That makes it genuinely useful for checking outputs of numeric computations (e.g. an upscale factor, a token count, a generated number).
- Equality and inequality:
==,!= - Numeric/string ordering:
<,<=,>,>= - Substring/text checks:
contains,starts with,ends with
How you'd use it
The canonical workflow: LLM generates a prompt → something like Text Format assembles it → you want to guard before the prompt reaches a CLIP encoder. Wire the LLM's output into var_1, set condition to starts with / a length check, or route a numeric value in and set < / >. If the check fails and interrupt is on, the run stops instead of spending minutes generating from a garbage prompt. That's the whole value: fail fast instead of wasting a generation.
The tensors passthrough is the quieter feature - you can place the gate in the middle of a pipeline without rerouting your images: they come out the other side unchanged when the check passes.
The gotchas
falsewithoutinterruptdoesn't stop anything. It just returns(None, None, None, "false")- the tensor outputs go null (which may break downstream nodes) but the run continues. If you want a hard stop,interruptmust be on.containsand the ordering operators are case-sensitive. "Cat" doesn't contain "cat". Normalize your strings upstream if that matters.- A
falseresult nulls your tensors, so wire the passthrough into anything that must keep running only when the check passes - otherwise you'll feedNoneinto a sampler.
Install
Part of Zuellni/ComfyUI-Custom-Nodes, via ComfyUI Manager (search "Zuellni") or:
cd ComfyUI/custom_nodes
git clone https://github.com/Zuellni/ComfyUI-Custom-Nodes
No extra dependencies beyond what ComfyUI ships. Note the pack's text nodes are built for text-generation-webui running with --api - Text Condition itself is just a comparator, so it works standalone, but if you got here expecting the full LLM loop, that's the other half. And the pack is archived - fine for a comparator, but don't expect fixes.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| var_1 | STRING | — | |
| condition | COMBO | == | 9 options: ==, !=, <, <=, >, >=, +3 |
| var_2 | STRING | — | |
| interrupt | COMBO | false | 2 options: false, true |
| imagesopt | IMAGE | — | |
| latentsopt | LATENT | — | |
| masksopt | MASK | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| IMAGES | IMAGE | — |
| LATENTS | LATENT | — |
| MASKS | MASK | — |
| RESULT | STRING | — |