Nodes/ComfyUI-UML/UML Code Assistant
ComfyUI Node

UML Code Assistant

The all-in-one shortcut — describe a diagram, get renderable code out the other side

By antoinebou12·Created 6 months ago·Updated 17 days ago· 3
UML Code Assistant
    • code_input
    descriptionKroki – Creates diagrams from textual descriptions!
    templateGenerate a Mermaid diagram that illustrates: {{description}}
    positive_instructionOutput only valid Mermaid diagram code. No markdown fences (no ```). No explanation.
    negative_instructionDo not add any text outside the diagram syntax.
    template_file
    diagram_typemermaid
    output_formatsvg
    providerollama
    modelllama3.2
    api_key
    ollama_base_url

    UML Code Assistant is the "just make it happen" node in this pack. Where the other pieces split the job - LLM Prompt Engine builds the prompt, LLM Call sends it, UML Render draws it - this one collapses the first two into a single box. You type a description, it builds the prompt, calls the model, and hands you diagram source code on the other side, ready to drop straight into UML Render.

    The one input that's actually required is description - your plain-English ask, like "Kroki – Creates diagrams from textual descriptions!" - and everything else has a sensible default. The output is a single string called code_input, which is a deliberate name: it's built to plug into UML Render's code_input socket (that's a wildcard input, so it accepts anything, including this node's output). Wire it up, hit run, and you've got a working LLM → diagram pipeline with exactly two nodes. That's the appeal in one sentence.

    How it works

    It's the same machinery as the other LLM nodes, just bundled. You pick a provider (ollama is the default and needs no key - it calls your local Ollama at http://localhost:11434, overridable with ollama_base_url or the OLLAMA_BASE_URL env var) and a model (default llama3.2). For OpenAI, Anthropic, or Gemini you either paste a key into api_key or rely on the matching OPENAI_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY environment variable.

    The prompt assembly is where the pack's thinking lives. A template with a {{description}} placeholder gets combined with two instruction blocks:

    • positive_instruction - what you want, e.g. "Output only valid Mermaid diagram code. No markdown fences (no ```). No explanation."
    • negative_instruction - what you don't, e.g. "Do not add any text outside the diagram syntax." This is sent to the model as a system-level "Do NOT..." instruction.

    That fence-aversion isn't paranoia: it's the exact failure mode that breaks rendering. You can also pick a template_file preset from the dropdown (general_mermaid.txt, kroki.txt, mermaid_flowchart.txt, plantuml_sequence.txt, uml_plan_then_code.txt) - the plan-then-code preset is the one to try first, because it tells the model to think, then emit only diagram DSL. And if you're changing diagram_type or output_format, keep them in sync with what you set on the UML Render node; the placeholder logic substitutes them into the prompt, so the model knows what it's producing.

    Who should reach for it

    If you're prototyping or you just want "describe → diagram" with the fewest moving parts, this is the node. If you'd rather have each step visible and tunable - see exactly what prompt went out, adjust the negative prompt between runs - the three-node chain (Prompt Engine → LLM Call → UML Render) gives you more control at the cost of clutter. One genuine quirk: because code_input is a wildcard socket, ComfyUI can't always tell you at a glance that a string is the right thing to feed it - trust the output name.

    Installing

    Part of the antoinebou12/ComfyUI-UML pack:

    comfy node install comfyui-uml
    # or manually:
    cd ComfyUI/custom_nodes && git clone https://github.com/antoinebou12/ComfyUI-UML
    pip install -r requirements.txt
    

    Restart ComfyUI, add the node from the UML category, type a description, and make sure the thing it calls is actually running. Ollama isn't running → connection refused; the model isn't pulled → ollama pull llama3.2; no key and no env var for a cloud provider → the node raises an error naming the env var it wants. All of it is in the failure message rather than a mystery traceback, which is more than most ComfyUI nodes offer.

    CategoryUML

    Inputs (11)

    NameTypeDefaultDescription
    descriptionSTRINGKroki – Creates diagrams from textual descriptions!
    templateoptSTRINGGenerate a Mermaid diagram that illustrates: {{description}}
    positive_instructionoptSTRINGOutput only valid Mermaid diagram code. No markdown fences (no ```). No explanation.
    negative_instructionoptSTRINGDo not add any text outside the diagram syntax.
    template_fileoptCOMBO6 options: , general_mermaid.txt, kroki.txt, mermaid_flowchart.txt, plantuml_sequence.txt, uml_plan_then_code.txt
    diagram_typeoptSTRINGmermaid
    output_formatoptSTRINGsvg
    provideroptCOMBOollama4 options: ollama, openai, anthropic, gemini
    modeloptCOMBOllama3.218 options: llama3.2, llama3.1, mistral, codellama, qwen2.5-coder, phi3, +12
    api_keyoptSTRING
    ollama_base_urloptSTRING

    Outputs (1)

    NameTypeDescription
    code_inputSTRING