@optima-chat/gen-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backends/bfl.d.ts +18 -0
- package/dist/backends/bfl.d.ts.map +1 -0
- package/dist/backends/bfl.js +130 -0
- package/dist/backends/bfl.js.map +1 -0
- package/dist/backends/comfyui.d.ts +10 -0
- package/dist/backends/comfyui.d.ts.map +1 -0
- package/dist/backends/comfyui.js +121 -0
- package/dist/backends/comfyui.js.map +1 -0
- package/dist/backends/index.d.ts +24 -0
- package/dist/backends/index.d.ts.map +1 -0
- package/dist/backends/index.js +59 -0
- package/dist/backends/index.js.map +1 -0
- package/dist/backends/types.d.ts +99 -0
- package/dist/backends/types.d.ts.map +1 -0
- package/dist/backends/types.js +2 -0
- package/dist/backends/types.js.map +1 -0
- package/dist/backends/video-dashscope.d.ts +10 -0
- package/dist/backends/video-dashscope.d.ts.map +1 -0
- package/dist/backends/video-dashscope.js +108 -0
- package/dist/backends/video-dashscope.js.map +1 -0
- package/dist/backends/video-index.d.ts +23 -0
- package/dist/backends/video-index.d.ts.map +1 -0
- package/dist/backends/video-index.js +57 -0
- package/dist/backends/video-index.js.map +1 -0
- package/dist/commands/asr.d.ts +3 -0
- package/dist/commands/asr.d.ts.map +1 -0
- package/dist/commands/asr.js +133 -0
- package/dist/commands/asr.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +105 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/download.d.ts +3 -0
- package/dist/commands/download.d.ts.map +1 -0
- package/dist/commands/download.js +169 -0
- package/dist/commands/download.js.map +1 -0
- package/dist/commands/edit.d.ts +3 -0
- package/dist/commands/edit.d.ts.map +1 -0
- package/dist/commands/edit.js +155 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/generate.d.ts +3 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +135 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/image.d.ts +3 -0
- package/dist/commands/image.d.ts.map +1 -0
- package/dist/commands/image.js +139 -0
- package/dist/commands/image.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +144 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/interrupt.d.ts +3 -0
- package/dist/commands/interrupt.d.ts.map +1 -0
- package/dist/commands/interrupt.js +54 -0
- package/dist/commands/interrupt.js.map +1 -0
- package/dist/commands/model.d.ts +3 -0
- package/dist/commands/model.d.ts.map +1 -0
- package/dist/commands/model.js +82 -0
- package/dist/commands/model.js.map +1 -0
- package/dist/commands/node.d.ts +3 -0
- package/dist/commands/node.d.ts.map +1 -0
- package/dist/commands/node.js +148 -0
- package/dist/commands/node.js.map +1 -0
- package/dist/commands/queue.d.ts +3 -0
- package/dist/commands/queue.d.ts.map +1 -0
- package/dist/commands/queue.js +199 -0
- package/dist/commands/queue.js.map +1 -0
- package/dist/commands/system.d.ts +3 -0
- package/dist/commands/system.d.ts.map +1 -0
- package/dist/commands/system.js +85 -0
- package/dist/commands/system.js.map +1 -0
- package/dist/commands/task.d.ts +3 -0
- package/dist/commands/task.d.ts.map +1 -0
- package/dist/commands/task.js +176 -0
- package/dist/commands/task.js.map +1 -0
- package/dist/commands/tryon.d.ts +3 -0
- package/dist/commands/tryon.d.ts.map +1 -0
- package/dist/commands/tryon.js +178 -0
- package/dist/commands/tryon.js.map +1 -0
- package/dist/commands/tts.d.ts +3 -0
- package/dist/commands/tts.d.ts.map +1 -0
- package/dist/commands/tts.js +157 -0
- package/dist/commands/tts.js.map +1 -0
- package/dist/commands/video.d.ts +3 -0
- package/dist/commands/video.d.ts.map +1 -0
- package/dist/commands/video.js +137 -0
- package/dist/commands/video.js.map +1 -0
- package/dist/commands/workflow.d.ts +3 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +244 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/services/api.d.ts +23 -0
- package/dist/services/api.d.ts.map +1 -0
- package/dist/services/api.js +108 -0
- package/dist/services/api.js.map +1 -0
- package/dist/services/auth.d.ts +10 -0
- package/dist/services/auth.d.ts.map +1 -0
- package/dist/services/auth.js +34 -0
- package/dist/services/auth.js.map +1 -0
- package/dist/services/bfl-api.d.ts +67 -0
- package/dist/services/bfl-api.d.ts.map +1 -0
- package/dist/services/bfl-api.js +108 -0
- package/dist/services/bfl-api.js.map +1 -0
- package/dist/services/config.d.ts +12 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +30 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/dashscope-api.d.ts +69 -0
- package/dist/services/dashscope-api.d.ts.map +1 -0
- package/dist/services/dashscope-api.js +134 -0
- package/dist/services/dashscope-api.js.map +1 -0
- package/dist/services/dashscope-tts-api.d.ts +23 -0
- package/dist/services/dashscope-tts-api.d.ts.map +1 -0
- package/dist/services/dashscope-tts-api.js +56 -0
- package/dist/services/dashscope-tts-api.js.map +1 -0
- package/dist/services/fashn-api.d.ts +57 -0
- package/dist/services/fashn-api.d.ts.map +1 -0
- package/dist/services/fashn-api.js +84 -0
- package/dist/services/fashn-api.js.map +1 -0
- package/dist/services/generation-api.d.ts +139 -0
- package/dist/services/generation-api.d.ts.map +1 -0
- package/dist/services/generation-api.js +236 -0
- package/dist/services/generation-api.js.map +1 -0
- package/dist/services/groq-api.d.ts +18 -0
- package/dist/services/groq-api.d.ts.map +1 -0
- package/dist/services/groq-api.js +30 -0
- package/dist/services/groq-api.js.map +1 -0
- package/dist/services/websocket.d.ts +33 -0
- package/dist/services/websocket.d.ts.map +1 -0
- package/dist/services/websocket.js +217 -0
- package/dist/services/websocket.js.map +1 -0
- package/dist/utils/helpText.d.ts +15 -0
- package/dist/utils/helpText.d.ts.map +1 -0
- package/dist/utils/helpText.js +37 -0
- package/dist/utils/helpText.js.map +1 -0
- package/dist/utils/logger.d.ts +5 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +14 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/output.d.ts +54 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +76 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/workflow.d.ts +17 -0
- package/dist/utils/workflow.d.ts.map +1 -0
- package/dist/utils/workflow.js +81 -0
- package/dist/utils/workflow.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { success, info } from '../utils/logger.js';
|
|
2
|
+
import { outputSuccess, outputError, isPrettyMode } from '../utils/output.js';
|
|
3
|
+
import { addEnhancedHelp } from '../utils/helpText.js';
|
|
4
|
+
import { GenerationApiClient, GenerationApiError, } from '../services/generation-api.js';
|
|
5
|
+
export function registerTaskCommand(program) {
|
|
6
|
+
const task = program
|
|
7
|
+
.command('task')
|
|
8
|
+
.description('任务管理 - 查看、取消、重试生成任务');
|
|
9
|
+
// gen task get <id>
|
|
10
|
+
const getCmd = task
|
|
11
|
+
.command('get')
|
|
12
|
+
.description('查看任务状态')
|
|
13
|
+
.argument('<task_id>', '任务 ID')
|
|
14
|
+
.action(async (taskId, options) => {
|
|
15
|
+
const pretty = isPrettyMode(options);
|
|
16
|
+
try {
|
|
17
|
+
const client = new GenerationApiClient();
|
|
18
|
+
const result = await client.getTask(taskId);
|
|
19
|
+
if (pretty) {
|
|
20
|
+
success(`任务 ${result.task_id}`);
|
|
21
|
+
info(`类型: ${result.type || '-'}`);
|
|
22
|
+
info(`状态: ${result.status}`);
|
|
23
|
+
if (result.result_url)
|
|
24
|
+
info(`结果: ${result.result_url}`);
|
|
25
|
+
if (result.error_message)
|
|
26
|
+
info(`错误: ${result.error_message}`);
|
|
27
|
+
if (result.created_at)
|
|
28
|
+
info(`创建: ${result.created_at}`);
|
|
29
|
+
if (result.completed_at)
|
|
30
|
+
info(`完成: ${result.completed_at}`);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
outputSuccess(result);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
handleError(err, 'TASK_GET_FAILED', options);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
// gen task list
|
|
41
|
+
const listCmd = task
|
|
42
|
+
.command('list')
|
|
43
|
+
.description('列出我的任务')
|
|
44
|
+
.option('--status <status>', '按状态筛选: pending | completed | failed | cancelled')
|
|
45
|
+
.option('--type <type>', '按类型筛选: image | video | tts | asr | tryon')
|
|
46
|
+
.option('--limit <n>', '返回数量', '20')
|
|
47
|
+
.action(async (options) => {
|
|
48
|
+
const pretty = isPrettyMode(options);
|
|
49
|
+
try {
|
|
50
|
+
const client = new GenerationApiClient();
|
|
51
|
+
const result = await client.listTasks({
|
|
52
|
+
status: options.status,
|
|
53
|
+
type: options.type,
|
|
54
|
+
limit: parseInt(options.limit),
|
|
55
|
+
});
|
|
56
|
+
if (pretty) {
|
|
57
|
+
success(`共 ${result.total} 个任务`);
|
|
58
|
+
for (const task of result.tasks) {
|
|
59
|
+
const statusIcon = task.status === 'completed' ? '✓' :
|
|
60
|
+
task.status === 'failed' ? '✗' :
|
|
61
|
+
task.status === 'pending' ? '○' :
|
|
62
|
+
task.status === 'processing' ? '◐' : '•';
|
|
63
|
+
info(` ${statusIcon} ${task.task_id} ${task.type || '-'} ${task.status} ${task.created_at || ''}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
outputSuccess(result);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
handleError(err, 'TASK_LIST_FAILED', options);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
// gen task cancel <id>
|
|
75
|
+
const cancelCmd = task
|
|
76
|
+
.command('cancel')
|
|
77
|
+
.description('取消任务')
|
|
78
|
+
.argument('<task_id>', '任务 ID')
|
|
79
|
+
.action(async (taskId, options) => {
|
|
80
|
+
const pretty = isPrettyMode(options);
|
|
81
|
+
try {
|
|
82
|
+
const client = new GenerationApiClient();
|
|
83
|
+
const result = await client.cancelTask(taskId);
|
|
84
|
+
if (pretty) {
|
|
85
|
+
if (result.status === 'cancelled') {
|
|
86
|
+
success(`任务 ${taskId} 已取消`);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
info(`取消结果: ${result.status}`);
|
|
90
|
+
if (result.error_message)
|
|
91
|
+
info(result.error_message);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
outputSuccess(result);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
handleError(err, 'TASK_CANCEL_FAILED', options);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
// gen task retry <id>
|
|
103
|
+
const retryCmd = task
|
|
104
|
+
.command('retry')
|
|
105
|
+
.description('重试失败的任务(用原始参数重新提交)')
|
|
106
|
+
.argument('<task_id>', '任务 ID')
|
|
107
|
+
.action(async (taskId, options) => {
|
|
108
|
+
const pretty = isPrettyMode(options);
|
|
109
|
+
try {
|
|
110
|
+
const client = new GenerationApiClient();
|
|
111
|
+
const result = await client.retryTask(taskId);
|
|
112
|
+
if (pretty) {
|
|
113
|
+
success(`已重新提交,新任务 ID: ${result.task_id}`);
|
|
114
|
+
info(`状态: ${result.status}`);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
outputSuccess(result);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
handleError(err, 'TASK_RETRY_FAILED', options);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
// Enhanced help
|
|
125
|
+
addEnhancedHelp(task, {
|
|
126
|
+
examples: [
|
|
127
|
+
'# 查看任务状态',
|
|
128
|
+
'$ gen task get abc-123',
|
|
129
|
+
'',
|
|
130
|
+
'# 列出所有任务',
|
|
131
|
+
'$ gen task list',
|
|
132
|
+
'',
|
|
133
|
+
'# 列出失败的图片任务',
|
|
134
|
+
'$ gen task list --status failed --type image',
|
|
135
|
+
'',
|
|
136
|
+
'# 取消正在进行的任务',
|
|
137
|
+
'$ gen task cancel abc-123',
|
|
138
|
+
'',
|
|
139
|
+
'# 重试失败的任务',
|
|
140
|
+
'$ gen task retry abc-123',
|
|
141
|
+
],
|
|
142
|
+
outputJson: `{
|
|
143
|
+
"success": true,
|
|
144
|
+
"data": {
|
|
145
|
+
"task_id": "abc-123",
|
|
146
|
+
"type": "image",
|
|
147
|
+
"status": "completed",
|
|
148
|
+
"result_url": "https://...",
|
|
149
|
+
"created_at": "2026-03-21T10:00:00Z",
|
|
150
|
+
"completed_at": "2026-03-21T10:00:15Z"
|
|
151
|
+
}
|
|
152
|
+
}`,
|
|
153
|
+
relatedCommands: [
|
|
154
|
+
{ command: 'image <prompt>', description: '生成图像' },
|
|
155
|
+
{ command: 'video <image>', description: '生成视频' },
|
|
156
|
+
{ command: 'tts <text>', description: '文本转语音' },
|
|
157
|
+
{ command: 'asr <file>', description: '语音识别' },
|
|
158
|
+
{ command: 'tryon <model> <garment>', description: '虚拟试穿' },
|
|
159
|
+
],
|
|
160
|
+
notes: [
|
|
161
|
+
'所有生成命令会自动轮询等待结果',
|
|
162
|
+
'如果轮询超时,可以用 gen task get <id> 手动查看',
|
|
163
|
+
'取消正在执行的任务时,如果官方 API 不支持取消,任务会继续执行,结果仍可查看',
|
|
164
|
+
],
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function handleError(err, code, options) {
|
|
168
|
+
if (err instanceof GenerationApiError) {
|
|
169
|
+
outputError(err.code, err.message, options);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
173
|
+
outputError(code, message, options);
|
|
174
|
+
}
|
|
175
|
+
}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ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAiLpD"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import ora from 'ora';
|
|
3
|
+
import { success, info } from '../utils/logger.js';
|
|
4
|
+
import { outputSuccess, outputError, isPrettyMode } from '../utils/output.js';
|
|
5
|
+
import { addEnhancedHelp } from '../utils/helpText.js';
|
|
6
|
+
import { getConfigValue } from '../services/config.js';
|
|
7
|
+
import { GenerationApiClient, GenerationApiError, imageToBase64DataUrl, downloadResult, } from '../services/generation-api.js';
|
|
8
|
+
export function registerTryonCommand(program) {
|
|
9
|
+
const cmd = program
|
|
10
|
+
.command('tryon')
|
|
11
|
+
.description('虚拟试穿 (Virtual Try-On) - 使用 FASHN AI tryon-v1.6')
|
|
12
|
+
.argument('<model_image>', '人物照片路径或 URL')
|
|
13
|
+
.argument('<garment_image>', '服装照片路径或 URL')
|
|
14
|
+
.option('-o, --output <path>', '输出文件路径', '')
|
|
15
|
+
.option('-c, --category <type>', '服装类别: auto, tops, bottoms, one-pieces', 'auto')
|
|
16
|
+
.option('-m, --mode <mode>', '生成模式: performance (~7s), balanced (~9s), quality (~13s)', 'quality')
|
|
17
|
+
.option('--garment-type <type>', '服装照片类型: auto, flat-lay, model', 'auto')
|
|
18
|
+
.option('-n, --num-samples <n>', '生成数量 (1-4)', '1')
|
|
19
|
+
.option('--format <fmt>', '输出格式: png, jpeg', 'png')
|
|
20
|
+
.option('--seed <n>', '随机种子(用于复现)')
|
|
21
|
+
.action(async (modelImage, garmentImage, options) => {
|
|
22
|
+
const pretty = isPrettyMode(options);
|
|
23
|
+
try {
|
|
24
|
+
// 处理图像输入:本地文件转 base64,URL 直接使用
|
|
25
|
+
const resolveImage = async (input) => {
|
|
26
|
+
if (input.startsWith('http://') || input.startsWith('https://')) {
|
|
27
|
+
return input;
|
|
28
|
+
}
|
|
29
|
+
return imageToBase64DataUrl(input);
|
|
30
|
+
};
|
|
31
|
+
const [modelImg, garmentImg] = await Promise.all([
|
|
32
|
+
resolveImage(modelImage),
|
|
33
|
+
resolveImage(garmentImage),
|
|
34
|
+
]);
|
|
35
|
+
const numSamples = parseInt(options.numSamples, 10);
|
|
36
|
+
const outputDir = getConfigValue('outputDir') || './gen-output';
|
|
37
|
+
const params = {
|
|
38
|
+
model_image: modelImg,
|
|
39
|
+
garment_image: garmentImg,
|
|
40
|
+
category: options.category,
|
|
41
|
+
mode: options.mode,
|
|
42
|
+
garment_photo_type: options.garmentType,
|
|
43
|
+
num_samples: numSamples,
|
|
44
|
+
output_format: options.format,
|
|
45
|
+
seed: options.seed ? parseInt(options.seed, 10) : undefined,
|
|
46
|
+
};
|
|
47
|
+
const client = new GenerationApiClient();
|
|
48
|
+
const startTime = Date.now();
|
|
49
|
+
if (pretty) {
|
|
50
|
+
const spinner = ora(`正在提交虚拟试穿任务 (${options.mode} 模式)...`).start();
|
|
51
|
+
try {
|
|
52
|
+
const result = await client.submitAndPoll('tryon', params, {
|
|
53
|
+
onProgress: (status) => {
|
|
54
|
+
spinner.text = `虚拟试穿中 (${status})...`;
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
if (result.status === 'completed' && result.result_url) {
|
|
58
|
+
spinner.text = '正在下载结果图像...';
|
|
59
|
+
// result_url 可能是单个 URL 或 result_meta 里有多个
|
|
60
|
+
const outputs = [];
|
|
61
|
+
const urls = result.result_meta?.output_urls || [result.result_url];
|
|
62
|
+
const ts = Date.now();
|
|
63
|
+
for (let i = 0; i < urls.length; i++) {
|
|
64
|
+
const outputPath = options.output && urls.length === 1
|
|
65
|
+
? path.resolve(options.output)
|
|
66
|
+
: path.resolve(outputDir, `tryon_${ts}_${i}.${options.format}`);
|
|
67
|
+
const dir = path.dirname(outputPath);
|
|
68
|
+
const filename = path.basename(outputPath);
|
|
69
|
+
const saved = await downloadResult(urls[i], dir, filename);
|
|
70
|
+
outputs.push(saved);
|
|
71
|
+
}
|
|
72
|
+
const durationMs = Date.now() - startTime;
|
|
73
|
+
spinner.succeed('虚拟试穿完成!');
|
|
74
|
+
for (const out of outputs) {
|
|
75
|
+
success(`输出文件: ${out}`);
|
|
76
|
+
}
|
|
77
|
+
info(`模式: ${options.mode}, 类别: ${options.category}, 耗时: ${(durationMs / 1000).toFixed(1)}s`);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
spinner.info(`任务状态: ${result.status}`);
|
|
81
|
+
if (result.error_message)
|
|
82
|
+
info(`错误: ${result.error_message}`);
|
|
83
|
+
info(`使用 'gen task get ${result.task_id}' 查看最新状态`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
spinner.fail(`试穿失败: ${err?.message || err}`);
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const result = await client.submitAndPoll('tryon', params);
|
|
93
|
+
if (result.status === 'completed' && result.result_url) {
|
|
94
|
+
const outputs = [];
|
|
95
|
+
const urls = result.result_meta?.output_urls || [result.result_url];
|
|
96
|
+
const ts = Date.now();
|
|
97
|
+
for (let i = 0; i < urls.length; i++) {
|
|
98
|
+
const outputPath = options.output && urls.length === 1
|
|
99
|
+
? path.resolve(options.output)
|
|
100
|
+
: path.resolve(outputDir, `tryon_${ts}_${i}.${options.format}`);
|
|
101
|
+
const dir = path.dirname(outputPath);
|
|
102
|
+
const filename = path.basename(outputPath);
|
|
103
|
+
const saved = await downloadResult(urls[i], dir, filename);
|
|
104
|
+
outputs.push(saved);
|
|
105
|
+
}
|
|
106
|
+
const durationMs = Date.now() - startTime;
|
|
107
|
+
outputSuccess({
|
|
108
|
+
task_id: result.task_id,
|
|
109
|
+
outputs,
|
|
110
|
+
mode: options.mode,
|
|
111
|
+
category: options.category,
|
|
112
|
+
numSamples,
|
|
113
|
+
durationMs,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
outputSuccess({
|
|
118
|
+
task_id: result.task_id,
|
|
119
|
+
status: result.status,
|
|
120
|
+
error_message: result.error_message,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
if (err instanceof GenerationApiError) {
|
|
127
|
+
outputError(err.code, err.message, options);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
outputError('TRYON_FAILED', `虚拟试穿失败: ${err}`, options);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
addEnhancedHelp(cmd, {
|
|
135
|
+
examples: [
|
|
136
|
+
'# 基本用法 - 本地图片试穿',
|
|
137
|
+
'$ gen tryon person.jpg garment.jpg',
|
|
138
|
+
'',
|
|
139
|
+
'# 使用 URL 图片',
|
|
140
|
+
'$ gen tryon https://example.com/model.jpg https://example.com/dress.jpg',
|
|
141
|
+
'',
|
|
142
|
+
'# 指定服装类别和生成模式',
|
|
143
|
+
'$ gen tryon person.jpg top.jpg -c tops -m performance',
|
|
144
|
+
'',
|
|
145
|
+
'# 生成多张结果',
|
|
146
|
+
'$ gen tryon person.jpg dress.jpg -n 4 -c one-pieces',
|
|
147
|
+
'',
|
|
148
|
+
'# 指定输出路径',
|
|
149
|
+
'$ gen tryon person.jpg garment.jpg -o result.png',
|
|
150
|
+
'',
|
|
151
|
+
'# 使用种子复现结果',
|
|
152
|
+
'$ gen tryon person.jpg garment.jpg --seed 42',
|
|
153
|
+
],
|
|
154
|
+
outputJson: `{
|
|
155
|
+
"success": true,
|
|
156
|
+
"data": {
|
|
157
|
+
"task_id": "abc123",
|
|
158
|
+
"outputs": ["./gen-output/tryon_1234567890_0.png"],
|
|
159
|
+
"mode": "quality",
|
|
160
|
+
"category": "auto",
|
|
161
|
+
"numSamples": 1,
|
|
162
|
+
"durationMs": 13000
|
|
163
|
+
}
|
|
164
|
+
}`,
|
|
165
|
+
relatedCommands: [
|
|
166
|
+
{ command: 'image <prompt>', description: '文本生成图像' },
|
|
167
|
+
{ command: 'task get <id>', description: '查看任务状态' },
|
|
168
|
+
],
|
|
169
|
+
notes: [
|
|
170
|
+
'通过 optima-generation 调用 FASHN AI tryon-v1.6 模型',
|
|
171
|
+
'需要 Optima 账号(OPTIMA_TOKEN 或 ~/.optima/token.json)',
|
|
172
|
+
'支持本地图片路径和 URL',
|
|
173
|
+
'服装类别: auto (自动检测), tops (上装), bottoms (下装), one-pieces (连体)',
|
|
174
|
+
'生成模式: performance (~7s), balanced (~9s), quality (~13s)',
|
|
175
|
+
],
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=tryon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tryon.js","sourceRoot":"","sources":["../../src/commands/tryon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAElB,oBAAoB,EACpB,cAAc,GACf,MAAM,+BAA+B,CAAC;AAEvC,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,MAAM,GAAG,GAAG,OAAO;SAChB,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,gDAAgD,CAAC;SAC7D,QAAQ,CAAC,eAAe,EAAE,aAAa,CAAC;SACxC,QAAQ,CAAC,iBAAiB,EAAE,aAAa,CAAC;SAC1C,MAAM,CAAC,qBAAqB,EAAE,QAAQ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,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tts.d.ts","sourceRoot":"","sources":["../../src/commands/tts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,QAoJlD"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import ora from 'ora';
|
|
3
|
+
import { success, info } from '../utils/logger.js';
|
|
4
|
+
import { outputSuccess, outputError, isPrettyMode } from '../utils/output.js';
|
|
5
|
+
import { addEnhancedHelp } from '../utils/helpText.js';
|
|
6
|
+
import { getConfigValue } from '../services/config.js';
|
|
7
|
+
import { GenerationApiClient, GenerationApiError, validateTTSParams, downloadResult, } from '../services/generation-api.js';
|
|
8
|
+
const TTS_VOICES = [
|
|
9
|
+
'Cherry', 'Serena', 'Chelsie', 'Aria', 'Bella', 'Vivian', 'Jennifer', 'Katerina',
|
|
10
|
+
'Breeze', 'Maple', 'Sakura',
|
|
11
|
+
'Ethan', 'Aiden', 'Brandon', 'Ryan', 'Luke', 'Leo',
|
|
12
|
+
];
|
|
13
|
+
export function registerTtsCommand(program) {
|
|
14
|
+
const cmd = program
|
|
15
|
+
.command('tts')
|
|
16
|
+
.description('文本转语音 (Text-to-Speech) - 使用 DashScope qwen3-tts-flash')
|
|
17
|
+
.argument('<text>', '要转换的文本内容')
|
|
18
|
+
.option('-o, --output <path>', '输出文件路径', '')
|
|
19
|
+
.option('--voice <name>', '声音名称 (默认: Cherry)', 'Cherry')
|
|
20
|
+
.option('--voices', '列出可用声音')
|
|
21
|
+
.option('--play', '生成后自动播放音频')
|
|
22
|
+
.action(async (text, options) => {
|
|
23
|
+
const pretty = isPrettyMode(options);
|
|
24
|
+
// 列出可用声音
|
|
25
|
+
if (options.voices) {
|
|
26
|
+
if (pretty) {
|
|
27
|
+
info('可用声音列表 (qwen3-tts-flash):');
|
|
28
|
+
console.log(` 女声: Cherry, Serena, Chelsie, Aria, Bella, Vivian, Jennifer, Katerina, Breeze, Maple, Sakura`);
|
|
29
|
+
console.log(` 男声: Ethan, Aiden, Brandon, Ryan, Luke, Leo`);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
outputSuccess({ voices: TTS_VOICES });
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
// CLI 层快速校验
|
|
38
|
+
validateTTSParams({ text });
|
|
39
|
+
const outputDir = getConfigValue('outputDir') || './gen-output';
|
|
40
|
+
const outputPath = options.output
|
|
41
|
+
? path.resolve(options.output)
|
|
42
|
+
: path.resolve(outputDir, `tts_${Date.now()}.wav`);
|
|
43
|
+
const params = {
|
|
44
|
+
text,
|
|
45
|
+
voice: options.voice,
|
|
46
|
+
};
|
|
47
|
+
const client = new GenerationApiClient();
|
|
48
|
+
const startTime = Date.now();
|
|
49
|
+
if (pretty) {
|
|
50
|
+
const spinner = ora(`正在合成语音 (${options.voice})...`).start();
|
|
51
|
+
try {
|
|
52
|
+
const result = await client.submitAndPoll('tts', params, {
|
|
53
|
+
onProgress: (status) => {
|
|
54
|
+
spinner.text = `语音合成中 (${status})...`;
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
if (result.status === 'completed' && result.result_url) {
|
|
58
|
+
spinner.text = '正在下载音频...';
|
|
59
|
+
const filename = path.basename(outputPath);
|
|
60
|
+
const dir = path.dirname(outputPath);
|
|
61
|
+
await downloadResult(result.result_url, dir, filename);
|
|
62
|
+
const durationMs = Date.now() - startTime;
|
|
63
|
+
spinner.succeed('语音合成完成!');
|
|
64
|
+
success(`输出文件: ${outputPath}`);
|
|
65
|
+
info(`声音: ${options.voice}, 耗时: ${(durationMs / 1000).toFixed(1)}s`);
|
|
66
|
+
// 自动播放
|
|
67
|
+
if (options.play) {
|
|
68
|
+
const { execSync } = await import('child_process');
|
|
69
|
+
info('正在播放...');
|
|
70
|
+
execSync(`afplay "${outputPath}"`, { stdio: 'inherit' });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
spinner.info(`任务状态: ${result.status}`);
|
|
75
|
+
if (result.error_message)
|
|
76
|
+
info(`错误: ${result.error_message}`);
|
|
77
|
+
info(`使用 'gen task get ${result.task_id}' 查看最新状态`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
spinner.fail(`合成失败: ${err?.message || err}`);
|
|
82
|
+
throw err;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const result = await client.submitAndPoll('tts', params);
|
|
87
|
+
if (result.status === 'completed' && result.result_url) {
|
|
88
|
+
const filename = path.basename(outputPath);
|
|
89
|
+
const dir = path.dirname(outputPath);
|
|
90
|
+
await downloadResult(result.result_url, dir, filename);
|
|
91
|
+
const durationMs = Date.now() - startTime;
|
|
92
|
+
outputSuccess({
|
|
93
|
+
task_id: result.task_id,
|
|
94
|
+
output: outputPath,
|
|
95
|
+
voice: options.voice,
|
|
96
|
+
text,
|
|
97
|
+
durationMs,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
outputSuccess({
|
|
102
|
+
task_id: result.task_id,
|
|
103
|
+
status: result.status,
|
|
104
|
+
error_message: result.error_message,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
if (err instanceof GenerationApiError) {
|
|
111
|
+
outputError(err.code, err.message, options);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
outputError('TTS_FAILED', `语音合成失败: ${err}`, options);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
addEnhancedHelp(cmd, {
|
|
119
|
+
examples: [
|
|
120
|
+
'# 基本用法 - 中文语音合成',
|
|
121
|
+
'$ gen tts "你好,欢迎使用语音合成"',
|
|
122
|
+
'',
|
|
123
|
+
'# 指定输出文件和声音',
|
|
124
|
+
'$ gen tts "Hello world" -o hello.wav --voice Ethan',
|
|
125
|
+
'',
|
|
126
|
+
'# 使用男声',
|
|
127
|
+
'$ gen tts "今天天气真好" --voice Ryan',
|
|
128
|
+
'',
|
|
129
|
+
'# 生成后自动播放',
|
|
130
|
+
'$ gen tts "测试语音" --play',
|
|
131
|
+
'',
|
|
132
|
+
'# 列出可用声音',
|
|
133
|
+
'$ gen tts "" --voices',
|
|
134
|
+
],
|
|
135
|
+
outputJson: `{
|
|
136
|
+
"success": true,
|
|
137
|
+
"data": {
|
|
138
|
+
"task_id": "abc-123",
|
|
139
|
+
"output": "./gen-output/tts_1234567890.wav",
|
|
140
|
+
"voice": "Cherry",
|
|
141
|
+
"text": "你好",
|
|
142
|
+
"durationMs": 1200
|
|
143
|
+
}
|
|
144
|
+
}`,
|
|
145
|
+
relatedCommands: [
|
|
146
|
+
{ command: 'asr <file>', description: '语音识别(语音转文字)' },
|
|
147
|
+
{ command: 'task get <id>', description: '查看任务状态' },
|
|
148
|
+
],
|
|
149
|
+
notes: [
|
|
150
|
+
'通过 optima-generation 调用 DashScope qwen3-tts-flash 模型',
|
|
151
|
+
'需要 Optima 账号(OPTIMA_TOKEN 或 ~/.optima/token.json)',
|
|
152
|
+
'支持 50+ 种声音,支持中、英、日、韩等 10 种语言',
|
|
153
|
+
'输出格式为 WAV',
|
|
154
|
+
],
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=tts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tts.js","sourceRoot":"","sources":["../../src/commands/tts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO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