Skip to content

Commit

Permalink
Fix save settings bug
Browse files Browse the repository at this point in the history
  • Loading branch information
amanape committed Dec 30, 2024
1 parent 9dfc732 commit ecde867
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 0 additions & 2 deletions frontend/src/components/features/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export function Sidebar() {
const { logout } = useAuth();
const { isUpToDate: settingsAreUpToDate } = useSettingsUpToDate();

console.warn({ settingsAreUpToDate });

const [accountSettingsModalOpen, setAccountSettingsModalOpen] =
React.useState(false);
const [settingsModalIsOpen, setSettingsModalIsOpen] = React.useState(false);
Expand Down
5 changes: 4 additions & 1 deletion openhands/server/routes/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ async def store_settings(
settings_store = await SettingsStoreImpl.get_instance(config, github_token)
existing_settings = await settings_store.load()
if existing_settings:
settings = Settings(**{**existing_settings.__dict__, **settings.__dict__})
# Only update settings that are not None with the new values
for key, value in settings.__dict__.items():
if value is None:
setattr(settings, key, getattr(existing_settings, key))
if settings.llm_api_key is None:
settings.llm_api_key = existing_settings.llm_api_key
await settings_store.store(settings)
Expand Down

0 comments on commit ecde867

Please sign in to comment.