Skip to content

Commit

Permalink
Bring back merge logic
Browse files Browse the repository at this point in the history
  • Loading branch information
amanape committed Dec 31, 2024
1 parent 98fc5b4 commit 0143c60
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions openhands/server/routes/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,17 @@ async def store_settings(
github_token = request.state.github_token
try:
settings_store = await SettingsStoreImpl.get_instance(config, github_token)
existing_settings = await settings_store.load()

if existing_settings:
# 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)

return JSONResponse(
status_code=status.HTTP_200_OK,
content={'message': 'Settings stored'},
Expand Down

0 comments on commit 0143c60

Please sign in to comment.