feat(config): disable code-lab options and hide transcripts for graded audio responses
This commit is contained in:
@@ -39,6 +39,9 @@ export default function AudioResponsePlayer({
|
|||||||
const timerRef = useRef<NodeJS.Timeout | null>(null);
|
const timerRef = useRef<NodeJS.Timeout | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// For graded audio responses we intentionally avoid transcript capture/display.
|
||||||
|
if (isGraded) return;
|
||||||
|
|
||||||
// Initialize Web Speech API
|
// Initialize Web Speech API
|
||||||
if (typeof window !== 'undefined' && ('webkitSpeechRecognition' in window || 'SpeechRecognition' in window)) {
|
if (typeof window !== 'undefined' && ('webkitSpeechRecognition' in window || 'SpeechRecognition' in window)) {
|
||||||
const SpeechRecognition = (window as any).webkitSpeechRecognition || (window as any).SpeechRecognition;
|
const SpeechRecognition = (window as any).webkitSpeechRecognition || (window as any).SpeechRecognition;
|
||||||
@@ -67,7 +70,7 @@ export default function AudioResponsePlayer({
|
|||||||
return () => {
|
return () => {
|
||||||
if (timerRef.current) clearInterval(timerRef.current);
|
if (timerRef.current) clearInterval(timerRef.current);
|
||||||
};
|
};
|
||||||
}, []);
|
}, [isGraded]);
|
||||||
|
|
||||||
const startRecording = async () => {
|
const startRecording = async () => {
|
||||||
// Check if browser supports MediaRecorder
|
// Check if browser supports MediaRecorder
|
||||||
@@ -128,7 +131,7 @@ export default function AudioResponsePlayer({
|
|||||||
console.log('[AudioResponse] Recording started');
|
console.log('[AudioResponse] Recording started');
|
||||||
|
|
||||||
// Start speech recognition
|
// Start speech recognition
|
||||||
if (recognitionRef.current) {
|
if (!isGraded && recognitionRef.current) {
|
||||||
setTranscript("");
|
setTranscript("");
|
||||||
try {
|
try {
|
||||||
recognitionRef.current.start();
|
recognitionRef.current.start();
|
||||||
@@ -215,7 +218,7 @@ export default function AudioResponsePlayer({
|
|||||||
blockId,
|
blockId,
|
||||||
recordingTime
|
recordingTime
|
||||||
);
|
);
|
||||||
if (result.transcript) {
|
if (!isGraded && result.transcript) {
|
||||||
setTranscript(result.transcript);
|
setTranscript(result.transcript);
|
||||||
}
|
}
|
||||||
setEvaluation({
|
setEvaluation({
|
||||||
@@ -226,7 +229,7 @@ export default function AudioResponsePlayer({
|
|||||||
setSubmitted(true);
|
setSubmitted(true);
|
||||||
|
|
||||||
if (onComplete) {
|
if (onComplete) {
|
||||||
onComplete(result.score, result.transcript || transcript);
|
onComplete(result.score, isGraded ? "" : (result.transcript || transcript));
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error("Evaluation failed", err);
|
console.error("Evaluation failed", err);
|
||||||
@@ -361,7 +364,7 @@ export default function AudioResponsePlayer({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Transcript Preview */}
|
{/* Transcript Preview */}
|
||||||
{transcript && !submitted && (
|
{transcript && !submitted && !isGraded && (
|
||||||
<div className="p-4 bg-black/5 dark:bg-white/5 border border-black/5 dark:border-white/10 rounded-xl">
|
<div className="p-4 bg-black/5 dark:bg-white/5 border border-black/5 dark:border-white/10 rounded-xl">
|
||||||
<p className="text-xs text-gray-500 dark:text-gray-500 uppercase tracking-wider mb-2">Transcript:</p>
|
<p className="text-xs text-gray-500 dark:text-gray-500 uppercase tracking-wider mb-2">Transcript:</p>
|
||||||
<p className="text-sm text-gray-700 dark:text-gray-300">{transcript}</p>
|
<p className="text-sm text-gray-700 dark:text-gray-300">{transcript}</p>
|
||||||
@@ -436,10 +439,12 @@ export default function AudioResponsePlayer({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="p-4 bg-black/5 dark:bg-white/5 border border-black/5 dark:border-white/10 rounded-xl">
|
{!isGraded && (
|
||||||
<p className="text-xs text-gray-500 uppercase tracking-wider mb-2">Your Transcript:</p>
|
<div className="p-4 bg-black/5 dark:bg-white/5 border border-black/5 dark:border-white/10 rounded-xl">
|
||||||
<p className="text-sm text-gray-700 dark:text-gray-300">{transcript}</p>
|
<p className="text-xs text-gray-500 uppercase tracking-wider mb-2">Your Transcript:</p>
|
||||||
</div>
|
<p className="text-sm text-gray-700 dark:text-gray-300">{transcript}</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{!isGraded && evaluation.score < 70 && (
|
{!isGraded && evaluation.score < 70 && (
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -1171,7 +1171,6 @@ export default function LessonEditor({ params }: { params: { id: string; lessonI
|
|||||||
{ type: 'audio-response', icon: '🎤', label: 'Oral Practice', color: 'blue' },
|
{ type: 'audio-response', icon: '🎤', label: 'Oral Practice', color: 'blue' },
|
||||||
{ type: 'memory-match', icon: '🧩', label: 'Logic Game', color: 'indigo' },
|
{ type: 'memory-match', icon: '🧩', label: 'Logic Game', color: 'indigo' },
|
||||||
{ type: 'peer-review', icon: '👥', label: 'Peer Review', color: 'slate' },
|
{ type: 'peer-review', icon: '👥', label: 'Peer Review', color: 'slate' },
|
||||||
{ type: 'code-lab', icon: '🧑💻', label: 'Code Lab', color: 'indigo' },
|
|
||||||
{ type: 'mermaid', icon: '📊', label: 'Mermaid Diagram', color: 'indigo' },
|
{ type: 'mermaid', icon: '📊', label: 'Mermaid Diagram', color: 'indigo' },
|
||||||
{ type: 'role-playing', icon: '🎭', label: 'Role-Playing AI', color: 'purple' },
|
{ type: 'role-playing', icon: '🎭', label: 'Role-Playing AI', color: 'purple' },
|
||||||
].map((item) => (
|
].map((item) => (
|
||||||
|
|||||||
@@ -200,7 +200,6 @@ export default function QuestionBankPage() {
|
|||||||
<option value="fill-in-the-blanks">Completar</option>
|
<option value="fill-in-the-blanks">Completar</option>
|
||||||
<option value="audio-response">Respuesta Audio</option>
|
<option value="audio-response">Respuesta Audio</option>
|
||||||
<option value="hotspot">Hotspot</option>
|
<option value="hotspot">Hotspot</option>
|
||||||
<option value="code-lab">Código</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -242,8 +242,6 @@ export default function QuestionBankEditor({ question, onSuccess, onCancel }: Qu
|
|||||||
<option value="ordering">Ordenar</option>
|
<option value="ordering">Ordenar</option>
|
||||||
<option value="fill-in-the-blanks">Completar Espacios</option>
|
<option value="fill-in-the-blanks">Completar Espacios</option>
|
||||||
<option value="audio-response">Respuesta de Audio</option>
|
<option value="audio-response">Respuesta de Audio</option>
|
||||||
<option value="hotspot">Hotspot (Imagen)</option>
|
|
||||||
<option value="code-lab">Ejercicio de Código</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user