mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-20 15:33:54 +00:00
fix: silent no-model default is GLM-5.2, never the Anthropic flagship (#64635)
When a user starts a chat without ever selecting a model (GUI Chat App onboarding, provider-set-but-model-missing config, empty model.default), every silent fallback path resolved to the first curated catalog entry — anthropic/claude-fable-5, the priciest flagship. Users were silently billed for the most expensive model without opting in. - hermes_cli/models.py: add PREFERRED_SILENT_DEFAULT_MODEL (z-ai/glm-5.2) + pick_silent_default_model() helper; point the nous silent-default override at it and add an openrouter override (previously resolved to "" and let downstream paths land on the flagship). - hermes_cli/web_server.py: /api/model/recommended-default (the endpoint the Desktop onboarding confirm card reads) now picks GLM-5.2 when the provider's list carries it instead of blindly taking entry [0]. - tui_gateway/server.py: _resolve_model()'s last-resort literal was anthropic/claude-sonnet-4; now PREFERRED_SILENT_DEFAULT_MODEL. - tests: update empty-model fallback tests for the new contract.
This commit is contained in:
parent
5d410355ac
commit
080daa3f42
4 changed files with 68 additions and 21 deletions
|
|
@ -5576,6 +5576,7 @@ def get_recommended_default_model(provider: str = ""):
|
|||
get_pricing_for_provider,
|
||||
check_nous_free_tier,
|
||||
partition_nous_models_by_tier,
|
||||
pick_silent_default_model,
|
||||
union_with_portal_free_recommendations,
|
||||
union_with_portal_paid_recommendations,
|
||||
)
|
||||
|
|
@ -5604,21 +5605,25 @@ def get_recommended_default_model(provider: str = ""):
|
|||
model_ids, pricing, portal_url
|
||||
)
|
||||
|
||||
model = model_ids[0] if model_ids else ""
|
||||
model = pick_silent_default_model(model_ids)
|
||||
return {"provider": "nous", "model": model, "free_tier": bool(free_tier)}
|
||||
except Exception:
|
||||
_log.exception("GET /api/model/recommended-default (nous) failed")
|
||||
return {"provider": "nous", "model": "", "free_tier": None}
|
||||
|
||||
# Non-Nous: first curated model for the provider, matching prior behaviour.
|
||||
# Non-Nous: preferred silent default when the provider's curated list
|
||||
# carries it, else the first curated model. Aggregator lists lead with the
|
||||
# priciest Anthropic flagship (claude-fable-5), which must never be the
|
||||
# model a user lands on without explicitly picking it.
|
||||
try:
|
||||
from hermes_cli.inventory import build_models_payload, load_picker_context
|
||||
from hermes_cli.models import pick_silent_default_model
|
||||
|
||||
payload = build_models_payload(load_picker_context())
|
||||
for row in payload.get("providers", []):
|
||||
if str(row.get("slug", "")).lower() == slug:
|
||||
models = row.get("models") or []
|
||||
return {"provider": slug, "model": models[0] if models else "", "free_tier": None}
|
||||
models = [str(m) for m in (row.get("models") or [])]
|
||||
return {"provider": slug, "model": pick_silent_default_model(models), "free_tier": None}
|
||||
return {"provider": slug, "model": "", "free_tier": None}
|
||||
except Exception:
|
||||
_log.exception("GET /api/model/recommended-default failed")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue