-
Notifications
You must be signed in to change notification settings - Fork 853
feat: add MiniMax as first-class LLM provider #958
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: master
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ import { | |
| isUsingOpenRouterApiModel, | ||
| isUsingAimlApiModel, | ||
| isUsingDeepSeekApiModel, | ||
| isUsingMiniMaxApiModel, | ||
| } from '../../config/index.mjs' | ||
| import Browser from 'webextension-polyfill' | ||
| import { languageList } from '../../config/language.mjs' | ||
|
|
@@ -342,6 +343,17 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) { | |
| }} | ||
| /> | ||
| )} | ||
| {isUsingMiniMaxApiModel(config) && ( | ||
| <input | ||
| type="password" | ||
| value={config.minimaxApiKey} | ||
| placeholder={t('MiniMax API Key')} | ||
| onChange={(e) => { | ||
| const apiKey = e.target.value | ||
| updateConfig({ minimaxApiKey: apiKey }) | ||
| }} | ||
| /> | ||
|
Comment on lines
+346
to
+355
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. 1. Missing minimax api key locale The settings UI introduces a new localized string key MiniMax API Key but no corresponding entry exists in the English locale (and therefore cannot be propagated). This can cause missing/incorrect UI text and violates the localization key propagation requirement. Agent Prompt
|
||
| )} | ||
|
Comment on lines
+346
to
+356
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 a better user experience, consider adding a 'Get' button next to the API key input that links to the MiniMax API key page. This is consistent with how API keys for other providers like OpenAI and Moonshot are handled in the UI. The URL for MiniMax API keys is: {isUsingMiniMaxApiModel(config) && (
<span style="display: flex; gap: 5px;">
<input
style="width: 100%;"
type="password"
value={config.minimaxApiKey}
placeholder={t('MiniMax API Key')}
onChange={(e) => {
const apiKey = e.target.value
updateConfig({ minimaxApiKey: apiKey })
}}
/>
{config.minimaxApiKey.length === 0 ? (
<a
href="https://api.minimax.io/user-center/api-keys"
target="_blank"
rel="nofollow noopener noreferrer"
>
<button style="white-space: nowrap;" type="button">
{t('Get')}
</button>
</a>
) : null}
</span>
)} |
||
| {isUsingOllamaApiModel(config) && ( | ||
| <input | ||
| type="password" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { generateAnswersWithOpenAiApiCompat } from './openai-api.mjs' | ||
|
|
||
| /** | ||
| * @param {Browser.Runtime.Port} port | ||
| * @param {string} question | ||
| * @param {Session} session | ||
| * @param {string} apiKey | ||
| */ | ||
| export async function generateAnswersWithMiniMaxApi(port, question, session, apiKey) { | ||
| const baseUrl = 'https://api.minimax.io/v1' | ||
| return generateAnswersWithOpenAiApiCompat(baseUrl, port, question, session, apiKey) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import assert from 'node:assert/strict' | ||
| import { describe, test } from 'node:test' | ||
| import { | ||
| miniMaxApiModelKeys, | ||
| isUsingMiniMaxApiModel, | ||
| Models, | ||
| ModelGroups, | ||
| } from '../../src/config/index.mjs' | ||
|
|
||
| describe('MiniMax integration', () => { | ||
| test('all MiniMax model keys have corresponding Models entries', () => { | ||
| for (const key of miniMaxApiModelKeys) { | ||
| assert.ok(Models[key], `Models entry missing for ${key}`) | ||
| assert.ok(Models[key].value, `Models[${key}].value is empty`) | ||
| assert.ok(Models[key].desc, `Models[${key}].desc is empty`) | ||
| } | ||
| }) | ||
|
|
||
| test('MiniMax model group is registered in ModelGroups', () => { | ||
| assert.ok(ModelGroups.miniMaxApiModelKeys, 'MiniMax group missing from ModelGroups') | ||
| assert.equal(ModelGroups.miniMaxApiModelKeys.desc, 'MiniMax (API)') | ||
| assert.deepEqual(ModelGroups.miniMaxApiModelKeys.value, miniMaxApiModelKeys) | ||
| }) | ||
|
|
||
| test('MiniMax model values match expected API model names', () => { | ||
| assert.equal(Models.minimax_m27.value, 'MiniMax-M2.7') | ||
| assert.equal(Models.minimax_m25.value, 'MiniMax-M2.5') | ||
| assert.equal(Models.minimax_m25_highspeed.value, 'MiniMax-M2.5-highspeed') | ||
| }) | ||
|
|
||
| test('isUsingMiniMaxApiModel does not match other provider models', () => { | ||
| const otherModels = [ | ||
| 'chatgptApi4oMini', | ||
| 'deepseek_chat', | ||
| 'moonshot_v1_8k', | ||
| 'claude37SonnetApi', | ||
| 'customModel', | ||
| 'ollamaModel', | ||
| ] | ||
| for (const modelName of otherModels) { | ||
| assert.equal(isUsingMiniMaxApiModel({ modelName }), false, `Should not match ${modelName}`) | ||
| } | ||
| }) | ||
|
|
||
| test('MiniMax model keys are unique and do not overlap with other groups', () => { | ||
| const allOtherKeys = [] | ||
| for (const [groupName, group] of Object.entries(ModelGroups)) { | ||
| if (groupName === 'miniMaxApiModelKeys') continue | ||
| allOtherKeys.push(...group.value) | ||
| } | ||
| for (const key of miniMaxApiModelKeys) { | ||
| assert.equal( | ||
| allOtherKeys.includes(key), | ||
| false, | ||
| `MiniMax key ${key} overlaps with another group`, | ||
| ) | ||
| } | ||
| }) | ||
| }) |
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.
The list of supported APIs is getting long. To improve readability and make it easier for users to find a specific provider, consider sorting the list of API providers alphabetically.