Include subentries in Google Generative AI diagnostics (#147558)

This commit is contained in:
tronikos 2025-06-26 01:50:47 -07:00 committed by GitHub
parent 38669ce96c
commit fb133664e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 35 additions and 14 deletions

View File

@ -21,6 +21,7 @@ async def async_get_config_entry_diagnostics(
"title": entry.title,
"data": entry.data,
"options": entry.options,
"subentries": dict(entry.subentries),
},
TO_REDACT,
)

View File

@ -34,12 +34,14 @@ def mock_config_entry(hass: HomeAssistant) -> MockConfigEntry:
"data": {},
"subentry_type": "conversation",
"title": DEFAULT_CONVERSATION_NAME,
"subentry_id": "ulid-conversation",
"unique_id": None,
},
{
"data": {},
"subentry_type": "tts",
"title": DEFAULT_TTS_NAME,
"subentry_id": "ulid-tts",
"unique_id": None,
},
],

View File

@ -5,6 +5,10 @@
'api_key': '**REDACTED**',
}),
'options': dict({
}),
'subentries': dict({
'ulid-conversation': dict({
'data': dict({
'chat_model': 'models/gemini-2.5-flash',
'dangerous_block_threshold': 'BLOCK_MEDIUM_AND_ABOVE',
'harassment_block_threshold': 'BLOCK_MEDIUM_AND_ABOVE',
@ -17,6 +21,20 @@
'top_k': 64,
'top_p': 0.95,
}),
'subentry_id': 'ulid-conversation',
'subentry_type': 'conversation',
'title': 'Google AI Conversation',
'unique_id': None,
}),
'ulid-tts': dict({
'data': dict({
}),
'subentry_id': 'ulid-tts',
'subentry_type': 'tts',
'title': 'Google AI TTS',
'unique_id': None,
}),
}),
'title': 'Google Generative AI Conversation',
})
# ---

View File

@ -35,10 +35,10 @@ async def test_diagnostics(
snapshot: SnapshotAssertion,
) -> None:
"""Test diagnostics."""
mock_config_entry.add_to_hass(hass)
hass.config_entries.async_update_entry(
hass.config_entries.async_update_subentry(
mock_config_entry,
options={
next(iter(mock_config_entry.subentries.values())),
data={
CONF_RECOMMENDED: False,
CONF_PROMPT: "Speak like a pirate",
CONF_TEMPERATURE: RECOMMENDED_TEMPERATURE,