Skip to content

The agent that grows with you

perf(cli): cap /model picker custom-endpoint probe at 1.5s

ZachariahChude0ce24c2e56
diff --git a/hermes_cli/model_switch.py b/hermes_cli/model_switch.py
index ef33260e2d5..252986ed30a 100644
--- a/hermes_cli/model_switch.py
+++ b/hermes_cli/model_switch.py
@@ -2702,6 +2702,7 @@ def list_authenticated_providers(
live_models = fetch_api_models(
api_key,
api_url,
+ timeout=1.5 if for_picker else 5.0, # picker: fail fast so a slow custom endpoint doesn't block /model
headers=_extra_headers_from_config(ep_cfg) or None,
)
if live_models:
@@ -2769,7 +2770,11 @@ def list_authenticated_providers(
try:
from hermes_cli.models import fetch_api_models
- _live_models = fetch_api_models("", str(current_base_url).strip().rstrip("/"))
+ _live_models = fetch_api_models(
+ "",
+ str(current_base_url).strip().rstrip("/"),
+ timeout=1.5 if for_picker else 5.0, # picker: fail fast on a slow current endpoint
+ )
if _live_models:
_models = _live_models
except Exception:
@@ -3012,6 +3017,7 @@ def list_authenticated_providers(
live_models = fetch_api_models(
api_key,
api_url,
+ timeout=1.5 if for_picker else 5.0, # picker: fail fast so a slow custom endpoint doesn't block /model
headers=grp.get("extra_headers") or None,
)
if live_models: