[split-required] Split remaining 500-680 LOC files (final batch)

website (17 pages + 3 components):
- multiplayer/wizard, middleware/wizard+test-wizard, communication
- builds/wizard, staff-search, voice, sbom/wizard
- foerderantrag, mail/tasks, tools/communication, sbom
- compliance/evidence, uni-crawler, brandbook (already done)
- CollectionsTab, IngestionTab, RiskHeatmap

backend-lehrer (5 files):
- letters_api (641 → 2), certificates_api (636 → 2)
- alerts_agent/db/models (636 → 3)
- llm_gateway/communication_service (614 → 2)
- game/database already done in prior batch

klausur-service (2 files):
- hybrid_vocab_extractor (664 → 2)
- klausur-service/frontend: api.ts (620 → 3), EHUploadWizard (591 → 2)

voice-service (3 files):
- bqas/rag_judge (618 → 3), runner (529 → 2)
- enhanced_task_orchestrator (519 → 2)

studio-v2 (6 files):
- korrektur/[klausurId] (578 → 4), fairness (569 → 2)
- AlertsWizard (552 → 2), OnboardingWizard (513 → 2)
- korrektur/api.ts (506 → 3), geo-lernwelt (501 → 2)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-04-25 08:56:45 +02:00
parent b4613e26f3
commit 451365a312
115 changed files with 10694 additions and 13839 deletions

View File

@@ -1,15 +1,14 @@
'use client'
import { useState, useEffect, useCallback } from 'react'
import { useState, useEffect } from 'react'
import type {
Collection,
IngestionStatus,
LiveProgress,
IndexedStats,
PendingFile,
PendingFilesData,
IngestionHistoryEntry
} from '../types'
import { IngestionHistory } from './IngestionHistory'
const API_BASE = process.env.NEXT_PUBLIC_KLAUSUR_SERVICE_URL || 'http://localhost:8086'
@@ -18,117 +17,66 @@ interface IngestionTabProps {
onRefresh: () => void
}
function IngestionTab({
status,
onRefresh
}: IngestionTabProps) {
function IngestionTab({ status, onRefresh }: IngestionTabProps) {
const [starting, setStarting] = useState(false)
const [liveProgress, setLiveProgress] = useState<LiveProgress | null>(null)
const [indexedStats, setIndexedStats] = useState<IndexedStats | null>(null)
const [pendingFiles, setPendingFiles] = useState<PendingFilesData | null>(null)
const [ingestionHistory, setIngestionHistory] = useState<IngestionHistoryEntry[]>([])
const [showHistory, setShowHistory] = useState(false)
const [showPending, setShowPending] = useState(false)
// Fetch indexed stats, pending files, and history on mount
useEffect(() => {
const fetchStats = async () => {
try {
const res = await fetch(`${API_BASE}/api/v1/admin/nibis/stats`)
if (res.ok) {
const data = await res.json()
setIndexedStats(data)
}
} catch (err) {
console.error('Failed to fetch stats:', err)
}
try { const res = await fetch(`${API_BASE}/api/v1/admin/nibis/stats`); if (res.ok) setIndexedStats(await res.json()) }
catch (err) { console.error('Failed to fetch stats:', err) }
}
const fetchPending = async () => {
try {
const res = await fetch(`${API_BASE}/api/v1/admin/rag/files/pending`)
if (res.ok) {
const data = await res.json()
setPendingFiles(data)
}
} catch (err) {
console.error('Failed to fetch pending files:', err)
}
try { const res = await fetch(`${API_BASE}/api/v1/admin/rag/files/pending`); if (res.ok) setPendingFiles(await res.json()) }
catch (err) { console.error('Failed to fetch pending files:', err) }
}
const fetchHistory = async () => {
try {
const res = await fetch(`${API_BASE}/api/v1/admin/rag/ingestion/history?limit=20`)
if (res.ok) {
const data = await res.json()
setIngestionHistory(data.history || [])
}
} catch (err) {
console.error('Failed to fetch history:', err)
}
try { const res = await fetch(`${API_BASE}/api/v1/admin/rag/ingestion/history?limit=20`); if (res.ok) { const data = await res.json(); setIngestionHistory(data.history || []) } }
catch (err) { console.error('Failed to fetch history:', err) }
}
fetchStats()
fetchPending()
fetchHistory()
fetchStats(); fetchPending(); fetchHistory()
}, [])
// Poll for live progress when running
useEffect(() => {
let interval: NodeJS.Timeout | null = null
const fetchProgress = async () => {
try {
const res = await fetch(`${API_BASE}/api/v1/admin/nibis/progress`)
if (res.ok) {
const data = await res.json()
setLiveProgress(data)
// Refresh stats when complete
if (!data.running && data.phase === 'complete') {
onRefresh()
// Also refresh indexed stats
const statsRes = await fetch(`${API_BASE}/api/v1/admin/nibis/stats`)
if (statsRes.ok) {
setIndexedStats(await statsRes.json())
}
if (statsRes.ok) setIndexedStats(await statsRes.json())
}
}
} catch (err) {
console.error('Failed to fetch progress:', err)
}
} catch (err) { console.error('Failed to fetch progress:', err) }
}
// Start polling immediately and every 1.5 seconds
fetchProgress()
interval = setInterval(fetchProgress, 1500)
return () => {
if (interval) clearInterval(interval)
}
return () => { if (interval) clearInterval(interval) }
}, [onRefresh])
const startIngestion = async () => {
setStarting(true)
try {
await fetch(`${API_BASE}/api/v1/admin/nibis/ingest`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
method: 'POST', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ ewh_only: true, incremental: true }),
})
onRefresh()
} catch (err) {
console.error('Failed to start ingestion:', err)
} finally {
setStarting(false)
}
} catch (err) { console.error('Failed to start ingestion:', err) }
finally { setStarting(false) }
}
const phaseLabels: Record<string, string> = {
idle: 'Bereit',
extracting: 'Entpacke ZIP-Dateien...',
discovering: 'Suche Dokumente...',
indexing: 'Indexiere Dokumente...',
complete: 'Abgeschlossen',
idle: 'Bereit', extracting: 'Entpacke ZIP-Dateien...', discovering: 'Suche Dokumente...',
indexing: 'Indexiere Dokumente...', complete: 'Abgeschlossen',
}
return (
@@ -136,131 +84,58 @@ function IngestionTab({
<div className="flex items-center justify-between">
<div>
<h2 className="text-lg font-semibold text-slate-900">Ingestion Status</h2>
<p className="text-sm text-slate-500">
Übersicht über laufende und vergangene Indexierungsvorgänge
</p>
<p className="text-sm text-slate-500">Uebersicht ueber laufende und vergangene Indexierungsvorgaenge</p>
</div>
<div className="flex gap-3">
<button
onClick={onRefresh}
className="px-4 py-2 text-sm font-medium text-slate-700 bg-white border border-slate-300 rounded-lg hover:bg-slate-50"
>
Aktualisieren
</button>
<button
onClick={startIngestion}
disabled={status?.running || starting}
className="px-4 py-2 text-sm font-medium text-white bg-primary-600 rounded-lg hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed"
>
<button onClick={onRefresh} className="px-4 py-2 text-sm font-medium text-slate-700 bg-white border border-slate-300 rounded-lg hover:bg-slate-50">Aktualisieren</button>
<button onClick={startIngestion} disabled={status?.running || starting} className="px-4 py-2 text-sm font-medium text-white bg-primary-600 rounded-lg hover:bg-primary-700 disabled:opacity-50 disabled:cursor-not-allowed">
{starting ? 'Startet...' : 'Ingestion starten'}
</button>
</div>
</div>
{/* Live Progress (when running) */}
{/* Live Progress */}
{liveProgress?.running && (
<div className="bg-primary-50 rounded-lg border border-primary-200 p-6">
<div className="flex items-center gap-4 mb-4">
<div className="w-3 h-3 bg-primary-500 rounded-full animate-pulse"></div>
<span className="text-lg font-medium text-primary-900">
{liveProgress.phase ? (phaseLabels[liveProgress.phase] || liveProgress.phase) : 'Läuft...'}
</span>
<span className="ml-auto text-sm text-primary-700 font-mono">
{(liveProgress.percent ?? 0).toFixed(1)}%
</span>
<span className="text-lg font-medium text-primary-900">{liveProgress.phase ? (phaseLabels[liveProgress.phase] || liveProgress.phase) : 'Laeuft...'}</span>
<span className="ml-auto text-sm text-primary-700 font-mono">{(liveProgress.percent ?? 0).toFixed(1)}%</span>
</div>
{/* Progress Bar */}
<div className="h-3 bg-primary-200 rounded-full overflow-hidden mb-4">
<div
className="h-full bg-primary-600 transition-all duration-300"
style={{ width: `${liveProgress.percent ?? 0}%` }}
/>
<div className="h-full bg-primary-600 transition-all duration-300" style={{ width: `${liveProgress.percent ?? 0}%` }} />
</div>
{/* Current File */}
{liveProgress.current_filename && (
<p className="text-sm text-primary-700 mb-4 truncate">
<span className="font-medium">[{liveProgress.current_doc}/{liveProgress.total_docs}]</span>{' '}
{liveProgress.current_filename}
<span className="font-medium">[{liveProgress.current_doc}/{liveProgress.total_docs}]</span> {liveProgress.current_filename}
</p>
)}
{/* Live Stats */}
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 text-sm">
<div className="bg-white/50 rounded p-2">
<p className="text-primary-600 text-xs uppercase">Indexiert</p>
<p className="text-lg font-semibold text-primary-900">{liveProgress.documents_indexed}</p>
</div>
<div className="bg-white/50 rounded p-2">
<p className="text-primary-600 text-xs uppercase">Übersprungen</p>
<p className="text-lg font-semibold text-primary-900">{liveProgress.documents_skipped}</p>
</div>
<div className="bg-white/50 rounded p-2">
<p className="text-primary-600 text-xs uppercase">Chunks</p>
<p className="text-lg font-semibold text-primary-900">{liveProgress.chunks_created}</p>
</div>
<div className="bg-white/50 rounded p-2">
<p className="text-primary-600 text-xs uppercase">Fehler</p>
<p className={`text-lg font-semibold ${(liveProgress.errors_count ?? 0) > 0 ? 'text-red-600' : 'text-primary-900'}`}>
{liveProgress.errors_count ?? 0}
</p>
</div>
<div className="bg-white/50 rounded p-2"><p className="text-primary-600 text-xs uppercase">Indexiert</p><p className="text-lg font-semibold text-primary-900">{liveProgress.documents_indexed}</p></div>
<div className="bg-white/50 rounded p-2"><p className="text-primary-600 text-xs uppercase">Uebersprungen</p><p className="text-lg font-semibold text-primary-900">{liveProgress.documents_skipped}</p></div>
<div className="bg-white/50 rounded p-2"><p className="text-primary-600 text-xs uppercase">Chunks</p><p className="text-lg font-semibold text-primary-900">{liveProgress.chunks_created}</p></div>
<div className="bg-white/50 rounded p-2"><p className="text-primary-600 text-xs uppercase">Fehler</p><p className={`text-lg font-semibold ${(liveProgress.errors_count ?? 0) > 0 ? 'text-red-600' : 'text-primary-900'}`}>{liveProgress.errors_count ?? 0}</p></div>
</div>
</div>
)}
{/* Indexed Data Overview - Always visible */}
{/* Indexed Data Overview */}
{indexedStats?.indexed && (
<div className="bg-gradient-to-r from-green-50 to-emerald-50 rounded-lg border border-green-200 p-6">
<h3 className="text-lg font-semibold text-green-900 mb-4 flex items-center gap-2">
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
</svg>
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" /></svg>
Indexierte Daten (Gesamt)
</h3>
<div className="grid grid-cols-2 md:grid-cols-4 gap-6 mb-4">
<div className="bg-white/60 rounded-lg p-3">
<p className="text-xs text-green-700 uppercase tracking-wider">Chunks gesamt</p>
<p className="text-2xl font-bold text-green-900">
{(indexedStats.total_chunks ?? 0).toLocaleString()}
</p>
</div>
<div className="bg-white/60 rounded-lg p-3">
<p className="text-xs text-green-700 uppercase tracking-wider">Jahre</p>
<p className="text-2xl font-bold text-green-900">
{indexedStats.years?.length ?? 0}
</p>
<p className="text-xs text-green-600 mt-1">
{(indexedStats.years?.length ?? 0) > 0
? `${Math.min(...indexedStats.years!)} - ${Math.max(...indexedStats.years!)}`
: '-'
}
</p>
</div>
<div className="bg-white/60 rounded-lg p-3">
<p className="text-xs text-green-700 uppercase tracking-wider">Fächer</p>
<p className="text-2xl font-bold text-green-900">
{indexedStats.subjects?.length || 0}
</p>
</div>
<div className="bg-white/60 rounded-lg p-3">
<p className="text-xs text-green-700 uppercase tracking-wider">Status</p>
<p className="text-lg font-bold text-green-600">Bereit</p>
</div>
<div className="bg-white/60 rounded-lg p-3"><p className="text-xs text-green-700 uppercase tracking-wider">Chunks gesamt</p><p className="text-2xl font-bold text-green-900">{(indexedStats.total_chunks ?? 0).toLocaleString()}</p></div>
<div className="bg-white/60 rounded-lg p-3"><p className="text-xs text-green-700 uppercase tracking-wider">Jahre</p><p className="text-2xl font-bold text-green-900">{indexedStats.years?.length ?? 0}</p><p className="text-xs text-green-600 mt-1">{(indexedStats.years?.length ?? 0) > 0 ? `${Math.min(...indexedStats.years!)} - ${Math.max(...indexedStats.years!)}` : '-'}</p></div>
<div className="bg-white/60 rounded-lg p-3"><p className="text-xs text-green-700 uppercase tracking-wider">Faecher</p><p className="text-2xl font-bold text-green-900">{indexedStats.subjects?.length || 0}</p></div>
<div className="bg-white/60 rounded-lg p-3"><p className="text-xs text-green-700 uppercase tracking-wider">Status</p><p className="text-lg font-bold text-green-600">Bereit</p></div>
</div>
{/* Years breakdown */}
{indexedStats.years && indexedStats.years.length > 0 && (
<div className="flex flex-wrap gap-2">
{indexedStats.years.sort((a, b) => a - b).map((year) => (
<span
key={year}
className="px-3 py-1 bg-white/80 text-green-800 text-sm rounded-full font-medium"
>
{year}
</span>
<span key={year} className="px-3 py-1 bg-white/80 text-green-800 text-sm rounded-full font-medium">{year}</span>
))}
</div>
)}
@@ -271,63 +146,27 @@ function IngestionTab({
{!liveProgress?.running && (
<div className="bg-white rounded-lg border border-slate-200 p-6">
<h3 className="text-sm font-medium text-slate-700 mb-4">Letzter Indexierungslauf</h3>
<div className="flex items-center gap-4 mb-4">
<div className="w-3 h-3 bg-green-500 rounded-full"></div>
<span className="text-lg font-medium text-slate-900">
{liveProgress?.phase === 'complete' ? 'Abgeschlossen' : 'Bereit'}
</span>
<span className="text-lg font-medium text-slate-900">{liveProgress?.phase === 'complete' ? 'Abgeschlossen' : 'Bereit'}</span>
</div>
{status && (
<div className="grid grid-cols-2 md:grid-cols-4 gap-6">
<div>
<p className="text-xs text-slate-500 uppercase tracking-wider">Zeitpunkt</p>
<p className="text-lg font-semibold text-slate-900">
{status.lastRun
? new Date(status.lastRun).toLocaleString('de-DE')
: 'Noch nie'
}
</p>
</div>
<div>
<p className="text-xs text-slate-500 uppercase tracking-wider">Neu indexiert</p>
<p className="text-lg font-semibold text-slate-900">
{status.documentsIndexed ?? '-'}
</p>
</div>
<div>
<p className="text-xs text-slate-500 uppercase tracking-wider">Neue Chunks</p>
<p className="text-lg font-semibold text-slate-900">
{status.chunksCreated ?? '-'}
</p>
</div>
<div>
<p className="text-xs text-slate-500 uppercase tracking-wider">Fehler</p>
<p className={`text-lg font-semibold ${status.errors.length > 0 ? 'text-red-600' : 'text-slate-900'}`}>
{status.errors.length}
</p>
</div>
<div><p className="text-xs text-slate-500 uppercase tracking-wider">Zeitpunkt</p><p className="text-lg font-semibold text-slate-900">{status.lastRun ? new Date(status.lastRun).toLocaleString('de-DE') : 'Noch nie'}</p></div>
<div><p className="text-xs text-slate-500 uppercase tracking-wider">Neu indexiert</p><p className="text-lg font-semibold text-slate-900">{status.documentsIndexed ?? '-'}</p></div>
<div><p className="text-xs text-slate-500 uppercase tracking-wider">Neue Chunks</p><p className="text-lg font-semibold text-slate-900">{status.chunksCreated ?? '-'}</p></div>
<div><p className="text-xs text-slate-500 uppercase tracking-wider">Fehler</p><p className={`text-lg font-semibold ${status.errors.length > 0 ? 'text-red-600' : 'text-slate-900'}`}>{status.errors.length}</p></div>
</div>
)}
{/* Show skipped info from live progress */}
{liveProgress && (liveProgress.documents_skipped ?? 0) > 0 && (
<p className="mt-3 text-sm text-slate-500">
{liveProgress.documents_skipped} Dokumente übersprungen (bereits indexiert)
</p>
<p className="mt-3 text-sm text-slate-500">{liveProgress.documents_skipped} Dokumente uebersprungen (bereits indexiert)</p>
)}
{status?.errors && status.errors.length > 0 && (
<div className="mt-4 p-4 bg-red-50 rounded-lg">
<h4 className="text-sm font-medium text-red-800 mb-2">Fehler</h4>
<ul className="text-sm text-red-700 space-y-1">
{status.errors.slice(0, 5).map((error, i) => (
<li key={i}>{error}</li>
))}
{status.errors.length > 5 && (
<li className="text-red-500">... und {status.errors.length - 5} weitere</li>
)}
{status.errors.slice(0, 5).map((error, i) => <li key={i}>{error}</li>)}
{status.errors.length > 5 && <li className="text-red-500">... und {status.errors.length - 5} weitere</li>}
</ul>
</div>
)}
@@ -339,174 +178,40 @@ function IngestionTab({
<div className="bg-amber-50 rounded-lg border border-amber-200 p-6">
<div className="flex items-center justify-between mb-4">
<div className="flex items-center gap-3">
<svg className="w-6 h-6 text-amber-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
<svg className="w-6 h-6 text-amber-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" /></svg>
<div>
<h3 className="text-lg font-semibold text-amber-900">
{pendingFiles.pending_count} Dateien warten auf Indexierung
</h3>
<p className="text-sm text-amber-700">
{pendingFiles.indexed_count} von {pendingFiles.total_files} Dateien sind indexiert
</p>
<h3 className="text-lg font-semibold text-amber-900">{pendingFiles.pending_count} Dateien warten auf Indexierung</h3>
<p className="text-sm text-amber-700">{pendingFiles.indexed_count} von {pendingFiles.total_files} Dateien sind indexiert</p>
</div>
</div>
<button
onClick={() => setShowPending(!showPending)}
className="text-sm text-amber-700 hover:text-amber-900 font-medium"
>
{showPending ? 'Ausblenden' : 'Details anzeigen'}
</button>
<button onClick={() => setShowPending(!showPending)} className="text-sm text-amber-700 hover:text-amber-900 font-medium">{showPending ? 'Ausblenden' : 'Details anzeigen'}</button>
</div>
{/* Pending by year summary */}
{pendingFiles.by_year && Object.keys(pendingFiles.by_year).length > 0 && (
<div className="flex flex-wrap gap-2 mb-4">
{Object.entries(pendingFiles.by_year)
.sort(([a], [b]) => Number(b) - Number(a))
.map(([year, count]) => (
<span
key={year}
className="px-3 py-1 bg-amber-100 text-amber-800 text-sm rounded-full font-medium"
>
{year}: {count} Dateien
</span>
))}
{Object.entries(pendingFiles.by_year).sort(([a], [b]) => Number(b) - Number(a)).map(([year, count]) => (
<span key={year} className="px-3 py-1 bg-amber-100 text-amber-800 text-sm rounded-full font-medium">{year}: {count} Dateien</span>
))}
</div>
)}
{/* Pending files list */}
{showPending && pendingFiles.pending_files && (
<div className="mt-4 max-h-64 overflow-y-auto">
<table className="w-full text-sm">
<thead className="text-left text-amber-700 border-b border-amber-200">
<tr>
<th className="pb-2">Dateiname</th>
<th className="pb-2">Jahr</th>
<th className="pb-2">Fach</th>
<th className="pb-2">Niveau</th>
</tr>
</thead>
<thead className="text-left text-amber-700 border-b border-amber-200"><tr><th className="pb-2">Dateiname</th><th className="pb-2">Jahr</th><th className="pb-2">Fach</th><th className="pb-2">Niveau</th></tr></thead>
<tbody className="divide-y divide-amber-100">
{pendingFiles.pending_files.map((file) => (
<tr key={file.id} className="text-amber-900">
<td className="py-2 font-mono text-xs">{file.filename}</td>
<td className="py-2">{file.year}</td>
<td className="py-2">{file.subject}</td>
<td className="py-2">{file.niveau}</td>
</tr>
<tr key={file.id} className="text-amber-900"><td className="py-2 font-mono text-xs">{file.filename}</td><td className="py-2">{file.year}</td><td className="py-2">{file.subject}</td><td className="py-2">{file.niveau}</td></tr>
))}
</tbody>
</table>
{(pendingFiles.pending_count ?? 0) > 100 && (
<p className="mt-2 text-xs text-amber-600">
Zeige 100 von {pendingFiles.pending_count} Dateien
</p>
)}
{(pendingFiles.pending_count ?? 0) > 100 && <p className="mt-2 text-xs text-amber-600">Zeige 100 von {pendingFiles.pending_count} Dateien</p>}
</div>
)}
</div>
)}
{/* Ingestion History Section */}
<div className="bg-white rounded-lg border border-slate-200 p-6">
<div className="flex items-center justify-between mb-4">
<h3 className="text-lg font-semibold text-slate-900">Indexierungs-Historie</h3>
<button
onClick={() => setShowHistory(!showHistory)}
className="text-sm text-slate-600 hover:text-slate-900 font-medium"
>
{showHistory ? 'Ausblenden' : `Alle anzeigen (${ingestionHistory.length})`}
</button>
</div>
{ingestionHistory.length === 0 ? (
<p className="text-slate-500 text-sm">Noch keine Indexierungsläufe durchgeführt.</p>
) : (
<div className="space-y-3">
{(showHistory ? ingestionHistory : ingestionHistory.slice(0, 3)).map((entry) => (
<div
key={entry.id}
className={`rounded-lg p-4 ${
entry.status === 'success'
? 'bg-green-50 border border-green-200'
: 'bg-red-50 border border-red-200'
}`}
>
<div className="flex items-center justify-between mb-2">
<div className="flex items-center gap-2">
{entry.status === 'success' ? (
<svg className="w-5 h-5 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
</svg>
) : (
<svg className="w-5 h-5 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
</svg>
)}
<span className="font-medium text-slate-900">
{new Date(entry.started_at || entry.startedAt).toLocaleString('de-DE')}
</span>
</div>
<span className="text-xs text-slate-500 font-mono">{entry.collection}</span>
</div>
{entry.stats && (
<div className="grid grid-cols-4 gap-4 text-sm">
<div>
<span className="text-slate-500">Gefunden:</span>{' '}
<span className="font-medium">{entry.stats.documents_found}</span>
</div>
<div>
<span className="text-slate-500">Indexiert:</span>{' '}
<span className="font-medium text-green-700">{entry.stats.documents_indexed}</span>
</div>
<div>
<span className="text-slate-500">Übersprungen:</span>{' '}
<span className="font-medium">{entry.stats.documents_skipped}</span>
</div>
<div>
<span className="text-slate-500">Chunks:</span>{' '}
<span className="font-medium">{entry.stats.chunks_created}</span>
</div>
</div>
)}
{entry.filters && (
<div className="mt-2 flex flex-wrap gap-2">
{entry.filters.year && (
<span className="px-2 py-0.5 bg-slate-200 text-slate-700 text-xs rounded">
Jahr: {entry.filters.year}
</span>
)}
{entry.filters.subject && (
<span className="px-2 py-0.5 bg-slate-200 text-slate-700 text-xs rounded">
Fach: {entry.filters.subject}
</span>
)}
{entry.filters.incremental && (
<span className="px-2 py-0.5 bg-blue-100 text-blue-700 text-xs rounded">
Inkrementell
</span>
)}
</div>
)}
{entry.error && (
<p className="mt-2 text-sm text-red-700">{entry.error}</p>
)}
</div>
))}
</div>
)}
</div>
<IngestionHistory history={ingestionHistory} />
</div>
)
}
// ============================================================================
// Documents Tab
// ============================================================================
export { IngestionTab }