-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: add MiniMax as LLM provider (M3 default, M2.7, M2.7-highspeed) #1076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import LangChainBot from "../LangChainBot"; | ||
| import store from "@/store"; | ||
| import { ChatOpenAI } from "@langchain/openai"; | ||
|
|
||
| export default class MiniMaxAPIBot extends LangChainBot { | ||
| static _brandId = "minimaxApi"; | ||
| static _className = "MiniMaxAPIBot"; | ||
|
|
||
| constructor() { | ||
| super(); | ||
| } | ||
|
|
||
| async _checkAvailability() { | ||
| let available = false; | ||
|
|
||
| if (store.state.minimaxApi.apiKey) { | ||
| this.setupModel(); | ||
| available = true; | ||
| } | ||
| return available; | ||
| } | ||
|
|
||
| _setupModel() { | ||
| const chatModel = new ChatOpenAI({ | ||
| configuration: { | ||
| basePath: store.state.minimaxApi.alterUrl | ||
| ? store.state.minimaxApi.alterUrl | ||
| : "https://api.minimax.io/v1", | ||
| }, | ||
| openAIApiKey: store.state.minimaxApi.apiKey, | ||
| modelName: this.constructor._model ? this.constructor._model : "", | ||
| temperature: store.state.minimaxApi.temperature, | ||
| streaming: true, | ||
| }); | ||
| return chatModel; | ||
| } | ||
|
|
||
| getPastRounds() { | ||
| return store.state.minimaxApi.pastRounds; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import MiniMaxAPIBot from "./MiniMaxAPIBot"; | ||
|
|
||
| export default class MiniMaxM25Bot extends MiniMaxAPIBot { | ||
| static _className = "MiniMaxM25Bot"; | ||
| static _logoFilename = "minimax-logo.svg"; | ||
| static _model = "MiniMax-M2.5"; | ||
| constructor() { | ||
| super(); | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import MiniMaxAPIBot from "./MiniMaxAPIBot"; | ||
|
|
||
| export default class MiniMaxM25HighspeedBot extends MiniMaxAPIBot { | ||
| static _className = "MiniMaxM25HighspeedBot"; | ||
| static _logoFilename = "minimax-logo.svg"; | ||
| static _model = "MiniMax-M2.5-highspeed"; | ||
| constructor() { | ||
| super(); | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| <template> | ||
| <CommonBotSettings | ||
| :settings="settings" | ||
| :brand-id="brandId" | ||
| mutation-type="setMiniMaxApi" | ||
| :watcher="watcher" | ||
| ></CommonBotSettings | ||
| > | ||
| </template> | ||
|
|
||
| <script> | ||
| import _bots from "@/bots"; | ||
| import Bot from "@/bots/minimax/MiniMaxAPIBot"; | ||
| import CommonBotSettings from "@/components/BotSettings/CommonBotSettings.vue"; | ||
| import { Type } from "./settings.const"; | ||
|
|
||
| const settings = [ | ||
| { | ||
| type: Type.Text, | ||
| name: "apiKey", | ||
| title: "common.apiKey", | ||
| description: "settings.secretPrompt", | ||
| placeholder: "eyJh...", | ||
| }, | ||
| { | ||
| type: Type.Text, | ||
| name: "alterUrl", | ||
| title: "minimaxApi.alterUrl", | ||
| description: "minimaxApi.alterUrlPrompt", | ||
| placeholder: "https://api.minimax.io/v1", | ||
| }, | ||
| { | ||
| type: Type.Slider, | ||
| name: "temperature", | ||
| title: "minimaxApi.temperature", | ||
| description: "minimaxApi.temperaturePrompt", | ||
| min: 0.1, | ||
| max: 1, | ||
| step: 0.1, | ||
| ticks: { | ||
| 0.1: "minimaxApi.temperature01", | ||
| 1: "minimaxApi.temperature1", | ||
| }, | ||
| }, | ||
| { | ||
| type: Type.Slider, | ||
| name: "pastRounds", | ||
| title: "bot.pastRounds", | ||
| description: "bot.pastRoundsPrompt", | ||
| min: 0, | ||
| max: 10, | ||
| step: 1, | ||
| }, | ||
| ]; | ||
| export default { | ||
| components: { | ||
| CommonBotSettings, | ||
| }, | ||
| data() { | ||
| return { | ||
| settings: settings, | ||
| brandId: Bot._brandId, | ||
| }; | ||
| }, | ||
| methods: { | ||
| watcher() { | ||
| _bots.all | ||
| .filter((bot) => bot instanceof Bot) | ||
| .map((bot) => bot.setupModel()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For code clarity and semantic correctness, it's better to use |
||
| }, | ||
| }, | ||
| }; | ||
| </script> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -393,5 +393,16 @@ | |
| "10": "10", | ||
| "25": "25", | ||
| "50": "50", | ||
| "100": "100" | ||
| "100": "100", | ||
| "minimaxApi": { | ||
| "name": "MiniMax API", | ||
| "MiniMax-M25": "MiniMax-M2.5", | ||
| "MiniMax-M25-highspeed": "MiniMax-M2.5-highspeed", | ||
| "alterUrl": "API URL", | ||
| "alterUrlPrompt": "Custom API endpoint URL (default: https://api.minimax.io/v1)", | ||
| "temperature": "Temperature", | ||
| "temperaturePrompt": "What sampling temperature to use, between 0.1 and 1", | ||
| "temperature01": "Precise", | ||
| "temperature1": "Creative" | ||
| } | ||
|
Comment on lines
+397
to
+408
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing German translations for MiniMax API settings. The
🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -317,6 +317,17 @@ | |
| "gemma-7b-it": "Gemma 7b", | ||
| "gemma2-9b-it": "Gemma2 9b" | ||
| }, | ||
| "minimaxApi": { | ||
| "name": "MiniMax API", | ||
| "MiniMax-M25": "MiniMax M2.5", | ||
| "MiniMax-M25-highspeed": "MiniMax M2.5 Highspeed", | ||
| "alterUrl": "Alternate Base URL", | ||
| "alterUrlPrompt": "Base URL path for API requests, default is https://api.minimax.io/v1", | ||
| "temperature": "Temperature", | ||
| "temperaturePrompt": "Must be between 0.1 and 1.0. Higher values produce more creative but less deterministic responses", | ||
| "temperature01": "More deterministic", | ||
| "temperature1": "More creative" | ||
| }, | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| "xaiApi": { | ||
| "name": "xAI API", | ||
| "grok-2-latest": "Grok-2", | ||
|
|
@@ -396,5 +407,16 @@ | |
| "10": "10", | ||
| "25": "25", | ||
| "50": "50", | ||
| "100": "100" | ||
| "100": "100", | ||
| "minimaxApi": { | ||
| "name": "MiniMax API", | ||
| "MiniMax-M25": "MiniMax-M2.5", | ||
| "MiniMax-M25-highspeed": "MiniMax-M2.5-highspeed", | ||
| "alterUrl": "API URL", | ||
| "alterUrlPrompt": "Custom API endpoint URL (default: https://api.minimax.io/v1)", | ||
| "temperature": "Temperature", | ||
| "temperaturePrompt": "What sampling temperature to use, between 0.1 and 1", | ||
| "temperature01": "Precise", | ||
| "temperature1": "Creative" | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -393,5 +393,16 @@ | |
| "10": "10", | ||
| "25": "25", | ||
| "50": "50", | ||
| "100": "100" | ||
| "100": "100", | ||
| "minimaxApi": { | ||
| "name": "MiniMax API", | ||
| "MiniMax-M25": "MiniMax-M2.5", | ||
| "MiniMax-M25-highspeed": "MiniMax-M2.5-highspeed", | ||
| "alterUrl": "API URL", | ||
| "alterUrlPrompt": "Custom API endpoint URL (default: https://api.minimax.io/v1)", | ||
| "temperature": "Temperature", | ||
| "temperaturePrompt": "What sampling temperature to use, between 0.1 and 1", | ||
| "temperature01": "Precise", | ||
| "temperature1": "Creative" | ||
| } | ||
|
Comment on lines
+396
to
+408
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing Spanish translations for MiniMax API settings. The
🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -393,5 +393,16 @@ | |
| "10": "10", | ||
| "25": "25", | ||
| "50": "50", | ||
| "100": "100" | ||
| "100": "100", | ||
| "minimaxApi": { | ||
| "name": "MiniMax API", | ||
| "MiniMax-M25": "MiniMax-M2.5", | ||
| "MiniMax-M25-highspeed": "MiniMax-M2.5-highspeed", | ||
| "alterUrl": "API URL", | ||
| "alterUrlPrompt": "Custom API endpoint URL (default: https://api.minimax.io/v1)", | ||
| "temperature": "Temperature", | ||
| "temperaturePrompt": "What sampling temperature to use, between 0.1 and 1", | ||
| "temperature01": "Precise", | ||
| "temperature1": "Creative" | ||
| } | ||
|
Comment on lines
+397
to
+408
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing French translations for MiniMax API settings. The For example:
🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -395,5 +395,16 @@ | |
| "10": "10", | ||
| "25": "25", | ||
| "50": "50", | ||
| "100": "100" | ||
| "100": "100", | ||
| "minimaxApi": { | ||
| "name": "MiniMax API", | ||
| "MiniMax-M25": "MiniMax-M2.5", | ||
| "MiniMax-M25-highspeed": "MiniMax-M2.5-highspeed", | ||
| "alterUrl": "API URL", | ||
| "alterUrlPrompt": "Custom API endpoint URL (default: https://api.minimax.io/v1)", | ||
| "temperature": "Temperature", | ||
| "temperaturePrompt": "What sampling temperature to use, between 0.1 and 1", | ||
| "temperature01": "Precise", | ||
| "temperature1": "Creative" | ||
| } | ||
|
Comment on lines
+399
to
+410
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing Italian translations for MiniMax API settings. The
🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -393,5 +393,16 @@ | |||||||||||||||||||||||||
| "10": "10", | ||||||||||||||||||||||||||
| "25": "25", | ||||||||||||||||||||||||||
| "50": "50", | ||||||||||||||||||||||||||
| "100": "100" | ||||||||||||||||||||||||||
| "100": "100", | ||||||||||||||||||||||||||
| "minimaxApi": { | ||||||||||||||||||||||||||
| "name": "MiniMax API", | ||||||||||||||||||||||||||
| "MiniMax-M25": "MiniMax-M2.5", | ||||||||||||||||||||||||||
| "MiniMax-M25-highspeed": "MiniMax-M2.5-highspeed", | ||||||||||||||||||||||||||
| "alterUrl": "API URL", | ||||||||||||||||||||||||||
| "alterUrlPrompt": "Custom API endpoint URL (default: https://api.minimax.io/v1)", | ||||||||||||||||||||||||||
| "temperature": "Temperature", | ||||||||||||||||||||||||||
| "temperaturePrompt": "What sampling temperature to use, between 0.1 and 1", | ||||||||||||||||||||||||||
| "temperature01": "Precise", | ||||||||||||||||||||||||||
| "temperature1": "Creative" | ||||||||||||||||||||||||||
|
Comment on lines
+402
to
+407
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JA locale strings are untranslated English text. Lines 401–406 introduce English UI copy in 🌐 Suggested JA localization "minimaxApi": {
"name": "MiniMax API",
"MiniMax-M25": "MiniMax-M2.5",
"MiniMax-M25-highspeed": "MiniMax-M2.5-highspeed",
"alterUrl": "API URL",
- "alterUrlPrompt": "Custom API endpoint URL (default: https://api.minimax.io/v1)",
- "temperature": "Temperature",
- "temperaturePrompt": "What sampling temperature to use, between 0.1 and 1",
- "temperature01": "Precise",
- "temperature1": "Creative"
+ "alterUrlPrompt": "カスタム API エンドポイント URL(既定: https://api.minimax.io/v1)",
+ "temperature": "温度",
+ "temperaturePrompt": "0.1〜1 の範囲でサンプリング温度を設定します",
+ "temperature01": "正確寄り",
+ "temperature1": "創造的"
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -396,5 +396,16 @@ | |
| "10": "10", | ||
| "25": "25", | ||
| "50": "50", | ||
| "100": "100" | ||
| "100": "100", | ||
| "minimaxApi": { | ||
| "name": "MiniMax API", | ||
| "MiniMax-M25": "MiniMax-M2.5", | ||
| "MiniMax-M25-highspeed": "MiniMax-M2.5-highspeed", | ||
| "alterUrl": "API URL", | ||
| "alterUrlPrompt": "Custom API endpoint URL (default: https://api.minimax.io/v1)", | ||
| "temperature": "Temperature", | ||
| "temperaturePrompt": "What sampling temperature to use, between 0.1 and 1", | ||
| "temperature01": "Precise", | ||
| "temperature1": "Creative" | ||
| } | ||
|
Comment on lines
+400
to
+411
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing Korean translations for MiniMax API settings. The
🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -393,5 +393,16 @@ | |
| "10": "10", | ||
| "25": "25", | ||
| "50": "50", | ||
| "100": "100" | ||
| "100": "100", | ||
| "minimaxApi": { | ||
| "name": "MiniMax API", | ||
| "MiniMax-M25": "MiniMax-M2.5", | ||
| "MiniMax-M25-highspeed": "MiniMax-M2.5-highspeed", | ||
| "alterUrl": "API URL", | ||
| "alterUrlPrompt": "Custom API endpoint URL (default: https://api.minimax.io/v1)", | ||
| "temperature": "Temperature", | ||
| "temperaturePrompt": "What sampling temperature to use, between 0.1 and 1", | ||
| "temperature01": "Precise", | ||
| "temperature1": "Creative" | ||
| } | ||
|
Comment on lines
+397
to
+408
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing Russian translations for MiniMax API settings. The For example:
🤖 Prompt for AI Agents |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For conciseness and improved readability, you can simplify the ternary expressions for
basePathandmodelNameby using the logical OR (||) operator to provide default values.