This commit is contained in:
Quan HL
2024-08-12 18:35:48 +07:00
parent b6a3fa5081
commit 305dabd84b
2 changed files with 12 additions and 12 deletions
+5 -5
View File
@@ -86,7 +86,7 @@ const trimTrailingSilence = (buffer) => {
*/
async function synthAudio(client, createHash, retrieveHash, logger, stats, { account_sid,
vendor, language, voice, gender, text, engine, salt, model, credentials, deploymentId,
disableTtsCache, renderForCaching, disableTtsStreaming, options, preCache = false
disableTtsCache, renderForCaching = false, disableTtsStreaming, options
}) {
let audioBuffer;
let servedFromCache = false;
@@ -165,7 +165,7 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
voice: voice || deploymentId,
engine,
text,
preCache: true
renderForCaching: true
});
const key = makeSynthKey({
@@ -175,10 +175,10 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
voice: voice || deploymentId,
engine,
text,
preCache
renderForCaching
});
let filePath;
filePath = makeFilePath({vendor, key, salt, preCache});
filePath = makeFilePath({vendor, key, salt, renderForCaching});
debug(`synth key is ${key}`);
let cached;
if (!disableTtsCache) {
@@ -187,7 +187,7 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
cached = await client.get(preCachekey);
if (cached) {
// Precache audio is available update filpath with precache file extension.
filePath = makeFilePath({vendor, key, salt, preCache: true});
filePath = makeFilePath({vendor, key, salt, renderForCaching: true});
} else {
cached = await client.get(key);
}