Add config flow for time to remember current conversation

This commit is contained in:
Simon Redman
2025-05-31 23:53:24 -04:00
parent aeac99ab22
commit 647e233925
2 changed files with 11 additions and 0 deletions

View File

@@ -65,6 +65,7 @@ from .const import (
CONF_REFRESH_SYSTEM_PROMPT,
CONF_REMEMBER_CONVERSATION,
CONF_REMEMBER_NUM_INTERACTIONS,
CONF_REMEMBER_CONVERSATION_TIME_MINUTES,
CONF_PROMPT_CACHING_ENABLED,
CONF_PROMPT_CACHING_INTERVAL,
CONF_USE_IN_CONTEXT_LEARNING_EXAMPLES,
@@ -1089,6 +1090,14 @@ def local_llama_config_option_schema(hass: HomeAssistant, options: MappingProxyT
): BooleanSelector(BooleanSelectorConfig()),
})
elif backend_type in BACKEND_TYPE_GENERIC_OPENAI_RESPONSES:
del result[CONF_REMEMBER_NUM_INTERACTIONS]
result = insert_after_key(result, CONF_REMEMBER_CONVERSATION, {
vol.Required(
CONF_REMEMBER_CONVERSATION_TIME_MINUTES,
description={"suggested_value": options.get(CONF_REMEMBER_CONVERSATION_TIME_MINUTES)},
default=DEFAULT_TOP_P,
): NumberSelector(NumberSelectorConfig(min=0, max=180, step=0.5, unit_of_measurement=UnitOfTime.MINUTES, mode=NumberSelectorMode.BOX)),
})
result = insert_after_key(result, CONF_MAX_TOKENS, {
vol.Required(
CONF_TEMPERATURE,

View File

@@ -243,6 +243,8 @@ CONF_REMEMBER_CONVERSATION = "remember_conversation"
DEFAULT_REMEMBER_CONVERSATION = True
CONF_REMEMBER_NUM_INTERACTIONS = "remember_num_interactions"
DEFAULT_REMEMBER_NUM_INTERACTIONS = 5
CONF_REMEMBER_CONVERSATION_TIME_MINUTES = "remember_conversation_time_minutes"
DEFAULT_REMEMBER_CONVERSATION_TIME_MINUTES = 2
CONF_PROMPT_CACHING_ENABLED = "prompt_caching"
DEFAULT_PROMPT_CACHING_ENABLED = False
CONF_PROMPT_CACHING_INTERVAL = "prompt_caching_interval"