Open-Generative-AI/app/api
Anuragp22 694c7075e2 feat(batch): New Batch wizard, CSV parser, and batch list
Slice 3 of the batch feature. Marketing team can now upload the
Rasika-style CSV, watch each row auto-map to the trainer/studio
they uploaded in slice 2, get a real MuAPI cost estimate, and
persist the batch as a draft.

Backend
-------
- POST /api/batches: creates a batch in status='draft' along with one
  job per CSV row (status='queued', not yet picked up since the
  worker arrives in slice 4).
- GET /api/batches: list view payload.
- GET /api/batches/[id]: detail with jobs joined to trainer/studio
  rows. Used by the slice-5 progress UI.
- POST /api/batches/[id]/estimate-cost: forwards the batch's model +
  payload to MuAPI's /api/v1/app/calculate_dynamic_cost, multiplies
  by row count, returns {perJob, total, currency}.

CSV
---
- lib/csvParser.js: PapaParse-based parser that validates required
  columns, normalises duration ("15 sec" -> 15) snapped to Seedance
  2.0's [5,10,15], maps quality ("1080P" -> "high"), and composes a
  prompt from description + start position + camera angle.

UI
--
- components/batch/NewBatchWizard.jsx: full-screen 3-step wizard.
  - Step 1 — name, CSV upload, model/duration/quality/aspect/
    concurrency settings.
  - Step 2 — review every row in a table. Auto-maps Character ->
    Trainer.csvLabel and Studio -> Studio.csvLabel, shows per-row
    override dropdowns and bulk-assign helpers, hard-blocks Next
    until every active row has both a trainer and studio.
  - Step 3 — saves the batch and triggers the cost estimate. On
    success, surfaces the batch id and points the user to the
    upcoming worker slice.
- components/batch/BatchesTab.jsx: replaces the placeholder with a
  real list view (status pill, progress counts, model, created-at)
  and the "+ New batch" button that opens the wizard.
- components/batch/BatchShell.jsx: pass apiKey to BatchesTab.

Verification
------------
- POST /api/batches with one row -> 201, batch + job persisted in
  Postgres (verified with psql).
- GET /api/batches lists the row.
- Cost estimate endpoint returns 401 without a key, calls MuAPI
  correctly with one (live test pending real credits).
2026-04-23 08:01:15 +05:30
..
agents/[[...path]] feat: integrate AI agent studio with minimal UI and upgrade Tailwind v4 2026-04-22 15:22:26 +05:30
api/v1/[[...path]] feat: integrate AI agent studio with minimal UI and upgrade Tailwind v4 2026-04-22 15:22:26 +05:30
app/[[...path]] feat: implement workflow identity persistence, unify api auth, and upgrade tailwind to v4 2026-04-21 19:38:34 +05:30
batches feat(batch): New Batch wizard, CSV parser, and batch list 2026-04-23 08:01:15 +05:30
studios feat(batch): trainers + studios CRUD with /batch shell UI 2026-04-23 07:32:49 +05:30
trainers feat(batch): trainers + studios CRUD with /batch shell UI 2026-04-23 07:32:49 +05:30
upload-binary feat: implement workflow identity persistence, unify api auth, and upgrade tailwind to v4 2026-04-21 19:38:34 +05:30
workflow/[[...path]] feat: implement workflow identity persistence, unify api auth, and upgrade tailwind to v4 2026-04-21 19:38:34 +05:30