Nodes/comfyui_LLM_party/load SQL memory
ComfyUI Node

load SQL memory

Load SQL memory — comfyui_LLM_party

By heshengtao·Created 2 years ago·Updated 7 days ago· 2,321
load SQL memory
    • system_prompt
    • user_history
    • history_id
    system_prompt
    history_id1
    database_urlpostgresql://myuser:mypassword@localhost:5432/mydatabase
    clear_memofalse

    This is the third and most durable of comfyui_LLM_party's memory backends: instead of a JSON file or a Redis key, your conversation history lives in a proper SQL database. Same job every time - give an LLM node something to remember across runs - but this is the option for when you actually want that history to persist reliably, survive a server restart, and be queryable outside the workflow itself.

    That's the real trade-off across the pack's three memory nodes. The JSON-file node is zero-infrastructure but fragile under concurrency. The Redis node handles concurrent access well but is, by nature, an in-memory-first store - great for speed, not what you'd reach for as your system of record. This node is the one built for durability: a SQL database is where you'd naturally want long-term conversation history to actually live if you ever need to audit it, back it up, or run any kind of analysis on it later. Which of the three you pick is really a question of how much infrastructure you're willing to run and how much you care about that history outliving a restart.

    Inputs that matter. system_prompt is a required multiline STRING - same role as in the other two memory nodes, the instructions framing the conversation. history_id (default 1) is an INT rather than a string key, and it's what identifies a specific conversation thread inside the database - increment or change it to start a fresh thread while keeping the same underlying table. database_url defaults to postgresql://myuser:mypassword@localhost:5432/mydatabase, which tells you the node expects a standard database connection string - swap in your actual host, credentials, and database name. clear_memo is a boolean, off by default, that wipes the history under the given history_id without touching any other thread or the node graph itself. Outputs are system_prompt, user_history (STRING), and history_id (INT, passed through) - feeding your LLM node its context same as the other two memory nodes.

    Installing it. This ships with the full comfyui_LLM_party pack - no separate install, but it does pull in a SQL client library as part of requirements.txt. Get the pack via ComfyUI Manager (search "comfyui_LLM_party") or cd ComfyUI/custom_nodes && git clone https://github.com/heshengtao/comfyui_LLM_party, then pip install -r requirements.txt from inside the project folder using your ComfyUI Python environment, and restart.

    Where this actually breaks. As with the other memory nodes, the node itself rarely misbehaves - the failure is almost always the connection string. If it can't connect, check the basics first: is the database actually running and reachable from the machine ComfyUI is on, is the host/port right, do the credentials match, and does the database named in the URL actually exist yet (this node reads and writes history, it doesn't create a database for you). On a hosted or remote executor, localhost in the default connection string won't point at anything - you need a real, network-reachable database, self-hosted or managed. If history isn't showing up where you expect, confirm you're passing the same history_id consistently; a different ID is a genuinely separate, empty thread by design. And if the whole pack fails to import rather than just this node erroring on connection, that's this project's much larger bundled requirements.txt - the README's requirements_fixed.txt is the fallback worth trying before assuming the database is at fault.

    Category大模型派对(llm_party)/记忆(memory)

    Inputs (4)

    NameTypeDefaultDescription
    system_promptSTRING
    history_idINT1
    database_urlSTRINGpostgresql://myuser:mypassword@localhost:5432/mydatabase
    clear_memoBOOLEANfalse

    Outputs (3)

    NameTypeDescription
    system_promptSTRING
    user_historySTRING
    history_idINT