mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 06:51:16 +08:00
fix(tui): sync inference model after switches
- keep HERMES_INFERENCE_MODEL aligned with HERMES_MODEL after in-TUI model switches - clarify static provider detection remapping docs
This commit is contained in:
@@ -1452,7 +1452,8 @@ def detect_static_provider_for_model(
|
|||||||
) -> Optional[tuple[str, str]]:
|
) -> Optional[tuple[str, str]]:
|
||||||
"""Auto-detect a provider from static catalogs only.
|
"""Auto-detect a provider from static catalogs only.
|
||||||
|
|
||||||
Returns ``(provider_id, model_name)`` — the model name may be remapped
|
Returns ``(provider_id, model_name)``. The model name may be remapped
|
||||||
|
when a static alias or bare provider name resolves to a catalog default.
|
||||||
Returns ``None`` when no confident match is found.
|
Returns ``None`` when no confident match is found.
|
||||||
"""
|
"""
|
||||||
name = (model_name or "").strip()
|
name = (model_name or "").strip()
|
||||||
|
|||||||
@@ -562,6 +562,8 @@ def test_config_set_model_syncs_tui_provider_env(monkeypatch):
|
|||||||
|
|
||||||
assert resp["result"]["value"] == "anthropic/claude-sonnet-4.6"
|
assert resp["result"]["value"] == "anthropic/claude-sonnet-4.6"
|
||||||
assert os.environ["HERMES_TUI_PROVIDER"] == "anthropic"
|
assert os.environ["HERMES_TUI_PROVIDER"] == "anthropic"
|
||||||
|
assert os.environ["HERMES_MODEL"] == "anthropic/claude-sonnet-4.6"
|
||||||
|
assert os.environ["HERMES_INFERENCE_MODEL"] == "anthropic/claude-sonnet-4.6"
|
||||||
finally:
|
finally:
|
||||||
server._sessions.clear()
|
server._sessions.clear()
|
||||||
|
|
||||||
|
|||||||
@@ -774,6 +774,7 @@ def _apply_model_switch(sid: str, session: dict, raw_input: str) -> dict:
|
|||||||
_emit("session.info", sid, _session_info(agent))
|
_emit("session.info", sid, _session_info(agent))
|
||||||
|
|
||||||
os.environ["HERMES_MODEL"] = result.new_model
|
os.environ["HERMES_MODEL"] = result.new_model
|
||||||
|
os.environ["HERMES_INFERENCE_MODEL"] = result.new_model
|
||||||
# Keep the process-level provider env var in sync with the user's explicit
|
# Keep the process-level provider env var in sync with the user's explicit
|
||||||
# choice so any ambient re-resolution (credential pool refresh, compressor
|
# choice so any ambient re-resolution (credential pool refresh, compressor
|
||||||
# rebuild, aux clients) resolves to the new provider instead of the
|
# rebuild, aux clients) resolves to the new provider instead of the
|
||||||
|
|||||||
Reference in New Issue
Block a user