This commit is contained in:
Timothy Jaeryang Baek
2026-08-17 00:18:35 -07:00
parent 211906d799
commit ad8c79f686
2 changed files with 16 additions and 22 deletions

View File

@@ -508,7 +508,7 @@ async def update_user_settings_by_session_user(
detail=ERROR_MESSAGES.ACCESS_PROHIBITED,
)
updated_user_settings = form_data.model_dump()
updated_user_settings = form_data.model_dump(exclude_unset=True)
ui_settings = updated_user_settings.get('ui')
if (
user.role != 'admin'

View File

@@ -90,19 +90,7 @@
};
const setUserSettings = async (cb?: () => Promise<void>) => {
let userSettings = await getUserSettings(localStorage.token).catch((error) => {
console.error(error);
return null;
});
if (!userSettings) {
try {
userSettings = JSON.parse(localStorage.getItem('settings') ?? '{}');
} catch (e: unknown) {
console.error('Failed to parse settings from localStorage', e);
userSettings = {};
}
}
const userSettings = await getUserSettings(localStorage.token);
if (userSettings?.ui) {
settings.set(userSettings.ui);
@@ -254,14 +242,20 @@
}
clearChatInputStorage();
await Promise.all([
checkLocalDBChats(),
setBanners().catch((e) => console.error('Failed to load banners:', e)),
setTools().catch((e) => console.error('Failed to load tools:', e)),
setUserSettings(async () => {
await setModels().catch((e) => console.error('Failed to load models:', e));
}).catch((e) => console.error('Failed to load user settings:', e))
]);
try {
await Promise.all([
checkLocalDBChats(),
setBanners().catch((e) => console.error('Failed to load banners:', e)),
setTools().catch((e) => console.error('Failed to load tools:', e)),
setUserSettings(async () => {
await setModels().catch((e) => console.error('Failed to load models:', e));
})
]);
} catch (e) {
console.error('Failed to load user settings:', e);
toast.error($i18n.t('Failed to load Interface settings'));
return;
}
selectedTerminalId.set(localStorage.selectedTerminalId ?? null);