Skip to content

Commit 82471e6

Browse files
committed
feat: add MiniMax brand true-color status bar to HTTP requests
- Replace single-icon prefix with bold MINIMAX brand wordmark - Use 24-bit true color (RGB) matching brand palette: - mmBlue (#2B52FF) for MINIMAX wordmark - mmPurple (#9333EA) for model name - mmCyan (#06B8D4) for region - mmPink (#EC4899) for masked API key - Status bar shows: MINIMAX Region: CN | Key: sk-c...nI7s | Model: MiniMax-M2.7 - Only renders when stderr is a TTY (no effect on redirected logs)
1 parent add6306 commit 82471e6

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

src/client/http.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,41 @@ export async function request(
4545
process.stderr.write(`> ${opts.method || 'GET'} ${opts.url}\n`);
4646
process.stderr.write(`> Auth: ${credential.token.slice(0, 8)}...\n`);
4747
}
48+
49+
// ANSI 真彩色 (24-bit) 与基础排版
50+
if (process.stderr.isTTY) {
51+
const reset = '\x1b[0m';
52+
const dim = '\x1b[2m';
53+
const bold = '\x1b[1m'; // 新增加粗效果
54+
55+
// 从 MiniMax Logo/品牌视觉提取的 RGB 颜色
56+
const mmBlue = '\x1b[38;2;43;82;255m'; // 主品牌色:MiniMax 科技蓝 (#2B52FF)
57+
const mmPurple = '\x1b[38;2;147;51;234m'; // 辅助品牌色:活力紫 (#9333EA)
58+
const mmCyan = '\x1b[38;2;6;184;212m'; // 点缀色:青色 (#06B8D4)
59+
const mmPink = '\x1b[38;2;236;72;153m'; // 点缀色:粉红 (#EC4899)
60+
61+
// 提取 Region (根据 baseUrl 推断)
62+
const region = config.baseUrl.includes('minimaxi.com') ? 'CN' : 'Global';
63+
64+
// 提取脱敏的 Key
65+
const token = credential.token;
66+
const maskedKey = token.length > 8 ? `${token.slice(0, 4)}...${token.slice(-4)}` : '***';
67+
68+
// 尝试从 body 中提取 Model
69+
let modelStr = '';
70+
if (opts.body && typeof opts.body === 'object' && 'model' in opts.body) {
71+
modelStr = ` ${dim}|${reset} ${dim}Model:${reset} ${mmPurple}${(opts.body as any).model}${reset}`;
72+
}
73+
74+
// 打印带有完整 MINIMAX 标识的状态栏
75+
process.stderr.write(
76+
`${bold}${mmBlue}MINIMAX${reset} ` +
77+
`${dim}Region:${reset} ${mmCyan}${region}${reset} ` +
78+
`${dim}|${reset} ` +
79+
`${dim}Key:${reset} ${mmPink}${maskedKey}${reset}` +
80+
`${modelStr}\n`
81+
);
82+
}
4883
}
4984

5085
const timeoutMs = (opts.timeout || config.timeout) * 1000;

0 commit comments

Comments
 (0)