mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-07-24 13:02:16 +00:00
support google gemini tts (#534)
* support google gemini tts * wip * wip * wip * wip * wip * support speech utils
This commit is contained in:
@@ -173,14 +173,23 @@ const encryptCredential = (obj) => {
|
||||
switch (vendor) {
|
||||
case 'google':
|
||||
assert(service_key, 'invalid json key: service_key is required');
|
||||
let modified_service_key = service_key;
|
||||
try {
|
||||
const o = JSON.parse(service_key);
|
||||
// support google gemini tts
|
||||
if (model_id) {
|
||||
o.model_id = model_id;
|
||||
} else {
|
||||
delete o.model_id;
|
||||
}
|
||||
|
||||
assert(o.client_email && o.private_key, 'invalid google service account key');
|
||||
modified_service_key = JSON.stringify(o);
|
||||
}
|
||||
catch (err) {
|
||||
assert(false, 'invalid google service account key - not JSON');
|
||||
}
|
||||
return encrypt(service_key);
|
||||
return encrypt(modified_service_key);
|
||||
|
||||
case 'aws':
|
||||
// AWS polly can work for 3 types of credentials:
|
||||
@@ -582,7 +591,7 @@ router.put('/:sid', async(req, res) => {
|
||||
custom_tts_url,
|
||||
custom_tts_streaming_url,
|
||||
cobalt_server_uri,
|
||||
model_id,
|
||||
model_id: model_id !== undefined ? model_id : o.model_id,
|
||||
stt_model_id,
|
||||
voice_engine,
|
||||
options,
|
||||
@@ -596,7 +605,8 @@ router.put('/:sid', async(req, res) => {
|
||||
resemble_tts_uri,
|
||||
resemble_tts_use_tls,
|
||||
api_uri,
|
||||
houndify_server_uri
|
||||
houndify_server_uri,
|
||||
...(vendor === 'google' && {service_key: JSON.stringify(o)})
|
||||
};
|
||||
logger.info({o, newCred}, 'updating speech credential with this new credential');
|
||||
obj.credential = encryptCredential(newCred);
|
||||
|
||||
Reference in New Issue
Block a user