mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-03 02:23:51 +00:00
fix: save only the changed key when pinning, reordering or picking a default outside the Settings modal (#30183)
This commit is contained in:
parent
f6922a4c42
commit
881f7c9400
10 changed files with 18 additions and 14 deletions
|
|
@ -41,7 +41,7 @@
|
|||
const closeModal = async () => {
|
||||
localStorage.version = $config.version;
|
||||
await settings.set({ ...$settings, ...{ version: $config.version } });
|
||||
await updateUserSettings(localStorage.token, { ui: $settings });
|
||||
await updateUserSettings(localStorage.token, { ui: { version: $config.version } });
|
||||
show = false;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -666,7 +666,7 @@
|
|||
? $pinnedModels.filter((id) => id !== modelId)
|
||||
: [...$pinnedModels, modelId]
|
||||
});
|
||||
await updateUserSettings(localStorage.token, { ui: $settings });
|
||||
await updateUserSettings(localStorage.token, { ui: { pinnedModels: $settings.pinnedModels } });
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
|
|
|
|||
|
|
@ -448,9 +448,11 @@
|
|||
tool_approval_mode
|
||||
}
|
||||
});
|
||||
await updateUserSettings(localStorage.token, { ui: $settings }).catch((err) => {
|
||||
console.error('[tool permissions settings]', err);
|
||||
});
|
||||
await updateUserSettings(localStorage.token, { ui: { params: $settings.params } }).catch(
|
||||
(err) => {
|
||||
console.error('[tool permissions settings]', err);
|
||||
}
|
||||
);
|
||||
|
||||
if ($chatId && !$temporaryChatEnabled && !isTemporaryChatId($chatId)) {
|
||||
const res = await updateChatById(localStorage.token, $chatId, { params }).catch((err) => {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
return;
|
||||
}
|
||||
settings.set({ ...$settings, models: selectedModels });
|
||||
await updateUserSettings(localStorage.token, { ui: $settings });
|
||||
await updateUserSettings(localStorage.token, { ui: { models: selectedModels } });
|
||||
|
||||
toast.success($i18n.t('Default model updated'));
|
||||
};
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
? $pinnedModels.filter((id) => id !== modelId)
|
||||
: [...$pinnedModels, modelId]
|
||||
});
|
||||
await updateUserSettings(localStorage.token, { ui: $settings });
|
||||
await updateUserSettings(localStorage.token, { ui: { pinnedModels: $settings.pinnedModels } });
|
||||
};
|
||||
|
||||
$: if (selectedModels.length > 0 && $models.length > 0) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
// Debounce backend save (avoid API spam on rapid picks)
|
||||
if (saveDebounceTimer) clearTimeout(saveDebounceTimer);
|
||||
saveDebounceTimer = setTimeout(async () => {
|
||||
await updateUserSettings(localStorage.token, { ui: { ...$settings, recentEmojis: updated } });
|
||||
await updateUserSettings(localStorage.token, { ui: { recentEmojis: updated } });
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@
|
|||
current.splice(oldIndex, 1);
|
||||
current.splice(newIndex, 0, itemId);
|
||||
settings.set({ ...$settings, pinnedMenuItems: current });
|
||||
await updateUserSettings(localStorage.token, { ui: $settings });
|
||||
await updateUserSettings(localStorage.token, { ui: { pinnedMenuItems: current } });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@
|
|||
...$pinnedModels.filter((id) => !$visiblePinnedModels.includes(id))
|
||||
]
|
||||
});
|
||||
await updateUserSettings(localStorage.token, { ui: $settings });
|
||||
await updateUserSettings(localStorage.token, {
|
||||
ui: { pinnedModels: $settings.pinnedModels }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -74,7 +76,7 @@
|
|||
...$settings,
|
||||
pinnedModels: $pinnedModels.filter((id) => id !== modelId)
|
||||
});
|
||||
updateUserSettings(localStorage.token, { ui: $settings });
|
||||
updateUserSettings(localStorage.token, { ui: { pinnedModels: $settings.pinnedModels } });
|
||||
}}
|
||||
/>
|
||||
{/each}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
current.splice(oldIndex, 1);
|
||||
current.splice(newIndex, 0, noteId);
|
||||
settings.set({ ...$settings, pinnedNotesOrder: current });
|
||||
await updateUserSettings(localStorage.token, { ui: $settings });
|
||||
await updateUserSettings(localStorage.token, { ui: { pinnedNotesOrder: current } });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
updated = [...pinnedItems, id];
|
||||
}
|
||||
await settings.set({ ...$settings, pinnedMenuItems: updated });
|
||||
await updateUserSettings(localStorage.token, { ui: $settings });
|
||||
await updateUserSettings(localStorage.token, { ui: { pinnedMenuItems: updated } });
|
||||
};
|
||||
|
||||
let usage = null;
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@
|
|||
? $pinnedModels.filter((id) => id !== modelId)
|
||||
: [...$pinnedModels, modelId]
|
||||
});
|
||||
await updateUserSettings(localStorage.token, { ui: $settings });
|
||||
await updateUserSettings(localStorage.token, { ui: { pinnedModels: $settings.pinnedModels } });
|
||||
};
|
||||
|
||||
const fetchAllWorkspaceModels = async () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue