fix(ocr-pipeline): always run fresh word detection, skip stale cache
Word-lookup is now ~0.03s (vs seconds with per-cell Tesseract), so always re-run detection when entering Step 5 instead of showing potentially stale cached word_result from the session DB. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -72,24 +72,9 @@ export function StepWordRecognition({ sessionId, onNext, goToStep }: StepWordRec
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!sessionId) return
|
if (!sessionId) return
|
||||||
|
// Always run fresh detection — word-lookup is fast (~0.03s)
|
||||||
const fetchSession = async () => {
|
// and avoids stale cached results from previous pipeline versions.
|
||||||
try {
|
|
||||||
const res = await fetch(`${KLAUSUR_API}/api/v1/ocr-pipeline/sessions/${sessionId}`)
|
|
||||||
if (res.ok) {
|
|
||||||
const info = await res.json()
|
|
||||||
if (info.word_result) {
|
|
||||||
applyGridResult(info.word_result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Failed to fetch session info:', e)
|
|
||||||
}
|
|
||||||
runAutoDetection()
|
runAutoDetection()
|
||||||
}
|
|
||||||
|
|
||||||
fetchSession()
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [sessionId])
|
}, [sessionId])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user