feat: Corrections tab — SFT candidate import, review, and JSONL export #15

Merged
pyr0ball merged 99 commits from feat/sft-corrections into main 2026-04-08 22:19:01 -07:00
Showing only changes of commit 4ad2907ae8 - Show all commits

View file

@ -11,6 +11,7 @@ from __future__ import annotations
import logging import logging
from pathlib import Path from pathlib import Path
from typing import Literal
import yaml import yaml
from fastapi import APIRouter, HTTPException from fastapi import APIRouter, HTTPException
@ -140,15 +141,13 @@ def get_queue(page: int = 1, per_page: int = 20):
class SubmitRequest(BaseModel): class SubmitRequest(BaseModel):
id: str id: str
action: str # "correct" | "discard" | "flag" action: Literal["correct", "discard", "flag"]
corrected_response: str | None = None corrected_response: str | None = None
@router.post("/submit") @router.post("/submit")
def post_submit(req: SubmitRequest): def post_submit(req: SubmitRequest):
"""Record a reviewer decision for one SFT candidate.""" """Record a reviewer decision for one SFT candidate."""
if req.action not in ("correct", "discard", "flag"):
raise HTTPException(422, f"Unknown action {req.action!r}")
if req.action == "correct": if req.action == "correct":
if not req.corrected_response or not req.corrected_response.strip(): if not req.corrected_response or not req.corrected_response.strip():
raise HTTPException(422, "corrected_response must be non-empty when action is 'correct'") raise HTTPException(422, "corrected_response must be non-empty when action is 'correct'")