Files
breakpilot-lehrer/admin-lehrer/app/(admin)/ai/test-quality/_components/SyntheticTab.tsx
Benjamin Admin 9ba420fa91
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 42s
CI / test-go-edu-search (push) Successful in 34s
CI / test-python-klausur (push) Failing after 2m51s
CI / test-python-agent-core (push) Successful in 21s
CI / test-nodejs-website (push) Successful in 29s
Fix: Remove broken getKlausurApiUrl and clean up empty lines
sed replacement left orphaned hostname references in story page
and empty lines in getApiBase functions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 16:02:04 +02:00

82 lines
3.7 KiB
TypeScript

'use client'
import type { BQASMetrics } from '../types'
import { IntentScoresChart } from './IntentScoresChart'
import { FailedTestsList } from './FailedTestsList'
export function SyntheticTab({
syntheticMetrics,
isRunningSynthetic,
runSyntheticTests,
}: {
syntheticMetrics: BQASMetrics | null
isRunningSynthetic: boolean
runSyntheticTests: () => void
}) {
return (
<div className="space-y-6">
<div className="bg-white rounded-xl border border-slate-200 p-6">
<div className="flex items-center justify-between mb-6">
<div>
<h3 className="text-lg font-semibold text-slate-900">Synthetic Test Suite</h3>
<p className="text-sm text-slate-500">LLM-generierte Variationen fuer Robustheit-Tests</p>
</div>
<button
onClick={runSyntheticTests}
disabled={isRunningSynthetic}
className={`px-4 py-2 rounded-lg text-sm font-medium transition-all ${
isRunningSynthetic
? 'bg-teal-100 text-teal-600 cursor-wait'
: 'bg-teal-600 text-white hover:bg-teal-700 active:scale-95'
}`}
>
{isRunningSynthetic ? 'Laeuft...' : 'Tests starten'}
</button>
</div>
{syntheticMetrics ? (
<>
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
<div className="text-center p-4 bg-slate-50 rounded-lg">
<p className="text-2xl font-bold text-slate-900">{syntheticMetrics.total_tests}</p>
<p className="text-xs text-slate-500">Generierte Tests</p>
</div>
<div className="text-center p-4 bg-emerald-50 rounded-lg">
<p className="text-2xl font-bold text-emerald-600">{syntheticMetrics.passed_tests}</p>
<p className="text-xs text-slate-500">Bestanden</p>
</div>
<div className="text-center p-4 bg-blue-50 rounded-lg">
<p className="text-2xl font-bold text-blue-600">{syntheticMetrics.avg_composite_score.toFixed(2)}</p>
<p className="text-xs text-slate-500">Avg Score</p>
</div>
<div className="text-center p-4 bg-purple-50 rounded-lg">
<p className="text-2xl font-bold text-purple-600">{syntheticMetrics.avg_coherence.toFixed(2)}</p>
<p className="text-xs text-slate-500">Coherence</p>
</div>
</div>
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div>
<h4 className="font-medium text-slate-900 mb-4">Intent-Variationen</h4>
<IntentScoresChart scores={syntheticMetrics.scores_by_intent} />
</div>
<div>
<h4 className="font-medium text-slate-900 mb-4">Fehlgeschlagene Tests</h4>
<FailedTestsList testIds={syntheticMetrics.failed_test_ids} />
</div>
</div>
</>
) : (
<div className="text-center py-12 text-slate-400">
<svg className="w-16 h-16 mx-auto mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z" />
</svg>
<p>Noch keine synthetischen Tests ausgefuehrt</p>
<p className="text-sm mt-2">Klicke &quot;Tests starten&quot; um Variationen zu generieren</p>
</div>
)}
</div>
</div>
)
}