feat: /provider command + fix gateway bugs + harden parse_model_input
/provider command (CLI + gateway):
Shows all providers with auth status (✓/✗), aliases, and active marker.
Users can now discover what provider names work with provider:model syntax.
Gateway bugs fixed:
- Config was saved even when validation.persist=False (told user 'session
only' but actually persisted the unvalidated model)
- HERMES_INFERENCE_PROVIDER env var not set on provider switch, causing
the switch to be silently overridden if that env var was already set
parse_model_input hardened:
- Colon only treated as provider delimiter if left side is a recognized
provider name or alias. 'anthropic/claude-3.5-sonnet:beta' now passes
through as a model name instead of trying provider='anthropic/claude-3.5-sonnet'.
- HTTP URLs, random colons no longer misinterpreted.
56 tests passing across model validation, CLI commands, and integration.
This commit is contained in:
parent
34792dd907
commit
666f2dd486
6 changed files with 169 additions and 20 deletions
|
|
@ -8,10 +8,11 @@ from hermes_cli.commands import COMMANDS, SlashCommandCompleter
|
|||
|
||||
# All commands that must be present in the shared COMMANDS dict.
|
||||
EXPECTED_COMMANDS = {
|
||||
"/help", "/tools", "/toolsets", "/model", "/prompt", "/personality",
|
||||
"/clear", "/history", "/new", "/reset", "/retry", "/undo", "/save",
|
||||
"/config", "/cron", "/skills", "/platforms", "/verbose", "/compress",
|
||||
"/usage", "/insights", "/paste", "/reload-mcp", "/quit",
|
||||
"/help", "/tools", "/toolsets", "/model", "/provider", "/prompt",
|
||||
"/personality", "/clear", "/history", "/new", "/reset", "/retry",
|
||||
"/undo", "/save", "/config", "/cron", "/skills", "/platforms",
|
||||
"/verbose", "/compress", "/usage", "/insights", "/paste",
|
||||
"/reload-mcp", "/quit",
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,17 @@ class TestParseModelInput:
|
|||
assert provider == "openrouter"
|
||||
assert model == ":something"
|
||||
|
||||
def test_unknown_prefix_colon_not_treated_as_provider(self):
|
||||
"""Colons are only provider delimiters if the left side is a known provider."""
|
||||
provider, model = parse_model_input("anthropic/claude-3.5-sonnet:beta", "openrouter")
|
||||
assert provider == "openrouter"
|
||||
assert model == "anthropic/claude-3.5-sonnet:beta"
|
||||
|
||||
def test_http_url_not_treated_as_provider(self):
|
||||
provider, model = parse_model_input("http://localhost:8080/model", "openrouter")
|
||||
assert provider == "openrouter"
|
||||
assert model == "http://localhost:8080/model"
|
||||
|
||||
|
||||
# -- curated_models_for_provider ---------------------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue