@lingjingai/lj-awb-cli 0.4.1 → 0.4.3
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 +77 -4
- package/packages/awb-core/src/services.js +994 -80
- package/packages/awb-core/src/standalone.js +36 -6
- 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 +3 -1
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.3",
|
|
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.3"
|
|
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,
|
|
@@ -172,6 +193,7 @@ function normalizeTaskSubmission(data = {}) {
|
|
|
172
193
|
return compactRecord({
|
|
173
194
|
taskId: data.taskId,
|
|
174
195
|
taskType: data.taskType,
|
|
196
|
+
objectName: data.objectName,
|
|
175
197
|
modelGroupCode: data.modelGroupCode,
|
|
176
198
|
projectGroupNo: data.projectGroupNo,
|
|
177
199
|
pointNo: data.pointNo,
|
|
@@ -207,6 +229,7 @@ function normalizeSubtitleSubmission(data = {}) {
|
|
|
207
229
|
|
|
208
230
|
function normalizeFee(data = {}) {
|
|
209
231
|
return compactRecord({
|
|
232
|
+
objectName: data.objectName,
|
|
210
233
|
modelGroupCode: data.modelGroupCode,
|
|
211
234
|
projectGroupNo: data.projectGroupNo,
|
|
212
235
|
pointCost: data.pointCost,
|
|
@@ -334,6 +357,7 @@ function normalizeSubjectVoice(data = {}) {
|
|
|
334
357
|
}
|
|
335
358
|
|
|
336
359
|
function normalizeAsset(data = {}) {
|
|
360
|
+
const conversion = data.conversionPlan ?? data.conversion ?? null;
|
|
337
361
|
return compactRecord({
|
|
338
362
|
created: data.created,
|
|
339
363
|
updated: data.updated,
|
|
@@ -341,9 +365,30 @@ function normalizeAsset(data = {}) {
|
|
|
341
365
|
groupId: data.groupId,
|
|
342
366
|
assetId: data.assetId,
|
|
343
367
|
platform: data.platform,
|
|
368
|
+
assetType: data.assetType,
|
|
344
369
|
name: data.name,
|
|
345
370
|
projectName: data.projectName,
|
|
346
371
|
assetPath: data.assetPath,
|
|
372
|
+
validationLegal: data.validation?.legal ?? (data.conversion ? true : undefined),
|
|
373
|
+
conversionRequired: Boolean(data.conversionPlan ?? data.conversion),
|
|
374
|
+
converted: Boolean(data.conversion?.converted),
|
|
375
|
+
conversionReason: conversion?.reason,
|
|
376
|
+
conversionTargetFormat: conversion?.toFormat,
|
|
377
|
+
conversionTargetWidth: conversion?.targetWidth,
|
|
378
|
+
conversionTargetHeight: conversion?.targetHeight,
|
|
379
|
+
conversionTargetPixels: conversion?.targetPixels,
|
|
380
|
+
conversionTargetFps: conversion?.targetFps,
|
|
381
|
+
conversionTargetDuration: conversion?.targetDuration,
|
|
382
|
+
conversionTarget: conversion
|
|
383
|
+
? compactRecord({
|
|
384
|
+
format: conversion.toFormat,
|
|
385
|
+
width: conversion.targetWidth,
|
|
386
|
+
height: conversion.targetHeight,
|
|
387
|
+
pixels: conversion.targetPixels,
|
|
388
|
+
fps: conversion.targetFps,
|
|
389
|
+
duration: conversion.targetDuration,
|
|
390
|
+
})
|
|
391
|
+
: undefined,
|
|
347
392
|
uploadBackendPath: data.upload?.backendPath,
|
|
348
393
|
uploadUrl: data.upload?.url,
|
|
349
394
|
});
|
|
@@ -504,11 +549,13 @@ export function normalizeOutputData(commandName, data) {
|
|
|
504
549
|
switch (commandName) {
|
|
505
550
|
case 'create image':
|
|
506
551
|
case 'create video':
|
|
552
|
+
case 'create video-super-resolution':
|
|
507
553
|
return normalizeTaskSubmission(data);
|
|
508
554
|
case 'create video-subtitle-removal':
|
|
509
555
|
return normalizeSubtitleSubmission(data);
|
|
510
556
|
case 'create image-fee':
|
|
511
557
|
case 'create video-fee':
|
|
558
|
+
case 'create video-super-resolution-fee':
|
|
512
559
|
return normalizeFee(data);
|
|
513
560
|
case 'account info':
|
|
514
561
|
return normalizeAccountInfo(data);
|
|
@@ -526,6 +573,7 @@ export function normalizeOutputData(commandName, data) {
|
|
|
526
573
|
case 'task video-status':
|
|
527
574
|
case 'task wait':
|
|
528
575
|
case 'task video-subtitle-status':
|
|
576
|
+
case 'task video-super-resolution-status':
|
|
529
577
|
return normalizeTaskStatus(data);
|
|
530
578
|
case 'create subject':
|
|
531
579
|
case 'create subject-wait':
|
|
@@ -1333,9 +1381,12 @@ const OUTPUT_KIND_BY_COMMAND = {
|
|
|
1333
1381
|
'create video-fee': 'fee_estimate',
|
|
1334
1382
|
'create video': 'task_submission',
|
|
1335
1383
|
'create video-batch': 'batch_task_submission',
|
|
1384
|
+
'create video-super-resolution-fee': 'fee_estimate',
|
|
1385
|
+
'create video-super-resolution': 'task_submission',
|
|
1336
1386
|
'task video-status': 'task_status',
|
|
1337
1387
|
'create video-subtitle-removal': 'subtitle_task_submission',
|
|
1338
1388
|
'task video-subtitle-status': 'subtitle_task_status',
|
|
1389
|
+
'task video-super-resolution-status': 'task_status',
|
|
1339
1390
|
'task list': 'task_list',
|
|
1340
1391
|
'task wait': 'task_status',
|
|
1341
1392
|
'task records': 'local_task_records',
|
|
@@ -1471,6 +1522,8 @@ const COMMAND_TITLES = {
|
|
|
1471
1522
|
'create video': '生视频任务提交结果',
|
|
1472
1523
|
'create image-batch': '批量生图提交结果',
|
|
1473
1524
|
'create video-batch': '批量生视频提交结果',
|
|
1525
|
+
'create video-super-resolution-fee': '视频超分积分预估',
|
|
1526
|
+
'create video-super-resolution': '视频超分任务提交结果',
|
|
1474
1527
|
'create video-subtitle-removal': '去字幕任务提交结果',
|
|
1475
1528
|
'create subject': '主体创建结果',
|
|
1476
1529
|
'create subject-wait': '主体状态',
|
|
@@ -1491,6 +1544,17 @@ const FIELD_LABELS = {
|
|
|
1491
1544
|
assetKind: '素材类型',
|
|
1492
1545
|
assetName: '素材名',
|
|
1493
1546
|
assetPath: '素材路径',
|
|
1547
|
+
assetType: '素材类型',
|
|
1548
|
+
converted: '已转码',
|
|
1549
|
+
conversionReason: '转码原因',
|
|
1550
|
+
conversionRequired: '需要转码',
|
|
1551
|
+
conversionTargetDuration: '目标时长',
|
|
1552
|
+
conversionTargetFormat: '目标格式',
|
|
1553
|
+
conversionTargetFps: '目标帧率',
|
|
1554
|
+
conversionTargetHeight: '目标高度',
|
|
1555
|
+
conversionTargetPixels: '目标像素',
|
|
1556
|
+
conversionTargetWidth: '目标宽度',
|
|
1557
|
+
validationLegal: '规格合法',
|
|
1494
1558
|
authType: '认证方式',
|
|
1495
1559
|
backendPath: '后端路径',
|
|
1496
1560
|
batchCount: '批次数',
|
|
@@ -1549,6 +1613,7 @@ const FIELD_LABELS = {
|
|
|
1549
1613
|
nextCommand: '下一步命令',
|
|
1550
1614
|
nextRefSubject: '主体引用参数',
|
|
1551
1615
|
nextVoiceArg: '音色参数',
|
|
1616
|
+
objectName: '对象路径',
|
|
1552
1617
|
originUrls: '原始素材',
|
|
1553
1618
|
parentKey: '父级 Key',
|
|
1554
1619
|
platform: '平台',
|
|
@@ -1655,7 +1720,7 @@ const DETAIL_FIELDS_BY_KIND = {
|
|
|
1655
1720
|
artifact_write_result: ['id', 'projectId', 'rowKind', 'entityKey', 'parentKey', 'actorKey', 'propKey', 'locationKey', 'stateKey', 'episodeId', 'sceneId', 'clipId', 'videoEpisodeId', 'status', 'title', 'name', 'displayName'],
|
|
1656
1721
|
asset_group_detail: ['groupId', 'platform', 'name', 'projectName', 'description', 'status', 'assetCount'],
|
|
1657
1722
|
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'],
|
|
1723
|
+
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
1724
|
auth_result: ['saved', 'verified', 'accessKey', 'source', 'dryRun', 'userId', 'userName', 'groupId', 'groupName'],
|
|
1660
1725
|
auth_status: ['configured', 'authType', 'accessKey', 'source', 'verified', 'verification', 'verifyCommand', 'userId', 'userName', 'groupId', 'groupName'],
|
|
1661
1726
|
batch_subject_publish_result: ['dryRun', 'submitted', 'count', 'successCount', 'failureCount', 'modelCode', 'projectGroupNo'],
|
|
@@ -1664,7 +1729,7 @@ const DETAIL_FIELDS_BY_KIND = {
|
|
|
1664
1729
|
credits_balance: ['billingPointBalance', 'currentProjectGroupNo', 'currentProjectGroupName', 'projectBudgetBalance', 'projectBudgetMax'],
|
|
1665
1730
|
credits_usage: ['projectGroupNo', 'sinceText', 'untilText', 'scannedTaskCount', 'pointTotal'],
|
|
1666
1731
|
environment_report: ['doctorStatus', 'verify'],
|
|
1667
|
-
fee_estimate: ['modelGroupCode', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter'],
|
|
1732
|
+
fee_estimate: ['objectName', 'modelGroupCode', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter'],
|
|
1668
1733
|
generic: ['cleared', 'selected', 'created', 'updated', 'reused', 'dryRun', 'action', 'projectGroupNo', 'projectGroupName', 'groupId', 'groupName', 'projectGroupName', 'point', 'memberCount', 'note'],
|
|
1669
1734
|
local_task_records: ['count', 'taskCount', 'successTaskCount', 'resultCount', 'pointTotal'],
|
|
1670
1735
|
project_summary: ['selected', 'created', 'updated', 'reused', 'projectGroupNo', 'projectGroupName', 'isSelected', 'projectBudgetBalance', 'projectBudgetMax', 'memberCount'],
|
|
@@ -1675,7 +1740,7 @@ const DETAIL_FIELDS_BY_KIND = {
|
|
|
1675
1740
|
subtitle_task_status: ['taskId', 'publicId', 'remoteTaskId', 'taskType', 'taskStatus', 'isTerminal', 'projectGroupNo', 'resultCount', 'errorMessage', 'timedOut', 'waitedMs'],
|
|
1676
1741
|
subtitle_task_submission: ['submitted', 'taskId', 'taskType', 'sourceTaskId', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter', 'nextCommand'],
|
|
1677
1742
|
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'],
|
|
1743
|
+
task_submission: ['taskId', 'taskType', 'objectName', 'modelGroupCode', 'projectGroupNo', 'pointNo', 'points', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter', 'uploadCount', 'nextCommand'],
|
|
1679
1744
|
update_result: ['checked', 'updated', 'updateAvailable', 'packageName', 'previousVersion', 'currentVersion', 'latestVersion', 'command', 'skillUpdated', 'restartRecommended', 'message'],
|
|
1680
1745
|
upload_result: ['dryRun', 'fileCount', 'assetCount', 'localFileCount', 'resourceConversionCount'],
|
|
1681
1746
|
};
|
|
@@ -1693,10 +1758,12 @@ const DRY_RUN_FIELDS_BY_COMMAND = {
|
|
|
1693
1758
|
'create video': ['dryRun', 'action', 'modelGroupCode', 'projectGroupNo', 'prompt', 'duration', 'ratio', 'quality', 'needAudio', 'resourceCount', 'localFileCount', 'assetCount'],
|
|
1694
1759
|
'create image-batch': ['dryRun', 'count', 'modelGroupCode', 'projectGroupNo'],
|
|
1695
1760
|
'create video-batch': ['dryRun', 'count', 'modelGroupCode', 'projectGroupNo'],
|
|
1761
|
+
'create video-super-resolution-fee': ['dryRun', 'action', 'objectName', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter'],
|
|
1762
|
+
'create video-super-resolution': ['dryRun', 'action', 'objectName', 'projectGroupNo', 'taskId', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter', 'nextCommand'],
|
|
1696
1763
|
'create video-subtitle-removal': ['dryRun', 'action', 'sourceTaskId', 'projectGroupNo'],
|
|
1697
1764
|
'create asset-group': ['dryRun', 'action', 'platform', 'name', 'projectName'],
|
|
1698
1765
|
'create asset-group-update': ['dryRun', 'action', 'groupId', 'platform', 'name', 'projectName'],
|
|
1699
|
-
'create asset': ['dryRun', 'action', 'groupId', 'platform', 'name', 'assetPath', 'localFileCount', 'fileCount'],
|
|
1766
|
+
'create asset': ['dryRun', 'action', 'groupId', 'platform', 'assetType', 'name', 'assetPath', 'validationLegal', 'conversionRequired', 'converted', 'conversionReason', 'conversionTargetFormat', 'conversionTargetWidth', 'conversionTargetHeight', 'conversionTargetPixels', 'conversionTargetFps', 'conversionTargetDuration', 'localFileCount', 'fileCount'],
|
|
1700
1767
|
'create subject': ['dryRun', 'action', 'name', 'modelCode', 'elementFrontalImage', 'assetCount', 'localFileCount', 'nextRefSubject'],
|
|
1701
1768
|
'create subject-voice': ['dryRun', 'action', 'name', 'voiceName', 'voiceUrl', 'remoteUrl', 'remoteUpload', 'localFileCount', 'nextVoiceArg'],
|
|
1702
1769
|
'create subject-batch': ['dryRun', 'count', 'modelCode'],
|
|
@@ -3125,6 +3192,12 @@ export function formatTextOutput(commandName, data, context = {}) {
|
|
|
3125
3192
|
'parentKey',
|
|
3126
3193
|
'assetKind',
|
|
3127
3194
|
'assetKey',
|
|
3195
|
+
'assetType',
|
|
3196
|
+
'assetPath',
|
|
3197
|
+
'validationLegal',
|
|
3198
|
+
'conversionRequired',
|
|
3199
|
+
'converted',
|
|
3200
|
+
'conversionReason',
|
|
3128
3201
|
'actorKey',
|
|
3129
3202
|
'propKey',
|
|
3130
3203
|
'locationKey',
|