Nodes/ComfyUi-Ollama-YN/My Ollama Special Generate Advance
ComfyUI Node

My Ollama Special Generate Advance

The structured SD prompt generator — when it cooperates, it's great

By wujm424606·Created 2 years ago·Updated 2 years ago· 84
My Ollama Special Generate Advance
    • total_response
    • description
    • long_prompt
    • camera_angle_word
    • style_words
    • subject_words
    • light_words
    • environment_words
    • style_categories
    prompt一个小女孩在森林里
    debug
    style_categories
    urlhttp://127.0.0.1:11434
    model
    extra_modelnone
    systemStable Diffusion is an AI art generation model similar to DALLE-2. Below is a list of prompts that can be used to generate images with Stable Diffusion: - portait of a homer simpson archer shooting arrow at forest monster, front game card, drark, marvel comics, dark, intricate, highly detailed, smooth, artstation, digital illustration by ruan jia and mandy jurgens and artgerm and wayne barlowe and greg rutkowski and zdislav beksinski - pirate, concept art, deep focus, fantasy, intricate, highly detailed, digital painting, artstation, matte, sharp focus, illustration, art by magali villeneuve, chippy, ryan yee, rk post, clint cearley, daniel ljunggren, zoltan boros, gabor szikszai, howard lyon, steve argyle, winona nelson - ghost inside a hunted room, art by lois van baarle and loish and ross tran and rossdraws and sam yang and samdoesarts and artgerm, digital art, highly detailed, intricate, sharp focus, Trending on Artstation HQ, deviantart, unreal engine 5, 4K UHD image - red dead redemption 2, cinematic view, epic sky, detailed, concept art, low angle, high detail, warm lighting, volumetric, godrays, vivid, beautiful, trending on artstation, by jordan grimmer, huge scene, grass, art greg rutkowski - a fantasy style portrait painting of rachel lane / alison brie hybrid in the style of francois boucher oil painting unreal 5 daz. rpg portrait, extremely detailed artgerm greg rutkowski alphonse mucha greg hildebrandt tim hildebrandt - athena, greek goddess, claudia black, art by artgerm and greg rutkowski and magali villeneuve, bronze greek armor, owl crown, d & d, fantasy, intricate, portrait, highly detailed, headshot, digital painting, trending on artstation, concept art, sharp focus, illustration - closeup portrait shot of a large strong female biomechanic woman in a scenic scifi environment, intricate, elegant, highly detailed, centered, digital painting, artstation, concept art, smooth, sharp focus, warframe, illustration, thomas kinkade, tomasz alen kopera, peter mohrbacher, donato giancola, leyendecker, boris vallejo - ultra realistic illustration of steve urkle as the hulk, intricate, elegant, highly detailed, digital painting, artstation, concept art, smooth, sharp focus, illustration, art by artgerm and greg rutkowski and alphonse mucha I want you to write me a list of detailed prompts exactly about the idea written after IDEA. Follow the structure of the example prompts. This means a very short description of the scene, followed by modifiers divided by commas to alter the mood, style, lighting, and more. Please generate the long prompt version of the short one according to the given examples. Long prompt version should consist of 3 to 5 sentences. Long prompt version must sepcify the color, shape, texture or spatial relation of the included objects. DO NOT generate sentences that describe any atmosphere!!!
    seed0
    top_k40
    top_p0.90
    temperature0.50
    num_predict-1
    tfs_z1.00
    keep_alive

    MyOllamaSpecialGenerateAdvance is the most ambitious node in this pack and the easiest to be disappointed by. Instead of just asking an LLM to write a prompt, it asks the model to fill a structured template, then parses the reply with regex into separate ingredients - subject, style, lighting, camera angle, environment - and reassembles them into one comma-joined SD prompt. When it works it produces prompts that genuinely read like a pro's, with the whole (style:1.4) weighting vocabulary baked in. When it doesn't, you get empty fields and a shrug.

    The template trick is why the README itself warns you to be careful with model choice. The default system prompt is a famous piece of prompt-engineering: a list of hand-crafted example prompts (the "artstation, greg rutkowski, trending on artstation" school) followed by an instruction to write a structured long prompt. If your model doesn't follow the JSON-ish template, every field comes back empty and you're left with an empty string on the wire.

    How it works

    The node appends Use the following template: {…} (a JSON blob with keys like description, long_prompt, camera_angle_word, style_words, subject_words, light_words, environment_words) to your prompt, sends it with the system instructions, then runs a handful of regexes over the response - code ported from the ComfyUI-Prompt-MZ project the author credits. Each matched field becomes an output. Then it joins the non-empty fields into a single prompt wrapped in parentheses, replaces stray periods and semicolons with commas, cleans up double commas, and optionally appends a preset style block.

    That's where style_categories comes in - it's both an input and an output, which is a little odd but makes sense once you see it. Choose none, high quality, photography, or illustration on the input, and the node appends the matching quality-weight block (e.g. ((high quality:1.4), (best quality:1.4), (masterpiece:1.4), …) for photography) to the final prompt. The same value comes out the style_categories output so you can see what was applied.

    The outputs

    Nine of them. The one you usually wire into CLIPTextEncode is total_response - the fully assembled, comma-joined prompt. The other eight are the raw ingredients: description, long_prompt, camera_angle_word, style_words, subject_words, light_words, environment_words, and style_categories. If a regex finds nothing, that output is an empty string, so it's safe to chain them; they're mainly useful if you want to see what the model decided each part should be, or splice specific ingredients into a different prompt.

    Inputs worth touching

    • prompt - your short idea. The default Chinese example ("一个小女孩在森林里") is a good hint that this pack was built for multilingual input.
    • style_categories - the four-way style switch described above.
    • system - feel free to edit; if your model keeps ignoring the template, tightening the instruction here is the first thing to try.
    • model / extra_model, temperature / top_p / top_k / num_predict / tfs_z, keep_alive - same shared sampling knobs as the rest of the pack.

    Installing and caveats

    Install once, works for all nodes in the pack: ComfyUI Manager (search "ComfyUi-Ollama-YN") or git clone https://github.com/wujm424606/ComfyUi-Ollama-YN.git into ComfyUI/custom_nodes. Dependencies are ollama, pandas, aiohttp, plus Ollama itself running locally.

    Two honest warnings. First, model choice genuinely matters here - a small or instruction-weak model will not follow the template and you'll get empty outputs. If total_response comes back blank, try a stronger instruct model before you touch the node. Second, the pack has been quiet since September 2024, so the hardcoded template and regexes are frozen in time. They still work, but treat the whole thing as "works for the models that obey it," not a universal translator. And the usual dropdown rules apply: new models need a node re-add or restart, and type model:latest explicitly in extra_model.

    CategoryMy Ollama

    Inputs (14)

    NameTypeDefaultDescription
    promptSTRING一个小女孩在森林里
    debugCOMBO2 options: disable, enable
    style_categoriesCOMBO4 options: none, high quality, photography, illustration
    urlSTRINGhttp://127.0.0.1:11434
    modelCOMBO0 options:
    extra_modelSTRINGnone
    systemSTRINGStable Diffusion is an AI art generation model similar to DALLE-2. Below is a list of prompts that can be used to generate images with Stable Diffusion: - portait of a homer simpson archer shooting arrow at forest monster, front game card, drark, marvel comics, dark, intricate, highly detailed, smooth, artstation, digital illustration by ruan jia and mandy jurgens and artgerm and wayne barlowe and greg rutkowski and zdislav beksinski - pirate, concept art, deep focus, fantasy, intricate, highly detailed, digital painting, artstation, matte, sharp focus, illustration, art by magali villeneuve, chippy, ryan yee, rk post, clint cearley, daniel ljunggren, zoltan boros, gabor szikszai, howard lyon, steve argyle, winona nelson - ghost inside a hunted room, art by lois van baarle and loish and ross tran and rossdraws and sam yang and samdoesarts and artgerm, digital art, highly detailed, intricate, sharp focus, Trending on Artstation HQ, deviantart, unreal engine 5, 4K UHD image - red dead redemption 2, cinematic view, epic sky, detailed, concept art, low angle, high detail, warm lighting, volumetric, godrays, vivid, beautiful, trending on artstation, by jordan grimmer, huge scene, grass, art greg rutkowski - a fantasy style portrait painting of rachel lane / alison brie hybrid in the style of francois boucher oil painting unreal 5 daz. rpg portrait, extremely detailed artgerm greg rutkowski alphonse mucha greg hildebrandt tim hildebrandt - athena, greek goddess, claudia black, art by artgerm and greg rutkowski and magali villeneuve, bronze greek armor, owl crown, d & d, fantasy, intricate, portrait, highly detailed, headshot, digital painting, trending on artstation, concept art, sharp focus, illustration - closeup portrait shot of a large strong female biomechanic woman in a scenic scifi environment, intricate, elegant, highly detailed, centered, digital painting, artstation, concept art, smooth, sharp focus, warframe, illustration, thomas kinkade, tomasz alen kopera, peter mohrbacher, donato giancola, leyendecker, boris vallejo - ultra realistic illustration of steve urkle as the hulk, intricate, elegant, highly detailed, digital painting, artstation, concept art, smooth, sharp focus, illustration, art by artgerm and greg rutkowski and alphonse mucha I want you to write me a list of detailed prompts exactly about the idea written after IDEA. Follow the structure of the example prompts. This means a very short description of the scene, followed by modifiers divided by commas to alter the mood, style, lighting, and more. Please generate the long prompt version of the short one according to the given examples. Long prompt version should consist of 3 to 5 sentences. Long prompt version must sepcify the color, shape, texture or spatial relation of the included objects. DO NOT generate sentences that describe any atmosphere!!!
    seedINT00–18446744073709550000
    top_kFLOAT400–100
    top_pFLOAT0.900–1
    temperatureFLOAT0.500–1
    num_predictFLOAT-1-2–2048
    tfs_zFLOAT1.001–1000
    keep_aliveCOMBO2 options: 0, 60m

    Outputs (9)

    NameTypeDescription
    total_responseSTRING
    descriptionSTRING
    long_promptSTRING
    camera_angle_wordSTRING
    style_wordsSTRING
    subject_wordsSTRING
    light_wordsSTRING
    environment_wordsSTRING
    style_categoriesSTRING