mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-01 16:31:56 +08:00
Compare commits
2 Commits
fix/plugin
...
hermes/her
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7b3c8797f | ||
|
|
c038ba35bb |
@@ -407,12 +407,6 @@ def resolve_runtime_provider(
|
|||||||
# (e.g. https://api.minimax.io/anthropic, https://dashscope.../anthropic)
|
# (e.g. https://api.minimax.io/anthropic, https://dashscope.../anthropic)
|
||||||
elif base_url.rstrip("/").endswith("/anthropic"):
|
elif base_url.rstrip("/").endswith("/anthropic"):
|
||||||
api_mode = "anthropic_messages"
|
api_mode = "anthropic_messages"
|
||||||
# MiniMax providers always use Anthropic Messages API.
|
|
||||||
# Auto-correct stale /v1 URLs (from old .env or config) to /anthropic.
|
|
||||||
elif provider in ("minimax", "minimax-cn"):
|
|
||||||
api_mode = "anthropic_messages"
|
|
||||||
if base_url.rstrip("/").endswith("/v1"):
|
|
||||||
base_url = base_url.rstrip("/")[:-3] + "/anthropic"
|
|
||||||
return {
|
return {
|
||||||
"provider": provider,
|
"provider": provider,
|
||||||
"api_mode": api_mode,
|
"api_mode": api_mode,
|
||||||
|
|||||||
17
run_agent.py
17
run_agent.py
@@ -3903,6 +3903,23 @@ class AIAgent:
|
|||||||
_fire_first_delta()
|
_fire_first_delta()
|
||||||
self._fire_stream_delta(delta.content)
|
self._fire_stream_delta(delta.content)
|
||||||
deltas_were_sent["yes"] = True
|
deltas_were_sent["yes"] = True
|
||||||
|
else:
|
||||||
|
# Tool calls suppress regular content streaming (avoids
|
||||||
|
# displaying chatty "I'll use the tool..." text alongside
|
||||||
|
# tool calls). But reasoning tags embedded in suppressed
|
||||||
|
# content should still reach the display — otherwise the
|
||||||
|
# reasoning box only appears as a post-response fallback,
|
||||||
|
# rendering it confusingly after the already-streamed
|
||||||
|
# response. Route suppressed content through the stream
|
||||||
|
# delta callback so its tag extraction can fire the
|
||||||
|
# reasoning display. Non-reasoning text is harmlessly
|
||||||
|
# suppressed by the CLI's _stream_delta when the stream
|
||||||
|
# box is already closed (tool boundary flush).
|
||||||
|
if self.stream_delta_callback:
|
||||||
|
try:
|
||||||
|
self.stream_delta_callback(delta.content)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
# Accumulate tool call deltas — notify display on first name
|
# Accumulate tool call deltas — notify display on first name
|
||||||
if delta and delta.tool_calls:
|
if delta and delta.tool_calls:
|
||||||
|
|||||||
@@ -493,22 +493,22 @@ def test_minimax_default_url_uses_anthropic_messages(monkeypatch):
|
|||||||
assert resolved["base_url"] == "https://api.minimax.io/anthropic"
|
assert resolved["base_url"] == "https://api.minimax.io/anthropic"
|
||||||
|
|
||||||
|
|
||||||
def test_minimax_stale_v1_url_auto_corrected(monkeypatch):
|
def test_minimax_v1_url_uses_chat_completions(monkeypatch):
|
||||||
"""MiniMax with stale /v1 base URL should be auto-corrected to /anthropic."""
|
"""MiniMax with /v1 base URL should use chat_completions (user override for regions where /anthropic 404s)."""
|
||||||
monkeypatch.setattr(rp, "resolve_provider", lambda *a, **k: "minimax")
|
monkeypatch.setattr(rp, "resolve_provider", lambda *a, **k: "minimax")
|
||||||
monkeypatch.setattr(rp, "_get_model_config", lambda: {})
|
monkeypatch.setattr(rp, "_get_model_config", lambda: {})
|
||||||
monkeypatch.setenv("MINIMAX_API_KEY", "test-minimax-key")
|
monkeypatch.setenv("MINIMAX_API_KEY", "test-minimax-key")
|
||||||
monkeypatch.setenv("MINIMAX_BASE_URL", "https://api.minimax.io/v1")
|
monkeypatch.setenv("MINIMAX_BASE_URL", "https://api.minimax.chat/v1")
|
||||||
|
|
||||||
resolved = rp.resolve_runtime_provider(requested="minimax")
|
resolved = rp.resolve_runtime_provider(requested="minimax")
|
||||||
|
|
||||||
assert resolved["provider"] == "minimax"
|
assert resolved["provider"] == "minimax"
|
||||||
assert resolved["api_mode"] == "anthropic_messages"
|
assert resolved["api_mode"] == "chat_completions"
|
||||||
assert resolved["base_url"] == "https://api.minimax.io/anthropic"
|
assert resolved["base_url"] == "https://api.minimax.chat/v1"
|
||||||
|
|
||||||
|
|
||||||
def test_minimax_cn_stale_v1_url_auto_corrected(monkeypatch):
|
def test_minimax_cn_v1_url_uses_chat_completions(monkeypatch):
|
||||||
"""MiniMax-CN with stale /v1 base URL should be auto-corrected to /anthropic."""
|
"""MiniMax-CN with /v1 base URL should use chat_completions (user override)."""
|
||||||
monkeypatch.setattr(rp, "resolve_provider", lambda *a, **k: "minimax-cn")
|
monkeypatch.setattr(rp, "resolve_provider", lambda *a, **k: "minimax-cn")
|
||||||
monkeypatch.setattr(rp, "_get_model_config", lambda: {})
|
monkeypatch.setattr(rp, "_get_model_config", lambda: {})
|
||||||
monkeypatch.setenv("MINIMAX_CN_API_KEY", "test-minimax-cn-key")
|
monkeypatch.setenv("MINIMAX_CN_API_KEY", "test-minimax-cn-key")
|
||||||
@@ -517,8 +517,8 @@ def test_minimax_cn_stale_v1_url_auto_corrected(monkeypatch):
|
|||||||
resolved = rp.resolve_runtime_provider(requested="minimax-cn")
|
resolved = rp.resolve_runtime_provider(requested="minimax-cn")
|
||||||
|
|
||||||
assert resolved["provider"] == "minimax-cn"
|
assert resolved["provider"] == "minimax-cn"
|
||||||
assert resolved["api_mode"] == "anthropic_messages"
|
assert resolved["api_mode"] == "chat_completions"
|
||||||
assert resolved["base_url"] == "https://api.minimaxi.com/anthropic"
|
assert resolved["base_url"] == "https://api.minimaxi.com/v1"
|
||||||
|
|
||||||
|
|
||||||
def test_minimax_explicit_api_mode_respected(monkeypatch):
|
def test_minimax_explicit_api_mode_respected(monkeypatch):
|
||||||
|
|||||||
Reference in New Issue
Block a user