refactor(frontend): isolate audio meters and apply settings on save
This commit is contained in:
@@ -40,12 +40,16 @@ export function loadSettings(): Settings {
|
||||
searchKey: read("searchKey") ?? "",
|
||||
};
|
||||
}
|
||||
export function saveSettings(settings: Settings) {
|
||||
export function saveSettings(settings: Partial<Settings>) {
|
||||
try {
|
||||
for (const key of ["directUrl", "voice", "instructions", "noiseGate", "searchKey"] as const) {
|
||||
localStorage.setItem(`s2s.ws.${key}`, String(settings[key]));
|
||||
if (settings[key] !== undefined) {
|
||||
localStorage.setItem(`s2s.ws.${key}`, String(settings[key]));
|
||||
}
|
||||
}
|
||||
if (settings.webSearch !== undefined) {
|
||||
localStorage.setItem("s2s.ws.tools", JSON.stringify({ web_search: settings.webSearch }));
|
||||
}
|
||||
localStorage.setItem("s2s.ws.tools", JSON.stringify({ web_search: settings.webSearch }));
|
||||
} catch {
|
||||
/* The current session still works when browser storage is disabled. */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user