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

@ -61,5 +61,7 @@ export const spanAnnotations = sqliteTable('span_annotations', {
notes: text('notes'), // free-text, nullable
sub_spans: text('sub_spans'), // JSON array of sub-span objects, nullable
color: text('color').notNull().default('#2196F3'), // hex color
source: text('source').notNull().default('human'), // 'human'|'model'|'human_correction'
model_prediction: text('model_prediction'), // JSON metadata when confirming/correcting predictions
created_at: integer('created_at').notNull(),
});