Nodes/ComfyUI_NAIDGenerator/Convert Prompt βœ’οΈπŸ…πŸ…πŸ…˜
ComfyUI Node

Convert Prompt βœ’οΈπŸ…πŸ…πŸ…˜

1.2) prompt syntax into NovelAI's {} and []

By bedovyyΒ·Created 3 years agoΒ·Updated 5 days agoΒ· 114
Convert Prompt βœ’οΈπŸ…πŸ…πŸ…˜
    • STRING
    β—„textβ€”β–Ί
    β—„weight_per_brace0.05β–Ί
    β—„syntax_modebraceβ–Ί

    Every ecosystem has its own emphasis syntax, and ComfyUI's and NovelAI's disagree in the most confusing way possible. ComfyUI conventions use (word) or (word:1.2) to boost a token. NovelAI uses {word} to boost and [word] to weaken - and because NovelAI's backend also accepts () from the web UI, a ComfyUI habit like (masterpiece) gets interpreted as something else entirely once it hits the NAI API. PromptToNAID exists purely to fix that mismatch.

    Feed it a prompt string and it returns a STRING you can wire straight into the positive input of GenerateNAID. Two inputs:

    • text - the prompt to convert. This is a "force input" port, so you can wire the output of another text node into it, or just type.
    • weight_per_brace - 0.05 default (0.05 to 0.10). How much emphasis one brace pair represents. At the default, (word:1.2) becomes {word}{word}{word}{word}-ish - actually, four levels up - and (word:0.8) becomes [word][word][word][word]. It's a precision dial; 0.05 gives you finer weight steps than 0.10, and you'll only touch it if you're trying to match a specific NovelAI weight convention.

    The mechanism is the genuinely nice part, and it's why this node works where a naive find-and-replace wouldn't: the pack's converter parses your prompt into a nested stack of weighted tokens - handling (word:1.2), bare (word) (which defaults to 1.1), and nesting - then emits the NAI brace/bracket form with the weight-per-brace you chose. It even pre-processes escaped parens so a literal \( in your prompt survives as a literal paren instead of being treated as emphasis. There's also a numeric fallback in the parser for negative weights, which braces can't express - those come out as weight::token :: syntax.

    So the workflow is: build prompts with ComfyUI muscle memory β†’ push them through PromptToNAID β†’ into Generate's positive. (Feed the same text through a second one for the negative, or just keep negative simple - the lowres default is fine.) It lives in the NovelAI/utils category, alongside the mask converters, and it's free - a local string transform, no Anlas, no API call.

    Install is the pack standard: ComfyUI Manager β†’ search "ComfyUI_NAIDGenerator", or git clone into custom_nodes/ and restart. You don't even need a NovelAI token to test this node on its own, since the conversion happens locally - which makes it a good first install check before you bother setting up .env.

    CategoryNovelAI/utils

    Inputs (3)

    NameTypeDefaultDescription
    textSTRINGβ€”
    weight_per_braceFLOAT0.050.05–0.1β€”
    syntax_modeCOMBObrace2 options: brace, numeric

    Outputs (1)

    NameTypeDescription
    STRINGSTRINGβ€”