fix: Fix missing model auto-pull when user settings are unmodified

This commit is contained in:
Shirasawa 2025-10-14 11:43:51 +00:00
parent 2b3b2e4aa6
commit f0689b260a

View file

@ -85,25 +85,27 @@
} }
}; };
const setUserSettings = async (cb) => { const setUserSettings = async (cb: () => Promise<void>) => {
const userSettings = await getUserSettings(localStorage.token).catch((error) => { let userSettings = await getUserSettings(localStorage.token).catch((error) => {
console.error(error); console.error(error);
return null; return null;
}); });
if (userSettings) { if (!userSettings) {
await settings.set(userSettings.ui); try {
userSettings = JSON.parse(localStorage.getItem('settings') ?? '{}');
if (cb) { } catch (e: unknown) {
await cb(); console.error('Failed to parse settings from localStorage', e);
userSettings = {};
} }
} }
try { if (userSettings?.ui) {
return JSON.parse(localStorage.getItem('settings') ?? '{}'); settings.set(userSettings.ui);
} catch (e: unknown) { }
console.error('Failed to parse settings from localStorage', e);
return {}; if (cb) {
await cb();
} }
}; };