Add MiniMax provider support#1377
Conversation
PR Summary by QodoAdd MiniMax provider plugin and register MiniMax-M3 model
AI Description
Diagram
High-Level Assessment
Files changed (8)
|
Code Review by Qodo
1. Undeclared OpenAI dependency
|
| public void RegisterDI(IServiceCollection services, IConfiguration config) | ||
| { | ||
| services.AddScoped<ITextCompletion, TextCompletionProvider>(); | ||
| services.AddScoped<IChatCompletion, ChatCompletionProvider>(); | ||
| } |
There was a problem hiding this comment.
1. Undeclared openai dependency 🐞 Bug ☼ Reliability
MiniMax providers require OpenAiSettings via DI, but MiniMaxAiPlugin.RegisterDI doesn’t register/bind OpenAiSettings, so MiniMax fails to resolve if BotSharp.Plugin.OpenAI isn’t also loaded as a plugin. Because PluginLoader only initializes plugins from explicitly listed assemblies, a project reference to the OpenAI plugin does not guarantee OpenAiPlugin.RegisterDI ran.
Agent Prompt
## Issue description
MiniMax provider implementations inject `OpenAiSettings`, but the MiniMax plugin does not register/bind `OpenAiSettings` itself and does not declare a plugin dependency on `BotSharp.Plugin.OpenAI`. This makes the plugin fragile: if the host forgets to include/load the OpenAI plugin assembly as a plugin, MiniMax provider activation will fail at runtime.
## Issue Context
- `PluginLoader` only discovers and initializes `IBotSharpPlugin` types from `PluginLoader:Assemblies`.
- MiniMax inherits OpenAI providers and therefore depends on `OpenAiPlugin`’s DI registrations.
## Fix Focus Areas
- Add an explicit plugin dependency attribute on the MiniMax plugin class.
- Ensure `OpenAiSettings` is registered when missing (use `TryAdd` to avoid overriding the OpenAI plugin’s registration when it is present).
### Suggested changes
1) Add `[PluginDependency("BotSharp.Plugin.OpenAI")]` to `MiniMaxAiPlugin`.
2) In `MiniMaxAiPlugin.RegisterDI`, add a `services.TryAddScoped(...)` registration for `OpenAiSettings` that binds the `OpenAi` section (mirroring `OpenAiPlugin`), so MiniMax can still run when OpenAI plugin isn’t initialized.
## Fix Focus Areas (by file/lines)
- src/Plugins/BotSharp.Plugin.MiniMaxAI/MiniMaxAiPlugin.cs[6-17]
- src/Plugins/BotSharp.Plugin.MiniMaxAI/Providers/Chat/ChatCompletionProvider.cs[3-13]
- src/Plugins/BotSharp.Plugin.MiniMaxAI/Providers/Text/TextCompletionProvider.cs[3-10]
- src/Plugins/BotSharp.Plugin.OpenAI/OpenAiPlugin.cs[23-33]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| public class ChatCompletionProvider : global::BotSharp.Plugin.OpenAI.Providers.Chat.ChatCompletionProvider | ||
| { | ||
| public override string Provider => "minimax"; | ||
|
|
There was a problem hiding this comment.
2. Global response api coupling 🐞 Bug ⚙ Maintainability
MiniMax inherits BotSharp.Plugin.OpenAI’s ChatCompletionProvider, so it is forced to follow the global OpenAiSettings.UseResponseApi behavior with no per-provider override. With WebStarter setting OpenAi:UseResponseApi to true, MiniMax is locked into the Responses codepath, making it impossible to run OpenAI in Responses mode while keeping MiniMax on legacy chat-completions mode.
Agent Prompt
## Issue description
`OpenAiSettings.UseResponseApi` is a single global toggle, but MiniMax reuses the OpenAI chat provider and therefore inherits that toggle. This couples MiniMax’s protocol selection to the OpenAI provider’s setting and prevents independent configuration.
## Issue Context
- MiniMax chat provider only overrides `Provider`, so it inherits all OpenAI request-shaping logic.
- The OpenAI chat provider branches to the Responses API when `UseResponseApi` is true.
- WebStarter sets `OpenAi:UseResponseApi` to true.
## Fix Focus Areas
- Make the `UseResponseApi` check provider-aware (e.g., only enable Responses API when `Provider == "openai"`), or add a per-provider/per-model override (e.g., list of providers allowed to use Responses API).
### Suggested minimal fix
Update OpenAI ChatCompletionProvider to use Responses API only for the actual OpenAI provider:
- Change `if (_settings.UseResponseApi)` to `if (_settings.UseResponseApi && Provider == "openai")`
This keeps OpenAI on Responses API while allowing OpenAI-compatible third-party providers (like MiniMax) to stay on legacy chat-completions.
## Fix Focus Areas (by file/lines)
- src/Plugins/BotSharp.Plugin.OpenAI/Providers/Chat/ChatCompletionProvider.cs[34-70]
- src/WebStarter/appsettings.json[44-46]
- src/Plugins/BotSharp.Plugin.MiniMaxAI/Providers/Chat/ChatCompletionProvider.cs[3-6]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Reason: add target provider/model to existing provider registry
Summary
minimax.Checks
python3JSONC parse ofsrc/WebStarter/appsettings.jsongit diff --checkNote:
dotnetwas not available in this worker environment, so build could not be run here.