mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(models): preserve OpenRouter variant tags (:free, :extended, :fast) during model switch (#6383)
Step c in switch_model() blindly converted the first colon to a slash for aggregator providers, even when the model name already contained a slash (vendor/model format). This mangled variant tags like :free into /free, causing 400 Bad Request from the API. Fix: skip the colon→slash conversion when the model already has a slash, since the colon is a variant tag, not a vendor separator. The module docstring already documented this intent (line 17-18) but the implementation didn't enforce it. Reported via Discord. Related to PR #6088 (which identified the same bug but placed the fix in model_normalize.py instead of model_switch.py where the actual mangling occurs).
This commit is contained in:
parent
ae4a884e8d
commit
980fadfea9
2 changed files with 74 additions and 1 deletions
|
|
@ -537,8 +537,11 @@ def switch_model(
|
|||
)
|
||||
else:
|
||||
# --- Step c: On aggregator, convert vendor:model to vendor/model ---
|
||||
# Only convert when there's no slash — a slash means the name
|
||||
# is already in vendor/model format and the colon is a variant
|
||||
# tag (:free, :extended, :fast) that must be preserved.
|
||||
colon_pos = raw_input.find(":")
|
||||
if colon_pos > 0 and is_aggregator(current_provider):
|
||||
if colon_pos > 0 and "/" not in raw_input and is_aggregator(current_provider):
|
||||
left = raw_input[:colon_pos].strip().lower()
|
||||
right = raw_input[colon_pos + 1:].strip()
|
||||
if left and right:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue