feat: OCR pipeline with NDJSON streaming and real-time progress (#226, #227, #231) #229

Merged
marcel merged 74 commits from feat/issue-226-227-ocr-pipeline-polygon into main 2026-04-13 12:39:04 +02:00
Showing only changes of commit 8c07779a91 - Show all commits

View File

@@ -13,10 +13,12 @@ let processed: number = $state(0);
let total: number = $state(0);
let currentPage: number = $state(0);
let totalPages: number = $state(0);
let retryCount: number = $state(0);
let progressPercent = $derived(total > 0 ? Math.round((processed / total) * 100) : 0);
$effect(() => {
void retryCount; // track dependency to re-create EventSource on retry
const source = new EventSource(`/api/ocr/jobs/${jobId}/progress`);
source.addEventListener('document', (e) => {
@@ -63,6 +65,7 @@ $effect(() => {
class="h-full bg-brand-mint transition-all duration-300"
style="width: {progressPercent}%"
role="progressbar"
aria-label={m.ocr_progress_heading()}
aria-valuenow={progressPercent}
aria-valuemin={0}
aria-valuemax={100}
@@ -79,7 +82,7 @@ $effect(() => {
</h3>
<button
type="button"
onclick={() => { status = 'running'; }}
onclick={() => { retryCount++; status = 'running'; }}
class="text-sm font-medium text-brand-navy transition-colors hover:text-brand-navy/80"
>
{m.ocr_error_retry()}