mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-07-04 19:21:53 +00:00
wip
This commit is contained in:
@@ -257,13 +257,7 @@ const testPlayHT = async(logger, synthAudio, credentials) => {
|
||||
}
|
||||
);
|
||||
// Test if playHT can fetch voices
|
||||
const get = bent('https://api.play.ht', 'GET', 'json', {
|
||||
'AUTHORIZATION' : credentials.api_key,
|
||||
'X-USER-ID': credentials.user_id,
|
||||
'Accept': 'application/json'
|
||||
});
|
||||
|
||||
await Promise.all([ get('/api/v2/cloned-voices'), get('/api/v2/voices')]);
|
||||
await fetchLayHTVoices(credentials);
|
||||
} catch (err) {
|
||||
logger.info({err}, 'synth Playht returned error');
|
||||
throw err;
|
||||
@@ -687,7 +681,7 @@ const concat = (a) => {
|
||||
return a ? ` ${a},` : '';
|
||||
};
|
||||
|
||||
async function getLanguagesVoicesForPlayHT(credential) {
|
||||
const fetchLayHTVoices = async(credential) => {
|
||||
if (credential) {
|
||||
const get = bent('https://api.play.ht', 'GET', 'json', {
|
||||
'AUTHORIZATION' : credential.api_key,
|
||||
@@ -695,7 +689,13 @@ async function getLanguagesVoicesForPlayHT(credential) {
|
||||
'Accept': 'application/json'
|
||||
});
|
||||
|
||||
const [cloned_voice, voices] = await Promise.all([ get('/api/v2/cloned-voices'), get('/api/v2/voices')]);
|
||||
return await Promise.all([ get('/api/v2/cloned-voices'), get('/api/v2/voices')]);
|
||||
}
|
||||
};
|
||||
|
||||
async function getLanguagesVoicesForPlayHT(credential) {
|
||||
if (credential) {
|
||||
const [cloned_voice, voices] = await fetchLayHTVoices(credential);
|
||||
const list_voices = [...cloned_voice, ...voices];
|
||||
|
||||
const buildVoice = (d) => {
|
||||
|
||||
Reference in New Issue
Block a user