mirror of
https://github.com/jambonz/speech-utils.git
synced 2026-07-24 13:11:56 +00:00
tts key should include model
This commit is contained in:
@@ -25,7 +25,7 @@ function getExtensionAndSampleRate(path) {
|
||||
}
|
||||
|
||||
async function addFileToCache(client, logger, path,
|
||||
{account_sid, vendor, language, voice, deploymentId, engine, text}) {
|
||||
{account_sid, vendor, language, voice, deploymentId, engine, model, text}) {
|
||||
let key;
|
||||
logger = logger || noopLogger;
|
||||
|
||||
@@ -36,6 +36,7 @@ async function addFileToCache(client, logger, path,
|
||||
language: language || '',
|
||||
voice: voice || deploymentId,
|
||||
engine,
|
||||
model,
|
||||
text,
|
||||
});
|
||||
const [extension, sampleRate] = getExtensionAndSampleRate(path);
|
||||
|
||||
@@ -12,7 +12,7 @@ const debug = require('debug')('jambonz:realtimedb-helpers');
|
||||
* @returns {object} result - {error, purgedCount}
|
||||
*/
|
||||
async function purgeTtsCache(client, logger, {all, account_sid, vendor,
|
||||
language, voice, deploymentId, engine, text} = {all: true}) {
|
||||
language, voice, deploymentId, engine, model, text} = {all: true}) {
|
||||
logger = logger || noopLogger;
|
||||
|
||||
let purgedCount = 0, error;
|
||||
@@ -33,6 +33,7 @@ async function purgeTtsCache(client, logger, {all, account_sid, vendor,
|
||||
language: language || '',
|
||||
voice: voice || deploymentId,
|
||||
engine,
|
||||
model,
|
||||
text,
|
||||
});
|
||||
purgedCount = await client.del(key);
|
||||
|
||||
@@ -169,6 +169,7 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
|
||||
language: language || '',
|
||||
voice: voice || deploymentId,
|
||||
engine,
|
||||
model,
|
||||
text
|
||||
});
|
||||
|
||||
|
||||
+9
-2
@@ -17,9 +17,16 @@ const debug = require('debug')('jambonz:realtimedb-helpers');
|
||||
//const nuanceClientMap = new Map();
|
||||
|
||||
function makeSynthKey({
|
||||
account_sid = '', vendor, language, voice, engine = '', text}) {
|
||||
account_sid = '',
|
||||
vendor,
|
||||
language,
|
||||
voice,
|
||||
engine = '',
|
||||
model = '',
|
||||
text
|
||||
}) {
|
||||
const hash = crypto.createHash('sha1');
|
||||
hash.update(`${language}:${vendor}:${voice}:${engine}:${text}`);
|
||||
hash.update(`${language}:${vendor}:${voice}:${engine}:${model}:${text}`);
|
||||
const hexHashKey = hash.digest('hex');
|
||||
const accountKey = account_sid ? `:${account_sid}` : '';
|
||||
const key = `tts${accountKey}:${hexHashKey}`;
|
||||
|
||||
Reference in New Issue
Block a user