mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
support disableTtsCache from config verb (#1410)
This commit is contained in:
@@ -658,6 +658,15 @@ class CallSession extends Emitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// disableTtsCache
|
||||||
|
get disableTtsCache() {
|
||||||
|
return this._disableTtsCache || false;
|
||||||
|
}
|
||||||
|
|
||||||
|
set disableTtsCache(d) {
|
||||||
|
this._disableTtsCache = d;
|
||||||
|
}
|
||||||
|
|
||||||
getTsStreamingVendor() {
|
getTsStreamingVendor() {
|
||||||
let v;
|
let v;
|
||||||
if (this.currentTask?.isStreamingTts) {
|
if (this.currentTask?.isStreamingTts) {
|
||||||
|
|||||||
@@ -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) {
|
||||||
@@ -88,6 +89,7 @@ class TaskConfig extends Task {
|
|||||||
get hasReferHook() { return Object.keys(this.data).includes('referHook'); }
|
get hasReferHook() { return Object.keys(this.data).includes('referHook'); }
|
||||||
get hasNotifySttLatency() { return Object.keys(this.data).includes('notifySttLatency'); }
|
get hasNotifySttLatency() { return Object.keys(this.data).includes('notifySttLatency'); }
|
||||||
get hasTtsStream() { return Object.keys(this.ttsStream).length; }
|
get hasTtsStream() { return Object.keys(this.ttsStream).length; }
|
||||||
|
get hasDisableTtsCache() { return Object.keys(this.data).includes('disableTtsCache'); }
|
||||||
|
|
||||||
get summary() {
|
get summary() {
|
||||||
const phrase = [];
|
const phrase = [];
|
||||||
@@ -125,6 +127,7 @@ class TaskConfig extends Task {
|
|||||||
phrase.push(`${this.ttsStream.enable ? 'enable' : 'disable'} ttsStream`);
|
phrase.push(`${this.ttsStream.enable ? 'enable' : 'disable'} ttsStream`);
|
||||||
}
|
}
|
||||||
if ('autoStreamTts' in this.data) phrase.push(`enable Say.stream value ${this.data.autoStreamTts ? 'on' : 'off'}`);
|
if ('autoStreamTts' in this.data) phrase.push(`enable Say.stream value ${this.data.autoStreamTts ? 'on' : 'off'}`);
|
||||||
|
if (this.hasDisableTtsCache) phrase.push(`disableTtsCache ${this.data.disableTtsCache ? 'on' : 'off'}`);
|
||||||
return `${this.name}{${phrase.join(',')}}`;
|
return `${this.name}{${phrase.join(',')}}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,6 +360,11 @@ class TaskConfig extends Task {
|
|||||||
this.logger.info('Config: disabling ttsStream');
|
this.logger.info('Config: disabling ttsStream');
|
||||||
cs.disableTtsStream();
|
cs.disableTtsStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.hasDisableTtsCache) {
|
||||||
|
this.logger.info(`set disableTtsCache = ${this.disableTtsCache}`);
|
||||||
|
cs.disableTtsCache = this.data.disableTtsCache;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async kill(cs) {
|
async kill(cs) {
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ class TtsTask extends Task {
|
|||||||
|
|
||||||
async exec(cs) {
|
async exec(cs) {
|
||||||
super.exec(cs);
|
super.exec(cs);
|
||||||
|
// update disableTtsCache from call session if not set in task
|
||||||
|
if (this.data.disableTtsCache == null) {
|
||||||
|
this.disableTtsCache = cs.disableTtsCache;
|
||||||
|
}
|
||||||
if (cs.synthesizer) {
|
if (cs.synthesizer) {
|
||||||
this.options = {...cs.synthesizer.options, ...this.options};
|
this.options = {...cs.synthesizer.options, ...this.options};
|
||||||
this.data.synthesizer = this.data.synthesizer || {};
|
this.data.synthesizer = this.data.synthesizer || {};
|
||||||
|
|||||||
Reference in New Issue
Block a user