Refactor pipeline task handling and UI flows

This commit is contained in:
2026-06-13 21:09:49 +02:00
parent 21c7e4c9a4
commit ff4c572157
24 changed files with 1346 additions and 236 deletions

75
lib/audits/progress.ts Normal file
View File

@@ -0,0 +1,75 @@
export const AUDIT_PROGRESS_TOTAL_STEPS = 6;
export type AuditProgress = {
step: number;
total: number;
label: string;
percent: number;
};
const fallbackProgress: AuditProgress = {
step: 1,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Audit vorbereitet",
percent: 17,
};
const progressByStep: Record<string, AuditProgress> = {
audit_prepared: fallbackProgress,
pagespeed_insights: {
step: 2,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Messe PageSpeed",
percent: 33,
},
website_signals: {
step: 3,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Sammle Website-Signale",
percent: 50,
},
classification: {
step: 4,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Bewerte Befunde",
percent: 67,
},
evidenceVerifier: {
step: 4,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Bewerte Befunde",
percent: 67,
},
multimodalAudit: {
step: 4,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Bewerte Befunde",
percent: 67,
},
germanCopy: {
step: 5,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Erstelle Texte",
percent: 83,
},
qualityReview: {
step: 6,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Speichere Audit",
percent: 100,
},
persist_audit: {
step: 6,
total: AUDIT_PROGRESS_TOTAL_STEPS,
label: "Speichere Audit",
percent: 100,
},
};
export function getAuditProgressForStep(step: string | null | undefined) {
if (!step) {
return fallbackProgress;
}
return progressByStep[step] ?? fallbackProgress;
}