error handling for TTS synthesize

This commit is contained in:
Elijah R 2024-07-14 22:44:03 -04:00
parent 2de60a98a3
commit 37fddca3e4

View file

@ -92,8 +92,12 @@ export class MSAgentChatRoom {
} }
}; };
if (this.tts !== null) { if (this.tts !== null) {
try {
let filename = await this.tts.synthesizeToFile(message, (++this.msgId).toString(10)); let filename = await this.tts.synthesizeToFile(message, (++this.msgId).toString(10));
msg.data.audio = '/api/tts/' + filename; msg.data.audio = '/api/tts/' + filename;
} catch (e) {
console.error(`Error synthesizing TTS: ${(e as Error).message}`);
}
} }
for (const _client of this.getActiveClients()) { for (const _client of this.getActiveClients()) {
_client.send(msg); _client.send(msg);