Nodes/4A NovelAI/NAI Prompt Scheduler
ComfyUI Node

NAI Prompt Scheduler

The reason NovelAI-in-ComfyUI feels like the web client

By tsukino4a·Created 20 days ago·Updated 7 days ago· 5
NAI Prompt Scheduler
    • positive
    • negative
    • characters
    • width
    • height
    config_json{"start_index":0,"task_count":1,"negative":"","tracks":[{"id":"quality","name":"质量","enabled":true,"text":"","mode":"sequence"}],"characters":[{"id":"char-1","name":"角色 1","enabled":true,"positive":"","negative":"","mode":"sequence","use_position":false,"x":0.5,"y":0.5,"use_order":false}],"use_coords":false,"positions_initialized":false,"settings_apply_nai":false}
    execution_index0
    run_id
    size_classNormal
    aspect_ratioPortrait
    width832
    height1216
    seed0

    Most ComfyUI packs make you write your prompt in a plain text box and hope. NAI Prompt Scheduler is the node that makes generating through this pack actually feel like using NovelAI - because it reproduces the web client's prompt editor, multi-character cards, and resolution picker, then adds wildcard support and batch runs on top. It's the node you'll spend your time in, and the other nodes mostly exist to serve it.

    What it does

    The whole editor state lives in a single config_json string - don't hand-edit that; it's the serialized form of a rich UI. Inside that UI you get NovelAI's native prompt syntax, and this is the part that matters: {}, [], and N::text:: weighting are preserved as native NovelAI text. NovelAI's curly braces mean something (stronger/weaker emphasis), so the scheduler treats them as prompt syntax, not as a random-choice wildcard - a distinction that trips people up, because in most other ComfyUI prompt tools {} does mean "pick a random option."

    Your prompt is split into tracks (quality, character, action, scene, character cards), and each field can flip between its positive and negative versions in place. Characters can be positioned on a canvas as normalized x/y coordinates. Resolution is handled by the size_class (Small, Normal, Large, Wallpaper) and aspect_ratio (Portrait, Landscape, Square) enums, or Custom with your own width/height (64–2048, in 64-pixel steps). Normal Portrait, for reference, is 832×1216 - the same presets NovelAI's own UI uses.

    It emits five things: positive, negative, characters, width, and height, which feed straight into NAI Sampler. The characters output is a JSON string - editable if you want to script it - and the Sampler parses it back into per-character generation.

    The seed gotcha, straight from the tooltip

    The seed field here is labeled in the schema with the author's own warning: wildcard selection seed; image seed belongs to NAI Sampler. If you're looking at the Scheduler's seed and expecting it to lock your image, it won't - that's the Sampler's job. This one only decides which wildcard choices get picked.

    Wildcards and batch runs

    With the companion 4A Prompt Manager installed, the Scheduler reads its folder-backed wildcard library: __folder__ / __path/file__ references expand, and tracks can switch randomly or sequentially. Only the plain __wildcard__ form is supported - braces are never treated as random options, for the NovelAI-reason above. Without 4APM installed, __wildcard__ tokens don't expand at all and a batch just repeats your current fixed prompts; every generation node still works.

    Batch runs come from start_index and task_count inside the config, driven by the execution_index and run_id inputs. One implementation detail worth knowing: the node forces itself to re-run every execution (IS_CHANGED returns NaN), which is exactly what a random-picker node must do - but it means this node defeats ComfyUI's cache for everything behind it, so a workflow built around it always re-executes its prompt stage.

    Install

    Same pack as everything else: ComfyUI Manager (search 4A NovelAI), or

    cd ComfyUI/custom_nodes
    git clone https://github.com/tsukino4a/ComfyUI-4A-NovelAI.git ComfyUI-4A-NovelAI
    cd ComfyUI-4A-NovelAI
    python install.py
    

    then restart. Install ComfyUI-4A-Prompt-Manager alongside it to unlock the wildcard integration. There's a Chinese video walkthrough linked from the README (Bilibili) if you prefer watching over reading.

    Category4A NovelAI

    Inputs (8)

    NameTypeDefaultDescription
    config_jsonSTRING{"start_index":0,"task_count":1,"negative":"","tracks":[{"id":"quality","name":"质量","enabled":true,"text":"","mode":"sequence"}],"characters":[{"id":"char-1","name":"角色 1","enabled":true,"positive":"","negative":"","mode":"sequence","use_position":false,"x":0.5,"y":0.5,"use_order":false}],"use_coords":false,"positions_initialized":false,"settings_apply_nai":false}
    execution_indexINT00–2147483647
    run_idSTRING
    size_classCOMBONormal5 options: Normal, Large, Wallpaper, Small, Custom
    aspect_ratioCOMBOPortrait3 options: Portrait, Landscape, Square
    widthINT83264–2048
    heightINT121664–2048
    seedINT00–18446744073709550000Wildcard selection seed; image seed belongs to NAI Sampler.

    Outputs (5)

    NameTypeDescription
    positiveSTRING
    negativeSTRING
    charactersSTRING
    widthINT
    heightINT