Skip to content

Commit d961aaa

Browse files
Fix default language in assists pipeline detail (#28125)
Co-authored-by: Bram Kragten <[email protected]>
1 parent bd6bc25 commit d961aaa

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-stt.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { css, html, LitElement } from "lit";
22
import { customElement, property, state } from "lit/decorators";
33
import memoizeOne from "memoize-one";
4+
import { fireEvent } from "../../../../common/dom/fire_event";
45
import type { LocalizeKeys } from "../../../../common/translations/localize";
56
import "../../../../components/ha-form/ha-form";
67
import type { AssistPipeline } from "../../../../data/assist_pipeline";
@@ -78,6 +79,18 @@ export class AssistPipelineDetailSTT extends LitElement {
7879

7980
private _supportedLanguagesChanged(ev) {
8081
this._supportedLanguages = ev.detail.value;
82+
83+
if (
84+
!this.data?.stt_language ||
85+
!this._supportedLanguages?.includes(this.data.stt_language)
86+
) {
87+
// wait for update of conversation_engine
88+
setTimeout(() => {
89+
const value = { ...this.data };
90+
value.stt_language = this._supportedLanguages?.[0] ?? null;
91+
fireEvent(this, "value-changed", { value });
92+
}, 0);
93+
}
8194
}
8295

8396
static styles = css`

src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-tts.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { css, html, LitElement, nothing } from "lit";
22
import { customElement, property, state } from "lit/decorators";
33
import memoizeOne from "memoize-one";
4+
import { fireEvent } from "../../../../common/dom/fire_event";
45
import type { LocalizeKeys } from "../../../../common/translations/localize";
56
import "../../../../components/ha-button";
67
import "../../../../components/ha-form/ha-form";
@@ -122,6 +123,18 @@ export class AssistPipelineDetailTTS extends LitElement {
122123

123124
private _supportedLanguagesChanged(ev) {
124125
this._supportedLanguages = ev.detail.value;
126+
127+
if (
128+
!this.data?.tts_language ||
129+
!this._supportedLanguages?.includes(this.data?.tts_language)
130+
) {
131+
// wait for update of conversation_engine
132+
setTimeout(() => {
133+
const value = { ...this.data };
134+
value.tts_language = this._supportedLanguages?.[0] ?? null;
135+
fireEvent(this, "value-changed", { value });
136+
}, 0);
137+
}
125138
}
126139

127140
static styles = css`

0 commit comments

Comments
 (0)