Nodes/Comfyui_Gemini2/CXH_Local_Prompt
ComfyUI Node

CXH_Local_Prompt

The one node in the Gemini pack that isn't Gemini

By StartHua·Created 2 years ago·Updated 2 years ago· 18
CXH_Local_Prompt
    • out
    prompt

    Right in the middle of a pack named Comfyui_Gemini2 sits a node with zero AI in it, and that's fine - it's the most dependable one in the bunch. CXH_Local_Prompt reads a text file from the pack's folder and outputs its entire contents as a STRING. No API, no key, no network, no GPU. It's a prompt library, and "local" is the only honest half of its name.

    Why you'd want that in a graph: saved prompts. If you keep reusing the same styles, seed ideas, or long prompt templates, you can drop them into the pack's prompt folder as .txt files and switch between them with a dropdown instead of hunting through old workflows to copy-paste. Wire out into CLIP Text Encode's prompt and you've got a tidy way to swap style mid-workflow. The pack even ships two templates to show the idea - 描述图片 ("detailed description of the picture below") and 故事 ("write a story about a magic backpack") - a hint of the author's Chinese-language workflow, with English prompts in the files because that's what the text encoders want.

    How it works only makes sense once you've seen the code. When the node is created, it scans custom_nodes/Comfyui_Gemini2/folder/prompt/ for *.txt files and builds the dropdown from the filenames. Pick one, run it, and the node reads that file and returns the whole thing as a string. On first run it creates the folder and a prompt.txt placeholder so you have somewhere to start.

    The interface is just two things: prompt, a dropdown of filenames (shown without the .txt), and the out STRING output. The dropdown entries are literally your filenames, so name files something readable - photoreal_style.txt beats 001.txt.

    Gotchas, such as they are. The dropdown is built when the node is created, so when you add a new .txt you have to delete and re-add the node (or restart) before it shows up - the file list isn't refreshed per run. And there's a helper route in the pack meant to open the prompt folder in Explorer, but it uses os.startfile, which is Windows-only; on Linux or macOS just open the folder yourself.

    Installation is the pack's standard one - in Manager, search "Comfyui_Gemini2", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/StartHua/Comfyui_Gemini2
    

    Unlike its Gemini siblings, this node needs no key, no pip install beyond what the pack pulls in, and no internet connection to do its job. It's the one you can drop into a locked-down setup without a setup dance.

    CategoryCXH/LLM

    Inputs (1)

    NameTypeDefaultDescription
    promptCOMBO2 options: 描述图片, 故事

    Outputs (1)

    NameTypeDescription
    outSTRING