ComfyUI Node

Chat_Message _O

The building block of the advanced ChatGPT chain

By omar92·Created 3 years ago·Updated 5 months ago· 181
Chat_Message _O
    • OPENAI_CHAT_MESSAGES
    roleuser
    content act as prompt generator ,i will give you text and you describe an image that match that text in details use gelbooru tags in your description also describe the high quality of the image, answer with one response only

    The Advanced OpenAI section of the Quality of Life Suit works like a real chat API client: you construct a conversation one message at a time, combine the messages, and send them off for a completion. Chat_Message _O is the piece that creates a single message - you pick a role and type content, and out comes an OPENAI_CHAT_MESSAGES object containing that one message.

    It lives under O/OpenAI/Advanced/ChatGPT, and it's the first step in the pack's documented advanced workflow: build a system message with Chat_Message, build a user message with another, merge them with combine_chat_messages _O, and hand the result to Chat completion _O. That's how you get multi-turn or system-prompt-driven behavior that the one-shot Simple/compact nodes can't express.

    How it works

    The node wraps {"role": role, "content": content} into a messages list and returns it under the OPENAI_CHAT_MESSAGES type. role is a dropdown with user, assistant, or system; content is a multiline string.

    The content field ships prefilled with the same prompt-generator system message used across the pack ("act as prompt generator, use gelbooru tags…") - so if you're building a system message, it already has a sensible starting point, and you can replace it with anything you want the model to be. Type "you are a prompt editor that outputs only comma-separated tags" in a system message and you've got a different tool than the default.

    The output type is a single-message list, which matters for the next step: combine_chat_messages _O merges two message objects at a time, so for a three-message conversation you chain combines. Keep that in mind when you're planning the graph.

    Installing

    Pack-wide install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/omar92/ComfyUI-QualityOfLifeSuit_Omar92.git
    

    or ComfyUI Manager → search ComfyUI-QualityOfLifeSuit_Omar92, then restart ComfyUI. The openai package is installed on demand. This node itself doesn't call the API - that's Chat completion _O's job - so it doesn't need a key to run, only to complete the chain.

    Gotchas

    Two things. First, message content here is a plain string, but there's a deprecated sibling Chat_Message_fromString _O that expects a STR object (the old string-wrapper type) - if you've loaded an old workflow and the wire won't connect, that's why, and you should swap to this current node. Second, remember the chain's endpoint still has the pack's OpenAI SDK fragility: completion works when the installed openai version matches what the code expects, and there are documented breakages when it doesn't. If you're building a fancy multi-message assistant workflow, budget some time for that.

    CategoryO/OpenAI/Advanced/ChatGPT

    Inputs (2)

    NameTypeDefaultDescription
    roleCOMBOuser3 options: user, assistant, system
    contentSTRING act as prompt generator ,i will give you text and you describe an image that match that text in details use gelbooru tags in your description also describe the high quality of the image, answer with one response only

    Outputs (1)

    NameTypeDescription
    OPENAI_CHAT_MESSAGESOPENAI_CHAT_MESSAGES