update transcribe to support google v1p1beta1 and aws

This commit is contained in:
Dave Horton
2021-01-31 15:49:19 -05:00
parent 59d685319e
commit 756db59671
7 changed files with 243 additions and 97 deletions

View File

@@ -47,6 +47,7 @@ class Dialogflow extends Task {
this.language = this.data.tts.language || 'default';
this.voice = this.data.tts.voice || 'default';
}
this.bargein = this.data.bargein;
}
get name() { return TaskName.Dialogflow; }
@@ -266,7 +267,7 @@ class Dialogflow extends Task {
* @param {*} ep - media server endpoint
* @param {*} evt - event data
*/
_onTranscription(ep, cs, evt) {
async _onTranscription(ep, cs, evt) {
const transcription = new Transcription(this.logger, evt);
if (this.events.includes('transcription') && transcription.isFinal) {
@@ -281,6 +282,13 @@ class Dialogflow extends Task {
transcription.confidence > 0.8) {
ep.play(this.data.thinkingSound).catch((err) => this.logger.info(err, 'Error playing typing sound'));
}
// interrupt playback on speaking if bargein = true
if (this.bargein && this.playInProgress) {
this.logger.debug('terminating playback due to speech bargein');
this.playInProgress = false;
await ep.api('uuid_break', ep.uuid);
}
}
/**