Nodes/ComfyUI-Vivax-Nodes/Ollama Message
ComfyUI Node

Ollama Message

Build a Chat History One Message at a Time

By vivax3794·Created 2 years ago·Updated 2 years ago· 3
Ollama Message
  • prev_message
  • messages
roleuser
message

Before you can generate, you need something to generate from - a chat history. Ollama Message is the constructor node for that history: one node adds one message to the conversation, with a role and content, and hands the growing list to the next node. Stack a few of these together and you've got a system prompt, a user question, maybe a follow-up, all in the right order.

The community's most popular use of Ollama-in-ComfyUI is exactly this shape: a system prompt that defines a character or a prompt-writing style, a user message with the actual request, then generate. Ollama Message is how you assemble that prompt stack node by node instead of pasting a wall of text into one field.

How it works

The mechanism could not be simpler. The node takes a role, a message string, and (optionally) the previous conversation, then returns the previous list plus one new message in Ollama's format - {"role": ..., "content": ...}. It never talks to a server; it's pure data assembly. Ollama Generate does the actual network call later.

The inputs and outputs

  • role (enum: user, system, assistant; default user) - who's speaking. system is where you put instructions and character definitions; user is the actual request; assistant is for injecting a prewritten reply.
  • message (STRING, multiline) - the message content. Multiline, so paste away.
  • prev_message (MESSAGE[], optional) - the conversation so far. Wire the previous Ollama Message's output here to chain them.

Output:

  • messages (MESSAGE[]) - the updated conversation, ready for the next Ollama Message or straight into Ollama Generate.

Common issues

  • The chain is manual. Nobody auto-links these nodes. Each one needs its prev_message wired to the previous node's output, in order. Forgot to connect it and every message starts a fresh conversation - your system prompt silently never makes it to the model.
  • Order is left to right. Whatever chain you build defines the order the model sees. A system message placed after your user request is a valid but usually pointless instruction. Build top-to-bottom.
  • MESSAGE[] is pack-local. This output only plugs into nodes that understand this pack's message type - practically speaking, this pack's own Ollama nodes. Don't expect it to feed an arbitrary OpenAI-compatible chat node.
  • It's not a server node. No Ollama server needed here, but the moment you hook it to Ollama Generate, that node's host and model settings become the whole game. Get the history right and the server running.

Install

Install with ComfyUI Manager (search ComfyUI-Vivax-Nodes) or clone:

cd ComfyUI/custom_nodes
git clone https://github.com/vivax3794/ComfyUI-Vivax-Nodes

then restart ComfyUI. The pack's only Python dependency is rich; the HTTP work happens in Ollama Generate via requests, already part of ComfyUI. No model downloads inside ComfyUI - the actual model lives in your Ollama install, external to this pack. Small single-author pack; the usual read-the-repo-first advice for custom nodes applies.

Categoryvivax/ollama

Inputs (3)

NameTypeDefaultDescription
roleCOMBOuser3 options: user, system, assistant
messageSTRING
prev_messageoptMESSAGE[]

Outputs (1)

NameTypeDescription
messagesMESSAGE[]