mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-10 10:56:34 +00:00
Improve trigger and action description for conversation (#23141)
This commit is contained in:
parent
4092f56ea5
commit
512fee47b6
@ -682,19 +682,27 @@ const tryDescribeTrigger = (
|
|||||||
|
|
||||||
// Conversation Trigger
|
// Conversation Trigger
|
||||||
if (trigger.trigger === "conversation") {
|
if (trigger.trigger === "conversation") {
|
||||||
if (!trigger.command) {
|
if (!trigger.command || !trigger.command.length) {
|
||||||
return hass.localize(
|
return hass.localize(
|
||||||
`${triggerTranslationBaseKey}.conversation.description.empty`
|
`${triggerTranslationBaseKey}.conversation.description.empty`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const commands = ensureArray(trigger.command);
|
||||||
|
|
||||||
|
if (commands.length === 1) {
|
||||||
|
return hass.localize(
|
||||||
|
`${triggerTranslationBaseKey}.conversation.description.single`,
|
||||||
|
{
|
||||||
|
sentence: commands[0],
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
return hass.localize(
|
return hass.localize(
|
||||||
`${triggerTranslationBaseKey}.conversation.description.full`,
|
`${triggerTranslationBaseKey}.conversation.description.multiple`,
|
||||||
{
|
{
|
||||||
sentence: formatListWithOrs(
|
sentence: commands[0],
|
||||||
hass.locale,
|
count: commands.length - 1,
|
||||||
ensureArray(trigger.command).map((cmd) => `'${cmd}'`)
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -486,6 +486,11 @@ const tryDescribeAction = <T extends ActionType>(
|
|||||||
|
|
||||||
if (actionType === "set_conversation_response") {
|
if (actionType === "set_conversation_response") {
|
||||||
const config = action as SetConversationResponseAction;
|
const config = action as SetConversationResponseAction;
|
||||||
|
if (isTemplate(config.set_conversation_response)) {
|
||||||
|
return hass.localize(
|
||||||
|
`${actionTranslationBaseKey}.set_conversation_response.description.template`
|
||||||
|
);
|
||||||
|
}
|
||||||
return hass.localize(
|
return hass.localize(
|
||||||
`${actionTranslationBaseKey}.set_conversation_response.description.full`,
|
`${actionTranslationBaseKey}.set_conversation_response.description.full`,
|
||||||
{ response: config.set_conversation_response }
|
{ response: config.set_conversation_response }
|
||||||
|
@ -3125,7 +3125,8 @@
|
|||||||
"description": {
|
"description": {
|
||||||
"picker": "When Assist matches a sentence from a voice assistant.",
|
"picker": "When Assist matches a sentence from a voice assistant.",
|
||||||
"empty": "When a sentence is said",
|
"empty": "When a sentence is said",
|
||||||
"full": "When the sentence {sentence} is said"
|
"single": "When the sentence ''{sentence}'' is said",
|
||||||
|
"multiple": "When the sentence ''{sentence}'' or {count, plural,\n one {another}\n other {{count} others}\n} are said"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tag": {
|
"tag": {
|
||||||
@ -3599,7 +3600,8 @@
|
|||||||
"label": "Set conversation response",
|
"label": "Set conversation response",
|
||||||
"description": {
|
"description": {
|
||||||
"picker": "Set response of conversation if automation was triggered by conversation trigger.",
|
"picker": "Set response of conversation if automation was triggered by conversation trigger.",
|
||||||
"full": "Set response of conversation to {response}"
|
"template": "Set response of conversation to a template",
|
||||||
|
"full": "Set response of conversation to ''{response}''"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"unknown": {
|
"unknown": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user