mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +00:00
Fallback to preferred pipeline if the pipeline doesn't exist (#25404)
This commit is contained in:
parent
30d46f2f8a
commit
d392bb4c83
@ -57,16 +57,22 @@ export class HaVoiceCommandDialog extends LitElement {
|
||||
public async showDialog(
|
||||
params: Required<VoiceCommandDialogParams>
|
||||
): Promise<void> {
|
||||
await this._loadPipelines();
|
||||
const pipelinesIds = this._pipelines?.map((pipeline) => pipeline.id) || [];
|
||||
if (
|
||||
params.pipeline_id === "preferred" ||
|
||||
(params.pipeline_id === "last_used" && !this._pipelineId)
|
||||
) {
|
||||
await this._loadPipelines();
|
||||
this._pipelineId = this._preferredPipeline;
|
||||
} else if (!["last_used", "preferred"].includes(params.pipeline_id)) {
|
||||
this._pipelineId = params.pipeline_id;
|
||||
}
|
||||
|
||||
// If the pipeline id is not in the list of pipelines, set it to preferred
|
||||
if (this._pipelineId && !pipelinesIds.includes(this._pipelineId)) {
|
||||
this._pipelineId = this._preferredPipeline;
|
||||
}
|
||||
|
||||
this._startListening = params.start_listening;
|
||||
this._opened = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user