mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-02 01:20:23 +08:00
fix(prompts): make the layout engine the default path, not display_diagram
"Generate a diagram to illustrate the git operation" still produced hand-written XML. Root cause: the very first working instruction in the system prompt said "then use display_diagram tool to generate the XML" — unconditionally. The tool-routing rules that divide by layout shape only appear 70 lines later, so the earlier, more actionable instruction won. That line predates draw_graph and restructure_diagram, from when display_diagram was the only drawing tool. - The opening instruction now says to pick the tool by layout shape, and names the engine tools as the default with display_diagram as the exception. - The identity line no longer describes the job as "precise XML specifications". - draw_graph's examples (prompt and tool description) now include git/branching workflows and the "illustrate how X works" phrasing. - "Core capabilities" and "Layout constraints" are scoped to display_diagram — they read as instructions to hand-position everything. - The edit_diagram error-recovery note no longer funnels back to display_diagram for restructuring. - display_diagram's own tool description now states it is the exception and points to draw_graph / restructure_diagram.
This commit is contained in:
@@ -600,7 +600,7 @@ IMPORTANT: The "Current diagram XML" is the SINGLE SOURCE OF TRUTH for what's on
|
||||
tools: {
|
||||
// Client-side tool that will be executed on the client
|
||||
display_diagram: {
|
||||
description: `Display a diagram on draw.io. Pass ONLY the mxCell elements - wrapper tags and root cells are added automatically.
|
||||
description: `Display a diagram by writing raw draw.io XML yourself. This is the EXCEPTION, for diagrams whose exact positions are the content (UI mockups, floor plans, circuit/P&ID, seating charts, Gantt, illustrations). For flowcharts and anything nodes-and-arrows use draw_graph; for nesting-based diagrams (cloud architecture, swimlanes, sequence, mind maps) use restructure_diagram. Pass ONLY the mxCell elements - wrapper tags and root cells are added automatically.
|
||||
|
||||
VALIDATION RULES (XML will be rejected if violated):
|
||||
1. Generate ONLY mxCell elements - NO wrapper tags (<mxfile>, <mxGraphModel>, <root>)
|
||||
@@ -764,7 +764,7 @@ BOX SHAPES: add_box takes shape — "decision" for a branch (diamond), "terminat
|
||||
draw_graph: {
|
||||
description: `Draw a FLOWCHART or other arrow-driven diagram from nodes and arrows alone. Give NO positions and NO nesting.
|
||||
|
||||
USE THIS FOR: flowcharts, decision trees, process and approval flows, CI/CD pipelines, state machines, dependency graphs, ER diagrams, site maps, data-flow diagrams.
|
||||
USE THIS FOR: flowcharts, decision trees, process and approval flows, CI/CD pipelines, state machines, git/branching workflows, dependency graphs, ER diagrams, site maps, data-flow diagrams, and any "illustrate how X works" where X is a sequence of steps or states.
|
||||
|
||||
The engine reads the arrows to work out how many rows the diagram has, which nodes share a row, and who goes left of whom — chosen to keep arrows from crossing each other or running through unrelated boxes. Do NOT lay these out yourself with nested containers or XML: declaring a flowchart as nesting puts every step in one column, so each branch has to jump over the step beside it.
|
||||
|
||||
@@ -857,7 +857,7 @@ Shapes: "decision" for a branch (diamond), "terminator" for a start or end point
|
||||
},
|
||||
},
|
||||
get_shape_library: {
|
||||
description: `Get draw.io shape/icon library documentation with style syntax and shape names. Use this for NON-AWS diagrams (flowcharts, BPMN, sequence, mind maps, UI mockups) that go through display_diagram. For AWS architecture, use search_stencils + restructure_diagram instead.
|
||||
description: `Get draw.io shape/icon library documentation with style syntax and shape names. Use this before writing raw XML with display_diagram (UI mockups, floor plans, and other absolute-position diagrams). Flowcharts go through draw_graph and AWS architecture through search_stencils + restructure_diagram - neither needs this.
|
||||
|
||||
Available libraries:
|
||||
- Cloud: aws4, azure2, gcp2, alibaba_cloud, openstack, salesforce
|
||||
|
||||
Reference in New Issue
Block a user