refactor(frontend): isolate audio meters and apply settings on save

This commit is contained in:
2026-10-07 09:29:20 -03:00
parent 09bf6ece00
commit 0c57f7c76d
7 changed files with 240 additions and 105 deletions
+7 -3
View File
@@ -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. */
}