Changeset 0.25.4 (#164)

This commit is contained in:
2026-03-09 20:17:46 +00:00
parent 2f7a0fb027
commit dbc1a97343
22 changed files with 660 additions and 491 deletions

View File

@@ -142,6 +142,13 @@
<div id="userPersonaList"><div class="settings-placeholder">Loading personas…</div></div>
{{else if eq .Section "models"}}
<div id="userModelList"><div class="settings-placeholder">Loading models…</div></div>
{{else if eq .Section "roles"}}
<div id="userRolesDisabled" class="settings-section" style="display:none;">
<p style="color:var(--text-2);font-size:13px;">Add a personal provider first to configure model role overrides.</p>
</div>
<div id="userRolesConfig"></div>
{{else if eq .Section "usage"}}
<div id="myUsageTotals"></div>
{{else if eq .Section "teams"}}
<div id="settingsDynamic"><div class="settings-placeholder">Loading teams…</div></div>
{{else}}<div class="settings-placeholder" id="settingsDynamic">Loading…</div>
@@ -166,7 +173,7 @@
<script nonce="{{.CSPNonce}}" src="{{.BasePath}}/js/notification-prefs.js?v={{.Version}}"></script>
<script nonce="{{.CSPNonce}}" src="{{.BasePath}}/js/channel-models.js?v={{.Version}}"></script>
<script nonce="{{.CSPNonce}}">
document.addEventListener('DOMContentLoaded', () => {
document.addEventListener('DOMContentLoaded', async () => {
const section = document.getElementById('settingsSection')?.dataset.section;
if (!section) return;
@@ -241,6 +248,22 @@
notifications: () => typeof NotifPrefs !== 'undefined' && NotifPrefs.load?.(),
teams: () => typeof UI !== 'undefined' && UI.loadTeamsSettings?.(),
};
// Populate App.policies and App.models from API.
// On chat surface, app.js does this. On settings surface, we must do it here.
try {
const pubData = await API.getPublicSettings();
App.policies = pubData.policies || {};
} catch (_) { App.policies = App.policies || {}; }
if (typeof fetchModels === 'function') await fetchModels();
// Wire up interactive handlers (BYOK provider form, model visibility, etc.)
if (typeof _initSettingsListeners === 'function') _initSettingsListeners();
// Show/hide BYOK and persona features based on policies
if (typeof UI !== 'undefined') {
UI.checkUserProvidersAllowed?.();
UI.checkUserPersonasAllowed?.();
}
if (dynamicSections[section]) dynamicSections[section]();
});
</script>