feat(provider): add mistral#72
Conversation
📝 WalkthroughWalkthroughThis PR adds support for a new Mistral provider across the codebase. Changes include schema validation for the provider type, configuration structures, provider implementation with macro registration, authentication wiring, and UI localization for both English and Chinese locales. ChangesMistral Provider Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 4/5 reviews remaining, refill in 12 minutes. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
ui/src/i18n/locales/zh-CN.json (1)
149-159:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win补齐
providers.form.types里的mistral文案当前只在
models.form.providers增加了mistral,但providers.form.types仍缺失(约 Line 220)。这会导致模型提供商类型下拉可能显示未翻译 key。Suggested patch
"types": { "openai": "OpenAI", "openrouter": "OpenRouter", "groq": "Groq", + "mistral": "Mistral", "azure": "Azure OpenAI", "anthropic": "Anthropic", "gemini": "Gemini", "deepseek": "DeepSeek", "bedrock": "AWS Bedrock" }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ui/src/i18n/locales/zh-CN.json` around lines 149 - 159, Add the missing "mistral" translation under the providers.form.types object in the zh-CN locale so the provider type dropdown shows the Chinese label; locate the providers.form.types block in ui/src/i18n/locales/zh-CN.json and add a "mistral" key with the appropriate Chinese string (matching the style used for other providers like "mistral" in providers or "mistral" elsewhere).ui/src/i18n/locales/en.json (1)
149-159:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd
mistraltoproviders.form.typesas wellYou added the model-form provider label, but the provider-form type label map still lacks
mistral(around Line 220). This can surface untranslated key text in the provider type selector.Suggested patch
"types": { "openai": "OpenAI", "openrouter": "OpenRouter", "groq": "Groq", + "mistral": "Mistral", "azure": "Azure OpenAI", "anthropic": "Anthropic", "gemini": "Gemini", "deepseek": "DeepSeek", "bedrock": "AWS Bedrock" }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ui/src/i18n/locales/en.json` around lines 149 - 159, The providers.form.types map in the en.json locale is missing the "mistral" key, causing untranslated text in the provider type selector; add an entry "mistral": "Mistral" to the providers.form.types object (the same label used in providers) so the provider-form type label map includes Mistral and matches the providers mapping.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/gateway/providers/mod.rs`:
- Line 75: Replace the std assert_eq! used in the test assertion for
registry.get("mistral").unwrap().name() with pretty_assertions::assert_eq!:
import the macro (use pretty_assertions::assert_eq;) at the top of the test
module and update the assertion call so the test uses
pretty_assertions::assert_eq!(registry.get("mistral").unwrap().name(),
"mistral"); keeping the same operands and preserving the unwrap() and .name()
chain.
In `@src/proxy/provider.rs`:
- Around line 230-244: The test
provider_auth_and_base_url_returns_mistral_api_key_and_optional_base_url uses
std's assert_eq! macros; replace those with pretty_assertions::assert_eq! to
follow project test conventions (update the two assertions that check
auth.api_key_for("mistral") and base_url_override.as_ref().map(Url::as_str)
accordingly) and add a use pretty_assertions::assert_eq; import at the top of
the test module if it's not already present.
---
Outside diff comments:
In `@ui/src/i18n/locales/en.json`:
- Around line 149-159: The providers.form.types map in the en.json locale is
missing the "mistral" key, causing untranslated text in the provider type
selector; add an entry "mistral": "Mistral" to the providers.form.types object
(the same label used in providers) so the provider-form type label map includes
Mistral and matches the providers mapping.
In `@ui/src/i18n/locales/zh-CN.json`:
- Around line 149-159: Add the missing "mistral" translation under the
providers.form.types object in the zh-CN locale so the provider type dropdown
shows the Chinese label; locate the providers.form.types block in
ui/src/i18n/locales/zh-CN.json and add a "mistral" key with the appropriate
Chinese string (matching the style used for other providers like "mistral" in
providers or "mistral" elsewhere).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 57e1791b-e30c-4586-8c54-aebe9e9b5629
📒 Files selected for processing (8)
src/config/entities/providers-schema.jsonsrc/config/entities/providers.rssrc/gateway/providers/mistral.rssrc/gateway/providers/mod.rssrc/proxy/provider.rsui/src/i18n/locales/en.jsonui/src/i18n/locales/zh-CN.jsonui/src/lib/api/types.ts
Summary by CodeRabbit
New Features