mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-01-25 02:08:24 +00:00
elevenlabs new model and options (#267)
This commit is contained in:
@@ -132,7 +132,8 @@ const encryptCredential = (obj) => {
|
|||||||
custom_tts_url,
|
custom_tts_url,
|
||||||
auth_token = '',
|
auth_token = '',
|
||||||
cobalt_server_uri,
|
cobalt_server_uri,
|
||||||
model_id
|
model_id,
|
||||||
|
options
|
||||||
} = obj;
|
} = obj;
|
||||||
|
|
||||||
switch (vendor) {
|
switch (vendor) {
|
||||||
@@ -210,7 +211,7 @@ const encryptCredential = (obj) => {
|
|||||||
case 'elevenlabs':
|
case 'elevenlabs':
|
||||||
assert(api_key, 'invalid elevenLabs speech credential: api_key is required');
|
assert(api_key, 'invalid elevenLabs speech credential: api_key is required');
|
||||||
assert(model_id, 'invalid elevenLabs speech credential: model_id is required');
|
assert(model_id, 'invalid elevenLabs speech credential: model_id is required');
|
||||||
const elevenlabsData = JSON.stringify({api_key, model_id});
|
const elevenlabsData = JSON.stringify({api_key, model_id, options});
|
||||||
return encrypt(elevenlabsData);
|
return encrypt(elevenlabsData);
|
||||||
|
|
||||||
case 'assemblyai':
|
case 'assemblyai':
|
||||||
@@ -411,7 +412,8 @@ router.put('/:sid', async(req, res) => {
|
|||||||
custom_stt_url,
|
custom_stt_url,
|
||||||
custom_tts_url,
|
custom_tts_url,
|
||||||
cobalt_server_uri,
|
cobalt_server_uri,
|
||||||
model_id
|
model_id,
|
||||||
|
options
|
||||||
} = req.body;
|
} = req.body;
|
||||||
|
|
||||||
const newCred = {
|
const newCred = {
|
||||||
@@ -433,7 +435,8 @@ router.put('/:sid', async(req, res) => {
|
|||||||
custom_stt_url,
|
custom_stt_url,
|
||||||
custom_tts_url,
|
custom_tts_url,
|
||||||
cobalt_server_uri,
|
cobalt_server_uri,
|
||||||
model_id
|
model_id,
|
||||||
|
options
|
||||||
};
|
};
|
||||||
logger.info({o, newCred}, 'updating speech credential with this new credential');
|
logger.info({o, newCred}, 'updating speech credential with this new credential');
|
||||||
obj.credential = encryptCredential(newCred);
|
obj.credential = encryptCredential(newCred);
|
||||||
|
|||||||
@@ -395,6 +395,7 @@ function decryptCredential(obj, credential, logger, isObscureKey = true) {
|
|||||||
const o = JSON.parse(decrypt(credential));
|
const o = JSON.parse(decrypt(credential));
|
||||||
obj.api_key = isObscureKey ? obscureKey(o.api_key) : o.api_key;
|
obj.api_key = isObscureKey ? obscureKey(o.api_key) : o.api_key;
|
||||||
obj.model_id = o.model_id;
|
obj.model_id = o.model_id;
|
||||||
|
obj.options = o.options;
|
||||||
} else if (obj.vendor.startsWith('custom:')) {
|
} else if (obj.vendor.startsWith('custom:')) {
|
||||||
const o = JSON.parse(decrypt(credential));
|
const o = JSON.parse(decrypt(credential));
|
||||||
obj.auth_token = isObscureKey ? obscureKey(o.auth_token) : o.auth_token;
|
obj.auth_token = isObscureKey ? obscureKey(o.auth_token) : o.auth_token;
|
||||||
|
|||||||
Reference in New Issue
Block a user