Skip to content

Commit

Permalink
fix saving config_flow options
Browse files Browse the repository at this point in the history
  • Loading branch information
ej52 committed Nov 10, 2023
1 parent 66fd604 commit 22071d2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions custom_components/ollama_conversation/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class OllamaOptionsFlow(config_entries.OptionsFlow):
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
"""Initialize options flow."""
self.config_entry = config_entry
self.options = dict(config_entry.options)

async def async_step_init(
self, user_input: dict[str, Any] | None = None
Expand All @@ -154,8 +155,8 @@ async def async_step_prompt_system(
) -> FlowResult:
"""Manage Prompt Templates."""
if user_input is not None:
user_input.update(self.config_entry.options)
return self.async_create_entry(title="", data=user_input)
self.options.update(user_input)
return self.async_create_entry(title="", data=self.options)

schema = ollama_schema_prompt_system(self.config_entry.options)
return self.async_show_form(
Expand All @@ -168,8 +169,8 @@ async def async_step_model_config(
) -> FlowResult:
"""Manage Model Settings."""
if user_input is not None:
user_input.update(self.config_entry.options)
return self.async_create_entry(title="", data=user_input)
self.options.update(user_input)
return self.async_create_entry(title="", data=self.options)

try:
client = OllamaApiClient(
Expand Down

0 comments on commit 22071d2

Please sign in to comment.