diff --git a/custom_components/groq_cloud_api/config_flow.py b/custom_components/groq_cloud_api/config_flow.py index 3a3f85f..21ef564 100644 --- a/custom_components/groq_cloud_api/config_flow.py +++ b/custom_components/groq_cloud_api/config_flow.py @@ -148,19 +148,16 @@ class GroqConfigFlow(ConfigFlow, domain=DOMAIN): config_entry: ConfigEntry, ) -> OptionsFlow: """Create the options flow.""" - return GroqOptionsFlow(config_entry) - + return GroqOptionsFlow() + class GroqOptionsFlow(OptionsFlow): """Groq Cloud config flow options handler.""" - def __init__(self, config_entry: ConfigEntry) -> None: + def __init__(self) -> None: """Initialize options flow.""" - self.config_entry = config_entry - self.last_rendered_recommended = config_entry.options.get( - CONF_RECOMMENDED, False - ) + self.last_rendered_recommended = False async def async_step_init( self, user_input: dict[str, Any] | None = None @@ -168,6 +165,9 @@ class GroqOptionsFlow(OptionsFlow): """Manage the options.""" options: dict[str, Any] | MappingProxyType[str, Any] = self.config_entry.options + if user_input is None: + self.last_rendered_recommended = options.get(CONF_RECOMMENDED, False) + if user_input is not None: if user_input[CONF_RECOMMENDED] == self.last_rendered_recommended: if user_input[CONF_LLM_HASS_API] == "none": @@ -271,4 +271,4 @@ class InvalidAPIKey(exceptions.HomeAssistantError): class ModelNotFound(exceptions.HomeAssistantError): - """Model can't be found in the GroqCloud model's list.""" \ No newline at end of file + """Model can't be found in the GroqCloud model's list."""