mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-18 09:43:04 +00:00
Merge 741b223a70 into 374b10de86
This commit is contained in:
commit
fa17eadd7b
14 changed files with 95 additions and 53 deletions
|
|
@ -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 <name>` | 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 <model>` | LLM model (default: MiniMax-M3) |
|
||||
| `--model <model>` | LLM model (default: MiniMax-M3.1-Flash) |
|
||||
| `--base-url <url>` | LLM API base URL |
|
||||
| `--api-key <key>` | LLM API key |
|
||||
| `--concurrency <n>` | Parallel LLM calls (default: 3) |
|
||||
|
|
|
|||
|
|
@ -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 <name>` | 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 <model>` | LLM model (default: MiniMax-M3) |
|
||||
| `--model <model>` | LLM model (default: MiniMax-M3.1-Flash) |
|
||||
| `--base-url <url>` | LLM API base URL |
|
||||
| `--api-key <key>` | LLM API key |
|
||||
| `--concurrency <n>` | Parallel LLM calls (default: 3) |
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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<MiniMaxModelId, MiniMaxModelCapabilities> = {
|
||||
'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<string, MiniMaxModelCapabilities> = {
|
||||
'MiniMax-M2.7': {
|
||||
contextWindow: 204_800,
|
||||
inputModalities: ['text'],
|
||||
|
|
@ -56,7 +65,7 @@ export const MINIMAX_MODEL_CAPABILITIES: Record<MiniMaxModelId, MiniMaxModelCapa
|
|||
};
|
||||
|
||||
export const getMiniMaxModelCapabilities = (model: string): MiniMaxModelCapabilities | undefined =>
|
||||
MINIMAX_MODEL_CAPABILITIES[model as MiniMaxModelId];
|
||||
MINIMAX_MODEL_CAPABILITIES[model as MiniMaxModelId] ?? LEGACY_MINIMAX_MODEL_CAPABILITIES[model];
|
||||
|
||||
export type MiniMaxMediaDetail = 'low' | 'default' | 'high';
|
||||
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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', () => {
|
||||
|
|
|
|||
|
|
@ -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 <name>` | 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 <model>` | LLM model (default: MiniMax-M3) |
|
||||
| `--model <model>` | LLM model (default: MiniMax-M3.1-Flash) |
|
||||
| `--base-url <url>` | LLM API base URL |
|
||||
| `--api-key <key>` | LLM API key |
|
||||
| `--concurrency <n>` | Parallel LLM calls (default: 3) |
|
||||
|
|
|
|||
|
|
@ -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)',
|
||||
|
|
|
|||
|
|
@ -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)',
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ program
|
|||
'--provider <provider>',
|
||||
'LLM provider: minimax, openai, openrouter, azure, custom, cursor, claude, codex, opencode, or grok (default: minimax)',
|
||||
)
|
||||
.option('--model <model>', 'LLM model or deployment name (default: MiniMax-M3)')
|
||||
.option('--model <model>', 'LLM model or deployment name (default: MiniMax-M3.1-Flash)')
|
||||
.option(
|
||||
'--base-url <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 <n>', 'Parallel LLM calls (default: 3)', '3')
|
||||
.option('--timeout <seconds>', 'LLM request timeout in seconds (default: disabled)')
|
||||
.option('--retries <n>', 'Max LLM retry attempts per request (default: 3)')
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue