CorriDraw CorriDraw
24
Chapter 24 · AI generate

AI generate

Use the AI tab in the Text-to-Diagram dialog to turn natural-language prompts into editable Mermaid diagrams on the canvas, with daily rate limits and clear error feedback.

When the AI generate flow lands it will live inside the Text-to-Diagram dialog. The plan: click the three-dot extra-tools menu in the top toolbar and click Mermaid to Corridraw (or PlantUML to Corridraw) to open the dialog, then click the first tab — labelled Text to Diagram with an AI Beta badge — to reach the chat-style assistant. Describe the diagram you want in plain English in the chat input at the bottom, click the send button, and the assistant will stream back Mermaid source that gets rendered, validated, and is ready to drop onto your canvas.

Where it lives

The Text-to-Diagram dialog has three tabs across the top: Text to Diagram (the AI chat), Mermaid (paste raw Mermaid), and PlantUML (paste raw PlantUML). Click any tab to switch. The AI tab is selected by default. Behind the scenes the AI tab generates Mermaid source — it's a natural-language front-end for the same Mermaid pipeline documented in Mermaid → diagram. That's why the generated output drops seamlessly into the canvas: every shape, arrow, and label is a regular CorriDraw element after insertion, free to edit, restyle, and rearrange.

The Text-to-Diagram dialog open on the AI tab — three tabs at the top (Text to Diagram with AI Beta badge, Mermaid, PlantUML), an empty chat panel on the left, and a preview panel on the right.
Figure 1 — the AI tab inside the Text-to-Diagram dialog.

Writing a prompt

The chat input lives at the bottom of the panel. Click into it, type your description, and click the send button (the paper-plane icon to the right of the input) to submit. The assistant currently understands flowchart, sequence, class, state, and entity-relationship diagrams (the welcome screen lists this explicitly). Other shapes, like mind maps or Gantt charts, are not in scope yet.

Some prompts that translate well:

  • "Flowchart of the user signup flow with email verification and a fallback to Google sign-in."
  • "Sequence diagram: browser, API gateway, auth service, and database, for a token-refresh round trip."
  • "Class diagram for an Order entity with line items, customer, and shipping address."
  • "State diagram for a draft post moving through review, approved, and published states."

Prompts have a minimum and maximum length (the dialog will tell you exactly what they are when you hit either bound). Aim for one or two sentences with the diagram type, the main entities, and the relationships — that's enough context for clean output.

A prompt typed into the AI chat input — 'Flowchart of the user signup flow with email verification and a fallback to Google sign-in' — with the send button highlighted.
Figure 2 — concise, type-named prompts produce the cleanest output.

From prompt to shapes

Submitting a prompt streams a Mermaid response into the chat panel and renders it in the preview pane on the right as it arrives. When the stream finishes, three action buttons appear below the assistant message — click whichever fits:

  • Insert — drops the rendered diagram onto the canvas as native CorriDraw shapes.
  • View as Mermaid — switches to the Mermaid tab with the generated source pre-filled, so you can hand-edit it.
  • Retry — re-runs the original prompt with a fresh request.

Click Insert and the AI hand-off ends. From that point you have plain elements: arrows, text, rounded rectangles, diamonds. Click any of them to restyle, drag them to regroup, drop them inside frames, share the file. The diagram is yours.

The AI tab showing a streamed Mermaid response in the chat, the rendered diagram in the preview panel, and the Insert / View as Mermaid / Retry action buttons below the assistant message.
Figure 3 — the chat, the preview, and the action row after a successful generation.

Rate limits — free vs Pro

AI generate is metered to keep the service usable for everyone. The chat panel shows your remaining quota above the input as "N requests left today". When you exhaust the daily allowance you'll see this message, copied verbatim from the editor:

"You've hit your AI limit on the free plan. Try out Corridraw Pro for more or come back tomorrow."

The exact daily counts are read from the X-Ratelimit-Remaining header on every response, so the editor always shows the live remaining count rather than a hard-coded value. Free accounts get a small daily budget meant for trying the feature out; CorriDraw Pro subscribers get a much larger one suitable for daily use. Click the Upgrade to Pro button next to the rate-limit notice and it takes you to the billing page when you're ready.

There is also a burst limit — issuing many requests in quick succession returns a 429 with the message "Hold your horses, you're too fast for us! Please wait a moment before trying again." This is independent of the daily quota and clears after a short pause.

The chat panel showing the rate-limit banner '0 requests left today' with the upgrade-to-Pro button visible and the input disabled with placeholder 'You've reached your message limit'.
Figure 4 — the rate-limit state. Input disables and the upgrade prompt appears.

How prompts become shapes

Under the hood the path is prompt → Mermaid → CorriDraw elements. The AI is asked to return well-formed Mermaid for the type of diagram you described. That Mermaid source goes through the same parser the Mermaid tab uses, then the same converter that turns Mermaid into sketchy CorriDraw shapes. This is why generated diagrams pick up your current canvas styling (roughness, font, stroke width) the moment you insert them, and why edits afterwards behave exactly like edits on a hand-drawn diagram.

If a generation produces invalid Mermaid the preview shows a parse error with a one-click Regenerate (auto-fix) button — click it to send the broken source plus the error message back to the AI for repair. Most syntax slips clear up on the first auto-fix attempt.

Saved chats

Chat history is persisted per browser. Click the hamburger menu inside the dialog to see your previous sessions — click any session to restore it and keep iterating, or click New chat to start fresh and clear context. Click the trash icon on a chat or an individual message to delete it; deletion is instant and not undoable, so be deliberate.

Spot a typo? A suggestion? Tell us