Merge integration (ticket 06) into ticket 07

This commit is contained in:
Vasanth committed 2026-10-16 15:25:57 +05:30
commit 128f153f84
11 files changed
+392 -6

No files matched your search

+26 -5
View File
@@ -1,6 +1,6 @@
---
name: rpa-dashboard-ai
description: Builds a working dashboard for an RPA bot or service that uses AI (an LLM or OCR extraction call). It has everything from rpa-dashboard-no-ai (sidebar, top bar with dark toggle and status dot, KPI cards, batch donut, run panel with steps and live log, report table with search and export) plus confidence bands, a review split pane (source document beside the extracted fields, band filters, draft edits, Verify) and an approve gate the server enforces. Web path is React + Vite + Tailwind with a sample-data server stub; desktop path (PyQt) is the no-AI page plus plain-HTML AI sections over the Qt bridge, gate enforced in Python. Use when the user asks for an "AI RPA dashboard", an "extraction dashboard", an "LLM/OCR review dashboard", or any RPA/bot dashboard in a project that calls an LLM or OCR to extract fields. Needs rpa-dashboard-no-ai installed next to it.
description: Builds a working dashboard for an RPA bot or service that uses AI (an LLM or OCR extraction call). It has everything from rpa-dashboard-no-ai (sidebar, top bar with dark toggle and status dot, KPI cards, batch donut, run panel with steps and live log, report table with search and export) plus confidence bands, a review split pane (source document beside the extracted fields, band filters, draft edits, Verify), an approve gate the server enforces, and a cost/ROI page (tokens and cost per run, total and monthly spend, priced coverage, an against-doing-it-by-hand panel). Web path is React + Vite + Tailwind with a sample-data server stub; desktop path (PyQt) is the no-AI page plus plain-HTML AI sections over the Qt bridge, gate enforced in Python. Use when the user asks for an "AI RPA dashboard", an "extraction dashboard", an "LLM/OCR review dashboard", or any RPA/bot dashboard in a project that calls an LLM or OCR to extract fields. Needs rpa-dashboard-no-ai installed next to it.
---
# RPA dashboard (AI)
@@ -11,7 +11,8 @@ means `../rpa-dashboard-no-ai/templates/`.
| File | What it is |
|---|---|
| `templates/web/` | The React + Vite + Tailwind starter: shell, KPI, donut, run panel, report, **band legend, review split pane, approve gate**, sample data. |
| `templates/web/` | The React + Vite + Tailwind starter: shell, KPI, donut, run panel, report, **band legend, review split pane, approve gate, cost page**, sample data. |
| `templates/web/pricing.py` | The pricing table (with its source and as-of date) and `cost_for_call`. The backend imports it. |
| `templates/web/server_stub.py` | Sample-data backend for runs, review rows and the approve gate. Standard library only. |
| `templates/web/bands.py` | The band cut points and rules. The one source of truth: the backend imports it. |
| `templates/desktop/ai_sections.html` | Desktop: the Review tab (band legend, review split pane, drafts, Verify, approve gate) in plain HTML, pasted into `<no-ai>dashboard.html`. |
@@ -33,7 +34,8 @@ Before asking anything:
`<no-ai>frontend.md` section 1.
- **AI call:** find the LLM or OCR extraction (for example `genai`, `openai`,
`anthropic`, Textract or Tesseract calls): which fields it returns, which are
mandatory, and whether it returns per-word scores.
mandatory, and whether it returns per-word scores. Note the provider, the model
names, and whether the response's token usage (input, output, thinking) is kept.
- **Bot or backend:** the entry point, what it prints, and any web framework
(FastAPI, Flask, Django).
@@ -64,9 +66,17 @@ uses PyQt, choose desktop and say so.
## 5. Ask which optional sections to build
Always built: the no-AI shell and sections, plus the band legend, the review split
pane and the approve gate. Ask which extras to add (choose any, or none):
**checkpoint tracker**, **admin/roles screen**, **login page**. Build only the
pane, the approve gate and the cost page. Ask which extras to add (choose any, or none):
**checkpoint tracker**, **admin/roles screen**, **login page**, **model picker** (choose
the model per batch), **retry on another model** (for failed runs). Build only the
chosen ones at their `OPTIONAL:` markers, and delete the markers.
- **Model picker:** a `<select>` filled from `GET /models` (the pricing table's keys), at
the marker in `Cost.tsx` or next to the Run button; the chosen model goes with the
batch's start action. Remember the last choice per user.
- **Retry on another model:** on a `failed` run, at the marker in `Review.tsx`: a model
`<select>` (from `GET /models`, defaulting to the run's own model) and a Retry button
that sends `POST /runs/{job_id}/retry {model}`, then polls the run as usual.
Both need the endpoints in `templates/contract.md`; add them to the backend (and the stub).
## 6. Build (web)
@@ -117,6 +127,14 @@ review rows and the gate.
mandatory)`. The approve endpoint must refuse (409 with `detail`) while any flagged
field is unverified: the page never decides that. For the shell, set
`SAMPLE_DATA = false` and serve the no-AI endpoints too.
- **Cost page:** copy `pricing.py` next to the backend. Fill `PRICING` with the rates of
the models the project really calls, from the provider's pricing page, and set
`PRICING_SOURCE` and `PRICING_AS_OF`. If you can't read the rates, ask the user for
them. The backend stores each run's token usage and serves `GET /roi`, pricing each run
with `cost_for_call`. A run with no recorded usage gets `null`, never 0. If the
extraction doesn't keep token usage yet, wire it to (for example Gemini's
`usage_metadata`, OpenAI's and Anthropic's `usage`). In sample mode, replace the stub's
`ROI_RUNS` models with the project's models.
- **Desktop:** the same rules, over the bridge (`templates/contract.md`, "Desktop").
The shell is wired in `bot_runner.py` as the no-AI skill says. For review data, keep
`server_stub.py` (replace its `SAMPLE_FIELDS` with the real fields, as above) until
@@ -140,6 +158,9 @@ Open the page and check, in light, dark (the toggle) and a window 820px wide or
- on Review: the band legend counts and the caveat, band filters, a typed edit marked
unsaved until Save, a refused Approve while flagged fields are unverified, and
"page X of Y" on a running document;
- on Cost: the coverage pill, total and this month's spend, the month table, a run
marked "not priced", the pricing source and as-of date, and the by-hand figure
changing when an assumption is edited;
- no `{{` is left and the console shows no script errors.
Desktop: `python dashboard/bot_runner.py` (dry run: real steps, ending at 100), then