diff --git a/custom_components/zhipuai/config_flow.py b/custom_components/zhipuai/config_flow.py index 12b74d8..9e0e567 100644 --- a/custom_components/zhipuai/config_flow.py +++ b/custom_components/zhipuai/config_flow.py @@ -248,6 +248,9 @@ async def async_step_init( if not errors: self._data.update(user_input) + if CONF_WEB_SEARCH not in self._data: + self._data[CONF_WEB_SEARCH] = DEFAULT_WEB_SEARCH + if user_input.get(CONF_HISTORY_ANALYSIS): return await self.async_step_history() return self.async_create_entry(title="", data=self._data) @@ -375,7 +378,8 @@ def zhipuai_config_option_schema( ), vol.Optional( CONF_WEB_SEARCH, - default=DEFAULT_WEB_SEARCH, + default=options.get(CONF_WEB_SEARCH, DEFAULT_WEB_SEARCH), + description={"suggested_value": options.get(CONF_WEB_SEARCH, DEFAULT_WEB_SEARCH)}, ): bool, vol.Optional( CONF_HISTORY_ANALYSIS, @@ -415,4 +419,4 @@ class InvalidAPIKey(exceptions.HomeAssistantError): pass class ModelNotFound(exceptions.HomeAssistantError): - pass \ No newline at end of file + pass