Skip to content

Commit

Permalink
add use_streaming flag for elevenlabs and whisper (#290)
Browse files Browse the repository at this point in the history
* add use_streaming flag for elevenlabs (not for whisper yet)
---------

Co-authored-by: Dave Horton <daveh@beachdognet.com>
  • Loading branch information
xquanluu and davehorton authored Feb 12, 2024
1 parent 68d7334 commit 256ca44
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/routes/api/speech-credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ const encryptCredential = (obj) => {
auth_token = '',
cobalt_server_uri,
model_id,
options
options,
use_streaming
} = obj;

switch (vendor) {
Expand Down Expand Up @@ -211,7 +212,7 @@ const encryptCredential = (obj) => {
case 'elevenlabs':
assert(api_key, 'invalid elevenLabs speech credential: api_key is required');
assert(model_id, 'invalid elevenLabs speech credential: model_id is required');
const elevenlabsData = JSON.stringify({api_key, model_id, options});
const elevenlabsData = JSON.stringify({api_key, model_id, options, use_streaming});
return encrypt(elevenlabsData);

case 'assemblyai':
Expand Down Expand Up @@ -413,7 +414,8 @@ router.put('/:sid', async(req, res) => {
custom_tts_url,
cobalt_server_uri,
model_id,
options
options,
use_streaming
} = req.body;

const newCred = {
Expand All @@ -436,7 +438,8 @@ router.put('/:sid', async(req, res) => {
custom_tts_url,
cobalt_server_uri,
model_id,
options
options,
use_streaming
};
logger.info({o, newCred}, 'updating speech credential with this new credential');
obj.credential = encryptCredential(newCred);
Expand Down
1 change: 1 addition & 0 deletions lib/utils/speech-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ function decryptCredential(obj, credential, logger, isObscureKey = true) {
obj.api_key = isObscureKey ? obscureKey(o.api_key) : o.api_key;
obj.model_id = o.model_id;
obj.options = o.options;
obj.use_streaming = o.use_streaming;
} else if (obj.vendor.startsWith('custom:')) {
const o = JSON.parse(decrypt(credential));
obj.auth_token = isObscureKey ? obscureKey(o.auth_token) : o.auth_token;
Expand Down

0 comments on commit 256ca44

Please sign in to comment.