Nodes/ComfyUI-PromptEngine/PromptEngine Node
ComfyUI Node

PromptEngine Node

Chain a prompt together one dimension at a time

By aiimagestudio·Created 6 months ago·Updated 5 months ago· 4
PromptEngine Node
    • prompt_out
    categoryethnicity
    style🎲 Random Style
    variationfalse
    seed0
    custom_text
    prompt_in

    PromptEngine Node is the modular building block of the ComfyUI-PromptEngine pack. Where its sibling PromptEngineFull shoves all 21 visual dimensions into one node, this one handles exactly one dimension per node - and you chain several of them together, prompt_out feeding the next node's prompt_in. Same dictionaries, same logic, but you decide which dimensions even exist in the graph. If you want a prompt with outfit and lighting but not ethnicity, you just don't add those nodes.

    What one node does

    Each instance owns one dimension, chosen from the category dropdown: ethnicity, gender, age_appearance, subject_appearance, hair_style, hair_color, outfit, accessories, pose, body_direction, expression, gaze, location_type, background_props, atmosphere, shot_angle, shot_distance, composition, lighting, color_grade, visual_style. You then pick a style entry for it: "🎲 Random Style", "── (skip) ──", or one of the dictionary's cluster names for that dimension.

    The few inputs you'll actually touch:

    • category - which dimension this node owns. The options list in the API includes internal keys plus English/Chinese display names; the frontend picks a friendly label based on your ComfyUI locale.
    • style - the dictionary entry (or Random/Skip). Skip means "don't include this dimension."
    • variation - off emits the cluster's canonical_phrase; on picks a random sample from the cluster. Same switch as the Full node, scoped to this one dimension.
    • seed - reproducible random style/sample selection. The control_after_generate widget is attached automatically, same as any seed field in ComfyUI.
    • custom_text - this one's a true override: if it's non-empty, it replaces the dictionary selection for this node entirely. Great for hand-authoring one phrase without editing a dictionary file.
    • prompt_in - the optional upstream string. Wire the previous PromptEngine Node's prompt_out here to keep building.

    Output is a single prompt_out STRING, which you either feed into the next PromptEngine Node or straight into your CLIP/encoder text input. The pack's sample workflow chains about a dozen of these and previews the result with a text preview node.

    The merge behavior (read this once)

    Two dimensions have special handling baked in. If a node's category is gender, the output merges with whatever the previous node emitted when that looks like an ethnicity phrase - "White woman" instead of "White, woman". And hair_style merges with a preceding hair_color the same way. The pack's README also recommends keeping node order close to the built-in dimension order (ethnicity → gender → age → … → visual_style) for the most stable, readable output. That's advice worth following; it's what makes chained prompts diffable across runs.

    Install

    Same as any custom node:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jinxishe/ComfyUI-PromptEngine
    pip install -r requirements.txt
    

    Restart ComfyUI, or install via ComfyUI Manager by searching "ComfyUI-PromptEngine". For just the composition nodes you only need the core deps (openai, tqdm) - the heavy machine-learning stack is for the Step 1-3 dictionary tools, not for this.

    Gotchas

    • New dictionary entries (e.g. after running Step 3) won't show in the dropdown until you refresh the ComfyUI page - the frontend caches the list.
    • The style dropdown in the API schema lists a giant union of values across every dimension; the frontend trims it to the dimension you've selected, so don't let the 5,000+ item list scare you.
    • It's more clicking than the Full node. That's the trade: modularity and per-dimension branching cost you setup time. If you're building a one-shot preset and don't need the graph structure, reach for PromptEngineFull instead.

    This is a brand-new pack with no real community history yet, so the bundled dictionaries are a decent seed - the pack's whole point is that you grow them from your own prompt data with its Step 1-3 toolchain.

    CategoryPromptEngine

    Inputs (6)

    NameTypeDefaultDescription
    categoryCOMBOethnicity63 options: ethnicity, gender, age_appearance, subject_appearance, hair_style, hair_color, +57
    styleCOMBO🎲 Random Style5482 options: candid 肖像柔胶片, intense 品红粉色光晕, muted 大地色系配黑, 1990s film aesthetic, 1990s film photography, 1990s_film_aesthetic, +5476
    variationBOOLEANfalse
    seedINT00–2147483647
    custom_textSTRING
    prompt_inoptSTRING

    Outputs (1)

    NameTypeDescription
    prompt_outSTRING