ComfyUI Node

CharacterPromptSelect

Put characters where you want them in NAI4

By DiaoDaiaChan·Created 2 years ago·Updated 11 months ago· 7
CharacterPromptSelect
    • CharacterPrompt
    character1firefly_(honkai:_star_rail)
    character1_ucnegative_prompt
    character1_x0.50
    character1_y0.50
    character2_enabletrue
    character2kafka__(honkai:_star_rail)
    character2_ucnegative_prompt
    character2_x0.10
    character2_y0.50
    character3_enablefalse
    character3
    character3_ucnegative_prompt
    character3_x0.10
    character3_y0.50
    character4_enablefalse
    character4
    character4_ucnegative_prompt
    character4_x0.10
    character4_y0.50
    character5_enablefalse
    character5
    character5_ucnegative_prompt
    character5_x0.10
    character5_y0.50

    This node exists for one specific feature: NovelAI's nai-diffusion-4 "character position" control, where you tell the model who is in the image and roughly where on the canvas they are. Character_Prompt_Select (shown as CharacterPromptSelect) is a small form for building that list - up to five characters, each with a positive prompt, a negative, and an x/y position. You feed its output into the characterPrompts input of NovelAI_Request_Payload.

    It's the closest thing this pack has to a gimmick node, and it's worth understanding before you get excited: it only does anything on the nai-diffusion-4 models, and it's really a convenience wrapper around NovelAI's own v4 caption structure rather than a new control that ComfyUI adds on top.

    How it works

    Under the hood each character becomes a small object with a prompt, a uc (the negative), and a center position. When the payload builder turns that into the v4 request, it produces the v4_prompt/v4_negative_prompt caption structure NovelAI expects: a base_caption (your main prompt) plus a list of char_captions, each with its own center coordinates. In other words, the node is generating the exact JSON shape NovelAI's v4 models were trained on - the same one their web UI produces when you drag characters onto the canvas.

    The inputs that matter

    The node is a form with five near-identical slots. Only character 1 is required; characters 2–5 each have an enable toggle (character2_enable, etc.) that decides whether the slot counts at all.

    • character1 / character2 / … - the character's tag, in Danbooru-style naming. The defaults are dead giveaways: firefly_(honkai:_star_rail) and kafka__(honkai:_star_rail). That double-underscore in Kafka's tag is real and looks like a typo - it's actually a pretty good test of how literal these models are. The tag has to match the model's vocabulary, so don't freeform it.
    • character1_uc / … - the negative for that character. The default is literally the string negative_prompt, which is a placeholder, not a command; replace it with a real negative if you want one.
    • character1_x / character1_y - the position, as normalized 0–1 coordinates (0.5, 0.5 is dead center). The defaults put character 1 center and character 2 off to the left; the v4 feature is about rough placement, not pixel precision.

    Its one output, CharacterPrompt, is a LIST that wires into NovelAI_Request_Payload's characterPrompts input.

    Install

    Same as the rest of the pack - one install, six nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DiaoDaiaChan/ComfyUI_API_Request
    

    or find "ComfyUI_API_Request" in ComfyUI Manager. Restart, and you're done. No model files, because the model is running on NovelAI's side.

    Common issues

    Two ways to be confused here. First, the feature is silently inert on non-v4 models - nai-diffusion-3 and nai-diffusion-2 don't take character positions, so this whole node becomes decoration. Second, empty character slots don't get included in the payload, but an enabled slot with an empty prompt will ship a character caption with nothing in it, which can do weird things to composition. If you're not using a slot, leave it disabled. And remember the x/y numbers are relative to the full canvas, so a position that works at 832×1216 still lands in the same relative spot at other resolutions.

    CategorySDWebUI-API/SDWebUI-API

    Inputs (24)

    NameTypeDefaultDescription
    character1STRINGfirefly_(honkai:_star_rail)
    character1_ucSTRINGnegative_prompt
    character1_xFLOAT0.50
    character1_yFLOAT0.50
    character2_enableoptBOOLEANtrue
    character2optSTRINGkafka__(honkai:_star_rail)
    character2_ucoptSTRINGnegative_prompt
    character2_xoptFLOAT0.10
    character2_yoptFLOAT0.50
    character3_enableoptBOOLEANfalse
    character3optSTRING
    character3_ucoptSTRINGnegative_prompt
    character3_xoptFLOAT0.10
    character3_yoptFLOAT0.50
    character4_enableoptBOOLEANfalse
    character4optSTRING
    character4_ucoptSTRINGnegative_prompt
    character4_xoptFLOAT0.10
    character4_yoptFLOAT0.50
    character5_enableoptBOOLEANfalse
    character5optSTRING
    character5_ucoptSTRINGnegative_prompt
    character5_xoptFLOAT0.10
    character5_yoptFLOAT0.50

    Outputs (1)

    NameTypeDescription
    CharacterPromptLIST