mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Support continue conversation in Assist dialog (#24511)
This commit is contained in:
parent
79374f6052
commit
03b08fefb7
@ -295,6 +295,7 @@ export class HaAssistChat extends LitElement {
|
||||
this._addMessage(userMessage);
|
||||
this.requestUpdate("_audioRecorder");
|
||||
|
||||
let continueConversation = false;
|
||||
let hassMessage = {
|
||||
who: "hass",
|
||||
text: "…",
|
||||
@ -369,6 +370,8 @@ export class HaAssistChat extends LitElement {
|
||||
|
||||
if (event.type === "intent-end") {
|
||||
this._conversationId = event.data.intent_output.conversation_id;
|
||||
continueConversation =
|
||||
event.data.intent_output.continue_conversation;
|
||||
const plain = event.data.intent_output.response.speech?.plain;
|
||||
if (plain) {
|
||||
hassMessage.text = plain.speech;
|
||||
@ -380,7 +383,12 @@ export class HaAssistChat extends LitElement {
|
||||
const url = event.data.tts_output.url;
|
||||
this._audio = new Audio(url);
|
||||
this._audio.play();
|
||||
this._audio.addEventListener("ended", this._unloadAudio);
|
||||
this._audio.addEventListener("ended", () => {
|
||||
this._unloadAudio();
|
||||
if (continueConversation) {
|
||||
this._startListening();
|
||||
}
|
||||
});
|
||||
this._audio.addEventListener("pause", this._unloadAudio);
|
||||
this._audio.addEventListener("canplaythrough", this._playAudio);
|
||||
this._audio.addEventListener("error", this._audioError);
|
||||
|
@ -51,6 +51,7 @@ export interface ConversationResult {
|
||||
| IntentResultActionDone
|
||||
| IntentResultQueryAnswer
|
||||
| IntentResultError;
|
||||
continue_conversation: boolean;
|
||||
}
|
||||
|
||||
export interface Agent {
|
||||
|
Loading…
x
Reference in New Issue
Block a user