🌊 feat: enhance TTSService with Deepgram SDK integration and refactor voice validation

This commit is contained in:
Marco Beretta 2024-11-23 16:49:56 +01:00
parent 5eabd2493c
commit b7f4903acd
No known key found for this signature in database
GPG key ID: D918033D8E74CC11
3 changed files with 123 additions and 33 deletions

View file

@ -199,7 +199,7 @@ class STTService {
topics: sttSchema.intelligence?.topics,
};
[configOptions].forEach(this.removeUndefined);
this.removeUndefined(configOptions);
const { result, error } = await deepgram.listen.prerecorded.transcribeFile(
audioReadStream,
@ -213,6 +213,7 @@ class STTService {
return result.results?.channels[0]?.alternatives[0]?.transcript || '';
}
// TODO: Implement a better way to determine if the SDK should be used
shouldUseSDK(provider, sttSchema) {
if (provider !== STTProviders.OPENAI && provider !== STTProviders.AZURE_OPENAI) {
return true;