Nodes/ComfyUI-A5Nodes/A5TextPrompt
ComfyUI Node

A5TextPrompt

Pipe text in without losing the box you type in

By A5Projects·Created 3 days ago·Updated 3 days ago· 1
A5TextPrompt
    • text
    allow_external_text_replacetrue
    text
    external_text

    Here's the annoyance this node exists for. You wire an LLM enhancer into a CLIP Text Encode, so external text is driving your prompt - and now you can't see or edit it without unplugging the wire. Copy, paste, unplug, re-plug.

    A5TextPrompt is a text node with a switch: let an incoming string replace what's in the box, or block it. Either way, the prompt stays visible and editable, and there's a 20-entry history with back/forward and export.

    What it is

    Two widgets and one optional socket go in, one string comes out.

    • text - the multiline box. It's what the node returns.
    • allow_external_text_replace - on (allow) by default.
    • external_text - optional STRING input, and its tooltip is precise: it replaces the visible text only when replacement is allowed.

    When replacement is on and something is connected, the incoming value wins - and the node sends a websocket event so the frontend mirrors that value into the widget. That's the trick: the text you can't normally reach becomes the text sitting in your box, ready to be edited, copied, or kept as the seed for the next run. Flip the toggle to block and your typed text wins, even with the wire still attached.

    The author's own framing is that this is the simpler, text-only, undo-capable half of his enhancer node - he built it because he was tired of round-tripping prompts between a text field and a CLIP field.

    The history

    The node's toolbar has < and >, an index indicator, and an Export button. It keeps up to 20 entries: added when external text arrives, or when you type and click outside the node. Export dumps them with timestamps.

    Two honest limitations, both stated in the README: this history is not persistent across ComfyUI restarts and it's stored per workflow - it's a widget property, not something the Python side keeps. So it survives a save/load of that graph, and dies with a fresh canvas. If a prompt matters, export it.

    There's a subtlety in where the history lives that's worth knowing: it's frontend-only, so a run triggered from the API or a script won't populate it. This is a convenience feature for the person sitting at the screen.

    Why you'd use it instead of a Primitive

    ComfyUI's built-in PrimitiveStringMultiline is the honest, minimal version of this: one value, one string output. It's fine, and if you only need to convert a widget into a wire, it's all you need - and it's worth setting up, because giving a repeated value one authoritative source is the single best habit in this layer of the graph.

    What the core primitive doesn't give you is the toggle. With a primitive, whatever feeds it is the text; the day you want to override it by hand, you're editing the upstream node or unplugging a wire. A5TextPrompt is for the workflow where the prompt is sometimes generated and sometimes typed - enhancer on, enhancer off - and you don't want to rewire to switch modes.

    It's also useful as a wall between you and a nondeterministic upstream: leave the wire connected, block replacement, and your prompt is now yours while the enhancer keeps doing its thing for everything else.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/A5Projects/ComfyUI-A5Nodes
    

    Restart ComfyUI and refresh the browser; or find A5 Custom Nodes in ComfyUI Manager and choose the numbered version over Nightly. No dependencies, no weights. One of nine nodes in the same pack, so one install covers it. Disable standalone copies - the pack preserves the original node IDs so existing workflows still load, and duplicates cause registration conflicts.

    The UI here is JavaScript, so the pack's browser warning lands hardest on this node: classic node mode in Firefox, and if Nodes 2.0 breaks the history toolbar's rendering, reload the node from the context menu.

    Where people get burned

    Wiring to the box instead of the socket. The README says it directly: connect external strings to the External Input connector, not to the textbox. The widget isn't an input; you can't drag a link onto it.

    Expecting the box to keep its value. If replacement is allowed and text is connected, the incoming value overwrites what you typed every run. That's the feature working. Block it if you didn't mean it.

    allow_external_text_replace with nothing connected is a no-op - the node returns text, which is also what happens on block. The only difference between the two states exists when there's a wire.

    Text is text. This node does no sanitising, no trailing-comma cleanup, no dynamic-prompt expansion. Enhancers leak preambles like "Here is your enhanced prompt:" and this will hand that straight to your encoder. Read the box once in a while; that's what it's there for.

    Categoryutils/Text

    Inputs (3)

    NameTypeDefaultDescription
    allow_external_text_replaceBOOLEANtrueAllow a connected external_text value to replace the visible text when this node runs.
    textSTRINGEditable text returned by the node.
    external_textoptSTRINGOptional text source. It replaces the visible text only when external replacement is allowed.

    Outputs (1)

    NameTypeDescription
    textSTRING