diff --git a/admin-lehrer/app/(admin)/ai/ocr-pipeline/page.tsx b/admin-lehrer/app/(admin)/ai/ocr-pipeline/page.tsx index c69c58a..8fb2026 100644 --- a/admin-lehrer/app/(admin)/ai/ocr-pipeline/page.tsx +++ b/admin-lehrer/app/(admin)/ai/ocr-pipeline/page.tsx @@ -88,8 +88,19 @@ export default function OcrPipelinePage() { const dbStep = data.current_step || 1 // DB steps: 1=start, 2=orientation, 3=deskew, 4=dewarp, 5=crop, 6=columns, ... // UI steps are 0-indexed: 0=orientation, 1=deskew, 2=dewarp, 3=crop, 4=columns, ... - const uiStep = Math.max(0, dbStep - 1) - const skipSteps = savedDocType?.skip_steps || [] + let uiStep = Math.max(0, dbStep - 1) + const skipSteps = [...(savedDocType?.skip_steps || [])] + + // Sub-sessions: image is already cropped, skip pre-processing steps + // Jump directly to columns (UI step 4) unless already further ahead + const isSubSession = !!data.parent_session_id + const SUB_SESSION_SKIP = ['orientation', 'deskew', 'dewarp', 'crop'] + if (isSubSession) { + for (const s of SUB_SESSION_SKIP) { + if (!skipSteps.includes(s)) skipSteps.push(s) + } + if (uiStep < 4) uiStep = 4 // columns step + } setSteps( PIPELINE_STEPS.map((s, i) => ({