diff --git a/packages/client-discord/src/messages.ts b/packages/client-discord/src/messages.ts index cab78a8ad2..25227e3e94 100644 --- a/packages/client-discord/src/messages.ts +++ b/packages/client-discord/src/messages.ts @@ -521,6 +521,12 @@ export class MessageManager { ServiceType.SPEECH_GENERATION ); + if (!speechService) { + throw new Error( + "Speech generation service not found" + ); + } + const audioStream = await speechService.generate( this.runtime, content.text diff --git a/packages/client-discord/src/voice.ts b/packages/client-discord/src/voice.ts index cf03ac45e5..db62844756 100644 --- a/packages/client-discord/src/voice.ts +++ b/packages/client-discord/src/voice.ts @@ -374,7 +374,6 @@ export class VoiceManager extends EventEmitter { audioStream, 10000000, async (buffer) => { - // console.log("buffer: ", buffer); const currentTime = Date.now(); const silenceDuration = currentTime - lastChunkTime; if (!buffer) { @@ -401,15 +400,16 @@ export class VoiceManager extends EventEmitter { this.runtime.getService( ServiceType.TRANSCRIPTION ); - console.log( - "transcriptionService: ", - transcriptionService - ); + + if (!transcriptionService) { + throw new Error( + "Transcription generation service not found" + ); + } const text = await transcriptionService.transcribe(wavBuffer); - console.log("transcribed text: ", text); transcriptionText += text; } catch (error) { console.error("Error processing audio stream:", error);