v46: ws.send(blob) directly, no async/await in onopen
This commit is contained in:
+4
-4
@@ -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 = 'v45';
|
const VERSION = 'v46';
|
||||||
document.getElementById('ver').textContent = VERSION;
|
document.getElementById('ver').textContent = VERSION;
|
||||||
|
|
||||||
// ---------- Перевод на русский (Groq) ----------
|
// ---------- Перевод на русский (Groq) ----------
|
||||||
@@ -642,11 +642,11 @@ async function transcribe(blob) {
|
|||||||
const ws = new WebSocket('wss://proxy.kube5s.ru/ws');
|
const ws = new WebSocket('wss://proxy.kube5s.ru/ws');
|
||||||
const timeout = setTimeout(() => { console.log('[WS] timeout'); ws.close(); resolve({ text: '', error: 'timeout' }); }, 60000);
|
const timeout = setTimeout(() => { console.log('[WS] timeout'); ws.close(); resolve({ text: '', error: 'timeout' }); }, 60000);
|
||||||
|
|
||||||
ws.onopen = async () => {
|
ws.onopen = () => {
|
||||||
console.log('[WS] connected');
|
console.log('[WS] connected');
|
||||||
ws.send(JSON.stringify({ token: GROQ_API_KEY }));
|
ws.send(JSON.stringify({ token: GROQ_API_KEY }));
|
||||||
ws.send(await blob.arrayBuffer());
|
ws.send(blob); // Blob directly — no async/await needed
|
||||||
console.log('[WS] blob sent');
|
console.log('[WS] blob sent ' + (blob.size/1024).toFixed(1) + 'KB');
|
||||||
};
|
};
|
||||||
|
|
||||||
ws.onmessage = (e) => {
|
ws.onmessage = (e) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user