mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(tui): /model picker surfaces curated list, matching classic CLI (#12671)
model.options unconditionally overwrote each provider's curated model list with provider_model_ids() (live /models catalog), so TUI users saw non-agentic models that classic CLI /model and `hermes model` filter out via the curated _PROVIDER_MODELS source. On Nous specifically the live endpoint returns ~380 IDs including TTS, embeddings, rerankers, and image/video generators — the TUI picker showed all of them. Classic CLI picker showed the curated 30-model list. Drop the overwrite. list_authenticated_providers() already populates provider['models'] with the curated list (same source as classic CLI at cli.py:4792), sliced to max_models=50. Honor that. Added regression test that fails if the handler ever re-introduces a provider_model_ids() call over the curated list.
This commit is contained in:
parent
d393104bad
commit
ddd28329ff
2 changed files with 82 additions and 9 deletions
|
|
@ -2499,27 +2499,24 @@ def _(rid, params: dict) -> dict:
|
|||
def _(rid, params: dict) -> dict:
|
||||
try:
|
||||
from hermes_cli.model_switch import list_authenticated_providers
|
||||
from hermes_cli.models import provider_model_ids
|
||||
|
||||
session = _sessions.get(params.get("session_id", ""))
|
||||
agent = session.get("agent") if session else None
|
||||
cfg = _load_cfg()
|
||||
current_provider = getattr(agent, "provider", "") or ""
|
||||
current_model = getattr(agent, "model", "") or _resolve_model()
|
||||
# list_authenticated_providers already populates each provider's
|
||||
# "models" with the curated list (same source as `hermes model` and
|
||||
# classic CLI's /model picker). Do NOT overwrite with live
|
||||
# provider_model_ids() — that bypasses curation and pulls in
|
||||
# non-agentic models (e.g. Nous /models returns ~400 IDs including
|
||||
# TTS, embeddings, rerankers, image/video generators).
|
||||
providers = list_authenticated_providers(
|
||||
current_provider=current_provider,
|
||||
user_providers=cfg.get("providers") if isinstance(cfg.get("providers"), dict) else {},
|
||||
custom_providers=cfg.get("custom_providers") if isinstance(cfg.get("custom_providers"), list) else [],
|
||||
max_models=50,
|
||||
)
|
||||
for provider in providers:
|
||||
try:
|
||||
models = provider_model_ids(provider.get("slug"))
|
||||
if models:
|
||||
provider["models"] = models
|
||||
provider["total_models"] = len(models)
|
||||
except Exception as e:
|
||||
provider["warning"] = f"model catalog unavailable: {e}"
|
||||
return _ok(rid, {"providers": providers, "model": current_model, "provider": current_provider})
|
||||
except Exception as e:
|
||||
return _err(rid, 5033, str(e))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue