mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 06:51:16 +08:00
fix(doctor): accept bare custom provider
This commit is contained in:
@@ -320,7 +320,11 @@ def run_doctor(args):
|
|||||||
known_providers.add("custom:" + name.lower().replace(" ", "-"))
|
known_providers.add("custom:" + name.lower().replace(" ", "-"))
|
||||||
|
|
||||||
canonical_provider = provider
|
canonical_provider = provider
|
||||||
if provider and _resolve_provider_full is not None and provider != "auto":
|
if (
|
||||||
|
provider
|
||||||
|
and _resolve_provider_full is not None
|
||||||
|
and provider not in ("auto", "custom")
|
||||||
|
):
|
||||||
provider_def = _resolve_provider_full(provider, user_providers, custom_providers)
|
provider_def = _resolve_provider_full(provider, user_providers, custom_providers)
|
||||||
canonical_provider = provider_def.id if provider_def is not None else None
|
canonical_provider = provider_def.id if provider_def is not None else None
|
||||||
|
|
||||||
|
|||||||
@@ -308,6 +308,43 @@ def test_run_doctor_accepts_named_provider_from_providers_section(monkeypatch, t
|
|||||||
assert "model.provider 'volcengine-plan' is not a recognised provider" not in out
|
assert "model.provider 'volcengine-plan' is not a recognised provider" not in out
|
||||||
|
|
||||||
|
|
||||||
|
def test_run_doctor_accepts_bare_custom_provider(monkeypatch, tmp_path):
|
||||||
|
home = tmp_path / ".hermes"
|
||||||
|
home.mkdir(parents=True, exist_ok=True)
|
||||||
|
(home / "config.yaml").write_text(
|
||||||
|
"model:\n"
|
||||||
|
" provider: custom\n"
|
||||||
|
" default: local-model\n"
|
||||||
|
" base_url: http://localhost:8000/v1\n",
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
|
||||||
|
monkeypatch.setattr(doctor_mod, "HERMES_HOME", home)
|
||||||
|
monkeypatch.setattr(doctor_mod, "PROJECT_ROOT", tmp_path / "project")
|
||||||
|
monkeypatch.setattr(doctor_mod, "_DHH", str(home))
|
||||||
|
(tmp_path / "project").mkdir(exist_ok=True)
|
||||||
|
|
||||||
|
fake_model_tools = types.SimpleNamespace(
|
||||||
|
check_tool_availability=lambda *a, **kw: ([], []),
|
||||||
|
TOOLSET_REQUIREMENTS={},
|
||||||
|
)
|
||||||
|
monkeypatch.setitem(sys.modules, "model_tools", fake_model_tools)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from hermes_cli import auth as _auth_mod
|
||||||
|
monkeypatch.setattr(_auth_mod, "get_nous_auth_status", lambda: {})
|
||||||
|
monkeypatch.setattr(_auth_mod, "get_codex_auth_status", lambda: {})
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
buf = io.StringIO()
|
||||||
|
with contextlib.redirect_stdout(buf):
|
||||||
|
doctor_mod.run_doctor(Namespace(fix=False))
|
||||||
|
|
||||||
|
out = buf.getvalue()
|
||||||
|
assert "model.provider 'custom' is not a recognised provider" not in out
|
||||||
|
|
||||||
|
|
||||||
def test_run_doctor_termux_does_not_mark_browser_available_without_agent_browser(monkeypatch, tmp_path):
|
def test_run_doctor_termux_does_not_mark_browser_available_without_agent_browser(monkeypatch, tmp_path):
|
||||||
home = tmp_path / ".hermes"
|
home = tmp_path / ".hermes"
|
||||||
home.mkdir(parents=True, exist_ok=True)
|
home.mkdir(parents=True, exist_ok=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user