admin: show whisper-servers as gguf configs again, edit via whisper editor

Reverted the over-correction that hid whisper-server entries from the
backing GGUF file's config list — they should appear there (the file is
configured through them). To avoid the duplicate-config bug, editing a
whisper-server config from the GGUF row now routes to the whisper editor
(which updates in place by id) instead of the general config modal. Pills
for whisper-server configs are labelled by id so the two instances are
distinguishable (they share the "whisper" alias).
Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
parent ea8dd92c
......@@ -1312,14 +1312,13 @@ def _scan_caches() -> dict:
if isinstance(m, str):
p, s = m, {}
else:
# Whisper-server models are managed in their own card, not as
# editable configs of the backing GGUF file. Including them here
# (keyed by model_path) made them appear as the file's configs —
# and since they carry no config_id, "Configure" on the GGUF row
# treated every save as a brand-new config, spawning duplicates.
# Skip them; the file still shows "loaded" via its model_path key.
if m.get("backend") == "whisper-server":
continue
# Whisper-server entries have no "path"; their file is at
# "model_path", so they surface as configs of the backing GGUF
# file. The UI routes editing such a config to the whisper editor
# (which updates in place), so they no longer spawn duplicates.
if m.get("backend") == "whisper-server" and m.get("model_path"):
p = m["model_path"]
else:
p = m.get("path") or m.get("id") or ""
s = m if isinstance(m, dict) else {}
if not p:
......
......@@ -1934,7 +1934,12 @@ function _renderConfigPills(idx, m) {
const configs = m.configs || [];
if (!configs.length) return '';
const pills = configs.map((c, cfgIdx) => {
const label = (c.settings && (c.settings.config_name || c.settings.alias)) || `Config ${cfgIdx + 1}`;
const cs = c.settings || {};
// Whisper-server configs share the same alias ("whisper"); label them by id
// so the two instances are distinguishable.
const label = cs.config_name
|| (cs.backend === 'whisper-server' ? cs.id : cs.alias)
|| `Config ${cfgIdx + 1}`;
return `<span class="badge badge-user" style="font-size:10px;cursor:pointer;vertical-align:middle;margin:.1rem .1rem 0 0" onclick="openCfgModal(${idx},${cfgIdx})" title="Edit this configuration">${esc(label)}</span>${_engineTagHtml(m, c.settings)}`;
}).join('');
const addPill = `<span class="badge" style="font-size:10px;cursor:pointer;vertical-align:middle;margin:.1rem 0 0 0;background:var(--raised);border:1px dashed var(--border);color:var(--text-2)" onclick="openCfgModalNew(${idx})" title="Add another configuration for this model">+ Config</span>`;
......@@ -2990,6 +2995,15 @@ function openCfgModal(idx, cfgIdx){
}
// Determine which config's settings to load
const configs = m.configs || [];
// A whisper-server can appear as a config of its backing GGUF file. Editing it
// must go through the whisper editor (updates in place by id) — not the general
// modal, which would treat it as a config_id-less entry and create duplicates.
const _sel = (cfgIdx != null && cfgIdx >= 0) ? configs[cfgIdx] : (configs[0] || null);
if (_sel && (_sel.settings || {}).backend === 'whisper-server') {
const s = _sel.settings;
_openWhisperServerEdit({ path: s.id, settings: s });
return;
}
// Normalize cfgIdx: undefined/null → 0, -1 → "new"
const _cfgIdx = (cfgIdx == null) ? 0 : cfgIdx;
let s, configId, isNewConfig;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment