mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 05:37:20 +08:00
fix up settings saves (#4037)
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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());
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user