Repository navigation
Conversation
63efd78 to
57a8a51
Compare
There was a problem hiding this comment.
Hey - I've found 2 issues
Sourcery assessment
Needs a human reviewer. 2 findings to address first, and the provider now sends its Bearer token to api.minimax.cn by default and honors a configured api_base; if that host is wrong or untrusted, the token can be exposed externally. Reverting stops future requests but cannot undo exposure of a token already sent.
Blocking findings: astrbot/core/provider/sources/minimax_token_plan_source.py:33, astrbot/core/provider/sources/minimax_token_plan_source.py:43
| provider_settings: Global provider settings mapping. | ||
| """ | ||
| merged_provider_config = dict(provider_config) | ||
| if not str(merged_provider_config.get("api_base") or "").strip(): |
There was a problem hiding this comment.
🟠 High · Upgraded providers keep stale endpoint
When an existing installation has the previous default API base saved, the nonblank-value check preserves the saved https://api.minimaxi.com/anthropic value, so merged_provider_config and ProviderAnthropic keep sending chat and model-list requests to the old endpoint instead of the updated China endpoint; upgraded users do not receive the endpoint update.
Replace the saved value with the new endpoint when it matches the former default, while preserving custom API bases.
Also at astrbot/core/provider/sources/minimax_token_plan_source.py:34, astrbot/core/config/default.py:1423.
| configured_model = provider_config.get("model", "MiniMax-M3") | ||
| self.set_model(configured_model) | ||
|
|
||
| async def get_models(self) -> list[str]: |
There was a problem hiding this comment.
🟡 Medium · Model discovery stalls during outages
When the MiniMax model-list endpoint is slow or repeatedly times out, ProviderAnthropic.get_models() uses the SDK client timeout (120 seconds by default) and retries up to five times, so repeated timeouts can keep the model-list request waiting for over ten minutes before failing; the dashboard awaits this call without local timeout handling, leaving model discovery stalled instead of returning promptly.
Use a shorter model-discovery timeout or a smaller retry budget for this endpoint.
Update
ProviderMiniMaxTokenPlanto default toMiniMax-M4and align with the current MiniMax Anthropic-compatible API docs. Supersedes #10648.Modifications / 改动点
Update the default model in
ProviderMiniMaxTokenPlanfromMiniMax-M3toMiniMax-M4(also handling blankmodelvalues) and avoid mutating caller config dicts.Update the default China Anthropic endpoint to
https://api.minimax.cn/anthropicinminimax_token_plan_source.pyanddefault.py, while preserving configured custom/internationalapi_basevalues (e.g.,https://api.minimax.io/anthropic).Safely handle empty
keylists (key: []) so missing keys raiseValueErrorfromProviderAnthropicinstead ofIndexError.Inherit
ProviderAnthropic.get_models()(GET {base_url}/v1/models) instead of hardcodinghttps://api.minimaxi.com/v1/modelswith a separatehttpxclient.This is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
uv run ruff format --check .anduv run ruff check .passed.uv run pytest tests/test_anthropic_kimi_code_provider.py tests/test_provider_user_agent.py -qpassed.https://api.minimax.cn/anthropic:get_models()returned the model list includingMiniMax-M4, andtext_chat()succeeded using the defaultMiniMax-M4model.Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
📚 I checked the affected WebUI instructions and screenshots in
docs/zhanddocs/enagainst the changed navigation, page structure, and labels, and updated them in this PR (or explained why no documentation update is needed). For renamed, moved, or merged entry points, I included an old entry → new entry mapping in the documentation and changelog./ 我已对照变化后的 WebUI 入口、页面结构和术语,核对并在本 PR 中更新
docs/zh和docs/en的相关操作说明与截图(或说明无需更新文档的原因)。入口改名、移动或合并时,已在文档和 changelog 中补充 旧入口 → 新入口 对照。🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Align MiniMax Token Plan defaults and model discovery with the current Anthropic-compatible API.
Bug Fixes:
Enhancements: