support custom tts streaming (#1023)

* support custom tts streaming

* wip

* wip

* wip

* wip

* wip

* wip

* fix review comments
This commit is contained in:
Hoan Luu Huu
2025-01-14 19:24:06 +07:00
committed by GitHub
parent 499c800213
commit ca8cace284
5 changed files with 24 additions and 5 deletions

View File

@@ -214,7 +214,7 @@ class TtsStreamingBuffer extends Emitter {
}
async _api(ep, args) {
const apiCmd = `uuid_${this.vendor}_tts_streaming`;
const apiCmd = `uuid_${this.vendor.startsWith('custom:') ? 'custom' : this.vendor}_tts_streaming`;
const res = await ep.api(apiCmd, `^^|${args.join('|')}`);
if (!res.body?.startsWith('+OK')) {
this.logger.info({args}, `Error calling ${apiCmd}: ${res.body}`);
@@ -277,7 +277,8 @@ class TtsStreamingBuffer extends Emitter {
// DH: add other vendors here as modules are added
'deepgram',
'cartesia',
'elevenlabs'
'elevenlabs',
'custom'
].forEach((vendor) => {
const eventClassName = `${vendor.charAt(0).toUpperCase() + vendor.slice(1)}TtsStreamingEvents`;
const eventClass = require('../utils/constants')[eventClassName];