diff --git a/.claude/skills/gitnexus-cli/SKILL.md b/.claude/skills/gitnexus-cli/SKILL.md index 3a00ab546..4d894893b 100644 --- a/.claude/skills/gitnexus-cli/SKILL.md +++ b/.claude/skills/gitnexus-cli/SKILL.md @@ -81,7 +81,7 @@ Generates repository documentation from the knowledge graph using an LLM. HTTP p | ------------------- | ----------------------------------------- | | `--force` | Force full regeneration, also required to re-generate an existing wiki in a different language | | `--provider ` | LLM provider: minimax, openai, openrouter, azure, custom, cursor, claude, codex, opencode, or grok (default: minimax). Local CLIs (`cursor`, `claude`, `codex`, `opencode`, `grok`) use your existing CLI login and skip `--api-key`. | -| `--model ` | LLM model (default: MiniMax-M3) | +| `--model ` | LLM model (default: MiniMax-M3.1-Flash) | | `--base-url ` | LLM API base URL | | `--api-key ` | LLM API key | | `--concurrency ` | Parallel LLM calls (default: 3) | diff --git a/gitnexus-claude-plugin/skills/gitnexus-cli/SKILL.md b/gitnexus-claude-plugin/skills/gitnexus-cli/SKILL.md index 3a00ab546..4d894893b 100644 --- a/gitnexus-claude-plugin/skills/gitnexus-cli/SKILL.md +++ b/gitnexus-claude-plugin/skills/gitnexus-cli/SKILL.md @@ -81,7 +81,7 @@ Generates repository documentation from the knowledge graph using an LLM. HTTP p | ------------------- | ----------------------------------------- | | `--force` | Force full regeneration, also required to re-generate an existing wiki in a different language | | `--provider ` | LLM provider: minimax, openai, openrouter, azure, custom, cursor, claude, codex, opencode, or grok (default: minimax). Local CLIs (`cursor`, `claude`, `codex`, `opencode`, `grok`) use your existing CLI login and skip `--api-key`. | -| `--model ` | LLM model (default: MiniMax-M3) | +| `--model ` | LLM model (default: MiniMax-M3.1-Flash) | | `--base-url ` | LLM API base URL | | `--api-key ` | LLM API key | | `--concurrency ` | Parallel LLM calls (default: 3) | diff --git a/gitnexus-web/src/core/llm/settings-service.ts b/gitnexus-web/src/core/llm/settings-service.ts index fb2591172..5022f8d17 100644 --- a/gitnexus-web/src/core/llm/settings-service.ts +++ b/gitnexus-web/src/core/llm/settings-service.ts @@ -34,7 +34,8 @@ const mergeMiniMaxSettings = ( ...stored, }; - if (!(MINIMAX_MODEL_IDS as readonly string[]).includes(merged.model ?? '')) { + // Preset changes must not replace an explicitly saved or custom model ID. + if (!merged.model?.trim()) { return { ...merged, model: DEFAULT_LLM_SETTINGS.minimax?.model, diff --git a/gitnexus-web/src/core/llm/types.ts b/gitnexus-web/src/core/llm/types.ts index c5198bd16..3a71a80b0 100644 --- a/gitnexus-web/src/core/llm/types.ts +++ b/gitnexus-web/src/core/llm/types.ts @@ -30,7 +30,7 @@ export const MINIMAX_DOCS_ROOTS = { cn_zh: 'https://platform.minimaxi.com/docs', } as const; -export const MINIMAX_MODEL_IDS = ['MiniMax-M3', 'MiniMax-M2.7'] as const; +export const MINIMAX_MODEL_IDS = ['MiniMax-M3.1-Flash', 'MiniMax-M3'] as const; export type MiniMaxModelId = (typeof MINIMAX_MODEL_IDS)[number]; export type MiniMaxThinkingMode = 'adaptive' | 'disabled' | 'always_on'; @@ -43,11 +43,20 @@ export interface MiniMaxModelCapabilities { } export const MINIMAX_MODEL_CAPABILITIES: Record = { + 'MiniMax-M3.1-Flash': { + contextWindow: 1_000_000, + inputModalities: ['text', 'image', 'video'], + thinkingModes: ['adaptive'], + }, 'MiniMax-M3': { contextWindow: 1_000_000, inputModalities: ['text', 'image', 'video'], thinkingModes: ['adaptive', 'disabled'], }, +}; + +// Retain capabilities for saved older models without advertising them as presets. +const LEGACY_MINIMAX_MODEL_CAPABILITIES: Record = { 'MiniMax-M2.7': { contextWindow: 204_800, inputModalities: ['text'], @@ -56,7 +65,7 @@ export const MINIMAX_MODEL_CAPABILITIES: Record - MINIMAX_MODEL_CAPABILITIES[model as MiniMaxModelId]; + MINIMAX_MODEL_CAPABILITIES[model as MiniMaxModelId] ?? LEGACY_MINIMAX_MODEL_CAPABILITIES[model]; export type MiniMaxMediaDetail = 'low' | 'default' | 'high'; diff --git a/gitnexus-web/src/locales/en/settings.json b/gitnexus-web/src/locales/en/settings.json index 91c6b2a68..5431eeeb2 100644 --- a/gitnexus-web/src/locales/en/settings.json +++ b/gitnexus-web/src/locales/en/settings.json @@ -76,8 +76,8 @@ "apiKeyPlaceholder": "Enter your MiniMax API key", "helperText": "Get your API key from", "helperLinkLabel": "MiniMax Platform", - "modelPlaceholder": "e.g., MiniMax-M3 or MiniMax-M2.7", - "helperModel": "Available: MiniMax-M3 (default) and MiniMax-M2.7", + "modelPlaceholder": "e.g., MiniMax-M3.1-Flash or MiniMax-M3", + "helperModel": "Available: MiniMax-M3.1-Flash (default) and MiniMax-M3", "endpoint": "Regional endpoint", "endpoints": { "global": "Global (api.minimax.io)", diff --git a/gitnexus-web/src/locales/zh-CN/settings.json b/gitnexus-web/src/locales/zh-CN/settings.json index 4bc4fb05b..642a3dc79 100644 --- a/gitnexus-web/src/locales/zh-CN/settings.json +++ b/gitnexus-web/src/locales/zh-CN/settings.json @@ -76,8 +76,8 @@ "apiKeyPlaceholder": "输入 MiniMax API Key", "helperText": "从这里获取 API Key:", "helperLinkLabel": "MiniMax Platform", - "modelPlaceholder": "例如:MiniMax-M3 或 MiniMax-M2.7", - "helperModel": "可用:MiniMax-M3(默认)和 MiniMax-M2.7", + "modelPlaceholder": "例如:MiniMax-M3.1-Flash 或 MiniMax-M3", + "helperModel": "可用:MiniMax-M3.1-Flash(默认)和 MiniMax-M3", "endpoint": "区域端点", "endpoints": { "global": "全球(api.minimax.io)", diff --git a/gitnexus-web/test/unit/agent-history.test.ts b/gitnexus-web/test/unit/agent-history.test.ts index f672e8a9d..cd22663aa 100644 --- a/gitnexus-web/test/unit/agent-history.test.ts +++ b/gitnexus-web/test/unit/agent-history.test.ts @@ -225,7 +225,7 @@ it('drops reasoningContent from serialized assistant messages without tool calls }); describe('createChatModel', () => { - it('configures MiniMax-M3 adaptive thinking on the China endpoint', () => { + it('configures MiniMax-M3.1-Flash adaptive thinking on the China endpoint', () => { const model = createChatModel({ provider: 'minimax', apiKey: 'minimax-test-key', @@ -241,11 +241,22 @@ describe('createChatModel', () => { expect(model.temperature).toBeUndefined(); }); + it('forces adaptive thinking for Flash even when disabled was saved', () => { + const model = createChatModel({ + provider: 'minimax', + apiKey: 'minimax-test-key', + model: 'MiniMax-M3.1-Flash', + thinkingMode: 'disabled', + }) as any; + expect(model.invocationParams({}).thinking).toEqual({ type: 'adaptive' }); + expect(model.temperature).toBeUndefined(); + }); + it('supports disabled thinking for MiniMax-M3', () => { const model = createChatModel({ provider: 'minimax', apiKey: 'minimax-test-key', - model: MINIMAX_MODEL_IDS[0], + model: 'MiniMax-M3', thinkingMode: 'disabled', temperature: 0.1, } as any) as any; @@ -258,7 +269,7 @@ describe('createChatModel', () => { const model = createChatModel({ provider: 'minimax', apiKey: 'minimax-test-key', - model: MINIMAX_MODEL_IDS[1], + model: 'MiniMax-M2.7', thinkingMode: 'disabled', temperature: 0.1, } as any) as any; diff --git a/gitnexus-web/test/unit/settings-service.test.ts b/gitnexus-web/test/unit/settings-service.test.ts index b0762604f..db207a98d 100644 --- a/gitnexus-web/test/unit/settings-service.test.ts +++ b/gitnexus-web/test/unit/settings-service.test.ts @@ -46,28 +46,36 @@ describe('loadSettings', () => { expect(settings.openai).toBeDefined(); }); - it('migrates unsupported legacy MiniMax models to the current default', () => { - sessionStorage.setItem( - 'gitnexus-llm-settings', - JSON.stringify({ - activeProvider: 'minimax', - minimax: { - apiKey: 'minimax-test-key', - model: 'MiniMax-M2.5', - temperature: 0.1, - }, - }), - ); + it.each(['MiniMax-M3', 'MiniMax-M2.7', 'MiniMax-M2.5', 'custom-model'])( + 'preserves the explicitly saved MiniMax model %s', + (savedModel) => { + sessionStorage.setItem( + 'gitnexus-llm-settings', + JSON.stringify({ + activeProvider: 'minimax', + minimax: { + apiKey: 'minimax-test-key', + model: savedModel, + temperature: 0.1, + }, + }), + ); - const settings = loadSettings(); - expect(settings.minimax).toMatchObject({ - model: MINIMAX_MODEL_IDS[0], - thinkingMode: 'adaptive', - }); + const settings = loadSettings(); + expect(settings.minimax).toMatchObject({ + model: savedModel, + apiKey: 'minimax-test-key', + temperature: 0.1, + }); - const model = createChatModel(getActiveProviderConfig()!) as any; - expect(model.model).toBe(MINIMAX_MODEL_IDS[0]); - expect(model.thinking).toEqual({ type: 'adaptive' }); + const model = createChatModel(getActiveProviderConfig()!) as any; + expect(model.model).toBe(savedModel); + }, + ); + + it.each([undefined, '', ' '])('defaults missing MiniMax model %j to Flash', (model) => { + sessionStorage.setItem('gitnexus-llm-settings', JSON.stringify({ minimax: { model } })); + expect(loadSettings().minimax?.model).toBe('MiniMax-M3.1-Flash'); }); it('returns defaults on corrupted JSON', () => { @@ -220,16 +228,18 @@ describe('getAvailableModels', () => { }); it('describes MiniMax model input and thinking capabilities', () => { - expect(getMiniMaxModelCapabilities(MINIMAX_MODEL_IDS[0])).toEqual({ + expect(MINIMAX_MODEL_IDS).toEqual(['MiniMax-M3.1-Flash', 'MiniMax-M3']); + expect(getMiniMaxModelCapabilities('MiniMax-M3.1-Flash')).toEqual({ + contextWindow: 1_000_000, + inputModalities: ['text', 'image', 'video'], + thinkingModes: ['adaptive'], + }); + expect(getMiniMaxModelCapabilities('MiniMax-M3')).toEqual({ contextWindow: 1_000_000, inputModalities: ['text', 'image', 'video'], thinkingModes: ['adaptive', 'disabled'], }); - expect(getMiniMaxModelCapabilities(MINIMAX_MODEL_IDS[1])).toEqual({ - contextWindow: 204_800, - inputModalities: ['text'], - thinkingModes: ['always_on'], - }); + expect(getMiniMaxModelCapabilities('MiniMax-M2.7')?.thinkingModes).toEqual(['always_on']); }); it('returns empty array for unknown provider', () => { diff --git a/gitnexus/skills/gitnexus-cli.md b/gitnexus/skills/gitnexus-cli.md index 3a00ab546..4d894893b 100644 --- a/gitnexus/skills/gitnexus-cli.md +++ b/gitnexus/skills/gitnexus-cli.md @@ -81,7 +81,7 @@ Generates repository documentation from the knowledge graph using an LLM. HTTP p | ------------------- | ----------------------------------------- | | `--force` | Force full regeneration, also required to re-generate an existing wiki in a different language | | `--provider ` | LLM provider: minimax, openai, openrouter, azure, custom, cursor, claude, codex, opencode, or grok (default: minimax). Local CLIs (`cursor`, `claude`, `codex`, `opencode`, `grok`) use your existing CLI login and skip `--api-key`. | -| `--model ` | LLM model (default: MiniMax-M3) | +| `--model ` | LLM model (default: MiniMax-M3.1-Flash) | | `--base-url ` | LLM API base URL | | `--api-key ` | LLM API key | | `--concurrency ` | Parallel LLM calls (default: 3) | diff --git a/gitnexus/src/cli/i18n/en.ts b/gitnexus/src/cli/i18n/en.ts index 8cedc843f..08e4acc04 100644 --- a/gitnexus/src/cli/i18n/en.ts +++ b/gitnexus/src/cli/i18n/en.ts @@ -350,14 +350,15 @@ export const en = { 'help.option.wiki.force': 'Force full regeneration even if up to date', 'help.option.wiki.provider': 'LLM provider: minimax, openai, openrouter, azure, custom, cursor, claude, codex, opencode, or grok (default: minimax)', - 'help.option.wiki.model': 'LLM model or deployment name (default: MiniMax-M3)', + 'help.option.wiki.model': 'LLM model or deployment name (default: MiniMax-M3.1-Flash)', 'help.option.wiki.baseUrl': 'LLM API base URL. Azure v1: https://{resource}.openai.azure.com/openai/v1', 'help.option.wiki.apiKey': 'LLM API key or Azure api-key (saved to ~/.gitnexus/config.json)', 'help.option.wiki.apiVersion': 'Azure api-version query param, e.g. 2024-10-21 (legacy Azure API only)', 'help.option.wiki.reasoningModel': 'Enable reasoning mode; MiniMax-M3 uses adaptive thinking', - 'help.option.wiki.noReasoningModel': 'Disable reasoning mode; MiniMax-M3 disables thinking', + 'help.option.wiki.noReasoningModel': + 'Disable reasoning mode; MiniMax-M3.1-Flash remains adaptive, MiniMax-M3 disables thinking', 'help.option.wiki.concurrency': 'Parallel LLM calls (default: 3)', 'help.option.wiki.timeout': 'LLM request timeout in seconds (default: disabled)', 'help.option.wiki.retries': 'Max LLM retry attempts per request (default: 3)', diff --git a/gitnexus/src/cli/i18n/zh-CN.ts b/gitnexus/src/cli/i18n/zh-CN.ts index f333188b7..2f93d7759 100644 --- a/gitnexus/src/cli/i18n/zh-CN.ts +++ b/gitnexus/src/cli/i18n/zh-CN.ts @@ -319,13 +319,14 @@ export const zhCN = { 'help.option.wiki.force': '即使已是最新也强制完整重新生成', 'help.option.wiki.provider': 'LLM 提供商:minimax、openai、openrouter、azure、custom、cursor、claude、codex、opencode 或 grok(默认:minimax)', - 'help.option.wiki.model': 'LLM 模型或 deployment 名称(默认:MiniMax-M3)', + 'help.option.wiki.model': 'LLM 模型或 deployment 名称(默认:MiniMax-M3.1-Flash)', 'help.option.wiki.baseUrl': 'LLM API base URL。Azure v1:https://{resource}.openai.azure.com/openai/v1', 'help.option.wiki.apiKey': 'LLM API key 或 Azure api-key(保存到 ~/.gitnexus/config.json)', 'help.option.wiki.apiVersion': 'Azure api-version 查询参数,例如 2024-10-21(仅旧版 Azure API)', 'help.option.wiki.reasoningModel': '启用 reasoning 模式;MiniMax-M3 使用自适应 thinking', - 'help.option.wiki.noReasoningModel': '禁用 reasoning 模式;MiniMax-M3 关闭 thinking', + 'help.option.wiki.noReasoningModel': + '禁用 reasoning 模式;MiniMax-M3.1-Flash 保持自适应 thinking,MiniMax-M3 关闭 thinking', 'help.option.wiki.concurrency': '并行 LLM 调用数(默认:3)', 'help.option.wiki.timeout': 'LLM 请求超时时间(秒,默认:禁用)', 'help.option.wiki.retries': '每个请求的最大 LLM 重试次数(默认:3)', diff --git a/gitnexus/src/cli/index.ts b/gitnexus/src/cli/index.ts index 37dfe1ddb..32b7f2e6b 100644 --- a/gitnexus/src/cli/index.ts +++ b/gitnexus/src/cli/index.ts @@ -412,7 +412,7 @@ program '--provider ', 'LLM provider: minimax, openai, openrouter, azure, custom, cursor, claude, codex, opencode, or grok (default: minimax)', ) - .option('--model ', 'LLM model or deployment name (default: MiniMax-M3)') + .option('--model ', 'LLM model or deployment name (default: MiniMax-M3.1-Flash)') .option( '--base-url ', 'LLM API base URL. Azure v1: https://{resource}.openai.azure.com/openai/v1', @@ -423,7 +423,10 @@ program 'Azure api-version query param, e.g. 2024-10-21 (legacy Azure API only)', ) .option('--reasoning-model', 'Enable reasoning mode; MiniMax-M3 uses adaptive thinking') - .option('--no-reasoning-model', 'Disable reasoning mode; MiniMax-M3 disables thinking') + .option( + '--no-reasoning-model', + 'Disable reasoning mode; MiniMax-M3.1-Flash remains adaptive, MiniMax-M3 disables thinking', + ) .option('--concurrency ', 'Parallel LLM calls (default: 3)', '3') .option('--timeout ', 'LLM request timeout in seconds (default: disabled)') .option('--retries ', 'Max LLM retry attempts per request (default: 3)') diff --git a/gitnexus/src/core/wiki/llm-client.ts b/gitnexus/src/core/wiki/llm-client.ts index b8af62099..f477285a8 100644 --- a/gitnexus/src/core/wiki/llm-client.ts +++ b/gitnexus/src/core/wiki/llm-client.ts @@ -26,7 +26,7 @@ export const MINIMAX_OPENAI_BASE_URLS = { cn_zh: 'https://api.minimaxi.com/v1', } as const; -export const MINIMAX_MODEL_IDS = ['MiniMax-M3', 'MiniMax-M2.7'] as const; +export const MINIMAX_MODEL_IDS = ['MiniMax-M3.1-Flash', 'MiniMax-M3'] as const; export type MiniMaxThinkingMode = 'adaptive' | 'disabled' | 'always_on'; @@ -83,8 +83,9 @@ export function resolveMiniMaxThinkingMode( model: string, reasoningOverride?: boolean, ): MiniMaxThinkingMode | undefined { - if (model === MINIMAX_MODEL_IDS[1]) return 'always_on'; - if (model === MINIMAX_MODEL_IDS[0]) { + if (model === 'MiniMax-M3.1-Flash') return 'adaptive'; + if (model === 'MiniMax-M2.7') return 'always_on'; + if (model === 'MiniMax-M3') { return reasoningOverride === false ? 'disabled' : 'adaptive'; } return undefined; diff --git a/gitnexus/test/unit/wiki-llm-client.test.ts b/gitnexus/test/unit/wiki-llm-client.test.ts index 2a20c7591..54882748b 100644 --- a/gitnexus/test/unit/wiki-llm-client.test.ts +++ b/gitnexus/test/unit/wiki-llm-client.test.ts @@ -309,7 +309,10 @@ describe('callLLM — MiniMax request params', () => { expect(body.temperature).toBeUndefined(); }); - it('supports disabled thinking', async () => { + it.each([ + ['MiniMax-M3.1-Flash', 'adaptive'], + ['MiniMax-M3', 'disabled'], + ])('maps disabled reasoning for %s to %s', async (model, thinkingType) => { const fetchSpy = createFetchSpy(); vi.stubGlobal('fetch', fetchSpy); @@ -317,7 +320,7 @@ describe('callLLM — MiniMax request params', () => { await callLLM('test', { apiKey: 'minimax-test-key', baseUrl: MINIMAX_OPENAI_BASE_URLS.global_en, - model: MINIMAX_MODEL_IDS[0], + model, maxTokens: 500, temperature: 0.5, provider: 'minimax', @@ -326,8 +329,10 @@ describe('callLLM — MiniMax request params', () => { const [, init] = fetchSpy.mock.calls[0] as [string, RequestInit]; const body = JSON.parse(init.body as string); - expect(body.thinking).toEqual({ type: 'disabled' }); - expect(body.temperature).toBe(0.5); + expect(body.thinking).toEqual({ type: thinkingType }); + expect(body.temperature).toBe(thinkingType === 'disabled' ? 0.5 : undefined); + expect(body.reasoning_split).toBe(true); + expect(body.service_tier).toBeUndefined(); }); it('leaves always-on thinking implicit', async () => { @@ -338,7 +343,7 @@ describe('callLLM — MiniMax request params', () => { await callLLM('test', { apiKey: 'minimax-test-key', baseUrl: MINIMAX_OPENAI_BASE_URLS.global_en, - model: MINIMAX_MODEL_IDS[1], + model: 'MiniMax-M2.7', maxTokens: 500, temperature: 0.5, provider: 'minimax',