fix: always re-run structure detection instead of using cached result
The frontend was checking for an existing structure_result and reusing it, which meant the backend fix (passing word_boxes to graphic detection) never had a chance to run on existing sessions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,18 +36,7 @@ export function StepStructureDetection({ sessionId, onNext }: StepStructureDetec
|
||||
setError(null)
|
||||
|
||||
try {
|
||||
// Check if session already has structure result
|
||||
const sessionRes = await fetch(`${KLAUSUR_API}/api/v1/ocr-pipeline/sessions/${sessionId}`)
|
||||
if (sessionRes.ok) {
|
||||
const sessionData = await sessionRes.json()
|
||||
if (sessionData.structure_result) {
|
||||
setResult(sessionData.structure_result)
|
||||
setOverlayTs(Date.now())
|
||||
setDetecting(false)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Always re-run detection to pick up latest word_result from OCR step
|
||||
const res = await fetch(`${KLAUSUR_API}/api/v1/ocr-pipeline/sessions/${sessionId}/detect-structure`, {
|
||||
method: 'POST',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user