From f67ca55ec6aa0f889b45f0f05b9dec6a192a70e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=A5=E9=BA=92?= Date: Fri, 14 Aug 2026 11:42:16 +0800 Subject: [PATCH] feat(commands): localize multimodal command help --- packages/commands/src/commands/file/upload.ts | 15 ++- packages/commands/src/commands/image/edit.ts | 65 ++++++++--- .../commands/src/commands/image/generate.ts | 53 +++++++-- packages/commands/src/commands/omni/chat.ts | 75 ++++++++++--- .../commands/src/commands/speech/recognize.ts | 65 +++++++++-- .../src/commands/speech/synthesize.ts | 106 ++++++++++++++---- .../commands/src/commands/video/download.ts | 14 ++- packages/commands/src/commands/video/edit.ts | 67 ++++++++--- .../commands/src/commands/video/generate.ts | 54 +++++++-- packages/commands/src/commands/video/ref.ts | 71 +++++++++--- .../commands/src/commands/video/task-get.ts | 9 +- .../commands/src/commands/vision/describe.ts | 26 ++++- packages/core/src/types/command.ts | 10 +- .../runtime/src/utils/flag-descriptions.ts | 27 +++-- 14 files changed, 527 insertions(+), 130 deletions(-) diff --git a/packages/commands/src/commands/file/upload.ts b/packages/commands/src/commands/file/upload.ts index e655beb..5030810 100644 --- a/packages/commands/src/commands/file/upload.ts +++ b/packages/commands/src/commands/file/upload.ts @@ -2,20 +2,29 @@ import { defineCommand, detectOutputFormat } from "bailian-cli-core"; import { emitResult, emitBare } from "bailian-cli-runtime"; export default defineCommand({ - description: "Upload a local file to DashScope temporary storage (48h)", + description: { + "en-US": "Upload a local file to DashScope temporary storage (48h)", + "zh-CN": "将本地文件上传到 DashScope 临时存储(保留 48 小时)", + }, auth: "apiKey", usageArgs: "--file --model ", flags: { file: { type: "string", valueHint: "", - description: "Local file to upload (image, video, audio)", + description: { + "en-US": "Local file to upload (image, video, audio)", + "zh-CN": "要上传的本地文件(图片、视频或音频)", + }, required: true, }, model: { type: "string", valueHint: "", - description: "Target model name (file is bound to this model)", + description: { + "en-US": "Target model name (file is bound to this model)", + "zh-CN": "目标模型名称(文件将与该模型绑定)", + }, required: true, }, }, diff --git a/packages/commands/src/commands/image/edit.ts b/packages/commands/src/commands/image/edit.ts index e0bfcc2..7808db6 100644 --- a/packages/commands/src/commands/image/edit.ts +++ b/packages/commands/src/commands/image/edit.ts @@ -35,41 +35,67 @@ const EDIT_FLAGS = { image: { type: "array", valueHint: "", - description: "Source image URL or local file path (repeatable for multi-image merge)", + description: { + "en-US": "Source image URL or local file path (repeatable for multi-image merge)", + "zh-CN": "源图片 URL 或本地文件路径(多图融合时可重复)", + }, required: true, }, prompt: { type: "string", valueHint: "", - description: "Edit instruction text", + description: { "en-US": "Edit instruction text", "zh-CN": "编辑指令文本" }, required: true, }, model: { type: "string", valueHint: "", - description: "Model ID (default: qwen-image-3.0)", + description: { + "en-US": "Model ID (default: qwen-image-3.0)", + "zh-CN": "模型 ID(默认:qwen-image-3.0)", + }, }, size: { type: "string", valueHint: "", - description: "Output image size: ratio (3:4, 16:9) or pixels (2048*2048)", + description: { + "en-US": "Output image size: ratio (3:4, 16:9) or pixels (2048*2048)", + "zh-CN": "输出图片尺寸:比例(3:4、16:9)或像素(2048*2048)", + }, }, n: { type: "number", valueHint: "", - description: "Number of images (default: 1, max: 6)", + description: { + "en-US": "Number of images (default: 1, max: 6)", + "zh-CN": "图片数量(默认:1,最多:6)", + }, + }, + seed: { + type: "number", + valueHint: "", + description: { + "en-US": "Random seed for reproducible results", + "zh-CN": "用于复现结果的随机种子", + }, }, - seed: { type: "number", valueHint: "", description: "Random seed for reproducible results" }, negativePrompt: { type: "string", valueHint: "", - description: "Negative prompt to exclude unwanted content", + description: { + "en-US": "Negative prompt to exclude unwanted content", + "zh-CN": "负向提示词,用于排除不需要的内容", + }, }, function: { type: "string", valueHint: "", - description: - "wanx*-imageedit function (default: description_edit). Examples: stylization_all, description_edit", + description: { + "en-US": + "wanx*-imageedit function (default: description_edit). Examples: stylization_all, description_edit", + "zh-CN": + "wanx*-imageedit 功能(默认:description_edit)。例如:stylization_all、description_edit", + }, }, promptExtend: { type: "boolean", @@ -81,24 +107,37 @@ const EDIT_FLAGS = { valueHint: "", description: BOOL_FLAG_WATERMARK, }, - outDir: { type: "string", valueHint: "", description: "Download images to directory" }, + outDir: { + type: "string", + valueHint: "", + description: { "en-US": "Download images to directory", "zh-CN": "将图片下载到指定目录" }, + }, outPrefix: { type: "string", valueHint: "", - description: "Filename prefix (default: edited)", + description: { + "en-US": "Filename prefix (default: edited)", + "zh-CN": "文件名前缀(默认:edited)", + }, }, ...ASYNC_FLAG, ...CONCURRENT_FLAG, pollInterval: { type: "number", valueHint: "", - description: "Polling interval when waiting (default: 3)", + description: { + "en-US": "Polling interval when waiting (default: 3)", + "zh-CN": "等待任务时的轮询间隔(默认:3 秒)", + }, }, } satisfies FlagsDef; type EditFlags = ParsedFlags; export default defineCommand({ - description: "Edit an existing image with text instructions (Qwen-Image / Wan 2.7)", + description: { + "en-US": "Edit an existing image with text instructions (Qwen-Image / Wan 2.7)", + "zh-CN": "使用文本指令编辑现有图片(Qwen-Image / Wan 2.7)", + }, auth: "apiKey", usageArgs: "--image --prompt [flags]", flags: EDIT_FLAGS, diff --git a/packages/commands/src/commands/image/generate.ts b/packages/commands/src/commands/image/generate.ts index 0363928..b23d918 100644 --- a/packages/commands/src/commands/image/generate.ts +++ b/packages/commands/src/commands/image/generate.ts @@ -31,31 +31,51 @@ import { BOOL_FLAG_PROMPT_EXTEND_IMAGE_GENERATE, BOOL_FLAG_WATERMARK } from "bai import { join } from "path"; const GENERATE_FLAGS = { - prompt: { type: "string", valueHint: "", description: "Image description", required: true }, + prompt: { + type: "string", + valueHint: "", + description: { "en-US": "Image description", "zh-CN": "图片描述" }, + required: true, + }, model: { type: "string", valueHint: "", - description: "Model ID (default: qwen-image-3.0)", + description: { + "en-US": "Model ID (default: qwen-image-3.0)", + "zh-CN": "模型 ID(默认:qwen-image-3.0)", + }, }, size: { type: "string", valueHint: "", - description: "Image size: ratio (3:4, 16:9, 1:1) or pixels (2048*2048)", + description: { + "en-US": "Image size: ratio (3:4, 16:9, 1:1) or pixels (2048*2048)", + "zh-CN": "图片尺寸:比例(3:4、16:9、1:1)或像素(2048*2048)", + }, }, n: { type: "number", valueHint: "", - description: "Number of images per request (default: 1, max: 6)", + description: { + "en-US": "Number of images per request (default: 1, max: 6)", + "zh-CN": "每次请求生成的图片数量(默认:1,最多:6)", + }, }, seed: { type: "number", valueHint: "", - description: "Random seed for reproducible generation", + description: { + "en-US": "Random seed for reproducible generation", + "zh-CN": "用于复现生成结果的随机种子", + }, }, negativePrompt: { type: "string", valueHint: "", - description: "Negative prompt to exclude unwanted content", + description: { + "en-US": "Negative prompt to exclude unwanted content", + "zh-CN": "负向提示词,用于排除不需要的内容", + }, }, promptExtend: { type: "boolean", @@ -69,22 +89,35 @@ const GENERATE_FLAGS = { }, ...ASYNC_FLAG, ...CONCURRENT_FLAG, - outDir: { type: "string", valueHint: "", description: "Download images to directory" }, + outDir: { + type: "string", + valueHint: "", + description: { "en-US": "Download images to directory", "zh-CN": "将图片下载到指定目录" }, + }, outPrefix: { type: "string", valueHint: "", - description: "Filename prefix (default: image)", + description: { + "en-US": "Filename prefix (default: image)", + "zh-CN": "文件名前缀(默认:image)", + }, }, pollInterval: { type: "number", valueHint: "", - description: "Polling interval when waiting (default: 3)", + description: { + "en-US": "Polling interval when waiting (default: 3)", + "zh-CN": "等待任务时的轮询间隔(默认:3 秒)", + }, }, } satisfies FlagsDef; type GenerateFlags = ParsedFlags; export default defineCommand({ - description: "Generate images (Qwen-Image / wan2.x)", + description: { + "en-US": "Generate images (Qwen-Image / wan2.x)", + "zh-CN": "生成图片(Qwen-Image / wan2.x)", + }, auth: "apiKey", usageArgs: "--prompt [flags]", flags: GENERATE_FLAGS, diff --git a/packages/commands/src/commands/omni/chat.ts b/packages/commands/src/commands/omni/chat.ts index a819bbd..4bea7ec 100644 --- a/packages/commands/src/commands/omni/chat.ts +++ b/packages/commands/src/commands/omni/chat.ts @@ -114,61 +114,108 @@ function buildWavHeader(dataLength: number): Buffer { } export default defineCommand({ - description: "Multimodal chat with text + audio output (Qwen-Omni)", + description: { + "en-US": "Multimodal chat with text + audio output (Qwen-Omni)", + "zh-CN": "支持文本输入与音频输出的多模态对话(Qwen-Omni)", + }, auth: "apiKey", usageArgs: "--message [flags]", flags: { message: { type: "array", valueHint: "", - description: "Message text (repeatable, prefix role: to set role)", + description: { + "en-US": "Message text (repeatable, prefix role: to set role)", + "zh-CN": "消息文本(可重复;可使用 role: 前缀指定角色)", + }, }, model: { type: "string", valueHint: "", - description: "Model ID (default: qwen3.5-omni-plus)", + description: { + "en-US": "Model ID (default: qwen3.5-omni-plus)", + "zh-CN": "模型 ID(默认:qwen3.5-omni-plus)", + }, + }, + system: { + type: "string", + valueHint: "", + description: { "en-US": "System prompt", "zh-CN": "系统提示词" }, }, - system: { type: "string", valueHint: "", description: "System prompt" }, image: { type: "array", valueHint: "", - description: "Image URL or local file (repeatable)", + description: { + "en-US": "Image URL or local file (repeatable)", + "zh-CN": "图片 URL 或本地文件(可重复)", + }, }, audio: { type: "array", valueHint: "", - description: "Audio URL or local file (.wav/.mp3/.amr/.aac/.m4a/.ogg/.3gp/.3gpp)", + description: { + "en-US": "Audio URL or local file (.wav/.mp3/.amr/.aac/.m4a/.ogg/.3gp/.3gpp)", + "zh-CN": "音频 URL 或本地文件(.wav/.mp3/.amr/.aac/.m4a/.ogg/.3gp/.3gpp)", + }, }, video: { type: "array", valueHint: "", - description: "Video file URL / local path, or comma-separated frame URLs", + description: { + "en-US": "Video file URL / local path, or comma-separated frame URLs", + "zh-CN": "视频文件 URL / 本地路径,或以逗号分隔的帧 URL", + }, }, voice: { type: "string", valueHint: "", - description: "Output voice ID (default: Tina). Use --list-voices to see all options", + description: { + "en-US": "Output voice ID (default: Tina). Use --list-voices to see all options", + "zh-CN": "输出音色 ID(默认:Tina)。使用 --list-voices 查看所有选项", + }, }, listVoices: { type: "switch", - description: "List available output voices and exit", + description: { + "en-US": "List available output voices and exit", + "zh-CN": "列出可用的输出音色并退出", + }, }, audioFormat: { type: "string", valueHint: "", - description: "Audio output format (default: wav)", + description: { + "en-US": "Audio output format (default: wav)", + "zh-CN": "音频输出格式(默认:wav)", + }, }, audioOut: { type: "string", valueHint: "", - description: "Save audio to file (default: auto-generate)", + description: { + "en-US": "Save audio to file (default: auto-generate)", + "zh-CN": "将音频保存到文件(默认:自动生成路径)", + }, + }, + textOnly: { + type: "switch", + description: { + "en-US": "Output text only, no audio generation", + "zh-CN": "仅输出文本,不生成音频", + }, + }, + maxTokens: { + type: "number", + valueHint: "", + description: { "en-US": "Maximum tokens to generate", "zh-CN": "最大生成 Token 数" }, }, - textOnly: { type: "switch", description: "Output text only, no audio generation" }, - maxTokens: { type: "number", valueHint: "", description: "Maximum tokens to generate" }, temperature: { type: "number", valueHint: "", - description: "Sampling temperature (0.0, 2.0]", + description: { + "en-US": "Sampling temperature (0.0, 2.0]", + "zh-CN": "采样温度 (0.0, 2.0]", + }, }, }, exampleArgs: [ diff --git a/packages/commands/src/commands/speech/recognize.ts b/packages/commands/src/commands/speech/recognize.ts index 5af606b..f336e5c 100644 --- a/packages/commands/src/commands/speech/recognize.ts +++ b/packages/commands/src/commands/speech/recognize.ts @@ -24,39 +24,84 @@ const RECOGNIZE_FLAGS = { url: { type: "array", valueHint: "", - description: "Audio file URL or local file path (repeatable, max 100)", + description: { + "en-US": "Audio file URL or local file path (repeatable, max 100)", + "zh-CN": "音频文件 URL 或本地文件路径(可重复,最多 100 个)", + }, required: true, }, - model: { type: "string", valueHint: "", description: "Model ID (default: fun-asr)" }, - language: { type: "string", valueHint: "", description: "Language hint (e.g. zh, en, ja)" }, - diarization: { type: "switch", description: "Enable automatic speaker diarization" }, + model: { + type: "string", + valueHint: "", + description: { + "en-US": "Model ID (default: fun-asr)", + "zh-CN": "模型 ID(默认:fun-asr)", + }, + }, + language: { + type: "string", + valueHint: "", + description: { + "en-US": "Language hint (e.g. zh, en, ja)", + "zh-CN": "语言提示(例如 zh、en、ja)", + }, + }, + diarization: { + type: "switch", + description: { + "en-US": "Enable automatic speaker diarization", + "zh-CN": "启用自动说话人分离", + }, + }, speakerCount: { type: "number", valueHint: "", - description: "Expected number of speakers (requires --diarization)", + description: { + "en-US": "Expected number of speakers (requires --diarization)", + "zh-CN": "预期的说话人数量(需启用 --diarization)", + }, }, vocabularyId: { type: "string", valueHint: "", - description: "Hot-word vocabulary ID for improved accuracy", + description: { + "en-US": "Hot-word vocabulary ID for improved accuracy", + "zh-CN": "用于提升识别准确率的热词表 ID", + }, + }, + channelId: { + type: "number", + valueHint: "", + description: { + "en-US": "Audio channel ID (default: 0)", + "zh-CN": "音频声道 ID(默认:0)", + }, }, - channelId: { type: "number", valueHint: "", description: "Audio channel ID (default: 0)" }, out: { type: "string", valueHint: "", - description: "Save full transcription result to JSON file", + description: { + "en-US": "Save full transcription result to JSON file", + "zh-CN": "将完整转写结果保存到 JSON 文件", + }, }, ...ASYNC_FLAG, pollInterval: { type: "number", valueHint: "", - description: "Polling interval in seconds (default: 2)", + description: { + "en-US": "Polling interval in seconds (default: 2)", + "zh-CN": "轮询间隔,单位为秒(默认:2)", + }, }, } satisfies FlagsDef; type RecognizeFlags = ParsedFlags; export default defineCommand({ - description: "Recognize speech from audio files (FunAudio-ASR)", + description: { + "en-US": "Recognize speech from audio files (FunAudio-ASR)", + "zh-CN": "识别音频文件中的语音(FunAudio-ASR)", + }, auth: "apiKey", usageArgs: "--url [flags]", flags: RECOGNIZE_FLAGS, diff --git a/packages/commands/src/commands/speech/synthesize.ts b/packages/commands/src/commands/speech/synthesize.ts index 05a1538..6a0bed0 100644 --- a/packages/commands/src/commands/speech/synthesize.ts +++ b/packages/commands/src/commands/speech/synthesize.ts @@ -149,76 +149,142 @@ const SYNTHESIZE_FLAGS = { text: { type: "string", valueHint: "", - description: "Text to synthesize into speech (or use --text-file)", + description: { + "en-US": "Text to synthesize into speech (or use --text-file)", + "zh-CN": "要合成为语音的文本(也可使用 --text-file)", + }, }, textFile: { type: "string", valueHint: "", - description: "Read text from a file instead of --text", + description: { + "en-US": "Read text from a file instead of --text", + "zh-CN": "从文件读取文本,而非使用 --text", + }, }, model: { type: "string", valueHint: "", - description: - "Model ID (default: cosyvoice-v3-flash). System voices available for cosyvoice-v3-flash", + description: { + "en-US": + "Model ID (default: cosyvoice-v3-flash). System voices available for cosyvoice-v3-flash", + "zh-CN": "模型 ID(默认:cosyvoice-v3-flash)。cosyvoice-v3-flash 支持系统音色", + }, }, voice: { type: "string", valueHint: "", - description: - "Voice ID. Use --list-voices to see built-in voices for cosyvoice-v3-flash; for v3.5-flash provide a clone/design voice ID", + description: { + "en-US": + "Voice ID. Use --list-voices to see built-in voices for cosyvoice-v3-flash; for v3.5-flash provide a clone/design voice ID", + "zh-CN": + "音色 ID。使用 --list-voices 查看 cosyvoice-v3-flash 的内置音色;使用 v3.5-flash 时需提供复刻/设计音色 ID", + }, }, listVoices: { type: "switch", - description: - "List built-in system voices for the selected model and exit (console link shown in output)", + description: { + "en-US": + "List built-in system voices for the selected model and exit (console link shown in output)", + "zh-CN": "列出所选模型的内置系统音色并退出(输出中会显示控制台链接)", + }, }, format: { type: "string", valueHint: "", - description: "Audio format: mp3, pcm, wav, opus (default: mp3)", + description: { + "en-US": "Audio format: mp3, pcm, wav, opus (default: mp3)", + "zh-CN": "音频格式:mp3、pcm、wav、opus(默认:mp3)", + }, choices: ["mp3", "pcm", "wav", "opus"] as const, }, sampleRate: { type: "string", valueHint: "", - description: "Audio sample rate in Hz (e.g. 24000)", + description: { + "en-US": "Audio sample rate in Hz (e.g. 24000)", + "zh-CN": "音频采样率,单位为 Hz(例如 24000)", + }, + }, + volume: { + type: "string", + valueHint: "", + description: { + "en-US": "Volume 0-100 (default: 50)", + "zh-CN": "音量 0–100(默认:50)", + }, + }, + rate: { + type: "string", + valueHint: "", + description: { + "en-US": "Speech rate 0.5-2.0 (default: 1.0)", + "zh-CN": "语速 0.5–2.0(默认:1.0)", + }, }, - volume: { type: "string", valueHint: "", description: "Volume 0-100 (default: 50)" }, - rate: { type: "string", valueHint: "", description: "Speech rate 0.5-2.0 (default: 1.0)" }, pitch: { type: "string", valueHint: "", - description: "Pitch multiplier 0.5-2.0 (default: 1.0)", + description: { + "en-US": "Pitch multiplier 0.5-2.0 (default: 1.0)", + "zh-CN": "音高倍数 0.5–2.0(默认:1.0)", + }, }, seed: { type: "string", valueHint: "", - description: "Random seed 0-65535 for reproducible synthesis", + description: { + "en-US": "Random seed 0-65535 for reproducible synthesis", + "zh-CN": "用于复现合成结果的随机种子 0–65535", + }, }, language: { type: "string", valueHint: "", - description: "Language hint (e.g. zh, en, ja, ko, fr, de)", + description: { + "en-US": "Language hint (e.g. zh, en, ja, ko, fr, de)", + "zh-CN": "语言提示(例如 zh、en、ja、ko、fr、de)", + }, }, instruction: { type: "string", valueHint: "", - description: 'Natural language instruction to control speech style (e.g. "Use a gentle tone")', + description: { + "en-US": 'Natural language instruction to control speech style (e.g. "Use a gentle tone")', + "zh-CN": "用于控制语音风格的自然语言指令(例如“使用温柔的语气”)", + }, + }, + enableSsml: { + type: "switch", + description: { + "en-US": "Enable SSML markup parsing in input text", + "zh-CN": "解析输入文本中的 SSML 标记", + }, }, - enableSsml: { type: "switch", description: "Enable SSML markup parsing in input text" }, out: { type: "string", valueHint: "", - description: "Save audio to file (default: auto-generate in temp dir)", + description: { + "en-US": "Save audio to file (default: auto-generate in temp dir)", + "zh-CN": "将音频保存到文件(默认:在临时目录中自动生成路径)", + }, + }, + stream: { + type: "switch", + description: { + "en-US": "Stream raw PCM audio to stdout (pipe to player)", + "zh-CN": "将原始 PCM 音频流式输出到 stdout(可通过管道传给播放器)", + }, }, - stream: { type: "switch", description: "Stream raw PCM audio to stdout (pipe to player)" }, ...CONCURRENT_FLAG, } satisfies FlagsDef; type SynthesizeFlags = ParsedFlags; export default defineCommand({ - description: "Synthesize speech from text (CosyVoice TTS)", + description: { + "en-US": "Synthesize speech from text (CosyVoice TTS)", + "zh-CN": "将文本合成为语音(CosyVoice TTS)", + }, auth: "apiKey", usageArgs: "--text [flags]", flags: SYNTHESIZE_FLAGS, diff --git a/packages/commands/src/commands/video/download.ts b/packages/commands/src/commands/video/download.ts index c11c4eb..cbb6e92 100644 --- a/packages/commands/src/commands/video/download.ts +++ b/packages/commands/src/commands/video/download.ts @@ -10,17 +10,25 @@ import { downloadFile, formatBytes } from "bailian-cli-runtime"; import { emitResult, emitBare } from "bailian-cli-runtime"; export default defineCommand({ - description: "Download a completed video by task ID", + description: { + "en-US": "Download a completed video by task ID", + "zh-CN": "通过任务 ID 下载已完成的视频", + }, auth: "apiKey", usageArgs: "--task-id --out ", flags: { taskId: { type: "string", valueHint: "", - description: "Task ID to download from", + description: { "en-US": "Task ID to download from", "zh-CN": "要下载的任务 ID" }, + required: true, + }, + out: { + type: "string", + valueHint: "", + description: { "en-US": "Output file path", "zh-CN": "输出文件路径" }, required: true, }, - out: { type: "string", valueHint: "", description: "Output file path", required: true }, }, exampleArgs: [ "--task-id 3b256896-xxxx --out video.mp4", diff --git a/packages/commands/src/commands/video/edit.ts b/packages/commands/src/commands/video/edit.ts index 86467cf..8eb3c77 100644 --- a/packages/commands/src/commands/video/edit.ts +++ b/packages/commands/src/commands/video/edit.ts @@ -21,56 +21,86 @@ import { emitResult, emitBare } from "bailian-cli-runtime"; import { BOOL_FLAG_PROMPT_EXTEND_API_DEFAULT, BOOL_FLAG_WATERMARK } from "bailian-cli-runtime"; export default defineCommand({ - description: - "Edit a video with happyhorse-1.0-video-edit (style transfer, object replacement, etc.)", + description: { + "en-US": + "Edit a video with happyhorse-1.0-video-edit (style transfer, object replacement, etc.)", + "zh-CN": "使用 happyhorse-1.0-video-edit 编辑视频(风格转换、对象替换等)", + }, auth: "apiKey", usageArgs: "--video --prompt [flags]", flags: { model: { type: "string", valueHint: "", - description: "Model ID (default: happyhorse-1.0-video-edit)", + description: { + "en-US": "Model ID (default: happyhorse-1.0-video-edit)", + "zh-CN": "模型 ID(默认:happyhorse-1.0-video-edit)", + }, }, video: { type: "string", valueHint: "", - description: "Input video URL or local file (mp4/mov, 2-10s)", + description: { + "en-US": "Input video URL or local file (mp4/mov, 2-10s)", + "zh-CN": "输入视频 URL 或本地文件(mp4/mov,2–10 秒)", + }, required: true, }, prompt: { type: "string", valueHint: "", - description: 'Edit instruction (e.g. "Convert the scene to a claymation style")', + description: { + "en-US": 'Edit instruction (e.g. "Convert the scene to a claymation style")', + "zh-CN": "编辑指令(例如“将场景转换为黏土动画风格”)", + }, }, refImage: { type: "string", valueHint: "", - description: "Reference image URL (up to 4, comma-separated)", + description: { + "en-US": "Reference image URL (up to 4, comma-separated)", + "zh-CN": "参考图片 URL(最多 4 个,以逗号分隔)", + }, }, negativePrompt: { type: "string", valueHint: "", - description: "Negative prompt to exclude unwanted content", + description: { + "en-US": "Negative prompt to exclude unwanted content", + "zh-CN": "负向提示词,用于排除不需要的内容", + }, }, resolution: { type: "string", valueHint: "", - description: "Resolution: 720P or 1080P (default: 1080P)", + description: { + "en-US": "Resolution: 720P or 1080P (default: 1080P)", + "zh-CN": "分辨率:720P 或 1080P(默认:1080P)", + }, }, ratio: { type: "string", valueHint: "", - description: "Aspect ratio (16:9, 9:16, 1:1, 4:3, 3:4)", + description: { + "en-US": "Aspect ratio (16:9, 9:16, 1:1, 4:3, 3:4)", + "zh-CN": "宽高比(16:9、9:16、1:1、4:3、3:4)", + }, }, duration: { type: "number", valueHint: "", - description: "Output video duration in seconds (2-10)", + description: { + "en-US": "Output video duration in seconds (2-10)", + "zh-CN": "输出视频时长,单位为秒(2–10)", + }, }, audioSetting: { type: "string", valueHint: "", - description: "Audio: auto (default) or origin (keep original)", + description: { + "en-US": "Audio: auto (default) or origin (keep original)", + "zh-CN": "音频:auto(默认)或 origin(保留原音频)", + }, choices: ["auto", "origin"] as const, }, promptExtend: { @@ -86,19 +116,28 @@ export default defineCommand({ seed: { type: "number", valueHint: "", - description: "Random seed for reproducible generation", + description: { + "en-US": "Random seed for reproducible generation", + "zh-CN": "用于复现生成结果的随机种子", + }, }, download: { type: "string", valueHint: "", - description: "Save video to file on completion", + description: { + "en-US": "Save video to file on completion", + "zh-CN": "完成后将视频保存到文件", + }, }, ...ASYNC_FLAG, ...CONCURRENT_FLAG, pollInterval: { type: "number", valueHint: "", - description: "Polling interval when waiting (default: 15)", + description: { + "en-US": "Polling interval when waiting (default: 15)", + "zh-CN": "等待任务时的轮询间隔(默认:15 秒)", + }, }, }, exampleArgs: [ diff --git a/packages/commands/src/commands/video/generate.ts b/packages/commands/src/commands/video/generate.ts index be3f89a..0991860 100644 --- a/packages/commands/src/commands/video/generate.ts +++ b/packages/commands/src/commands/video/generate.ts @@ -22,46 +22,67 @@ import { emitResult, emitBare } from "bailian-cli-runtime"; import { BOOL_FLAG_PROMPT_EXTEND_API_DEFAULT, BOOL_FLAG_WATERMARK } from "bailian-cli-runtime"; export default defineCommand({ - description: - "Generate a video from text or image (happyhorse-1.1-t2v / happyhorse-1.1-i2v / wan2.6-t2v)", + description: { + "en-US": + "Generate a video from text or image (happyhorse-1.1-t2v / happyhorse-1.1-i2v / wan2.6-t2v)", + "zh-CN": "根据文本或图片生成视频(happyhorse-1.1-t2v / happyhorse-1.1-i2v / wan2.6-t2v)", + }, auth: "apiKey", usageArgs: "--prompt [--image ] [flags]", flags: { model: { type: "string", valueHint: "", - description: "Model ID (default: happyhorse-1.1-t2v, or happyhorse-1.1-i2v with --image)", + description: { + "en-US": "Model ID (default: happyhorse-1.1-t2v, or happyhorse-1.1-i2v with --image)", + "zh-CN": "模型 ID(默认:happyhorse-1.1-t2v;使用 --image 时为 happyhorse-1.1-i2v)", + }, }, prompt: { type: "string", valueHint: "", - description: "Video description", + description: { "en-US": "Video description", "zh-CN": "视频描述" }, required: true, }, image: { type: "string", valueHint: "", - description: "Input image URL for image-to-video generation", + description: { + "en-US": "Input image URL for image-to-video generation", + "zh-CN": "图生视频使用的输入图片 URL", + }, }, negativePrompt: { type: "string", valueHint: "", - description: "Negative prompt to exclude unwanted content", + description: { + "en-US": "Negative prompt to exclude unwanted content", + "zh-CN": "负向提示词,用于排除不需要的内容", + }, }, resolution: { type: "string", valueHint: "", - description: "Resolution: 720P or 1080P (default: 1080P)", + description: { + "en-US": "Resolution: 720P or 1080P (default: 1080P)", + "zh-CN": "分辨率:720P 或 1080P(默认:1080P)", + }, }, ratio: { type: "string", valueHint: "", - description: "Aspect ratio (e.g. 16:9, 9:16, 1:1)", + description: { + "en-US": "Aspect ratio (e.g. 16:9, 9:16, 1:1)", + "zh-CN": "宽高比(例如 16:9、9:16、1:1)", + }, }, duration: { type: "number", valueHint: "", - description: "Video duration in seconds (default: 5)", + description: { + "en-US": "Video duration in seconds (default: 5)", + "zh-CN": "视频时长,单位为秒(默认:5)", + }, }, promptExtend: { type: "boolean", @@ -76,19 +97,28 @@ export default defineCommand({ seed: { type: "number", valueHint: "", - description: "Random seed for reproducible generation", + description: { + "en-US": "Random seed for reproducible generation", + "zh-CN": "用于复现生成结果的随机种子", + }, }, download: { type: "string", valueHint: "", - description: "Save video to file on completion", + description: { + "en-US": "Save video to file on completion", + "zh-CN": "完成后将视频保存到文件", + }, }, ...ASYNC_FLAG, ...CONCURRENT_FLAG, pollInterval: { type: "number", valueHint: "", - description: "Polling interval when waiting (default: 5)", + description: { + "en-US": "Polling interval when waiting (default: 5)", + "zh-CN": "等待任务时的轮询间隔(默认:5 秒)", + }, }, }, exampleArgs: [ diff --git a/packages/commands/src/commands/video/ref.ts b/packages/commands/src/commands/video/ref.ts index 644d7ed..ab03d75 100644 --- a/packages/commands/src/commands/video/ref.ts +++ b/packages/commands/src/commands/video/ref.ts @@ -22,52 +22,86 @@ import { emitResult, emitBare } from "bailian-cli-runtime"; import { BOOL_FLAG_PROMPT_EXTEND_API_DEFAULT, BOOL_FLAG_WATERMARK } from "bailian-cli-runtime"; export default defineCommand({ - description: - "Reference-to-video generation (happyhorse-1.1-r2v / wan2.6-r2v): multi-subject, multi-shot with voice", + description: { + "en-US": + "Reference-to-video generation (happyhorse-1.1-r2v / wan2.6-r2v): multi-subject, multi-shot with voice", + "zh-CN": "参考生视频(happyhorse-1.1-r2v / wan2.6-r2v):支持多主体、多镜头和语音", + }, auth: "apiKey", usageArgs: "--prompt --image ... [--ref-video ...] [flags]", flags: { model: { type: "string", valueHint: "", - description: "Model ID (default: happyhorse-1.1-r2v)", + description: { + "en-US": "Model ID (default: happyhorse-1.1-r2v)", + "zh-CN": "模型 ID(默认:happyhorse-1.1-r2v)", + }, }, prompt: { type: "string", valueHint: "", - description: "Video description with reference markers (image1, video1, etc.)", + description: { + "en-US": "Video description with reference markers (image1, video1, etc.)", + "zh-CN": "包含引用标记的视频描述(image1、video1 等)", + }, required: true, }, image: { type: "array", valueHint: "", - description: "Reference image URL or local file (repeatable for multiple subjects)", + description: { + "en-US": "Reference image URL or local file (repeatable for multiple subjects)", + "zh-CN": "参考图片 URL 或本地文件(多个主体时可重复)", + }, }, refVideo: { type: "array", valueHint: "", - description: "Reference video URL or local file (repeatable)", + description: { + "en-US": "Reference video URL or local file (repeatable)", + "zh-CN": "参考视频 URL 或本地文件(可重复)", + }, }, imageVoice: { type: "array", valueHint: "", - description: "Voice URL for corresponding image (pairs by position)", + description: { + "en-US": "Voice URL for corresponding image (pairs by position)", + "zh-CN": "对应图片的语音 URL(按位置配对)", + }, }, videoVoice: { type: "array", valueHint: "", - description: "Voice URL for corresponding ref-video (pairs by position)", + description: { + "en-US": "Voice URL for corresponding ref-video (pairs by position)", + "zh-CN": "对应参考视频的语音 URL(按位置配对)", + }, }, resolution: { type: "string", valueHint: "", - description: "Resolution: 720P or 1080P (default: 1080P)", + description: { + "en-US": "Resolution: 720P or 1080P (default: 1080P)", + "zh-CN": "分辨率:720P 或 1080P(默认:1080P)", + }, + }, + ratio: { + type: "string", + valueHint: "", + description: { + "en-US": "Aspect ratio (16:9, 9:16, 1:1)", + "zh-CN": "宽高比(16:9、9:16、1:1)", + }, }, - ratio: { type: "string", valueHint: "", description: "Aspect ratio (16:9, 9:16, 1:1)" }, duration: { type: "number", valueHint: "", - description: "Video duration in seconds (default: 5)", + description: { + "en-US": "Video duration in seconds (default: 5)", + "zh-CN": "视频时长,单位为秒(默认:5)", + }, }, promptExtend: { type: "boolean", @@ -82,19 +116,28 @@ export default defineCommand({ seed: { type: "number", valueHint: "", - description: "Random seed for reproducible generation", + description: { + "en-US": "Random seed for reproducible generation", + "zh-CN": "用于复现生成结果的随机种子", + }, }, download: { type: "string", valueHint: "", - description: "Save video to file on completion", + description: { + "en-US": "Save video to file on completion", + "zh-CN": "完成后将视频保存到文件", + }, }, ...ASYNC_FLAG, ...CONCURRENT_FLAG, pollInterval: { type: "number", valueHint: "", - description: "Polling interval when waiting (default: 15)", + description: { + "en-US": "Polling interval when waiting (default: 15)", + "zh-CN": "等待任务时的轮询间隔(默认:15 秒)", + }, }, }, exampleArgs: [ diff --git a/packages/commands/src/commands/video/task-get.ts b/packages/commands/src/commands/video/task-get.ts index 667ae02..a622f71 100644 --- a/packages/commands/src/commands/video/task-get.ts +++ b/packages/commands/src/commands/video/task-get.ts @@ -7,11 +7,16 @@ import { import { emitResult, emitBare } from "bailian-cli-runtime"; export default defineCommand({ - description: "Query async task status", + description: { "en-US": "Query async task status", "zh-CN": "查询异步任务状态" }, auth: "apiKey", usageArgs: "--task-id ", flags: { - taskId: { type: "string", valueHint: "", description: "Async task ID", required: true }, + taskId: { + type: "string", + valueHint: "", + description: { "en-US": "Async task ID", "zh-CN": "异步任务 ID" }, + required: true, + }, }, exampleArgs: [ "--task-id 3b256896-3e70-xxxx-xxxx-xxxxxxxxxxxx", diff --git a/packages/commands/src/commands/vision/describe.ts b/packages/commands/src/commands/vision/describe.ts index 37dc7f7..6ef1e36 100644 --- a/packages/commands/src/commands/vision/describe.ts +++ b/packages/commands/src/commands/vision/describe.ts @@ -34,25 +34,41 @@ async function toImageUrl(image: string): Promise { } export default defineCommand({ - description: "Describe an image or video using Qwen-VL", + description: { + "en-US": "Describe an image or video using Qwen-VL", + "zh-CN": "使用 Qwen-VL 描述图片或视频", + }, auth: "apiKey", usageArgs: "--image [--video ] [--prompt ]", flags: { - image: { type: "string", valueHint: "", description: "Local image path or URL" }, + image: { + type: "string", + valueHint: "", + description: { "en-US": "Local image path or URL", "zh-CN": "本地图片路径或 URL" }, + }, video: { type: "array", valueHint: "", - description: "Video file URL or local path (mp4/mov/avi/mkv/webm)", + description: { + "en-US": "Video file URL or local path (mp4/mov/avi/mkv/webm)", + "zh-CN": "视频文件 URL 或本地路径(mp4/mov/avi/mkv/webm)", + }, }, prompt: { type: "string", valueHint: "", - description: "Question about the content (default: auto-detected)", + description: { + "en-US": "Question about the content (default: auto-detected)", + "zh-CN": "针对内容的问题(默认:自动识别)", + }, }, model: { type: "string", valueHint: "", - description: "Vision model (default: qwen3-vl-plus)", + description: { + "en-US": "Vision model (default: qwen3-vl-plus)", + "zh-CN": "视觉模型(默认:qwen3-vl-plus)", + }, }, }, exampleArgs: [ diff --git a/packages/core/src/types/command.ts b/packages/core/src/types/command.ts index fb31428..b54db8f 100644 --- a/packages/core/src/types/command.ts +++ b/packages/core/src/types/command.ts @@ -117,7 +117,10 @@ export const CONCURRENT_FLAG = { concurrent: { type: "number", valueHint: "", - description: "Run N parallel requests (default: 1)", + description: { + "en-US": "Run N parallel requests (default: 1)", + "zh-CN": "并行发送 N 个请求(默认:1)", + }, }, } satisfies FlagsDef; @@ -125,7 +128,10 @@ export const CONCURRENT_FLAG = { export const ASYNC_FLAG = { async: { type: "switch", - description: "Return async task id without waiting", + description: { + "en-US": "Return async task id without waiting", + "zh-CN": "直接返回异步任务 ID,不等待任务完成", + }, }, } satisfies FlagsDef; diff --git a/packages/runtime/src/utils/flag-descriptions.ts b/packages/runtime/src/utils/flag-descriptions.ts index 3bc8143..9faea8c 100644 --- a/packages/runtime/src/utils/flag-descriptions.ts +++ b/packages/runtime/src/utils/flag-descriptions.ts @@ -1,16 +1,27 @@ /** Shared --foo help text; keep wording consistent with actual CLI/request behavior. */ -export const BOOL_FLAG_WATERMARK = - "Enable watermark (true/false). Omit flag to use CLI default (true)."; +export const BOOL_FLAG_WATERMARK = { + "en-US": "Enable watermark (true/false). Omit flag to use CLI default (true).", + "zh-CN": "是否启用水印(true/false)。不传时使用 CLI 默认值 true。", +}; /** CLI sends prompt_extend=true when flag omitted (qwen-image edit, etc.). */ -export const BOOL_FLAG_PROMPT_EXTEND_CLI_TRUE = - "Enable prompt extend (true/false). Omit flag to use CLI default (true)."; +export const BOOL_FLAG_PROMPT_EXTEND_CLI_TRUE = { + "en-US": "Enable prompt extend (true/false). Omit flag to use CLI default (true).", + "zh-CN": "是否启用提示词扩展(true/false)。不传时使用 CLI 默认值 true。", +}; /** Sync qwen-image defaults on; async models omit the field unless flag is set. */ -export const BOOL_FLAG_PROMPT_EXTEND_IMAGE_GENERATE = - "Enable prompt extend (true/false). Omit flag: true for qwen-image sync; parameter omitted on async models (API default)."; +export const BOOL_FLAG_PROMPT_EXTEND_IMAGE_GENERATE = { + "en-US": + "Enable prompt extend (true/false). Omit flag: true for qwen-image sync; parameter omitted on async models (API default).", + "zh-CN": + "是否启用提示词扩展(true/false)。不传时:qwen-image 同步调用默认为 true;异步模型不传该参数(使用 API 默认值)。", +}; /** CLI omits prompt_extend in the request when flag is unset (video commands). */ -export const BOOL_FLAG_PROMPT_EXTEND_API_DEFAULT = - "Enable prompt extend (true/false). Omit flag to omit the parameter (DashScope default)."; +export const BOOL_FLAG_PROMPT_EXTEND_API_DEFAULT = { + "en-US": + "Enable prompt extend (true/false). Omit flag to omit the parameter (DashScope default).", + "zh-CN": "是否启用提示词扩展(true/false)。不传时省略该参数(使用 DashScope 默认值)。", +};