Add MiniMax as an LLM provider#11
Conversation
MiniMax offers OpenAI-compatible API endpoints with models like MiniMax-M2.5 and MiniMax-M2.5-highspeed (204K context window). This adds MiniMax alongside the existing providers by reusing the OpenAI-compatible adapter with the MiniMax base URL. Changes: - Add 'minimax' to the LLMProvider union type and default configs - Add MiniMax case to the provider adapter factory - Include MiniMax in the settings UI provider lists with base URL input - Update README with MiniMax in the provider table
WalkthroughThe pull request adds support for MiniMax as a new LLM provider throughout the application by extending type definitions, configuration objects, UI components, IPC handlers, and documentation. The implementation follows existing patterns established for other providers. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/renderer/src/components/tabs/SettingsTab.tsx (1)
412-427: Base URL logic duplicated across components.The
PROVIDERSarray and placeholder URL logic are duplicated betweenSettingsTab.tsxandSettingsModal.tsx. Consider centralizing to avoid drift.♻️ Centralize PROVIDERS in llm.types.ts
Since
PROVIDER_LABELSalready exists inllm.types.ts, you could derive or exportPROVIDERSfrom there:// In llm.types.ts export const PROVIDERS: LLMProvider[] = Object.keys(PROVIDER_LABELS) as LLMProvider[] // Or if order matters, define explicitly: export const PROVIDERS: LLMProvider[] = [ 'openai', 'anthropic', 'google', 'groq', 'xai', 'minimax', 'openrouter', 'ollama' ]Then import from both UI components to ensure consistency when adding new providers.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/renderer/src/components/tabs/SettingsTab.tsx` around lines 412 - 427, SettingsTab.tsx duplicates provider lists and placeholder URL logic already present in SettingsModal.tsx; centralize the provider definitions and any provider-specific placeholders by exporting a single PROVIDERS (and if needed PROVIDER_PLACEHOLDERS) from llm.types.ts (or the module where PROVIDER_LABELS lives) and import them into SettingsTab.tsx and SettingsModal.tsx; update the Input placeholder usage in SettingsTab's provider conditional (the component rendering using config.baseUrl and setProviderBaseUrl) to read the placeholder from the shared constant instead of duplicated ternary logic so both components stay in sync.src/renderer/src/components/modals/SettingsModal.tsx (1)
163-171: Consider extracting placeholder URLs to a constant.The nested ternary for placeholder URLs is becoming unwieldy with 4 providers. A lookup object would improve readability and reduce duplication with
SettingsTab.tsx.♻️ Optional: Extract to a constant
// Could be added to llm.types.ts alongside other provider constants const BASE_URL_PLACEHOLDERS: Partial<Record<LLMProvider, string>> = { ollama: 'http://localhost:11434', openrouter: 'https://openrouter.ai/api/v1', minimax: 'https://api.minimax.io/v1', xai: 'https://api.x.ai/v1' } // Usage: placeholder={BASE_URL_PLACEHOLDERS[provider] ?? ''}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/renderer/src/components/modals/SettingsModal.tsx` around lines 163 - 171, Extract the nested ternary used for placeholder in SettingsModal.tsx into a shared constant (e.g., BASE_URL_PLACEHOLDERS) keyed by LLMProvider to improve readability and reuse with SettingsTab.tsx; add the constant to a common location (suggest llm.types.ts alongside other provider constants) with entries for 'ollama', 'openrouter', 'minimax', and 'xai' and then replace the inline ternary expression (the placeholder prop that switches on provider) with a lookup like BASE_URL_PLACEHOLDERS[provider] ?? '' so both SettingsModal and SettingsTab can import and use the same mapping.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/renderer/src/components/modals/SettingsModal.tsx`:
- Around line 163-171: Extract the nested ternary used for placeholder in
SettingsModal.tsx into a shared constant (e.g., BASE_URL_PLACEHOLDERS) keyed by
LLMProvider to improve readability and reuse with SettingsTab.tsx; add the
constant to a common location (suggest llm.types.ts alongside other provider
constants) with entries for 'ollama', 'openrouter', 'minimax', and 'xai' and
then replace the inline ternary expression (the placeholder prop that switches
on provider) with a lookup like BASE_URL_PLACEHOLDERS[provider] ?? '' so both
SettingsModal and SettingsTab can import and use the same mapping.
In `@src/renderer/src/components/tabs/SettingsTab.tsx`:
- Around line 412-427: SettingsTab.tsx duplicates provider lists and placeholder
URL logic already present in SettingsModal.tsx; centralize the provider
definitions and any provider-specific placeholders by exporting a single
PROVIDERS (and if needed PROVIDER_PLACEHOLDERS) from llm.types.ts (or the module
where PROVIDER_LABELS lives) and import them into SettingsTab.tsx and
SettingsModal.tsx; update the Input placeholder usage in SettingsTab's provider
conditional (the component rendering using config.baseUrl and
setProviderBaseUrl) to read the placeholder from the shared constant instead of
duplicated ternary logic so both components stay in sync.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c56c3d95-159a-426c-bc2f-3600f7750924
📒 Files selected for processing (5)
README.mdsrc/main/ipc/llmHandlers.tssrc/renderer/src/components/modals/SettingsModal.tsxsrc/renderer/src/components/tabs/SettingsTab.tsxsrc/renderer/src/types/llm.types.ts
Summary
Adds MiniMax as a new LLM provider option, bringing the total from 7 to 8 supported providers.
MiniMax offers an OpenAI-compatible API with models like MiniMax-M2.5 and MiniMax-M2.5-highspeed, featuring a 204K context window — well-suited for the multi-turn node logic generation this app does.
Changes
llm.types.ts): Added'minimax'to theLLMProviderunion,DEFAULT_MODELS,PROVIDER_LABELS, andDEFAULT_LLM_SETTINGSllmHandlers.ts): Added'minimax'case to thegetAdapter()factory, reusinggetOpenAICompatibleAdapterwith MiniMax's base URL (https://api.minimax.io/v1)SettingsTab.tsx,SettingsModal.tsx): Added MiniMax to thePROVIDERSarray and base URL input conditionHow it works
Since MiniMax exposes an OpenAI-compatible chat completions endpoint, no new SDK dependency is needed — the existing
getOpenAICompatibleAdapter()handles everything with just the base URL override.Test plan
npm run build) succeedsSummary by CodeRabbit
Release Notes