Nodes/ComfyUI_StarNodes/⭐ Star Prompt Preview And Edit
ComfyUI Node

⭐ Star Prompt Preview And Edit

Read the prompt before the GPU does, and fix it mid-queue

By Starnodes2024·Created 2 years ago·Updated a day ago· 124
⭐ Star Prompt Preview And Edit
    • prompt
    ◄prompt—►
    ◄bypasstrue►

    The problem it solves

    The moment your prompt stops being something you typed, you lose sight of it. A wildcard node expands {golden hour|blue hour|midnight} into one of three options. A prompt picker grabs a random line from a file. An LLM helper rewrites your sentence. The text goes in the front, an image comes out the back, and the exact string that produced it is buried in the PNG metadata - which you read after waiting for the render. At 30 steps on a big model that's an expensive way to find out the wildcard picked the boring option.

    StarPromptPreviewAndEdit is the two-second fix: a node that shows the prompt in a real text box on the canvas and, if you want, stops the workflow so you can edit it before anything samples. It's a legibility node in a graph that's mostly plumbing - the same family as the debug and value nodes that exist because a wire tells you nothing about what's inside it.

    How it works

    The mechanism is refreshingly blunt, and reading the source is worth it because it explains every quirk later.

    The prompt input is forceInput - a socket, not a widget - so you connect any STRING into it. On execution the node pushes the raw text to the browser over ComfyUI's executed message and the pack's JS draws a monospace editor with a ▶ Continue button inside the node body. Frontend paint first, then the pause. In Edit Mode, the Python side then sits in a loop sleeping half a second at a time, checking for an interrupt, until a POST to the pack's own /starnodes/prompt_preview/continue endpoint arrives with your text. That text becomes the node's output. Click Continue and the graph resumes with your edit in hand.

    In Bypass Mode none of that happens: the text is displayed, the node returns the input unchanged, and the queue never stops.

    If you've poked at ComfyUI internals, two details explain how it behaves in a big workflow. It sets OUTPUT_NODE = True, so it executes even with nothing wired downstream - handy as a read-only monitor at the end of a prompt chain. And IS_CHANGED returns float("NaN"), the standard always-rerun trick, which is what makes it re-execute on every queue instead of caching after the first run. The cost is that everything behind it re-runs too, so this belongs in a workflow you're actively iterating on, not a 60-prompt batch you've already tuned.

    Inputs and output

    There are only two things to set, both required: prompt (connect a STRING - you genuinely can't type into it directly, which confuses people in the first thirty seconds) and mode, either Edit Mode or Bypass Mode. One output, prompt, carrying your edited text in Edit Mode and the untouched input in Bypass Mode.

    Wire it wherever a string is accepted: straight into a CLIP Text Encode, or between a wildcard node and the encoder. The latter is the pattern I'd actually recommend - let the wildcards roll, look at what came out, swap one word, hit Continue.

    Install

    ComfyUI Manager → search Starnodes → Install → restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Starnodes2024/ComfyUI_StarNodes
    cd ComfyUI_StarNodes && pip install -r requirements.txt
    

    This node needs none of those packages - it's stdlib plus ComfyUI internals. Then double-click the canvas, search star prompt.

    Where people get burned

    It blocks the whole queue, not just the node. ComfyUI runs one prompt at a time, so while Edit Mode is waiting, nothing else advances - the progress bar just sits there. That's the feature, but it means the moment you're queuing more than a couple of runs, flip the node to Bypass Mode or bypass it in the graph. Any overnight wildcard batch with this left in Edit Mode will generate exactly one image and then wait for you.

    Reload the page while it's waiting and you've lost the button. The pause lives on the server; the Continue button lives in the tab. Close or refresh and the run stays stuck until you hit Cancel/Interrupt - the wait loop checks for interrupt, so that's your escape hatch.

    "Why can't I type in the box?" Because the input is forced to be a connection. If you just want to type a prompt, use a normal text node; this one is a pass-through that displays.

    Treat anything that isn't "Bypass Mode" as Edit Mode. The code deliberately does this, because the frontend can hand it a blank value for a moment after you switch workflows. So if a loaded workflow looks like it's set to something odd and the run still pauses, that's not a bug - it's the fallback.

    It doesn't rewrite anything. It shows you the string and passes your text on verbatim - no attention weights, no cleanup. Which is the point: what you read is exactly what gets encoded.

    Category⭐StarNodes/Text And Data

    Inputs (2)

    NameTypeDefaultDescription
    promptSTRINGConnect any STRING. The text is shown inside the node; in Edit Mode you can change it before it is passed on.
    bypassBOOLEANtrueBypass (default): preview only, text passes through unchanged without pausing | Edit: workflow pauses, you can edit the text and click Continue.

    Outputs (1)

    NameTypeDescription
    promptSTRINGIn Edit Mode this is your edited text, in Bypass Mode the unchanged input.