Nodes/Nukun_ComfyUI_Nodes/Ollama Prompt Refiner (Nukun)
ComfyUI Node

Ollama Prompt Refiner (Nukun)

Your local Ollama, turned into a prompt factory

By OnekoSL·Created 3 months ago·Updated 11 days ago· 1
Ollama Prompt Refiner (Nukun)
    • positive
    • negative
    • report
    • base_prompt
    • foreground_prompt
    • background_prompt
    • plan_json
    • review_json
    word_salad
    ollama_urlhttp://127.0.0.1:11434
    ollama_modelautoren-darkidol-llama-3-1-8b:latest
    target_profilepony_v7
    seed0
    temperature0.45
    top_p0.90
    style_cluster430
    timeout_seconds120
    context_length4096
    style_anchor
    left
    right
    top
    bottom
    fallback_modeadaptive
    pipeline_modesingle
    unload_after_runtrue
    prompt_modestrict

    This is the heavyweight of the pack and the reason a lot of people install it: a local Ollama model that takes your rough "word salad" prompt and rewrites it into a properly split prompt set for a specific base model - Pony v6, Illustrious, Pony v7, Z-Image, Anima, Wan 2.2 video, or Krea 2. No cloud, no API key, no censored frontier model deciding your subject is a problem. If an LLM-in-the-graph prompt enhancer is the thing you've been wanting, this is a well-built, extremely opinionated version of it.

    The philosophy here is the right one, and it's the same one the community converged on: don't ask the LLM for one free-form rewrite, give it a tightly scoped job. The node asks for split outputs - base_prompt, foreground_prompt, background_prompt - plus a combined positive and negative, and it validates that the output is actually model-appropriate. For Pony v6 and Illustrious it pre-sorts your random words into fixed/base, foreground, background, style and discarded-noise buckets before the LLM ever sees them. That's the kind of guardrail a plain chat model won't give you.

    How it works

    You connect word_salad (typically from the pack's Random Vocab String List or Multi Vocab String List), pick target_profile, and the node talks to your local Ollama server at ollama_url (default http://127.0.0.1:11434) using ollama_model. The model dropdown refreshes live from Ollama's /api/tags, so pick the model, not the URL guesswork. Default model is autoren-darkidol-llama-3-1-8b:latest - a small abliterated Llama 3.1 8B, exactly the profile the KB says is right for this job: small, obedient, uncensored. German word_salad input gets translated to English first, which is a nice touch nobody else ships.

    The pipeline is where it gets sophisticated. Default pipeline_mode = single is one request plus a JSON-repair retry when output is malformed. plan_compile adds a planner stage that first classifies your noisy input into a fixed JSON plan, then hands both plan and source to the compiler. plan_compile_review adds a semantic reviewer and at most one correction. Each mode costs more Ollama requests - two or three per run plus possible repair - so it's slower, but the review stage genuinely catches the "LLM invented a character you didn't ask for" failure that unconstrained enhancers are famous for.

    The inputs worth setting as a beginner:

    • style_anchor - fixed character names, LoRA triggers, quality tags that must survive the rewrite. Use it; it's the difference between "Ollama kept my character" and "Ollama invented a new one."
    • target_profile - one profile per run. Pony v7 default.
    • style_cluster (default 430) - the Pony v7 style_cluster_XXXX header value.
    • prompt_mode - strict stays grounded in your text; creative lets it invent supporting detail and bumps sampling temperature.
    • fallback_mode - adaptive rebuilds locally when Ollama fails, continue pushes through transport errors, strict stops with a detailed error. adaptive is the default and the sane one for unattended runs.

    Outputs

    positive and negative go to your text encoders. base_prompt/foreground_prompt/background_prompt are the split pieces for workflows that feed regional conditioning. report tells you what ran, plan_json and review_json show the planner/reviewer output (empty {} when that stage didn't run).

    Installing it

    Clone the pack, restart, and you're most of the way there - the node itself has no Python deps beyond the pack's own. The real dependency is Ollama itself:

    cd ComfyUI/custom_nodes
    git clone https://github.com/OnekoSL/Nukun_ComfyUI_Nodes.git
    

    Then make sure Ollama is running (ollama serve), and pull a model: ollama pull autoren-darkidol-llama-3-1-8b:latest. The default context_length is 4096; the node unloads the model after each run by default to free VRAM for the diffusion pass - leave unload_after_run enabled unless you know why you need it off.

    Common issues

    Almost every problem is Ollama-side, not node-side. Malformed JSON gets one repair retry, then falls back per fallback_mode - if you see repeated fallbacks, your model is weak at structured output, so try a better one or lower temperature. If the model dropdown is empty, Ollama isn't reachable at ollama_url or /api/tags isn't answering. And a note for Pony v6/Illustrious: this node changed its output contract in newer versions - old workflows that expected separate pony_v6_* outputs need reconnecting to positive and negative. Read the report output when something looks off; it's unusually honest about what happened.

    CategoryNukun/Text

    Inputs (19)

    NameTypeDefaultDescription
    word_saladSTRINGEnglish, German, or mixed random vocabulary. Natural German wording is translated to English automatically before refinement.
    ollama_urlSTRINGhttp://127.0.0.1:11434Base Ollama URL, usually http://127.0.0.1:11434.
    ollama_modelCOMBOautoren-darkidol-llama-3-1-8b:latestLocal Ollama model used to rewrite the prompt. The dropdown refreshes from the selected Ollama URL in the browser.
    target_profileCOMBOpony_v7Prompt profile to generate. Ollama only writes this one split prompt set per run.
    seedINT00–18446744073709550000Seed passed to Ollama for repeatable prompt rewriting.
    temperatureFLOAT0.450–2Ollama generation temperature. Lower is more deterministic; Reka Flash 3 recommends 0.60.
    top_pFLOAT0.900.01–1Ollama nucleus sampling value. Reka Flash 3 recommends 0.95.
    style_clusterINT4300–2048Pony v7 style_cluster number used in the structured prompt header.
    timeout_secondsINT1201–600Maximum time to wait for each Ollama request. Use 180 or more for a large reasoning model with plan_compile_review.
    context_lengthCOMBO4096Ollama num_ctx context window. Higher values need more VRAM/RAM and may be limited by the selected model.
    style_anchoroptSTRINGOptional fixed motifs, character names, LoRA tags, or quality tags to preserve.
    leftoptSTRINGOptional English or German creative guidance for the left side of natural-language prompts.
    rightoptSTRINGOptional English or German creative guidance for the right side of natural-language prompts.
    topoptSTRINGOptional English or German creative guidance for the top area of natural-language prompts.
    bottomoptSTRINGOptional English or German creative guidance for the bottom area of natural-language prompts.
    fallback_modeoptCOMBOadaptiveSingle mode applies this to natural profiles; pipeline modes use it for every stage and target profile.
    pipeline_modeoptCOMBOsinglesingle keeps the classic refiner; plan_compile adds a planner; plan_compile_review also adds semantic review and at most one correction.
    unload_after_runoptBOOLEANtrueUnload the Ollama model after the complete node run so ComfyUI can reclaim RAM and VRAM.
    prompt_modeoptCOMBOstrictstrict stays close to the input; creative may invent coherent supporting details and uses broader sampling.

    Outputs (8)

    NameTypeDescription
    positiveSTRING
    negativeSTRING
    reportSTRING
    base_promptSTRING
    foreground_promptSTRING
    background_promptSTRING
    plan_jsonSTRING
    review_jsonSTRING