From 9fde22d2333986758c85a8ea1524d3fdb3a3f418 Mon Sep 17 00:00:00 2001 From: Yindong Date: Fri, 24 Apr 2026 00:54:12 +0800 Subject: [PATCH] fix the reset of model change by /model. --- cli.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cli.py b/cli.py index abd4d2391e..424594acf8 100644 --- a/cli.py +++ b/cli.py @@ -3176,7 +3176,14 @@ class HermesCLI: # the configured model (e.g. "qwen3.6-plus"), causing 400 errors. runtime_model = runtime.get("model") if runtime_model and isinstance(runtime_model, str): - self.model = runtime_model + # Only use runtime model if: model is unset, or model equals provider name + should_use_runtime_model = ( + not self.model or # No model configured yet + self.model == self.provider or # Model is the provider slug + self.model == runtime.get("name") # Model matches provider display name + ) + if should_use_runtime_model: + self.model = runtime_model # If model is still empty (e.g. user ran `hermes auth add openai-codex` # without `hermes model`), fall back to the provider's first catalog