ComfyUI Node

TagRAG Chat

Chat your way to a better prompt — until ComfyUI restarts, anyway

By FrostySDXL·Created 2 months ago·Updated 2 months ago· 0
TagRAG Chat
    • assistant_response
    • current_prompt
    • retrieved_tags
    • history_summary
    • status
    resetfalse
    message
    index_ref
    always_reset_on_loadfalse
    conversation_iddefault
    base_urlhttp://127.0.0.1:8080
    allow_remote_base_urlfalse
    retrieval_modefrom_index
    embedding_backendfrom_index
    embedding_model_path
    embedding_n_ctx2048
    embedding_n_gpu_layers-1
    embedding_base_url
    embedding_model
    embedding_endpoint_stylefrom_index
    generation_backendllama_cpp_python
    model
    model_path
    chat_formatllama-2
    n_ctx2048
    n_gpu_layers-1
    top_k10
    max_tokens512
    temperature0.70
    top_p0.95
    top_k_sampling40
    repeat_penalty1.10
    seed-1
    timeout_seconds30
    system_prompt_override
    history_steps6

    TagRAG Prompt is one shot: idea in, prompt out, done. TagRAG Chat is the iteration loop. Type a message, get an answer, then say "make it more cinematic and add rim lighting" and it actually remembers what came before - and re-runs RAG retrieval on every single turn, so the conversation stays anchored to your CSV tag library instead of drifting into whatever the model happens to know.

    This is the node you reach for when you're shaping one prompt through back-and-forth rather than starting from scratch each time. The "prompt enhancer" pattern is mainstream now - local LLM rewrites a rough idea into structured prompt text (the KB's llm-in-comfyui doc traces that whole lineage) - but Chat adds the missing piece: it keeps context between attempts, which is what most enhancer nodes don't do.

    How it works

    History lives in memory on the node instance, keyed by conversation_id (default default), and history_steps (default 6) bounds how many prior turns get sent to the model so the context window doesn't balloon. Every new message triggers a fresh retrieval: the pack reloads the CSV from the index_ref, pulls matching tags, and sends system + history + your current message (with the tag context block) to the backend. Then the reply gets appended to history for the next turn.

    The lifecycle is the thing to internalize: it's all in-memory and nothing is written to disk. Restart ComfyUI, reload the workflow, or let ComfyUI recreate the node instance and your conversation is gone. That's by design. The reset flag (the only required input) clears history deliberately, and always_reset_on_load discards it on every call - handy when a reloaded workflow shouldn't carry stale state from a previous session.

    Inputs that matter

    • reset - required; flip true to wipe the current conversation.
    • message - your next refinement request.
    • index_ref - the JSON string from TagRAG Index.
    • conversation_id - separates independent chats on the same node.
    • history_steps - how many prior turns the model sees (default 6).
    • model_path - local GGUF for the default native backend.
    • generation_backend - llama_cpp_python (default) or llama_server for a running llama.cpp server at base_url (http://127.0.0.1:8080).

    Outputs

    assistant_response (the model's reply), current_prompt (the RAG context block actually sent to the model - great for seeing what influenced the answer), retrieved_tags, history_summary (the stored turns as JSON), and status.

    Install

    Same story as the rest of the pack. ComfyUI Manager - search comfyui-tag-rag - or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/FrostySDXL/comfyui-tag-rag
    cd comfyui-tag-rag
    pip install -r requirements.txt
    

    Restart after installing. The pack downloads no models; you supply a GGUF for generation (model_path) and your own embedding GGUF if you want semantic retrieval. llama-cpp-python in that requirements file is the one dependency that can fail to install on some platforms - the llama-server backend is the fallback for exactly that case. No cloud LLM, no API key, ever.

    Where people get burned

    • "My conversation disappeared." In-memory, see above. Chat is for shaping a prompt in one sitting, not for keeping a record. If the history vanishing mid-session matters, that's the pre-alpha reality of this node.
    • ERROR: message is required - you queued it with a blank message. reset alone is fine (it clears history and returns a status), but a chat turn needs text.
    • Stale history after a workflow reload. Set always_reset_on_load if you don't want old turns leaking into fresh runs.
    • Backend errors - same as the Prompt node: llama-server request failed means check base_url and that the model is loaded server-side; model_path errors mean the GGUF isn't where you pointed.

    Honest take: if you only install one RAG node, it's not this one - TagRAG Prompt is the workhorse. Chat is for the fiddly "nudge it closer" sessions, and it's worth having when that's exactly what you're doing.

    CategoryTagRAG

    Inputs (31)

    NameTypeDefaultDescription
    resetBOOLEANfalse
    messageoptSTRING
    index_refoptSTRING
    always_reset_on_loadoptBOOLEANfalse
    conversation_idoptSTRINGdefault
    base_urloptSTRINGhttp://127.0.0.1:8080
    allow_remote_base_urloptBOOLEANfalse
    retrieval_modeoptCOMBOfrom_index4 options: from_index, lexical, semantic, hybrid
    embedding_backendoptCOMBOfrom_index3 options: from_index, llama_cpp_python, llama_server
    embedding_model_pathoptSTRING
    embedding_n_ctxoptINT2048256–262144
    embedding_n_gpu_layersoptINT-1-1–200
    embedding_base_urloptSTRING
    embedding_modeloptSTRING
    embedding_endpoint_styleoptCOMBOfrom_index3 options: from_index, openai_compatible, llama_cpp_legacy
    generation_backendoptCOMBOllama_cpp_python2 options: llama_cpp_python, llama_server
    modeloptSTRING
    model_pathoptSTRING
    chat_formatoptSTRINGllama-2
    n_ctxoptINT2048256–262144
    n_gpu_layersoptINT-1-1–200
    top_koptINT101–100
    max_tokensoptINT5121–4096
    temperatureoptFLOAT0.700–2
    top_poptFLOAT0.950–1
    top_k_samplingoptINT400–400
    repeat_penaltyoptFLOAT1.101–5
    seedoptINT-1-1–2147483647
    timeout_secondsoptFLOAT301–300
    system_prompt_overrideoptSTRING
    history_stepsoptINT61–50

    Outputs (5)

    NameTypeDescription
    assistant_responseSTRING
    current_promptSTRING
    retrieved_tagsSTRING
    history_summarySTRING
    statusSTRING