refactor(hermes_cli): nous_subscription/keepalive — reuse _norm, trim padding

This commit is contained in:
Teknium
2026-09-02 21:57:34 -07:00
parent 3b7002b623
commit c6c2a5dcd2
2 changed files with 5 additions and 6 deletions
-1
View File
@@ -67,7 +67,6 @@ def _interval_seconds(value: Optional[int]) -> int:
return int(value)
except (TypeError, ValueError):
return NOUS_AUTH_KEEPALIVE_INTERVAL_SECONDS
raw = _nous_config().get(NOUS_AUTH_KEEPALIVE_INTERVAL_CONFIG_KEY)
if raw is None or (isinstance(raw, str) and not raw.strip()):
return NOUS_AUTH_KEEPALIVE_INTERVAL_SECONDS
+5 -5
View File
@@ -157,15 +157,15 @@ def _select_nous(config: Dict[str, object], key: str) -> None:
section.pop("use_gateway", None)
def _provider_is_nous(config: Dict[str, object]) -> bool:
model_cfg = config.get("model")
return isinstance(model_cfg, dict) and str(model_cfg.get("provider") or "").strip().lower() == "nous"
def _norm(value: object, default: str = "") -> str:
return str(value or default).strip().lower()
def _provider_is_nous(config: Dict[str, object]) -> bool:
model_cfg = config.get("model")
return isinstance(model_cfg, dict) and _norm(model_cfg.get("provider")) == "nous"
def _toolset_enabled(config: Dict[str, object], toolset_key: str) -> bool:
"""True when some platform's configured toolsets cover every tool of ``toolset_key``."""
from toolsets import resolve_toolset