mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Fall back to domain for conversation agents without title (#92014)
This commit is contained in:
parent
78a49ecbce
commit
18f7b92438
@ -442,7 +442,7 @@ class AgentManager:
|
|||||||
agents.append(
|
agents.append(
|
||||||
AgentInfo(
|
AgentInfo(
|
||||||
id=agent_id,
|
id=agent_id,
|
||||||
name=config_entry.title,
|
name=config_entry.title or config_entry.domain,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return agents
|
return agents
|
||||||
|
@ -17,6 +17,12 @@
|
|||||||
'name': 'Mock Title',
|
'name': 'Mock Title',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_get_agent_info.3
|
||||||
|
dict({
|
||||||
|
'id': 'mock-entry',
|
||||||
|
'name': 'test',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_get_agent_list
|
# name: test_get_agent_list
|
||||||
dict({
|
dict({
|
||||||
'agents': list([
|
'agents': list([
|
||||||
|
@ -1642,6 +1642,13 @@ async def test_get_agent_info(
|
|||||||
assert conversation.async_get_agent_info(hass, mock_agent.agent_id) == snapshot
|
assert conversation.async_get_agent_info(hass, mock_agent.agent_id) == snapshot
|
||||||
assert conversation.async_get_agent_info(hass, "not exist") is None
|
assert conversation.async_get_agent_info(hass, "not exist") is None
|
||||||
|
|
||||||
|
# Test the name when config entry title is empty
|
||||||
|
agent_entry = hass.config_entries.async_get_entry("mock-entry")
|
||||||
|
hass.config_entries.async_update_entry(agent_entry, title="")
|
||||||
|
|
||||||
|
agent_info = conversation.async_get_agent_info(hass)
|
||||||
|
assert agent_info == snapshot
|
||||||
|
|
||||||
|
|
||||||
async def test_ws_get_agent_info(
|
async def test_ws_get_agent_info(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user