mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 01:36:49 +00:00
Voice dialog: Handle when not hearing anything.
This commit is contained in:
parent
23f0744fe2
commit
7c313a1083
@ -171,14 +171,18 @@ Polymer({
|
|||||||
this.recognition.abort();
|
this.recognition.abort();
|
||||||
var text = this.results.final || this.results.interim;
|
var text = this.results.final || this.results.interim;
|
||||||
this.results = null;
|
this.results = null;
|
||||||
|
if (text === '') {
|
||||||
|
text = '<Home Assistant did not hear anything>';
|
||||||
|
}
|
||||||
this.push('_conversation', { who: 'user', text: text, error: true });
|
this.push('_conversation', { who: 'user', text: text, error: true });
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
this.recognition.onend = function () {
|
this.recognition.onend = function () {
|
||||||
|
// Already handled by onerror
|
||||||
|
if (this.results == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var text = this.results.final || this.results.interim;
|
var text = this.results.final || this.results.interim;
|
||||||
this.results = null;
|
this.results = null;
|
||||||
|
|
||||||
if (text === '') return;
|
|
||||||
|
|
||||||
this.push('_conversation', { who: 'user', text: text });
|
this.push('_conversation', { who: 'user', text: text });
|
||||||
|
|
||||||
this.hass.callApi('post', 'conversation/process', { text: text })
|
this.hass.callApi('post', 'conversation/process', { text: text })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user