mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Voice picker: Guard for select undefined, update debug pipelines (#16279)
* Voice picker: Guard for select undefined * Update types, make debug a little nicer * Add type to stt-start event * Add language to STT data in render pipeline --------- Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
439f34f724
commit
9b32c9c6b4
@ -36,7 +36,7 @@ export class HaTTSVoicePicker extends LitElement {
|
|||||||
|
|
||||||
@state() _voices?: TTSVoice[] | null;
|
@state() _voices?: TTSVoice[] | null;
|
||||||
|
|
||||||
@query("ha-select") private _select!: HaSelect;
|
@query("ha-select") private _select?: HaSelect;
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (!this._voices) {
|
if (!this._voices) {
|
||||||
@ -108,9 +108,12 @@ export class HaTTSVoicePicker extends LitElement {
|
|||||||
|
|
||||||
protected updated(changedProperties: PropertyValues<this>) {
|
protected updated(changedProperties: PropertyValues<this>) {
|
||||||
super.updated(changedProperties);
|
super.updated(changedProperties);
|
||||||
if (changedProperties.has("_voices") && this._select.value !== this.value) {
|
if (
|
||||||
this._select.layoutOptions();
|
changedProperties.has("_voices") &&
|
||||||
fireEvent(this, "value-changed", { value: this._select.value });
|
this._select?.value !== this.value
|
||||||
|
) {
|
||||||
|
this._select?.layoutOptions();
|
||||||
|
fireEvent(this, "value-changed", { value: this._select?.value });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ interface PipelineSTTStartEvent extends PipelineEventBase {
|
|||||||
type: "stt-start";
|
type: "stt-start";
|
||||||
data: {
|
data: {
|
||||||
engine: string;
|
engine: string;
|
||||||
|
language: string;
|
||||||
metadata: SpeechMetadata;
|
metadata: SpeechMetadata;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -79,6 +80,7 @@ interface PipelineIntentStartEvent extends PipelineEventBase {
|
|||||||
type: "intent-start";
|
type: "intent-start";
|
||||||
data: {
|
data: {
|
||||||
engine: string;
|
engine: string;
|
||||||
|
language: string;
|
||||||
intent_input: string;
|
intent_input: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -93,6 +95,8 @@ interface PipelineTTSStartEvent extends PipelineEventBase {
|
|||||||
type: "tts-start";
|
type: "tts-start";
|
||||||
data: {
|
data: {
|
||||||
engine: string;
|
engine: string;
|
||||||
|
language: string;
|
||||||
|
voice: string;
|
||||||
tts_input: string;
|
tts_input: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ export class AssistPipelineRunDebug extends LitElement {
|
|||||||
padding-top: 16px;
|
padding-top: 16px;
|
||||||
}
|
}
|
||||||
assist-render-pipeline-run + assist-render-pipeline-run {
|
assist-render-pipeline-run + assist-render-pipeline-run {
|
||||||
border-top: 3px solid black;
|
border-top: 1px solid var(--divider-color);
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
|
@ -17,15 +17,19 @@ const RUN_DATA = {
|
|||||||
|
|
||||||
const STT_DATA = {
|
const STT_DATA = {
|
||||||
engine: "Engine",
|
engine: "Engine",
|
||||||
|
language: "Language",
|
||||||
};
|
};
|
||||||
|
|
||||||
const INTENT_DATA = {
|
const INTENT_DATA = {
|
||||||
engine: "Engine",
|
engine: "Engine",
|
||||||
|
language: "Language",
|
||||||
intent_input: "Input",
|
intent_input: "Input",
|
||||||
};
|
};
|
||||||
|
|
||||||
const TTS_DATA = {
|
const TTS_DATA = {
|
||||||
engine: "Engine",
|
engine: "Engine",
|
||||||
|
language: "Language",
|
||||||
|
voice: "Voice",
|
||||||
tts_input: "Input",
|
tts_input: "Input",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -120,11 +124,10 @@ const dataMinusKeysRender = (
|
|||||||
result[key] = data[key];
|
result[key] = data[key];
|
||||||
}
|
}
|
||||||
return render
|
return render
|
||||||
? html`<ha-yaml-editor
|
? html`<ha-expansion-panel>
|
||||||
readOnly
|
<span slot="header">Raw</span>
|
||||||
autoUpdate
|
<ha-yaml-editor readOnly autoUpdate .value=${result}></ha-yaml-editor>
|
||||||
.value=${result}
|
</ha-expansion-panel>`
|
||||||
></ha-yaml-editor>`
|
|
||||||
: "";
|
: "";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -204,6 +207,16 @@ export class AssistPipelineDebug extends LitElement {
|
|||||||
? html`
|
? html`
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
${renderData(this.pipelineRun.stt, STT_DATA)}
|
${renderData(this.pipelineRun.stt, STT_DATA)}
|
||||||
|
<div class="row">
|
||||||
|
<div>Language</div>
|
||||||
|
<div>${this.pipelineRun.stt.metadata.language}</div>
|
||||||
|
</div>
|
||||||
|
${this.pipelineRun.stt.stt_output
|
||||||
|
? html`<div class="row">
|
||||||
|
<div>Output</div>
|
||||||
|
<div>${this.pipelineRun.stt.stt_output.text}</div>
|
||||||
|
</div>`
|
||||||
|
: ""}
|
||||||
${dataMinusKeysRender(this.pipelineRun.stt, STT_DATA)}
|
${dataMinusKeysRender(this.pipelineRun.stt, STT_DATA)}
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
@ -225,6 +238,25 @@ export class AssistPipelineDebug extends LitElement {
|
|||||||
? html`
|
? html`
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
${renderData(this.pipelineRun.intent, INTENT_DATA)}
|
${renderData(this.pipelineRun.intent, INTENT_DATA)}
|
||||||
|
${this.pipelineRun.intent.intent_output
|
||||||
|
? html`<div class="row">
|
||||||
|
<div>Response type</div>
|
||||||
|
<div>
|
||||||
|
${this.pipelineRun.intent.intent_output
|
||||||
|
.response.response_type}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
${this.pipelineRun.intent.intent_output.response
|
||||||
|
.response_type === "error"
|
||||||
|
? html`<div class="row">
|
||||||
|
<div>Error code</div>
|
||||||
|
<div>
|
||||||
|
${this.pipelineRun.intent.intent_output
|
||||||
|
.response.data.code}
|
||||||
|
</div>
|
||||||
|
</div>`
|
||||||
|
: ""}`
|
||||||
|
: ""}
|
||||||
${dataMinusKeysRender(
|
${dataMinusKeysRender(
|
||||||
this.pipelineRun.intent,
|
this.pipelineRun.intent,
|
||||||
INTENT_DATA
|
INTENT_DATA
|
||||||
@ -249,6 +281,7 @@ export class AssistPipelineDebug extends LitElement {
|
|||||||
? html`
|
? html`
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
${renderData(this.pipelineRun.tts, TTS_DATA)}
|
${renderData(this.pipelineRun.tts, TTS_DATA)}
|
||||||
|
${dataMinusKeysRender(this.pipelineRun.tts, TTS_DATA)}
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
@ -301,6 +334,11 @@ export class AssistPipelineDebug extends LitElement {
|
|||||||
ha-expansion-panel {
|
ha-expansion-panel {
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
}
|
}
|
||||||
|
.card-content ha-expansion-panel {
|
||||||
|
padding-left: 0px;
|
||||||
|
--expansion-panel-summary-padding: 0px;
|
||||||
|
--expansion-panel-content-padding: 0px;
|
||||||
|
}
|
||||||
.heading {
|
.heading {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user