labs: AICharts demo (NL → validated chart spec) #35

Merged
teahubxyz merged 1 commits from labs/aicharts into main 2026-10-13 13:35:18 +00:00
Owner

Chai's AICharts seed (matcha/teahub#93), as a lab Worker on workers.dev.

  • labs/aicharts/aicharts.js: validator + fixed ops (filter, group, sort, bin, limit) + Chart.js config, attach(chart) and <ai-chart>. The model never sees rows, only columns, 5 sample rows and value ranges; no model-written code runs.
  • worker.js: demo page, library, /api/schema|data|spec|charts. Workers AI with json_schema output, fallback parse, one repair round with validator errors. D1: seeded orders, quota, saved_charts. 30/IP and 300/day AI caps.
  • deploy.py + labs-aicharts workflow (manual): one Worker, one D1, workers.dev only. No DNS.
  • Tests: test_aicharts.mjs (SQLite-backed D1 shim, fake AI), hooked into test_time.py (ALL OK 41). Checked in a browser locally: ask → chart → save → reload by link.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VDkN7ukK1kXkqov8FaZxva


Generated by Claude Code

Chai's AICharts seed (matcha/teahub#93), as a lab Worker on workers.dev. - `labs/aicharts/aicharts.js`: validator + fixed ops (filter, group, sort, bin, limit) + Chart.js config, `attach(chart)` and `<ai-chart>`. The model never sees rows, only columns, 5 sample rows and value ranges; no model-written code runs. - `worker.js`: demo page, library, `/api/schema|data|spec|charts`. Workers AI with json_schema output, fallback parse, one repair round with validator errors. D1: seeded orders, quota, saved_charts. 30/IP and 300/day AI caps. - `deploy.py` + `labs-aicharts` workflow (manual): one Worker, one D1, workers.dev only. No DNS. - Tests: `test_aicharts.mjs` (SQLite-backed D1 shim, fake AI), hooked into test_time.py (ALL OK 41). Checked in a browser locally: ask → chart → save → reload by link. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VDkN7ukK1kXkqov8FaZxva --- _Generated by [Claude Code](https://claude.ai/code/session_01VDkN7ukK1kXkqov8FaZxva)_
Sign in to join this conversation.