mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Persist an empty LLM API selection in Google Generative AI
Clearing every LLM API removed the key from the subentry data instead of storing an empty list. Only remove the key when it is absent from the submitted input. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016D21QGmGduj7t1aQLX26pS
This commit is contained in:
@@ -258,7 +258,7 @@ class LLMSubentryFlowHandler(ConfigSubentryFlow):
|
||||
|
||||
else:
|
||||
if user_input[CONF_RECOMMENDED] == self.last_rendered_recommended:
|
||||
if not user_input.get(CONF_LLM_HASS_API):
|
||||
if user_input.get(CONF_LLM_HASS_API) is None:
|
||||
user_input.pop(CONF_LLM_HASS_API, None)
|
||||
# Don't allow to save options that enable the
|
||||
# Google Search tool with an Assist API
|
||||
|
||||
@@ -583,6 +583,24 @@ def will_options_be_rendered_again(current_options, new_options) -> bool:
|
||||
},
|
||||
None,
|
||||
),
|
||||
(
|
||||
{
|
||||
CONF_RECOMMENDED: True,
|
||||
CONF_PROMPT: "",
|
||||
CONF_LLM_HASS_API: ["assist"],
|
||||
},
|
||||
{
|
||||
CONF_RECOMMENDED: True,
|
||||
CONF_PROMPT: "",
|
||||
CONF_LLM_HASS_API: [],
|
||||
},
|
||||
{
|
||||
CONF_RECOMMENDED: True,
|
||||
CONF_PROMPT: "",
|
||||
CONF_LLM_HASS_API: [],
|
||||
},
|
||||
None,
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("mock_init_component")
|
||||
|
||||
Reference in New Issue
Block a user