ComfyUI Node

Text Latch

The 'Show Text' that keeps its value when you disconnect it

By asaddi·Created 2 years ago·Updated 14 days ago· 7
Text Latch
    • text
    text
    replacetrue
    text_input

    Text Latch is the answer to a very specific ComfyUI itch, and the README nails it in three words: "Show Text with memory." You've hit this workflow pattern: an LLM generates a prompt, it feeds your text encoder, you run it, the result is great, and now you want to regenerate the image a few times with that same prompt without the LLM rewriting it every queue. So you mute the LLM or disconnect the wire - and the downstream text node screams at you that its input is missing. Text Latch exists so that doesn't happen. It's a real r/comfyui question, and this node is the tidy answer.

    How it works

    The node keeps a text widget on the front - the "memory." Every time it executes, if the optional text_input is connected and the replace switch is on, the incoming string replaces whatever the textbox currently shows. Then it outputs whatever the box shows, whether that's the fresh input or the frozen old value.

    The input is optional, and that's the entire trick. Disconnect the wire or mute the upstream LLM and the node simply keeps echoing its stored text. The replace boolean (default true) is the escape hatch: flip it off and the node ignores new input entirely, which is how you deliberately lock in a prompt while an upstream generator keeps running. There's a bit of lazy-evaluation plumbing in the source so it only pulls from whatever's connected when replace is actually on - it won't execute the whole upstream chain needlessly.

    Two niceties worth knowing. First, it's an output node, so its result shows up in the UI like a preview, not just as a wire. Second, the stored text rides along into exported workflows and saved images via the PNG metadata - reopen the workflow later and your latched prompt is right there, which is more than most Show Text clones can say.

    The inputs and output that matter

    • text - the editable widget that holds the current value; also the fallback if nothing's connected.
    • replace - boolean, default true; whether incoming text overwrites the box.
    • text_input (optional) - the string feeding in from upstream, usually your LLM's completion.
    • Output: text, the current contents, ready for any string input downstream (CLIP text encode, prompt combos, whatever).

    Installing it

    It ships in the ComfyUI-YALLM-node pack, so it's one install for the whole family - Manager searching "ComfyUI-YALLM-node", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/asaddi/ComfyUI-YALLM-node
    cd ComfyUI-YALLM-node
    pip install -r requirements.txt
    

    That's openai and pydantic, nothing else. Restart ComfyUI.

    Gotchas

    The classic failure is forgetting it's an output node and leaving it hanging unconnected - harmless, but you'll wonder why a stray preview appears. And remember the ordering: replace defaults to true, so on the very first execution with a connected input it will overwrite whatever you typed into the box by hand. If you pre-seed the widget with text you want kept, turn replace off before the chain fires. Otherwise it's one of the most forgiving nodes in the pack - the whole point is that it never throws because an input went missing.

    CategoryYALLM

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    replaceBOOLEANtrue
    text_inputoptSTRING

    Outputs (1)

    NameTypeDescription
    textSTRING