mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Fix OVHcloud AI Endpoints forgetting an empty LLM API selection (#179764)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
207d384cd0
commit
5ca5794855
@@ -176,7 +176,7 @@ class ConversationFlowHandler(ConfigSubentryFlow):
|
||||
existing = subentry.data
|
||||
|
||||
if user_input is not None:
|
||||
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)
|
||||
user_input[CONF_MODEL] = existing[CONF_MODEL]
|
||||
return self.async_update_and_abort(
|
||||
@@ -221,7 +221,7 @@ class ConversationFlowHandler(ConfigSubentryFlow):
|
||||
return self.async_abort(reason="entry_not_loaded")
|
||||
|
||||
if user_input is not None:
|
||||
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)
|
||||
return self.async_create_entry(
|
||||
title=user_input[CONF_MODEL], data=user_input
|
||||
|
||||
@@ -201,6 +201,7 @@ async def test_create_conversation_agent_no_control(
|
||||
assert result["data"] == {
|
||||
CONF_MODEL: "Mistral-Nemo-Instruct-2407",
|
||||
CONF_PROMPT: "you are an assistant",
|
||||
CONF_LLM_HASS_API: [],
|
||||
}
|
||||
|
||||
|
||||
@@ -499,5 +500,11 @@ async def test_reconfigure_conversation_agent_clears_llm_api(
|
||||
|
||||
subentry = mock_config_entry.subentries[subentry_id]
|
||||
assert subentry.data[CONF_PROMPT] == "updated prompt"
|
||||
assert CONF_LLM_HASS_API not in subentry.data
|
||||
assert subentry.data[CONF_LLM_HASS_API] == []
|
||||
assert subentry.data[CONF_MODEL] == "Meta-Llama-3_3-70B-Instruct"
|
||||
|
||||
result = await mock_config_entry.start_subentry_reconfigure_flow(hass, subentry_id)
|
||||
|
||||
schema = result["data_schema"].schema
|
||||
key = next(k for k in schema if k == CONF_LLM_HASS_API)
|
||||
assert key.default() == []
|
||||
|
||||
Reference in New Issue
Block a user