mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
fix(model_switch): preserve explicit custom-provider model list when no api_key
This commit is contained in:
parent
bfcab25dcd
commit
0b491c466a
1 changed files with 16 additions and 1 deletions
|
|
@ -1692,7 +1692,22 @@ def list_authenticated_providers(
|
|||
# Ollama servers) — the /models endpoint often works without
|
||||
# auth. The CLI's _model_flow_named_custom always probes, so
|
||||
# the Telegram/Discord picker should do the same for parity.
|
||||
if api_url:
|
||||
# Live-discovery policy:
|
||||
# - With an api_key, the user has explicitly opted into the
|
||||
# endpoint and live /models is the source of truth — replace
|
||||
# the (possibly partial) ``models:`` subset configured for
|
||||
# context-length overrides with the full live catalog.
|
||||
# This is the Bifrost / aggregator-gateway case.
|
||||
# - Without an api_key but with an explicit ``models:`` list
|
||||
# (or top-level ``model:``), the user is narrowing a public
|
||||
# endpoint to a specific subset (e.g. ollama.com /v1/models
|
||||
# returns 35 models but the user only wants 4). Preserve the
|
||||
# explicit list and skip live discovery.
|
||||
# - Without an api_key AND no explicit models, fall through to
|
||||
# live discovery so bare-endpoint custom providers (local
|
||||
# llama.cpp / Ollama servers) still appear populated.
|
||||
should_probe = bool(api_url) and (bool(api_key) or not grp["models"])
|
||||
if should_probe:
|
||||
try:
|
||||
from hermes_cli.models import fetch_api_models
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue