Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/cli/src/commands/app/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ export default defineCommand({
{ flag: "--has-thoughts", description: "Show agent thinking process" },
],
examples: [
'bl app call --app-id abc123 --prompt "你好"',
'bl app call --app-id abc123 --prompt "描述这张图片" --image https://example.com/photo.jpg',
'bl app call --app-id abc123 --prompt "分析图片" --image img1.jpg --image img2.jpg',
'bl app call --app-id abc123 --prompt "继续" --session-id sess_xxx --stream',
'bl app call --app-id abc123 --prompt "搜索资料" --pipeline-ids pipe1,pipe2',
'bl app call --app-id abc123 --prompt "开始" --biz-params \'{"key":"value"}\'',
'bl app call --app-id abc123 --prompt "Hello"',
'bl app call --app-id abc123 --prompt "Describe this image" --image https://example.com/photo.jpg',
'bl app call --app-id abc123 --prompt "Analyze the image" --image img1.jpg --image img2.jpg',
'bl app call --app-id abc123 --prompt "Continue" --session-id sess_xxx --stream',
'bl app call --app-id abc123 --prompt "Search for materials" --pipeline-ids pipe1,pipe2',
'bl app call --app-id abc123 --prompt "Start" --biz-params \'{"key":"value"}\'',
],
async run(config: Config, flags: GlobalFlags) {
const appId = flags.appId as string;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/app/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default defineCommand({
],
examples: [
"bl app list",
"bl app list --name 客服",
"bl app list --name customer service",
"bl app list --page 2 --page-size 10",
"bl app list --output json",
],
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/image/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ export default defineCommand({
{ flag: "--out-prefix <prefix>", description: "Filename prefix (default: edited)" },
],
examples: [
'bl image edit --image ./photo.png --prompt "把背景换成海滩"',
'bl image edit --image ./photo.png --prompt "Replace the background with a beach"',
'bl image edit --image https://example.com/logo.png --prompt "Change color to blue" --n 3',
'bl image edit --image ./a.png --image ./b.png --prompt "把两张图合并成一张拼图"',
'bl image edit --image ./a.png --image ./b.png --prompt "Merge two images into one collage"',
'bl image edit --image https://example.com/photo.png --prompt "Remove the person" --model qwen-image-2.0-pro',
'bl image edit --image ./photo.png --prompt "把背景换成海滩" --watermark false',
'bl image edit --image ./photo.png --prompt "Replace the background with a beach" --watermark false',
],
async run(config: Config, flags: GlobalFlags) {
// Normalize --image to string array (supports both single and repeated flags)
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/image/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default defineCommand({
},
],
examples: [
'bl image generate --prompt "一只穿太空服的猫在火星上"',
'bl image generate --prompt "A cat in a spacesuit on Mars"',
'bl image generate --prompt "Logo design" --n 3 --out-dir ./generated/',
'bl image generate --prompt "Mountain landscape" --size 2688*1536',
'bl image generate --prompt "A castle" --seed 42 --prompt-extend false',
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/knowledge/retrieve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export default defineCommand({
"`--workspace-id` is NOT required when using --api-key.",
],
examples: [
'bl knowledge retrieve --index-id idx_xxx --query "如何使用阿里云百炼"',
'bl knowledge retrieve --api-key $DASHSCOPE_API_KEY --index-id idx_xxx --query "RAG检索" --rerank --rerank-model qwen3-rerank-hybrid',
'bl knowledge retrieve --index-id idx_xxx --query "How to use Alibaba Cloud Bailian"',
'bl knowledge retrieve --api-key $DASHSCOPE_API_KEY --index-id idx_xxx --query "RAG retrieval" --rerank --rerank-model qwen3-rerank-hybrid',
],
async run(config: Config, flags: GlobalFlags) {
const indexId = flags.indexId as string;
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/mcp/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export default defineCommand({
{ flag: "--url <url>", description: "Override the MCP endpoint URL (for non-Bailian servers)" },
],
examples: [
'bl mcp call market-cmapi00073529.SmartStockSelection --query "筛选ROE>15%的消费股"',
'bl mcp call market-cmapi00073529.FinQuery --json \'{"q":"贵州茅台","limit":5}\'',
'bl mcp call market-cmapi00073529.SmartStockSelection --query "Screen consumer stocks with ROE > 15%"',
'bl mcp call market-cmapi00073529.FinQuery --json \'{"q":"Guizhou Maotai","limit":5}\'',
"bl mcp call market-cmapi00073529.SmartFundSelection --arg riskLevel=R3 --arg minScale=10",
],
async run(config: Config, flags: GlobalFlags) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/mcp/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default defineCommand({
{ flag: "--page-size <n>", description: "Results per page (default: 30)", type: "number" },
{ flag: "--region <region>", description: "API region (default: cn-beijing)" },
],
examples: ["bl mcp list", "bl mcp list --name 金融", "bl mcp list --output json"],
examples: ["bl mcp list", "bl mcp list --name finance", "bl mcp list --output json"],
async run(config: Config, flags: GlobalFlags) {
const serverName = (flags.name as string) || "";
const type = (flags.type as string) || "OFFICIAL";
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/memory/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export default defineCommand({
{ flag: "--memory-library-id <id>", description: "Memory library ID (isolate memory space)" },
],
examples: [
'bl memory add --user-id user1 --content "用户喜欢Python编程"',
'bl memory add --user-id user1 --messages \'[{"role":"user","content":"我喜欢旅行"}]\'',
'bl memory add --user-id user1 --content "住在北京" --profile-schema schema_xxx',
'bl memory add --user-id user1 --content "The user likes Python programming"',
'bl memory add --user-id user1 --messages \'[{"role":"user","content":"I like traveling"}]\'',
'bl memory add --user-id user1 --content "Lives in Beijing" --profile-schema schema_xxx',
],
async run(config: Config, flags: GlobalFlags) {
const userId = flags.userId as string;
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/memory/profile-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export default defineCommand({
{ flag: "--description <text>", description: "Schema description" },
{
flag: "--attributes <json>",
description: 'Attributes JSON array: [{"name":"age","description":"年龄"}]',
description: 'Attributes JSON array: [{"name":"age","description":"age"}]',
required: true,
},
],
examples: [
'bl memory profile create --name "user_basic" --attributes \'[{"name":"age","description":"年龄"},{"name":"hobby","description":"爱好"}]\'',
'bl memory profile create --name "user_basic" --attributes \'[{"name":"age","description":"age"},{"name":"hobby","description":"hobby"}]\'',
],
async run(config: Config, flags: GlobalFlags) {
const name = flags.name as string;
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/memory/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default defineCommand({
{ flag: "--memory-library-id <id>", description: "Memory library ID" },
],
examples: [
'bl memory search --user-id user1 --query "编程偏好"',
'bl memory search --user-id user1 --messages \'[{"role":"user","content":"推荐一本书"}]\' --top-k 5',
'bl memory search --user-id user1 --query "programming preferences"',
'bl memory search --user-id user1 --messages \'[{"role":"user","content":"recommend a book"}]\' --top-k 5',
],
async run(config: Config, flags: GlobalFlags) {
const userId = flags.userId as string;
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/src/commands/memory/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export default defineCommand({
},
{ flag: "--memory-library-id <id>", description: "Memory library ID (non-default library)" },
],
examples: ['bl memory update --node-id node_xxx --user-id user1 --content "更新后的记忆内容"'],
examples: [
'bl memory update --node-id node_xxx --user-id user1 --content "updated memory content"',
],
async run(config: Config, flags: GlobalFlags) {
const nodeId = flags.nodeId as string;
if (!nodeId)
Expand Down
16 changes: 8 additions & 8 deletions packages/cli/src/commands/omni/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { promptText, failIfMissing } from "../../output/prompt.ts";
import { emitResult } from "../../output/output.ts";
import { resolveOutputDir, resolveCredential } from "bailian-cli-core";

const OMNI_VOICES = ["Chelsie", "Cherry", "Ethan", "Serena", "Tina"];
const OMNI_VOICES = ["Chelsie", "Cherry", "Ethan", "Serena", "Sunny", "Tina"];

/**
* Extension to input audio format.
Expand Down Expand Up @@ -119,14 +119,14 @@ export default defineCommand({
{ flag: "--temperature <n>", description: "Sampling temperature (0.0, 2.0]", type: "number" },
],
examples: [
'bl omni --message "你好,你是谁?"',
'bl omni --message "描述这张图片" --image ./photo.jpg',
'bl omni --message "这段音频在说什么?" --audio https://example.com/audio.wav',
'bl omni --message "总结这个视频" --video https://example.com/video.mp4',
'bl omni --message "这个视频讲了什么" --video ./local-video.mp4 --text-only',
'bl omni --message "用四川话回答:今天天气怎么样" --voice Serena',
'bl omni --message "Hello, who are you?"',
'bl omni --message "Describe this image" --image ./photo.jpg',
'bl omni --message "What is this audio saying?" --audio https://example.com/audio.wav',
'bl omni --message "Summarize this video" --video https://example.com/video.mp4',
'bl omni --message "What is this video about?" --video ./local-video.mp4 --text-only',
'bl omni --message "Answer in Sichuan dialect: How\'s the weather today?" --voice Sunny',
'bl omni --message "Hello" --text-only --output json',
'bl omni --message "朗读这段话" --audio-out greeting.wav',
'bl omni --message "Read this passage aloud" --audio-out greeting.wav',
],
async run(config: Config, flags: GlobalFlags) {
// --- Parse messages ---
Expand Down
31 changes: 12 additions & 19 deletions packages/cli/src/commands/quota/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ function formatRatio(usage: number, limit: number): string {
function getStatus(usage: number, limit: number): string {
if (limit <= 0) return "-";
const pct = (usage / limit) * 100;
if (pct >= 100) return "已限流";
if (pct >= 80) return "接近限流";
return "正常";
if (pct >= 100) return "Rate Limited";
if (pct >= 80) return "Near limit";
return "Normal";
}

function getNestedRecord(
Expand Down Expand Up @@ -193,8 +193,7 @@ function printTable(rows: CheckRow[], noColor: boolean): void {
const yellow = noColor ? (t: string) => t : (t: string) => `\x1b[33m${t}\x1b[0m`;
const red = noColor ? (t: string) => t : (t: string) => `\x1b[31m${t}\x1b[0m`;

const headersCn = ["模型", "RPM 用量/限额", "TPM 用量/限额", "状态"];
const headersEn = ["Model", "RPM Usage/Limit", "TPM Usage/Limit", "Status"];
const headers = ["Model", "RPM Usage/Limit", "TPM Usage/Limit", "Status"];

const tableRows = rows.map((r) => {
const rpmStr = r.rpmUsage < 0 ? "-" : formatRatio(r.rpmUsage, r.rpmLimit);
Expand All @@ -215,36 +214,30 @@ function printTable(rows: CheckRow[], noColor: boolean): void {
return;
}

const widths = headersCn.map((label, col) =>
Math.max(
displayWidth(label),
displayWidth(headersEn[col]),
...tableRows.map((r) => displayWidth(r.cells[col])),
),
const widths = headers.map((label, col) =>
Math.max(displayWidth(label), ...tableRows.map((r) => displayWidth(r.cells[col]))),
);

const cnLine = headersCn.map((label, col) => bold(padEnd(label, widths[col]))).join(" ");
const enLine = headersEn.map((label, col) => dim(padEnd(label, widths[col]))).join(" ");
const headerLine = headers.map((label, col) => bold(padEnd(label, widths[col]))).join(" ");
const separator = widths.map((w) => dim("─".repeat(w))).join("──");

process.stdout.write(cnLine + "\n");
process.stdout.write(enLine + "\n");
process.stdout.write(headerLine + "\n");
process.stdout.write(separator + "\n");

const statusCol = 3;
for (const r of tableRows) {
const cells = r.cells.map((cell, col) => {
if (col === statusCol) {
if (cell === "已限流") return red(padEnd(cell, widths[col]));
if (cell === "接近限流") return yellow(padEnd(cell, widths[col]));
if (cell === "正常") return green(padEnd(cell, widths[col]));
if (cell === "Rate Limited") return red(padEnd(cell, widths[col]));
if (cell === "Near limit") return yellow(padEnd(cell, widths[col]));
if (cell === "Normal") return green(padEnd(cell, widths[col]));
}
return padEnd(cell, widths[col]);
});
process.stdout.write(cells.join(" ") + "\n");
}

process.stdout.write(dim(`\n共 ${rows.length} 个模型 (Total: ${rows.length})`) + "\n");
process.stdout.write(dim(`\nTotal: ${rows.length} models`) + "\n");
}

export default defineCommand({
Expand Down
19 changes: 6 additions & 13 deletions packages/cli/src/commands/quota/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,36 +65,29 @@ function printTable(records: LimitApplicationItem[], noColor: boolean, total: nu
const bold = noColor ? (t: string) => t : (t: string) => `\x1b[1m${t}\x1b[0m`;
const dim = noColor ? (t: string) => t : (t: string) => `\x1b[2m${t}\x1b[0m`;

const headersCn = ["模型", "Token 账号限流", "申请时间"];
const headersEn = ["Model", "Token Limit", "Applied At"];
const headers = ["Model", "Token Limit", "Applied At"];

const rows = records.map((r) => [
r.deployedModel,
formatNumber(r.usageLimit),
formatDateTime(r.gmtCreate),
]);

const widths = headersCn.map((label, col) =>
Math.max(
displayWidth(label),
displayWidth(headersEn[col]),
...rows.map((row) => displayWidth(row[col])),
),
const widths = headers.map((label, col) =>
Math.max(displayWidth(label), ...rows.map((row) => displayWidth(row[col]))),
);

const cnLine = headersCn.map((label, col) => bold(padEnd(label, widths[col]))).join(" ");
const enLine = headersEn.map((label, col) => dim(padEnd(label, widths[col]))).join(" ");
const headerLine = headers.map((label, col) => bold(padEnd(label, widths[col]))).join(" ");
const separator = widths.map((w) => dim("─".repeat(w))).join("──");

process.stdout.write(cnLine + "\n");
process.stdout.write(enLine + "\n");
process.stdout.write(headerLine + "\n");
process.stdout.write(separator + "\n");

for (const row of rows) {
process.stdout.write(row.map((cell, col) => padEnd(cell, widths[col])).join(" ") + "\n");
}

process.stdout.write(dim(`\n共 ${total} 条记录 (Total: ${total})`) + "\n");
process.stdout.write(dim(`\nTotal: ${total} records`) + "\n");
}

export default defineCommand({
Expand Down
19 changes: 6 additions & 13 deletions packages/cli/src/commands/quota/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ function printTable(models: ModelWithQpm[], noColor: boolean): void {
const bold = noColor ? (t: string) => t : (t: string) => `\x1b[1m${t}\x1b[0m`;
const dim = noColor ? (t: string) => t : (t: string) => `\x1b[2m${t}\x1b[0m`;

const headersCn = ["模型", "RPM", "TPM", "可设上限 TPM"];
const headersEn = ["Model", "Req/min", "Token/min", "Max TPM"];
const headers = ["Model", "Req/min", "Token/min", "Max TPM"];

const rows = models.map((m) => {
const qpm = m.qpmInfo;
Expand All @@ -135,27 +134,21 @@ function printTable(models: ModelWithQpm[], noColor: boolean): void {
return;
}

const widths = headersCn.map((label, col) =>
Math.max(
displayWidth(label),
displayWidth(headersEn[col]),
...rows.map((row) => displayWidth(row[col])),
),
const widths = headers.map((label, col) =>
Math.max(displayWidth(label), ...rows.map((row) => displayWidth(row[col]))),
);

const cnLine = headersCn.map((label, col) => bold(padEnd(label, widths[col]))).join(" ");
const enLine = headersEn.map((label, col) => dim(padEnd(label, widths[col]))).join(" ");
const headerLine = headers.map((label, col) => bold(padEnd(label, widths[col]))).join(" ");
const separator = widths.map((w) => dim("─".repeat(w))).join("──");

process.stdout.write(cnLine + "\n");
process.stdout.write(enLine + "\n");
process.stdout.write(headerLine + "\n");
process.stdout.write(separator + "\n");

for (const row of rows) {
process.stdout.write(row.map((cell, col) => padEnd(cell, widths[col])).join(" ") + "\n");
}

process.stdout.write(dim(`\n共 ${models.length} 个模型 (Total: ${models.length})`) + "\n");
process.stdout.write(dim(`\nTotal: ${models.length} models`) + "\n");
}

export default defineCommand({
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/search/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export default defineCommand({
{ flag: "--list-tools", description: "List available MCP tools and exit" },
],
examples: [
'bl search web --query "阿里云百炼最新功能"',
'bl search web --query "Alibaba Cloud Bailian latest features"',
'bl search web --query "TypeScript 5.9 new features" --count 5',
'bl search web --query "今日新闻"',
'bl search web --query "Today\'s news"',
"bl search web --list-tools",
],
async run(config: Config, flags: GlobalFlags) {
Expand Down
9 changes: 5 additions & 4 deletions packages/cli/src/commands/speech/synthesize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ export default defineCommand({
{ flag: "--language <lang>", description: "Language hint (e.g. zh, en, ja, ko, fr, de)" },
{
flag: "--instruction <text>",
description: 'Natural language instruction to control speech style (e.g. "请用温柔的语调")',
description:
'Natural language instruction to control speech style (e.g. "Use a gentle tone")',
},
{ flag: "--enable-ssml", description: "Enable SSML markup parsing in input text" },
{
Expand All @@ -182,13 +183,13 @@ export default defineCommand({
],
examples: [
"bl speech synthesize --list-voices --model cosyvoice-v3-flash",
'bl speech synthesize --text "你好,我是千问" --voice <voice_id>',
'bl speech synthesize --text "Hello, I am Qwen" --voice <voice_id>',
'bl speech synthesize --text "Hello world" --voice <voice_id> --language en',
"bl speech synthesize --text-file script.txt --out speech.wav --voice <voice_id>",
'bl speech synthesize --text "今天天气真好" --voice <voice_id> --instruction "请用温柔的语调说话"',
'bl speech synthesize --text "Today is a good day" --voice <voice_id> --instruction "Use a gentle tone"',
'bl speech synthesize --text "Hello" --voice <voice_id> --format wav --sample-rate 24000',
"# Stream to audio player (macOS)",
'bl speech synthesize --text "你好" --voice <voice_id> --stream | afplay -',
'bl speech synthesize --text "Hello" --voice <voice_id> --stream | afplay -',
"# Pipe to ffplay",
'bl speech synthesize --text "Hello" --voice <voice_id> --stream | ffplay -nodisp -autoexit -f s16le -ar 24000 -ac 1 -',
],
Expand Down
19 changes: 6 additions & 13 deletions packages/cli/src/commands/usage/free.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ function printTable(
typeMap: Map<string, string>,
noColor: boolean,
): void {
const headersCn = ["模型", "类型", "剩余/总量", "使用率", "过期时间", "用完即停"];
const headersEn = ["Model", "Type", "Remaining/Total", "Usage", "Expires", "Auto-Stop"];
const headers = ["Model", "Type", "Remaining/Total", "Usage", "Expires", "Auto-Stop"];

const rows = quotas.map((quota) => {
const hasQuota = quota.quotaInitTotal != null && quota.quotaTotal != null;
Expand All @@ -102,26 +101,20 @@ function printTable(
];
});

const widths = headersCn.map((label, col) =>
Math.max(
displayWidth(label),
displayWidth(headersEn[col]),
...rows.map((row) => displayWidth(row[col])),
),
const widths = headers.map((label, col) =>
Math.max(displayWidth(label), ...rows.map((row) => displayWidth(row[col]))),
);

const dim = noColor ? (text: string) => text : (text: string) => `\x1b[2m${text}\x1b[0m`;
const bold = noColor ? (text: string) => text : (text: string) => `\x1b[1m${text}\x1b[0m`;
const green = noColor ? (text: string) => text : (text: string) => `\x1b[32m${text}\x1b[0m`;
const yellow = noColor ? (text: string) => text : (text: string) => `\x1b[33m${text}\x1b[0m`;

const autoStopCol = headersCn.length - 1;
const cnLine = headersCn.map((label, col) => bold(padEnd(label, widths[col]))).join(" ");
const enLine = headersEn.map((label, col) => dim(padEnd(label, widths[col]))).join(" ");
const autoStopCol = headers.length - 1;
const headerLine = headers.map((label, col) => bold(padEnd(label, widths[col]))).join(" ");
const separator = widths.map((width) => dim("─".repeat(width))).join("──");

process.stdout.write(cnLine + "\n");
process.stdout.write(enLine + "\n");
process.stdout.write(headerLine + "\n");
process.stdout.write(separator + "\n");

for (const row of rows) {
Expand Down
Loading