admin: show models pinned to a secondary engine (whisper form + loaded)

/admin/api/models is served by the primary engine and ran list_models()
with the per-engine assignment filter, so models pinned to a secondary
engine (whisper-servers configured with engine=radeon) were dropped. That
emptied the whisper-server config form and left those models unmatched in
the loaded-status check, so they never showed as loaded.

Add list_models(all_engines=True) to bypass _entry_assigned, and call it
from the admin model list. Combined with the whisper-servers now reported
in /internal/engine-state, the radeon whisper-servers reappear in their own
form and show as loaded.
Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
parent 801d21a9
...@@ -692,7 +692,10 @@ async def api_list_models(username: str = Depends(require_admin)): ...@@ -692,7 +692,10 @@ async def api_list_models(username: str = Depends(require_admin)):
models_data = session_manager._load_auth_data() # TODO: move to ModelManager models_data = session_manager._load_auth_data() # TODO: move to ModelManager
from codai.models.manager import multi_model_manager from codai.models.manager import multi_model_manager
try: try:
return multi_model_manager.list_models() # all_engines=True: the admin config view must show every configured model,
# including ones pinned to a secondary engine (e.g. whisper-servers on the
# radeon engine) which the per-engine assignment filter would otherwise hide.
return multi_model_manager.list_models(all_engines=True)
except Exception: except Exception:
return [] return []
......
...@@ -3969,8 +3969,13 @@ class MultiModelManager: ...@@ -3969,8 +3969,13 @@ class MultiModelManager:
return info.id return info.id
return None return None
def list_models(self) -> List[ModelInfo]: def list_models(self, all_engines: bool = False) -> List[ModelInfo]:
"""List all available models (configured + runtime aliases) with type/capability metadata.""" """List all available models (configured + runtime aliases) with type/capability metadata.
all_engines=True bypasses the per-engine assignment filter so the admin
config UI sees every configured model — otherwise, on a multi-engine node,
models pinned to a secondary engine (e.g. whisper-servers on `radeon`) are
hidden from the primary's list, which serves /admin/api/models."""
from codai.models.capabilities import detect_model_capabilities, ModelCapabilities from codai.models.capabilities import detect_model_capabilities, ModelCapabilities
models = [] models = []
...@@ -4048,7 +4053,8 @@ class MultiModelManager: ...@@ -4048,7 +4053,8 @@ class MultiModelManager:
for m in md.get(cat, []): for m in md.get(cat, []):
# Only list models the front assigned to THIS engine (so a # Only list models the front assigned to THIS engine (so a
# per-engine /v1/models reflects what it actually serves). # per-engine /v1/models reflects what it actually serves).
if not self._entry_assigned(m): # The admin config view passes all_engines=True to see them all.
if not all_engines and not self._entry_assigned(m):
continue continue
if isinstance(m, str): if isinstance(m, str):
mid = m mid = m
......
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