mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-22 16:25:58 +00:00
Adds --once to /model across CLI, TUI, and gateway: switch model for the next turn only, restoring the previous model in a finally block so success, exception, and interrupt all revert. Parsing extends parse_model_flags_detailed(); resolve_persist_behavior() treats --once as a persistence opt-out; --global + --once is rejected. Salvaged from PR #29923 (image-generation lane split to #59815 per review; conflict resolution against current main by the maintainers).
22 lines
776 B
Python
22 lines
776 B
Python
from hermes_cli.model_switch import parse_model_flags, parse_model_flags_detailed
|
|
|
|
|
|
def test_parse_model_flags_detailed_supports_once():
|
|
parsed = parse_model_flags_detailed("sonnet --provider anthropic --once")
|
|
|
|
assert parsed.model_input == "sonnet"
|
|
assert parsed.explicit_provider == "anthropic"
|
|
assert parsed.is_global is False
|
|
assert parsed.force_refresh is False
|
|
assert parsed.is_session is False
|
|
assert parsed.is_once is True
|
|
|
|
|
|
def test_parse_model_flags_legacy_wrapper_strips_once():
|
|
model_input, provider, is_global, force_refresh, is_session = parse_model_flags("sonnet --once")
|
|
|
|
assert model_input == "sonnet"
|
|
assert provider == ""
|
|
assert is_global is False
|
|
assert force_refresh is False
|
|
assert is_session is False
|