google STT: default to command_and_search for Gather, as latest_short seems to have issues, various other fixes (#285)

This commit is contained in:
Dave Horton
2023-03-26 12:20:03 -04:00
committed by GitHub
parent e1bd075ebc
commit 63ab554908
2 changed files with 33 additions and 40 deletions

View File

@@ -104,6 +104,10 @@ class TaskGather extends Task {
get needsStt() { return this.input.includes('speech'); }
get wantsMultipleUtterances() {
return this.data.recognizer?.singleUtterance === false;
}
get earlyMedia() {
return (this.sayTask && this.sayTask.earlyMedia) ||
(this.playTask && this.playTask.earlyMedia);
@@ -661,14 +665,18 @@ class TaskGather extends Task {
this._killAudio(cs);
}
// DCH: commenting out because my experience is that the google STT engine
// will keep listening after it detects end of utterance, and will return a final transcript
// My earlier understanding that we needed to stop and restart the recognizer appears incorrect.
/*
if (!this.resolved && !this.killed && !this._bufferedTranscripts.length) {
/**
* By default, Gather asks google for a single utterance. On getting an end of utterance event,
* the mod_google_transcribe plugin will send a WritesDone to the grpc stream, which will usually
* cause google to return a final transcript. So even though we have not received a final
* transcript at this point (because otherwise resolved() would be true), we do not need to
* restart the recognizer - we should get the final transcript shortly.
* The exception is if the Gather was specifically configured to listen
* to multiple utterances, in which case we need to restart the recognizer.
*/
if (!this.resolved && !this.killed && !this._bufferedTranscripts.length && this.wantsMultipleUtterances) {
this._startTranscribing(ep);
}
*/
}
_onStartOfSpeech(cs, ep) {