support voxist stt (#384)

This commit is contained in:
Hoan Luu Huu authored and GitHub committed 2025-02-05 08:32:36 -05:00
1 parent 86d50d94cb
commit 73e35c84c5
4 files changed
+83 -2

No files matched your search

+19 -1
View File
@@ -12,7 +12,8 @@ const {decryptCredential, testWhisper, testDeepgramTTS,
testVerbioTts,
testVerbioStt,
testSpeechmaticsStt,
testCartesia} = require('../../utils/speech-utils');
testCartesia,
testVoxistStt} = require('../../utils/speech-utils');
const {DbErrorUnprocessableRequest, DbErrorForbidden, DbErrorBadRequest} = require('../../utils/errors');
const {
testGoogleTts,
@@ -270,6 +271,11 @@ const encryptCredential = (obj) => {
const assemblyaiData = JSON.stringify({api_key});
return encrypt(assemblyaiData);
case 'voxist':
assert(api_key, 'invalid voxist speech credential: api_key is required');
const voxistData = JSON.stringify({api_key});
return encrypt(voxistData);
case 'whisper':
assert(api_key, 'invalid whisper speech credential: api_key is required');
assert(model_id, 'invalid whisper speech credential: model_id is required');
@@ -853,6 +859,18 @@ router.get('/:sid/test', async(req, res) => {
SpeechCredential.sttTestResult(sid, false);
}
}
} else if (cred.vendor === 'voxist') {
const {api_key} = credential;
if (cred.use_for_stt) {
try {
await testVoxistStt(logger, {api_key});
results.stt.status = 'ok';
SpeechCredential.sttTestResult(sid, true);
} catch (err) {
results.stt = {status: 'fail', reason: err.message};
SpeechCredential.sttTestResult(sid, false);
}
}
} else if (cred.vendor === 'whisper') {
if (cred.use_for_tts) {
try {