|
1 | 1 | import { defineCommand } from '../command'; |
| 2 | +import { DOCS_HOSTS } from '../config/schema'; |
2 | 3 | import type { Config } from '../config/schema'; |
3 | 4 | import type { GlobalFlags } from '../types/flags'; |
4 | 5 |
|
5 | 6 | interface ApiRef { |
6 | 7 | command: string; |
7 | 8 | title: string; |
8 | | - url: string; |
| 9 | + path: string; |
9 | 10 | } |
10 | 11 |
|
11 | 12 | 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' }, |
20 | 21 | ]; |
21 | 22 |
|
22 | 23 | export default defineCommand({ |
23 | 24 | name: 'help', |
24 | 25 | description: 'Show MiniMax API documentation links', |
25 | 26 | 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; |
28 | 29 | process.stdout.write(` |
29 | 30 | MiniMax API Documentation Links |
30 | 31 |
|
31 | | - Official docs: https://platform.minimax.io/docs/api-reference |
| 32 | + Official docs: ${host}/docs/api-reference |
32 | 33 |
|
33 | 34 | `); |
34 | 35 | for (const ref of API_REFS) { |
35 | 36 | 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`); |
37 | 38 | } |
38 | 39 | }, |
39 | 40 | }); |
0 commit comments