Nodes/comfyui-aichat/Gemini 文本块
ComfyUI Node

Gemini 文本块

The text part of a Gemini message, as a wireable thing

By spawner1145·Created about a year ago·Updated 10 days ago· 3
Gemini 文本块
    • content_item
    text

    The simplest node in the pack

    GeminiTextBlock wraps any string as a GEMINI_CONTENT_ITEM - a {"text": ...} part - so it can ride through the same content pipeline as images and files. That's the whole job. It's one input, one output, no settings.

    If you're only sending one text prompt, you won't need it: GeminiChat has a user_prompt field that covers that case directly. This node earns its keep when the text you want to send isn't a literal you typed, but a value flowing in from somewhere else in the graph - a wildcard result, a LoRA metadata string, an OCR or transcription node's output, a filename. That dynamic string goes into text, and the content_item output plugs into a GeminiChat content slot or into a GeminiContentConnector next to an encoded image.

    Inputs and output

    text - a multiline string, default empty. content_item - the resulting GEMINI_CONTENT_ITEM.

    That's genuinely all there is. There's no escaping, no templating, no merging - if you need to combine multiple texts, run more than one block or concatenate upstream. If you need text plus an image plus a file in one message, text block + encoder/uploader + connector is the intended assembly.

    Gotchas

    • Sending the same text in user_prompt and in a text block duplicates it in the message. Pick one place.
    • An empty block still produces an empty text part; the Chat node skips falsy parts, so it's harmless, but keep the graph readable anyway.
    • It's a local-only node - nothing is sent until the content item reaches GeminiChat, so it costs nothing to have in a workflow that isn't running.

    Install

    With the pack, via ComfyUI Manager (search "comfyui-aichat") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/spawner1145/comfyui-aichat
    

    Restart ComfyUI. No models, no downloads; the pack needs only httpx, openai, and PyYAML. It's the most boring node in the pack on purpose - when you're building multi-part messages, boring is exactly what you want between the interesting parts.

    CategoryGemini API/Content

    Inputs (1)

    NameTypeDefaultDescription
    textSTRING

    Outputs (1)

    NameTypeDescription
    content_itemGEMINI_CONTENT_ITEM