diff --git a/packages/commands/src/commands/advisor/recommend.ts b/packages/commands/src/commands/advisor/recommend.ts index c328b06..70499ca 100644 --- a/packages/commands/src/commands/advisor/recommend.ts +++ b/packages/commands/src/commands/advisor/recommend.ts @@ -226,15 +226,18 @@ function isEmptyResult(result: RecommendResult): boolean { } export default defineCommand({ - description: - "Recommend the best models for your use case (intent analysis → candidate recall → LLM ranking)", + description: { + "en-US": + "Recommend the best models for your use case (intent analysis → candidate recall → LLM ranking)", + "zh-CN": "为你的使用场景推荐最佳模型(意图分析 → 候选召回 → LLM 排序)", + }, auth: "apiKey", usageArgs: "--message [flags]", flags: { message: { type: "string", valueHint: "", - description: "Describe your requirements", + description: { "en-US": "Describe your requirements", "zh-CN": "描述你的需求" }, required: true, }, }, diff --git a/packages/commands/src/commands/app/call.ts b/packages/commands/src/commands/app/call.ts index cdd2ef2..14e1c00 100644 --- a/packages/commands/src/commands/app/call.ts +++ b/packages/commands/src/commands/app/call.ts @@ -11,50 +11,84 @@ import { import { ansi, emitResult, emitBare } from "bailian-cli-runtime"; export default defineCommand({ - description: "Call a Bailian application (agent or workflow)", + description: { + "en-US": "Call a Bailian application (agent or workflow)", + "zh-CN": "调用百炼应用(智能体或工作流)", + }, auth: "apiKey", usageArgs: "--app-id --prompt [flags]", flags: { appId: { type: "string", valueHint: "", - description: "Application ID (required)", + description: { "en-US": "Application ID (required)", "zh-CN": "应用 ID(必填)" }, required: true, }, prompt: { type: "string", valueHint: "", - description: "Input prompt text", + description: { "en-US": "Input prompt text", "zh-CN": "输入提示词文本" }, required: true, }, image: { type: "array", valueHint: "", - description: "Image URL(s) to pass to the app (repeatable)", + description: { + "en-US": "Image URL(s) to pass to the app (repeatable)", + "zh-CN": "传给应用的图片 URL(可重复)", + }, }, fileId: { type: "array", valueHint: "", - description: "Pre-uploaded file ID(s) (repeatable)", + description: { + "en-US": "Pre-uploaded file ID(s) (repeatable)", + "zh-CN": "已上传的文件 ID(可重复)", + }, }, sessionId: { type: "string", valueHint: "", - description: "Session ID for multi-turn conversation", + description: { + "en-US": "Session ID for multi-turn conversation", + "zh-CN": "多轮对话的 Session ID", + }, + }, + stream: { + type: "switch", + description: { + "en-US": "Stream response (default: on in TTY)", + "zh-CN": "流式输出响应(TTY 中默认开启)", + }, }, - stream: { type: "switch", description: "Stream response (default: on in TTY)" }, pipelineIds: { type: "string", valueHint: "", - description: "Knowledge base pipeline IDs (comma-separated)", + description: { + "en-US": "Knowledge base pipeline IDs (comma-separated)", + "zh-CN": "知识库 Pipeline ID(以逗号分隔)", + }, + }, + memoryId: { + type: "string", + valueHint: "", + description: { + "en-US": "Memory ID for long-term memory", + "zh-CN": "长期记忆使用的 Memory ID", + }, }, - memoryId: { type: "string", valueHint: "", description: "Memory ID for long-term memory" }, bizParams: { type: "string", valueHint: "", - description: "Business parameters JSON (workflow variables)", + description: { + "en-US": "Business parameters JSON (workflow variables)", + "zh-CN": "业务参数 JSON(工作流变量)", + }, + }, + hasThoughts: { + type: "switch", + description: { "en-US": "Show agent thinking process", "zh-CN": "显示智能体思考过程" }, }, - hasThoughts: { type: "switch", description: "Show agent thinking process" }, }, exampleArgs: [ '--app-id abc123 --prompt "Hello"', diff --git a/packages/commands/src/commands/app/list.ts b/packages/commands/src/commands/app/list.ts index dca7fe1..fb52453 100644 --- a/packages/commands/src/commands/app/list.ts +++ b/packages/commands/src/commands/app/list.ts @@ -4,24 +4,27 @@ import { emitResult } from "bailian-cli-runtime"; const APP_LIST_API = "zeldaEasy.broadscope-bailian.app-control.list"; export default defineCommand({ - description: "List Bailian applications", + description: { "en-US": "List Bailian applications", "zh-CN": "列出百炼应用" }, auth: "console", usageArgs: "[flags]", flags: { name: { type: "string", valueHint: "", - description: "Filter by app name (keyword search)", + description: { + "en-US": "Filter by app name (keyword search)", + "zh-CN": "按应用名称筛选(关键词搜索)", + }, }, page: { type: "number", valueHint: "", - description: "Page number (default: 1)", + description: { "en-US": "Page number (default: 1)", "zh-CN": "页码(默认:1)" }, }, pageSize: { type: "number", valueHint: "", - description: "Results per page (default: 30)", + description: { "en-US": "Results per page (default: 30)", "zh-CN": "每页结果数(默认:30)" }, }, }, exampleArgs: ["", "--name customer service", "--page 2 --page-size 10", "--output json"], diff --git a/packages/commands/src/commands/console/call.ts b/packages/commands/src/commands/console/call.ts index 28fb847..95cce7b 100644 --- a/packages/commands/src/commands/console/call.ts +++ b/packages/commands/src/commands/console/call.ts @@ -7,20 +7,26 @@ import { import { emitResult } from "bailian-cli-runtime"; export default defineCommand({ - description: "Call a Bailian console API via the CLI gateway", + description: { + "en-US": "Call a Bailian console API via the CLI gateway", + "zh-CN": "通过 CLI Gateway 调用百炼控制台 API", + }, auth: "console", usageArgs: "--api --data [flags]", flags: { api: { type: "string", valueHint: "", - description: "API name (e.g. zeldaEasy.broadscope-bailian.memory-library.getLibraries)", + description: { + "en-US": "API name (e.g. zeldaEasy.broadscope-bailian.memory-library.getLibraries)", + "zh-CN": "API 名称(例如 zeldaEasy.broadscope-bailian.memory-library.getLibraries)", + }, required: true, }, data: { type: "string", valueHint: "", - description: "Request data as JSON string", + description: { "en-US": "Request data as JSON string", "zh-CN": "JSON 字符串格式的请求数据" }, required: true, }, }, diff --git a/packages/commands/src/commands/dataset/delete.ts b/packages/commands/src/commands/dataset/delete.ts index 5e18766..ad56300 100644 --- a/packages/commands/src/commands/dataset/delete.ts +++ b/packages/commands/src/commands/dataset/delete.ts @@ -5,13 +5,13 @@ const DELETE_FLAGS = { fileId: { type: "string", valueHint: "", - description: "Dataset file ID (required)", + description: { "en-US": "Dataset file ID (required)", "zh-CN": "数据集文件 ID(必填)" }, required: true, }, } satisfies FlagsDef; export default defineCommand({ - description: "Delete a dataset file by ID", + description: { "en-US": "Delete a dataset file by ID", "zh-CN": "通过 ID 删除数据集文件" }, auth: "apiKey", usageArgs: "--file-id ", flags: DELETE_FLAGS, diff --git a/packages/commands/src/commands/dataset/get.ts b/packages/commands/src/commands/dataset/get.ts index 2c1cf71..4950678 100644 --- a/packages/commands/src/commands/dataset/get.ts +++ b/packages/commands/src/commands/dataset/get.ts @@ -5,13 +5,16 @@ const GET_FLAGS = { fileId: { type: "string", valueHint: "", - description: "Dataset file ID (required)", + description: { "en-US": "Dataset file ID (required)", "zh-CN": "数据集文件 ID(必填)" }, required: true, }, } satisfies FlagsDef; export default defineCommand({ - description: "Get details of a single dataset file", + description: { + "en-US": "Get details of a single dataset file", + "zh-CN": "获取单个数据集文件的详情", + }, auth: "apiKey", usageArgs: "--file-id ", flags: GET_FLAGS, diff --git a/packages/commands/src/commands/dataset/list.ts b/packages/commands/src/commands/dataset/list.ts index 7bc858b..c6ebc77 100644 --- a/packages/commands/src/commands/dataset/list.ts +++ b/packages/commands/src/commands/dataset/list.ts @@ -2,21 +2,31 @@ import { defineCommand, detectOutputFormat, listDatasets, type FlagsDef } from " import { emitResult, emitBare, emitRequestId, formatTable } from "bailian-cli-runtime"; const LIST_FLAGS = { - page: { type: "number", valueHint: "", description: "Page number (default: 1)" }, + page: { + type: "number", + valueHint: "", + description: { "en-US": "Page number (default: 1)", "zh-CN": "页码(默认:1)" }, + }, pageSize: { type: "number", valueHint: "", - description: "Results per page (default: 10, max 100)", + description: { + "en-US": "Results per page (default: 10, max 100)", + "zh-CN": "每页结果数(默认:10,最多:100)", + }, }, purpose: { type: "string", valueHint: "", - description: 'Filter by purpose (e.g. "fine-tune", "evaluation"). Omit to list all.', + description: { + "en-US": 'Filter by purpose (e.g. "fine-tune", "evaluation"). Omit to list all.', + "zh-CN": '按用途筛选(例如 "fine-tune"、"evaluation")。省略时列出全部。', + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "List uploaded dataset files", + description: { "en-US": "List uploaded dataset files", "zh-CN": "列出已上传的数据集文件" }, auth: "apiKey", usageArgs: "[--page ] [--page-size ] [--purpose ]", flags: LIST_FLAGS, diff --git a/packages/commands/src/commands/dataset/upload.ts b/packages/commands/src/commands/dataset/upload.ts index a3c6104..64355bd 100644 --- a/packages/commands/src/commands/dataset/upload.ts +++ b/packages/commands/src/commands/dataset/upload.ts @@ -17,32 +17,51 @@ const UPLOAD_FLAGS = { file: { type: "string", valueHint: "", - description: "Local dataset file (.jsonl or .zip; ≤300MB text, ≤1GB image)", + description: { + "en-US": "Local dataset file (.jsonl or .zip; ≤300MB text, ≤1GB image)", + "zh-CN": "本地数据集文件(.jsonl 或 .zip;文本不超过 300MB,图片不超过 1GB)", + }, required: true, }, purpose: { type: "string", valueHint: "", - description: 'Dataset purpose tag (default: "fine-tune"; e.g. "evaluation")', + description: { + "en-US": 'Dataset purpose tag (default: "fine-tune"; e.g. "evaluation")', + "zh-CN": '数据集用途标签(默认:"fine-tune";例如 "evaluation")', + }, }, schema: { type: "string", valueHint: "", - description: - 'Record schema: "chatml" (SFT), "dpo" (chosen/rejected), "cpt" (raw text), "tts" (audio), or "image" (image generation). Default auto-detects per record.', + description: { + "en-US": + 'Record schema: "chatml" (SFT), "dpo" (chosen/rejected), "cpt" (raw text), "tts" (audio), or "image" (image generation). Default auto-detects per record.', + "zh-CN": + '记录 Schema:"chatml"(SFT)、"dpo"(chosen/rejected)、"cpt"(原始文本)、"tts"(音频)或 "image"(图片生成)。默认逐条自动识别。', + }, }, noValidate: { type: "switch", - description: "Skip the local JSONL pre-flight check (not recommended)", + description: { + "en-US": "Skip the local JSONL pre-flight check (not recommended)", + "zh-CN": "跳过本地 JSONL 预检查(不推荐)", + }, }, fullValidate: { type: "switch", - description: "JSON.parse every line instead of sampling (slower)", + description: { + "en-US": "JSON.parse every line instead of sampling (slower)", + "zh-CN": "使用 JSON.parse 检查每一行,而不是抽样检查(速度较慢)", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Upload a dataset file (.jsonl or .zip) to Bailian", + description: { + "en-US": "Upload a dataset file (.jsonl or .zip) to Bailian", + "zh-CN": "将数据集文件(.jsonl 或 .zip)上传到百炼", + }, auth: "apiKey", usageArgs: "--file [--purpose ] [--schema ] [--no-validate] [--full-validate]", @@ -57,16 +76,24 @@ export default defineCommand({ "--file train.jsonl --no-validate", ], notes: [ - "Supports .jsonl (text) and .zip (audio/image archives with a data.jsonl", - "manifest). Five record schemas are recognized: chatml = {messages:[...]}", - '(SFT); dpo = {messages:[...], chosen, rejected}; cpt = {text:"..."}', - '(continual pre-training, raw text); tts = {wav_fn:"train/xxx.wav",', - 'text:"..."} (audio fine-tuning); image = {img_path:"..."} (image', - "generation). With no --schema, a record carrying wav_fn is validated as", - "TTS, img_path as image, chosen/rejected as DPO, text (no messages) as CPT,", - "otherwise ChatML. Upload cap: 300MB text, 1GB image. Upload uses the", - "OpenAI-compatible /compatible-mode/v1/files endpoint so the purpose tag is", - "persisted (the DashScope-native /api/v1/files drops it).", + { + "en-US": + 'Supports .jsonl (text) and .zip (audio/image archives with a data.jsonl manifest). Five record schemas are recognized: chatml = {messages:[...]} (SFT); dpo = {messages:[...], chosen, rejected}; cpt = {text:"..."} (continual pre-training, raw text); tts = {wav_fn:"train/xxx.wav", text:"..."} (audio fine-tuning); image = {img_path:"..."} (image generation).', + "zh-CN": + '支持 .jsonl(文本)和 .zip(包含 data.jsonl 清单的音频/图片归档)。可识别五种记录 Schema:chatml = {messages:[...]}(SFT);dpo = {messages:[...], chosen, rejected};cpt = {text:"..."}(持续预训练,原始文本);tts = {wav_fn:"train/xxx.wav", text:"..."}(音频微调);image = {img_path:"..."}(图片生成)。', + }, + { + "en-US": + "With no --schema, a record carrying wav_fn is validated as TTS, img_path as image, chosen/rejected as DPO, text (no messages) as CPT, otherwise ChatML.", + "zh-CN": + "未指定 --schema 时,包含 wav_fn 的记录按 TTS 验证,包含 img_path 的按 image 验证,包含 chosen/rejected 的按 DPO 验证,仅含 text(无 messages)的按 CPT 验证,其他记录按 ChatML 验证。", + }, + { + "en-US": + "Upload cap: 300MB text, 1GB image. Upload uses the OpenAI-compatible /compatible-mode/v1/files endpoint so the purpose tag is persisted (the DashScope-native /api/v1/files drops it).", + "zh-CN": + "上传上限:文本 300MB,图片 1GB。上传使用 OpenAI 兼容的 /compatible-mode/v1/files Endpoint,以便保留 purpose 标签;DashScope 原生 /api/v1/files 会丢弃该标签。", + }, ], async run(ctx) { const { identity, settings, flags } = ctx; diff --git a/packages/commands/src/commands/dataset/validate.ts b/packages/commands/src/commands/dataset/validate.ts index 8bf0d29..65cb523 100644 --- a/packages/commands/src/commands/dataset/validate.ts +++ b/packages/commands/src/commands/dataset/validate.ts @@ -25,23 +25,36 @@ const VALIDATE_FLAGS = { file: { type: "string", valueHint: "", - description: "Local dataset file (.jsonl or .zip)", + description: { + "en-US": "Local dataset file (.jsonl or .zip)", + "zh-CN": "本地数据集文件(.jsonl 或 .zip)", + }, required: true, }, fullValidate: { type: "switch", - description: "JSON.parse every line instead of sampling (slower)", + description: { + "en-US": "JSON.parse every line instead of sampling (slower)", + "zh-CN": "使用 JSON.parse 检查每一行,而不是抽样检查(速度较慢)", + }, }, schema: { type: "string", valueHint: "", - description: - 'Record schema: "chatml" (SFT), "dpo" (chosen/rejected), "cpt" (raw text), "tts" (audio), or "image" (image generation). Default auto-detects per record.', + description: { + "en-US": + 'Record schema: "chatml" (SFT), "dpo" (chosen/rejected), "cpt" (raw text), "tts" (audio), or "image" (image generation). Default auto-detects per record.', + "zh-CN": + '记录 Schema:"chatml"(SFT)、"dpo"(chosen/rejected)、"cpt"(原始文本)、"tts"(音频)或 "image"(图片生成)。默认逐条自动识别。', + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Locally validate a dataset file (.jsonl or .zip) without uploading", + description: { + "en-US": "Locally validate a dataset file (.jsonl or .zip) without uploading", + "zh-CN": "在本地验证数据集文件(.jsonl 或 .zip),不执行上传", + }, // 纯本地校验,不触网、不需 API key(与 `pipeline validate` 一致)。 auth: "none", usageArgs: "--file [--full-validate] [--schema ]", @@ -55,18 +68,30 @@ export default defineCommand({ "--file train.jsonl --output json", ], notes: [ - "Default scan: every line gets a structural check, then ~160 lines (front 50,", - "evenly spaced 100, last 10) are JSON.parsed against the active schema.", - "Schemas: chatml = {messages:[...]} (SFT); dpo = {messages:[...], chosen,", - 'rejected}; cpt = {text:"..."} (continual pre-training, raw text);', - 'tts = {wav_fn:"train/xxx.wav", text:"..."} (audio fine-tuning);', - 'image = {img_path:"..."} (image generation). With no --schema, a record', - "carrying wav_fn is validated as TTS, img_path as image, chosen/rejected", - "as DPO, text (no messages) as CPT, otherwise ChatML. Pass --schema to", - "require a specific shape on every record. ZIP archives (.zip) are", - "validated structurally (data.jsonl present, media references resolve) in", - "addition to per-record content checks. Use --full-validate to JSON.parse", - "every line.", + { + "en-US": + "Default scan: every line gets a structural check, then ~160 lines (front 50, evenly spaced 100, last 10) are JSON.parsed against the active schema.", + "zh-CN": + "默认扫描:先对每一行进行结构检查,再抽取约 160 行(前 50 行、均匀抽取 100 行、最后 10 行),使用 JSON.parse 按当前 Schema 验证。", + }, + { + "en-US": + 'Schemas: chatml = {messages:[...]} (SFT); dpo = {messages:[...], chosen, rejected}; cpt = {text:"..."} (continual pre-training, raw text); tts = {wav_fn:"train/xxx.wav", text:"..."} (audio fine-tuning); image = {img_path:"..."} (image generation).', + "zh-CN": + 'Schema:chatml = {messages:[...]}(SFT);dpo = {messages:[...], chosen, rejected};cpt = {text:"..."}(持续预训练,原始文本);tts = {wav_fn:"train/xxx.wav", text:"..."}(音频微调);image = {img_path:"..."}(图片生成)。', + }, + { + "en-US": + "With no --schema, a record carrying wav_fn is validated as TTS, img_path as image, chosen/rejected as DPO, text (no messages) as CPT, otherwise ChatML. Pass --schema to require a specific shape on every record.", + "zh-CN": + "未指定 --schema 时,包含 wav_fn 的记录按 TTS 验证,包含 img_path 的按 image 验证,包含 chosen/rejected 的按 DPO 验证,仅含 text(无 messages)的按 CPT 验证,其他记录按 ChatML 验证。使用 --schema 要求每条记录符合指定结构。", + }, + { + "en-US": + "ZIP archives (.zip) are validated structurally (data.jsonl present, media references resolve) in addition to per-record content checks. Use --full-validate to JSON.parse every line.", + "zh-CN": + "ZIP 归档(.zip)除逐条检查记录内容外,还会执行结构验证(存在 data.jsonl、媒体引用可解析)。使用 --full-validate 对每一行执行 JSON.parse。", + }, ], async run(ctx) { const { settings, flags } = ctx; diff --git a/packages/commands/src/commands/deploy/create.ts b/packages/commands/src/commands/deploy/create.ts index 96c75d9..590f716 100644 --- a/packages/commands/src/commands/deploy/create.ts +++ b/packages/commands/src/commands/deploy/create.ts @@ -17,49 +17,76 @@ const CREATE_FLAGS = { model: { type: "string", valueHint: "", - description: "Model name (catalog model or fine-tuned output) (required)", + description: { + "en-US": "Model name (catalog model or fine-tuned output) (required)", + "zh-CN": "模型名称(模型目录中的模型或微调输出模型,必填)", + }, required: true, }, name: { type: "string", valueHint: "", - description: "Console display name for the deployment (required)", + description: { + "en-US": "Console display name for the deployment (required)", + "zh-CN": "部署在控制台中的显示名称(必填)", + }, required: true, }, plan: { type: "string", valueHint: "", - description: "Billing plan: lora (default, Token-billed) | ptu (Token-billed) | mu", + description: { + "en-US": "Billing plan: lora (default, Token-billed) | ptu (Token-billed) | mu", + "zh-CN": "计费方案:lora(默认,按 Token 计费)| ptu(按 Token 计费)| mu", + }, }, deploySpec: { type: "string", valueHint: "", - description: "Deploy spec (only used by plan=mu; auto-picked if omitted)", + description: { + "en-US": "Deploy spec (only used by plan=mu; auto-picked if omitted)", + "zh-CN": "部署规格(仅 plan=mu 使用;省略时自动选择)", + }, }, capacity: { type: "number", valueHint: "", - description: "Resource units (plan=mu only; required by API; defaults to the template's unit)", + description: { + "en-US": "Resource units (plan=mu only; required by API; defaults to the template's unit)", + "zh-CN": "资源单元数(仅 plan=mu;API 必填;默认为模板的单元数)", + }, }, billingMethod: { type: "string", valueHint: "", - description: 'Billing method (plan=mu only; default "POST_PAY", the only supported value)', + description: { + "en-US": 'Billing method (plan=mu only; default "POST_PAY", the only supported value)', + "zh-CN": '计费方式(仅 plan=mu;默认且仅支持 "POST_PAY")', + }, }, inputTpm: { type: "number", valueHint: "", - description: "PTU max input tokens/min (required for plan=ptu)", + description: { + "en-US": "PTU max input tokens/min (required for plan=ptu)", + "zh-CN": "PTU 每分钟最大输入 Token 数(plan=ptu 时必填)", + }, }, outputTpm: { type: "number", valueHint: "", - description: "PTU max output tokens/min (required for plan=ptu)", + description: { + "en-US": "PTU max output tokens/min (required for plan=ptu)", + "zh-CN": "PTU 每分钟最大输出 Token 数(plan=ptu 时必填)", + }, }, thinkingOutputTpm: { type: "number", valueHint: "", - description: "PTU max thinking-output tokens/min (optional, some models)", + description: { + "en-US": "PTU max thinking-output tokens/min (optional, some models)", + "zh-CN": "PTU 每分钟最大思考输出 Token 数(部分模型可选)", + }, }, } satisfies FlagsDef; @@ -67,25 +94,46 @@ const CREATE_USAGE = "--model --name [--plan ] [--deploy-spec ] [--capacity ] [--billing-method ] [--input-tpm ] [--output-tpm ] [--thinking-output-tpm ]"; const CREATE_NOTES = [ - "Plan defaults to `lora` (Token-billed) for text/image and `mu` (model-unit-", - "billed) for audio (CosyVoice TTS). Pass --plan to override.", - "For plan=ptu (Token-billed, provisioned throughput), --input-tpm and", - "--output-tpm are required (the platform rejects creation without an", - "explicit ptu_capacity despite the doc listing defaults).", - "For plan=mu, `capacity`, `billing_method` and `deploy_spec` are required.", - "billing_method defaults to POST_PAY (only supported value); deploy_spec", - "and capacity are auto-picked from GET /deployments/models when omitted.", - "Use `bl deploy models --source base` to inspect available templates.", - "After creation, status starts at PENDING and transitions to RUNNING.", - "Invoke the deployed model with: bl text chat --model ", - "WARNING: --model is overloaded across commands and refers to DIFFERENT", - "values. `bl deploy create --model` takes the exported model_name", - "(e.g. `qwen3-8b-ft-...`), but the create response also returns a", - "`deployed_model` field (the deployment instance id, e.g.", - "`qwen3-8b-5ecb5f068d79`). The inference call `bl text chat --model` must use", - "the `deployed_model` from the create response — NOT the `model_name` you", - "passed to `deploy create`. Do not reuse the value across the two", - "commands.", + { + "en-US": + "Plan defaults to `lora` (Token-billed) for text/image and `mu` (model-unit-billed) for audio (CosyVoice TTS). Pass --plan to override.", + "zh-CN": + "文本/图片的 Plan 默认为 `lora`(按 Token 计费),音频(CosyVoice TTS)默认为 `mu`(按模型单元计费)。使用 --plan 覆盖默认值。", + }, + { + "en-US": + "For plan=ptu (Token-billed, provisioned throughput), --input-tpm and --output-tpm are required (the platform rejects creation without an explicit ptu_capacity despite the doc listing defaults).", + "zh-CN": + "plan=ptu(按 Token 计费的预置吞吐)时,--input-tpm 和 --output-tpm 必填(如果没有显式 ptu_capacity,即使文档列出了默认值,平台也会拒绝创建)。", + }, + { + "en-US": "For plan=mu, `capacity`, `billing_method` and `deploy_spec` are required.", + "zh-CN": "plan=mu 时,`capacity`、`billing_method` 和 `deploy_spec` 必填。", + }, + { + "en-US": + "billing_method defaults to POST_PAY (only supported value); deploy_spec and capacity are auto-picked from GET /deployments/models when omitted.", + "zh-CN": + "billing_method 默认为 POST_PAY(唯一支持值);省略 deploy_spec 和 capacity 时,会从 GET /deployments/models 自动选择。", + }, + { + "en-US": "Use `bl deploy models --source base` to inspect available templates.", + "zh-CN": "使用 `bl deploy models --source base` 查看可用模板。", + }, + { + "en-US": "After creation, status starts at PENDING and transitions to RUNNING.", + "zh-CN": "创建后状态从 PENDING 开始,并转换为 RUNNING。", + }, + { + "en-US": "Invoke the deployed model with: `bl text chat --model `.", + "zh-CN": "调用已部署模型:`bl text chat --model `。", + }, + { + "en-US": + "WARNING: --model is overloaded across commands and refers to DIFFERENT values. `bl deploy create --model` takes the exported model_name (e.g. `qwen3-8b-ft-...`), but the create response also returns a `deployed_model` field (the deployment instance id, e.g. `qwen3-8b-5ecb5f068d79`). The inference call `bl text chat --model` must use the `deployed_model` from the create response — NOT the `model_name` you passed to `deploy create`. Do not reuse the value across the two commands.", + "zh-CN": + "警告:--model 在不同命令中含义不同,指向不同的值。`bl deploy create --model` 接收导出的 model_name(例如 `qwen3-8b-ft-...`),但创建响应还会返回 `deployed_model` 字段(部署实例 ID,例如 `qwen3-8b-5ecb5f068d79`)。推理调用 `bl text chat --model` 必须使用创建响应中的 `deployed_model`,而不是传给 `deploy create` 的 `model_name`。不要在这两个命令之间复用该值。", + }, ]; /** @@ -171,7 +219,7 @@ async function runCreate( /** `bl deploy text create` — deploy a text model. */ export const deployTextCreate = defineCommand({ - description: "Create a text model deployment", + description: { "en-US": "Create a text model deployment", "zh-CN": "创建文本模型部署" }, auth: "apiKey", usageArgs: CREATE_USAGE, flags: CREATE_FLAGS, @@ -188,7 +236,10 @@ export const deployTextCreate = defineCommand({ /** `bl deploy audio create` — deploy an audio (TTS) model. Defaults to plan=mu. */ export const deployAudioCreate = defineCommand({ - description: "Create an audio (TTS) model deployment", + description: { + "en-US": "Create an audio (TTS) model deployment", + "zh-CN": "创建音频(TTS)模型部署", + }, auth: "apiKey", usageArgs: CREATE_USAGE, flags: CREATE_FLAGS, @@ -204,7 +255,10 @@ export const deployAudioCreate = defineCommand({ /** `bl deploy image create` — deploy an image generation model. */ export const deployImageCreate = defineCommand({ - description: "Create an image generation model deployment", + description: { + "en-US": "Create an image generation model deployment", + "zh-CN": "创建图片生成模型部署", + }, auth: "apiKey", usageArgs: CREATE_USAGE, flags: CREATE_FLAGS, diff --git a/packages/commands/src/commands/deploy/delete.ts b/packages/commands/src/commands/deploy/delete.ts index bd6dd85..f633687 100644 --- a/packages/commands/src/commands/deploy/delete.ts +++ b/packages/commands/src/commands/deploy/delete.ts @@ -13,12 +13,18 @@ const DELETE_FLAGS = { deployedModel: { type: "string", valueHint: "", - description: "Deployed model identifier (required)", + description: { + "en-US": "Deployed model identifier (required)", + "zh-CN": "已部署模型标识(必填)", + }, required: true, }, skipPrecheck: { type: "switch", - description: "Skip the local STOPPED/FAILED status precheck", + description: { + "en-US": "Skip the local STOPPED/FAILED status precheck", + "zh-CN": "跳过本地 STOPPED/FAILED 状态预检查", + }, }, } satisfies FlagsDef; @@ -30,7 +36,10 @@ const DELETE_FLAGS = { * DELETE call. */ export default defineCommand({ - description: "Delete a model deployment (must be STOPPED or FAILED)", + description: { + "en-US": "Delete a model deployment (must be STOPPED or FAILED)", + "zh-CN": "删除模型部署(状态必须为 STOPPED 或 FAILED)", + }, auth: "apiKey", usageArgs: "--deployed-model [--skip-precheck]", flags: DELETE_FLAGS, diff --git a/packages/commands/src/commands/deploy/get.ts b/packages/commands/src/commands/deploy/get.ts index 9c53e96..1ffeb58 100644 --- a/packages/commands/src/commands/deploy/get.ts +++ b/packages/commands/src/commands/deploy/get.ts @@ -5,13 +5,19 @@ const GET_FLAGS = { deployedModel: { type: "string", valueHint: "", - description: "Deployed model identifier (required)", + description: { + "en-US": "Deployed model identifier (required)", + "zh-CN": "已部署模型标识(必填)", + }, required: true, }, } satisfies FlagsDef; export default defineCommand({ - description: "Get details of a single model deployment", + description: { + "en-US": "Get details of a single model deployment", + "zh-CN": "获取单个模型部署的详情", + }, auth: "apiKey", usageArgs: "--deployed-model ", flags: GET_FLAGS, diff --git a/packages/commands/src/commands/deploy/list.ts b/packages/commands/src/commands/deploy/list.ts index e7c2917..0383fc1 100644 --- a/packages/commands/src/commands/deploy/list.ts +++ b/packages/commands/src/commands/deploy/list.ts @@ -7,21 +7,31 @@ import { import { emitResult, emitBare, emitRequestId, formatTable } from "bailian-cli-runtime"; const LIST_FLAGS = { - page: { type: "number", valueHint: "", description: "Page number (default: 1)" }, + page: { + type: "number", + valueHint: "", + description: { "en-US": "Page number (default: 1)", "zh-CN": "页码(默认:1)" }, + }, pageSize: { type: "number", valueHint: "", - description: "Results per page (default: 10, max 100)", + description: { + "en-US": "Results per page (default: 10, max 100)", + "zh-CN": "每页结果数(默认:10,最多:100)", + }, }, status: { type: "string", valueHint: "", - description: "Filter by status (PENDING / RUNNING / STOPPED / FAILED)", + description: { + "en-US": "Filter by status (PENDING / RUNNING / STOPPED / FAILED)", + "zh-CN": "按状态筛选(PENDING / RUNNING / STOPPED / FAILED)", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "List model deployments", + description: { "en-US": "List model deployments", "zh-CN": "列出模型部署" }, auth: "apiKey", usageArgs: "[--page ] [--page-size ] [--status ]", flags: LIST_FLAGS, diff --git a/packages/commands/src/commands/deploy/models.ts b/packages/commands/src/commands/deploy/models.ts index d1ea972..3bb820c 100644 --- a/packages/commands/src/commands/deploy/models.ts +++ b/packages/commands/src/commands/deploy/models.ts @@ -7,27 +7,37 @@ import { import { emitResult, emitBare, emitRequestId, formatTable } from "bailian-cli-runtime"; const MODELS_FLAGS = { - page: { type: "number", valueHint: "", description: "Page number (default: 1)" }, + page: { + type: "number", + valueHint: "", + description: { "en-US": "Page number (default: 1)", "zh-CN": "页码(默认:1)" }, + }, pageSize: { type: "number", valueHint: "", - description: "Results per page (default: 100)", + description: { "en-US": "Results per page (default: 100)", "zh-CN": "每页结果数(默认:100)" }, }, // 全局 --version 是保留 flag,目录版本过滤改名 --catalog-version。 catalogVersion: { type: "string", valueHint: "", - description: "Catalog version filter (default: v1.0; required for new catalog models)", + description: { + "en-US": "Catalog version filter (default: v1.0; required for new catalog models)", + "zh-CN": "模型目录版本筛选(默认:v1.0;新目录模型必填)", + }, }, source: { type: "string", valueHint: "", - description: "Model source filter: custom (fine-tuned) | base (catalog) | public", + description: { + "en-US": "Model source filter: custom (fine-tuned) | base (catalog) | public", + "zh-CN": "模型来源筛选:custom(微调模型)| base(模型目录)| public", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "List models available for deployment", + description: { "en-US": "List models available for deployment", "zh-CN": "列出可部署的模型" }, auth: "apiKey", usageArgs: "[--page ] [--page-size ] [--catalog-version ] [--source ]", flags: MODELS_FLAGS, diff --git a/packages/commands/src/commands/deploy/scale.ts b/packages/commands/src/commands/deploy/scale.ts index 805f9c5..fe18261 100644 --- a/packages/commands/src/commands/deploy/scale.ts +++ b/packages/commands/src/commands/deploy/scale.ts @@ -10,23 +10,35 @@ const SCALE_FLAGS = { deployedModel: { type: "string", valueHint: "", - description: "Deployed model identifier (required)", + description: { + "en-US": "Deployed model identifier (required)", + "zh-CN": "已部署模型标识(必填)", + }, required: true, }, capacity: { type: "number", valueHint: "", - description: "New capacity in plan units (must be a multiple of base_capacity)", + description: { + "en-US": "New capacity in plan units (must be a multiple of base_capacity)", + "zh-CN": "以方案单元表示的新容量(必须是 base_capacity 的整数倍)", + }, }, inputTpm: { type: "number", valueHint: "", - description: "PTU only — input tokens per minute", + description: { + "en-US": "PTU only — input tokens per minute", + "zh-CN": "仅 PTU:每分钟输入 Token 数", + }, }, outputTpm: { type: "number", valueHint: "", - description: "PTU only — output tokens per minute", + description: { + "en-US": "PTU only — output tokens per minute", + "zh-CN": "仅 PTU:每分钟输出 Token 数", + }, }, } satisfies FlagsDef; @@ -37,7 +49,7 @@ const SCALE_FLAGS = { * integer multiple of `base_capacity` (visible via `bl deploy get`). */ export default defineCommand({ - description: "Scale a deployment's capacity", + description: { "en-US": "Scale a deployment's capacity", "zh-CN": "调整部署容量" }, auth: "apiKey", usageArgs: "--deployed-model --capacity [--input-tpm ] [--output-tpm ]", flags: SCALE_FLAGS, diff --git a/packages/commands/src/commands/deploy/update.ts b/packages/commands/src/commands/deploy/update.ts index 0bbb29d..e387f81 100644 --- a/packages/commands/src/commands/deploy/update.ts +++ b/packages/commands/src/commands/deploy/update.ts @@ -10,18 +10,21 @@ const UPDATE_FLAGS = { deployedModel: { type: "string", valueHint: "", - description: "Deployed model identifier (required)", + description: { + "en-US": "Deployed model identifier (required)", + "zh-CN": "已部署模型标识(必填)", + }, required: true, }, rpmLimit: { type: "number", valueHint: "", - description: "Requests per minute", + description: { "en-US": "Requests per minute", "zh-CN": "每分钟请求数" }, }, tpmLimit: { type: "number", valueHint: "", - description: "Tokens per minute", + description: { "en-US": "Tokens per minute", "zh-CN": "每分钟 Token 数" }, }, } satisfies FlagsDef; @@ -32,7 +35,10 @@ const UPDATE_FLAGS = { * Body: at least one of `rpm_limit` (requests/min) or `tpm_limit` (tokens/min). */ export default defineCommand({ - description: "Update a deployment's rate limits (rpm_limit / tpm_limit)", + description: { + "en-US": "Update a deployment's rate limits (rpm_limit / tpm_limit)", + "zh-CN": "更新部署的限流配置(rpm_limit / tpm_limit)", + }, auth: "apiKey", usageArgs: "--deployed-model [--rpm-limit ] [--tpm-limit ]", flags: UPDATE_FLAGS, @@ -40,7 +46,12 @@ export default defineCommand({ "--deployed-model dep-... --rpm-limit 1000", "--deployed-model dep-... --rpm-limit 1000 --tpm-limit 200000", ], - notes: ["At least one of --rpm-limit / --tpm-limit must be provided."], + notes: [ + { + "en-US": "At least one of --rpm-limit / --tpm-limit must be provided.", + "zh-CN": "--rpm-limit / --tpm-limit 至少需要提供一个。", + }, + ], validate: (flags) => flags.rpmLimit === undefined && flags.tpmLimit === undefined ? "Provide at least one of --rpm-limit / --tpm-limit." diff --git a/packages/commands/src/commands/finetune/cancel.ts b/packages/commands/src/commands/finetune/cancel.ts index 789a3b0..1a0433e 100644 --- a/packages/commands/src/commands/finetune/cancel.ts +++ b/packages/commands/src/commands/finetune/cancel.ts @@ -5,20 +5,24 @@ const CANCEL_FLAGS = { jobId: { type: "string", valueHint: "", - description: "Fine-tune job ID (required)", + description: { "en-US": "Fine-tune job ID (required)", "zh-CN": "微调任务 ID(必填)" }, required: true, }, } satisfies FlagsDef; export default defineCommand({ - description: "Cancel a running fine-tune job", + description: { "en-US": "Cancel a running fine-tune job", "zh-CN": "取消正在运行的微调任务" }, auth: "apiKey", usageArgs: "--job-id ", flags: CANCEL_FLAGS, exampleArgs: ["--job-id ft-xxx", "--job-id ft-xxx --dry-run"], notes: [ - "Only PENDING / RUNNING jobs can be cancelled. Completed / failed / already-", - "cancelled jobs return a server-side error (passed through verbatim).", + { + "en-US": + "Only PENDING / RUNNING jobs can be cancelled. Completed / failed / already-cancelled jobs return a server-side error (passed through verbatim).", + "zh-CN": + "只有 PENDING / RUNNING 状态的任务可以取消。已完成、失败或已取消的任务会返回服务端错误(原样透传)。", + }, ], async run(ctx) { const { settings, flags } = ctx; diff --git a/packages/commands/src/commands/finetune/capability.ts b/packages/commands/src/commands/finetune/capability.ts index 1bf7203..4626bab 100644 --- a/packages/commands/src/commands/finetune/capability.ts +++ b/packages/commands/src/commands/finetune/capability.ts @@ -58,18 +58,27 @@ const CAPABILITY_FLAGS = { model: { type: "string", valueHint: "", - description: "List training types supported by this base model.", + description: { + "en-US": "List training types supported by this base model.", + "zh-CN": "列出该基础模型支持的训练类型。", + }, }, trainingType: { type: "string", valueHint: "", - description: `List models supporting this training type: ${TRAINING_TYPES_CLI.join(" | ")}.`, + description: { + "en-US": `List models supporting this training type: ${TRAINING_TYPES_CLI.join(" | ")}.`, + "zh-CN": `列出支持该训练类型的模型:${TRAINING_TYPES_CLI.join(" | ")}。`, + }, }, } satisfies FlagsDef; export default defineCommand({ - description: - "Query fine-tune training capability — by model (which training types it supports) or by training type (which models support it)", + description: { + "en-US": + "Query fine-tune training capability — by model (which training types it supports) or by training type (which models support it)", + "zh-CN": "查询微调训练能力:按模型查询其支持的训练类型,或按训练类型查询支持它的模型", + }, auth: "none", usageArgs: "--model | --training-type ", flags: CAPABILITY_FLAGS, @@ -80,10 +89,20 @@ export default defineCommand({ "--training-type sft --quiet", ], notes: [ - "Exactly one of --model / --training-type is required.", - "Training-type values use the `` / `-lora` convention:", - "sft | sft-lora | dpo | dpo-lora | cpt. (cpt has no -lora variant server-side.)", - "Queries listFoundationModels, a public API — no console login needed.", + { + "en-US": "Exactly one of --model / --training-type is required.", + "zh-CN": "--model / --training-type 必须且只能指定一个。", + }, + { + "en-US": + "Training-type values use the `` / `-lora` convention: sft | sft-lora | dpo | dpo-lora | cpt. (cpt has no -lora variant server-side.)", + "zh-CN": + "训练类型遵循 `` / `-lora` 命名约定:sft | sft-lora | dpo | dpo-lora | cpt。(服务端的 cpt 没有 -lora 变体。)", + }, + { + "en-US": "Queries listFoundationModels, a public API — no console login needed.", + "zh-CN": "查询公开 API listFoundationModels,无需登录控制台。", + }, ], validate: (f) => { if (f.model && f.trainingType) diff --git a/packages/commands/src/commands/finetune/checkpoints.ts b/packages/commands/src/commands/finetune/checkpoints.ts index 7c05a36..86433f0 100644 --- a/packages/commands/src/commands/finetune/checkpoints.ts +++ b/packages/commands/src/commands/finetune/checkpoints.ts @@ -10,20 +10,26 @@ const CHECKPOINTS_FLAGS = { jobId: { type: "string", valueHint: "", - description: "Fine-tune job ID (required)", + description: { "en-US": "Fine-tune job ID (required)", "zh-CN": "微调任务 ID(必填)" }, required: true, }, } satisfies FlagsDef; export default defineCommand({ - description: "List checkpoints produced by a fine-tune job", + description: { + "en-US": "List checkpoints produced by a fine-tune job", + "zh-CN": "列出微调任务生成的 Checkpoint", + }, auth: "apiKey", usageArgs: "--job-id ", flags: CHECKPOINTS_FLAGS, exampleArgs: ["--job-id ft-xxx", "--job-id ft-xxx --output json"], notes: [ - "Use the returned `checkpoint` value with `finetune export` to publish", - "a deployable model.", + { + "en-US": + "Use the returned `checkpoint` value with `finetune export` to publish a deployable model.", + "zh-CN": "将返回的 `checkpoint` 值传给 `finetune export`,以发布可部署模型。", + }, ], async run(ctx) { const { settings, flags } = ctx; diff --git a/packages/commands/src/commands/finetune/create.ts b/packages/commands/src/commands/finetune/create.ts index 6fbb54f..340b3aa 100644 --- a/packages/commands/src/commands/finetune/create.ts +++ b/packages/commands/src/commands/finetune/create.ts @@ -219,31 +219,44 @@ const COMMON_FLAGS = { model: { type: "string", valueHint: "", - description: "Base model to fine-tune", + description: { "en-US": "Base model to fine-tune", "zh-CN": "要微调的基础模型" }, required: true, }, datasets: { type: "string", valueHint: "", - description: - "Comma-separated dataset file IDs or local paths (.jsonl for text, .zip for audio/image). Local paths are uploaded (validated) first, then their file-ids are used.", + description: { + "en-US": + "Comma-separated dataset file IDs or local paths (.jsonl for text, .zip for audio/image). Local paths are uploaded (validated) first, then their file-ids are used.", + "zh-CN": + "数据集文件 ID 或本地路径,以逗号分隔(文本使用 .jsonl,音频/图片使用 .zip)。本地路径会先验证并上传,再使用对应的 file-id。", + }, required: true, }, validations: { type: "string", valueHint: "", - description: - "Comma-separated validation dataset file IDs or local paths (auto-uploaded like --datasets).", + description: { + "en-US": + "Comma-separated validation dataset file IDs or local paths (auto-uploaded like --datasets).", + "zh-CN": "验证数据集文件 ID 或本地路径,以逗号分隔(与 --datasets 一样自动上传)。", + }, }, modelName: { type: "string", valueHint: "", - description: "Output model name (after training)", + description: { + "en-US": "Output model name (after training)", + "zh-CN": "训练完成后的输出模型名称", + }, }, suffix: { type: "string", valueHint: "", - description: "Output suffix appended by the platform (finetuned_output_suffix)", + description: { + "en-US": "Output suffix appended by the platform (finetuned_output_suffix)", + "zh-CN": "平台追加的输出后缀(finetuned_output_suffix)", + }, }, } satisfies FlagsDef; @@ -258,28 +271,37 @@ const TEXT_FLAGS = { trainingType: { type: "string", valueHint: "", - description: `Training type: ${TRAINING_TYPES_CLI.join(" | ")} (default: ${DEFAULT_TRAINING_TYPE}). Mapping to the server happens at the interface boundary (e.g. sft-lora -> efficient_sft, dpo -> dpo_full).`, + description: { + "en-US": `Training type: ${TRAINING_TYPES_CLI.join(" | ")} (default: ${DEFAULT_TRAINING_TYPE}). Mapping to the server happens at the interface boundary (e.g. sft-lora -> efficient_sft, dpo -> dpo_full).`, + "zh-CN": `训练类型:${TRAINING_TYPES_CLI.join(" | ")}(默认:${DEFAULT_TRAINING_TYPE})。在接口边界转换为服务端值(例如 sft-lora -> efficient_sft、dpo -> dpo_full)。`, + }, }, nEpochs: { type: "number", valueHint: "", - description: "Number of epochs (default: 3)", + description: { "en-US": "Number of epochs (default: 3)", "zh-CN": "训练轮数(默认:3)" }, }, batchSize: { type: "number", valueHint: "", - description: - "Per-device batch size (clamped to [8, 1024]). Auto-set to 8 for small datasets (<100KB)", + description: { + "en-US": + "Per-device batch size (clamped to [8, 1024]). Auto-set to 8 for small datasets (<100KB)", + "zh-CN": "单设备 Batch Size(限制在 [8, 1024])。小数据集(<100KB)自动设为 8", + }, }, learningRate: { type: "string", valueHint: "", - description: 'Learning rate as a string to preserve precision (e.g. "1.6e-5")', + description: { + "en-US": 'Learning rate as a string to preserve precision (e.g. "1.6e-5")', + "zh-CN": '以字符串形式指定学习率以保留精度(例如 "1.6e-5")', + }, }, maxLength: { type: "number", valueHint: "", - description: "Max sequence length", + description: { "en-US": "Max sequence length", "zh-CN": "最大序列长度" }, }, } satisfies FlagsDef; @@ -306,13 +328,20 @@ const IMAGE_FLAGS = { type: "string", choices: ["t2i", "i2i"] as const, valueHint: "", - description: - "Generation type: t2i (default) | i2i. Sets generation_type/max_pixels. Required to train I2I from a file-id or with --dry-run (local data auto-detects input_img).", + description: { + "en-US": + "Generation type: t2i (default) | i2i. Sets generation_type/max_pixels. Required to train I2I from a file-id or with --dry-run (local data auto-detects input_img).", + "zh-CN": + "生成类型:t2i(默认)| i2i。用于设置 generation_type/max_pixels。通过 file-id 训练 I2I 或使用 --dry-run 时必填(本地数据会自动识别 input_img)。", + }, }, learningRate: { type: "string", valueHint: "", - description: 'Learning rate as a string to preserve precision (e.g. "3e-5")', + description: { + "en-US": 'Learning rate as a string to preserve precision (e.g. "3e-5")', + "zh-CN": '以字符串形式指定学习率以保留精度(例如 "3e-5")', + }, }, } satisfies FlagsDef; @@ -326,43 +355,70 @@ const IMAGE_USAGE = "--model --datasets [--validations ] [--model-name ] [--suffix ] [--generation-type ] [--learning-rate ]"; const COMMON_NOTES = [ - "Creating a job uploads any local datasets and consumes training quota.", - "Use --dry-run to preview the request body without submitting.", - "--datasets / --validations accept either file-ids (from `dataset upload`)", - "or local paths. Local paths are validated and uploaded first, then their", - "file-ids are submitted — a one-step upload-and-train.", + { + "en-US": "Creating a job uploads any local datasets and consumes training quota.", + "zh-CN": "创建任务会上传所有本地数据集并消耗训练额度。", + }, + { + "en-US": "Use --dry-run to preview the request body without submitting.", + "zh-CN": "使用 --dry-run 预览请求体,不实际提交。", + }, + { + "en-US": + "--datasets / --validations accept either file-ids (from `dataset upload`) or local paths. Local paths are validated and uploaded first, then their file-ids are submitted — a one-step upload-and-train.", + "zh-CN": + "--datasets / --validations 可接受 file-id(来自 `dataset upload`)或本地路径。本地路径会先验证并上传,再提交对应的 file-id,实现一步上传并训练。", + }, ]; const TEXT_NOTES = [ ...COMMON_NOTES, - "Training-type values use the `` / `-lora` convention:", - "sft (full) | sft-lora (LoRA) | dpo (full) | dpo-lora (LoRA) | cpt. These map", - "to the server's training_type at the interface boundary, so the rest of the", - "CLI never sees the raw server strings.", - "Before submitting (non dry-run) the job, the model's training capability is", - "checked via listFoundationModels (no console login required); an unsupported", - "training type fails fast with the list the model actually supports.", - "n_epochs defaults to 3. Other hyper-parameters are platform defaults unless set.", - "Learning rate is forwarded as a string to avoid JSON-number precision loss.", - "Pre-submit gate: if the training dataset's sample count is not greater", - "than batch_size, the job is rejected before upload or quota consumption", - "(the platform would otherwise fail ~10 min in, after data processing).", + { + "en-US": + "Training-type values use the `` / `-lora` convention: sft (full) | sft-lora (LoRA) | dpo (full) | dpo-lora (LoRA) | cpt. These map to the server's training_type at the interface boundary, so the rest of the CLI never sees the raw server strings.", + "zh-CN": + "训练类型遵循 `` / `-lora` 命名约定:sft(全量)| sft-lora(LoRA)| dpo(全量)| dpo-lora(LoRA)| cpt。这些值会在接口边界映射为服务端 training_type,因此 CLI 的其他部分不会接触服务端原始字符串。", + }, + { + "en-US": + "Before submitting (non dry-run) the job, the model's training capability is checked via listFoundationModels (no console login required); an unsupported training type fails fast with the list the model actually supports.", + "zh-CN": + "提交任务前(非 dry-run),会通过 listFoundationModels 检查模型训练能力(无需登录控制台);如果训练类型不受支持,会立即失败并列出该模型实际支持的训练类型。", + }, + { + "en-US": "n_epochs defaults to 3. Other hyper-parameters are platform defaults unless set.", + "zh-CN": "n_epochs 默认为 3。其他超参数未设置时使用平台默认值。", + }, + { + "en-US": "Learning rate is forwarded as a string to avoid JSON-number precision loss.", + "zh-CN": "学习率以字符串形式传递,避免 JSON 数字精度损失。", + }, + { + "en-US": + "Pre-submit gate: if the training dataset's sample count is not greater than batch_size, the job is rejected before upload or quota consumption (the platform would otherwise fail ~10 min in, after data processing).", + "zh-CN": + "提交前检查:如果训练数据集的样本数不大于 batch_size,会在上传或消耗额度前拒绝任务(否则平台会在数据处理约 10 分钟后才失败)。", + }, ]; const AUDIO_NOTES = [ ...COMMON_NOTES, - "Audio TTS training runs sft-lora (efficient_sft) with fixed CosyVoice", - "hyper-parameter defaults; there are no training-type or hyper-parameter", - "knobs to set.", + { + "en-US": + "Audio TTS training runs sft-lora (efficient_sft) with fixed CosyVoice hyper-parameter defaults; there are no training-type or hyper-parameter knobs to set.", + "zh-CN": + "音频 TTS 训练使用 sft-lora(efficient_sft)和固定的 CosyVoice 超参数默认值;没有可设置的训练类型或超参数选项。", + }, ]; const IMAGE_NOTES = [ ...COMMON_NOTES, - "Image generation training runs sft-lora (efficient_sft) with fixed defaults;", - "only --learning-rate is overridable. T2I vs I2I is declared with", - "--generation-type (default t2i), which sets generation_type/max_pixels. For", - "local data the type is auto-detected (records with input_img train I2I);", - "pass --generation-type explicitly to train I2I from a file-id or in --dry-run.", + { + "en-US": + "Image generation training runs sft-lora (efficient_sft) with fixed defaults; only --learning-rate is overridable. T2I vs I2I is declared with --generation-type (default t2i), which sets generation_type/max_pixels. For local data the type is auto-detected (records with input_img train I2I); pass --generation-type explicitly to train I2I from a file-id or in --dry-run.", + "zh-CN": + "图片生成训练使用 sft-lora(efficient_sft)和固定默认值;仅 --learning-rate 可覆盖。通过 --generation-type(默认 t2i)声明 T2I 或 I2I,并设置 generation_type/max_pixels。本地数据会自动识别类型(包含 input_img 的记录训练 I2I);通过 file-id 训练 I2I 或使用 --dry-run 时,请显式传入 --generation-type。", + }, ]; /** @@ -642,7 +698,10 @@ async function runCreate( /** `bl finetune text create` — fine-tune a text model. Datasets are `.jsonl`. */ export const finetuneTextCreate = defineCommand({ - description: "Create a text model fine-tune job (sft | sft-lora | dpo | dpo-lora | cpt)", + description: { + "en-US": "Create a text model fine-tune job (sft | sft-lora | dpo | dpo-lora | cpt)", + "zh-CN": "创建文本模型微调任务(sft | sft-lora | dpo | dpo-lora | cpt)", + }, auth: "apiKey", usageArgs: TEXT_USAGE, flags: TEXT_FLAGS, @@ -662,7 +721,10 @@ export const finetuneTextCreate = defineCommand({ /** `bl finetune audio create` — fine-tune an audio TTS model. Datasets are `.zip`. */ export const finetuneAudioCreate = defineCommand({ - description: "Create an audio TTS model fine-tune job (sft-lora)", + description: { + "en-US": "Create an audio TTS model fine-tune job (sft-lora)", + "zh-CN": "创建音频 TTS 模型微调任务(sft-lora)", + }, auth: "apiKey", usageArgs: AUDIO_USAGE, flags: AUDIO_FLAGS, @@ -679,7 +741,10 @@ export const finetuneAudioCreate = defineCommand({ /** `bl finetune image create` — fine-tune an image generation model. Datasets are `.zip`. */ export const finetuneImageCreate = defineCommand({ - description: "Create an image generation model fine-tune job (sft-lora)", + description: { + "en-US": "Create an image generation model fine-tune job (sft-lora)", + "zh-CN": "创建图片生成模型微调任务(sft-lora)", + }, auth: "apiKey", usageArgs: IMAGE_USAGE, flags: IMAGE_FLAGS, diff --git a/packages/commands/src/commands/finetune/delete.ts b/packages/commands/src/commands/finetune/delete.ts index 102fda6..ed10220 100644 --- a/packages/commands/src/commands/finetune/delete.ts +++ b/packages/commands/src/commands/finetune/delete.ts @@ -5,20 +5,23 @@ const DELETE_FLAGS = { jobId: { type: "string", valueHint: "", - description: "Fine-tune job ID (required)", + description: { "en-US": "Fine-tune job ID (required)", "zh-CN": "微调任务 ID(必填)" }, required: true, }, } satisfies FlagsDef; export default defineCommand({ - description: "Delete a fine-tune job record", + description: { "en-US": "Delete a fine-tune job record", "zh-CN": "删除微调任务记录" }, auth: "apiKey", usageArgs: "--job-id ", flags: DELETE_FLAGS, exampleArgs: ["--job-id ft-xxx", "--job-id ft-xxx --dry-run"], notes: [ - "Cancel a RUNNING job first via `finetune cancel` — the platform refuses", - "to delete jobs that are still in flight.", + { + "en-US": + "Cancel a RUNNING job first via `finetune cancel` — the platform refuses to delete jobs that are still in flight.", + "zh-CN": "请先通过 `finetune cancel` 取消 RUNNING 任务,平台拒绝删除仍在运行的任务。", + }, ], async run(ctx) { const { settings, flags } = ctx; diff --git a/packages/commands/src/commands/finetune/export.ts b/packages/commands/src/commands/finetune/export.ts index 7e52de0..bbc9fa4 100644 --- a/packages/commands/src/commands/finetune/export.ts +++ b/packages/commands/src/commands/finetune/export.ts @@ -10,33 +10,42 @@ const EXPORT_FLAGS = { jobId: { type: "string", valueHint: "", - description: "Fine-tune job ID (required)", + description: { "en-US": "Fine-tune job ID (required)", "zh-CN": "微调任务 ID(必填)" }, required: true, }, checkpoint: { type: "string", valueHint: "", - description: "Checkpoint identifier from `finetune checkpoints` (required)", + description: { + "en-US": "Checkpoint identifier from `finetune checkpoints` (required)", + "zh-CN": "来自 `finetune checkpoints` 的 Checkpoint 标识(必填)", + }, required: true, }, modelName: { type: "string", valueHint: "", - description: "Deployable model name (required)", + description: { "en-US": "Deployable model name (required)", "zh-CN": "可部署模型名称(必填)" }, required: true, }, } satisfies FlagsDef; export default defineCommand({ - description: "Publish a checkpoint as a deployable model", + description: { + "en-US": "Publish a checkpoint as a deployable model", + "zh-CN": "将 Checkpoint 发布为可部署模型", + }, auth: "apiKey", usageArgs: "--job-id --checkpoint --model-name ", flags: EXPORT_FLAGS, exampleArgs: ["--job-id ft-xxx --checkpoint ckpt-3 --model-name my-qwen-sft"], notes: [ - "Required before `deploy create` can target a checkpoint. The", - "platform may auto-export the best checkpoint when a job reaches SUCCEEDED —", - "explicit export is the canonical path for non-best checkpoints.", + { + "en-US": + "Required before `deploy create` can target a checkpoint. The platform may auto-export the best checkpoint when a job reaches SUCCEEDED — explicit export is the canonical path for non-best checkpoints.", + "zh-CN": + "必须先执行此操作,`deploy create` 才能使用 Checkpoint。任务达到 SUCCEEDED 后,平台可能自动导出最佳 Checkpoint;对于非最佳 Checkpoint,显式导出是标准方式。", + }, ], async run(ctx) { const { identity, settings, flags } = ctx; diff --git a/packages/commands/src/commands/finetune/get.ts b/packages/commands/src/commands/finetune/get.ts index 0ba0114..e9ad5eb 100644 --- a/packages/commands/src/commands/finetune/get.ts +++ b/packages/commands/src/commands/finetune/get.ts @@ -5,13 +5,16 @@ const GET_FLAGS = { jobId: { type: "string", valueHint: "", - description: "Fine-tune job ID (required)", + description: { "en-US": "Fine-tune job ID (required)", "zh-CN": "微调任务 ID(必填)" }, required: true, }, } satisfies FlagsDef; export default defineCommand({ - description: "Get details of a single fine-tune job", + description: { + "en-US": "Get details of a single fine-tune job", + "zh-CN": "获取单个微调任务的详情", + }, auth: "apiKey", usageArgs: "--job-id ", flags: GET_FLAGS, diff --git a/packages/commands/src/commands/finetune/list.ts b/packages/commands/src/commands/finetune/list.ts index ca4eddd..07b68bf 100644 --- a/packages/commands/src/commands/finetune/list.ts +++ b/packages/commands/src/commands/finetune/list.ts @@ -2,21 +2,31 @@ import { defineCommand, detectOutputFormat, listFineTunes, type FlagsDef } from import { emitResult, emitBare, emitRequestId, formatTable } from "bailian-cli-runtime"; const LIST_FLAGS = { - page: { type: "number", valueHint: "", description: "Page number (default: 1)" }, + page: { + type: "number", + valueHint: "", + description: { "en-US": "Page number (default: 1)", "zh-CN": "页码(默认:1)" }, + }, pageSize: { type: "number", valueHint: "", - description: "Results per page (default: 10, max 100)", + description: { + "en-US": "Results per page (default: 10, max 100)", + "zh-CN": "每页结果数(默认:10,最多:100)", + }, }, status: { type: "string", valueHint: "", - description: "Filter by status (PENDING / RUNNING / SUCCEEDED / FAILED / CANCELED)", + description: { + "en-US": "Filter by status (PENDING / RUNNING / SUCCEEDED / FAILED / CANCELED)", + "zh-CN": "按状态筛选(PENDING / RUNNING / SUCCEEDED / FAILED / CANCELED)", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "List fine-tune jobs", + description: { "en-US": "List fine-tune jobs", "zh-CN": "列出微调任务" }, auth: "apiKey", usageArgs: "[--page ] [--page-size ] [--status ]", flags: LIST_FLAGS, diff --git a/packages/commands/src/commands/finetune/logs.ts b/packages/commands/src/commands/finetune/logs.ts index bd0802e..3e270a9 100644 --- a/packages/commands/src/commands/finetune/logs.ts +++ b/packages/commands/src/commands/finetune/logs.ts @@ -67,31 +67,47 @@ const LOGS_FLAGS = { jobId: { type: "string", valueHint: "", - description: "Fine-tune job ID (required)", + description: { "en-US": "Fine-tune job ID (required)", "zh-CN": "微调任务 ID(必填)" }, required: true, }, - page: { type: "number", valueHint: "", description: "Page number (default: 1)" }, + page: { + type: "number", + valueHint: "", + description: { "en-US": "Page number (default: 1)", "zh-CN": "页码(默认:1)" }, + }, pageSize: { type: "number", valueHint: "", - description: "Lines per page (default: server-defined)", + description: { + "en-US": "Lines per page (default: server-defined)", + "zh-CN": "每页行数(默认:由服务端决定)", + }, }, search: { type: "string", valueHint: "", - description: - "Case-insensitive substring filter. When set, all log pages are fetched and filtered client-side (--page is ignored).", + description: { + "en-US": + "Case-insensitive substring filter. When set, all log pages are fetched and filtered client-side (--page is ignored).", + "zh-CN": "不区分大小写的子字符串筛选。设置后会获取全部日志页并在客户端筛选(忽略 --page)。", + }, }, tail: { type: "number", valueHint: "", - description: - "Keep only the last N entries. When set, all log pages are fetched and the trailing N are kept (--page is ignored).", + description: { + "en-US": + "Keep only the last N entries. When set, all log pages are fetched and the trailing N are kept (--page is ignored).", + "zh-CN": "仅保留最后 N 条记录。设置后会获取全部日志页并保留末尾 N 条(忽略 --page)。", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Fetch training logs for a fine-tune job", + description: { + "en-US": "Fetch training logs for a fine-tune job", + "zh-CN": "获取微调任务的训练日志", + }, auth: "apiKey", usageArgs: "--job-id [--page ] [--page-size ] [--search ] [--tail ]", flags: LOGS_FLAGS, diff --git a/packages/commands/src/commands/finetune/watch.ts b/packages/commands/src/commands/finetune/watch.ts index c02b207..e082470 100644 --- a/packages/commands/src/commands/finetune/watch.ts +++ b/packages/commands/src/commands/finetune/watch.ts @@ -52,30 +52,42 @@ const WATCH_FLAGS = { jobId: { type: "string", valueHint: "", - description: "Fine-tune job ID (required)", + description: { "en-US": "Fine-tune job ID (required)", "zh-CN": "微调任务 ID(必填)" }, required: true, }, follow: { type: "switch", - description: - "Block and poll until a terminal state (the legacy behavior). Without it, a single status probe is performed and the command returns immediately.", + description: { + "en-US": + "Block and poll until a terminal state (the legacy behavior). Without it, a single status probe is performed and the command returns immediately.", + "zh-CN": "阻塞并轮询至终态(旧版行为)。不使用时仅查询一次状态并立即返回。", + }, }, interval: { type: "number", valueHint: "", - description: `Seconds between polls with --follow (default: ${DEFAULT_INTERVAL_SEC}, min: ${MIN_INTERVAL_SEC}). Ignored without --follow.`, + description: { + "en-US": `Seconds between polls with --follow (default: ${DEFAULT_INTERVAL_SEC}, min: ${MIN_INTERVAL_SEC}). Ignored without --follow.`, + "zh-CN": `使用 --follow 时的轮询间隔秒数(默认:${DEFAULT_INTERVAL_SEC},最小:${MIN_INTERVAL_SEC})。未使用 --follow 时忽略。`, + }, }, pollTimeout: { type: "number", valueHint: "", - description: - "With --follow, stop polling after this many seconds (default: no limit). Ignored without --follow.", + description: { + "en-US": + "With --follow, stop polling after this many seconds (default: no limit). Ignored without --follow.", + "zh-CN": "使用 --follow 时,在指定秒数后停止轮询(默认:无限制)。未使用 --follow 时忽略。", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: - "Probe a fine-tune job's status (default: single non-blocking fetch). Pass --follow to poll until terminal.", + description: { + "en-US": + "Probe a fine-tune job's status (default: single non-blocking fetch). Pass --follow to poll until terminal.", + "zh-CN": "查询微调任务状态(默认:单次非阻塞获取)。使用 --follow 持续轮询至终态。", + }, auth: "apiKey", usageArgs: "--job-id [--follow] [--interval ] [--poll-timeout ]", flags: WATCH_FLAGS, @@ -87,15 +99,28 @@ export default defineCommand({ "--job-id ft-xxx --follow --poll-timeout 3600", ], notes: [ - "Default (no --follow) is a NON-BLOCKING single status probe: one fetch, then", - "return immediately. This is the mode meant for agents / scripts — the caller", - "owns the polling cadence, so the CLI never holds the terminal.", - "A terminal FAILED/CANCELED status raises a normal CLI error (non-zero exit);", - "a SUCCEEDED or still-running status returns 0. With --follow, exceeding", - "--poll-timeout raises a timeout error.", - "Use --follow for the blocking, human-terminal-follow experience; use the", - "default mode when driving the loop yourself (e.g. from an agent).", - "For per-step training output (not status), use `finetune logs`.", + { + "en-US": + "Default (no --follow) is a NON-BLOCKING single status probe: one fetch, then return immediately. This is the mode meant for agents / scripts — the caller owns the polling cadence, so the CLI never holds the terminal.", + "zh-CN": + "默认不使用 --follow,执行非阻塞的单次状态查询:获取一次后立即返回。该模式适用于 Agent / 脚本,由调用方控制轮询节奏,CLI 不会持续占用终端。", + }, + { + "en-US": + "A terminal FAILED/CANCELED status raises a normal CLI error (non-zero exit); a SUCCEEDED or still-running status returns 0. With --follow, exceeding --poll-timeout raises a timeout error.", + "zh-CN": + "终态 FAILED/CANCELED 会触发普通 CLI 错误(非零退出码);SUCCEEDED 或仍在运行时返回 0。使用 --follow 时,超过 --poll-timeout 会触发超时错误。", + }, + { + "en-US": + "Use --follow for the blocking, human-terminal-follow experience; use the default mode when driving the loop yourself (e.g. from an agent).", + "zh-CN": + "需要在人工终端中阻塞跟踪时使用 --follow;自行驱动轮询(例如通过 Agent)时使用默认模式。", + }, + { + "en-US": "For per-step training output (not status), use `finetune logs`.", + "zh-CN": "要查看逐步骤训练输出(而非状态),请使用 `finetune logs`。", + }, ], async run(ctx) { const { settings, flags } = ctx; diff --git a/packages/commands/src/commands/knowledge/chat.ts b/packages/commands/src/commands/knowledge/chat.ts index 9e0d255..fd5aeed 100644 --- a/packages/commands/src/commands/knowledge/chat.ts +++ b/packages/commands/src/commands/knowledge/chat.ts @@ -18,25 +18,38 @@ const CHAT_FLAGS = { message: { type: "array", valueHint: "", - description: - "Message text (repeatable). Supports role:content prefix to set role (e.g. user:hello), defaults to user. Follows OpenAI message format", + description: { + "en-US": + "Message text (repeatable). Supports role:content prefix to set role (e.g. user:hello), defaults to user. Follows OpenAI message format", + "zh-CN": + "消息文本(可重复)。支持使用 role:content 前缀指定角色(例如 user:hello),默认为 user。遵循 OpenAI 消息格式", + }, }, agentId: { type: "string", valueHint: "", - description: "Q&A service ID (find in console knowledge Q&A page)", + description: { + "en-US": "Q&A service ID (find in console knowledge Q&A page)", + "zh-CN": "问答服务 ID(可在控制台知识库问答页面查看)", + }, required: true, }, // 知识库走 workspace 专属域名,--workspace-id 属命令自有 flag(console 凭证域不适用)。 workspaceId: { type: "string", valueHint: "", - description: "Workspace ID for API endpoint URL (or set BAILIAN_WORKSPACE_ID)", + description: { + "en-US": "Workspace ID for API endpoint URL (or set BAILIAN_WORKSPACE_ID)", + "zh-CN": "API Endpoint URL 使用的 Workspace ID(也可设置 BAILIAN_WORKSPACE_ID)", + }, }, image: { type: "array", valueHint: "", - description: "Image URL (repeatable). Attached to the last user message as multimodal content", + description: { + "en-US": "Image URL (repeatable). Attached to the last user message as multimodal content", + "zh-CN": "图片 URL(可重复)。将作为多模态内容附加到最后一条用户消息", + }, }, } satisfies FlagsDef; type ChatFlags = ParsedFlags; @@ -137,15 +150,36 @@ const STEP_LABELS: Record = { }; export default defineCommand({ - description: "Chat with a Bailian knowledge base (RAG Q&A with streaming)", + description: { + "en-US": "Chat with a Bailian knowledge base (RAG Q&A with streaming)", + "zh-CN": "与百炼知识库对话(支持流式输出的 RAG 问答)", + }, auth: "apiKey", usageArgs: "--message --agent-id [flags]", flags: CHAT_FLAGS, notes: [ - "Response is returned as SSE stream events. Event lifecycle: tool_calling → tool_return → plan_start → planning → plan_end → generation_start → generating → generation_end. tool_calling → tool_return may loop multiple times.", - "Auth: uses DashScope API Key (Bearer token). Get yours from the console API Key page.", - "`--workspace-id` can be set via BAILIAN_WORKSPACE_ID env or `kscli config set workspace_id `.", - 'Multi-turn: use --message "user:..." and --message "assistant:..." to pass conversation history.', + { + "en-US": + "Response is returned as SSE stream events. Event lifecycle: tool_calling → tool_return → plan_start → planning → plan_end → generation_start → generating → generation_end. tool_calling → tool_return may loop multiple times.", + "zh-CN": + "响应以 SSE 流事件返回。事件生命周期:tool_calling → tool_return → plan_start → planning → plan_end → generation_start → generating → generation_end。tool_calling → tool_return 可能循环多次。", + }, + { + "en-US": + "Auth: uses DashScope API Key (Bearer token). Get yours from the console API Key page.", + "zh-CN": "鉴权:使用 DashScope API Key(Bearer Token)。可在控制台 API Key 页面获取。", + }, + { + "en-US": + "`--workspace-id` can be set via BAILIAN_WORKSPACE_ID env or `kscli config set workspace_id `.", + "zh-CN": + "`--workspace-id` 可通过 BAILIAN_WORKSPACE_ID 环境变量或 `kscli config set workspace_id ` 设置。", + }, + { + "en-US": + 'Multi-turn: use --message "user:..." and --message "assistant:..." to pass conversation history.', + "zh-CN": '多轮对话:使用 --message "user:..." 和 --message "assistant:..." 传入对话历史。', + }, ], exampleArgs: [ '--message "What is RAG?" --agent-id aid-xxx --workspace-id ws-xxx', diff --git a/packages/commands/src/commands/knowledge/retrieve.ts b/packages/commands/src/commands/knowledge/retrieve.ts index f367abf..4a7dbff 100644 --- a/packages/commands/src/commands/knowledge/retrieve.ts +++ b/packages/commands/src/commands/knowledge/retrieve.ts @@ -12,51 +12,73 @@ const RETRIEVE_FLAGS = { indexId: { type: "string", valueHint: "", - description: "Knowledge base index ID (required)", + description: { + "en-US": "Knowledge base index ID (required)", + "zh-CN": "知识库索引 ID(必填)", + }, required: true, }, query: { type: "string", valueHint: "", - description: "Search query (required)", + description: { "en-US": "Search query (required)", "zh-CN": "搜索查询(必填)" }, required: true, }, denseSimilarityTopK: { type: "number", valueHint: "", - description: "Dense retrieval top K", + description: { "en-US": "Dense retrieval top K", "zh-CN": "稠密检索 Top K" }, }, sparseSimilarityTopK: { type: "number", valueHint: "", - description: "Sparse retrieval top K", + description: { "en-US": "Sparse retrieval top K", "zh-CN": "稀疏检索 Top K" }, + }, + rerank: { type: "switch", description: { "en-US": "Enable reranking", "zh-CN": "启用重排序" } }, + rerankTopN: { + type: "number", + valueHint: "", + description: { "en-US": "Rerank top N results", "zh-CN": "重排序前 N 个结果" }, }, - rerank: { type: "switch", description: "Enable reranking" }, - rerankTopN: { type: "number", valueHint: "", description: "Rerank top N results" }, rerankModel: { type: "string", valueHint: "", - description: "Rerank model, e.g. qwen3-rerank-hybrid", + description: { + "en-US": "Rerank model, e.g. qwen3-rerank-hybrid", + "zh-CN": "重排序模型,例如 qwen3-rerank-hybrid", + }, }, rerankMode: { type: "string", valueHint: "", - description: "Rerank mode: qa, similar, or custom", + description: { + "en-US": "Rerank mode: qa, similar, or custom", + "zh-CN": "重排序模式:qa、similar 或 custom", + }, }, rerankInstruct: { type: "string", valueHint: "", - description: "Custom rerank instruction, when mode=custom", + description: { + "en-US": "Custom rerank instruction, when mode=custom", + "zh-CN": "自定义重排序指令,仅在 mode=custom 时使用", + }, }, topK: { type: "number", valueHint: "", - description: "Number of results (deprecated, use --rerank-top-n)", + description: { + "en-US": "Number of results (deprecated, use --rerank-top-n)", + "zh-CN": "结果数量(已废弃,请使用 --rerank-top-n)", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Retrieve from a Bailian knowledge base (deprecated, use `search` instead)", + description: { + "en-US": "Retrieve from a Bailian knowledge base (deprecated, use `search` instead)", + "zh-CN": "从百炼知识库检索(已废弃,请改用 `search`)", + }, auth: "apiKey", usageArgs: "--index-id --query [flags]", flags: RETRIEVE_FLAGS, diff --git a/packages/commands/src/commands/knowledge/search.ts b/packages/commands/src/commands/knowledge/search.ts index d23dd48..b6eb79a 100644 --- a/packages/commands/src/commands/knowledge/search.ts +++ b/packages/commands/src/commands/knowledge/search.ts @@ -14,44 +14,81 @@ const SEARCH_FLAGS = { query: { type: "string", valueHint: "", - description: "Search query text (required, cannot be empty)", + description: { + "en-US": "Search query text (required, cannot be empty)", + "zh-CN": "搜索查询文本(必填且不能为空)", + }, required: true, }, agentId: { type: "string", valueHint: "", - description: "Retrieval service ID (find in console knowledge retrieval page)", + description: { + "en-US": "Retrieval service ID (find in console knowledge retrieval page)", + "zh-CN": "检索服务 ID(可在控制台知识库检索页面查看)", + }, required: true, }, // 知识库走 workspace 专属域名,--workspace-id 属命令自有 flag(console 凭证域不适用)。 workspaceId: { type: "string", valueHint: "", - description: "Workspace ID for API endpoint URL (or set BAILIAN_WORKSPACE_ID)", + description: { + "en-US": "Workspace ID for API endpoint URL (or set BAILIAN_WORKSPACE_ID)", + "zh-CN": "API Endpoint URL 使用的 Workspace ID(也可设置 BAILIAN_WORKSPACE_ID)", + }, }, image: { type: "array", valueHint: "", - description: "Image URL for multimodal retrieval (repeatable)", + description: { + "en-US": "Image URL for multimodal retrieval (repeatable)", + "zh-CN": "多模态检索使用的图片 URL(可重复)", + }, }, queryHistory: { type: "string", valueHint: "", - description: - 'User conversation history JSON for context understanding and query rewriting. Format: \'[{"role":"user","content":"What is RAG"},{"role":"assistant","content":"RAG is..."}]\'', + description: { + "en-US": + 'User conversation history JSON for context understanding and query rewriting. Format: \'[{"role":"user","content":"What is RAG"},{"role":"assistant","content":"RAG is..."}]\'', + "zh-CN": + '用于上下文理解和查询改写的用户对话历史 JSON。格式:\'[{"role":"user","content":"What is RAG"},{"role":"assistant","content":"RAG is..."}]\'', + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Search a Bailian knowledge base (RAG semantic retrieval)", + description: { + "en-US": "Search a Bailian knowledge base (RAG semantic retrieval)", + "zh-CN": "搜索百炼知识库(RAG 语义检索)", + }, auth: "apiKey", usageArgs: "--query --agent-id [flags]", flags: SEARCH_FLAGS, notes: [ - "Retrieval scope and strategy (multi-index weighting, routing, reranking, etc.) are driven by the agent_id service config. Only query and agent_id are required.", - "Auth: uses DashScope API Key (Bearer token). Get yours from the console API Key page.", - "`--workspace-id` can be set via BAILIAN_WORKSPACE_ID env or `kscli config set workspace_id `.", - "`--query-history` passes prior conversation turns; the server rewrites the query based on context to improve retrieval relevance.", + { + "en-US": + "Retrieval scope and strategy (multi-index weighting, routing, reranking, etc.) are driven by the agent_id service config. Only query and agent_id are required.", + "zh-CN": + "检索范围与策略(多索引权重、路由、重排序等)由 agent_id 服务配置决定。仅 query 和 agent_id 必填。", + }, + { + "en-US": + "Auth: uses DashScope API Key (Bearer token). Get yours from the console API Key page.", + "zh-CN": "鉴权:使用 DashScope API Key(Bearer Token)。可在控制台 API Key 页面获取。", + }, + { + "en-US": + "`--workspace-id` can be set via BAILIAN_WORKSPACE_ID env or `kscli config set workspace_id `.", + "zh-CN": + "`--workspace-id` 可通过 BAILIAN_WORKSPACE_ID 环境变量或 `kscli config set workspace_id ` 设置。", + }, + { + "en-US": + "`--query-history` passes prior conversation turns; the server rewrites the query based on context to improve retrieval relevance.", + "zh-CN": "`--query-history` 用于传入历史对话;服务端会根据上下文改写查询,以提高检索相关性。", + }, ], exampleArgs: [ '--query "What is RAG?" --agent-id aid-xxx --workspace-id ws-xxx', diff --git a/packages/commands/src/commands/managed-agent/_engine/credentials.ts b/packages/commands/src/commands/managed-agent/_engine/credentials.ts index cf0212c..3dbfbaa 100644 --- a/packages/commands/src/commands/managed-agent/_engine/credentials.ts +++ b/packages/commands/src/commands/managed-agent/_engine/credentials.ts @@ -49,9 +49,23 @@ export interface CredentialHost { * safe: agent commands ship on `bl` only. */ export const CREDENTIALS_NOTE = [ - "Bailian credentials come from bl's auth chain: --api-key > DASHSCOPE_API_KEY > `bl auth login` (active config profile).", - "Other providers read the env vars referenced in agents.yaml (e.g. ${ANTHROPIC_API_KEY}), including .env and ~/.agents/config.json.", - "Resolved credentials are injected into the SDK in-memory and cleared from the environment; they never persist in process env.", + { + "en-US": + "Bailian credentials come from bl's auth chain: --api-key > DASHSCOPE_API_KEY > `bl auth login` (active config profile).", + "zh-CN": + "百炼凭证来自 bl 鉴权链:--api-key > DASHSCOPE_API_KEY > `bl auth login`(当前激活的配置 Profile)。", + }, + { + "en-US": + "Other providers read the env vars referenced in agents.yaml (e.g. ${ANTHROPIC_API_KEY}), including .env and ~/.agents/config.json.", + "zh-CN": + "其他 Provider 读取 agents.yaml 中引用的环境变量(例如 ${ANTHROPIC_API_KEY}),包括 .env 和 ~/.agents/config.json。", + }, + { + "en-US": + "Resolved credentials are injected into the SDK in-memory and cleared from the environment; they never persist in process env.", + "zh-CN": "解析后的凭证仅在内存中注入 SDK,并从环境中清除;不会持久保留在进程环境变量中。", + }, ]; /** @@ -59,7 +73,10 @@ export const CREDENTIALS_NOTE = [ * agents.yaml / local state only, so no login or provider key is required. */ export const OFFLINE_NOTE = [ - "Runs fully offline against local files: no login or provider credentials required.", + { + "en-US": "Runs fully offline against local files: no login or provider credentials required.", + "zh-CN": "完全离线处理本地文件:无需登录或提供 Provider 凭证。", + }, ]; /** diff --git a/packages/commands/src/commands/managed-agent/apply.ts b/packages/commands/src/commands/managed-agent/apply.ts index a00a166..6040a0a 100644 --- a/packages/commands/src/commands/managed-agent/apply.ts +++ b/packages/commands/src/commands/managed-agent/apply.ts @@ -21,30 +21,48 @@ const APPLY_FLAGS = { file: { type: "string", valueHint: "", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, provider: { type: "string", valueHint: "", - description: "Target provider (default: all configured)", + description: { + "en-US": "Target provider (default: all configured)", + "zh-CN": "目标 Provider(默认:全部已配置项)", + }, }, yes: { type: "switch", - description: "Confirm and apply without an interactive prompt (required to mutate)", + description: { + "en-US": "Confirm and apply without an interactive prompt (required to mutate)", + "zh-CN": "无需交互提示直接确认并应用(执行变更时必填)", + }, }, noRefresh: { type: "switch", - description: "Skip refreshing state from remote before planning", + description: { + "en-US": "Skip refreshing state from remote before planning", + "zh-CN": "规划前跳过从远端刷新状态", + }, }, concurrency: { type: "number", valueHint: "", - description: "Max independent resources to apply in parallel (default 6, max 10)", + description: { + "en-US": "Max independent resources to apply in parallel (default 6, max 10)", + "zh-CN": "最大并行应用资源数(默认:6,最多:10)", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Apply planned changes to create/update/delete agent resources", + description: { + "en-US": "Apply planned changes to create/update/delete agent resources", + "zh-CN": "应用规划的变更,创建、更新或删除 Agent 资源", + }, auth: "apiKey", usageArgs: "[--file ] [--provider ] [--yes] [--concurrency ]", flags: APPLY_FLAGS, diff --git a/packages/commands/src/commands/managed-agent/destroy.ts b/packages/commands/src/commands/managed-agent/destroy.ts index 4c43f8e..722faea 100644 --- a/packages/commands/src/commands/managed-agent/destroy.ts +++ b/packages/commands/src/commands/managed-agent/destroy.ts @@ -16,20 +16,32 @@ const DESTROY_FLAGS = { file: { type: "string", valueHint: "", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, yes: { type: "switch", - description: "Confirm and destroy without an interactive prompt (required)", + description: { + "en-US": "Confirm and destroy without an interactive prompt (required)", + "zh-CN": "无需交互提示直接确认并销毁(必填)", + }, }, cascade: { type: "switch", - description: "Auto-delete dependent resources (e.g. sessions referencing an environment)", + description: { + "en-US": "Auto-delete dependent resources (e.g. sessions referencing an environment)", + "zh-CN": "自动删除依赖资源(例如引用某个环境的 Session)", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Destroy all managed agent resources tracked in state", + description: { + "en-US": "Destroy all managed agent resources tracked in state", + "zh-CN": "销毁 State 中跟踪的全部托管 Agent 资源", + }, auth: "apiKey", usageArgs: "[--file ] [--yes] [--cascade]", flags: DESTROY_FLAGS, diff --git a/packages/commands/src/commands/managed-agent/init.ts b/packages/commands/src/commands/managed-agent/init.ts index fd50d2b..ac3c83c 100644 --- a/packages/commands/src/commands/managed-agent/init.ts +++ b/packages/commands/src/commands/managed-agent/init.ts @@ -78,27 +78,39 @@ const INIT_FLAGS = { provider: { type: "string", valueHint: "", - description: "Provider: bailian, claude, qoder, ark, all (default: bailian)", + description: { + "en-US": "Provider: bailian, claude, qoder, ark, all (default: bailian)", + "zh-CN": "Provider:bailian、claude、qoder、ark、all(默认:bailian)", + }, choices: PROVIDERS, }, agentName: { type: "string", valueHint: "", - description: "Name of the first agent (default: assistant)", + description: { + "en-US": "Name of the first agent (default: assistant)", + "zh-CN": "第一个 Agent 的名称(默认:assistant)", + }, }, file: { type: "string", valueHint: "", - description: "Output config path (default: agents.yaml)", + description: { + "en-US": "Output config path (default: agents.yaml)", + "zh-CN": "输出配置路径(默认:agents.yaml)", + }, }, force: { type: "switch", - description: "Overwrite an existing config file", + description: { "en-US": "Overwrite an existing config file", "zh-CN": "覆盖已有配置文件" }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Create a new agents.yaml template", + description: { + "en-US": "Create a new agents.yaml template", + "zh-CN": "创建新的 agents.yaml 模板", + }, auth: "none", usageArgs: "[--provider ] [--agent-name ] [--file ] [--force]", flags: INIT_FLAGS, diff --git a/packages/commands/src/commands/managed-agent/plan.ts b/packages/commands/src/commands/managed-agent/plan.ts index 0dcd0e1..1a5dda8 100644 --- a/packages/commands/src/commands/managed-agent/plan.ts +++ b/packages/commands/src/commands/managed-agent/plan.ts @@ -21,32 +21,52 @@ const PLAN_FLAGS = { file: { type: "string", valueHint: "", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, provider: { type: "string", valueHint: "", - description: "Target provider (default: all configured)", + description: { + "en-US": "Target provider (default: all configured)", + "zh-CN": "目标 Provider(默认:全部已配置项)", + }, }, noRefresh: { type: "switch", - description: "Skip refreshing state from remote before planning", + description: { + "en-US": "Skip refreshing state from remote before planning", + "zh-CN": "规划前跳过从远端刷新状态", + }, }, refreshOnly: { type: "switch", - description: "Refresh state and show drift without planning remote mutations", + description: { + "en-US": "Refresh state and show drift without planning remote mutations", + "zh-CN": "刷新状态并显示漂移,不规划远端变更", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Show what changes would be applied to agent infrastructure", + description: { + "en-US": "Show what changes would be applied to agent infrastructure", + "zh-CN": "显示将应用到 Agent 基础设施的变更", + }, auth: "apiKey", usageArgs: "[--file ] [--provider ] [--no-refresh] [--refresh-only]", flags: PLAN_FLAGS, exampleArgs: ["", "--provider bailian", "--no-refresh"], notes: [ ...CREDENTIALS_NOTE, - "--no-refresh and --dry-run plan offline from local config and state: no remote requests, no state writes, provider keys are not checked.", + { + "en-US": + "--no-refresh and --dry-run plan offline from local config and state: no remote requests, no state writes, provider keys are not checked.", + "zh-CN": + "--no-refresh 和 --dry-run 基于本地配置与 State 离线规划:不发送远端请求、不写入 State,也不检查 Provider Key。", + }, ], async run(ctx) { const { settings, flags } = ctx; diff --git a/packages/commands/src/commands/managed-agent/session-create.ts b/packages/commands/src/commands/managed-agent/session-create.ts index 1485ab5..a26b8cd 100644 --- a/packages/commands/src/commands/managed-agent/session-create.ts +++ b/packages/commands/src/commands/managed-agent/session-create.ts @@ -10,38 +10,57 @@ const SESSION_CREATE_FLAGS = { file: { type: "string", valueHint: "", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, agent: { type: "string", valueHint: "", - description: "Agent name (auto-detected when only one agent is configured)", + description: { + "en-US": "Agent name (auto-detected when only one agent is configured)", + "zh-CN": "Agent 名称(仅配置一个 Agent 时自动识别)", + }, }, environment: { type: "string", valueHint: "", - description: "Override agent's declared environment", + description: { + "en-US": "Override agent's declared environment", + "zh-CN": "覆盖 Agent 声明的环境", + }, }, vault: { type: "string", valueHint: "", - description: "Override agent's declared vault", + description: { "en-US": "Override agent's declared vault", "zh-CN": "覆盖 Agent 声明的 Vault" }, }, memoryStores: { type: "string", valueHint: "", - description: "Override agent's memory stores (comma-separated)", + description: { + "en-US": "Override agent's memory stores (comma-separated)", + "zh-CN": "覆盖 Agent 的 Memory Store(以逗号分隔)", + }, + }, + title: { + type: "string", + valueHint: "", + description: { "en-US": "Session title", "zh-CN": "Session 标题" }, }, - title: { type: "string", valueHint: "<title>", description: "Session title" }, provider: { type: "string", valueHint: "<name>", - description: "Target provider (multi-provider agents)", + description: { + "en-US": "Target provider (multi-provider agents)", + "zh-CN": "目标 Provider(多 Provider Agent)", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Create a new session for an agent", + description: { "en-US": "Create a new session for an agent", "zh-CN": "为 Agent 创建新 Session" }, auth: "apiKey", usageArgs: "[--agent <name>] [--environment <name>] [--title <title>] [--file <path>]", flags: SESSION_CREATE_FLAGS, diff --git a/packages/commands/src/commands/managed-agent/session-delete.ts b/packages/commands/src/commands/managed-agent/session-delete.ts index 5d463db..9cbd2ee 100644 --- a/packages/commands/src/commands/managed-agent/session-delete.ts +++ b/packages/commands/src/commands/managed-agent/session-delete.ts @@ -9,23 +9,26 @@ const SESSION_DELETE_FLAGS = { sessionId: { type: "string", valueHint: "<id>", - description: "Session ID (required)", + description: { "en-US": "Session ID (required)", "zh-CN": "Session ID(必填)" }, required: true, }, file: { type: "string", valueHint: "<path>", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, provider: { type: "string", valueHint: "<name>", - description: "Target provider", + description: { "en-US": "Target provider", "zh-CN": "目标 Provider" }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Delete a session", + description: { "en-US": "Delete a session", "zh-CN": "删除 Session" }, auth: "apiKey", usageArgs: "--session-id <id> [--provider <name>] [--file <path>]", flags: SESSION_DELETE_FLAGS, diff --git a/packages/commands/src/commands/managed-agent/session-events.ts b/packages/commands/src/commands/managed-agent/session-events.ts index 0cdcf33..84e15a6 100644 --- a/packages/commands/src/commands/managed-agent/session-events.ts +++ b/packages/commands/src/commands/managed-agent/session-events.ts @@ -11,32 +11,38 @@ const SESSION_EVENTS_FLAGS = { sessionId: { type: "string", valueHint: "<id>", - description: "Session ID (required)", + description: { "en-US": "Session ID (required)", "zh-CN": "Session ID(必填)" }, required: true, }, file: { type: "string", valueHint: "<path>", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, provider: { type: "string", valueHint: "<name>", - description: "Target provider", + description: { "en-US": "Target provider", "zh-CN": "目标 Provider" }, }, limit: { type: "number", valueHint: "<n>", - description: "Maximum number of events to fetch", + description: { "en-US": "Maximum number of events to fetch", "zh-CN": "要获取的最大事件数" }, }, all: { type: "switch", - description: "Fetch all pages by following the cursor", + description: { + "en-US": "Fetch all pages by following the cursor", + "zh-CN": "跟随 Cursor 获取全部分页", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "List event history for a session", + description: { "en-US": "List event history for a session", "zh-CN": "列出 Session 的事件历史" }, auth: "apiKey", usageArgs: "--session-id <id> [--limit <n>] [--all] [--file <path>]", flags: SESSION_EVENTS_FLAGS, diff --git a/packages/commands/src/commands/managed-agent/session-get.ts b/packages/commands/src/commands/managed-agent/session-get.ts index 522daad..fcbb43a 100644 --- a/packages/commands/src/commands/managed-agent/session-get.ts +++ b/packages/commands/src/commands/managed-agent/session-get.ts @@ -9,23 +9,26 @@ const SESSION_GET_FLAGS = { sessionId: { type: "string", valueHint: "<id>", - description: "Session ID (required)", + description: { "en-US": "Session ID (required)", "zh-CN": "Session ID(必填)" }, required: true, }, file: { type: "string", valueHint: "<path>", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, provider: { type: "string", valueHint: "<name>", - description: "Target provider", + description: { "en-US": "Target provider", "zh-CN": "目标 Provider" }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Get details of a session", + description: { "en-US": "Get details of a session", "zh-CN": "获取 Session 详情" }, auth: "apiKey", usageArgs: "--session-id <id> [--provider <name>] [--file <path>]", flags: SESSION_GET_FLAGS, diff --git a/packages/commands/src/commands/managed-agent/session-list.ts b/packages/commands/src/commands/managed-agent/session-list.ts index 2694e20..a87abd0 100644 --- a/packages/commands/src/commands/managed-agent/session-list.ts +++ b/packages/commands/src/commands/managed-agent/session-list.ts @@ -10,26 +10,35 @@ const SESSION_LIST_FLAGS = { file: { type: "string", valueHint: "<path>", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, agent: { type: "string", valueHint: "<name>", - description: "Filter by agent name", + description: { "en-US": "Filter by agent name", "zh-CN": "按 Agent 名称筛选" }, }, all: { type: "switch", - description: "Fetch all pages by following the cursor", + description: { + "en-US": "Fetch all pages by following the cursor", + "zh-CN": "跟随 Cursor 获取全部分页", + }, }, provider: { type: "string", valueHint: "<name>", - description: "Target provider", + description: { "en-US": "Target provider", "zh-CN": "目标 Provider" }, }, } satisfies FlagsDef; export default defineCommand({ - description: "List sessions from the provider", + description: { + "en-US": "List sessions from the provider", + "zh-CN": "列出 Provider 中的 Session", + }, auth: "apiKey", usageArgs: "[--agent <name>] [--all] [--provider <name>] [--file <path>]", flags: SESSION_LIST_FLAGS, diff --git a/packages/commands/src/commands/managed-agent/session-run.ts b/packages/commands/src/commands/managed-agent/session-run.ts index ebae004..ff84b1d 100644 --- a/packages/commands/src/commands/managed-agent/session-run.ts +++ b/packages/commands/src/commands/managed-agent/session-run.ts @@ -14,55 +14,82 @@ const SESSION_RUN_FLAGS = { prompt: { type: "string", valueHint: "<text>", - description: "Prompt to send (required)", + description: { "en-US": "Prompt to send (required)", "zh-CN": "要发送的 Prompt(必填)" }, required: true, }, file: { type: "string", valueHint: "<path>", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, agent: { type: "string", valueHint: "<name>", - description: "Agent name (auto-detected when only one agent is configured)", + description: { + "en-US": "Agent name (auto-detected when only one agent is configured)", + "zh-CN": "Agent 名称(仅配置一个 Agent 时自动识别)", + }, }, environment: { type: "string", valueHint: "<name>", - description: "Override agent's declared environment", + description: { + "en-US": "Override agent's declared environment", + "zh-CN": "覆盖 Agent 声明的环境", + }, }, vault: { type: "string", valueHint: "<name>", - description: "Override agent's declared vault", + description: { "en-US": "Override agent's declared vault", "zh-CN": "覆盖 Agent 声明的 Vault" }, }, memoryStores: { type: "string", valueHint: "<names>", - description: "Override agent's memory stores (comma-separated)", + description: { + "en-US": "Override agent's memory stores (comma-separated)", + "zh-CN": "覆盖 Agent 的 Memory Store(以逗号分隔)", + }, + }, + title: { + type: "string", + valueHint: "<title>", + description: { "en-US": "Session title", "zh-CN": "Session 标题" }, }, - title: { type: "string", valueHint: "<title>", description: "Session title" }, provider: { type: "string", valueHint: "<name>", - description: "Target provider", + description: { "en-US": "Target provider", "zh-CN": "目标 Provider" }, }, noStream: { type: "switch", - description: "Use polling instead of SSE streaming", + description: { + "en-US": "Use polling instead of SSE streaming", + "zh-CN": "使用轮询代替 SSE 流式传输", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Create a session, send a message, and stream the response", + description: { + "en-US": "Create a session, send a message, and stream the response", + "zh-CN": "创建 Session、发送消息并流式输出响应", + }, auth: "apiKey", usageArgs: "--prompt <text> [--agent <name>] [--no-stream] [--file <path>]", flags: SESSION_RUN_FLAGS, exampleArgs: ['--prompt "hello"', '--agent assistant --prompt "summarize this repo"'], notes: [ ...CREDENTIALS_NOTE, - "--output json emits one envelope: { session_id, provider, agent, events } — read session_id to chain `session send/get/events/delete`.", + { + "en-US": + "--output json emits one envelope: { session_id, provider, agent, events } — read session_id to chain `session send/get/events/delete`.", + "zh-CN": + "--output json 输出一个 Envelope:{ session_id, provider, agent, events }。读取 session_id 后可串联调用 `session send/get/events/delete`。", + }, ], async run(ctx) { const { settings, flags } = ctx; diff --git a/packages/commands/src/commands/managed-agent/session-send.ts b/packages/commands/src/commands/managed-agent/session-send.ts index 22f9dc0..aea6b79 100644 --- a/packages/commands/src/commands/managed-agent/session-send.ts +++ b/packages/commands/src/commands/managed-agent/session-send.ts @@ -10,33 +10,42 @@ const SESSION_SEND_FLAGS = { sessionId: { type: "string", valueHint: "<id>", - description: "Session ID (required)", + description: { "en-US": "Session ID (required)", "zh-CN": "Session ID(必填)" }, required: true, }, message: { type: "string", valueHint: "<text>", - description: "Message to send (required)", + description: { "en-US": "Message to send (required)", "zh-CN": "要发送的消息(必填)" }, required: true, }, file: { type: "string", valueHint: "<path>", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, provider: { type: "string", valueHint: "<name>", - description: "Target provider", + description: { "en-US": "Target provider", "zh-CN": "目标 Provider" }, }, noStream: { type: "switch", - description: "Use polling instead of SSE streaming", + description: { + "en-US": "Use polling instead of SSE streaming", + "zh-CN": "使用轮询代替 SSE 流式传输", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Send a message to an existing session and stream the response", + description: { + "en-US": "Send a message to an existing session and stream the response", + "zh-CN": "向已有 Session 发送消息并流式输出响应", + }, auth: "apiKey", usageArgs: "--session-id <id> --message <text> [--no-stream] [--file <path>]", flags: SESSION_SEND_FLAGS, diff --git a/packages/commands/src/commands/managed-agent/skill-list.ts b/packages/commands/src/commands/managed-agent/skill-list.ts index f5cf185..f8f7727 100644 --- a/packages/commands/src/commands/managed-agent/skill-list.ts +++ b/packages/commands/src/commands/managed-agent/skill-list.ts @@ -12,23 +12,33 @@ const SKILL_LIST_FLAGS = { file: { type: "string", valueHint: "<path>", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, source: { type: "string", valueHint: "<source>", - description: - "Skill catalog: custom (workspace-uploaded, default), official (built-in), or all (both catalogs in one call)", + description: { + "en-US": + "Skill catalog: custom (workspace-uploaded, default), official (built-in), or all (both catalogs in one call)", + "zh-CN": + "Skill Catalog:custom(Workspace 上传,默认)、official(内置)或 all(一次调用获取两类 Catalog)", + }, }, provider: { type: "string", valueHint: "<name>", - description: "Target provider", + description: { "en-US": "Target provider", "zh-CN": "目标 Provider" }, }, } satisfies FlagsDef; export default defineCommand({ - description: "List skills from the provider's skill catalog", + description: { + "en-US": "List skills from the provider's skill catalog", + "zh-CN": "列出 Provider Skill Catalog 中的 Skill", + }, auth: "apiKey", usageArgs: "[--source custom|official|all] [--provider <name>] [--file <path>]", flags: SKILL_LIST_FLAGS, @@ -40,9 +50,21 @@ export default defineCommand({ ], notes: [ ...CREDENTIALS_NOTE, - "Providers without a skill listing API (e.g. ark) return an empty list.", - "For agent-driven skill selection, use `--source all --output json`: one call returns both catalogs with per-skill `source` and `description` fields to pick from.", - "When generating a task that needs a suitable skill, call this command to match official or custom skills before wiring them into the task.", + { + "en-US": "Providers without a skill listing API (e.g. ark) return an empty list.", + "zh-CN": "没有 Skill 列表 API 的 Provider(例如 ark)会返回空列表。", + }, + { + "en-US": + "For agent-driven skill selection, use `--source all --output json`: one call returns both catalogs with per-skill `source` and `description` fields to pick from.", + "zh-CN": + "由 Agent 选择 Skill 时,请使用 `--source all --output json`:一次调用返回两类 Catalog,并为每个 Skill 提供 `source` 和 `description` 字段用于选择。", + }, + { + "en-US": + "When generating a task that needs a suitable skill, call this command to match official or custom skills before wiring them into the task.", + "zh-CN": "生成需要合适 Skill 的任务时,先调用此命令匹配官方或自定义 Skill,再将其接入任务。", + }, ], validate: (f) => f.source && !SKILL_SOURCES.includes(f.source as SkillSource) diff --git a/packages/commands/src/commands/managed-agent/state-import.ts b/packages/commands/src/commands/managed-agent/state-import.ts index 7d4565e..91841c5 100644 --- a/packages/commands/src/commands/managed-agent/state-import.ts +++ b/packages/commands/src/commands/managed-agent/state-import.ts @@ -9,29 +9,44 @@ const STATE_IMPORT_FLAGS = { address: { type: "string", valueHint: "<provider.type.name>", - description: "Resource state address (required)", + description: { + "en-US": "Resource state address (required)", + "zh-CN": "资源 State 地址(必填)", + }, required: true, }, remoteId: { type: "string", valueHint: "<id>", - description: "Existing remote resource ID to import (required)", + description: { + "en-US": "Existing remote resource ID to import (required)", + "zh-CN": "要导入的已有远端资源 ID(必填)", + }, required: true, }, resourceVersion: { type: "number", valueHint: "<n>", - description: "Resource version (for versioned resources like agents)", + description: { + "en-US": "Resource version (for versioned resources like agents)", + "zh-CN": "资源版本(用于 Agent 等带版本的资源)", + }, }, file: { type: "string", valueHint: "<path>", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Import an existing remote resource into agents state", + description: { + "en-US": "Import an existing remote resource into agents state", + "zh-CN": "将已有远端资源导入 Agent State", + }, auth: "apiKey", usageArgs: "--address <provider.type.name> --remote-id <id> [--resource-version <n>] [--file <path>]", diff --git a/packages/commands/src/commands/managed-agent/state-list.ts b/packages/commands/src/commands/managed-agent/state-list.ts index 8bc604b..e6588eb 100644 --- a/packages/commands/src/commands/managed-agent/state-list.ts +++ b/packages/commands/src/commands/managed-agent/state-list.ts @@ -8,12 +8,18 @@ const STATE_LIST_FLAGS = { file: { type: "string", valueHint: "<path>", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "List resources tracked in agents state", + description: { + "en-US": "List resources tracked in agents state", + "zh-CN": "列出 Agent State 中跟踪的资源", + }, auth: "none", usageArgs: "[--file <path>]", flags: STATE_LIST_FLAGS, diff --git a/packages/commands/src/commands/managed-agent/state-rm.ts b/packages/commands/src/commands/managed-agent/state-rm.ts index 0442807..8d6242d 100644 --- a/packages/commands/src/commands/managed-agent/state-rm.ts +++ b/packages/commands/src/commands/managed-agent/state-rm.ts @@ -15,18 +15,27 @@ const STATE_RM_FLAGS = { address: { type: "string", valueHint: "<provider.type.name>", - description: "Resource state address (required)", + description: { + "en-US": "Resource state address (required)", + "zh-CN": "资源 State 地址(必填)", + }, required: true, }, file: { type: "string", valueHint: "<path>", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Remove a resource from state without destroying it remotely", + description: { + "en-US": "Remove a resource from state without destroying it remotely", + "zh-CN": "从 State 中移除资源,但不销毁远端资源", + }, auth: "none", usageArgs: "--address <provider.type.name> [--file <path>]", flags: STATE_RM_FLAGS, diff --git a/packages/commands/src/commands/managed-agent/state-show.ts b/packages/commands/src/commands/managed-agent/state-show.ts index c478782..82e7fae 100644 --- a/packages/commands/src/commands/managed-agent/state-show.ts +++ b/packages/commands/src/commands/managed-agent/state-show.ts @@ -15,18 +15,27 @@ const STATE_SHOW_FLAGS = { address: { type: "string", valueHint: "<provider.type.name>", - description: "Resource state address (required)", + description: { + "en-US": "Resource state address (required)", + "zh-CN": "资源 State 地址(必填)", + }, required: true, }, file: { type: "string", valueHint: "<path>", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Show details of a resource in agents state", + description: { + "en-US": "Show details of a resource in agents state", + "zh-CN": "显示 Agent State 中资源的详情", + }, auth: "none", usageArgs: "--address <provider.type.name> [--file <path>]", flags: STATE_SHOW_FLAGS, diff --git a/packages/commands/src/commands/managed-agent/validate.ts b/packages/commands/src/commands/managed-agent/validate.ts index ad918a1..32fe5ea 100644 --- a/packages/commands/src/commands/managed-agent/validate.ts +++ b/packages/commands/src/commands/managed-agent/validate.ts @@ -14,12 +14,18 @@ const VALIDATE_FLAGS = { file: { type: "string", valueHint: "<path>", - description: "Config file path (default: agents.yaml)", + description: { + "en-US": "Config file path (default: agents.yaml)", + "zh-CN": "配置文件路径(默认:agents.yaml)", + }, }, } satisfies FlagsDef; export default defineCommand({ - description: "Validate an agents.yaml configuration (offline)", + description: { + "en-US": "Validate an agents.yaml configuration (offline)", + "zh-CN": "离线验证 agents.yaml 配置", + }, auth: "none", usageArgs: "[--file <path>]", flags: VALIDATE_FLAGS, diff --git a/packages/commands/src/commands/memory/add.ts b/packages/commands/src/commands/memory/add.ts index 160999f..cb1fb35 100644 --- a/packages/commands/src/commands/memory/add.ts +++ b/packages/commands/src/commands/memory/add.ts @@ -11,28 +11,49 @@ import { import { emitResult, emitBare } from "bailian-cli-runtime"; const ADD_FLAGS = { - userId: { type: "string", valueHint: "<id>", description: "User ID (required)", required: true }, + userId: { + type: "string", + valueHint: "<id>", + description: { "en-US": "User ID (required)", "zh-CN": "用户 ID(必填)" }, + required: true, + }, messages: { type: "string", valueHint: "<json>", - description: 'Messages JSON array: [{"role":"user","content":"..."},...]', + description: { + "en-US": 'Messages JSON array: [{"role":"user","content":"..."},...]', + "zh-CN": '消息 JSON 数组:[{"role":"user","content":"..."},...]', + }, + }, + content: { + type: "string", + valueHint: "<text>", + description: { "en-US": "Custom content text to memorize", "zh-CN": "要记忆的自定义内容文本" }, }, - content: { type: "string", valueHint: "<text>", description: "Custom content text to memorize" }, profileSchema: { type: "string", valueHint: "<id>", - description: "Profile schema ID for user profiling", + description: { + "en-US": "Profile schema ID for user profiling", + "zh-CN": "用于用户画像的 Profile Schema ID", + }, }, memoryLibraryId: { type: "string", valueHint: "<id>", - description: "Memory library ID (isolate memory space)", + description: { + "en-US": "Memory library ID (isolate memory space)", + "zh-CN": "记忆库 ID(用于隔离记忆空间)", + }, }, } satisfies FlagsDef; type AddFlags = ParsedFlags<typeof ADD_FLAGS>; export default defineCommand({ - description: "Add memory from messages or custom content", + description: { + "en-US": "Add memory from messages or custom content", + "zh-CN": "从消息或自定义内容添加记忆", + }, auth: "apiKey", usageArgs: "--user-id <id> [--messages <json>] [--content <text>] [flags]", flags: ADD_FLAGS, diff --git a/packages/commands/src/commands/memory/delete.ts b/packages/commands/src/commands/memory/delete.ts index 0c85ddc..d3febaa 100644 --- a/packages/commands/src/commands/memory/delete.ts +++ b/packages/commands/src/commands/memory/delete.ts @@ -2,26 +2,29 @@ import { defineCommand, memoryNodePath, detectOutputFormat } from "bailian-cli-c import { emitResult, emitBare } from "bailian-cli-runtime"; export default defineCommand({ - description: "Delete a memory node", + description: { "en-US": "Delete a memory node", "zh-CN": "删除记忆节点" }, auth: "apiKey", usageArgs: "--node-id <id> --user-id <id>", flags: { nodeId: { type: "string", valueHint: "<id>", - description: "Memory node ID (required)", + description: { "en-US": "Memory node ID (required)", "zh-CN": "记忆节点 ID(必填)" }, required: true, }, userId: { type: "string", valueHint: "<id>", - description: "User ID (required)", + description: { "en-US": "User ID (required)", "zh-CN": "用户 ID(必填)" }, required: true, }, memoryLibraryId: { type: "string", valueHint: "<id>", - description: "Memory library ID (non-default library)", + description: { + "en-US": "Memory library ID (non-default library)", + "zh-CN": "记忆库 ID(非默认记忆库)", + }, }, }, exampleArgs: ["--node-id node_xxx --user-id user1"], diff --git a/packages/commands/src/commands/memory/list.ts b/packages/commands/src/commands/memory/list.ts index 6757fe6..67b0bb6 100644 --- a/packages/commands/src/commands/memory/list.ts +++ b/packages/commands/src/commands/memory/list.ts @@ -7,23 +7,31 @@ import { import { emitResult, emitBare } from "bailian-cli-runtime"; export default defineCommand({ - description: "List memory nodes for a user", + description: { "en-US": "List memory nodes for a user", "zh-CN": "列出用户的记忆节点" }, auth: "apiKey", usageArgs: "--user-id <id> [flags]", flags: { userId: { type: "string", valueHint: "<id>", - description: "User ID (required)", + description: { "en-US": "User ID (required)", "zh-CN": "用户 ID(必填)" }, required: true, }, pageSize: { type: "number", valueHint: "<n>", - description: "Results per page (default: 10)", + description: { "en-US": "Results per page (default: 10)", "zh-CN": "每页结果数(默认:10)" }, + }, + page: { + type: "number", + valueHint: "<n>", + description: { "en-US": "Page number (default: 1)", "zh-CN": "页码(默认:1)" }, + }, + memoryLibraryId: { + type: "string", + valueHint: "<id>", + description: { "en-US": "Memory library ID", "zh-CN": "记忆库 ID" }, }, - page: { type: "number", valueHint: "<n>", description: "Page number (default: 1)" }, - memoryLibraryId: { type: "string", valueHint: "<id>", description: "Memory library ID" }, }, exampleArgs: ["--user-id user1", "--user-id user1 --page-size 20 --page 2"], async run(ctx) { diff --git a/packages/commands/src/commands/memory/profile-create.ts b/packages/commands/src/commands/memory/profile-create.ts index 391fd08..727614f 100644 --- a/packages/commands/src/commands/memory/profile-create.ts +++ b/packages/commands/src/commands/memory/profile-create.ts @@ -9,21 +9,31 @@ import { import { emitResult, emitBare } from "bailian-cli-runtime"; export default defineCommand({ - description: "Create a user profile schema for memory profiling", + description: { + "en-US": "Create a user profile schema for memory profiling", + "zh-CN": "创建用于记忆画像的用户 Profile Schema", + }, auth: "apiKey", usageArgs: "--name <name> --attributes <json> [flags]", flags: { name: { type: "string", valueHint: "<name>", - description: "Schema name (required)", + description: { "en-US": "Schema name (required)", "zh-CN": "Schema 名称(必填)" }, required: true, }, - description: { type: "string", valueHint: "<text>", description: "Schema description" }, + description: { + type: "string", + valueHint: "<text>", + description: { "en-US": "Schema description", "zh-CN": "Schema 描述" }, + }, attributes: { type: "string", valueHint: "<json>", - description: 'Attributes JSON array: [{"name":"age","description":"age"}]', + description: { + "en-US": 'Attributes JSON array: [{"name":"age","description":"age"}]', + "zh-CN": '属性 JSON 数组:[{"name":"age","description":"age"}]', + }, required: true, }, }, diff --git a/packages/commands/src/commands/memory/profile-get.ts b/packages/commands/src/commands/memory/profile-get.ts index 0a891ad..1edf3b4 100644 --- a/packages/commands/src/commands/memory/profile-get.ts +++ b/packages/commands/src/commands/memory/profile-get.ts @@ -7,20 +7,26 @@ import { import { emitResult, emitBare } from "bailian-cli-runtime"; export default defineCommand({ - description: "Get user profile by schema ID and user ID", + description: { + "en-US": "Get user profile by schema ID and user ID", + "zh-CN": "通过 Schema ID 和用户 ID 获取用户画像", + }, auth: "apiKey", usageArgs: "--schema-id <id> --user-id <id>", flags: { schemaId: { type: "string", valueHint: "<id>", - description: "Profile schema ID (required)", + description: { + "en-US": "Profile schema ID (required)", + "zh-CN": "Profile Schema ID(必填)", + }, required: true, }, userId: { type: "string", valueHint: "<id>", - description: "User ID (required)", + description: { "en-US": "User ID (required)", "zh-CN": "用户 ID(必填)" }, required: true, }, }, diff --git a/packages/commands/src/commands/memory/search.ts b/packages/commands/src/commands/memory/search.ts index 6abccb4..d8cc318 100644 --- a/packages/commands/src/commands/memory/search.ts +++ b/packages/commands/src/commands/memory/search.ts @@ -11,24 +11,46 @@ import { import { emitResult, emitBare } from "bailian-cli-runtime"; const SEARCH_FLAGS = { - userId: { type: "string", valueHint: "<id>", description: "User ID (required)", required: true }, - query: { type: "string", valueHint: "<text>", description: "Search query text" }, + userId: { + type: "string", + valueHint: "<id>", + description: { "en-US": "User ID (required)", "zh-CN": "用户 ID(必填)" }, + required: true, + }, + query: { + type: "string", + valueHint: "<text>", + description: { "en-US": "Search query text", "zh-CN": "搜索查询文本" }, + }, messages: { type: "string", valueHint: "<json>", - description: "Messages JSON array for context-based search", + description: { + "en-US": "Messages JSON array for context-based search", + "zh-CN": "用于上下文搜索的消息 JSON 数组", + }, }, topK: { type: "number", valueHint: "<n>", - description: "Number of results to return (default: 10)", + description: { + "en-US": "Number of results to return (default: 10)", + "zh-CN": "返回结果数量(默认:10)", + }, + }, + memoryLibraryId: { + type: "string", + valueHint: "<id>", + description: { "en-US": "Memory library ID", "zh-CN": "记忆库 ID" }, }, - memoryLibraryId: { type: "string", valueHint: "<id>", description: "Memory library ID" }, } satisfies FlagsDef; type SearchFlags = ParsedFlags<typeof SEARCH_FLAGS>; export default defineCommand({ - description: "Search memory nodes by query or messages", + description: { + "en-US": "Search memory nodes by query or messages", + "zh-CN": "通过查询文本或消息搜索记忆节点", + }, auth: "apiKey", usageArgs: "--user-id <id> [--query <text>] [flags]", flags: SEARCH_FLAGS, diff --git a/packages/commands/src/commands/memory/update.ts b/packages/commands/src/commands/memory/update.ts index 14cd3e9..438e1b8 100644 --- a/packages/commands/src/commands/memory/update.ts +++ b/packages/commands/src/commands/memory/update.ts @@ -7,32 +7,38 @@ import { import { emitResult, emitBare } from "bailian-cli-runtime"; export default defineCommand({ - description: "Update a memory node content", + description: { "en-US": "Update a memory node content", "zh-CN": "更新记忆节点内容" }, auth: "apiKey", usageArgs: "--node-id <id> --user-id <id> --content <text>", flags: { nodeId: { type: "string", valueHint: "<id>", - description: "Memory node ID (required)", + description: { "en-US": "Memory node ID (required)", "zh-CN": "记忆节点 ID(必填)" }, required: true, }, userId: { type: "string", valueHint: "<id>", - description: "User ID (required)", + description: { "en-US": "User ID (required)", "zh-CN": "用户 ID(必填)" }, required: true, }, content: { type: "string", valueHint: "<text>", - description: "New content for the memory node (required)", + description: { + "en-US": "New content for the memory node (required)", + "zh-CN": "记忆节点的新内容(必填)", + }, required: true, }, memoryLibraryId: { type: "string", valueHint: "<id>", - description: "Memory library ID (non-default library)", + description: { + "en-US": "Memory library ID (non-default library)", + "zh-CN": "记忆库 ID(非默认记忆库)", + }, }, }, exampleArgs: ['--node-id node_xxx --user-id user1 --content "updated memory content"'], diff --git a/packages/commands/src/commands/model/list.ts b/packages/commands/src/commands/model/list.ts index b76f058..7bb28d2 100644 --- a/packages/commands/src/commands/model/list.ts +++ b/packages/commands/src/commands/model/list.ts @@ -18,34 +18,60 @@ const LIST_FLAGS = { model: { type: "string", valueHint: "<model>", - description: "Show full details of a specific model family (switches to detail mode)", + description: { + "en-US": "Show full details of a specific model family (switches to detail mode)", + "zh-CN": "显示指定模型系列的完整详情(切换到详情模式)", + }, + }, + page: { + type: "number", + valueHint: "<n>", + description: { "en-US": "Page number (default: 1)", "zh-CN": "页码(默认:1)" }, + }, + pageSize: { + type: "number", + valueHint: "<n>", + description: { "en-US": "Results per page (default: 10)", "zh-CN": "每页结果数(默认:10)" }, }, - page: { type: "number", valueHint: "<n>", description: "Page number (default: 1)" }, - pageSize: { type: "number", valueHint: "<n>", description: "Results per page (default: 10)" }, provider: { type: "array", valueHint: "<p>", - description: "Filter by provider (repeatable, e.g. --provider alibaba --provider deepseek)", + description: { + "en-US": "Filter by provider (repeatable, e.g. --provider alibaba --provider deepseek)", + "zh-CN": "按提供商筛选(可重复,例如 --provider alibaba --provider deepseek)", + }, }, capability: { type: "array", valueHint: "<c>", - description: "Filter by capability code (TG, Reasoning, VU, IG, VG, TTS, ASR, …)", + description: { + "en-US": "Filter by capability code (TG, Reasoning, VU, IG, VG, TTS, ASR, …)", + "zh-CN": "按能力代码筛选(TG、Reasoning、VU、IG、VG、TTS、ASR 等)", + }, }, feature: { type: "array", valueHint: "<f>", - description: "Filter by feature (function-calling, web-search, structured-outputs, …)", + description: { + "en-US": "Filter by feature (function-calling, web-search, structured-outputs, …)", + "zh-CN": "按特性筛选(function-calling、web-search、structured-outputs 等)", + }, }, contextWindow: { type: "array", valueHint: "<w>", - description: "Filter by context window range bucket", + description: { + "en-US": "Filter by context window range bucket", + "zh-CN": "按上下文窗口范围筛选", + }, }, enrich: { type: "switch", - description: - "Also fetch input parameter schema (predictConfig) for trunk models (detail mode only)", + description: { + "en-US": + "Also fetch input parameter schema (predictConfig) for trunk models (detail mode only)", + "zh-CN": "同时获取主干模型的输入参数 Schema(predictConfig,仅详情模式)", + }, }, } satisfies FlagsDef; @@ -289,7 +315,10 @@ function printPredictConfigTable(entries: PredictConfigEntry[]): void { // --------------------------------------------------------------------------- export default defineCommand({ - description: "Browse model families or show detailed model info in the Bailian model marketplace", + description: { + "en-US": "Browse model families or show detailed model info in the Bailian model marketplace", + "zh-CN": "浏览百炼模型市场中的模型系列,或查看模型详细信息", + }, auth: "console", usageArgs: "[--model <model>] [--page <n>] [--page-size <n>] [--provider <p>] [--capability <c>] [--feature <f>] [--enrich]", diff --git a/packages/commands/src/commands/pipeline/run.ts b/packages/commands/src/commands/pipeline/run.ts index d06537e..10089dd 100644 --- a/packages/commands/src/commands/pipeline/run.ts +++ b/packages/commands/src/commands/pipeline/run.ts @@ -11,36 +11,55 @@ const RUN_FLAGS = { file: { type: "string", valueHint: "<path>", - description: "Pipeline definition file (YAML/JSON)", + description: { + "en-US": "Pipeline definition file (YAML/JSON)", + "zh-CN": "Pipeline 定义文件(YAML/JSON)", + }, required: true, }, - input: { type: "string", valueHint: "<json>", description: "Runtime input as inline JSON" }, + input: { + type: "string", + valueHint: "<json>", + description: { "en-US": "Runtime input as inline JSON", "zh-CN": "内联 JSON 格式的运行时输入" }, + }, inputFile: { type: "string", valueHint: "<path>", - description: "Runtime input from a JSON file", + description: { + "en-US": "Runtime input from a JSON file", + "zh-CN": "来自 JSON 文件的运行时输入", + }, }, concurrency: { type: "number", valueHint: "<n>", - description: "Max parallel steps (default: 1)", + description: { + "en-US": "Max parallel steps (default: 1)", + "zh-CN": "最大并行步骤数(默认:1)", + }, }, events: { type: "string", valueHint: "<format>", - description: "Emit lifecycle events: jsonl", + description: { "en-US": "Emit lifecycle events: jsonl", "zh-CN": "输出生命周期事件:jsonl" }, choices: ["jsonl"] as const, }, stepTimeout: { type: "number", valueHint: "<seconds>", - description: "Default step timeout in seconds", + description: { + "en-US": "Default step timeout in seconds", + "zh-CN": "默认步骤超时时间,单位为秒", + }, }, } satisfies FlagsDef; type RunFlags = ParsedFlags<typeof RUN_FLAGS>; export default defineCommand({ - description: "Run a pipeline workflow definition", + description: { + "en-US": "Run a pipeline workflow definition", + "zh-CN": "运行 Pipeline 工作流定义", + }, auth: "none", usageArgs: "--file <path> [flags]", flags: RUN_FLAGS, diff --git a/packages/commands/src/commands/pipeline/validate.ts b/packages/commands/src/commands/pipeline/validate.ts index 695b877..e5594dc 100644 --- a/packages/commands/src/commands/pipeline/validate.ts +++ b/packages/commands/src/commands/pipeline/validate.ts @@ -6,14 +6,20 @@ import { collectPipelineIssues, collectPipelineHints } from "bailian-cli-runtime import { loadPipelineFile } from "./load-file.ts"; export default defineCommand({ - description: "Validate a pipeline definition without executing", + description: { + "en-US": "Validate a pipeline definition without executing", + "zh-CN": "验证 Pipeline 定义但不执行", + }, auth: "none", usageArgs: "--file <path>", flags: { file: { type: "string", valueHint: "<path>", - description: "Pipeline definition file (YAML/JSON)", + description: { + "en-US": "Pipeline definition file (YAML/JSON)", + "zh-CN": "Pipeline 定义文件(YAML/JSON)", + }, required: true, }, }, diff --git a/packages/commands/src/commands/plugin/install.ts b/packages/commands/src/commands/plugin/install.ts index 838bec9..7a018a2 100644 --- a/packages/commands/src/commands/plugin/install.ts +++ b/packages/commands/src/commands/plugin/install.ts @@ -2,14 +2,20 @@ import { defineCommand, detectOutputFormat } from "bailian-cli-core"; import { emitResult } from "bailian-cli-runtime"; export default defineCommand({ - description: "Install or upgrade an allowlisted Command Pack", + description: { + "en-US": "Install or upgrade an allowlisted Command Pack", + "zh-CN": "安装或升级白名单内的 Command Pack", + }, auth: "none", usageArgs: "--package <name[@version]>", flags: { package: { type: "string", valueHint: "<name[@version]>", - description: "Allowlisted Command Pack package and optional version or tag", + description: { + "en-US": "Allowlisted Command Pack package and optional version or tag", + "zh-CN": "白名单内的 Command Pack 包名,以及可选的版本或 Tag", + }, required: true, }, }, diff --git a/packages/commands/src/commands/plugin/link.ts b/packages/commands/src/commands/plugin/link.ts index 4a232c1..7b78392 100644 --- a/packages/commands/src/commands/plugin/link.ts +++ b/packages/commands/src/commands/plugin/link.ts @@ -2,14 +2,20 @@ import { defineCommand, detectOutputFormat } from "bailian-cli-core"; import { emitResult } from "bailian-cli-runtime"; export default defineCommand({ - description: "Link an allowlisted local Command Pack for development", + description: { + "en-US": "Link an allowlisted local Command Pack for development", + "zh-CN": "链接白名单内的本地 Command Pack 用于开发", + }, auth: "none", usageArgs: "--path <directory>", flags: { path: { type: "string", valueHint: "<directory>", - description: "Local Command Pack package directory", + description: { + "en-US": "Local Command Pack package directory", + "zh-CN": "本地 Command Pack 包目录", + }, required: true, }, }, diff --git a/packages/commands/src/commands/plugin/list.ts b/packages/commands/src/commands/plugin/list.ts index efc867e..047847e 100644 --- a/packages/commands/src/commands/plugin/list.ts +++ b/packages/commands/src/commands/plugin/list.ts @@ -2,7 +2,10 @@ import { defineCommand, detectOutputFormat } from "bailian-cli-core"; import { emitBare, emitResult, formatTable } from "bailian-cli-runtime"; export default defineCommand({ - description: "List installed Command Packs and their load status", + description: { + "en-US": "List installed Command Packs and their load status", + "zh-CN": "列出已安装的 Command Pack 及其加载状态", + }, auth: "none", exampleArgs: ["", "--output json"], async run(ctx) { diff --git a/packages/commands/src/commands/plugin/remove.ts b/packages/commands/src/commands/plugin/remove.ts index 6453300..75fbbbe 100644 --- a/packages/commands/src/commands/plugin/remove.ts +++ b/packages/commands/src/commands/plugin/remove.ts @@ -2,14 +2,20 @@ import { defineCommand, detectOutputFormat } from "bailian-cli-core"; import { emitResult } from "bailian-cli-runtime"; export default defineCommand({ - description: "Remove an installed Command Pack", + description: { + "en-US": "Remove an installed Command Pack", + "zh-CN": "移除已安装的 Command Pack", + }, auth: "none", usageArgs: "--name <package>", flags: { name: { type: "string", valueHint: "<package>", - description: "Allowlisted Command Pack package name", + description: { + "en-US": "Allowlisted Command Pack package name", + "zh-CN": "白名单内的 Command Pack 包名", + }, required: true, }, }, diff --git a/packages/commands/src/commands/quota/check.ts b/packages/commands/src/commands/quota/check.ts index beca1cb..82637f8 100644 --- a/packages/commands/src/commands/quota/check.ts +++ b/packages/commands/src/commands/quota/check.ts @@ -191,19 +191,28 @@ function printTable(rows: CheckRow[]): void { } export default defineCommand({ - description: "Check current usage against rate limits", + description: { + "en-US": "Check current usage against rate limits", + "zh-CN": "根据限流额度检查当前用量", + }, auth: "console", usageArgs: "[--model <model>] [flags]", flags: { model: { type: "string", valueHint: "<model>", - description: "Model name(s), comma-separated", + description: { + "en-US": "Model name(s), comma-separated", + "zh-CN": "模型名称,多个名称以逗号分隔", + }, }, period: { type: "string", valueHint: "<minutes>", - description: "Query usage for the last N minutes (default: 2)", + description: { + "en-US": "Query usage for the last N minutes (default: 2)", + "zh-CN": "查询最近 N 分钟的用量(默认:2)", + }, }, }, exampleArgs: [ diff --git a/packages/commands/src/commands/quota/history.ts b/packages/commands/src/commands/quota/history.ts index a12db99..6f1be61 100644 --- a/packages/commands/src/commands/quota/history.ts +++ b/packages/commands/src/commands/quota/history.ts @@ -82,24 +82,24 @@ function printTable(records: LimitApplicationItem[], total: number): void { } export default defineCommand({ - description: "View quota change history", + description: { "en-US": "View quota change history", "zh-CN": "查看额度变更历史" }, auth: "console", usageArgs: "[flags]", flags: { page: { type: "string", valueHint: "<n>", - description: "Page number (default: 1)", + description: { "en-US": "Page number (default: 1)", "zh-CN": "页码(默认:1)" }, }, pageSize: { type: "string", valueHint: "<n>", - description: "Page size (default: 10)", + description: { "en-US": "Page size (default: 10)", "zh-CN": "每页数量(默认:10)" }, }, model: { type: "string", valueHint: "<model>", - description: "Filter by model name", + description: { "en-US": "Filter by model name", "zh-CN": "按模型名称筛选" }, }, }, exampleArgs: ["", "--page 2", "--page-size 20", "--model qwen-turbo", "--output json"], diff --git a/packages/commands/src/commands/quota/list.ts b/packages/commands/src/commands/quota/list.ts index a6aefd6..2a8e902 100644 --- a/packages/commands/src/commands/quota/list.ts +++ b/packages/commands/src/commands/quota/list.ts @@ -168,14 +168,17 @@ function printTable(rows: ListRow[]): void { } export default defineCommand({ - description: "View model RPM/TPM rate limits", + description: { "en-US": "View model RPM/TPM rate limits", "zh-CN": "查看模型 RPM/TPM 限流额度" }, auth: "console", usageArgs: "[--model <model>] [flags]", flags: { model: { type: "string", valueHint: "<model>", - description: "Model name(s), comma-separated", + description: { + "en-US": "Model name(s), comma-separated", + "zh-CN": "模型名称,多个名称以逗号分隔", + }, }, }, exampleArgs: ["", "--model qwen3.6-plus", "--model qwen3.6-plus,qwen-turbo", "--output json"], diff --git a/packages/commands/src/commands/quota/request.ts b/packages/commands/src/commands/quota/request.ts index 5f25e27..98bdf21 100644 --- a/packages/commands/src/commands/quota/request.ts +++ b/packages/commands/src/commands/quota/request.ts @@ -73,20 +73,20 @@ async function fetchModelQpmInfo( } export default defineCommand({ - description: "Request a temporary quota increase", + description: { "en-US": "Request a temporary quota increase", "zh-CN": "申请临时提升额度" }, auth: "console", usageArgs: "--model <model> --tpm <value> [flags]", flags: { model: { type: "string", valueHint: "<model>", - description: "Model name (required)", + description: { "en-US": "Model name (required)", "zh-CN": "模型名称(必填)" }, required: true, }, tpm: { type: "string", valueHint: "<value>", - description: "Target TPM value (required)", + description: { "en-US": "Target TPM value (required)", "zh-CN": "目标 TPM 值(必填)" }, required: true, }, }, diff --git a/packages/commands/src/commands/skill/add.ts b/packages/commands/src/commands/skill/add.ts index 5c5c035..0c1e433 100644 --- a/packages/commands/src/commands/skill/add.ts +++ b/packages/commands/src/commands/skill/add.ts @@ -25,18 +25,27 @@ interface AddOutcome { const INSTALL_CONCURRENCY = 3; export default defineCommand({ - description: "Install skills from the Bailian skill registry into local agents", + description: { + "en-US": "Install skills from the Bailian skill registry into local agents", + "zh-CN": "将百炼 Skill Registry 中的 Skill 安装到本地 Agent", + }, auth: "none", usageArgs: "--all | --name <name,...>", flags: { all: { type: "switch", - description: "Install all skills from the registry", + description: { + "en-US": "Install all skills from the registry", + "zh-CN": "安装 Registry 中的全部 Skill", + }, }, name: { type: "string", valueHint: "<name,...>", - description: "Comma-separated skill names to install", + description: { + "en-US": "Comma-separated skill names to install", + "zh-CN": "要安装的 Skill 名称,以逗号分隔", + }, }, }, validate(flags) { diff --git a/packages/commands/src/commands/skill/init.ts b/packages/commands/src/commands/skill/init.ts index 22d5f1d..fdddeda 100644 --- a/packages/commands/src/commands/skill/init.ts +++ b/packages/commands/src/commands/skill/init.ts @@ -27,13 +27,23 @@ const BAILIAN_PREFIX = "bailian-"; const INIT_CONCURRENCY = 3; export default defineCommand({ - description: "Install all bailian-* skills (one-shot bootstrap for new environments)", + description: { + "en-US": "Install all bailian-* skills (one-shot bootstrap for new environments)", + "zh-CN": "安装全部 bailian-* Skill(用于新环境的一次性初始化)", + }, auth: "none", usageArgs: "", exampleArgs: [""], notes: [ - "Fetches the registry index and installs every skill whose name starts with bailian-", - "Equivalent to: bl skill add --all (filtered to bailian-* skills)", + { + "en-US": + "Fetches the registry index and installs every skill whose name starts with `bailian-`.", + "zh-CN": "获取 Registry 索引并安装名称以 `bailian-` 开头的所有 Skill。", + }, + { + "en-US": "Equivalent to: `bl skill add --all` (filtered to `bailian-*` skills).", + "zh-CN": "等价于:`bl skill add --all`(筛选为 `bailian-*` Skill)。", + }, ], async run(ctx) { const format = ctx.settings.outputExplicit ? ctx.settings.output : "json"; diff --git a/packages/commands/src/commands/skill/list.ts b/packages/commands/src/commands/skill/list.ts index 1a21887..05ea1a9 100644 --- a/packages/commands/src/commands/skill/list.ts +++ b/packages/commands/src/commands/skill/list.ts @@ -16,11 +16,19 @@ function truncate(text: string | undefined): string { } export default defineCommand({ - description: "List registry skills and diff against local installs", + description: { + "en-US": "List registry skills and diff against local installs", + "zh-CN": "列出 Registry Skill,并与本地安装结果比较", + }, auth: "none", exampleArgs: ["", "--output json"], notes: [ - "STATUS: installed | outdated | not-installed | missing (lock has it, dir deleted) | untracked (dir exists, not managed)", + { + "en-US": + "STATUS: installed | outdated | not-installed | missing (lock has it, dir deleted) | untracked (dir exists, not managed)", + "zh-CN": + "STATUS:installed | outdated | not-installed | missing(Lock 中存在但目录已删除)| untracked(目录存在但未被管理)", + }, ], async run(ctx) { const format = ctx.settings.outputExplicit ? ctx.settings.output : "json"; diff --git a/packages/commands/src/commands/skill/remove.ts b/packages/commands/src/commands/skill/remove.ts index 5074962..3c05399 100644 --- a/packages/commands/src/commands/skill/remove.ts +++ b/packages/commands/src/commands/skill/remove.ts @@ -19,14 +19,20 @@ interface RemoveOutcome { } export default defineCommand({ - description: "Remove locally installed skills (registry is untouched)", + description: { + "en-US": "Remove locally installed skills (registry is untouched)", + "zh-CN": "移除本地已安装的 Skill(不修改 Registry)", + }, auth: "none", usageArgs: "--name <all|name,...>", flags: { name: { type: "string", valueHint: "<all|name,...>", - description: "Skills to remove: all or comma-separated skill names", + description: { + "en-US": "Skills to remove: all or comma-separated skill names", + "zh-CN": "要移除的 Skill:all 或以逗号分隔的 Skill 名称", + }, required: true, }, }, diff --git a/packages/commands/src/commands/skill/update.ts b/packages/commands/src/commands/skill/update.ts index 249c808..39da4cb 100644 --- a/packages/commands/src/commands/skill/update.ts +++ b/packages/commands/src/commands/skill/update.ts @@ -26,18 +26,27 @@ interface UpdateOutcome { const UPDATE_CONCURRENCY = 3; export default defineCommand({ - description: "Update installed skills to the latest registry versions", + description: { + "en-US": "Update installed skills to the latest registry versions", + "zh-CN": "将已安装的 Skill 更新到 Registry 最新版本", + }, auth: "none", usageArgs: "[--all] [--name <name,...>]", flags: { all: { type: "switch", - description: "Update all installed skills (default when neither --all nor --name is given)", + description: { + "en-US": "Update all installed skills (default when neither --all nor --name is given)", + "zh-CN": "更新全部已安装 Skill(未指定 --all 或 --name 时的默认行为)", + }, }, name: { type: "string", valueHint: "<name,...>", - description: "Comma-separated skill names to update (must be already installed)", + description: { + "en-US": "Comma-separated skill names to update (must be already installed)", + "zh-CN": "要更新的 Skill 名称,以逗号分隔(必须已安装)", + }, }, }, validate(flags) { diff --git a/packages/commands/src/commands/token-plan/add-member.ts b/packages/commands/src/commands/token-plan/add-member.ts index fa7cea0..554ffc7 100644 --- a/packages/commands/src/commands/token-plan/add-member.ts +++ b/packages/commands/src/commands/token-plan/add-member.ts @@ -23,26 +23,40 @@ const ADD_MEMBER_FLAGS = { accountName: { type: "string", valueHint: "<name>", - description: "Member display name", + description: { "en-US": "Member display name", "zh-CN": "成员显示名称" }, + required: true, + }, + orgId: { + type: "string", + valueHint: "<id>", + description: { "en-US": "Organization ID", "zh-CN": "组织 ID" }, required: true, }, - orgId: { type: "string", valueHint: "<id>", description: "Organization ID", required: true }, orgRoleCode: { type: "string", valueHint: "<code>", - description: "Organization role: ORG_ADMIN or ORG_MEMBER (default: ORG_MEMBER)", + description: { + "en-US": "Organization role: ORG_ADMIN or ORG_MEMBER (default: ORG_MEMBER)", + "zh-CN": "组织角色:ORG_ADMIN 或 ORG_MEMBER(默认:ORG_MEMBER)", + }, }, specType: { type: "string", valueHint: "<type>", - description: "Seat tier to assign on creation: standard, pro, or max", + description: { + "en-US": "Seat tier to assign on creation: standard, pro, or max", + "zh-CN": "创建时分配的席位档位:standard、pro 或 max", + }, }, ...TOKEN_PLAN_COMMON_QUERY_FLAGS, } satisfies FlagsDef; type AddMemberFlags = ParsedFlags<typeof ADD_MEMBER_FLAGS>; export default defineCommand({ - description: "Add a member to a Token Plan organization", + description: { + "en-US": "Add a member to a Token Plan organization", + "zh-CN": "向 Token Plan 组织添加成员", + }, auth: "openapi", usageArgs: "--account-name <name> --org-id <id> [flags]", flags: ADD_MEMBER_FLAGS, diff --git a/packages/commands/src/commands/token-plan/assign-seats.ts b/packages/commands/src/commands/token-plan/assign-seats.ts index d5d275c..961d1f9 100644 --- a/packages/commands/src/commands/token-plan/assign-seats.ts +++ b/packages/commands/src/commands/token-plan/assign-seats.ts @@ -24,21 +24,34 @@ const ASSIGN_SEATS_FLAGS = { seatType: { type: "string", valueHint: "<type>", - description: "Seat tier: standard, pro, or max", + description: { + "en-US": "Seat tier: standard, pro, or max", + "zh-CN": "席位档位:standard、pro 或 max", + }, required: true, }, accountId: { type: "array", valueHint: "<id>", - description: "Target member account ID (repeatable)", + description: { + "en-US": "Target member account ID (repeatable)", + "zh-CN": "目标成员账号 ID(可重复)", + }, }, ...TOKEN_PLAN_COMMON_QUERY_FLAGS, - locale: { type: "string", valueHint: "<locale>", description: "Language: zh-CN or en-US" }, + locale: { + type: "string", + valueHint: "<locale>", + description: { "en-US": "Language: zh-CN or en-US", "zh-CN": "语言:zh-CN 或 en-US" }, + }, } satisfies FlagsDef; type AssignSeatsFlags = ParsedFlags<typeof ASSIGN_SEATS_FLAGS>; export default defineCommand({ - description: "Batch assign Token Plan seats to members", + description: { + "en-US": "Batch assign Token Plan seats to members", + "zh-CN": "批量向成员分配 Token Plan 席位", + }, auth: "openapi", usageArgs: "--workspace-id <id> --seat-type <type> --account-id <id> [flags]", flags: ASSIGN_SEATS_FLAGS, diff --git a/packages/commands/src/commands/token-plan/create-key.ts b/packages/commands/src/commands/token-plan/create-key.ts index 9df3b89..f6bb154 100644 --- a/packages/commands/src/commands/token-plan/create-key.ts +++ b/packages/commands/src/commands/token-plan/create-key.ts @@ -23,17 +23,24 @@ const CREATE_KEY_FLAGS = { accountId: { type: "string", valueHint: "<id>", - description: "Target member account ID", + description: { "en-US": "Target member account ID", "zh-CN": "目标成员账号 ID" }, required: true, }, ...TOKEN_PLAN_WORKSPACE_FLAG, - description: { type: "string", valueHint: "<text>", description: "API key description" }, + description: { + type: "string", + valueHint: "<text>", + description: { "en-US": "API key description", "zh-CN": "API Key 描述" }, + }, ...TOKEN_PLAN_COMMON_QUERY_FLAGS, } satisfies FlagsDef; type CreateKeyFlags = ParsedFlags<typeof CREATE_KEY_FLAGS>; export default defineCommand({ - description: "Create a Token Plan API key for a seat", + description: { + "en-US": "Create a Token Plan API key for a seat", + "zh-CN": "为席位创建 Token Plan API Key", + }, auth: "openapi", usageArgs: "--account-id <id> --workspace-id <id> [flags]", flags: CREATE_KEY_FLAGS, diff --git a/packages/commands/src/commands/token-plan/list-seats.ts b/packages/commands/src/commands/token-plan/list-seats.ts index a5fc532..be2a40f 100644 --- a/packages/commands/src/commands/token-plan/list-seats.ts +++ b/packages/commands/src/commands/token-plan/list-seats.ts @@ -20,36 +20,62 @@ const API_ACTION = "GetSubscriptionSeatDetails"; const API_PATH = "/tokenplan/subscription/seat-detail"; const LIST_SEATS_FLAGS = { - pageNo: { type: "number", valueHint: "<n>", description: "Page number (default: 1)" }, - pageSize: { type: "number", valueHint: "<n>", description: "Page size (default: 10)" }, + pageNo: { + type: "number", + valueHint: "<n>", + description: { "en-US": "Page number (default: 1)", "zh-CN": "页码(默认:1)" }, + }, + pageSize: { + type: "number", + valueHint: "<n>", + description: { "en-US": "Page size (default: 10)", "zh-CN": "每页数量(默认:10)" }, + }, ...TOKEN_PLAN_COMMON_QUERY_FLAGS, status: { type: "array", valueHint: "<status>", - description: - "Seat status filter (repeatable): CREATING, NORMAL, LIMIT, RELEASE, STOP, REFUNDED", + description: { + "en-US": "Seat status filter (repeatable): CREATING, NORMAL, LIMIT, RELEASE, STOP, REFUNDED", + "zh-CN": "席位状态筛选(可重复):CREATING、NORMAL、LIMIT、RELEASE、STOP、REFUNDED", + }, }, statusListStr: { type: "string", valueHint: "<json>", - description: "StatusList as JSON string, e.g. '[\"NORMAL\"]'", + description: { + "en-US": "StatusList as JSON string, e.g. '[\"NORMAL\"]'", + "zh-CN": "JSON 字符串格式的 StatusList,例如 '[\"NORMAL\"]'", + }, + }, + seatId: { + type: "string", + valueHint: "<id>", + description: { "en-US": "Filter by seat ID", "zh-CN": "按席位 ID 筛选" }, }, - seatId: { type: "string", valueHint: "<id>", description: "Filter by seat ID" }, seatType: { type: "string", valueHint: "<type>", - description: "Seat tier: standard, pro, or max", + description: { + "en-US": "Seat tier: standard, pro, or max", + "zh-CN": "席位档位:standard、pro 或 max", + }, }, queryAssigned: { type: "string", valueHint: "<bool>", - description: "Filter by assignment: true=assigned, false=unassigned", + description: { + "en-US": "Filter by assignment: true=assigned, false=unassigned", + "zh-CN": "按分配状态筛选:true=已分配,false=未分配", + }, }, } satisfies FlagsDef; type ListSeatsFlags = ParsedFlags<typeof LIST_SEATS_FLAGS>; export default defineCommand({ - description: "List Token Plan subscription seat details", + description: { + "en-US": "List Token Plan subscription seat details", + "zh-CN": "列出 Token Plan 订阅席位详情", + }, auth: "openapi", usageArgs: "[flags]", flags: LIST_SEATS_FLAGS, diff --git a/packages/commands/src/commands/token-plan/utils.ts b/packages/commands/src/commands/token-plan/utils.ts index 4f83a18..2ca1a25 100644 --- a/packages/commands/src/commands/token-plan/utils.ts +++ b/packages/commands/src/commands/token-plan/utils.ts @@ -17,12 +17,15 @@ export const TOKEN_PLAN_COMMON_QUERY_FLAGS = { callerUacAccountId: { type: "string", valueHint: "<id>", - description: "Caller UAC account ID", + description: { "en-US": "Caller UAC account ID", "zh-CN": "调用方 UAC 账号 ID" }, }, namespaceId: { type: "string", valueHint: "<id>", - description: "Product namespace ID (Token Plan default: namespace-1)", + description: { + "en-US": "Product namespace ID (Token Plan default: namespace-1)", + "zh-CN": "产品 Namespace ID(Token Plan 默认:namespace-1)", + }, }, } satisfies FlagsDef; @@ -30,7 +33,10 @@ export const TOKEN_PLAN_WORKSPACE_FLAG = { workspaceId: { type: "string", valueHint: "<id>", - description: "Workspace ID (env: BAILIAN_WORKSPACE_ID, config: workspace_id)", + description: { + "en-US": "Workspace ID (env: BAILIAN_WORKSPACE_ID, config: workspace_id)", + "zh-CN": "Workspace ID(环境变量:BAILIAN_WORKSPACE_ID,配置项:workspace_id)", + }, }, } satisfies FlagsDef; diff --git a/packages/commands/src/commands/update.ts b/packages/commands/src/commands/update.ts index cb67263..9d2d4d6 100644 --- a/packages/commands/src/commands/update.ts +++ b/packages/commands/src/commands/update.ts @@ -62,14 +62,20 @@ function binaryReinstallHint(): string { } export default defineCommand({ - description: "Update the CLI to the latest or a specified version", + description: { + "en-US": "Update the CLI to the latest or a specified version", + "zh-CN": "将 CLI 更新到最新版本或指定版本", + }, auth: "none", usageArgs: "[--to <version>]", flags: { to: { type: "string", valueHint: "<version>", - description: "Install this exact version instead of the latest", + description: { + "en-US": "Install this exact version instead of the latest", + "zh-CN": "安装指定版本,而不是最新版本", + }, }, }, exampleArgs: ["", "--to 0.1.14"], diff --git a/packages/commands/src/commands/usage/free.ts b/packages/commands/src/commands/usage/free.ts index 6748a88..c52db65 100644 --- a/packages/commands/src/commands/usage/free.ts +++ b/packages/commands/src/commands/usage/free.ts @@ -17,29 +17,44 @@ import { const TOP_N = 15; export default defineCommand({ - description: "Query free-tier quota for models (all models if --model is omitted)", + description: { + "en-US": "Query free-tier quota for models (all models if --model is omitted)", + "zh-CN": "查询模型免费额度(省略 --model 时查询全部模型)", + }, auth: "console", usageArgs: "[--model <model>[,model2,...]] [flags]", flags: { model: { type: "string", valueHint: "<model>", - description: "Model name(s) to query, comma-separated for multiple; omit for all models", + description: { + "en-US": "Model name(s) to query, comma-separated for multiple; omit for all models", + "zh-CN": "要查询的模型名称;多个名称以逗号分隔,省略时查询全部模型", + }, }, expiring: { type: "string", valueHint: "<days>", - description: "Only show quotas expiring within N days", + description: { + "en-US": "Only show quotas expiring within N days", + "zh-CN": "仅显示将在 N 天内到期的额度", + }, }, sort: { type: "string", valueHint: "<field>", - description: "Sort by: remaining (ascending), expires (ascending)", + description: { + "en-US": "Sort by: remaining (ascending), expires (ascending)", + "zh-CN": "排序方式:remaining(剩余额度升序)、expires(到期时间升序)", + }, choices: ["remaining", "expires"] as const, }, all: { type: "switch", - description: "Show all models instead of the top rows", + description: { + "en-US": "Show all models instead of the top rows", + "zh-CN": "显示全部模型,而不只显示前几行", + }, }, }, exampleArgs: [ diff --git a/packages/commands/src/commands/usage/freetier.ts b/packages/commands/src/commands/usage/freetier.ts index 0166fb8..868872b 100644 --- a/packages/commands/src/commands/usage/freetier.ts +++ b/packages/commands/src/commands/usage/freetier.ts @@ -91,27 +91,36 @@ async function fetchAllModelNames(client: Client): Promise<string[]> { } export default defineCommand({ - description: - "Enable or disable auto-stop for free-tier models. Enables by default; use --off to disable", + description: { + "en-US": + "Enable or disable auto-stop for free-tier models. Enables by default; use --off to disable", + "zh-CN": "启用或停用免费额度模型自动停止。默认启用,使用 --off 停用", + }, auth: "console", usageArgs: "<--model <model>[,model2,...] | --all> [--off] [flags]", flags: { model: { type: "string", valueHint: "<model>", - description: "Model name(s), comma-separated for multiple", + description: { + "en-US": "Model name(s), comma-separated for multiple", + "zh-CN": "模型名称,多个名称以逗号分隔", + }, }, all: { type: "switch", - description: "Apply to all free-tier models", + description: { "en-US": "Apply to all free-tier models", "zh-CN": "应用于全部免费额度模型" }, }, on: { type: "switch", - description: "Enable auto-stop (default behavior)", + description: { + "en-US": "Enable auto-stop (default behavior)", + "zh-CN": "启用自动停止(默认行为)", + }, }, off: { type: "switch", - description: "Disable auto-stop", + description: { "en-US": "Disable auto-stop", "zh-CN": "停用自动停止" }, }, }, exampleArgs: [ diff --git a/packages/commands/src/commands/usage/stats.ts b/packages/commands/src/commands/usage/stats.ts index 0d45ac1..4229370 100644 --- a/packages/commands/src/commands/usage/stats.ts +++ b/packages/commands/src/commands/usage/stats.ts @@ -274,24 +274,30 @@ function printModelTable( } export default defineCommand({ - description: "Query model usage statistics", + description: { "en-US": "Query model usage statistics", "zh-CN": "查询模型用量统计" }, auth: "console", usageArgs: "[--model <model>] [--days <days>] [flags]", flags: { model: { type: "string", valueHint: "<model>", - description: "Model name(s), comma-separated; omit for overview", + description: { + "en-US": "Model name(s), comma-separated; omit for overview", + "zh-CN": "模型名称,多个名称以逗号分隔;省略时查看概览", + }, }, days: { type: "string", valueHint: "<days>", - description: "Number of days (default: 7)", + description: { "en-US": "Number of days (default: 7)", "zh-CN": "天数(默认:7)" }, }, type: { type: "string", valueHint: "<type>", - description: "Model type: Text, Vision, Multimodal, Audio, Embedding", + description: { + "en-US": "Model type: Text, Vision, Multimodal, Audio, Embedding", + "zh-CN": "模型类型:Text、Vision、Multimodal、Audio、Embedding", + }, }, }, exampleArgs: [ diff --git a/packages/commands/src/commands/usage/summary.ts b/packages/commands/src/commands/usage/summary.ts index c93d193..55d4985 100644 --- a/packages/commands/src/commands/usage/summary.ts +++ b/packages/commands/src/commands/usage/summary.ts @@ -22,14 +22,20 @@ import { const TOP_N = 10; export default defineCommand({ - description: "Show a unified usage summary: free-tier quota and recent usage overview", + description: { + "en-US": "Show a unified usage summary: free-tier quota and recent usage overview", + "zh-CN": "显示统一用量摘要:免费额度和近期用量概览", + }, auth: "console", usageArgs: "[--days <days>] [flags]", flags: { days: { type: "string", valueHint: "<days>", - description: "Number of days for the usage overview (default: 7)", + description: { + "en-US": "Number of days for the usage overview (default: 7)", + "zh-CN": "用量概览的天数(默认:7)", + }, }, }, exampleArgs: ["", "--days 30", "--output json"], diff --git a/packages/commands/src/commands/workspace/init.ts b/packages/commands/src/commands/workspace/init.ts index 3820713..f773378 100644 --- a/packages/commands/src/commands/workspace/init.ts +++ b/packages/commands/src/commands/workspace/init.ts @@ -26,17 +26,23 @@ const FLAGS = { accessKeyId: { type: "string", valueHint: "<id>", - description: "Alibaba Cloud Access Key ID", + description: { "en-US": "Alibaba Cloud Access Key ID", "zh-CN": "阿里云 Access Key ID" }, }, accessKeySecret: { type: "string", valueHint: "<secret>", - description: "Alibaba Cloud Access Key Secret", + description: { + "en-US": "Alibaba Cloud Access Key Secret", + "zh-CN": "阿里云 Access Key Secret", + }, }, securityToken: { type: "string", valueHint: "<token>", - description: "Alibaba Cloud STS Security Token (optional)", + description: { + "en-US": "Alibaba Cloud STS Security Token (optional)", + "zh-CN": "阿里云 STS Security Token(可选)", + }, }, } satisfies FlagsDef; @@ -71,7 +77,10 @@ interface CommodityItem { } export default defineCommand({ - description: "Initialize Bailian workspace and activate postpaid services", + description: { + "en-US": "Initialize Bailian workspace and activate postpaid services", + "zh-CN": "初始化百炼 Workspace 并开通后付费服务", + }, auth: "none", usageArgs: "--access-key-id <id> --access-key-secret <secret> [--security-token <token>]", flags: FLAGS, diff --git a/packages/commands/src/commands/workspace/list.ts b/packages/commands/src/commands/workspace/list.ts index c4fd1d7..9d7a00e 100644 --- a/packages/commands/src/commands/workspace/list.ts +++ b/packages/commands/src/commands/workspace/list.ts @@ -67,14 +67,14 @@ function printTable(workspaces: WorkspaceInfo[]): void { } export default defineCommand({ - description: "List all workspaces", + description: { "en-US": "List all workspaces", "zh-CN": "列出全部 Workspace" }, auth: "console", usageArgs: "[flags]", flags: { list: { type: "string", valueHint: "<n>", - description: "Limit number of results", + description: { "en-US": "Limit number of results", "zh-CN": "限制结果数量" }, }, }, exampleArgs: ["", "--list 5", "--output json"], diff --git a/packages/core/src/types/command.ts b/packages/core/src/types/command.ts index b54db8f..727259e 100644 --- a/packages/core/src/types/command.ts +++ b/packages/core/src/types/command.ts @@ -266,7 +266,8 @@ export interface Command<F extends FlagsDef = FlagsDef> { usageArgs?: string; /** Example arg strings (without the `<bin> <path>` prefix). */ exampleArgs?: string[]; - notes?: string[]; + /** Additional help paragraphs rendered below flags. */ + notes?: LocalizedText[]; flags?: F; /** * Cross-flag validation, after parsing and before run. Return an error message diff --git a/packages/runtime/src/registry.ts b/packages/runtime/src/registry.ts index 3095878..99dbc19 100644 --- a/packages/runtime/src/registry.ts +++ b/packages/runtime/src/registry.ts @@ -413,7 +413,7 @@ ${authFlagSections ? `${authFlagSections}\n\n` : ""}${b(this.localize(HELP_TEXT. if (cmd.notes && cmd.notes.length > 0) { out.write(`\n${b(this.localize(HELP_TEXT.notes))}\n`); for (const note of cmd.notes) { - out.write(` ${note}\n`); + out.write(` ${this.localize(note)}\n`); } } if (cmd.exampleArgs && cmd.exampleArgs.length > 0) { diff --git a/packages/runtime/tests/i18n.test.ts b/packages/runtime/tests/i18n.test.ts index d49e83b..11fb434 100644 --- a/packages/runtime/tests/i18n.test.ts +++ b/packages/runtime/tests/i18n.test.ts @@ -38,6 +38,12 @@ test("registry renders runtime help copy with the selected language", async () = "en-US": "Test command", "zh-CN": "测试命令", }, + notes: [ + { + "en-US": "Test note", + "zh-CN": "测试说明", + }, + ], auth: "none", run: async () => {}, }); @@ -58,4 +64,8 @@ test("registry renders runtime help copy with the selected language", async () = expect(output).toContain("全局选项:"); expect(output).toContain("显示帮助信息"); expect(output).toContain("获取帮助:"); + + output = ""; + registry.printHelp(["test"], stream); + expect(output).toContain("测试说明"); }); diff --git a/skills/bailian-cli/reference/skill.md b/skills/bailian-cli/reference/skill.md index 8670967..6b3f8f4 100644 --- a/skills/bailian-cli/reference/skill.md +++ b/skills/bailian-cli/reference/skill.md @@ -56,8 +56,8 @@ _No command-specific flags._ #### Notes -- Fetches the registry index and installs every skill whose name starts with bailian- -- Equivalent to: bl skill add --all (filtered to bailian-\* skills) +- Fetches the registry index and installs every skill whose name starts with `bailian-`. +- Equivalent to: `bl skill add --all` (filtered to `bailian-*` skills). #### Examples diff --git a/skills/bailian-finetune/reference/dataset.md b/skills/bailian-finetune/reference/dataset.md index 523a421..0d5b808 100644 --- a/skills/bailian-finetune/reference/dataset.md +++ b/skills/bailian-finetune/reference/dataset.md @@ -127,16 +127,9 @@ bl dataset list --output json #### Notes -- Supports .jsonl (text) and .zip (audio/image archives with a data.jsonl -- manifest). Five record schemas are recognized: chatml = {messages:[...]} -- (SFT); dpo = {messages:[...], chosen, rejected}; cpt = {text:"..."} -- (continual pre-training, raw text); tts = {wav_fn:"train/xxx.wav", -- text:"..."} (audio fine-tuning); image = {img_path:"..."} (image -- generation). With no --schema, a record carrying wav_fn is validated as -- TTS, img_path as image, chosen/rejected as DPO, text (no messages) as CPT, -- otherwise ChatML. Upload cap: 300MB text, 1GB image. Upload uses the -- OpenAI-compatible /compatible-mode/v1/files endpoint so the purpose tag is -- persisted (the DashScope-native /api/v1/files drops it). +- Supports .jsonl (text) and .zip (audio/image archives with a data.jsonl manifest). Five record schemas are recognized: chatml = {messages:[...]} (SFT); dpo = {messages:[...], chosen, rejected}; cpt = {text:"..."} (continual pre-training, raw text); tts = {wav_fn:"train/xxx.wav", text:"..."} (audio fine-tuning); image = {img_path:"..."} (image generation). +- With no --schema, a record carrying wav_fn is validated as TTS, img_path as image, chosen/rejected as DPO, text (no messages) as CPT, otherwise ChatML. +- Upload cap: 300MB text, 1GB image. Upload uses the OpenAI-compatible /compatible-mode/v1/files endpoint so the purpose tag is persisted (the DashScope-native /api/v1/files drops it). #### Examples @@ -186,18 +179,10 @@ bl dataset upload --file train.jsonl --no-validate #### Notes -- Default scan: every line gets a structural check, then ~160 lines (front 50, -- evenly spaced 100, last 10) are JSON.parsed against the active schema. -- Schemas: chatml = {messages:[...]} (SFT); dpo = {messages:[...], chosen, -- rejected}; cpt = {text:"..."} (continual pre-training, raw text); -- tts = {wav_fn:"train/xxx.wav", text:"..."} (audio fine-tuning); -- image = {img_path:"..."} (image generation). With no --schema, a record -- carrying wav_fn is validated as TTS, img_path as image, chosen/rejected -- as DPO, text (no messages) as CPT, otherwise ChatML. Pass --schema to -- require a specific shape on every record. ZIP archives (.zip) are -- validated structurally (data.jsonl present, media references resolve) in -- addition to per-record content checks. Use --full-validate to JSON.parse -- every line. +- Default scan: every line gets a structural check, then ~160 lines (front 50, evenly spaced 100, last 10) are JSON.parsed against the active schema. +- Schemas: chatml = {messages:[...]} (SFT); dpo = {messages:[...], chosen, rejected}; cpt = {text:"..."} (continual pre-training, raw text); tts = {wav_fn:"train/xxx.wav", text:"..."} (audio fine-tuning); image = {img_path:"..."} (image generation). +- With no --schema, a record carrying wav_fn is validated as TTS, img_path as image, chosen/rejected as DPO, text (no messages) as CPT, otherwise ChatML. Pass --schema to require a specific shape on every record. +- ZIP archives (.zip) are validated structurally (data.jsonl present, media references resolve) in addition to per-record content checks. Use --full-validate to JSON.parse every line. #### Examples diff --git a/skills/bailian-finetune/reference/deploy.md b/skills/bailian-finetune/reference/deploy.md index a33d2c5..ae7653f 100644 --- a/skills/bailian-finetune/reference/deploy.md +++ b/skills/bailian-finetune/reference/deploy.md @@ -47,25 +47,14 @@ Index: [index.md](index.md) #### Notes -- Plan defaults to `lora` (Token-billed) for text/image and `mu` (model-unit- -- billed) for audio (CosyVoice TTS). Pass --plan to override. -- For plan=ptu (Token-billed, provisioned throughput), --input-tpm and -- --output-tpm are required (the platform rejects creation without an -- explicit ptu_capacity despite the doc listing defaults). +- Plan defaults to `lora` (Token-billed) for text/image and `mu` (model-unit-billed) for audio (CosyVoice TTS). Pass --plan to override. +- For plan=ptu (Token-billed, provisioned throughput), --input-tpm and --output-tpm are required (the platform rejects creation without an explicit ptu_capacity despite the doc listing defaults). - For plan=mu, `capacity`, `billing_method` and `deploy_spec` are required. -- billing_method defaults to POST_PAY (only supported value); deploy_spec -- and capacity are auto-picked from GET /deployments/models when omitted. +- billing_method defaults to POST_PAY (only supported value); deploy_spec and capacity are auto-picked from GET /deployments/models when omitted. - Use `bl deploy models --source base` to inspect available templates. - After creation, status starts at PENDING and transitions to RUNNING. -- Invoke the deployed model with: bl text chat --model <deployed_model> -- WARNING: --model is overloaded across commands and refers to DIFFERENT -- values. `bl deploy <modality> create --model` takes the exported model_name -- (e.g. `qwen3-8b-ft-...`), but the create response also returns a -- `deployed_model` field (the deployment instance id, e.g. -- `qwen3-8b-5ecb5f068d79`). The inference call `bl text chat --model` must use -- the `deployed_model` from the create response — NOT the `model_name` you -- passed to `deploy <modality> create`. Do not reuse the value across the two -- commands. +- Invoke the deployed model with: `bl text chat --model <deployed_model>`. +- WARNING: --model is overloaded across commands and refers to DIFFERENT values. `bl deploy <modality> create --model` takes the exported model_name (e.g. `qwen3-8b-ft-...`), but the create response also returns a `deployed_model` field (the deployment instance id, e.g. `qwen3-8b-5ecb5f068d79`). The inference call `bl text chat --model` must use the `deployed_model` from the create response — NOT the `model_name` you passed to `deploy <modality> create`. Do not reuse the value across the two commands. #### Examples @@ -160,25 +149,14 @@ bl deploy get --deployed-model qwen-plus-2025-12-01-b6d61c71 --output json #### Notes -- Plan defaults to `lora` (Token-billed) for text/image and `mu` (model-unit- -- billed) for audio (CosyVoice TTS). Pass --plan to override. -- For plan=ptu (Token-billed, provisioned throughput), --input-tpm and -- --output-tpm are required (the platform rejects creation without an -- explicit ptu_capacity despite the doc listing defaults). +- Plan defaults to `lora` (Token-billed) for text/image and `mu` (model-unit-billed) for audio (CosyVoice TTS). Pass --plan to override. +- For plan=ptu (Token-billed, provisioned throughput), --input-tpm and --output-tpm are required (the platform rejects creation without an explicit ptu_capacity despite the doc listing defaults). - For plan=mu, `capacity`, `billing_method` and `deploy_spec` are required. -- billing_method defaults to POST_PAY (only supported value); deploy_spec -- and capacity are auto-picked from GET /deployments/models when omitted. +- billing_method defaults to POST_PAY (only supported value); deploy_spec and capacity are auto-picked from GET /deployments/models when omitted. - Use `bl deploy models --source base` to inspect available templates. - After creation, status starts at PENDING and transitions to RUNNING. -- Invoke the deployed model with: bl text chat --model <deployed_model> -- WARNING: --model is overloaded across commands and refers to DIFFERENT -- values. `bl deploy <modality> create --model` takes the exported model_name -- (e.g. `qwen3-8b-ft-...`), but the create response also returns a -- `deployed_model` field (the deployment instance id, e.g. -- `qwen3-8b-5ecb5f068d79`). The inference call `bl text chat --model` must use -- the `deployed_model` from the create response — NOT the `model_name` you -- passed to `deploy <modality> create`. Do not reuse the value across the two -- commands. +- Invoke the deployed model with: `bl text chat --model <deployed_model>`. +- WARNING: --model is overloaded across commands and refers to DIFFERENT values. `bl deploy <modality> create --model` takes the exported model_name (e.g. `qwen3-8b-ft-...`), but the create response also returns a `deployed_model` field (the deployment instance id, e.g. `qwen3-8b-5ecb5f068d79`). The inference call `bl text chat --model` must use the `deployed_model` from the create response — NOT the `model_name` you passed to `deploy <modality> create`. Do not reuse the value across the two commands. #### Examples @@ -318,25 +296,14 @@ bl deploy scale --deployed-model dep-... --capacity 2 #### Notes -- Plan defaults to `lora` (Token-billed) for text/image and `mu` (model-unit- -- billed) for audio (CosyVoice TTS). Pass --plan to override. -- For plan=ptu (Token-billed, provisioned throughput), --input-tpm and -- --output-tpm are required (the platform rejects creation without an -- explicit ptu_capacity despite the doc listing defaults). +- Plan defaults to `lora` (Token-billed) for text/image and `mu` (model-unit-billed) for audio (CosyVoice TTS). Pass --plan to override. +- For plan=ptu (Token-billed, provisioned throughput), --input-tpm and --output-tpm are required (the platform rejects creation without an explicit ptu_capacity despite the doc listing defaults). - For plan=mu, `capacity`, `billing_method` and `deploy_spec` are required. -- billing_method defaults to POST_PAY (only supported value); deploy_spec -- and capacity are auto-picked from GET /deployments/models when omitted. +- billing_method defaults to POST_PAY (only supported value); deploy_spec and capacity are auto-picked from GET /deployments/models when omitted. - Use `bl deploy models --source base` to inspect available templates. - After creation, status starts at PENDING and transitions to RUNNING. -- Invoke the deployed model with: bl text chat --model <deployed_model> -- WARNING: --model is overloaded across commands and refers to DIFFERENT -- values. `bl deploy <modality> create --model` takes the exported model_name -- (e.g. `qwen3-8b-ft-...`), but the create response also returns a -- `deployed_model` field (the deployment instance id, e.g. -- `qwen3-8b-5ecb5f068d79`). The inference call `bl text chat --model` must use -- the `deployed_model` from the create response — NOT the `model_name` you -- passed to `deploy <modality> create`. Do not reuse the value across the two -- commands. +- Invoke the deployed model with: `bl text chat --model <deployed_model>`. +- WARNING: --model is overloaded across commands and refers to DIFFERENT values. `bl deploy <modality> create --model` takes the exported model_name (e.g. `qwen3-8b-ft-...`), but the create response also returns a `deployed_model` field (the deployment instance id, e.g. `qwen3-8b-5ecb5f068d79`). The inference call `bl text chat --model` must use the `deployed_model` from the create response — NOT the `model_name` you passed to `deploy <modality> create`. Do not reuse the value across the two commands. #### Examples diff --git a/skills/bailian-finetune/reference/finetune.md b/skills/bailian-finetune/reference/finetune.md index d269dfc..67c56e3 100644 --- a/skills/bailian-finetune/reference/finetune.md +++ b/skills/bailian-finetune/reference/finetune.md @@ -48,12 +48,8 @@ Index: [index.md](index.md) - Creating a job uploads any local datasets and consumes training quota. - Use --dry-run to preview the request body without submitting. -- --datasets / --validations accept either file-ids (from `dataset upload`) -- or local paths. Local paths are validated and uploaded first, then their -- file-ids are submitted — a one-step upload-and-train. -- Audio TTS training runs sft-lora (efficient_sft) with fixed CosyVoice -- hyper-parameter defaults; there are no training-type or hyper-parameter -- knobs to set. +- --datasets / --validations accept either file-ids (from `dataset upload`) or local paths. Local paths are validated and uploaded first, then their file-ids are submitted — a one-step upload-and-train. +- Audio TTS training runs sft-lora (efficient_sft) with fixed CosyVoice hyper-parameter defaults; there are no training-type or hyper-parameter knobs to set. #### Examples @@ -95,8 +91,7 @@ bl finetune audio create --model cosyvoice-v3-flash --datasets ./audio.zip --dry #### Notes -- Only PENDING / RUNNING jobs can be cancelled. Completed / failed / already- -- cancelled jobs return a server-side error (passed through verbatim). +- Only PENDING / RUNNING jobs can be cancelled. Completed / failed / already-cancelled jobs return a server-side error (passed through verbatim). #### Examples @@ -126,8 +121,7 @@ bl finetune cancel --job-id ft-xxx --dry-run #### Notes - Exactly one of --model / --training-type is required. -- Training-type values use the `<method>` / `<method>-lora` convention: -- sft | sft-lora | dpo | dpo-lora | cpt. (cpt has no -lora variant server-side.) +- Training-type values use the `<method>` / `<method>-lora` convention: sft | sft-lora | dpo | dpo-lora | cpt. (cpt has no -lora variant server-side.) - Queries listFoundationModels, a public API — no console login needed. #### Examples @@ -166,8 +160,7 @@ bl finetune capability --training-type sft --quiet #### Notes -- Use the returned `checkpoint` value with `finetune export` to publish -- a deployable model. +- Use the returned `checkpoint` value with `finetune export` to publish a deployable model. #### Examples @@ -197,8 +190,7 @@ bl finetune checkpoints --job-id ft-xxx --output json #### Notes -- Cancel a RUNNING job first via `finetune cancel` — the platform refuses -- to delete jobs that are still in flight. +- Cancel a RUNNING job first via `finetune cancel` — the platform refuses to delete jobs that are still in flight. #### Examples @@ -230,9 +222,7 @@ bl finetune delete --job-id ft-xxx --dry-run #### Notes -- Required before `deploy <modality> create` can target a checkpoint. The -- platform may auto-export the best checkpoint when a job reaches SUCCEEDED — -- explicit export is the canonical path for non-best checkpoints. +- Required before `deploy <modality> create` can target a checkpoint. The platform may auto-export the best checkpoint when a job reaches SUCCEEDED — explicit export is the canonical path for non-best checkpoints. #### Examples @@ -292,14 +282,8 @@ bl finetune get --job-id ft-xxx --output json - Creating a job uploads any local datasets and consumes training quota. - Use --dry-run to preview the request body without submitting. -- --datasets / --validations accept either file-ids (from `dataset upload`) -- or local paths. Local paths are validated and uploaded first, then their -- file-ids are submitted — a one-step upload-and-train. -- Image generation training runs sft-lora (efficient_sft) with fixed defaults; -- only --learning-rate is overridable. T2I vs I2I is declared with -- --generation-type (default t2i), which sets generation_type/max_pixels. For -- local data the type is auto-detected (records with input_img train I2I); -- pass --generation-type explicitly to train I2I from a file-id or in --dry-run. +- --datasets / --validations accept either file-ids (from `dataset upload`) or local paths. Local paths are validated and uploaded first, then their file-ids are submitted — a one-step upload-and-train. +- Image generation training runs sft-lora (efficient_sft) with fixed defaults; only --learning-rate is overridable. T2I vs I2I is declared with --generation-type (default t2i), which sets generation_type/max_pixels. For local data the type is auto-detected (records with input_img train I2I); pass --generation-type explicitly to train I2I from a file-id or in --dry-run. #### Examples @@ -434,21 +418,12 @@ bl finetune logs --job-id ft-xxx --search checkpoint --tail 5 - Creating a job uploads any local datasets and consumes training quota. - Use --dry-run to preview the request body without submitting. -- --datasets / --validations accept either file-ids (from `dataset upload`) -- or local paths. Local paths are validated and uploaded first, then their -- file-ids are submitted — a one-step upload-and-train. -- Training-type values use the `<method>` / `<method>-lora` convention: -- sft (full) | sft-lora (LoRA) | dpo (full) | dpo-lora (LoRA) | cpt. These map -- to the server's training_type at the interface boundary, so the rest of the -- CLI never sees the raw server strings. -- Before submitting (non dry-run) the job, the model's training capability is -- checked via listFoundationModels (no console login required); an unsupported -- training type fails fast with the list the model actually supports. +- --datasets / --validations accept either file-ids (from `dataset upload`) or local paths. Local paths are validated and uploaded first, then their file-ids are submitted — a one-step upload-and-train. +- Training-type values use the `<method>` / `<method>-lora` convention: sft (full) | sft-lora (LoRA) | dpo (full) | dpo-lora (LoRA) | cpt. These map to the server's training_type at the interface boundary, so the rest of the CLI never sees the raw server strings. +- Before submitting (non dry-run) the job, the model's training capability is checked via listFoundationModels (no console login required); an unsupported training type fails fast with the list the model actually supports. - n_epochs defaults to 3. Other hyper-parameters are platform defaults unless set. - Learning rate is forwarded as a string to avoid JSON-number precision loss. -- Pre-submit gate: if the training dataset's sample count is not greater -- than batch_size, the job is rejected before upload or quota consumption -- (the platform would otherwise fail ~10 min in, after data processing). +- Pre-submit gate: if the training dataset's sample count is not greater than batch_size, the job is rejected before upload or quota consumption (the platform would otherwise fail ~10 min in, after data processing). #### Examples @@ -505,14 +480,9 @@ bl finetune text create --model qwen3-8b --datasets file-xxx --dry-run #### Notes -- Default (no --follow) is a NON-BLOCKING single status probe: one fetch, then -- return immediately. This is the mode meant for agents / scripts — the caller -- owns the polling cadence, so the CLI never holds the terminal. -- A terminal FAILED/CANCELED status raises a normal CLI error (non-zero exit); -- a SUCCEEDED or still-running status returns 0. With --follow, exceeding -- --poll-timeout raises a timeout error. -- Use --follow for the blocking, human-terminal-follow experience; use the -- default mode when driving the loop yourself (e.g. from an agent). +- Default (no --follow) is a NON-BLOCKING single status probe: one fetch, then return immediately. This is the mode meant for agents / scripts — the caller owns the polling cadence, so the CLI never holds the terminal. +- A terminal FAILED/CANCELED status raises a normal CLI error (non-zero exit); a SUCCEEDED or still-running status returns 0. With --follow, exceeding --poll-timeout raises a timeout error. +- Use --follow for the blocking, human-terminal-follow experience; use the default mode when driving the loop yourself (e.g. from an agent). - For per-step training output (not status), use `finetune logs`. #### Examples diff --git a/tools/generate-reference.ts b/tools/generate-reference.ts index a9f4b46..d4319a8 100644 --- a/tools/generate-reference.ts +++ b/tools/generate-reference.ts @@ -114,9 +114,9 @@ function formatExamples(path: string, exampleArgs: string[] | undefined): string ); } -function formatNotes(notes: string[] | undefined): string { +function formatNotes(notes: LocalizedText[] | undefined): string { if (!notes?.length) return ""; - return notes.map((n) => `- ${n}`).join("\n") + "\n"; + return notes.map((note) => `- ${referenceText(note)}`).join("\n") + "\n"; } function commandSection(path: string, cmd: AnyCommand): string {