Changeset 0.15.0 patches (#72)
This commit is contained in:
@@ -131,7 +131,15 @@ const API = {
|
||||
this._refreshTimer = setTimeout(async () => {
|
||||
if (!this.refreshToken) return;
|
||||
console.debug('🔄 Proactive token refresh');
|
||||
await this.refresh();
|
||||
try {
|
||||
const data = await this._post('/api/v1/auth/refresh', { refresh_token: this.refreshToken }, true);
|
||||
this._setAuth(data);
|
||||
} catch (e) {
|
||||
// Proactive refresh failed — keep session alive.
|
||||
// Access token is still valid for ~20% of its lifetime.
|
||||
// When it naturally expires, 401-retry in _authed() handles cleanup.
|
||||
console.warn('⚠ Proactive refresh failed, access token still valid');
|
||||
}
|
||||
}, ms);
|
||||
},
|
||||
|
||||
|
||||
@@ -62,7 +62,11 @@ async function fetchModels() {
|
||||
App.hiddenModels = new Set(
|
||||
(prefData.preferences || []).filter(p => p.hidden).map(p => p.model_id)
|
||||
);
|
||||
} catch (e) { App.hiddenModels = new Set(); }
|
||||
} catch (e) {
|
||||
// Keep existing preferences on failure (auth dead, network issue).
|
||||
// Only init to empty if there's nothing to preserve.
|
||||
if (!App.hiddenModels) App.hiddenModels = new Set();
|
||||
}
|
||||
|
||||
App.models = (data.models || []).map(m => {
|
||||
const isPreset = !!m.is_preset;
|
||||
|
||||
@@ -509,7 +509,9 @@ Object.assign(UI, {
|
||||
App.hiddenModels = new Set(
|
||||
(prefData.preferences || []).filter(p => p.hidden).map(p => p.model_id)
|
||||
);
|
||||
} catch (e) { App.hiddenModels = new Set(); }
|
||||
} catch (e) {
|
||||
if (!App.hiddenModels) App.hiddenModels = new Set();
|
||||
}
|
||||
}
|
||||
|
||||
const data = await API.listEnabledModels();
|
||||
|
||||
Reference in New Issue
Block a user