feat(api): add span annotation export and feedback loop support

- Add GET /api/span-annotations/export endpoint for ML pipeline JSON/CSV export
- Add source and model_prediction fields to span_annotations schema
- Update POST endpoint to accept source (human/model/human_correction) and model_prediction metadata
- Support negative annotations (label 'O' for user corrections to model predictions)
- Create migration 0005 for new schema fields

Completes tasks 8.1-8.4 of candle-backend change
This commit is contained in:
Marko Djordjevic 2026-02-15 14:35:31 +01:00
parent 205021e810
commit bb1b6d573f
5 changed files with 147 additions and 4 deletions

View file

@ -71,10 +71,10 @@
## 8. Span Annotation Export & Feedback
- [ ] 8.1 Create `src/app/api/span-annotations/export/route.ts` — GET endpoint exporting span annotations as JSON in ML pipeline format
- [ ] 8.2 Add `source` and `model_prediction` fields to span annotation schema (Drizzle migration) — source defaults to "human", model_prediction is nullable JSON
- [ ] 8.3 Update span annotation POST endpoint to accept optional `source` and `model_prediction` fields
- [ ] 8.4 Support negative annotations — span with label "O", source "human_correction", and model_prediction metadata
- [x] 8.1 Create `src/app/api/span-annotations/export/route.ts` — GET endpoint exporting span annotations as JSON in ML pipeline format
- [x] 8.2 Add `source` and `model_prediction` fields to span annotation schema (Drizzle migration) — source defaults to "human", model_prediction is nullable JSON
- [x] 8.3 Update span annotation POST endpoint to accept optional `source` and `model_prediction` fields
- [x] 8.4 Support negative annotations — span with label "O", source "human_correction", and model_prediction metadata
## 9. Prediction UI — State & Controls