feat: fix hotspot test

This commit is contained in:
2026-01-22 16:52:36 -03:00
parent 957539d201
commit fa8ca6cb61
20 changed files with 247 additions and 39 deletions
@@ -135,14 +135,14 @@ export default function AudioResponsePlayer({
};
const evaluateResponse = async () => {
if (!transcript.trim()) {
alert("No speech detected. Please try recording again.");
if (!audioBlob) {
alert("No recording found. Please try again.");
return;
}
setIsTranscribing(true);
try {
const result = await lmsApi.evaluateAudio(transcript, prompt, keywords);
const result = await lmsApi.evaluateAudioFile(audioBlob, prompt, keywords);
setEvaluation({
score: result.score,
foundKeywords: result.found_keywords,
@@ -153,9 +153,9 @@ export default function AudioResponsePlayer({
if (onComplete) {
onComplete(result.score, transcript);
}
} catch (err) {
} catch (err: any) {
console.error("Evaluation failed", err);
alert("Evaluation failed. Please try again.");
alert(err.message || "Evaluation failed. Please try again.");
} finally {
setIsTranscribing(false);
}
@@ -94,6 +94,7 @@ export default function HotspotPlayer({
src={getImageUrl(imageUrl)}
alt={title}
fill
unoptimized
className="object-cover transition-transform duration-700 group-hover:scale-[1.02]"
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
/>
@@ -12,6 +12,7 @@ interface MediaPlayerProps {
media_type: 'video' | 'audio';
config?: {
maxPlays?: number;
show_transcript?: boolean;
markers?: {
timestamp: number;
question: string;
@@ -176,10 +177,10 @@ export default function MediaPlayer({ id, lessonId, title, url, media_type, conf
}
}}
>
{hasTranscription && vttEn && (
{hasTranscription && config?.show_transcript !== false && vttEn && (
<track kind="subtitles" src={vttEn} srcLang="en" label="English" />
)}
{hasTranscription && vttEs && (
{hasTranscription && config?.show_transcript !== false && vttEs && (
<track kind="subtitles" src={vttEs} srcLang="es" label="Español" />
)}
</video>