diff --git a/admin/frontend/models.html b/admin/frontend/models.html
index b7df065..f6bebb1 100644
--- a/admin/frontend/models.html
+++ b/admin/frontend/models.html
@@ -193,6 +193,10 @@ header.navbar{padding-top:2px!important;padding-bottom:2px!important}
Model Availability
Change the override dropdown to mark a model active, deprecated, or stale
+
+
+
+
@@ -302,13 +306,24 @@ function connectSSE() {
MODEL AVAILABILITY TABLE
═══════════════════════════════════════ */
+let _modelsCache = [];
+
function renderModels(models) {
+ _modelsCache = models || [];
const tbody = document.getElementById('model-tbody');
if (!models || !models.length) {
tbody.innerHTML = '| No models |
';
return;
}
- const html = models.filter(m => (m.access_level === 'public') || !m.access_level).map(m => {
+ const toggleEl = document.getElementById('show-deprecated-toggle');
+ const showDeprecated = toggleEl ? toggleEl.checked : false;
+ const visible = models.filter(m => (m.access_level === 'public') || !m.access_level)
+ .filter(m => showDeprecated || (m.effective_availability !== 'deprecated' && m.effective_availability !== 'stale'));
+ if (!visible.length) {
+ tbody.innerHTML = '| No models match the current filter |
';
+ return;
+ }
+ const html = visible.map(m => {
const availClass = { active: 'var(--tblr-success)', deprecated: 'var(--tblr-danger)', stale: 'var(--tblr-warning)' }[m.effective_availability] || 'var(--tblr-secondary)';
const selectOpts = ['active','deprecated','stale'].map(a =>
``
diff --git a/tests/test_admin_frontend.py b/tests/test_admin_frontend.py
index cce40c8..7e434af 100644
--- a/tests/test_admin_frontend.py
+++ b/tests/test_admin_frontend.py
@@ -142,6 +142,19 @@ def test_admin_models_returns_html_with_availability_marker(admin_client):
assert "Model Availability" in resp.text
+def test_admin_models_hides_deprecated_by_default_with_a_toggle_to_show_them(admin_client):
+ """The models page defaults to hiding deprecated/stale rows (e.g. after
+ the OpenRouter allowlist prunes 425 down to 30) behind a toggle, rather
+ than always rendering every row regardless of availability."""
+ resp = admin_client.get("/admin/models")
+ text = resp.text
+ assert 'id="show-deprecated-toggle"' in text
+ # Default unchecked: renderModels must read the toggle's checked state
+ # and exclude deprecated/stale unless it's on.
+ assert "effective_availability !== 'deprecated'" in text
+ assert "effective_availability !== 'stale'" in text
+
+
def test_admin_profiles_returns_html_with_profiles_marker(admin_client):
"""GET /admin/profiles returns 200, text/html, and contains the Chart.js
tag and the Profiles page marker."""