feat: Full-Row OCR mit Spacing fuer Box-Sub-Sessions
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 40s
CI / test-go-edu-search (push) Successful in 28s
CI / test-python-klausur (push) Failing after 2m16s
CI / test-python-agent-core (push) Successful in 17s
CI / test-nodejs-website (push) Successful in 22s

Sub-Sessions ueberspringen Spaltenerkennung und nutzen stattdessen eine
Pseudo-Spalte ueber die volle Breite. Text wird mit proportionalem
Spacing aus Wort-Positionen rekonstruiert, um raeumliches Layout zu erhalten.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-10 08:28:29 +01:00
parent 34adb437d0
commit 23b7840ea7
4 changed files with 91 additions and 1 deletions

View File

@@ -45,6 +45,7 @@ export function StepColumnDetection({ sessionId, onNext, onBoxSessionsCreated }:
const [savedGtColumns, setSavedGtColumns] = useState<PageRegion[] | null>(null)
const [creatingBoxSessions, setCreatingBoxSessions] = useState(false)
const [existingSubSessions, setExistingSubSessions] = useState<SubSession[] | null>(null)
const [isSubSession, setIsSubSession] = useState(false)
// Fetch session info (image dimensions) + check for cached column result
useEffect(() => {
@@ -58,14 +59,31 @@ export function StepColumnDetection({ sessionId, onNext, onBoxSessionsCreated }:
if (info.image_width && info.image_height) {
setImageDimensions({ width: info.image_width, height: info.image_height })
}
const isSub = !!info.parent_session_id
setIsSubSession(isSub)
if (info.sub_sessions && info.sub_sessions.length > 0) {
setExistingSubSessions(info.sub_sessions)
onBoxSessionsCreated?.(info.sub_sessions)
}
if (info.column_result) {
setColumnResult(info.column_result)
// Sub-session with pseudo-column already set → auto-advance
if (isSub) {
onNext()
return
}
return
}
// Sub-session without columns → auto-detect (creates pseudo-column)
if (isSub) {
const res = await fetch(`${KLAUSUR_API}/api/v1/ocr-pipeline/sessions/${sessionId}/columns`, { method: 'POST' })
if (res.ok) {
const data: ColumnResult = await res.json()
setColumnResult(data)
onNext()
return
}
}
}
} catch (e) {
console.error('Failed to fetch session info:', e)