AI Copilot — Natural Language Generation
The Copilot reads the full simulation state and can auto-lay-out a flowsheet from a plain-English description, diagnose a non-converging solve against a structured FailureMode, or propose a thermo-package switch — it never computes a result itself; the deterministic solver always produces every number (principle #9).
The Copilot receives the full simulation state as structured context on every call — the flowsheet graph JSON, the full stream table, convergence history, every unit-op's params, the thermo package and component list — not just your chat message. Two things it can do:
- Generate — "separate ethanol from water to 99.5%" returns a structured flowsheet JSON matching the exact canvas schema. The server validates it before ever rendering it — invalid AI output is rejected, never shown.
- Diagnose — on a failed/unconverged solve, the backend classifies the failure into a
FailureModeenum first (never a raw string), and the AI explains that clean category in plain English with a concrete suggested fix.
What it never does: compute a result. The deterministic solver always produces every number — the AI points, the solver confirms.
POST /api/ai/chat
{ "sim_id": "...", "message": "separate ethanol from water to 99.5% purity" }Non-blocking by design: a solve must succeed even when the Anthropic API is down, slow, or rate-limited — results still render, the copilot just shows "diagnostics unavailable."