Settings/Add Models: split Local and API into separate cards, always show API key

Drop the in-card Local/API tab strip — each is now its own admin card with
a normal h2 heading (Local on top, API below). The API key input is
always visible (no more click-to-reveal toggle), matching how cloud
providers actually work. Local keeps the optional key reveal since
local servers usually don't need one.

Dead code removed: wireModelsTabs IIFE and the adm-epApiKeyBtn toggle wire.
This commit is contained in:
pewdiepie-archdaemon
2026-06-09 14:57:42 +09:00
parent 2252776a97
commit b2458f9891
2 changed files with 15 additions and 75 deletions
-33
View File
@@ -1168,7 +1168,6 @@ function initEndpointForm() {
});
};
_wireKeyToggle('adm-epLocalKeyBtn', 'adm-epLocalApiKey-row');
_wireKeyToggle('adm-epApiKeyBtn', 'adm-epApiKey-row');
// ── Added Models toolbar: Probe + Clear offline ────────────────────
// Both buttons act over the currently-rendered endpoint list. The
@@ -1444,38 +1443,6 @@ function initEndpointForm() {
});
}
// Add Models card has Local / API tabs (each tab pairs an Add form
// with its corresponding Added list). Remember the active tab in
// localStorage so the user lands back where they were.
(function wireModelsTabs() {
const tabs = document.querySelectorAll('.adm-models-tab');
const panes = document.querySelectorAll('.adm-models-pane');
if (!tabs.length || !panes.length) return;
const KEY = 'odysseus.addModels.activeTab';
const validTabs = new Set(Array.from(tabs).map((t) => t.dataset.modelsTab));
let active = 'local';
try {
const stored = localStorage.getItem(KEY);
if (stored && validTabs.has(stored)) active = stored;
} catch {}
const apply = (name) => {
active = name;
try { localStorage.setItem(KEY, name); } catch {}
tabs.forEach((t) => {
const on = t.dataset.modelsTab === name;
t.classList.toggle('active', on);
t.setAttribute('aria-selected', on ? 'true' : 'false');
// Inline style swap so we don't need a CSS rule for active.
t.style.borderBottomColor = on ? 'var(--accent, var(--red))' : 'transparent';
t.style.color = on ? 'var(--fg)' : 'var(--fg-muted)';
});
panes.forEach((p) => {
p.classList.toggle('hidden', p.dataset.modelsPane !== name);
});
};
tabs.forEach((t) => t.addEventListener('click', () => apply(t.dataset.modelsTab)));
apply(active);
})();
document.querySelectorAll('.adm-quickstart-section').forEach((sec) => {
const head = sec.querySelector('.adm-quickstart-toggle');
if (!head) return;