Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions BotSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Core.Rules", "src\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Plugin.DeepSeekAI", "src\Plugins\BotSharp.Plugin.DeepSeekAI\BotSharp.Plugin.DeepSeekAI.csproj", "{AF329442-B48E-4B48-A18A-1C869D1BA6F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Plugin.MiniMaxAI", "src\Plugins\BotSharp.Plugin.MiniMaxAI\BotSharp.Plugin.MiniMaxAI.csproj", "{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Core.Realtime", "src\Infrastructure\BotSharp.Core.Realtime\BotSharp.Core.Realtime.csproj", "{781F1465-365C-0F22-1775-25025DAFA4C7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Test.ComputerUse", "tests\BotSharp.Test.ComputerUse\BotSharp.Test.ComputerUse.csproj", "{C19D9AC1-97DD-8E65-E8DB-D295A095AA2D}"
Expand Down Expand Up @@ -737,6 +739,18 @@ Global
{AF329442-B48E-4B48-A18A-1C869D1BA6F5}.Release|x64.Build.0 = Release|Any CPU
{AF329442-B48E-4B48-A18A-1C869D1BA6F5}.Release|x86.ActiveCfg = Release|Any CPU
{AF329442-B48E-4B48-A18A-1C869D1BA6F5}.Release|x86.Build.0 = Release|Any CPU
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}.Debug|x64.ActiveCfg = Debug|Any CPU
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}.Debug|x64.Build.0 = Debug|Any CPU
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}.Debug|x86.ActiveCfg = Debug|Any CPU
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}.Debug|x86.Build.0 = Debug|Any CPU
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}.Release|Any CPU.Build.0 = Release|Any CPU
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}.Release|x64.ActiveCfg = Release|Any CPU
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}.Release|x64.Build.0 = Release|Any CPU
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}.Release|x86.ActiveCfg = Release|Any CPU
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503}.Release|x86.Build.0 = Release|Any CPU
{781F1465-365C-0F22-1775-25025DAFA4C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{781F1465-365C-0F22-1775-25025DAFA4C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{781F1465-365C-0F22-1775-25025DAFA4C7}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -1001,6 +1015,7 @@ Global
{F812BAAE-5A7D-4DF7-8E71-70696B51C61F} = {E29DC6C4-5E57-48C5-BCB0-6B8F84782749}
{AFD64412-4D6A-452E-82A2-79E5D8842E29} = {E29DC6C4-5E57-48C5-BCB0-6B8F84782749}
{AF329442-B48E-4B48-A18A-1C869D1BA6F5} = {D5293208-2BEF-42FC-A64C-5954F61720BA}
{D92C1A49-3F64-4D0C-91C0-B14EA47D2503} = {D5293208-2BEF-42FC-A64C-5954F61720BA}
{781F1465-365C-0F22-1775-25025DAFA4C7} = {E29DC6C4-5E57-48C5-BCB0-6B8F84782749}
{C19D9AC1-97DD-8E65-E8DB-D295A095AA2D} = {32FAFFFE-A4CB-4FEE-BF7C-84518BBC6DCC}
{B268E2F0-060F-8466-7D81-ABA4D735CA59} = {51AFE054-AE99-497D-A593-69BAEFB5106F}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(TargetFramework)</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>$(LangVersion)</LangVersion>
<VersionPrefix>$(BotSharpVersion)</VersionPrefix>
<GeneratePackageOnBuild>$(GeneratePackageOnBuild)</GeneratePackageOnBuild>
<GenerateDocumentationFile>$(GenerateDocumentationFile)</GenerateDocumentationFile>
<OutputPath>$(SolutionDir)packages</OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BotSharp.Plugin.OpenAI\BotSharp.Plugin.OpenAI.csproj" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions src/Plugins/BotSharp.Plugin.MiniMaxAI/MiniMaxAiPlugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using BotSharp.Plugin.MiniMaxAI.Providers.Chat;
using BotSharp.Plugin.MiniMaxAI.Providers.Text;

namespace BotSharp.Plugin.MiniMaxAI;

public class MiniMaxAiPlugin : IBotSharpPlugin
{
public string Id => "8a4ebd68-4d7d-4c5c-aed9-263946cc3a0d";
public string Name => "MiniMax";
public string Description => "MiniMax AI models exposed through the OpenAI-compatible API.";
public string IconUrl => "https://www.minimax.io/favicon.ico";

public void RegisterDI(IServiceCollection services, IConfiguration config)
{
services.AddScoped<ITextCompletion, TextCompletionProvider>();
services.AddScoped<IChatCompletion, ChatCompletionProvider>();
}
Comment on lines +13 to +17

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace BotSharp.Plugin.MiniMaxAI.Providers.Chat;

public class ChatCompletionProvider : global::BotSharp.Plugin.OpenAI.Providers.Chat.ChatCompletionProvider
{
public override string Provider => "minimax";

Comment on lines +3 to +6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

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

public ChatCompletionProvider(
global::BotSharp.Plugin.OpenAI.Settings.OpenAiSettings settings,
ILogger<global::BotSharp.Plugin.OpenAI.Providers.Chat.ChatCompletionProvider> logger,
IServiceProvider services,
IConversationStateService state,
IFileStorageService fileStorage) : base(settings, logger, services, state, fileStorage)
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace BotSharp.Plugin.MiniMaxAI.Providers.Text;

public class TextCompletionProvider : global::BotSharp.Plugin.OpenAI.Providers.Text.TextCompletionProvider
{
public override string Provider => "minimax";

public TextCompletionProvider(
global::BotSharp.Plugin.OpenAI.Settings.OpenAiSettings settings,
ILogger<global::BotSharp.Plugin.OpenAI.Providers.Text.TextCompletionProvider> logger,
IServiceProvider services) : base(settings, logger, services)
{
}
}
8 changes: 8 additions & 0 deletions src/Plugins/BotSharp.Plugin.MiniMaxAI/Using.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Logging;

global using BotSharp.Abstraction.Conversations;
global using BotSharp.Abstraction.Files;
global using BotSharp.Abstraction.MLTasks;
global using BotSharp.Abstraction.Plugins;
1 change: 1 addition & 0 deletions src/WebStarter/WebStarter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<ProjectReference Include="..\Plugins\BotSharp.Plugin.AzureOpenAI\BotSharp.Plugin.AzureOpenAI.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.SparkDesk\BotSharp.Plugin.SparkDesk.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.DeepSeekAI\BotSharp.Plugin.DeepSeekAI.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.MiniMaxAI\BotSharp.Plugin.MiniMaxAI.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.ChatbotUI\BotSharp.Plugin.ChatbotUI.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.HuggingFace\BotSharp.Plugin.HuggingFace.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.KnowledgeBase\BotSharp.Plugin.KnowledgeBase.csproj" />
Expand Down
25 changes: 25 additions & 0 deletions src/WebStarter/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,30 @@
}
]
},
{
"Provider": "minimax",
"Models": [
{
"Id": "MiniMax-M3",
"Name": "MiniMax-M3",
"Version": "MiniMax-M3",
"ApiKey": "",
"Endpoint": "https://api.minimax.io/v1",
"Type": "chat",
"Capabilities": [
"Chat"
],
"Cost": {
"TextInputCost": 0.0006,
"CachedTextInputCost": 0.00012,
"AudioInputCost": 0,
"CachedAudioInputCost": 0,
"TextOutputCost": 0.0024,
"AudioOutputCost": 0
}
}
]
},
{
"Provider": "google-ai",
"Models": [
Expand Down Expand Up @@ -1056,6 +1080,7 @@
"BotSharp.Plugin.GoogleAI",
"BotSharp.Plugin.MetaAI",
"BotSharp.Plugin.DeepSeekAI",
"BotSharp.Plugin.MiniMaxAI",
"BotSharp.Plugin.MetaMessenger",
"BotSharp.Plugin.HuggingFace",
"BotSharp.Plugin.KnowledgeBase",
Expand Down