Merge pull request #18324 from ShirasawaSama/patch-37

fix: Fix missing model auto-pull when user settings are unmodified
This commit is contained in:
Tim Jaeryang Baek 2025-10-14 18:07:32 -05:00 committed by GitHub
commit 515e136502
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -85,26 +85,28 @@
} }
}; };
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') ?? '{}');
} catch (e: unknown) {
console.error('Failed to parse settings from localStorage', e);
userSettings = {};
}
}
if (userSettings?.ui) {
settings.set(userSettings.ui);
}
if (cb) { if (cb) {
await cb(); await cb();
} }
}
try {
return JSON.parse(localStorage.getItem('settings') ?? '{}');
} catch (e: unknown) {
console.error('Failed to parse settings from localStorage', e);
return {};
}
}; };
const setModels = async () => { const setModels = async () => {