@lingjingai/lj-awb-cli 0.4.2 → 0.4.4
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/build/_shared.mjs +54 -5
- package/build/prod.mjs +12 -3
- package/package.json +1 -1
- package/packages/awb-cli/package.json +2 -2
- package/packages/awb-core/package.json +1 -1
- package/packages/awb-core/src/api.js +14 -0
- package/packages/awb-core/src/commands.js +52 -3
- package/packages/awb-core/src/common.js +8 -0
- package/packages/awb-core/src/output.js +92 -7
- package/packages/awb-core/src/services.js +934 -51
- package/packages/awb-core/src/standalone.js +31 -5
- package/skills/lj-awb/SKILL.md +4 -3
- package/skills/lj-awb/VERSION +1 -1
- package/skills/lj-awb/compat.json +3 -3
- package/skills/lj-awb/modules/asset.md +10 -1
- package/skills/lj-awb/modules/create.md +4 -2
- package/skills/lj-awb/modules/task.md +4 -1
- package/skills/lj-awb/modules/upload.md +1 -1
- package/skills/lj-awb/modules/video.md +7 -0
- package/skills/lj-awb/modules/workflows.md +3 -1
- package/skills/lj-awb/references/output-fields.md +5 -3
package/build/_shared.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawnSync } from 'node:child_process';
|
|
3
|
-
import { cpSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { cpSync, mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import os from 'node:os';
|
|
4
5
|
import path from 'node:path';
|
|
5
6
|
import { fileURLToPath } from 'node:url';
|
|
6
7
|
|
|
@@ -19,13 +20,16 @@ export function run(command, args, options = {}) {
|
|
|
19
20
|
process.stderr.write(`$ ${[command, ...args].join(' ')}\n`);
|
|
20
21
|
const result = spawnSync(command, args, {
|
|
21
22
|
cwd: options.cwd || repoRoot,
|
|
23
|
+
env: options.env ? { ...process.env, ...options.env } : process.env,
|
|
22
24
|
stdio: 'inherit',
|
|
23
25
|
});
|
|
24
26
|
if (result.error) {
|
|
27
|
+
options.beforeExit?.();
|
|
25
28
|
process.stderr.write(`${result.error.message}\n`);
|
|
26
29
|
process.exit(1);
|
|
27
30
|
}
|
|
28
31
|
if (result.status !== 0) {
|
|
32
|
+
options.beforeExit?.();
|
|
29
33
|
process.exit(result.status || 1);
|
|
30
34
|
}
|
|
31
35
|
}
|
|
@@ -33,11 +37,53 @@ export function run(command, args, options = {}) {
|
|
|
33
37
|
export function capture(command, args, options = {}) {
|
|
34
38
|
return spawnSync(command, args, {
|
|
35
39
|
cwd: options.cwd || repoRoot,
|
|
40
|
+
env: options.env ? { ...process.env, ...options.env } : process.env,
|
|
36
41
|
encoding: 'utf8',
|
|
37
42
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
38
43
|
});
|
|
39
44
|
}
|
|
40
45
|
|
|
46
|
+
export function createNpmPublishAuthConfig(registry) {
|
|
47
|
+
const tokenSource = ['NPM_PUBLISH_TOKEN', 'NPM_TOKEN', 'NODE_AUTH_TOKEN']
|
|
48
|
+
.find((name) => process.env[name]?.trim());
|
|
49
|
+
if (!tokenSource) {
|
|
50
|
+
return {
|
|
51
|
+
env: {},
|
|
52
|
+
cleanup() {},
|
|
53
|
+
tokenSource: null,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const token = process.env[tokenSource].trim();
|
|
58
|
+
const normalizedRegistry = registry.endsWith('/') ? registry : `${registry}/`;
|
|
59
|
+
const registryUrl = new URL(normalizedRegistry);
|
|
60
|
+
const registryPath = registryUrl.pathname.endsWith('/') ? registryUrl.pathname : `${registryUrl.pathname}/`;
|
|
61
|
+
const npmrcDir = mkdtempSync(path.join(os.tmpdir(), 'lj-awb-npm-'));
|
|
62
|
+
const npmrcPath = path.join(npmrcDir, '.npmrc');
|
|
63
|
+
writeFileSync(
|
|
64
|
+
npmrcPath,
|
|
65
|
+
[
|
|
66
|
+
`registry=${normalizedRegistry}`,
|
|
67
|
+
`//${registryUrl.host}${registryPath}:_authToken=${token}`,
|
|
68
|
+
'strict-ssl=false',
|
|
69
|
+
'always-auth=true',
|
|
70
|
+
'',
|
|
71
|
+
].join('\n'),
|
|
72
|
+
{ mode: 0o600 },
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
env: {
|
|
77
|
+
NPM_CONFIG_USERCONFIG: npmrcPath,
|
|
78
|
+
NPM_CONFIG_REGISTRY: normalizedRegistry,
|
|
79
|
+
},
|
|
80
|
+
cleanup() {
|
|
81
|
+
rmSync(npmrcDir, { recursive: true, force: true });
|
|
82
|
+
},
|
|
83
|
+
tokenSource,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
41
87
|
export function packageFilePaths(cwd = repoRoot) {
|
|
42
88
|
const result = capture('npm', ['pack', '--dry-run', '--json'], { cwd });
|
|
43
89
|
if (result.error) {
|
|
@@ -101,12 +147,13 @@ export function packTarball(stageDir) {
|
|
|
101
147
|
return path.join(stageDir, tarball);
|
|
102
148
|
}
|
|
103
149
|
|
|
104
|
-
export function ensureLoggedIn(registry) {
|
|
105
|
-
const result = capture('npm', ['whoami', `--registry=${registry}`]);
|
|
150
|
+
export function ensureLoggedIn(registry, options = {}) {
|
|
151
|
+
const result = capture('npm', ['whoami', `--registry=${registry}`], { env: options.env });
|
|
106
152
|
if (result.status === 0) {
|
|
107
153
|
process.stderr.write(`npm user: ${result.stdout.trim()}\n`);
|
|
108
154
|
return;
|
|
109
155
|
}
|
|
156
|
+
options.beforeExit?.();
|
|
110
157
|
process.stderr.write([
|
|
111
158
|
`npm is not logged in for ${registry}.`,
|
|
112
159
|
`Run: npm login --registry=${registry}`,
|
|
@@ -115,14 +162,16 @@ export function ensureLoggedIn(registry) {
|
|
|
115
162
|
process.exit(1);
|
|
116
163
|
}
|
|
117
164
|
|
|
118
|
-
export function ensureVersionNotPublished({ name, version, registry }) {
|
|
165
|
+
export function ensureVersionNotPublished({ name, version, registry }, options = {}) {
|
|
119
166
|
const spec = `${name}@${version}`;
|
|
120
|
-
const result = capture('npm', ['view', spec, 'version', `--registry=${registry}`]);
|
|
167
|
+
const result = capture('npm', ['view', spec, 'version', `--registry=${registry}`], { env: options.env });
|
|
121
168
|
if (result.status === 0) {
|
|
169
|
+
options.beforeExit?.();
|
|
122
170
|
process.stderr.write(`${spec} already exists on npm. Bump the version before publishing.\n`);
|
|
123
171
|
process.exit(1);
|
|
124
172
|
}
|
|
125
173
|
if (!/E404|404 Not Found|Not found/i.test(`${result.stderr}\n${result.stdout}`)) {
|
|
174
|
+
options.beforeExit?.();
|
|
126
175
|
process.stderr.write(`Could not verify whether ${spec} exists on npm.\n`);
|
|
127
176
|
process.stderr.write(result.stderr || result.stdout || '');
|
|
128
177
|
process.exit(1);
|
package/build/prod.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import {
|
|
5
|
+
createNpmPublishAuthConfig,
|
|
5
6
|
ensureLoggedIn,
|
|
6
7
|
ensureVersionNotPublished,
|
|
7
8
|
findArgValue,
|
|
@@ -33,14 +34,21 @@ function ensureProductionDefaultApiOrigin() {
|
|
|
33
34
|
ensureProductionDefaultApiOrigin();
|
|
34
35
|
|
|
35
36
|
process.stderr.write(`Preparing ${pkg.name}@${pkg.version} for npm ${dryRun ? 'dry-run' : 'publish'} with default API origin ${PROD_API_ORIGIN}.\n`);
|
|
37
|
+
const publishAuth = createNpmPublishAuthConfig(registry);
|
|
38
|
+
if (!dryRun && publishAuth.tokenSource) {
|
|
39
|
+
process.stderr.write(`Using npm publish token from ${publishAuth.tokenSource}; NPM_CONFIG_USERCONFIG points to an isolated temporary npmrc.\n`);
|
|
40
|
+
}
|
|
36
41
|
|
|
37
42
|
if (process.env.SKIP_CHECK !== '1') {
|
|
38
43
|
run('npm', ['run', 'check:local']);
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
ensureVersionNotPublished(
|
|
46
|
+
ensureVersionNotPublished(
|
|
47
|
+
{ name: pkg.name, version: pkg.version, registry },
|
|
48
|
+
{ env: publishAuth.env, beforeExit: publishAuth.cleanup },
|
|
49
|
+
);
|
|
42
50
|
if (!dryRun) {
|
|
43
|
-
ensureLoggedIn(registry);
|
|
51
|
+
ensureLoggedIn(registry, { env: publishAuth.env, beforeExit: publishAuth.cleanup });
|
|
44
52
|
}
|
|
45
53
|
|
|
46
54
|
run('npm', [
|
|
@@ -49,4 +57,5 @@ run('npm', [
|
|
|
49
57
|
'public',
|
|
50
58
|
`--registry=${registry}`,
|
|
51
59
|
...passthroughArgs,
|
|
52
|
-
]);
|
|
60
|
+
], { env: publishAuth.env, beforeExit: publishAuth.cleanup });
|
|
61
|
+
publishAuth.cleanup();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingjingai/awb-cli-bin",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Standalone CLI for Lingjing AWB",
|
|
5
5
|
"private": true,
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"README.md"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@lingjingai/awb-core": "0.4.
|
|
16
|
+
"@lingjingai/awb-core": "0.4.4"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -230,6 +230,20 @@ export async function createVideoSubtitleRemovalTask(payload = {}) {
|
|
|
230
230
|
return await apiFetch('/api/material/creation/videoSubtitleRemoval', { body: payload });
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
export async function fetchVideoSuperResolutionFee(payload = {}) {
|
|
234
|
+
return await apiFetch('/api/material/creation/videoUpResolutionCal', {
|
|
235
|
+
method: 'GET',
|
|
236
|
+
query: payload,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export async function createVideoSuperResolutionTask(payload = {}) {
|
|
241
|
+
return await apiFetch('/api/material/creation/videoUpResolution', {
|
|
242
|
+
method: 'POST',
|
|
243
|
+
query: payload,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
233
247
|
export async function fetchTaskFeed(payload = {}) {
|
|
234
248
|
return await apiFetch('/api/material/creation/task/feedPull', {
|
|
235
249
|
query: payload,
|
|
@@ -40,6 +40,9 @@ import {
|
|
|
40
40
|
subjectWait,
|
|
41
41
|
subtitleRemove,
|
|
42
42
|
subtitleStatus,
|
|
43
|
+
videoSuperResolution,
|
|
44
|
+
videoSuperResolutionFee,
|
|
45
|
+
videoSuperResolutionStatus,
|
|
43
46
|
taskList,
|
|
44
47
|
taskRecordPoll,
|
|
45
48
|
taskRecords,
|
|
@@ -695,6 +698,35 @@ export function registerAwbCommands(cli) {
|
|
|
695
698
|
func: async (_ctx, kwargs) => subtitleRemove(kwargs),
|
|
696
699
|
});
|
|
697
700
|
|
|
701
|
+
cli({
|
|
702
|
+
name: 'create video-super-resolution-fee',
|
|
703
|
+
description: commandHelp('计算视频超分预计积分;传入 objectName', {
|
|
704
|
+
examples: ['lj-awb create video-super-resolution-fee --object-name material/video-super/example.mp4 --project-group-no <no>'],
|
|
705
|
+
hint: 'objectName 通常是 material backendPath 或 COS 对象路径;正式超分前先看一次估价。',
|
|
706
|
+
}),
|
|
707
|
+
args: [
|
|
708
|
+
{ name: 'object-name', valueName: 'path', description: '视频对象路径;通常是 material backendPath 或 COS 对象路径' },
|
|
709
|
+
PROJECT_GROUP_ARG,
|
|
710
|
+
],
|
|
711
|
+
func: async (_ctx, kwargs) => videoSuperResolutionFee(kwargs),
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
cli({
|
|
715
|
+
name: 'create video-super-resolution',
|
|
716
|
+
description: commandHelp('基于 objectName 提交视频超分任务', {
|
|
717
|
+
examples: ['lj-awb create video-super-resolution --object-name material/video-super/example.mp4 --project-group-no <no> --dry-run'],
|
|
718
|
+
hint: '正式执行需要 --yes;会先按 objectName 读取视频信息,再选择 1080P / 2K 模型组。',
|
|
719
|
+
}),
|
|
720
|
+
args: [
|
|
721
|
+
{ name: 'object-name', valueName: 'path', description: '视频对象路径;通常是 material backendPath 或 COS 对象路径' },
|
|
722
|
+
PROJECT_GROUP_ARG,
|
|
723
|
+
TASK_RECORD_ARG,
|
|
724
|
+
DRY_RUN_ARG,
|
|
725
|
+
YES_ARG,
|
|
726
|
+
],
|
|
727
|
+
func: async (_ctx, kwargs) => videoSuperResolution(kwargs),
|
|
728
|
+
});
|
|
729
|
+
|
|
698
730
|
cli({
|
|
699
731
|
name: 'task video-subtitle-status',
|
|
700
732
|
description: commandHelp('查询 material 去字幕任务状态', {
|
|
@@ -707,13 +739,25 @@ export function registerAwbCommands(cli) {
|
|
|
707
739
|
func: async (_ctx, kwargs) => subtitleStatus(kwargs),
|
|
708
740
|
});
|
|
709
741
|
|
|
742
|
+
cli({
|
|
743
|
+
name: 'task video-super-resolution-status',
|
|
744
|
+
description: commandHelp('查询 material 视频超分任务状态', {
|
|
745
|
+
examples: ['lj-awb task video-super-resolution-status --task-id <superResolutionTaskId>'],
|
|
746
|
+
}),
|
|
747
|
+
args: [
|
|
748
|
+
{ name: 'task-id', valueName: 'id', description: 'material 视频超分任务 ID' },
|
|
749
|
+
PROJECT_GROUP_ARG,
|
|
750
|
+
],
|
|
751
|
+
func: async (_ctx, kwargs) => videoSuperResolutionStatus(kwargs),
|
|
752
|
+
});
|
|
753
|
+
|
|
710
754
|
cli({
|
|
711
755
|
name: 'task list',
|
|
712
756
|
description: commandHelp('查询项目组近期任务流', {
|
|
713
757
|
examples: ['lj-awb task list --task-type IMAGE_CREATE --project-group-no <no>'],
|
|
714
758
|
}),
|
|
715
759
|
args: [
|
|
716
|
-
{ name: 'task-type', valueName: 'type', description: 'IMAGE_CREATE / IMAGE_EDIT / VIDEO_GROUP' },
|
|
760
|
+
{ name: 'task-type', valueName: 'type', description: 'IMAGE_CREATE / IMAGE_EDIT / VIDEO_GROUP / VIDEO_SUPER_RESOLUTION / VIDEO_SUBTITLE_REMOVAL' },
|
|
717
761
|
PROJECT_GROUP_ARG,
|
|
718
762
|
{ name: 'page-size', valueName: 'n', description: '每页任务数' },
|
|
719
763
|
{ name: 'min-time', valueName: 'ms', description: '任务流 minTime,默认当前时间' },
|
|
@@ -729,7 +773,7 @@ export function registerAwbCommands(cli) {
|
|
|
729
773
|
}),
|
|
730
774
|
args: [
|
|
731
775
|
{ name: 'task-id', valueName: 'id', description: '任务 ID' },
|
|
732
|
-
{ name: 'task-type', valueName: 'type', description: 'IMAGE_CREATE / VIDEO_GROUP' },
|
|
776
|
+
{ name: 'task-type', valueName: 'type', description: 'IMAGE_CREATE / VIDEO_GROUP;material 扩展任务优先用 task video-subtitle-status / task video-super-resolution-status' },
|
|
733
777
|
PROJECT_GROUP_ARG,
|
|
734
778
|
...TASK_WAIT_ARGS,
|
|
735
779
|
],
|
|
@@ -846,7 +890,11 @@ export function registerAwbCommands(cli) {
|
|
|
846
890
|
cli({
|
|
847
891
|
name: 'create asset',
|
|
848
892
|
description: commandHelp('把 COS 路径 / URL / 本地文件注册成平台素材', {
|
|
849
|
-
examples: [
|
|
893
|
+
examples: [
|
|
894
|
+
'lj-awb create asset --group-id <id> --platform JIMENG --url "asset-review/upload/a.png" --name "女主正面" --dry-run',
|
|
895
|
+
'lj-awb create asset --group-id <id> --platform JIMENG --file ./clip.mp4 --name "参考视频" --dry-run',
|
|
896
|
+
],
|
|
897
|
+
hint: 'CLI 会按扩展名自动设置 assetType=Image/Video/Audio;本地文件会用 ffprobe 预校验图片/视频尺寸、视频时长/FPS/像素数和音频时长,缺少 ffprobe/ffmpeg 时 macOS + Homebrew 会自动安装 ffmpeg。',
|
|
850
898
|
}),
|
|
851
899
|
args: [
|
|
852
900
|
{ name: 'group-id', valueName: 'id', description: '素材组 ID' },
|
|
@@ -854,6 +902,7 @@ export function registerAwbCommands(cli) {
|
|
|
854
902
|
{ name: 'file', valueName: 'path', description: '本地素材文件;会先上传' },
|
|
855
903
|
{ name: 'url', valueName: 'url', description: '素材 URL 或 COS 路径' },
|
|
856
904
|
{ name: 'backend-path', valueName: 'path', description: 'upload files 返回的 backendPath' },
|
|
905
|
+
{ name: 'auto-convert', description: '本地素材不符合加白规格时自动转换为合法规格后继续' },
|
|
857
906
|
ASSET_PLATFORM_ARG,
|
|
858
907
|
DRY_RUN_ARG,
|
|
859
908
|
YES_ARG,
|
|
@@ -318,11 +318,19 @@ export function guessMimeType(filePath) {
|
|
|
318
318
|
return 'image/png';
|
|
319
319
|
case '.jpg':
|
|
320
320
|
case '.jpeg':
|
|
321
|
+
case '.jfif':
|
|
321
322
|
return 'image/jpeg';
|
|
323
|
+
case '.tif':
|
|
324
|
+
case '.tiff':
|
|
325
|
+
return 'image/tiff';
|
|
322
326
|
case '.webp':
|
|
323
327
|
return 'image/webp';
|
|
324
328
|
case '.gif':
|
|
325
329
|
return 'image/gif';
|
|
330
|
+
case '.heic':
|
|
331
|
+
return 'image/heic';
|
|
332
|
+
case '.heif':
|
|
333
|
+
return 'image/heif';
|
|
326
334
|
case '.mp3':
|
|
327
335
|
return 'audio/mpeg';
|
|
328
336
|
case '.wav':
|
|
@@ -52,6 +52,7 @@ function requestSummary(request = {}) {
|
|
|
52
52
|
const promptParams = request.promptParams || {};
|
|
53
53
|
return compactRecord({
|
|
54
54
|
requestSource: request.requestSource,
|
|
55
|
+
objectName: request.objectName,
|
|
55
56
|
modelCode: request.modelCode,
|
|
56
57
|
modelGroupCode: request.modelGroupCode,
|
|
57
58
|
projectGroupNo: request.projectGroupNo,
|
|
@@ -158,6 +159,26 @@ function normalizeDryRun(data = {}) {
|
|
|
158
159
|
resourceConversion: Array.isArray(resourceConversions) && resourceConversions.length === 1
|
|
159
160
|
? `${resourceConversions[0].resource || 'resource'} ${resourceConversions[0].fromFormat}->${resourceConversions[0].toFormat}`
|
|
160
161
|
: undefined,
|
|
162
|
+
validationLegal: data.validation?.legal,
|
|
163
|
+
conversionRequired: Boolean(data.conversionPlan),
|
|
164
|
+
converted: Boolean(data.conversion?.converted),
|
|
165
|
+
conversionReason: data.conversionPlan?.reason ?? data.conversion?.reason ?? (Array.isArray(data.validation?.violations) ? data.validation.violations.map((item) => item.message).join(';') : undefined),
|
|
166
|
+
conversionTargetFormat: data.conversionPlan?.toFormat ?? data.conversion?.toFormat,
|
|
167
|
+
conversionTargetWidth: data.conversionPlan?.targetWidth ?? data.conversion?.targetWidth,
|
|
168
|
+
conversionTargetHeight: data.conversionPlan?.targetHeight ?? data.conversion?.targetHeight,
|
|
169
|
+
conversionTargetPixels: data.conversionPlan?.targetPixels ?? data.conversion?.targetPixels,
|
|
170
|
+
conversionTargetFps: data.conversionPlan?.targetFps ?? data.conversion?.targetFps,
|
|
171
|
+
conversionTargetDuration: data.conversionPlan?.targetDuration ?? data.conversion?.targetDuration,
|
|
172
|
+
conversionTarget: data.conversionPlan
|
|
173
|
+
? compactRecord({
|
|
174
|
+
format: data.conversionPlan.toFormat,
|
|
175
|
+
width: data.conversionPlan.targetWidth,
|
|
176
|
+
height: data.conversionPlan.targetHeight,
|
|
177
|
+
pixels: data.conversionPlan.targetPixels,
|
|
178
|
+
fps: data.conversionPlan.targetFps,
|
|
179
|
+
duration: data.conversionPlan.targetDuration,
|
|
180
|
+
})
|
|
181
|
+
: undefined,
|
|
161
182
|
fileCount: Array.isArray(data.files) ? data.files.length : undefined,
|
|
162
183
|
assetCount: Array.isArray(data.assets) ? data.assets.length : undefined,
|
|
163
184
|
files: data.files,
|
|
@@ -168,10 +189,19 @@ function normalizeDryRun(data = {}) {
|
|
|
168
189
|
});
|
|
169
190
|
}
|
|
170
191
|
|
|
171
|
-
function
|
|
192
|
+
function submissionStatusCommand(commandName, data = {}) {
|
|
193
|
+
if (!data?.taskId) return null;
|
|
194
|
+
if (commandName === 'create image') return `${commandPrefix()} task image-status --task-id ${data.taskId}`;
|
|
195
|
+
if (commandName === 'create video') return `${commandPrefix()} task video-status --task-id ${data.taskId}`;
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function normalizeTaskSubmission(commandName, data = {}) {
|
|
200
|
+
const statusCommand = rewriteCommandPrefix(data.statusCommand || submissionStatusCommand(commandName, data));
|
|
172
201
|
return compactRecord({
|
|
173
202
|
taskId: data.taskId,
|
|
174
203
|
taskType: data.taskType,
|
|
204
|
+
objectName: data.objectName,
|
|
175
205
|
modelGroupCode: data.modelGroupCode,
|
|
176
206
|
projectGroupNo: data.projectGroupNo,
|
|
177
207
|
pointNo: data.pointNo,
|
|
@@ -184,6 +214,7 @@ function normalizeTaskSubmission(data = {}) {
|
|
|
184
214
|
projectBudgetRemainingAfter: data.projectBudgetRemainingAfter ?? data.projectPointRemainingAfter,
|
|
185
215
|
uploadCount: Array.isArray(data.uploads) ? data.uploads.length : undefined,
|
|
186
216
|
nextCommand: rewriteCommandPrefix(data.nextCommand),
|
|
217
|
+
statusCommand,
|
|
187
218
|
waited: data.waited ? normalizeTaskStatus(data.waited) : undefined,
|
|
188
219
|
});
|
|
189
220
|
}
|
|
@@ -207,6 +238,7 @@ function normalizeSubtitleSubmission(data = {}) {
|
|
|
207
238
|
|
|
208
239
|
function normalizeFee(data = {}) {
|
|
209
240
|
return compactRecord({
|
|
241
|
+
objectName: data.objectName,
|
|
210
242
|
modelGroupCode: data.modelGroupCode,
|
|
211
243
|
projectGroupNo: data.projectGroupNo,
|
|
212
244
|
pointCost: data.pointCost,
|
|
@@ -334,6 +366,7 @@ function normalizeSubjectVoice(data = {}) {
|
|
|
334
366
|
}
|
|
335
367
|
|
|
336
368
|
function normalizeAsset(data = {}) {
|
|
369
|
+
const conversion = data.conversionPlan ?? data.conversion ?? null;
|
|
337
370
|
return compactRecord({
|
|
338
371
|
created: data.created,
|
|
339
372
|
updated: data.updated,
|
|
@@ -341,9 +374,30 @@ function normalizeAsset(data = {}) {
|
|
|
341
374
|
groupId: data.groupId,
|
|
342
375
|
assetId: data.assetId,
|
|
343
376
|
platform: data.platform,
|
|
377
|
+
assetType: data.assetType,
|
|
344
378
|
name: data.name,
|
|
345
379
|
projectName: data.projectName,
|
|
346
380
|
assetPath: data.assetPath,
|
|
381
|
+
validationLegal: data.validation?.legal ?? (data.conversion ? true : undefined),
|
|
382
|
+
conversionRequired: Boolean(data.conversionPlan ?? data.conversion),
|
|
383
|
+
converted: Boolean(data.conversion?.converted),
|
|
384
|
+
conversionReason: conversion?.reason,
|
|
385
|
+
conversionTargetFormat: conversion?.toFormat,
|
|
386
|
+
conversionTargetWidth: conversion?.targetWidth,
|
|
387
|
+
conversionTargetHeight: conversion?.targetHeight,
|
|
388
|
+
conversionTargetPixels: conversion?.targetPixels,
|
|
389
|
+
conversionTargetFps: conversion?.targetFps,
|
|
390
|
+
conversionTargetDuration: conversion?.targetDuration,
|
|
391
|
+
conversionTarget: conversion
|
|
392
|
+
? compactRecord({
|
|
393
|
+
format: conversion.toFormat,
|
|
394
|
+
width: conversion.targetWidth,
|
|
395
|
+
height: conversion.targetHeight,
|
|
396
|
+
pixels: conversion.targetPixels,
|
|
397
|
+
fps: conversion.targetFps,
|
|
398
|
+
duration: conversion.targetDuration,
|
|
399
|
+
})
|
|
400
|
+
: undefined,
|
|
347
401
|
uploadBackendPath: data.upload?.backendPath,
|
|
348
402
|
uploadUrl: data.upload?.url,
|
|
349
403
|
});
|
|
@@ -504,11 +558,13 @@ export function normalizeOutputData(commandName, data) {
|
|
|
504
558
|
switch (commandName) {
|
|
505
559
|
case 'create image':
|
|
506
560
|
case 'create video':
|
|
507
|
-
|
|
561
|
+
case 'create video-super-resolution':
|
|
562
|
+
return normalizeTaskSubmission(commandName, data);
|
|
508
563
|
case 'create video-subtitle-removal':
|
|
509
564
|
return normalizeSubtitleSubmission(data);
|
|
510
565
|
case 'create image-fee':
|
|
511
566
|
case 'create video-fee':
|
|
567
|
+
case 'create video-super-resolution-fee':
|
|
512
568
|
return normalizeFee(data);
|
|
513
569
|
case 'account info':
|
|
514
570
|
return normalizeAccountInfo(data);
|
|
@@ -526,6 +582,7 @@ export function normalizeOutputData(commandName, data) {
|
|
|
526
582
|
case 'task video-status':
|
|
527
583
|
case 'task wait':
|
|
528
584
|
case 'task video-subtitle-status':
|
|
585
|
+
case 'task video-super-resolution-status':
|
|
529
586
|
return normalizeTaskStatus(data);
|
|
530
587
|
case 'create subject':
|
|
531
588
|
case 'create subject-wait':
|
|
@@ -1333,9 +1390,12 @@ const OUTPUT_KIND_BY_COMMAND = {
|
|
|
1333
1390
|
'create video-fee': 'fee_estimate',
|
|
1334
1391
|
'create video': 'task_submission',
|
|
1335
1392
|
'create video-batch': 'batch_task_submission',
|
|
1393
|
+
'create video-super-resolution-fee': 'fee_estimate',
|
|
1394
|
+
'create video-super-resolution': 'task_submission',
|
|
1336
1395
|
'task video-status': 'task_status',
|
|
1337
1396
|
'create video-subtitle-removal': 'subtitle_task_submission',
|
|
1338
1397
|
'task video-subtitle-status': 'subtitle_task_status',
|
|
1398
|
+
'task video-super-resolution-status': 'task_status',
|
|
1339
1399
|
'task list': 'task_list',
|
|
1340
1400
|
'task wait': 'task_status',
|
|
1341
1401
|
'task records': 'local_task_records',
|
|
@@ -1471,6 +1531,8 @@ const COMMAND_TITLES = {
|
|
|
1471
1531
|
'create video': '生视频任务提交结果',
|
|
1472
1532
|
'create image-batch': '批量生图提交结果',
|
|
1473
1533
|
'create video-batch': '批量生视频提交结果',
|
|
1534
|
+
'create video-super-resolution-fee': '视频超分积分预估',
|
|
1535
|
+
'create video-super-resolution': '视频超分任务提交结果',
|
|
1474
1536
|
'create video-subtitle-removal': '去字幕任务提交结果',
|
|
1475
1537
|
'create subject': '主体创建结果',
|
|
1476
1538
|
'create subject-wait': '主体状态',
|
|
@@ -1491,6 +1553,17 @@ const FIELD_LABELS = {
|
|
|
1491
1553
|
assetKind: '素材类型',
|
|
1492
1554
|
assetName: '素材名',
|
|
1493
1555
|
assetPath: '素材路径',
|
|
1556
|
+
assetType: '素材类型',
|
|
1557
|
+
converted: '已转码',
|
|
1558
|
+
conversionReason: '转码原因',
|
|
1559
|
+
conversionRequired: '需要转码',
|
|
1560
|
+
conversionTargetDuration: '目标时长',
|
|
1561
|
+
conversionTargetFormat: '目标格式',
|
|
1562
|
+
conversionTargetFps: '目标帧率',
|
|
1563
|
+
conversionTargetHeight: '目标高度',
|
|
1564
|
+
conversionTargetPixels: '目标像素',
|
|
1565
|
+
conversionTargetWidth: '目标宽度',
|
|
1566
|
+
validationLegal: '规格合法',
|
|
1494
1567
|
authType: '认证方式',
|
|
1495
1568
|
backendPath: '后端路径',
|
|
1496
1569
|
batchCount: '批次数',
|
|
@@ -1549,6 +1622,7 @@ const FIELD_LABELS = {
|
|
|
1549
1622
|
nextCommand: '下一步命令',
|
|
1550
1623
|
nextRefSubject: '主体引用参数',
|
|
1551
1624
|
nextVoiceArg: '音色参数',
|
|
1625
|
+
objectName: '对象路径',
|
|
1552
1626
|
originUrls: '原始素材',
|
|
1553
1627
|
parentKey: '父级 Key',
|
|
1554
1628
|
platform: '平台',
|
|
@@ -1589,6 +1663,7 @@ const FIELD_LABELS = {
|
|
|
1589
1663
|
sourceTaskId: '来源任务 ID',
|
|
1590
1664
|
stateKey: '状态 Key',
|
|
1591
1665
|
status: '状态',
|
|
1666
|
+
statusCommand: '状态查询命令',
|
|
1592
1667
|
statusCommandTaskType: '状态任务类型',
|
|
1593
1668
|
submitted: '已提交',
|
|
1594
1669
|
successRate: '成功率',
|
|
@@ -1655,7 +1730,7 @@ const DETAIL_FIELDS_BY_KIND = {
|
|
|
1655
1730
|
artifact_write_result: ['id', 'projectId', 'rowKind', 'entityKey', 'parentKey', 'actorKey', 'propKey', 'locationKey', 'stateKey', 'episodeId', 'sceneId', 'clipId', 'videoEpisodeId', 'status', 'title', 'name', 'displayName'],
|
|
1656
1731
|
asset_group_detail: ['groupId', 'platform', 'name', 'projectName', 'description', 'status', 'assetCount'],
|
|
1657
1732
|
asset_group_write_result: ['created', 'updated', 'groupId', 'platform', 'name', 'projectName', 'assetPath'],
|
|
1658
|
-
asset_register_result: ['created', 'updated', 'registered', 'assetId', 'groupId', 'platform', 'name', 'projectName', 'assetPath', 'uploadBackendPath', 'uploadUrl'],
|
|
1733
|
+
asset_register_result: ['created', 'updated', 'registered', 'assetId', 'groupId', 'platform', 'assetType', 'name', 'projectName', 'assetPath', 'validationLegal', 'conversionRequired', 'converted', 'conversionReason', 'conversionTargetFormat', 'conversionTargetWidth', 'conversionTargetHeight', 'conversionTargetPixels', 'conversionTargetFps', 'conversionTargetDuration', 'uploadBackendPath', 'uploadUrl'],
|
|
1659
1734
|
auth_result: ['saved', 'verified', 'accessKey', 'source', 'dryRun', 'userId', 'userName', 'groupId', 'groupName'],
|
|
1660
1735
|
auth_status: ['configured', 'authType', 'accessKey', 'source', 'verified', 'verification', 'verifyCommand', 'userId', 'userName', 'groupId', 'groupName'],
|
|
1661
1736
|
batch_subject_publish_result: ['dryRun', 'submitted', 'count', 'successCount', 'failureCount', 'modelCode', 'projectGroupNo'],
|
|
@@ -1664,7 +1739,7 @@ const DETAIL_FIELDS_BY_KIND = {
|
|
|
1664
1739
|
credits_balance: ['billingPointBalance', 'currentProjectGroupNo', 'currentProjectGroupName', 'projectBudgetBalance', 'projectBudgetMax'],
|
|
1665
1740
|
credits_usage: ['projectGroupNo', 'sinceText', 'untilText', 'scannedTaskCount', 'pointTotal'],
|
|
1666
1741
|
environment_report: ['doctorStatus', 'verify'],
|
|
1667
|
-
fee_estimate: ['modelGroupCode', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter'],
|
|
1742
|
+
fee_estimate: ['objectName', 'modelGroupCode', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter'],
|
|
1668
1743
|
generic: ['cleared', 'selected', 'created', 'updated', 'reused', 'dryRun', 'action', 'projectGroupNo', 'projectGroupName', 'groupId', 'groupName', 'projectGroupName', 'point', 'memberCount', 'note'],
|
|
1669
1744
|
local_task_records: ['count', 'taskCount', 'successTaskCount', 'resultCount', 'pointTotal'],
|
|
1670
1745
|
project_summary: ['selected', 'created', 'updated', 'reused', 'projectGroupNo', 'projectGroupName', 'isSelected', 'projectBudgetBalance', 'projectBudgetMax', 'memberCount'],
|
|
@@ -1675,7 +1750,7 @@ const DETAIL_FIELDS_BY_KIND = {
|
|
|
1675
1750
|
subtitle_task_status: ['taskId', 'publicId', 'remoteTaskId', 'taskType', 'taskStatus', 'isTerminal', 'projectGroupNo', 'resultCount', 'errorMessage', 'timedOut', 'waitedMs'],
|
|
1676
1751
|
subtitle_task_submission: ['submitted', 'taskId', 'taskType', 'sourceTaskId', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter', 'nextCommand'],
|
|
1677
1752
|
task_status: ['taskId', 'publicId', 'remoteTaskId', 'taskType', 'taskStatus', 'isTerminal', 'modelGroupCode', 'projectGroupNo', 'pointNo', 'gmtCreate', 'resultCount', 'errorMessage', 'timedOut', 'waitedMs'],
|
|
1678
|
-
task_submission: ['taskId', 'taskType', 'modelGroupCode', 'projectGroupNo', 'pointNo', 'points', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter', 'uploadCount', 'nextCommand'],
|
|
1753
|
+
task_submission: ['taskId', 'taskType', 'objectName', 'modelGroupCode', 'projectGroupNo', 'pointNo', 'points', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter', 'uploadCount', 'nextCommand', 'statusCommand'],
|
|
1679
1754
|
update_result: ['checked', 'updated', 'updateAvailable', 'packageName', 'previousVersion', 'currentVersion', 'latestVersion', 'command', 'skillUpdated', 'restartRecommended', 'message'],
|
|
1680
1755
|
upload_result: ['dryRun', 'fileCount', 'assetCount', 'localFileCount', 'resourceConversionCount'],
|
|
1681
1756
|
};
|
|
@@ -1693,10 +1768,12 @@ const DRY_RUN_FIELDS_BY_COMMAND = {
|
|
|
1693
1768
|
'create video': ['dryRun', 'action', 'modelGroupCode', 'projectGroupNo', 'prompt', 'duration', 'ratio', 'quality', 'needAudio', 'resourceCount', 'localFileCount', 'assetCount'],
|
|
1694
1769
|
'create image-batch': ['dryRun', 'count', 'modelGroupCode', 'projectGroupNo'],
|
|
1695
1770
|
'create video-batch': ['dryRun', 'count', 'modelGroupCode', 'projectGroupNo'],
|
|
1771
|
+
'create video-super-resolution-fee': ['dryRun', 'action', 'objectName', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter'],
|
|
1772
|
+
'create video-super-resolution': ['dryRun', 'action', 'objectName', 'projectGroupNo', 'taskId', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter', 'nextCommand'],
|
|
1696
1773
|
'create video-subtitle-removal': ['dryRun', 'action', 'sourceTaskId', 'projectGroupNo'],
|
|
1697
1774
|
'create asset-group': ['dryRun', 'action', 'platform', 'name', 'projectName'],
|
|
1698
1775
|
'create asset-group-update': ['dryRun', 'action', 'groupId', 'platform', 'name', 'projectName'],
|
|
1699
|
-
'create asset': ['dryRun', 'action', 'groupId', 'platform', 'name', 'assetPath', 'localFileCount', 'fileCount'],
|
|
1776
|
+
'create asset': ['dryRun', 'action', 'groupId', 'platform', 'assetType', 'name', 'assetPath', 'validationLegal', 'conversionRequired', 'converted', 'conversionReason', 'conversionTargetFormat', 'conversionTargetWidth', 'conversionTargetHeight', 'conversionTargetPixels', 'conversionTargetFps', 'conversionTargetDuration', 'localFileCount', 'fileCount'],
|
|
1700
1777
|
'create subject': ['dryRun', 'action', 'name', 'modelCode', 'elementFrontalImage', 'assetCount', 'localFileCount', 'nextRefSubject'],
|
|
1701
1778
|
'create subject-voice': ['dryRun', 'action', 'name', 'voiceName', 'voiceUrl', 'remoteUrl', 'remoteUpload', 'localFileCount', 'nextVoiceArg'],
|
|
1702
1779
|
'create subject-batch': ['dryRun', 'count', 'modelCode'],
|
|
@@ -2776,6 +2853,7 @@ function collectPrettyActions(commandName, normalized, context = {}) {
|
|
|
2776
2853
|
actions.push({ label, value: rewriteCommandPrefix(value) });
|
|
2777
2854
|
};
|
|
2778
2855
|
if (normalized?.nextCommand) add('继续查询', normalized.nextCommand);
|
|
2856
|
+
if (normalized?.statusCommand) add('状态查询', normalized.statusCommand);
|
|
2779
2857
|
if (normalized?.nextRefSubject) add('主体引用', normalized.nextRefSubject);
|
|
2780
2858
|
if (normalized?.nextVoiceArg) add('音色参数', normalized.nextVoiceArg);
|
|
2781
2859
|
if (normalized?.dryRun && context.confirmCommand) add('确认执行', context.confirmCommand);
|
|
@@ -3125,6 +3203,12 @@ export function formatTextOutput(commandName, data, context = {}) {
|
|
|
3125
3203
|
'parentKey',
|
|
3126
3204
|
'assetKind',
|
|
3127
3205
|
'assetKey',
|
|
3206
|
+
'assetType',
|
|
3207
|
+
'assetPath',
|
|
3208
|
+
'validationLegal',
|
|
3209
|
+
'conversionRequired',
|
|
3210
|
+
'converted',
|
|
3211
|
+
'conversionReason',
|
|
3128
3212
|
'actorKey',
|
|
3129
3213
|
'propKey',
|
|
3130
3214
|
'locationKey',
|
|
@@ -3147,7 +3231,7 @@ export function formatTextOutput(commandName, data, context = {}) {
|
|
|
3147
3231
|
'dryRun',
|
|
3148
3232
|
'action',
|
|
3149
3233
|
],
|
|
3150
|
-
['nextCommand', 'nextRefSubject', ...(list ? ['count'] : []), ...(isModelList ? ['usage'] : [])],
|
|
3234
|
+
['nextCommand', 'statusCommand', 'nextRefSubject', ...(list ? ['count'] : []), ...(isModelList ? ['usage'] : [])],
|
|
3151
3235
|
);
|
|
3152
3236
|
if (scalarLine) lines.push(scalarLine);
|
|
3153
3237
|
if (list) {
|
|
@@ -3174,6 +3258,7 @@ export function formatTextOutput(commandName, data, context = {}) {
|
|
|
3174
3258
|
}
|
|
3175
3259
|
}
|
|
3176
3260
|
if (normalized.nextCommand) lines.push(`next=${normalized.nextCommand}`);
|
|
3261
|
+
if (normalized.statusCommand) lines.push(`statusCommand=${normalized.statusCommand}`);
|
|
3177
3262
|
if (normalized.nextRefSubject) lines.push(`nextRefSubject=${normalized.nextRefSubject}`);
|
|
3178
3263
|
if (normalized.dryRun && context.confirmCommand) lines.push(`nextAfterConfirm=${context.confirmCommand}`);
|
|
3179
3264
|
if (normalized.dryRun && !context.confirmCommand && context.executeCommand) lines.push(`next=${context.executeCommand}`);
|