Nodes/ComfyUI Ollama/Ollama Load Context
ComfyUI Node

Ollama Load Context

Read a saved Ollama conversation back into your graph

By stavsap·Created 2 years ago·Updated 10 months ago· 853
Ollama Load Context
    • context
    context_file

    This is the read half of a pair - OllamaSaveContext writes a conversation state to disk, OllamaLoadContext reads it back in. It has zero recorded impressions, which tracks: it's a small persistence utility, not something you stumble onto unless you already know you saved a context and specifically want it back. Nobody googles this node before they've used its counterpart.

    How it works

    context_file is a dropdown, not a text field - ComfyUI populates it from whatever files OllamaSaveContext has already written, the same convention as a checkpoint or LoRA loader listing what it finds in a folder rather than making you type a path. Pick one, and the node outputs the saved conversation state as a plain string.

    The gotcha worth knowing

    Same story as its counterpart: the context this node outputs is typed STRING, which is the format used by the deprecated OllamaGenerateAdvance node's context input/output - not the current-generation OllamaGenerateV2's OLLAMA_CONTEXT type, and not OllamaChat's OLLAMA_HISTORY type either. ComfyUI enforces socket types, so this node's output will only actually connect to something expecting a plain string. In practice that means the real workflow is: run OllamaGenerateAdvance with keep_context on, save its context output with OllamaSaveContext, then next session load it here and feed it back into OllamaGenerateAdvance's optional context input to resume the conversation - all on the older V1-lineage node, not the current one.

    Inputs and outputs that matter

    • context_file (enum, populated from saved files) - the only input. Nothing to configure beyond picking the right one.
    • Output: context (STRING) - wire this into OllamaGenerateAdvance's context input to resume where a previous session left off.

    Installing it

    Same as the rest of the pack. Via ComfyUI Manager, search comfyui-ollama (by Stav Sapir) or ollamastavsap. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/stavsap/comfyui-ollama
    pip install -r requirements.txt
    

    then restart. This node does no network calls of its own - it's local file I/O only, so there's no Ollama-server dependency to troubleshoot for this specific node, only for whatever generates the context you're loading.

    Common issues

    Empty dropdown. You haven't run OllamaSaveContext yet, or you saved it under a filename you're not expecting - there's nothing to load until a save has actually happened first.

    Won't connect to OllamaGenerateV2 or OllamaChat. Type mismatch, not a bug - see above. This node only speaks the older STRING-context format.

    Building for the long term. Tying a workflow to save/load context long-term means depending on a deprecated node (OllamaGenerateAdvance) that isn't getting further updates. If you don't actually need state to survive a ComfyUI restart, OllamaChat's native history chaining is the more current path - it just won't persist to disk on its own.

    CategoryOllama

    Inputs (1)

    NameTypeDefaultDescription
    context_fileCOMBO0 options:

    Outputs (1)

    NameTypeDescription
    contextSTRING