v40: remove debug logs, clean CORS (only Flask handles it)
This commit is contained in:
+3
-5
@@ -53,7 +53,7 @@ let mediaRecorder, audioChunks = [], userAudioBlob = null, ttsText = '';
|
|||||||
let isRecording = false, isAnalyzing = false, micAnalyser = null, micAnimId = null;
|
let isRecording = false, isAnalyzing = false, micAnalyser = null, micAnimId = null;
|
||||||
let recordStartTime = 0, recordDuration = 0;
|
let recordStartTime = 0, recordDuration = 0;
|
||||||
// ---------- Версия ----------
|
// ---------- Версия ----------
|
||||||
const VERSION = 'v39';
|
const VERSION = 'v40';
|
||||||
document.getElementById('ver').textContent = VERSION;
|
document.getElementById('ver').textContent = VERSION;
|
||||||
|
|
||||||
// ---------- Перевод на русский (Groq) ----------
|
// ---------- Перевод на русский (Groq) ----------
|
||||||
@@ -221,12 +221,11 @@ async function doCompare(blob, originalText, duration) {
|
|||||||
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
||||||
setStatus('Анализ... ' + elapsed + 'с');
|
setStatus('Анализ... ' + elapsed + 'с');
|
||||||
}, 150);
|
}, 150);
|
||||||
const t0 = performance.now();
|
|
||||||
let whisperResult, phon;
|
let whisperResult, phon;
|
||||||
try {
|
try {
|
||||||
[whisperResult, phon] = await Promise.all([
|
[whisperResult, phon] = await Promise.all([
|
||||||
transcribe(blob).then(r => { console.log('[TIMING] transcribe:', ((performance.now()-t0)/1000).toFixed(2)+'s'); return r; }),
|
transcribe(blob),
|
||||||
phoneticAnalysis(blob).then(r => { console.log('[TIMING] phonetic:', ((performance.now()-t0)/1000).toFixed(2)+'s'); return r; })
|
phoneticAnalysis(blob)
|
||||||
]);
|
]);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
clearInterval(timerId);
|
clearInterval(timerId);
|
||||||
@@ -611,7 +610,6 @@ document.getElementById('btnPlayUser').onclick = async () => {
|
|||||||
|
|
||||||
async function transcribe(blob) {
|
async function transcribe(blob) {
|
||||||
if (!GROQ_API_KEY) return { text: '', error: 'no_key' };
|
if (!GROQ_API_KEY) return { text: '', error: 'no_key' };
|
||||||
console.log('[BLOB] size:', blob.size, 'bytes, type:', blob.type);
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', new File([blob], 'audio.webm', { type: 'audio/webm' }));
|
formData.append('file', new File([blob], 'audio.webm', { type: 'audio/webm' }));
|
||||||
formData.append('model', 'whisper-large-v3');
|
formData.append('model', 'whisper-large-v3');
|
||||||
|
|||||||
Reference in New Issue
Block a user