mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Inform user that subscription is needed for cloud services (#16318)
This commit is contained in:
parent
a5759e36b2
commit
addb66f21d
@ -22,6 +22,7 @@ import type { HomeAssistant } from "../../../types";
|
|||||||
import { showVoiceAssistantPipelineDetailDialog } from "./show-dialog-voice-assistant-pipeline-detail";
|
import { showVoiceAssistantPipelineDetailDialog } from "./show-dialog-voice-assistant-pipeline-detail";
|
||||||
import { brandsUrl } from "../../../util/brands-url";
|
import { brandsUrl } from "../../../util/brands-url";
|
||||||
import { formatLanguageCode } from "../../../common/language/format_language";
|
import { formatLanguageCode } from "../../../common/language/format_language";
|
||||||
|
import { CloudStatusLoggedIn } from "../../../data/cloud";
|
||||||
|
|
||||||
export class AssistPref extends LitElement {
|
export class AssistPref extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
@ -30,6 +31,8 @@ export class AssistPref extends LitElement {
|
|||||||
|
|
||||||
@state() private _preferred: string | null = null;
|
@state() private _preferred: string | null = null;
|
||||||
|
|
||||||
|
@property() public cloudStatus?: CloudStatusLoggedIn;
|
||||||
|
|
||||||
protected firstUpdated(changedProps: PropertyValues) {
|
protected firstUpdated(changedProps: PropertyValues) {
|
||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
|
|
||||||
@ -125,6 +128,7 @@ export class AssistPref extends LitElement {
|
|||||||
|
|
||||||
private async _openDialog(pipeline?: AssistPipeline): Promise<void> {
|
private async _openDialog(pipeline?: AssistPipeline): Promise<void> {
|
||||||
showVoiceAssistantPipelineDetailDialog(this, {
|
showVoiceAssistantPipelineDetailDialog(this, {
|
||||||
|
cloudActiveSubscription: this.cloudStatus?.active_subscription,
|
||||||
pipeline,
|
pipeline,
|
||||||
preferred: pipeline?.id === this._preferred,
|
preferred: pipeline?.id === this._preferred,
|
||||||
createPipeline: async (values) => {
|
createPipeline: async (values) => {
|
||||||
|
@ -28,6 +28,8 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
|
|
||||||
@state() private _preferred?: boolean;
|
@state() private _preferred?: boolean;
|
||||||
|
|
||||||
|
@state() private _cloudActive?: boolean;
|
||||||
|
|
||||||
@state() private _error?: Record<string, string>;
|
@state() private _error?: Record<string, string>;
|
||||||
|
|
||||||
@state() private _submitting = false;
|
@state() private _submitting = false;
|
||||||
@ -40,13 +42,14 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
if (this._params.pipeline) {
|
if (this._params.pipeline) {
|
||||||
this._data = this._params.pipeline;
|
this._data = this._params.pipeline;
|
||||||
this._preferred = this._params.preferred;
|
this._preferred = this._params.preferred;
|
||||||
|
this._cloudActive = this._params.cloudActiveSubscription;
|
||||||
} else {
|
} else {
|
||||||
this._data = {
|
this._data = {
|
||||||
language: (
|
language: (
|
||||||
this.hass.config.language || this.hass.locale.language
|
this.hass.config.language || this.hass.locale.language
|
||||||
).substring(0, 2),
|
).substring(0, 2),
|
||||||
stt_engine: "cloud",
|
stt_engine: this._cloudActive ? "cloud" : undefined,
|
||||||
tts_engine: "cloud",
|
tts_engine: this._cloudActive ? "cloud" : undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +91,7 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
>
|
>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
${this._error
|
${this._error
|
||||||
? html`<ha-alert alert-type="error"> ${this._error} </ha-alert>`
|
? html`<ha-alert alert-type="error">${this._error}</ha-alert>`
|
||||||
: nothing}
|
: nothing}
|
||||||
<assist-pipeline-detail-config
|
<assist-pipeline-detail-config
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
@ -104,6 +107,28 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
keys="conversation_engine,conversation_language"
|
keys="conversation_engine,conversation_language"
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></assist-pipeline-detail-conversation>
|
></assist-pipeline-detail-conversation>
|
||||||
|
${!this._cloudActive &&
|
||||||
|
(this._data.tts_engine === "cloud" ||
|
||||||
|
this._data.stt_engine === "cloud")
|
||||||
|
? html`
|
||||||
|
<ha-alert alert-type="warning"
|
||||||
|
>${this.hass.localize(
|
||||||
|
"ui.panel.config.voice_assistants.assistants.pipeline.detail.no_cloud_message"
|
||||||
|
)}
|
||||||
|
<a
|
||||||
|
href="/config/cloud"
|
||||||
|
slot="action"
|
||||||
|
@click=${this.closeDialog}
|
||||||
|
>
|
||||||
|
<ha-button>
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.voice_assistants.assistants.pipeline.detail.no_cloud_action"
|
||||||
|
)}
|
||||||
|
</ha-button>
|
||||||
|
</a>
|
||||||
|
</ha-alert>
|
||||||
|
`
|
||||||
|
: nothing}
|
||||||
<assist-pipeline-detail-stt
|
<assist-pipeline-detail-stt
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this._data}
|
.data=${this._data}
|
||||||
@ -236,7 +261,7 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
ha-alert {
|
ha-alert {
|
||||||
margin-bottom: 8px;
|
margin-bottom: 16px;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
a {
|
a {
|
||||||
|
@ -40,7 +40,10 @@ export class HaConfigVoiceAssistantsAssistants extends LitElement {
|
|||||||
>
|
>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
${isComponentLoaded(this.hass, "assist_pipeline")
|
${isComponentLoaded(this.hass, "assist_pipeline")
|
||||||
? html` <assist-pref .hass=${this.hass}></assist-pref> `
|
? html`<assist-pref
|
||||||
|
.hass=${this.hass}
|
||||||
|
.cloudStatus=${this.cloudStatus}
|
||||||
|
></assist-pref>`
|
||||||
: nothing}
|
: nothing}
|
||||||
${this.cloudStatus?.logged_in
|
${this.cloudStatus?.logged_in
|
||||||
? html`
|
? html`
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
} from "../../../data/assist_pipeline";
|
} from "../../../data/assist_pipeline";
|
||||||
|
|
||||||
export interface VoiceAssistantPipelineDetailsDialogParams {
|
export interface VoiceAssistantPipelineDetailsDialogParams {
|
||||||
|
cloudActiveSubscription?: boolean;
|
||||||
pipeline?: AssistPipeline;
|
pipeline?: AssistPipeline;
|
||||||
preferred?: boolean;
|
preferred?: boolean;
|
||||||
createPipeline: (values: AssistPipelineMutableParams) => Promise<unknown>;
|
createPipeline: (values: AssistPipelineMutableParams) => Promise<unknown>;
|
||||||
|
@ -2068,7 +2068,9 @@
|
|||||||
"title": "Text-to-speech",
|
"title": "Text-to-speech",
|
||||||
"description": "When you are controlling your assistant with voice, the text-to-speech engine turns the conversation text responses into audio."
|
"description": "When you are controlling your assistant with voice, the text-to-speech engine turns the conversation text responses into audio."
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"no_cloud_message": "You should have an active cloud subscription to use cloud speech services.",
|
||||||
|
"no_cloud_action": "Subscribe"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cloud": {
|
"cloud": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user