mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 04:46:34 +00:00
Add local processing option to pipeline for LLM conversation agents (#22561)
* Add local processing field to pipeline * update * Update wording * handle current pipelines --------- Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
d2665f1349
commit
757ed2e80c
@ -9,6 +9,7 @@ export interface AssistPipeline {
|
|||||||
language: string;
|
language: string;
|
||||||
conversation_engine: string;
|
conversation_engine: string;
|
||||||
conversation_language: string | null;
|
conversation_language: string | null;
|
||||||
|
prefer_local_intents?: boolean;
|
||||||
stt_engine: string | null;
|
stt_engine: string | null;
|
||||||
stt_language: string | null;
|
stt_language: string | null;
|
||||||
tts_engine: string | null;
|
tts_engine: string | null;
|
||||||
@ -28,6 +29,7 @@ export interface AssistPipelineMutableParams {
|
|||||||
language: string;
|
language: string;
|
||||||
conversation_engine: string;
|
conversation_engine: string;
|
||||||
conversation_language: string | null;
|
conversation_language: string | null;
|
||||||
|
prefer_local_intents?: boolean;
|
||||||
stt_engine: string | null;
|
stt_engine: string | null;
|
||||||
stt_language: string | null;
|
stt_language: string | null;
|
||||||
tts_engine: string | null;
|
tts_engine: string | null;
|
||||||
|
@ -17,8 +17,12 @@ export class AssistPipelineDetailConversation extends LitElement {
|
|||||||
@state() private _supportedLanguages?: "*" | string[];
|
@state() private _supportedLanguages?: "*" | string[];
|
||||||
|
|
||||||
private _schema = memoizeOne(
|
private _schema = memoizeOne(
|
||||||
(language?: string, supportedLanguages?: "*" | string[]) =>
|
(
|
||||||
[
|
engine?: string,
|
||||||
|
language?: string,
|
||||||
|
supportedLanguages?: "*" | string[]
|
||||||
|
) => {
|
||||||
|
const fields: any = [
|
||||||
{
|
{
|
||||||
name: "",
|
name: "",
|
||||||
type: "grid",
|
type: "grid",
|
||||||
@ -32,18 +36,32 @@ export class AssistPipelineDetailConversation extends LitElement {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
supportedLanguages !== "*" && supportedLanguages?.length
|
],
|
||||||
? {
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
if (supportedLanguages !== "*" && supportedLanguages?.length) {
|
||||||
|
fields[0].schema.push({
|
||||||
name: "conversation_language",
|
name: "conversation_language",
|
||||||
required: true,
|
required: true,
|
||||||
selector: {
|
selector: {
|
||||||
language: { languages: supportedLanguages, no_sort: true },
|
language: { languages: supportedLanguages, no_sort: true },
|
||||||
},
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
: { name: "", type: "constant" },
|
|
||||||
] as const,
|
if (engine !== "conversation.home_assistant") {
|
||||||
|
fields.push({
|
||||||
|
name: "prefer_local_intents",
|
||||||
|
default: true,
|
||||||
|
selector: {
|
||||||
|
boolean: {},
|
||||||
},
|
},
|
||||||
] as const
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
private _computeLabel = (schema): string =>
|
private _computeLabel = (schema): string =>
|
||||||
@ -53,6 +71,13 @@ export class AssistPipelineDetailConversation extends LitElement {
|
|||||||
)
|
)
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
|
private _computeHelper = (schema): string =>
|
||||||
|
schema.name
|
||||||
|
? this.hass.localize(
|
||||||
|
`ui.panel.config.voice_assistants.assistants.pipeline.detail.form.${schema.name}_description` as LocalizeKeys
|
||||||
|
)
|
||||||
|
: "";
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
return html`
|
return html`
|
||||||
<div class="section">
|
<div class="section">
|
||||||
@ -69,10 +94,15 @@ export class AssistPipelineDetailConversation extends LitElement {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<ha-form
|
<ha-form
|
||||||
.schema=${this._schema(this.data?.language, this._supportedLanguages)}
|
.schema=${this._schema(
|
||||||
|
this.data?.conversation_engine,
|
||||||
|
this.data?.language,
|
||||||
|
this._supportedLanguages
|
||||||
|
)}
|
||||||
.data=${this.data}
|
.data=${this.data}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.computeLabel=${this._computeLabel}
|
.computeLabel=${this._computeLabel}
|
||||||
|
.computeHelper=${this._computeHelper}
|
||||||
@supported-languages-changed=${this._supportedLanguagesChanged}
|
@supported-languages-changed=${this._supportedLanguagesChanged}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -48,7 +48,7 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
this._cloudActive = this._params.cloudActiveSubscription;
|
this._cloudActive = this._params.cloudActiveSubscription;
|
||||||
|
|
||||||
if (this._params.pipeline) {
|
if (this._params.pipeline) {
|
||||||
this._data = this._params.pipeline;
|
this._data = { prefer_local_intents: false, ...this._params.pipeline };
|
||||||
|
|
||||||
this._hideWakeWord =
|
this._hideWakeWord =
|
||||||
this._params.hideWakeWord || !this._data.wake_word_entity;
|
this._params.hideWakeWord || !this._data.wake_word_entity;
|
||||||
@ -170,7 +170,7 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
<assist-pipeline-detail-conversation
|
<assist-pipeline-detail-conversation
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this._data}
|
.data=${this._data}
|
||||||
keys="conversation_engine,conversation_language"
|
keys="conversation_engine,conversation_language,prefer_local_intents"
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></assist-pipeline-detail-conversation>
|
></assist-pipeline-detail-conversation>
|
||||||
${!this._cloudActive &&
|
${!this._cloudActive &&
|
||||||
@ -259,6 +259,7 @@ export class DialogVoiceAssistantPipelineDetail extends LitElement {
|
|||||||
language: data.language!,
|
language: data.language!,
|
||||||
conversation_engine: data.conversation_engine!,
|
conversation_engine: data.conversation_engine!,
|
||||||
conversation_language: data.conversation_language ?? null,
|
conversation_language: data.conversation_language ?? null,
|
||||||
|
prefer_local_intents: data.prefer_local_intents ?? true,
|
||||||
stt_engine: data.stt_engine ?? null,
|
stt_engine: data.stt_engine ?? null,
|
||||||
stt_language: data.stt_language ?? null,
|
stt_language: data.stt_language ?? null,
|
||||||
tts_engine: data.tts_engine ?? null,
|
tts_engine: data.tts_engine ?? null,
|
||||||
|
@ -2724,6 +2724,8 @@
|
|||||||
"name": "[%key:ui::common::name%]",
|
"name": "[%key:ui::common::name%]",
|
||||||
"conversation_engine": "Conversation agent",
|
"conversation_engine": "Conversation agent",
|
||||||
"conversation_language": "[%key:ui::panel::config::voice_assistants::assistants::pipeline::detail::form::language%]",
|
"conversation_language": "[%key:ui::panel::config::voice_assistants::assistants::pipeline::detail::form::language%]",
|
||||||
|
"prefer_local_intents": "Prefer handling commands locally",
|
||||||
|
"prefer_local_intents_description": "A command will first be sent to the local conversation agent. If the local agent does not handle the command, it will be sent to selected agent.",
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
"stt_engine": "Speech-to-text",
|
"stt_engine": "Speech-to-text",
|
||||||
"stt_language": "[%key:ui::panel::config::voice_assistants::assistants::pipeline::detail::form::language%]",
|
"stt_language": "[%key:ui::panel::config::voice_assistants::assistants::pipeline::detail::form::language%]",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user