Skip to content

Commit c7a762d

Browse files
committed
fix: apiDocs paths, region-aware help, add speech apiDocs
- Change all apiDocs from full URLs to paths (works with DOCS_HOSTS) - Make help command region-aware using DOCS_HOSTS + config.region - Remove self-referential apiDocs from help command - Add missing apiDocs to speech/synthesize (was claimed in PR body)
1 parent d49f204 commit c7a762d

3 files changed

Lines changed: 16 additions & 14 deletions

File tree

src/commands/help.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
import { defineCommand } from '../command';
2+
import { DOCS_HOSTS } from '../config/schema';
23
import type { Config } from '../config/schema';
34
import type { GlobalFlags } from '../types/flags';
45

56
interface ApiRef {
67
command: string;
78
title: string;
8-
url: string;
9+
path: string;
910
}
1011

1112
const API_REFS: ApiRef[] = [
12-
{ command: 'mmx text chat', title: 'Text Generation (Chat Completion)', url: 'https://platform.minimax.io/docs/api-reference/text-post' },
13-
{ command: 'mmx speech synthesize', title: 'Speech T2A (Text-to-Audio)', url: 'https://platform.minimax.io/docs/api-reference/speech-t2a-http' },
14-
{ command: 'mmx image generate', title: 'Image Generation (T2I / I2I)', url: 'https://platform.minimax.io/docs/api-reference/image-generation-t2i' },
15-
{ command: 'mmx video generate', title: 'Video Generation (T2V / I2V / S2V)', url: 'https://platform.minimax.io/docs/api-reference/video-generation' },
16-
{ command: 'mmx music generate', title: 'Music Generation', url: 'https://platform.minimax.io/docs/api-reference/music-generation' },
17-
{ command: 'mmx music cover', title: 'Music Cover (via Music Generation)', url: 'https://platform.minimax.io/docs/api-reference/music-generation' },
18-
{ command: 'mmx search query', title: 'Web Search', url: 'https://platform.minimax.io/docs/api-reference/web-search' },
19-
{ command: 'mmx vision describe', title: 'Vision (Image Understanding)', url: 'https://platform.minimax.io/docs/api-reference/vision' },
13+
{ command: 'mmx text chat', title: 'Text Generation (Chat Completion)', path: '/docs/api-reference/text-post' },
14+
{ command: 'mmx speech synthesize', title: 'Speech T2A (Text-to-Audio)', path: '/docs/api-reference/speech-t2a-http' },
15+
{ command: 'mmx image generate', title: 'Image Generation (T2I / I2I)', path: '/docs/api-reference/image-generation-t2i' },
16+
{ command: 'mmx video generate', title: 'Video Generation (T2V / I2V / S2V)', path: '/docs/api-reference/video-generation' },
17+
{ command: 'mmx music generate', title: 'Music Generation', path: '/docs/api-reference/music-generation' },
18+
{ command: 'mmx music cover', title: 'Music Cover (via Music Generation)', path: '/docs/api-reference/music-generation' },
19+
{ command: 'mmx search query', title: 'Web Search', path: '/docs/api-reference/web-search' },
20+
{ command: 'mmx vision describe', title: 'Vision (Image Understanding)', path: '/docs/api-reference/vision' },
2021
];
2122

2223
export default defineCommand({
2324
name: 'help',
2425
description: 'Show MiniMax API documentation links',
2526
usage: 'mmx help',
26-
apiDocs: 'https://platform.minimax.io/docs/api-reference',
27-
async run(_config: Config, _flags: GlobalFlags) {
27+
async run(config: Config, _flags: GlobalFlags) {
28+
const host = DOCS_HOSTS[config.region] || DOCS_HOSTS.global;
2829
process.stdout.write(`
2930
MiniMax API Documentation Links
3031
31-
Official docs: https://platform.minimax.io/docs/api-reference
32+
Official docs: ${host}/docs/api-reference
3233
3334
`);
3435
for (const ref of API_REFS) {
3536
process.stdout.write(` ${ref.command.padEnd(30)} ${ref.title}\n`);
36-
process.stdout.write(` ${' '.repeat(30)} ${ref.url}\n\n`);
37+
process.stdout.write(` ${' '.repeat(30)} ${host}${ref.path}\n\n`);
3738
}
3839
},
3940
});

src/commands/speech/synthesize.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type { SpeechRequest, SpeechResponse } from '../../types/api';
1414
export default defineCommand({
1515
name: 'speech synthesize',
1616
description: 'Synchronous TTS, up to 10k chars (speech-2.8-hd / 2.6 / 02)',
17+
apiDocs: '/docs/api-reference/speech-t2a-http',
1718
usage: 'mmx speech synthesize --text <text> [--out <path>] [flags]',
1819
options: [
1920
{ flag: '--model <model>', description: 'Model ID (default: speech-2.8-hd)' },

src/commands/text/chat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function extractText(content: ContentBlock[]): string {
7878
export default defineCommand({
7979
name: 'text chat',
8080
description: 'Send a chat completion (MiniMax Messages API)',
81-
apiDocs: 'https://platform.minimax.io/docs/api-reference/text-post',
81+
apiDocs: '/docs/api-reference/text-post',
8282
usage: 'mmx text chat --message <text> [flags]',
8383
options: [
8484
{ flag: '--model <model>', description: 'Model ID (default: MiniMax-M2.7)' },

0 commit comments

Comments
 (0)