Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix up settings saves (#4037)

Robert Brennan7b2b1eff57e4
diff --git a/frontend/src/components/modals/settings/SettingsForm.tsx b/frontend/src/components/modals/settings/SettingsForm.tsx
index aa1fa95d55..12f1fb697b 100644
--- a/frontend/src/components/modals/settings/SettingsForm.tsx
+++ b/frontend/src/components/modals/settings/SettingsForm.tsx
@@ -54,8 +54,6 @@ function SettingsForm({
const handleAdvancedChange = (value: boolean) => {
setEnableAdvanced(value);
- // Reset the base URL if the user disables advanced options
- if (!value) onBaseURLChange("");
};
return (
diff --git a/frontend/src/services/settings.ts b/frontend/src/services/settings.ts
index 4d06f20285..0e769faaba 100644
--- a/frontend/src/services/settings.ts
+++ b/frontend/src/services/settings.ts
@@ -87,10 +87,10 @@ export const getSettings = (): Settings => {
export const saveSettings = (settings: Partial<Settings>) => {
Object.keys(settings).forEach((key) => {
const isValid = validKeys.includes(key as keyof Settings);
- const value = settings[key as keyof Settings];
-
- if (isValid && typeof value !== "undefined")
- localStorage.setItem(key, value.toString());
+ if (!isValid) return;
+ let value = settings[key as keyof Settings];
+ if (value === undefined || value === null) value = "";
+ localStorage.setItem(key, value.toString());
});
localStorage.setItem("SETTINGS_VERSION", LATEST_SETTINGS_VERSION.toString());
};
diff --git a/openhands/server/session/session.py b/openhands/server/session/session.py
index 10c51594db..588df19610 100644
--- a/openhands/server/session/session.py
+++ b/openhands/server/session/session.py
@@ -76,9 +76,7 @@ class Session:
AgentStateChangedObservation('', AgentState.LOADING), EventSource.AGENT
)
# Extract the agent-relevant arguments from the request
- args = {
- key: value for key, value in data.get('args', {}).items() if value != ''
- }
+ args = {key: value for key, value in data.get('args', {}).items()}
agent_cls = args.get(ConfigType.AGENT, self.config.default_agent)
self.config.security.confirmation_mode = args.get(
ConfigType.CONFIRMATION_MODE, self.config.security.confirmation_mode