ComfyUI Node

Prompt Fetcher

The ComfyUI node with no inputs that borrows a Civitai prompt

By Darkdevworker·Created 3 months ago·Updated about a month ago· 1
Prompt Fetcher
    • positive_prompt
    • negative_prompt

    You found a model on Civitai whose sample images look exactly like what you want. The prompt is right there in the metadata, and now you're retyping 400 characters into a CLIP Text Encode by hand, or squinting at two browser windows trying to copy-paste cleanly. Prompt Fetcher is the lazy fix: click a button on the image, the text lands in a node, the node feeds your encoders.

    It's one node out of a much bigger extension - the CivitAI + Hugging Face Downloader pack, which is mostly a browse-and-download sidebar for Civitai and Hugging Face. Prompt Fetcher is the only graph node the author ships for prompt work, and it exists to close the loop between "I found this model" and "I ran this model."

    What it actually is

    A string holder with two sockets. That's the whole node. No text box, no widgets, nothing to type into - required and optional in its schema are both empty, and it declares two outputs, both STRING: positive_prompt and negative_prompt.

    That's the part that confuses people who add it expecting a text field. There isn't one. The text arrives from the sidebar: open any model's preview image in the pack's lightbox, and if the image carries generation metadata the panel shows a ⚡ Use in workflow button next to the prompt. Press it and the positive and negative go to the node. Then you run the workflow and the sockets carry them downstream.

    Where it plugs in: right-click the text widget on your positive CLIP Text Encode and Convert widget to input, then wire positive_prompt into it; same for the negative branch. If you're the sort who keeps a note node or a filename template fed by a prompt string, it'll take these too - anything that wants a STRING.

    How the mechanism works

    Worth understanding, because it explains both the magic and the trap. The extension's server exposes POST /civitai/prompt-fetcher; the ⚡ button hits it, the server calls set_prompts(), and that writes into a plain module-level dict in nodes.py:

    _prompt_store = {"positive": "", "negative": "", "updated_at": 0}
    

    Every Prompt Fetcher node you place reads from that same dict. There is no per-node state, no widget, no file on disk - the prompts live in the server's RAM, globally.

    The refresh trick is IS_CHANGED, returning _prompt_store["updated_at"], a time.time() stamp set when prompts arrive. ComfyUI's cache compares that against the previous run's, so the node stays cached and cheap until you actually click the button - then the stamp changes and the node plus everything downstream re-executes. Clean invalidation, no NaN sledgehammer. The node is also flagged OUTPUT_NODE = True, so it's a valid graph terminus: a workflow whose only "output" is a Prompt Fetcher will run rather than sit inert.

    Installing it

    The node ships inside the downloader pack, so you install the pack. Simplest path is ComfyUI Manager - search the pack title - or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Darkdevworker/ComfyUI-CivitAiHF-Downloader.git
    pip install -r ComfyUI-CivitAiHF-Downloader/requirements.txt
    

    Restart ComfyUI. Dependencies are light (requests, tqdm, markdown-it-py, straight from the repo's requirements.txt), there's no model to download, and nothing here touches your GPU. You'll know it loaded when the console prints Server loaded and Nodes loaded and the CivitAI sidebar tab shows up.

    Where people get burned

    • Nothing to see on the node. After clicking ⚡ the node still looks blank - the values aren't displayed anywhere on it. To confirm they landed, hit the extension's own endpoint: curl http://127.0.0.1:8188/civitai/prompt-fetcher returns the stored positive and negative as JSON.
    • The button only shows up when the image has metadata. The panel reads the prompt out of the preview's generation data, so if Civitai has none for that image it says so and offers nothing to send. In practice you're relying on the A1111-style parameters block or a ComfyUI graph chunk being present - usually true on model showcase images, quite often not on re-uploads and re-encoded files. No metadata, no button; back to copy-paste.
    • The prompts are not in your workflow. They're in server memory. Save the workflow, restart ComfyUI, and those sockets emit empty strings - an empty prompt is a silent, confusing generation, not an error. So don't share a workflow that depends on this node. If a prompt matters, paste it into the encoder and keep the graph self-contained. That's the real design cost of the node.
    • Everyone on the server shares one store. It's global, so any workflow, any tab, any user on that instance overwrites the same two strings. Solo desktop: irrelevant. A shared box with two people rendering: whoever clicked last wins, and the other person's next run gets a stranger's prompt. Also, clicking ⚡ can't alter a run that's already queued - click first, then run.

    Should you reach for it

    As a convenience node, yes, if you're already running this pack. It removes the most annoying copy-paste in the Civitai loop, and it costs nothing. If you don't want the full downloader sidebar, you don't want the node either - it's an output tap for that UI, useless on its own, and the core PrimitiveString node does the same job with text you own and can actually save.

    CategoryCivitai

    Inputs (0)

    No inputs

    Outputs (2)

    NameTypeDescription
    positive_promptSTRING—
    negative_promptSTRING—