v83: Whisper — сырой WebM, без WAV-конвертации

This commit is contained in:
“Naeel”
2026-05-23 06:27:35 +04:00
parent dababcf466
commit 73e9efad9c
3 changed files with 6 additions and 12 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
// ---------- Глобальные переменные и инициализация ----------
const GROQ_API_KEY = '';
const VERSION = 'v82';
const VERSION = 'v83';
let mediaRecorder, audioChunks = [], userAudioBlob = null, ttsText = '';
let isRecording = false, isAnalyzing = false, micAnalyser = null, micAnimId = null;
+2 -5
View File
@@ -4,15 +4,12 @@ async function transcribe(blob) {
if (!GROQ_API_KEY) return { text: '', error: 'no_key' };
const tStart = performance.now();
// Обрезаем 0.2с в начале (щелчок)
const sendBlob = await trimStartBlob(blob);
const form = new FormData();
form.append('file', sendBlob, sendBlob.type === 'audio/wav' ? 'audio.wav' : 'audio.webm');
form.append('file', blob, 'audio.webm');
form.append('model', 'whisper-large-v3');
form.append('language', 'it');
console.log('[HTTP] blob ' + (sendBlob.size/1024).toFixed(1) + 'KB → multipart POST');
console.log('[HTTP] blob ' + (blob.size/1024).toFixed(1) + 'KB → multipart POST');
try {
const r = await fetch('https://lang.kube5s.ru/openai/v1/audio/transcriptions', {