From 851857e413a6acf591cf4f00ad58abc48fe6316a Mon Sep 17 00:00:00 2001 From: cokemine Date: Thu, 9 Apr 2026 16:15:37 +0900 Subject: [PATCH] fix(models): correct probed_url selection logic Updated the logic for determining the probed_url in the probe_api_models function to use the first tried URL instead of the last. This change ensures that the most relevant URL is returned when probing for models. Additionally, improved the output message in the _model_flow_custom function to provide clearer guidance based on the suggested_base_url. --- hermes_cli/main.py | 6 +++++- hermes_cli/models.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hermes_cli/main.py b/hermes_cli/main.py index 5b180fc2..96345c48 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -1474,7 +1474,11 @@ def _model_flow_custom(config): f"Hermes will still save it." ) if probe.get("suggested_base_url"): - print(f" If this server expects /v1, try base URL: {probe['suggested_base_url']}") + suggested = probe["suggested_base_url"] + if suggested.endswith("/v1"): + print(f" If this server expects /v1 in the path, try base URL: {suggested}") + else: + print(f" If /v1 should not be in the base URL, try: {suggested}") # Select model — use probe results when available, fall back to manual input model_name = "" diff --git a/hermes_cli/models.py b/hermes_cli/models.py index ce89bdea..b55249a7 100644 --- a/hermes_cli/models.py +++ b/hermes_cli/models.py @@ -1532,7 +1532,7 @@ def probe_api_models( return { "models": None, - "probed_url": tried[-1] if tried else normalized.rstrip("/") + "/models", + "probed_url": tried[0] if tried else normalized.rstrip("/") + "/models", "resolved_base_url": normalized, "suggested_base_url": alternate_base if alternate_base != normalized else None, "used_fallback": False,