Skip to content

Commit

Permalink
issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Nov 19, 2024
1 parent af591e0 commit 48d6fdb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions packages/client-discord/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions packages/client-discord/src/voice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -401,15 +400,16 @@ export class VoiceManager extends EventEmitter {
this.runtime.getService<ITranscriptionService>(
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);
Expand Down

0 comments on commit 48d6fdb

Please sign in to comment.