Merge pull request #2004 from octo-patch/octo/minimax-m31-flash

feat: recommend MiniMax Flash and map current reasoning controls
This commit is contained in:
Bingxi Zhao
2026-10-28 01:00:44 +08:00
committed by GitHub
15 changed files with 552 additions and 16 deletions

View File

@@ -319,6 +319,7 @@ def _build_anthropic_adapter(config: LLMClientConfig, spec: Any) -> Any:
default_model=config.model or "claude-sonnet-4-20250514",
extra_headers=config.extra_headers,
supports_prompt_caching=spec.supports_prompt_caching,
binding=spec.name,
)
return _ProviderOpenAIAdapter(anthropic_provider)
@@ -428,6 +429,18 @@ class _ProviderOpenAIAdapter:
if max_tokens is None:
max_tokens = kwargs.pop("max_tokens", 4096)
reasoning_effort = kwargs.pop("reasoning_effort", None)
if getattr(self._provider, "_binding", "") in {"minimax", "minimax_anthropic"} and (
model or self._provider.default_model
).lower() in {"minimax-m3.1-flash", "minimax-m3"}:
# Convert the facade's OpenAI-only controls back to intent before
# the native Anthropic provider builds its protocol-specific body.
extra_body = dict(kwargs.pop("extra_body", None) or {})
thinking = extra_body.pop("thinking", None)
extra_body.pop("reasoning_split", None)
if thinking and reasoning_effort is None:
reasoning_effort = "none" if thinking.get("type") == "disabled" else "adaptive"
if extra_body:
kwargs["extra_body"] = extra_body
kwargs.pop("stream_options", None)
if stream:

View File

@@ -18,6 +18,7 @@ import aiohttp
from deeptutor.services.config import load_system_settings
from deeptutor.services.provider_registry import effective_backend, find_by_name
from .minimax_models import prioritize_model_names
from .utils import build_auth_headers, collect_model_names
logger = logging.getLogger(__name__)
@@ -102,9 +103,13 @@ async def fetch_models(
mapping = cast(Mapping[str, object], payload)
items = mapping.get("data")
if isinstance(items, list):
return collect_model_names(cast(list[object], items))
return prioritize_model_names(
collect_model_names(cast(list[object], items)), binding
)
elif isinstance(payload, list):
return collect_model_names(cast(list[object], payload))
return prioritize_model_names(
collect_model_names(cast(list[object], payload)), binding
)
return []
except Exception as e:
logger.error("Error fetching models from %s: %s", base_url, e)

View File

@@ -128,6 +128,11 @@ KNOWN_CONTEXT_WINDOWS: dict[str, int] = {
"minimax-m2.7": 204800,
"minimax-m2.7-highspeed": 204800,
"minimax-m3": 1000000,
# https://platform.minimax.io/docs/api-reference/text-openai-api (2026-10-20)
"minimax-m3.1-flash": 1000000,
# OpenRouter /api/v1/models (2026-10-20), not direct API capacities.
"minimax/minimax-m3.1-flash:free": 1000000,
"minimax/minimax-m3": 1048576,
"o1": 200000,
"o1-pro": 200000,
"o3": 200000,

View File

@@ -0,0 +1,15 @@
"""Order MiniMax discovery without discarding account-provided model IDs."""
from __future__ import annotations
def prioritize_model_names(names: list[str], binding: str) -> list[str]:
"""Prefer current defaults and retain every model returned by discovery."""
if binding not in {"minimax", "minimax_anthropic", "openrouter"}:
return names
prefix = "minimax/" if binding == "openrouter" else ""
flash = prefix + "minimax-m3.1-flash" + (":free" if prefix else "")
preferred = [flash, prefix + "minimax-m3"]
return sorted(
names, key=lambda name: preferred.index(name.lower()) if name.lower() in preferred else 2
)

View File

@@ -16,6 +16,7 @@ from typing import Any
import json_repair
from deeptutor.services.llm.provider_core.base import LLMProvider, LLMResponse, ToolCallRequest
from deeptutor.services.llm.reasoning_params import minimax_reasoning_kwargs
from deeptutor.services.provider_registry import ANTHROPIC_EFFORT_BASED_FAMILIES
from deeptutor.services.session.provider_response_state import (
normalize_provider_response_state,
@@ -44,11 +45,13 @@ class AnthropicProvider(LLMProvider):
default_model: str = "claude-sonnet-4-20250514",
extra_headers: dict[str, str] | None = None,
supports_prompt_caching: bool = True,
binding: str = "anthropic",
):
super().__init__(api_key, api_base)
self.default_model = default_model
self.extra_headers = extra_headers or {}
self._supports_prompt_caching = supports_prompt_caching
self._binding = binding
from anthropic import AsyncAnthropic
@@ -412,7 +415,15 @@ class AnthropicProvider(LLMProvider):
if system:
kwargs["system"] = system
if thinking_enabled and effort_based:
minimax = (
minimax_reasoning_kwargs(model_name, effort, anthropic=True)
if getattr(self, "_binding", "anthropic") in {"minimax", "minimax_anthropic"}
else None
)
if minimax is not None:
kwargs.update(minimax)
thinking_enabled = minimax["thinking"]["type"] != "disabled"
elif thinking_enabled and effort_based:
# These families reject enabled+budget_tokens with a 400 —
# adaptive is their only on-mode, so any real effort level maps
# to adaptive (no budget headroom needed). Off-sentinels omit

View File

@@ -129,6 +129,7 @@ def _build_runtime_provider(
default_model=llm_config.model,
extra_headers=llm_config.extra_headers or None,
supports_prompt_caching=bool(spec and spec.supports_prompt_caching),
binding=spec.name if spec else llm_config.binding,
)
else:
from deeptutor.services.llm.provider_core.openai_compat_provider import OpenAICompatProvider

View File

@@ -68,6 +68,41 @@ _THINKING_DISABLED_BY_DEFAULT_MODELS: tuple[str, ...] = ()
_THINKING_DISABLED_BY_DEFAULT: tuple[tuple[str, str], ...] = ()
def minimax_reasoning_kwargs(
model: str, effort: str, *, anthropic: bool = False
) -> dict[str, Any] | None:
"""Map current MiniMax models without changing saved legacy/custom requests.
See https://platform.minimax.io/docs/api-reference/text-openai-api and
https://platform.minimax.io/docs/api-reference/text-anthropic-api.
"""
name = model.lower()
if name not in {"minimax-m3.1-flash", "minimax-m3"}:
return None
if name == "minimax-m3":
if not effort and not anthropic:
# Omission retains each protocol's own default, including when an
# agentic OpenAI facade forwards this request to Anthropic Messages.
return {}
enabled = effort not in {"none", "minimal", "minimum"} if effort else not anthropic
thinking = {"type": "adaptive" if enabled else "disabled"}
return {"thinking": thinking} if anthropic else {"extra_body": {"thinking": thinking}}
# Flash always uses adaptive reasoning. Saved off/binary values fall back
# to the vendor default effort rather than sending an unsupported mode.
thinking = {"type": "adaptive"}
result: dict[str, Any] = (
{"thinking": thinking}
if anthropic
else {"extra_body": {"thinking": thinking, "reasoning_split": True}}
)
if effort in {"low", "medium", "high", "xhigh", "max"}:
if anthropic:
result["output_config"] = {"effort": effort}
else:
result["reasoning_effort"] = effort
return result
def _spec_name(spec: Any, binding: str | None) -> str:
return str(getattr(spec, "name", None) or binding or "").strip().lower()
@@ -149,11 +184,20 @@ def build_openai_compatible_reasoning_kwargs(
``custom`` bindings need model-family inference because their endpoint is
user supplied and therefore cannot be identified by provider name alone.
"""
if reasoning_effort == "":
return {}
provider_name = _spec_name(spec, binding)
model_name = model or ""
if provider_name == "minimax":
minimax = minimax_reasoning_kwargs(model_name, (reasoning_effort or "").strip().lower())
if minimax is not None:
return minimax
if (
provider_name == "openrouter"
and model_name.lower() == "minimax/minimax-m3.1-flash:free"
and reasoning_effort in {"none", "minimal", "minimum"}
):
return {}
if reasoning_effort == "":
return {}
thinking_style = str(getattr(spec, "thinking_style", "") or "")
patterns = tuple(getattr(spec, "reasoning_model_patterns", ()) or ())

View File

@@ -31,6 +31,11 @@ def supported_reasoning_efforts(
"anthropic_compatible": "custom_anthropic",
}.get(provider, provider)
spec = find_by_name(provider)
if spec and spec.name in {"minimax", "minimax_anthropic"}:
if model.lower() == "minimax-m3.1-flash":
return ["low", "medium", "high", "xhigh", "max"]
if model.lower() == "minimax-m3":
return ["none", "adaptive"]
binary_choices = None
if spec is None or spec.backend in {"openai_compat", "azure_openai"}:
# Use the actual wire mapper, including custom model-family inference.

View File

@@ -10,6 +10,7 @@ import aiohttp
import requests
from deeptutor.services.llm.cloud_provider import _auth_binding, _get_aiohttp_connector
from deeptutor.services.llm.minimax_models import prioritize_model_names
from deeptutor.services.llm.utils import build_auth_headers, collect_model_names
@@ -336,7 +337,10 @@ async def probe_provider(
if kinds:
entry["services"] = kinds
models[name] = entry
result = {"status": "connected", "models": list(models.values())}
result = {
"status": "connected",
"models": [models[name] for name in prioritize_model_names(list(models), binding)],
}
capabilities = detect_capabilities(all_items)
if capabilities:
result["capabilities"] = capabilities

View File

@@ -98,6 +98,18 @@ async def test_cloud_fetch_models_non_200_returns_empty(monkeypatch: MonkeyPatch
assert await cloud_provider.fetch_models("https://api.openai.com/v1", "bad") == []
@pytest.mark.asyncio
async def test_minimax_discovery_recommends_current_text_models(monkeypatch: MonkeyPatch) -> None:
names = ["MiniMax-M2.7", "MiniMax-M3", "speech-2.8-hd", "MiniMax-M3.1-Flash"]
_install_session(monkeypatch, _FakeResponse(200, {"data": [{"id": name} for name in names]}))
assert await cloud_provider.fetch_models("https://api.minimax.io/v1", "fixture", "minimax") == [
"MiniMax-M3.1-Flash",
"MiniMax-M3",
"MiniMax-M2.7",
"speech-2.8-hd",
]
def test_ssl_connector(monkeypatch: MonkeyPatch) -> None:
"""The aiohttp connector only appears when TLS verification is disabled."""
monkeypatch.delenv("DISABLE_SSL_VERIFY", raising=False)

View File

@@ -0,0 +1,383 @@
"""Exercise current MiniMax discovery and real SDK request serialization offline."""
from __future__ import annotations
import importlib
import json
import httpx
import pytest
from deeptutor.runtime.agentic.client import (
LLMClientConfig,
_build_openai_client,
build_completion_kwargs,
)
from deeptutor.services.llm.config import LLMConfig
from deeptutor.services.llm.context_window import known_context_window
from deeptutor.services.llm.minimax_models import prioritize_model_names
from deeptutor.services.llm.provider_factory import _build_runtime_provider
from deeptutor.services.model_selection.reasoning import supported_reasoning_efforts
def mocked_sdk(sdk, handle):
# Both supported SDK ranges include releases using httpx and httpx2.
base = importlib.import_module(type(sdk).__module__.split(".")[0] + "._base_client")
transport = getattr(base, "httpx2", None) or base.httpx
def adapt(request):
response = handle(request)
return transport.Response(
response.status_code, headers=response.headers, content=response.content
)
return sdk.with_options(
http_client=transport.AsyncClient(transport=transport.MockTransport(adapt))
)
FLASH = "MiniMax-M3.1-Flash"
TOOLS = [
{
"type": "function",
"function": {
"name": "lookup",
"description": "Look up a fact",
"parameters": {"type": "object", "properties": {}},
},
}
]
@pytest.mark.parametrize(
"binding,prefix,suffix",
[("minimax", "", ""), ("minimax_anthropic", "", ""), ("openrouter", "minimax/", ":free")],
)
def test_active_discovery_preserves_unrelated_models(binding, prefix, suffix):
flash = prefix + FLASH + suffix
m3 = prefix + "MiniMax-M3"
saved = [
prefix + "MiniMax-M2.7",
prefix + "MiniMax-M4",
"custom-deployment",
"speech-2.8-hd",
m3,
flash,
]
assert prioritize_model_names(saved, binding) == [flash, m3, *saved[:4]]
assert saved[0] == prefix + "MiniMax-M2.7"
assert prioritize_model_names(saved, "custom") == saved
assert prioritize_model_names([m3], binding) == [m3]
assert prioritize_model_names([], binding) == []
def test_context_windows_keep_gateway_provenance():
assert known_context_window(FLASH) == 1000000
assert known_context_window("MiniMax-M3") == 1000000
assert known_context_window("minimax/minimax-m3.1-flash:free") == 1000000
assert known_context_window("minimax/minimax-m3") == 1048576
assert known_context_window("MiniMax-M2.7") == 204800
@pytest.mark.parametrize("binding", ["minimax", "minimax_anthropic"])
def test_reasoning_choices_follow_model_contract(binding):
assert supported_reasoning_efforts(binding, FLASH) == ["low", "medium", "high", "xhigh", "max"]
assert supported_reasoning_efforts(binding, "MiniMax-M3") == ["none", "adaptive"]
@pytest.mark.asyncio
@pytest.mark.parametrize("api_format", ["openai_chat", "anthropic"])
@pytest.mark.parametrize("model", [FLASH, "MiniMax-M3"])
@pytest.mark.parametrize("effort", [None, "none", "low", "xhigh", "max"])
async def test_agentic_real_sdk_payload(api_format, model, effort):
anthropic = api_format == "anthropic"
client = _build_openai_client(
LLMClientConfig(
binding="minimax",
model=model,
api_key="fixture-key",
base_url=None,
api_format=api_format,
),
disable_ssl_verify=False,
)
requests = []
def handle(request):
requests.append(request)
return httpx.Response(200, json=response_payload(anthropic))
sdk = client._provider._client if anthropic else client
patched = mocked_sdk(sdk, handle)
await sdk.close()
if anthropic:
client._provider._client = patched
else:
client = patched
try:
result = await client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": "Hello"}],
tools=TOOLS,
**build_completion_kwargs(
binding="minimax",
model=model,
temperature=0.7,
max_tokens=4096,
reasoning_effort=effort,
),
)
assert result.choices[0].message.content == "OK"
body = json.loads(requests[0].content)
assert body["model"] == model
if model == FLASH:
assert body["thinking"] == {"type": "adaptive"}
if anthropic:
assert "reasoning_split" not in body
assert body.get("output_config", {}).get("effort") == (
effort if effort in {"low", "xhigh", "max"} else None
)
elif effort:
assert body["thinking"] == {"type": "disabled" if effort == "none" else "adaptive"}
assert "reasoning_effort" not in body
elif anthropic:
assert body["thinking"] == {"type": "disabled"}
else:
assert "thinking" not in body
finally:
await client.close()
@pytest.mark.asyncio
@pytest.mark.parametrize("model", ["minimax/minimax-m3.1-flash:free", "minimax/minimax-m3"])
async def test_openrouter_sdk_keeps_verified_route(model):
provider = _build_runtime_provider(
LLMConfig(
provider_name="openrouter",
binding="openrouter",
model=model,
api_key="fixture-key",
base_url="https://openrouter.ai/api/v1",
),
configure_env=False,
)
requests = []
def handle(request):
requests.append(request)
return httpx.Response(200, json=response_payload(False))
old_client = provider._client
provider._client = mocked_sdk(old_client, handle)
await old_client.close()
try:
result = await provider.chat(messages=[{"role": "user", "content": "Hello"}])
assert result.content == "OK", result
body = json.loads(requests[0].content)
assert body["model"] == model
assert str(requests[0].url) == "https://openrouter.ai/api/v1/chat/completions"
assert "thinking" not in body
assert "reasoning_split" not in body
finally:
await provider._client.close()
def response_payload(anthropic):
if anthropic:
return {
"id": "msg_test",
"type": "message",
"role": "assistant",
"model": FLASH,
"content": [{"type": "text", "text": "OK"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 1, "output_tokens": 1},
}
return {
"id": "chat_test",
"object": "chat.completion",
"created": 1,
"model": FLASH,
"choices": [
{"index": 0, "message": {"role": "assistant", "content": "OK"}, "finish_reason": "stop"}
],
"usage": {"prompt_tokens": 1, "completion_tokens": 1, "total_tokens": 2},
}
def stream_payload(anthropic):
if anthropic:
message = response_payload(True)
message["content"] = []
message["stop_reason"] = None
events = [
("message_start", {"message": message}),
("content_block_start", {"index": 0, "content_block": {"type": "text", "text": ""}}),
("content_block_delta", {"index": 0, "delta": {"type": "text_delta", "text": "OK"}}),
("content_block_stop", {"index": 0}),
(
"message_delta",
{
"delta": {"stop_reason": "end_turn", "stop_sequence": None},
"usage": {"output_tokens": 1},
},
),
("message_stop", {}),
]
return "".join(
f"event: {kind}\ndata: {json.dumps({'type': kind, **data})}\n\n"
for kind, data in events
)
return 'data: {"id":"chat_test","object":"chat.completion.chunk","created":1,"model":"MiniMax-M3.1-Flash","choices":[{"index":0,"delta":{"content":"OK"},"finish_reason":null}]}\n\ndata: {"id":"chat_test","object":"chat.completion.chunk","created":1,"model":"MiniMax-M3.1-Flash","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}\n\ndata: [DONE]\n\n'
@pytest.mark.asyncio
@pytest.mark.parametrize("api_format", ["openai_chat", "anthropic"])
@pytest.mark.parametrize("host", ["api.minimax.io", "api.minimaxi.com"])
@pytest.mark.parametrize(
"effort", [None, "", "low", "medium", "high", "xhigh", "max", "none", "minimal"]
)
async def test_flash_real_sdk_payload(api_format, host, effort):
anthropic = api_format == "anthropic"
base = f"https://{host}/" + ("anthropic" if anthropic else "v1")
provider = _build_runtime_provider(
LLMConfig(
provider_name="minimax",
binding="minimax",
model=FLASH,
api_key="fixture-key",
base_url=base,
api_format=api_format,
),
configure_env=False,
)
requests = []
def handle(request):
requests.append(request)
return httpx.Response(200, json=response_payload(anthropic))
old_client = provider._client
provider._client = mocked_sdk(old_client, handle)
await old_client.close()
try:
response = await provider.chat(
messages=[{"role": "user", "content": "Hello"}], tools=TOOLS, reasoning_effort=effort
)
assert response.content == "OK", response
assert len(requests) == 1
request = requests[0]
body = json.loads(request.content)
assert str(request.url) == base + ("/v1/messages" if anthropic else "/chat/completions")
assert body["model"] == FLASH
assert body["thinking"] == {"type": "adaptive"}
assert "service_tier" not in body
assert body.get("reasoning_split") is not False
if anthropic:
# Anthropic 2.x sends api_key as Bearer auth; 0.x uses X-Api-Key.
# Verify the exact configured credential with either supported SDK.
assert (
request.headers.get("x-api-key"),
request.headers.get("authorization"),
) in {("fixture-key", None), (None, "Bearer fixture-key")}
assert body.get("output_config", {}).get("effort") == (
effort if effort in {"low", "medium", "high", "xhigh", "max"} else None
)
assert "reasoning_effort" not in body
else:
assert request.headers["authorization"] == "Bearer fixture-key"
assert body.get("reasoning_effort") == (
effort if effort in {"low", "medium", "high", "xhigh", "max"} else None
)
assert body["tools"]
image_url = "https://example.test/diagram.png"
replay = [
{
"role": "user",
"content": [
{"type": "text", "text": "Read this"},
{"type": "image_url", "image_url": {"url": image_url}},
],
},
{
"role": "assistant",
"content": "",
"reasoning_content": "Need lookup",
"tool_calls": [
{
"id": "call_lookup",
"type": "function",
"function": {"name": "lookup", "arguments": "{}"},
}
],
},
{"role": "tool", "tool_call_id": "call_lookup", "content": "Found it"},
]
if anthropic:
replay[1]["_provider_response_state"] = {
"thinking_blocks": [
{
"type": "thinking",
"thinking": "Need lookup",
"signature": "fixture-signature",
}
]
}
response = await provider.chat(messages=replay, tools=TOOLS, reasoning_effort=effort)
assert response.content == "OK", response
replay_body = json.loads(requests[1].content)
assert replay_body["thinking"] == {"type": "adaptive"}
assert image_url in json.dumps(replay_body)
if anthropic:
assert "call_lookup" in json.dumps(replay_body)
assert "fixture-signature" in json.dumps(replay_body)
else:
assistant = replay_body["messages"][1]
assert assistant["tool_calls"][0]["function"]["name"] == "lookup"
assert assistant["tool_calls"][0]["id"] == replay_body["messages"][2]["tool_call_id"]
assert assistant["reasoning_content"] == "Need lookup"
finally:
await provider._client.close()
@pytest.mark.asyncio
@pytest.mark.parametrize("api_format", ["openai_chat", "anthropic"])
@pytest.mark.parametrize("model", [FLASH, "MiniMax-M3", "MiniMax-M2.7", "saved-custom-deployment"])
async def test_saved_models_and_streaming_keep_ids(api_format, model):
anthropic = api_format == "anthropic"
provider = _build_runtime_provider(
LLMConfig(
provider_name="minimax",
binding="minimax",
model=model,
api_key="fixture-key",
base_url="https://gateway.example/anthropic"
if anthropic
else "https://gateway.example/v1",
api_format=api_format,
),
configure_env=False,
)
bodies = []
def handle(request):
bodies.append(json.loads(request.content))
return httpx.Response(
200, headers={"content-type": "text/event-stream"}, text=stream_payload(anthropic)
)
old_client = provider._client
provider._client = mocked_sdk(old_client, handle)
await old_client.close()
try:
response = await provider.chat_stream(messages=[{"role": "user", "content": "Hello"}])
assert response.content == "OK", response
assert bodies[0]["model"] == model
assert bodies[0]["stream"] is True
if model == FLASH:
assert bodies[0]["thinking"] == {"type": "adaptive"}
elif model == "MiniMax-M3":
assert bodies[0].get("thinking") == ({"type": "disabled"} if anthropic else None)
assert "reasoning_effort" not in bodies[0]
finally:
await provider._client.close()

View File

@@ -430,6 +430,18 @@ export function ServiceConfigEditor({
model: item.id,
};
});
if (
service === "llm" &&
["minimax", "minimax_anthropic", "openrouter"].includes(binding)
) {
// Discovery recommendations must not erase saved legacy/custom models.
const discovered = new Set(fetched.map((item) => item.id));
profile.models.push(
...Array.from(existing.values()).filter(
(model) => !discovered.has(model.model),
),
);
}
if (
target.active_profile_id === profile.id &&
!profile.models.some(

View File

@@ -104,6 +104,15 @@ function tableReasoningEffortOptions(
const provider = PROVIDER_ALIASES[canonical] ?? canonical;
const modelName = (model ?? "").trim().toLowerCase();
if (["minimax", "minimax_anthropic"].includes(provider)) {
if (modelName === "minimax-m3.1-flash") {
return options(["low", "medium", "high", "xhigh", "max"], current);
}
if (modelName === "minimax-m3") {
return options(["none", "adaptive"], current);
}
}
if (provider === "gemini" || modelName.includes("gemini")) {
if (
modelName.includes("gemini-3") ||

View File

@@ -1,21 +1,28 @@
import { render, screen, waitFor } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { Mermaid } from "@/components/Mermaid";
const renderer = vi.hoisted(() => ({ render: vi.fn(), initialize: vi.fn() }));
const renderer = vi.hoisted(() => ({
render: vi.fn(),
initialize: vi.fn(),
t: (value: string) => value,
}));
vi.mock("mermaid", () => ({ default: renderer }));
vi.mock("react-i18next", () => ({ useTranslation: () => ({ t: (value: string) => value }) }));
vi.mock("react-i18next", () => ({ useTranslation: () => ({ t: renderer.t }) }));
describe("Mermaid rendering recovery", () => {
it("renders a corrected chart after a renderer error", async () => {
renderer.render.mockReset()
.mockRejectedValueOnce(new Error("Parse error"))
.mockResolvedValueOnce({ svg: '<svg aria-label="corrected diagram"></svg>' });
const correctedChart = "flowchart TD; A-->B";
renderer.render.mockReset().mockImplementation(async (_id: string, chart: string) => {
if (chart !== correctedChart) throw new Error("Parse error");
return { svg: '<svg aria-label="corrected diagram"></svg>' };
});
const { rerender } = render(<Mermaid chart="flowchart TD; A[" />);
await screen.findByText("Diagram rendering error", {}, { timeout: 2500 });
rerender(<Mermaid chart="flowchart TD; A-->B" />);
await waitFor(() => expect(renderer.render).toHaveBeenCalledTimes(2), { timeout: 2500 });
expect(screen.getByLabelText("corrected diagram")).toBeInTheDocument();
rerender(<Mermaid chart={correctedChart} />);
expect(await screen.findByLabelText("corrected diagram", {}, { timeout: 2500 }))
.toBeInTheDocument();
expect(renderer.render).toHaveBeenCalledWith(expect.any(String), correctedChart);
expect(screen.queryByText("Diagram rendering error")).not.toBeInTheDocument();
});
});

View File

@@ -10,6 +10,16 @@ import {
const values = (binding: string, model: string, current = ""): string[] =>
reasoningEffortOptions(binding, model, current).map((option) => option.value);
test("MiniMax Flash exposes adaptive effort levels and preserves saved values", () => {
for (const binding of ["minimax", "minimax_anthropic"]) {
assert.deepEqual(values(binding, "MiniMax-M3.1-Flash"), [
"", "low", "medium", "high", "xhigh", "max",
]);
assert.deepEqual(values(binding, "MiniMax-M3"), ["", "none", "adaptive"]);
assert.equal(values(binding, "MiniMax-M3.1-Flash", "none").includes("none"), true);
}
});
test("Gemini 3 and 2.5 Pro do not list the invalid none effort", () => {
assert.deepEqual(values("gemini", "gemini-3.6-flash"), [
"",