Fix #5211: Preserve dots in OpenCode Go model names
OpenCode Go model names with dots (minimax-m2.7, glm-4.5, kimi-k2.5) were being mangled to hyphens (minimax-m2-7), causing HTTP 401 errors. Two code paths were affected: 1. model_normalize.py: opencode-go was incorrectly in DOT_TO_HYPHEN_PROVIDERS 2. run_agent.py: _anthropic_preserve_dots() did not check for opencode-go Fix: - Remove opencode-go from _DOT_TO_HYPHEN_PROVIDERS (dots are correct for Go) - Add opencode-go to _anthropic_preserve_dots() provider check - Add opencode.ai/zen/go to base_url fallback check - Add regression tests in tests/test_model_normalize.py Co-authored-by: jacob3712 <jacob3712@users.noreply.github.com>
This commit is contained in:
@@ -5224,11 +5224,13 @@ class AIAgent:
|
||||
return transformed
|
||||
|
||||
def _anthropic_preserve_dots(self) -> bool:
|
||||
"""True when using Alibaba/DashScope anthropic-compatible endpoint (model names keep dots, e.g. qwen3.5-plus)."""
|
||||
if (getattr(self, "provider", "") or "").lower() == "alibaba":
|
||||
"""True when using an anthropic-compatible endpoint that preserves dots in model names.
|
||||
Alibaba/DashScope keeps dots (e.g. qwen3.5-plus).
|
||||
OpenCode Go keeps dots (e.g. minimax-m2.7)."""
|
||||
if (getattr(self, "provider", "") or "").lower() in {"alibaba", "opencode-go"}:
|
||||
return True
|
||||
base = (getattr(self, "base_url", "") or "").lower()
|
||||
return "dashscope" in base or "aliyuncs" in base
|
||||
return "dashscope" in base or "aliyuncs" in base or "opencode.ai/zen/go" in base
|
||||
|
||||
def _build_api_kwargs(self, api_messages: list) -> dict:
|
||||
"""Build the keyword arguments dict for the active API mode."""
|
||||
|
||||
Reference in New Issue
Block a user