diff --git a/js/compare.js b/js/compare.js index 917fee4..ab7ff5e 100644 --- a/js/compare.js +++ b/js/compare.js @@ -54,15 +54,9 @@ async function doCompare(blob, originalText, duration) { const elapsed = ((Date.now() - startTime) / 1000).toFixed(1); setStatus('Анализ... ' + elapsed + 'с'); }, 150); - let whisperResult, phon; + let whisperResult; try { - const phonTimeout = new Promise(resolve => - setTimeout(() => resolve({ pitchHz: 0, pitchStability: 0, voiceClarity: 0, phonScore: 0 }), 15000) - ); - [whisperResult, phon] = await Promise.all([ - transcribe(blob), - Promise.race([phoneticAnalysis(blob), phonTimeout]) - ]); + whisperResult = await transcribe(blob); } catch(e) { clearInterval(timerId); isAnalyzing = false; @@ -71,33 +65,26 @@ async function doCompare(blob, originalText, duration) { } clearInterval(timerId); - const phonEmoji = phon.phonScore >= 85 ? '🟢' : phon.phonScore >= 60 ? '🟡' : '🔴'; let recHTML = '', diffHTML = ''; if (whisperResult.text) { const _transcribed = whisperResult.text; const { score, words } = compareTexts(originalText, whisperResult.text); const recEmoji = score >= 90 ? '🟢' : score >= 70 ? '🟡' : '🔴'; - recHTML = recEmoji + ' Распознание: ' + score + '%  |  🗣 ' + whisperResult.text + '  |  '; + recHTML = recEmoji + ' Распознание: ' + score + '%  |  🗣 ' + whisperResult.text + ''; diffHTML = '
' + '📋 Текст: зелёный ≥80%, жёлтый ≥50%, красный <50%' + '
' + renderDiff(words); } else { - recHTML = ''; + recHTML = '⚠️ Не распознано'; diffHTML = ''; } - document.getElementById('score').innerHTML = - recHTML + phonEmoji + ' Произношение: ' + phon.phonScore + '%'; + document.getElementById('score').innerHTML = recHTML; - document.getElementById('diff').innerHTML = diffHTML + - '
' + - '🎵 Тон: ' + phon.pitchHz + ' Hz' + - '📏 Стабильность: ' + phon.pitchStability + '%' + - '🗣 Артикуляция: ' + phon.voiceClarity + '%' + - '
'; + document.getElementById('diff').innerHTML = diffHTML; // Слоги — в отдельный div, не в diff (diff перезаписывается) _currentBlob = blob; diff --git a/js/main.js b/js/main.js index 7cca8cd..a35ad42 100644 --- a/js/main.js +++ b/js/main.js @@ -1,6 +1,6 @@ // ---------- Глобальные переменные и инициализация ---------- const GROQ_API_KEY = ''; -const VERSION = 'v78'; +const VERSION = 'v79'; let mediaRecorder, audioChunks = [], userAudioBlob = null, ttsText = ''; let isRecording = false, isAnalyzing = false, micAnalyser = null, micAnimId = null;