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:
parent
205021e810
commit
bb1b6d573f
5 changed files with 147 additions and 4 deletions
|
|
@ -46,6 +46,8 @@ export async function POST(request: NextRequest) {
|
|||
notes,
|
||||
sub_spans,
|
||||
color,
|
||||
source,
|
||||
model_prediction,
|
||||
} = body;
|
||||
|
||||
if (!chart_id || start_time === undefined || end_time === undefined || !label) {
|
||||
|
|
@ -71,6 +73,8 @@ export async function POST(request: NextRequest) {
|
|||
notes: notes || null,
|
||||
sub_spans: sub_spans ? JSON.stringify(sub_spans) : null,
|
||||
color: color || '#2196F3',
|
||||
source: source || 'human', // 'human', 'model', or 'human_correction'
|
||||
model_prediction: model_prediction ? JSON.stringify(model_prediction) : null,
|
||||
created_at: Math.floor(Date.now() / 1000),
|
||||
})
|
||||
.returning();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue