mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-10-02 19:07:25 -05:00
ui : stop settings save from clobbering backend config
Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash
This commit is contained in:
@@ -48,6 +48,11 @@
|
||||
|
||||
let localConfig: SettingsConfigType = $state({ ...settingsStore.config });
|
||||
|
||||
// Snapshot used to persist only the fields edited in this dialog. Config keys
|
||||
// that other surfaces write directly (backends, MCP servers) must not be
|
||||
// clobbered by the dialog's save.
|
||||
let baseline: SettingsConfigType = $state({ ...settingsStore.config });
|
||||
|
||||
let mobileHeader: { updateCarousel: () => void } | undefined;
|
||||
|
||||
let fetchInitiated = false;
|
||||
@@ -75,6 +80,7 @@
|
||||
|
||||
function handleReset() {
|
||||
localConfig = { ...settingsStore.config };
|
||||
baseline = { ...settingsStore.config };
|
||||
setMode(localConfig.theme as ColorMode);
|
||||
mobileHeader?.updateCarousel();
|
||||
}
|
||||
@@ -95,7 +101,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
const processedConfig = { ...localConfig };
|
||||
const processedConfig: SettingsConfigType = {};
|
||||
|
||||
for (const [key, value] of Object.entries(localConfig)) {
|
||||
if (value !== baseline[key]) {
|
||||
processedConfig[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
for (const field of NUMERIC_FIELDS) {
|
||||
if (processedConfig[field] !== undefined && processedConfig[field] !== '') {
|
||||
@@ -127,6 +139,7 @@
|
||||
|
||||
export function reset() {
|
||||
localConfig = { ...settingsStore.config };
|
||||
baseline = { ...settingsStore.config };
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user