Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix: prioritize MiniMax defaults without filtering discovered models

Bingxi Zhao (Frank)dd43e51be912
diff --git a/deeptutor/services/llm/cloud_provider.py b/deeptutor/services/llm/cloud_provider.py
index 68bd43026..cb83213a5 100644
--- a/deeptutor/services/llm/cloud_provider.py
+++ b/deeptutor/services/llm/cloud_provider.py
@@ -18,7 +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 active_model_names
+from .minimax_models import prioritize_model_names
from .utils import build_auth_headers, collect_model_names
logger = logging.getLogger(__name__)
@@ -103,11 +103,11 @@ async def fetch_models(
mapping = cast(Mapping[str, object], payload)
items = mapping.get("data")
if isinstance(items, list):
- return active_model_names(
+ return prioritize_model_names(
collect_model_names(cast(list[object], items)), binding
)
elif isinstance(payload, list):
- return active_model_names(
+ return prioritize_model_names(
collect_model_names(cast(list[object], payload)), binding
)
return []
diff --git a/deeptutor/services/llm/minimax_models.py b/deeptutor/services/llm/minimax_models.py
index c6eadff5d..8b40bb865 100644
--- a/deeptutor/services/llm/minimax_models.py
+++ b/deeptutor/services/llm/minimax_models.py
@@ -1,31 +1,15 @@
-"""Current MiniMax text choices in live discovery; saved model IDs remain untouched."""
+"""Order MiniMax discovery without discarding account-provided model IDs."""
from __future__ import annotations
-def active_model_names(names: list[str], binding: str) -> list[str]:
- """Prefer Flash, retain M3, and preserve unrelated/custom discovery entries.
-
- Only filter known MiniMax text IDs for MiniMax and OpenRouter. Do not invent
- account access by adding models missing from the endpoint's response.
- """
+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 "")
- active = [flash, prefix + "minimax-m3"]
-
- def keep(name: str) -> bool:
- lowered = name.lower()
- if prefix and not lowered.startswith(prefix):
- return True
- model = lowered.removeprefix(prefix)
- known_text = model == "minimax-01" or model.startswith(
- ("minimax-m", "minimax-text", "minimax-vl", "abab")
- )
- return not known_text or lowered in active
-
- filtered = [name for name in names if keep(name)]
+ preferred = [flash, prefix + "minimax-m3"]
return sorted(
- filtered, key=lambda name: active.index(name.lower()) if name.lower() in active else 2
+ names, key=lambda name: preferred.index(name.lower()) if name.lower() in preferred else 2
)
diff --git a/deeptutor/services/settings/provider_probe.py b/deeptutor/services/settings/provider_probe.py
index c581f018d..2906a9cab 100644
--- a/deeptutor/services/settings/provider_probe.py
+++ b/deeptutor/services/settings/provider_probe.py
@@ -10,7 +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 active_model_names
+from deeptutor.services.llm.minimax_models import prioritize_model_names
from deeptutor.services.llm.utils import build_auth_headers, collect_model_names
@@ -339,7 +339,7 @@ async def probe_provider(
models[name] = entry
result = {
"status": "connected",
- "models": [models[name] for name in active_model_names(list(models), binding)],
+ "models": [models[name] for name in prioritize_model_names(list(models), binding)],
}
capabilities = detect_capabilities(all_items)
if capabilities:
diff --git a/tests/services/llm/test_cloud_provider.py b/tests/services/llm/test_cloud_provider.py
index 340960d44..fbb307d3f 100644
--- a/tests/services/llm/test_cloud_provider.py
+++ b/tests/services/llm/test_cloud_provider.py
@@ -105,6 +105,7 @@ async def test_minimax_discovery_recommends_current_text_models(monkeypatch: Mon
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",
]
diff --git a/tests/services/llm/test_minimax_current_models.py b/tests/services/llm/test_minimax_current_models.py
index b3320e75a..701297c68 100644
--- a/tests/services/llm/test_minimax_current_models.py
+++ b/tests/services/llm/test_minimax_current_models.py
@@ -15,7 +15,7 @@ from deeptutor.runtime.agentic.client import (
)
from deeptutor.services.llm.config import LLMConfig
from deeptutor.services.llm.context_window import known_context_window
-from deeptutor.services.llm.minimax_models import active_model_names
+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
@@ -56,12 +56,19 @@ TOOLS = [
def test_active_discovery_preserves_unrelated_models(binding, prefix, suffix):
flash = prefix + FLASH + suffix
m3 = prefix + "MiniMax-M3"
- saved = [prefix + "MiniMax-M2.7", "custom-deployment", "speech-2.8-hd", m3, flash]
- assert active_model_names(saved, binding) == [flash, m3, "custom-deployment", "speech-2.8-hd"]
+ 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 active_model_names(saved, "custom") == saved
- assert active_model_names([m3], binding) == [m3]
- assert active_model_names([], binding) == []
+ 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():