CognxSafeTrack commited on
Commit ·
5006493
1
Parent(s): cfa14f7
feat(admin): display Whisper STT confidence score in moderation live feed
Browse files
apps/admin/src/pages/LiveFeed.tsx
CHANGED
|
@@ -19,6 +19,7 @@ interface PendingReview {
|
|
| 19 |
};
|
| 20 |
audioUrl: string | null;
|
| 21 |
dayNumber: number;
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
export default function LiveFeed() {
|
|
@@ -229,7 +230,14 @@ function ModerationCard({ review, adminId, onSuccess, onSkip, getApiUrl, apiKey
|
|
| 229 |
{/* Left Column: Écoute */}
|
| 230 |
<div className="bg-slate-50 p-5 rounded-xl border border-slate-100">
|
| 231 |
<h4 className="text-sm font-semibold text-slate-700 mb-3 uppercase tracking-wider flex justify-between items-center">
|
| 232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
{review.audioUrl && (
|
| 234 |
<button onClick={changeSpeed} className="text-xs bg-indigo-100 text-indigo-700 px-2 py-1 rounded-md font-medium hover:bg-indigo-200 transition-colors">
|
| 235 |
Vitesse: {playbackRate}x
|
|
|
|
| 19 |
};
|
| 20 |
audioUrl: string | null;
|
| 21 |
dayNumber: number;
|
| 22 |
+
confidenceScore: number | null;
|
| 23 |
}
|
| 24 |
|
| 25 |
export default function LiveFeed() {
|
|
|
|
| 230 |
{/* Left Column: Écoute */}
|
| 231 |
<div className="bg-slate-50 p-5 rounded-xl border border-slate-100">
|
| 232 |
<h4 className="text-sm font-semibold text-slate-700 mb-3 uppercase tracking-wider flex justify-between items-center">
|
| 233 |
+
<div className="flex items-center gap-2">
|
| 234 |
+
Audio Étudiant (WOLOF)
|
| 235 |
+
{review.confidenceScore !== null && (
|
| 236 |
+
<span className={`text-xs px-2 py-0.5 rounded-full font-bold ${review.confidenceScore > 80 ? 'bg-green-100 text-green-700' : review.confidenceScore > 50 ? 'bg-orange-100 text-orange-700' : 'bg-red-100 text-red-700'}`}>
|
| 237 |
+
{review.confidenceScore}%
|
| 238 |
+
</span>
|
| 239 |
+
)}
|
| 240 |
+
</div>
|
| 241 |
{review.audioUrl && (
|
| 242 |
<button onClick={changeSpeed} className="text-xs bg-indigo-100 text-indigo-700 px-2 py-1 rounded-md font-medium hover:bg-indigo-200 transition-colors">
|
| 243 |
Vitesse: {playbackRate}x
|
apps/whatsapp-worker/src/index.ts
CHANGED
|
@@ -485,8 +485,8 @@ const worker = new Worker('whatsapp-queue', async (job: Job) => {
|
|
| 485 |
if (activeEnrollment) {
|
| 486 |
await prisma.userProgress.upsert({
|
| 487 |
where: { userId_trackId: { userId: user.id, trackId: activeEnrollment.trackId } },
|
| 488 |
-
update: { exerciseStatus: 'PENDING_REVIEW' as any, adminTranscription: transcribedText },
|
| 489 |
-
create: { userId: user.id, trackId: activeEnrollment.trackId, exerciseStatus: 'PENDING_REVIEW' as any, adminTranscription: transcribedText }
|
| 490 |
});
|
| 491 |
await sendTextMessage(phone, "🎙️ Nyangi jaxas sa kàddu. Xamle dina la tontu ci kanam ! (En cours d'analyse par l'équipe)");
|
| 492 |
} else {
|
|
|
|
| 485 |
if (activeEnrollment) {
|
| 486 |
await prisma.userProgress.upsert({
|
| 487 |
where: { userId_trackId: { userId: user.id, trackId: activeEnrollment.trackId } },
|
| 488 |
+
update: { exerciseStatus: 'PENDING_REVIEW' as any, adminTranscription: transcribedText, confidenceScore: confidence },
|
| 489 |
+
create: { userId: user.id, trackId: activeEnrollment.trackId, exerciseStatus: 'PENDING_REVIEW' as any, adminTranscription: transcribedText, confidenceScore: confidence }
|
| 490 |
});
|
| 491 |
await sendTextMessage(phone, "🎙️ Nyangi jaxas sa kàddu. Xamle dina la tontu ci kanam ! (En cours d'analyse par l'équipe)");
|
| 492 |
} else {
|
packages/database/prisma/schema.prisma
CHANGED
|
@@ -101,6 +101,7 @@ model UserProgress {
|
|
| 101 |
exerciseStatus ExerciseStatus @default(PENDING)
|
| 102 |
badges Json? // Array of strings: ["CLARTE", "CONFIANCE"]
|
| 103 |
behavioralScoring Json? // { discipline_financiere: 0, organisation: 0, ... }
|
|
|
|
| 104 |
adminTranscription String?
|
| 105 |
overrideAudioUrl String?
|
| 106 |
reviewedBy String?
|
|
|
|
| 101 |
exerciseStatus ExerciseStatus @default(PENDING)
|
| 102 |
badges Json? // Array of strings: ["CLARTE", "CONFIANCE"]
|
| 103 |
behavioralScoring Json? // { discipline_financiere: 0, organisation: 0, ... }
|
| 104 |
+
confidenceScore Float? // STT Whisper avg_logprob mapped to 0-100%
|
| 105 |
adminTranscription String?
|
| 106 |
overrideAudioUrl String?
|
| 107 |
reviewedBy String?
|