mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
Add ability to disable TTS cache for entire call session.
This commit is contained in:
@@ -18,7 +18,8 @@ class TaskConfig extends Task {
|
|||||||
'boostAudioSignal',
|
'boostAudioSignal',
|
||||||
'vad',
|
'vad',
|
||||||
'ttsStream',
|
'ttsStream',
|
||||||
'autoStreamTts'
|
'autoStreamTts',
|
||||||
|
'disableTtsCache'
|
||||||
].forEach((k) => this[k] = this.data[k] || {});
|
].forEach((k) => this[k] = this.data[k] || {});
|
||||||
|
|
||||||
if ('notifyEvents' in this.data) {
|
if ('notifyEvents' in this.data) {
|
||||||
@@ -96,6 +97,7 @@ class TaskConfig extends Task {
|
|||||||
if (this.data.reset.length) phrase.push(`reset ${this.data.reset.join(',')}`);
|
if (this.data.reset.length) phrase.push(`reset ${this.data.reset.join(',')}`);
|
||||||
|
|
||||||
if (this.bargeIn.enable) phrase.push('enable barge-in');
|
if (this.bargeIn.enable) phrase.push('enable barge-in');
|
||||||
|
if (this.disableTtsCache) phrase.push(`disableTtsCache ${this.disableTtsCache ? 'true' : 'false'}`);
|
||||||
if (this.hasSynthesizer) {
|
if (this.hasSynthesizer) {
|
||||||
const {vendor:v, language:l, voice, label} = this.synthesizer;
|
const {vendor:v, language:l, voice, label} = this.synthesizer;
|
||||||
const s = `{${v},${l},${voice},${label || 'None'}}`;
|
const s = `{${v},${l},${voice},${label || 'None'}}`;
|
||||||
@@ -357,6 +359,11 @@ class TaskConfig extends Task {
|
|||||||
this.logger.info('Config: disabling ttsStream');
|
this.logger.info('Config: disabling ttsStream');
|
||||||
cs.disableTtsStream();
|
cs.disableTtsStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.disableTtsCache) {
|
||||||
|
this.logger.info('Config: disable TtsCache');
|
||||||
|
cs.disableTtsCache = this.disableTtsCache;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async kill(cs) {
|
async kill(cs) {
|
||||||
|
|||||||
@@ -342,7 +342,9 @@ class TaskSay extends TtsTask {
|
|||||||
evt.variable_tts_cache_filename &&
|
evt.variable_tts_cache_filename &&
|
||||||
!this.killed &&
|
!this.killed &&
|
||||||
// if tts cache is not disabled, add the file to cache
|
// if tts cache is not disabled, add the file to cache
|
||||||
!this.disableTtsCache
|
!this.disableTtsCache &&
|
||||||
|
// has tts cache been disabled for the entire session
|
||||||
|
!cs.disableTtsCache
|
||||||
) {
|
) {
|
||||||
const text = parseTextFromSayString(this.text[segment]);
|
const text = parseTextFromSayString(this.text[segment]);
|
||||||
this.logger.debug({text, cacheFile: evt.variable_tts_cache_filename}, 'Say:exec cache tts');
|
this.logger.debug({text, cacheFile: evt.variable_tts_cache_filename}, 'Say:exec cache tts');
|
||||||
|
|||||||
Reference in New Issue
Block a user