mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 02:38:53 +00:00
Fix default language in assists pipeline detail (#28125)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { css, html, LitElement } from "lit";
|
import { css, html, LitElement } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
import type { LocalizeKeys } from "../../../../common/translations/localize";
|
import type { LocalizeKeys } from "../../../../common/translations/localize";
|
||||||
import "../../../../components/ha-form/ha-form";
|
import "../../../../components/ha-form/ha-form";
|
||||||
import type { AssistPipeline } from "../../../../data/assist_pipeline";
|
import type { AssistPipeline } from "../../../../data/assist_pipeline";
|
||||||
@@ -78,6 +79,18 @@ export class AssistPipelineDetailSTT extends LitElement {
|
|||||||
|
|
||||||
private _supportedLanguagesChanged(ev) {
|
private _supportedLanguagesChanged(ev) {
|
||||||
this._supportedLanguages = ev.detail.value;
|
this._supportedLanguages = ev.detail.value;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!this.data?.stt_language ||
|
||||||
|
!this._supportedLanguages?.includes(this.data.stt_language)
|
||||||
|
) {
|
||||||
|
// wait for update of conversation_engine
|
||||||
|
setTimeout(() => {
|
||||||
|
const value = { ...this.data };
|
||||||
|
value.stt_language = this._supportedLanguages?.[0] ?? null;
|
||||||
|
fireEvent(this, "value-changed", { value });
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static styles = css`
|
static styles = css`
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { css, html, LitElement, nothing } from "lit";
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
import type { LocalizeKeys } from "../../../../common/translations/localize";
|
import type { LocalizeKeys } from "../../../../common/translations/localize";
|
||||||
import "../../../../components/ha-button";
|
import "../../../../components/ha-button";
|
||||||
import "../../../../components/ha-form/ha-form";
|
import "../../../../components/ha-form/ha-form";
|
||||||
@@ -122,6 +123,18 @@ export class AssistPipelineDetailTTS extends LitElement {
|
|||||||
|
|
||||||
private _supportedLanguagesChanged(ev) {
|
private _supportedLanguagesChanged(ev) {
|
||||||
this._supportedLanguages = ev.detail.value;
|
this._supportedLanguages = ev.detail.value;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!this.data?.tts_language ||
|
||||||
|
!this._supportedLanguages?.includes(this.data?.tts_language)
|
||||||
|
) {
|
||||||
|
// wait for update of conversation_engine
|
||||||
|
setTimeout(() => {
|
||||||
|
const value = { ...this.data };
|
||||||
|
value.tts_language = this._supportedLanguages?.[0] ?? null;
|
||||||
|
fireEvent(this, "value-changed", { value });
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static styles = css`
|
static styles = css`
|
||||||
|
|||||||
Reference in New Issue
Block a user