v46: ws.send(blob) directly, no async/await in onopen

This commit is contained in:
“Naeel”
2026-05-22 16:38:54 +04:00
parent d4aebf4b2c
commit 86e7db4b77
+4 -4
View File
@@ -53,7 +53,7 @@ let mediaRecorder, audioChunks = [], userAudioBlob = null, ttsText = '';
let isRecording = false, isAnalyzing = false, micAnalyser = null, micAnimId = null;
let recordStartTime = 0, recordDuration = 0;
// ---------- Версия ----------
const VERSION = 'v45';
const VERSION = 'v46';
document.getElementById('ver').textContent = VERSION;
// ---------- Перевод на русский (Groq) ----------
@@ -642,11 +642,11 @@ async function transcribe(blob) {
const ws = new WebSocket('wss://proxy.kube5s.ru/ws');
const timeout = setTimeout(() => { console.log('[WS] timeout'); ws.close(); resolve({ text: '', error: 'timeout' }); }, 60000);
ws.onopen = async () => {
ws.onopen = () => {
console.log('[WS] connected');
ws.send(JSON.stringify({ token: GROQ_API_KEY }));
ws.send(await blob.arrayBuffer());
console.log('[WS] blob sent');
ws.send(blob); // Blob directly — no async/await needed
console.log('[WS] blob sent ' + (blob.size/1024).toFixed(1) + 'KB');
};
ws.onmessage = (e) => {