fix: warn instead of blocking when configured model not in hardcoded list (#7692)

* fix: change highspeed model block to warning instead of ValueError

* fix: add highspeed models + use astrbot logger (per AI review)

* style: fix ruff format (line-length, import grouping)
This commit is contained in:
千岚之夏
2026-04-21 08:24:18 +08:00
committed by GitHub
parent fb16e12c80
commit 406bb6c1a7

View File

@@ -1,11 +1,15 @@
from astrbot import logger
from astrbot.core.provider.sources.anthropic_source import ProviderAnthropic
from ..register import register_provider_adapter
MINIMAX_TOKEN_PLAN_MODELS = [
"MiniMax-M2.7",
"MiniMax-M2.7-highspeed",
"MiniMax-M2.5",
"MiniMax-M2.5-highspeed",
"MiniMax-M2.1",
"MiniMax-M2.1-highspeed",
"MiniMax-M2",
]
@@ -43,9 +47,13 @@ class ProviderMiniMaxTokenPlan(ProviderAnthropic):
configured_model = provider_config.get("model", "MiniMax-M2.7")
if configured_model not in MINIMAX_TOKEN_PLAN_MODELS:
raise ValueError(
f"Unsupported model: {configured_model!r}. "
f"Supported models: {', '.join(MINIMAX_TOKEN_PLAN_MODELS)}"
logger.warning(
f"Configured model {configured_model!r} is not in the known "
f"Token Plan model list "
f"({', '.join(MINIMAX_TOKEN_PLAN_MODELS)}). "
f"The model may still work if your plan supports it. "
f"If you encounter errors, please check your plan's "
f"model availability."
)
self.set_model(configured_model)