stt error fixed

This commit is contained in:
jhyang0 2025-07-08 16:01:11 +09:00
parent 2e259fcb8f
commit e5d301cc9c

View File

@ -320,14 +320,20 @@ class SttService {
}
async sendSystemAudioContent(data, mimeType) {
const provider = await this.getAiProvider();
const isGemini = provider === 'gemini';
if (!this.theirSttSession) {
throw new Error('Their STT session not active');
}
const payload = isGemini
let modelInfo = this.modelInfo;
if (!modelInfo) {
console.warn('[SttService] modelInfo not found, fetching on-the-fly as a fallback...');
modelInfo = await getCurrentModelInfo(null, { type: 'stt' });
}
if (!modelInfo) {
throw new Error('STT model info could not be retrieved.');
}
const payload = modelInfo.provider === 'gemini'
? { audio: { data, mimeType: mimeType || 'audio/pcm;rate=24000' } }
: data;