mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 02:24:51 -05:00
Restore the recommended LLM API fallback for LiteLLM (#179768)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
f6c9b6fdf9
commit
37eebc3671
@@ -180,7 +180,7 @@ class ConversationFlowHandler(LiteLLMSubentryFlowHandler):
|
||||
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)
|
||||
if self._is_new:
|
||||
return self.async_create_entry(
|
||||
@@ -241,7 +241,10 @@ class ConversationFlowHandler(LiteLLMSubentryFlowHandler):
|
||||
): TemplateSelector(),
|
||||
vol.Optional(
|
||||
CONF_LLM_HASS_API,
|
||||
default=self.options.get(CONF_LLM_HASS_API, []),
|
||||
default=self.options.get(
|
||||
CONF_LLM_HASS_API,
|
||||
RECOMMENDED_CONVERSATION_OPTIONS[CONF_LLM_HASS_API],
|
||||
),
|
||||
): SelectSelector(
|
||||
SelectSelectorConfig(options=hass_apis, multiple=True)
|
||||
),
|
||||
|
||||
@@ -242,6 +242,7 @@ async def test_create_conversation_agent_no_control(
|
||||
assert result["data"] == {
|
||||
CONF_MODEL: "gpt-3.5-turbo",
|
||||
CONF_PROMPT: "you are an assistant",
|
||||
CONF_LLM_HASS_API: [],
|
||||
}
|
||||
|
||||
|
||||
@@ -360,7 +361,7 @@ async def test_reconfigure_conversation_agent_disable_llm_api(
|
||||
)
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "reconfigure_successful"
|
||||
assert CONF_LLM_HASS_API not in mock_config_entry.subentries[subentry_id].data
|
||||
assert mock_config_entry.subentries[subentry_id].data[CONF_LLM_HASS_API] == []
|
||||
|
||||
result = await mock_config_entry.start_subentry_reconfigure_flow(hass, subentry_id)
|
||||
schema = result["data_schema"].schema
|
||||
|
||||
Reference in New Issue
Block a user