fix: relative bold detection (page median), fix save/finish buttons
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 27s
CI / test-go-edu-search (push) Successful in 29s
CI / test-python-klausur (push) Failing after 2m3s
CI / test-python-agent-core (push) Successful in 17s
CI / test-nodejs-website (push) Successful in 21s

Bold detection:
- Replace absolute threshold with page-level relative comparison
- Measure stroke width for all cells, then mark cells >1.4× median as bold
- Adapts automatically to font, DPI and scan quality

Save buttons:
- Fix status stuck on 'error' preventing re-click
- Better error messages with response body
- Fallback score to 0 when null

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-05 13:02:16 +01:00
parent cd12755da6
commit 1a2efbf075
2 changed files with 68 additions and 43 deletions

View File

@@ -170,22 +170,29 @@ export function StepGroundTruth({ sessionId, onNext }: StepGroundTruthProps) {
// Save validation
const handleSave = async () => {
if (!sessionId) return
if (!sessionId) {
setError('Keine Session-ID vorhanden')
return
}
setStatus('saving')
setError('')
try {
const resp = await fetch(
`${KLAUSUR_API}/api/v1/ocr-pipeline/sessions/${sessionId}/reconstruction/validate`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ notes, score }),
body: JSON.stringify({ notes, score: score ?? 0 }),
}
)
if (!resp.ok) throw new Error(`Save failed: ${resp.status}`)
if (!resp.ok) {
const body = await resp.text().catch(() => '')
throw new Error(`Speichern fehlgeschlagen (${resp.status}): ${body}`)
}
setStatus('saved')
} catch (e) {
setError(e instanceof Error ? e.message : String(e))
setStatus('error')
setStatus('ready')
}
}