Nodes/ComfyUI_DW_Chat/Prompt Extractor
ComfyUI Node

Prompt Extractor

**' out of your chat node's output in one node

By yiwangsimple·Created 2 years ago·Updated about a year ago· 89
Prompt Extractor
    • positive_prompt
    • negative_prompt
    input_text

    Prompt Extractor is the boring node that makes the fun nodes usable. Every chat node in this pack hands you one blob of text - and when you ask an LLM for "a positive prompt and a negative prompt," it returns both in one wall of text with **Positive Prompt:** and **Negative Prompt:** headings. This node finds those headings and splits the blob into two clean STRING outputs you can wire straight into your positive and negative conditioning inputs. That's it. That's the whole job, and it does it well.

    Mechanically it's pure regex and string search - no API, no model, no key, no network. It finds **positive prompt:** (case-insensitive) in input_text, takes everything up to the negative heading as the positive half, and collects the negative half line by line. It even handles the degenerate case where the model repeats "Negative Prompt:" mid-section by folding the duplicates in. Free, deterministic, instant.

    The one real constraint: the headings have to match the format it's looking for. It specifically hunts for **positive prompt:** and **negative prompt:** - with the asterisks and the colon. If your chat node produces Positive Prompt: without bold markers, or 正Prompt: in Chinese, or a JSON object, this node returns empty strings and you'll wonder what broke. So pair it with chat nodes whose system prompts are set up to emit that exact format - the pack's own role-based prompts (like DeepSeek's 报错助手 and the Groq node with a well-written system_message) tend to produce compatible output.

    Inputs: just input_text (multiline). Outputs: positive_prompt and negative_prompt, both STRING.

    Installing it

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

    restart. No extra dependencies, no models - this node is self-contained and adds zero weight to your install.

    Why you'll reach for it

    The classic wiring is: Groq Chat → Prompt Extractor → CLIP Text Encode (positive and negative). You ask the LLM for both prompts in one shot, it splits them, and the extractor does the formatting work so the model's reply actually becomes usable conditioning. It's also handy as a general "clean up this chat output" utility. The limitation is real but narrow - it's a one-format tool in a world where LLMs don't always follow formatting instructions. If your model deviates, add "strictly use the format Positive Prompt: ... Negative Prompt:" to your system message and it'll behave. For everything else in the pack, this is the glue.

    Category🌙DW/prompt_utils

    Inputs (1)

    NameTypeDefaultDescription
    input_textSTRING

    Outputs (2)

    NameTypeDescription
    positive_promptSTRING
    negative_promptSTRING