ComfyUI Node

String Preview

The ComfyUI debugger for text nobody else will show you

By bradsec·Created 2 years ago·Updated 2 months ago· 36
String Preview
    • output_string
    input_string

    ComfyUI has a famous problem with intermediate text: the graph happily moves strings around, and you have to believe the prompt that reaches the sampler is the one you think it is. String Preview is the flashlight. You drop it after any node that produces text, run the queue once, and it shows you the actual string on the node's face - no screenshotting, no JSON digging.

    The name undersells it slightly. This isn't a preview that sits at the end of the line; it's a debugger you can insert anywhere, because it passes its input straight through. Wire it between a String Multi Replace and the next node and it doesn't just show you the result - the result still flows onward through its output_string output. That passthrough is the trick that makes it painless to leave in a workflow permanently.

    How it works

    String Preview is an output node (it's flagged OUTPUT_NODE), so ComfyUI treats it as a terminal that displays in the UI. A small bit of JS gives it a read-only multiline widget, and every time the node runs it writes the incoming text into that widget. The interesting implementation detail: its IS_CHANGED method returns float("nan"), which forces ComfyUI to re-evaluate it on every queue run. That matters because text nodes get cached - without that nudge, a preview would sometimes show you last run's string and quietly lie to you.

    The only input is input_string, and it's forceInput - you can't type into this node, you have to wire something into it. That's deliberate: it's a viewer, not an editor. The output_string output is the exact same string, passed through untouched, so the node is safe to drop into the middle of a chain.

    What to do with it

    • Verify the tail end of an LLM prompt after cleaning - paste output from Ollama/Claude/ChatGPT into a String Textbox, run it through String Strip, and preview to confirm the boilerplate is actually gone.
    • Debug a String Multi Replace when a replacement didn't land the way you expected.
    • Just double-check that the prompt the KSampler is about to encode matches what you think you wrote.

    Installation

    Same pack, no dependencies, no models. Via Manager: Manager > Custom Nodes Manager > search "ComfyUI_StringEssentials" > Install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bradsec/ComfyUI_StringEssentials.git
    

    Then restart and grab it under Add Node > utils > StringEssentials.

    Gotchas

    • Blank preview usually means upstream never executed, not a broken node. If a node feeding it didn't change, ComfyUI may skip re-running it - which is exactly why String Preview forces its own re-evaluation, but it can only preview what actually reaches it. Give the graph a real queue pass.
    • Because it's an output node, it runs as part of the output pass. Fine for correctness - the string can't be "stale" in the sense of wrong - but if you're in headless/API mode with no canvas, there's nothing to see, so don't reach for it there.
    • The preview widget is read-only and slightly faded (by design). If you want to edit, that's what the String Textbox is for.

    If you're doing any amount of text wrangling in ComfyUI, this is the node you'll reach for first and keep forever. Cheap, honest, and it ends the guessing.

    Categoryutils/StringEssentials

    Inputs (1)

    NameTypeDefaultDescription
    input_stringSTRINGThe string to preview

    Outputs (1)

    NameTypeDescription
    output_stringSTRING