Nodes/ComfyUI-Gemini/🆕Gemini_15P_Chat_Advance_Zho
ComfyUI Node

🆕Gemini_15P_Chat_Advance_Zho

Multi-turn chat with a system instruction, no key in the workflow

By ZHO-ZHO-ZHO·Created 3 years ago·Updated 2 years ago· 784
🆕Gemini_15P_Chat_Advance_Zho
  • image
  • response
promptWhat is the meaning of life?
system_instructionYou are creating a prompt for Stable Diffusion to generate an image. First step: describe this image, then put description into text. Second step: generate a text prompt for %s based on first step. Only respond with the prompt itself, but embellish it as needed but keep it under 80 tokens.
model_name

This is the chat-capable sibling of Gemini_15P_Advance_Zho, and for anyone who actually wants a conversation with a 1.5 Pro model inside ComfyUI, it's the node to reach for. Same implicit-key setup, same 1.5 Pro only, same system instruction - but instead of one prompt in / one answer out, it remembers. The node keeps a chat session alive across queue runs, so run 1 is "write a story about a lighthouse," run 2 is "now make it spooky," and the model knows what the first story was.

Why does this matter? ComfyUI workflows run once per queue. Most Gemini nodes here are stateless - every execution is a fresh request. The Advance chat node is the exception that holds state, which is what turns it from a prompt tool into an actual chatbot you can iteratively direct. ZHO demoed exactly this: a chat robot wired to DisplayText_Zho so each answer shows up in the graph.

How it works

The mechanism is model.start_chat(history=[]) held on the node instance, then chat.send_message(...) on each run. The 1.5 Pro path accepts an optional image - the code path for vision in chat is actually wired correctly here, unlike the plain chat nodes (see below). Its system_instruction input is applied when the session starts.

One subtlety that trips people: the output is named response, but it's really the formatted chat history - the whole transcript with role: lines and dashed separators, not just the latest reply. The node literally returns chat_history. Great for watching the conversation unfold in DisplayText_Zho; slightly surprising if you were expecting only the new answer.

Inputs

  • system_instruction - the persona, set when the chat starts.
  • prompt - each message you send.
  • model_name - locked to gemini-1.5-pro-latest.
  • image (optional) - send an image mid-conversation; 1.5 Pro handles it.

Install and gotchas

cd ComfyUI/custom_nodes
git clone https://github.com/ZHO-ZHO-ZHO/ComfyUI-Gemini.git
cd ComfyUI-Gemini
pip install -r requirements.txt

The statefulness is the feature and the trap. There's no reset button in the node - the session lives on the node instance for as long as ComfyUI runs. To start a fresh conversation you either create a new node or restart ComfyUI. And watch the free-tier rate limits (roughly 2 RPM on 1.5 Pro at launch): a long back-and-forth can trip them mid-conversation, and because the history keeps growing, you'll feel the latency creep up as each request carries the whole transcript.

CategoryZho模块组/✨Gemini

Inputs (4)

NameTypeDefaultDescription
promptSTRINGWhat is the meaning of life?
system_instructionSTRINGYou are creating a prompt for Stable Diffusion to generate an image. First step: describe this image, then put description into text. Second step: generate a text prompt for %s based on first step. Only respond with the prompt itself, but embellish it as needed but keep it under 80 tokens.
model_nameCOMBO1 options: gemini-1.5-pro-latest
imageoptIMAGE

Outputs (1)

NameTypeDescription
responseSTRING