Nodes/ComfyUI_DW_Chat/Moonshot Multi Chat
ComfyUI Node

Moonshot Multi Chat

Multi-turn chat with the history in your hands

By yiwangsimple·Created 2 years ago·Updated about a year ago· 89
Moonshot Multi Chat
    • chat_history
    prompt
    model
    temperature0.3
    max_tokens1000
    system_message
    reset_conversationfalse

    Moonshot Multi Chat is the stateful sibling of the pack's Single Chat node. Where the single-turn version forgets everything between runs, this one keeps the whole conversation on the node and replays it to Kimi every time you hit queue. It's for the workflows where you want to iterate - refine a prompt across runs, debug an error message by asking follow-ups, have the model rewrite its own output. The trade-off is that you have to remember it's stateful, because nothing in the UI yells at you.

    The mechanism is simple: the node holds a conversation_history list, appends each new prompt, sends the whole thing to api.moonshot.cn, and returns the chat - all of it - as a single chat_history string, formatted like user: ... / assistant: ... with a dashed separator between turns. That output is genuinely useful: you can dump it to a text file and have a written record of the whole back-and-forth.

    Inputs mirror the Single node - prompt, model (8k/32k/128k context), temperature (default 0.3), max_tokens, optional system_message - plus one extra: reset_conversation, a boolean that wipes the history before this run. Default is False, which is exactly backwards for anyone who just wants a clean call, so make a habit of toggling it when you want a fresh thread. The same trick as the Groq node in this pack: history is stored on the node instance, so deleting the node is also a reset.

    Output is the chat_history STRING. It's not a clean "answer" like the single node - if all you need is the latest reply, this node's format is clunkier. Reach for Single Chat for that.

    Installing and keys

    Same pack, same dance:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yiwangsimple/ComfyUI_GroqChat
    

    then restart, copy api_key.ini.example to api_key.ini, and drop your key from platform.moonshot.cn/console/api-keys into MOONSHOT_API_KEY. The OpenAI SDK dependency installs from requirements.txt.

    Gotchas

    Two things trip people up. First, the obvious one: forget reset_conversation and your prompt gets asked in the middle of an ever-growing conversation - context window fills up, costs creep. Second, that chat_history output is a formatted dump, not raw JSON, so don't try to pipe it into anything that expects clean message objects. This node is about human-readable iteration, not automation plumbing.

    Category🌙DW/Chat

    Inputs (6)

    NameTypeDefaultDescription
    promptSTRING
    modelCOMBO3 options: moonshot-v1-8k, moonshot-v1-32k, moonshot-v1-128k
    temperatureFLOAT0.30–2
    max_tokensINT10001–128000
    system_messageoptSTRING
    reset_conversationoptBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    chat_historySTRING