Fix Grid Build step: show grid-editor summary instead of word_result
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 31s
CI / test-go-edu-search (push) Successful in 31s
CI / test-python-klausur (push) Failing after 2m31s
CI / test-python-agent-core (push) Successful in 21s
CI / test-nodejs-website (push) Successful in 23s
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 31s
CI / test-go-edu-search (push) Successful in 31s
CI / test-python-klausur (push) Failing after 2m31s
CI / test-python-agent-core (push) Successful in 21s
CI / test-nodejs-website (push) Successful in 23s
The Grid Build step was showing word_result.grid_shape (from the initial OCR word clustering, often just 1 column) instead of the grid-editor summary (zone-based, with correct column/row/cell counts). Now reads summary.total_rows/total_columns/total_cells from the grid-editor result. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -32,8 +32,10 @@ export function StepGridBuild({ sessionId, onNext }: StepGridBuildProps) {
|
|||||||
const res = await fetch(`${KLAUSUR_API}/api/v1/ocr-pipeline/sessions/${sessionId}/grid-editor`)
|
const res = await fetch(`${KLAUSUR_API}/api/v1/ocr-pipeline/sessions/${sessionId}/grid-editor`)
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
if (data.grid_shape) {
|
// Use grid-editor summary (accurate zone-based counts)
|
||||||
setResult({ rows: data.grid_shape.rows, cols: data.grid_shape.cols, cells: data.grid_shape.total_cells })
|
const summary = data.summary
|
||||||
|
if (summary) {
|
||||||
|
setResult({ rows: summary.total_rows || 0, cols: summary.total_columns || 0, cells: summary.total_cells || 0 })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,8 +59,14 @@ export function StepGridBuild({ sessionId, onNext }: StepGridBuildProps) {
|
|||||||
throw new Error(data.detail || `Grid-Build fehlgeschlagen (${res.status})`)
|
throw new Error(data.detail || `Grid-Build fehlgeschlagen (${res.status})`)
|
||||||
}
|
}
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
const shape = data.grid_shape || { rows: 0, cols: 0, total_cells: 0 }
|
// Use grid-editor summary (zone-based, more accurate than word_result.grid_shape)
|
||||||
setResult({ rows: shape.rows, cols: shape.cols, cells: shape.total_cells })
|
const summary = data.summary
|
||||||
|
if (summary) {
|
||||||
|
setResult({ rows: summary.total_rows || 0, cols: summary.total_columns || 0, cells: summary.total_cells || 0 })
|
||||||
|
} else {
|
||||||
|
const shape = data.grid_shape || { rows: 0, cols: 0, total_cells: 0 }
|
||||||
|
setResult({ rows: shape.rows, cols: shape.cols, cells: shape.total_cells })
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setError(e instanceof Error ? e.message : String(e))
|
setError(e instanceof Error ? e.message : String(e))
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user