Skip to content

Commit

Permalink
properly count aivoices
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Dec 30, 2024
1 parent 796c193 commit 8a98268
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions server/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1162,21 +1162,19 @@ export class Room {
// console.log(arr);
const results = await Promise.allSettled(
arr.map(async (str, i) => {
try {
// Call the API to pregenerate the voice clips
const url = await genAITextToSpeech(rvcHost, str ?? '');
// Report progress back in chat messages
if (url) {
this.addChatMessage(undefined, {
id: '',
name: 'System',
msg: 'generated ai voice ' + i + ': ' + url,
});
redisCount('aiVoice');
}
} catch (e) {
console.log(e);
// Call the API to pregenerate the voice clips
const url = await genAITextToSpeech(rvcHost, str ?? '');
// Report progress back in chat messages
if (url) {
this.addChatMessage(undefined, {
id: '',
name: 'System',
msg: 'generated ai voice ' + i + ': ' + url,
});
redisCount('aiVoice');
return url;
}
return null;
}),
);
this.addChatMessage(undefined, {
Expand Down

0 comments on commit 8a98268

Please sign in to comment.