@lingjingai/lj-awb-cli-pre 0.4.7 → 0.4.9
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/README.md +14 -5
- package/build/volta-pre.mjs +64 -0
- package/install.mjs +11 -3
- package/package.json +4 -3
- package/packages/awb-cli/package.json +2 -2
- package/packages/awb-core/package.json +1 -2
- package/packages/awb-core/src/commands.js +10 -460
- package/packages/awb-core/src/output.js +5 -287
- package/packages/awb-core/src/services.js +119 -12
- package/packages/awb-core/src/standalone.js +20 -184
- package/packages/awb-core/src/update.js +74 -3
- package/skills/lj-awb/SKILL.md +13 -7
- package/skills/lj-awb/VERSION +1 -1
- package/skills/lj-awb/compat.json +3 -3
- package/skills/lj-awb/modules/account.md +2 -2
- package/skills/lj-awb/modules/create-contract.md +10 -8
- package/skills/lj-awb/modules/driver.md +4 -10
- package/skills/lj-awb/modules/evals.md +2 -2
- package/skills/lj-awb/modules/image.md +3 -3
- package/skills/lj-awb/modules/model.md +50 -1
- package/skills/lj-awb/modules/project.md +2 -2
- package/skills/lj-awb/modules/task-manual.md +3 -3
- package/skills/lj-awb/modules/task.md +1 -1
- package/skills/lj-awb/modules/video.md +3 -3
- package/skills/lj-awb/modules/workflows.md +1 -76
- package/skills/lj-awb/references/error-codes.md +1 -1
- package/skills/lj-awb/references/output-fields.md +4 -11
- package/packages/awb-core/src/artifact.js +0 -936
- package/skills/lj-awb/modules/artifact/asset.md +0 -64
- package/skills/lj-awb/modules/artifact/clip.md +0 -65
- package/skills/lj-awb/modules/artifact/script.md +0 -37
- package/skills/lj-awb/modules/artifact/video.md +0 -65
- package/skills/lj-awb/modules/artifact.md +0 -65
|
@@ -435,136 +435,6 @@ function normalizeList(data = {}, keys) {
|
|
|
435
435
|
});
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
-
function normalizeArtifactList(commandName, data) {
|
|
439
|
-
if (Array.isArray(data)) {
|
|
440
|
-
return compactRecord({ count: data.length, items: cleanNested(data) });
|
|
441
|
-
}
|
|
442
|
-
if (!isPlainObject(data)) return cleanNested(data);
|
|
443
|
-
const arrayKey = Object.keys(data).find((key) => Array.isArray(data[key]));
|
|
444
|
-
if (arrayKey) {
|
|
445
|
-
return compactRecord({
|
|
446
|
-
count: data.count ?? data[arrayKey].length,
|
|
447
|
-
[arrayKey]: cleanNested(data[arrayKey]),
|
|
448
|
-
...Object.fromEntries(
|
|
449
|
-
Object.entries(data)
|
|
450
|
-
.filter(([key]) => key !== arrayKey && key !== 'raw')
|
|
451
|
-
.map(([key, value]) => [key, cleanNested(value)]),
|
|
452
|
-
),
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
return cleanNested(data);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
function normalizeArtifactRecord(data) {
|
|
459
|
-
if (!isPlainObject(data)) return cleanNested(data);
|
|
460
|
-
const out = compactRecord({
|
|
461
|
-
id: data.id,
|
|
462
|
-
projectId: data.projectId,
|
|
463
|
-
rowKind: data.rowKind,
|
|
464
|
-
entityKey: data.entityKey,
|
|
465
|
-
parentKey: data.parentKey,
|
|
466
|
-
sortOrder: data.sortOrder,
|
|
467
|
-
actorKey: data.actorKey,
|
|
468
|
-
propKey: data.propKey,
|
|
469
|
-
locationKey: data.locationKey,
|
|
470
|
-
stateKey: data.stateKey,
|
|
471
|
-
episodeId: data.episodeId,
|
|
472
|
-
sceneId: data.sceneId,
|
|
473
|
-
clipId: data.clipId,
|
|
474
|
-
videoEpisodeId: data.videoEpisodeId,
|
|
475
|
-
status: data.status,
|
|
476
|
-
title: data.title,
|
|
477
|
-
name: data.name,
|
|
478
|
-
displayName: data.displayName,
|
|
479
|
-
description: data.description,
|
|
480
|
-
});
|
|
481
|
-
for (const [key, value] of Object.entries(data)) {
|
|
482
|
-
if (key in out) continue;
|
|
483
|
-
if (Array.isArray(value)) out[`${key}Count`] = value.length;
|
|
484
|
-
else if (!isPlainObject(value)) out[key] = value;
|
|
485
|
-
}
|
|
486
|
-
return cleanNested(out);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
function normalizeArtifactFull(data) {
|
|
490
|
-
if (!isPlainObject(data)) return cleanNested(data);
|
|
491
|
-
const out = compactRecord({
|
|
492
|
-
projectId: data.projectId,
|
|
493
|
-
id: data.id,
|
|
494
|
-
title: data.title,
|
|
495
|
-
status: data.status,
|
|
496
|
-
});
|
|
497
|
-
for (const [key, value] of Object.entries(data)) {
|
|
498
|
-
if (Array.isArray(value)) out[`${key}Count`] = value.length;
|
|
499
|
-
else if (isPlainObject(value)) {
|
|
500
|
-
const innerKey = Object.keys(value).find((k) => Array.isArray(value[k]));
|
|
501
|
-
if (innerKey) out[`${key}.${innerKey}Count`] = value[innerKey].length;
|
|
502
|
-
} else if (!(key in out)) out[key] = value;
|
|
503
|
-
}
|
|
504
|
-
return out;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
function normalizeArtifactImport(data = {}) {
|
|
508
|
-
if (!isPlainObject(data)) return cleanNested(data);
|
|
509
|
-
return compactRecord({
|
|
510
|
-
imported: data.imported,
|
|
511
|
-
dryRun: data.dryRun,
|
|
512
|
-
action: data.action,
|
|
513
|
-
projectId: data.projectId,
|
|
514
|
-
sourceFile: data.sourceFile,
|
|
515
|
-
inputDir: data.inputDir,
|
|
516
|
-
inputFile: data.inputFile,
|
|
517
|
-
rowCount: data.rowCount,
|
|
518
|
-
actorCount: data.actorCount,
|
|
519
|
-
propCount: data.propCount,
|
|
520
|
-
locationCount: data.locationCount,
|
|
521
|
-
episodeCount: data.episodeCount,
|
|
522
|
-
sceneCount: data.sceneCount,
|
|
523
|
-
clipCount: data.clipCount,
|
|
524
|
-
batchCount: Array.isArray(data.batch) ? data.batch.length : undefined,
|
|
525
|
-
rowsByKind: data.rowsByKind,
|
|
526
|
-
files: isPlainObject(data.files)
|
|
527
|
-
? compactRecord({
|
|
528
|
-
actors: data.files.actorsFile,
|
|
529
|
-
props: data.files.propsFile,
|
|
530
|
-
locations: data.files.locationsFile,
|
|
531
|
-
})
|
|
532
|
-
: undefined,
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
function normalizeArtifactWrite(data) {
|
|
537
|
-
if (!isPlainObject(data)) return cleanNested(data);
|
|
538
|
-
return normalizeArtifactRecord(data);
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
function normalizeArtifactDelete(data) {
|
|
542
|
-
if (!isPlainObject(data)) return cleanNested(data);
|
|
543
|
-
return compactRecord({
|
|
544
|
-
deleted: data.deleted ?? true,
|
|
545
|
-
action: data.action,
|
|
546
|
-
projectId: data.projectId,
|
|
547
|
-
key: data.key,
|
|
548
|
-
stateKey: data.stateKey,
|
|
549
|
-
episodeId: data.episodeId,
|
|
550
|
-
sceneId: data.sceneId,
|
|
551
|
-
clipId: data.clipId,
|
|
552
|
-
videoEpisodeId: data.videoEpisodeId,
|
|
553
|
-
rowKind: data.rowKind,
|
|
554
|
-
entityKey: data.entityKey,
|
|
555
|
-
});
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
function normalizeArtifactStatus(data) {
|
|
559
|
-
if (!isPlainObject(data)) return cleanNested(data);
|
|
560
|
-
return compactRecord({
|
|
561
|
-
updated: data.updated ?? true,
|
|
562
|
-
videoEpisodeId: data.videoEpisodeId ?? data.id,
|
|
563
|
-
status: data.status,
|
|
564
|
-
messageCount: Array.isArray(data.messages) ? data.messages.length : undefined,
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
|
|
568
438
|
export function normalizeOutputData(commandName, data) {
|
|
569
439
|
if (!isPlainObject(data)) return cleanNested(data);
|
|
570
440
|
switch (commandName) {
|
|
@@ -595,7 +465,7 @@ export function normalizeOutputData(commandName, data) {
|
|
|
595
465
|
case 'credits balance':
|
|
596
466
|
return normalizeCredits(data);
|
|
597
467
|
case 'project current':
|
|
598
|
-
case 'project
|
|
468
|
+
case 'project switch':
|
|
599
469
|
case 'project create':
|
|
600
470
|
case 'project update':
|
|
601
471
|
case 'project ensure':
|
|
@@ -645,88 +515,6 @@ export function normalizeOutputData(commandName, data) {
|
|
|
645
515
|
default:
|
|
646
516
|
break;
|
|
647
517
|
}
|
|
648
|
-
if (commandName?.startsWith('artifact ')) {
|
|
649
|
-
return normalizeArtifactByCommand(commandName, data);
|
|
650
|
-
}
|
|
651
|
-
return cleanNested(data);
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
const ARTIFACT_LIST_COMMANDS = new Set([
|
|
655
|
-
'artifact script rows',
|
|
656
|
-
'artifact script children',
|
|
657
|
-
'artifact asset actors',
|
|
658
|
-
'artifact asset props',
|
|
659
|
-
'artifact asset locations',
|
|
660
|
-
'artifact video episodes',
|
|
661
|
-
'artifact video scenes',
|
|
662
|
-
'artifact video clips',
|
|
663
|
-
'artifact clip episodes',
|
|
664
|
-
]);
|
|
665
|
-
|
|
666
|
-
const ARTIFACT_RECORD_COMMANDS = new Set([
|
|
667
|
-
'artifact script document',
|
|
668
|
-
'artifact script row',
|
|
669
|
-
'artifact asset actor',
|
|
670
|
-
'artifact asset prop',
|
|
671
|
-
'artifact asset location',
|
|
672
|
-
'artifact video episode',
|
|
673
|
-
'artifact video scene',
|
|
674
|
-
'artifact video clip',
|
|
675
|
-
'artifact clip episode',
|
|
676
|
-
'artifact clip episode-by-id',
|
|
677
|
-
]);
|
|
678
|
-
|
|
679
|
-
const ARTIFACT_FULL_COMMANDS = new Set([
|
|
680
|
-
'artifact script get',
|
|
681
|
-
'artifact asset get',
|
|
682
|
-
'artifact video get',
|
|
683
|
-
'artifact clip get',
|
|
684
|
-
]);
|
|
685
|
-
|
|
686
|
-
const ARTIFACT_IMPORT_COMMANDS = new Set([
|
|
687
|
-
'artifact script import',
|
|
688
|
-
'artifact asset import',
|
|
689
|
-
'artifact video import-storyboard',
|
|
690
|
-
'artifact clip upsert-batch',
|
|
691
|
-
]);
|
|
692
|
-
|
|
693
|
-
const ARTIFACT_WRITE_COMMANDS = new Set([
|
|
694
|
-
'artifact script upsert-row',
|
|
695
|
-
'artifact asset upsert-actor',
|
|
696
|
-
'artifact asset upsert-prop',
|
|
697
|
-
'artifact asset upsert-location',
|
|
698
|
-
'artifact asset upsert-actor-state',
|
|
699
|
-
'artifact asset upsert-prop-state',
|
|
700
|
-
'artifact asset upsert-location-state',
|
|
701
|
-
'artifact video upsert-episode',
|
|
702
|
-
'artifact video upsert-scene',
|
|
703
|
-
'artifact video upsert-clip',
|
|
704
|
-
'artifact video update-clip-urls',
|
|
705
|
-
'artifact clip upsert-episode',
|
|
706
|
-
]);
|
|
707
|
-
|
|
708
|
-
const ARTIFACT_DELETE_COMMANDS = new Set([
|
|
709
|
-
'artifact script delete-row',
|
|
710
|
-
'artifact asset delete-actor',
|
|
711
|
-
'artifact asset delete-prop',
|
|
712
|
-
'artifact asset delete-location',
|
|
713
|
-
'artifact asset delete-actor-state',
|
|
714
|
-
'artifact asset delete-prop-state',
|
|
715
|
-
'artifact asset delete-location-state',
|
|
716
|
-
'artifact video delete-episode',
|
|
717
|
-
'artifact video delete-scene',
|
|
718
|
-
'artifact video delete-clip',
|
|
719
|
-
'artifact clip delete-episode',
|
|
720
|
-
]);
|
|
721
|
-
|
|
722
|
-
function normalizeArtifactByCommand(commandName, data) {
|
|
723
|
-
if (ARTIFACT_LIST_COMMANDS.has(commandName)) return normalizeArtifactList(commandName, data);
|
|
724
|
-
if (ARTIFACT_RECORD_COMMANDS.has(commandName)) return normalizeArtifactRecord(data);
|
|
725
|
-
if (ARTIFACT_FULL_COMMANDS.has(commandName)) return normalizeArtifactFull(data);
|
|
726
|
-
if (ARTIFACT_IMPORT_COMMANDS.has(commandName)) return normalizeArtifactImport(data);
|
|
727
|
-
if (ARTIFACT_WRITE_COMMANDS.has(commandName)) return normalizeArtifactWrite(data);
|
|
728
|
-
if (ARTIFACT_DELETE_COMMANDS.has(commandName)) return normalizeArtifactDelete(data);
|
|
729
|
-
if (commandName === 'artifact clip update-status') return normalizeArtifactStatus(data);
|
|
730
518
|
return cleanNested(data);
|
|
731
519
|
}
|
|
732
520
|
|
|
@@ -1393,7 +1181,7 @@ const OUTPUT_KIND_BY_COMMAND = {
|
|
|
1393
1181
|
'account switch-team': 'generic',
|
|
1394
1182
|
'project list': 'project_list',
|
|
1395
1183
|
'project current': 'project_summary',
|
|
1396
|
-
'project
|
|
1184
|
+
'project switch': 'generic',
|
|
1397
1185
|
'project users': 'project_user_list',
|
|
1398
1186
|
'project create': 'generic',
|
|
1399
1187
|
'project update': 'generic',
|
|
@@ -1432,57 +1220,6 @@ const OUTPUT_KIND_BY_COMMAND = {
|
|
|
1432
1220
|
'create asset-group': 'asset_group_write_result',
|
|
1433
1221
|
'create asset-group-update': 'asset_group_write_result',
|
|
1434
1222
|
'create asset': 'asset_register_result',
|
|
1435
|
-
'artifact script get': 'artifact_full',
|
|
1436
|
-
'artifact script document': 'artifact_record',
|
|
1437
|
-
'artifact script rows': 'artifact_list',
|
|
1438
|
-
'artifact script row': 'artifact_record',
|
|
1439
|
-
'artifact script children': 'artifact_list',
|
|
1440
|
-
'artifact script upsert-row': 'artifact_write_result',
|
|
1441
|
-
'artifact script delete-row': 'artifact_delete_result',
|
|
1442
|
-
'artifact script import': 'artifact_import_result',
|
|
1443
|
-
'artifact asset get': 'artifact_full',
|
|
1444
|
-
'artifact asset actors': 'artifact_list',
|
|
1445
|
-
'artifact asset actor': 'artifact_record',
|
|
1446
|
-
'artifact asset props': 'artifact_list',
|
|
1447
|
-
'artifact asset prop': 'artifact_record',
|
|
1448
|
-
'artifact asset locations': 'artifact_list',
|
|
1449
|
-
'artifact asset location': 'artifact_record',
|
|
1450
|
-
'artifact asset upsert-actor': 'artifact_write_result',
|
|
1451
|
-
'artifact asset upsert-prop': 'artifact_write_result',
|
|
1452
|
-
'artifact asset upsert-location': 'artifact_write_result',
|
|
1453
|
-
'artifact asset upsert-actor-state': 'artifact_write_result',
|
|
1454
|
-
'artifact asset upsert-prop-state': 'artifact_write_result',
|
|
1455
|
-
'artifact asset upsert-location-state': 'artifact_write_result',
|
|
1456
|
-
'artifact asset delete-actor': 'artifact_delete_result',
|
|
1457
|
-
'artifact asset delete-prop': 'artifact_delete_result',
|
|
1458
|
-
'artifact asset delete-location': 'artifact_delete_result',
|
|
1459
|
-
'artifact asset delete-actor-state': 'artifact_delete_result',
|
|
1460
|
-
'artifact asset delete-prop-state': 'artifact_delete_result',
|
|
1461
|
-
'artifact asset delete-location-state': 'artifact_delete_result',
|
|
1462
|
-
'artifact asset import': 'artifact_import_result',
|
|
1463
|
-
'artifact video get': 'artifact_full',
|
|
1464
|
-
'artifact video episodes': 'artifact_list',
|
|
1465
|
-
'artifact video episode': 'artifact_record',
|
|
1466
|
-
'artifact video scenes': 'artifact_list',
|
|
1467
|
-
'artifact video scene': 'artifact_record',
|
|
1468
|
-
'artifact video clips': 'artifact_list',
|
|
1469
|
-
'artifact video clip': 'artifact_record',
|
|
1470
|
-
'artifact video upsert-episode': 'artifact_write_result',
|
|
1471
|
-
'artifact video upsert-scene': 'artifact_write_result',
|
|
1472
|
-
'artifact video upsert-clip': 'artifact_write_result',
|
|
1473
|
-
'artifact video update-clip-urls': 'artifact_write_result',
|
|
1474
|
-
'artifact video delete-episode': 'artifact_delete_result',
|
|
1475
|
-
'artifact video delete-scene': 'artifact_delete_result',
|
|
1476
|
-
'artifact video delete-clip': 'artifact_delete_result',
|
|
1477
|
-
'artifact video import-storyboard': 'artifact_import_result',
|
|
1478
|
-
'artifact clip get': 'artifact_full',
|
|
1479
|
-
'artifact clip episodes': 'artifact_list',
|
|
1480
|
-
'artifact clip episode': 'artifact_record',
|
|
1481
|
-
'artifact clip episode-by-id': 'artifact_record',
|
|
1482
|
-
'artifact clip upsert-episode': 'artifact_write_result',
|
|
1483
|
-
'artifact clip upsert-batch': 'artifact_import_result',
|
|
1484
|
-
'artifact clip update-status': 'artifact_status_update',
|
|
1485
|
-
'artifact clip delete-episode': 'artifact_delete_result',
|
|
1486
1223
|
'create subject-list': 'subject_list',
|
|
1487
1224
|
'create subject': 'subject_publish_result',
|
|
1488
1225
|
'create subject-wait': 'subject_status',
|
|
@@ -1495,13 +1232,6 @@ const OUTPUT_KIND_BY_COMMAND = {
|
|
|
1495
1232
|
|
|
1496
1233
|
const KIND_TITLES = {
|
|
1497
1234
|
account_summary: '账号概览',
|
|
1498
|
-
artifact_delete_result: '最终产物删除结果',
|
|
1499
|
-
artifact_full: '最终产物详情',
|
|
1500
|
-
artifact_import_result: '最终产物导入结果',
|
|
1501
|
-
artifact_list: '最终产物列表',
|
|
1502
|
-
artifact_record: '最终产物记录',
|
|
1503
|
-
artifact_status_update: '剪辑状态更新结果',
|
|
1504
|
-
artifact_write_result: '最终产物写入结果',
|
|
1505
1235
|
asset_group_detail: '素材组详情',
|
|
1506
1236
|
asset_group_list: '素材组列表',
|
|
1507
1237
|
asset_group_write_result: '素材组写入结果',
|
|
@@ -1552,7 +1282,7 @@ const COMMAND_TITLES = {
|
|
|
1552
1282
|
'auth clear': '清空认证结果',
|
|
1553
1283
|
'auth logout': '退出登录结果',
|
|
1554
1284
|
'account switch-team': '团队切换结果',
|
|
1555
|
-
'project
|
|
1285
|
+
'project switch': '项目组切换结果',
|
|
1556
1286
|
'project create': '项目组创建结果',
|
|
1557
1287
|
'project update': '项目组更新结果',
|
|
1558
1288
|
'project ensure': '项目组确保结果',
|
|
@@ -1757,12 +1487,6 @@ const FIELD_LABELS = {
|
|
|
1757
1487
|
|
|
1758
1488
|
const DETAIL_FIELDS_BY_KIND = {
|
|
1759
1489
|
account_summary: ['userId', 'userName', 'groupId', 'groupName', 'currentProjectGroupNo', 'currentProjectGroupName', 'billingPointBalance', 'projectBudgetBalance', 'projectBudgetMax'],
|
|
1760
|
-
artifact_delete_result: ['deleted', 'action', 'projectId', 'rowKind', 'entityKey', 'key', 'stateKey', 'episodeId', 'sceneId', 'clipId', 'videoEpisodeId'],
|
|
1761
|
-
artifact_full: ['projectId', 'id', 'title', 'status', 'rowCount', 'actorCount', 'propCount', 'locationCount', 'episodeCount', 'sceneCount', 'clipCount'],
|
|
1762
|
-
artifact_import_result: ['imported', 'dryRun', 'action', 'projectId', 'sourceFile', 'inputDir', 'inputFile', 'rowCount', 'actorCount', 'propCount', 'locationCount', 'episodeCount', 'sceneCount', 'clipCount', 'batchCount'],
|
|
1763
|
-
artifact_record: ['id', 'projectId', 'rowKind', 'entityKey', 'parentKey', 'actorKey', 'propKey', 'locationKey', 'stateKey', 'episodeId', 'sceneId', 'clipId', 'videoEpisodeId', 'status', 'title', 'name', 'displayName', 'description'],
|
|
1764
|
-
artifact_status_update: ['updated', 'videoEpisodeId', 'status', 'messageCount'],
|
|
1765
|
-
artifact_write_result: ['id', 'projectId', 'rowKind', 'entityKey', 'parentKey', 'actorKey', 'propKey', 'locationKey', 'stateKey', 'episodeId', 'sceneId', 'clipId', 'videoEpisodeId', 'status', 'title', 'name', 'displayName'],
|
|
1766
1490
|
asset_group_detail: ['groupId', 'platform', 'name', 'projectName', 'description', 'status', 'assetCount'],
|
|
1767
1491
|
asset_group_write_result: ['created', 'updated', 'groupId', 'platform', 'name', 'projectName', 'assetPath'],
|
|
1768
1492
|
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'],
|
|
@@ -1788,7 +1512,7 @@ const DETAIL_FIELDS_BY_KIND = {
|
|
|
1788
1512
|
subtitle_task_submission: ['submitted', 'taskId', 'taskType', 'sourceTaskId', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter', 'nextCommand'],
|
|
1789
1513
|
task_status: ['taskId', 'publicId', 'remoteTaskId', 'taskType', 'taskStatus', 'isTerminal', 'modelGroupCode', 'projectGroupNo', 'pointNo', 'gmtCreate', 'resultCount', 'errorMessage', 'timedOut', 'waitedMs'],
|
|
1790
1514
|
task_submission: ['taskId', 'taskType', 'objectName', 'modelGroupCode', 'projectGroupNo', 'pointNo', 'points', 'pointCost', 'billingPointBalance', 'billingPointRemainingAfter', 'projectBudgetBalance', 'projectBudgetMax', 'projectBudgetRemainingAfter', 'uploadCount', 'nextCommand', 'statusCommand'],
|
|
1791
|
-
update_result: ['checked', 'updated', 'updateAvailable', 'packageName', 'previousVersion', 'currentVersion', 'latestVersion', 'command', 'skillUpdated', 'restartRecommended', 'message'],
|
|
1515
|
+
update_result: ['checked', 'updated', 'updateAvailable', 'packageName', 'installer', 'previousVersion', 'currentVersion', 'latestVersion', 'command', 'skillUpdated', 'restartRecommended', 'message'],
|
|
1792
1516
|
upload_result: ['dryRun', 'fileCount', 'assetCount', 'localFileCount', 'resourceConversionCount'],
|
|
1793
1517
|
};
|
|
1794
1518
|
|
|
@@ -1796,7 +1520,7 @@ const DRY_RUN_FIELDS_BY_COMMAND = {
|
|
|
1796
1520
|
'auth login': ['dryRun', 'saved', 'verified', 'accessKey'],
|
|
1797
1521
|
'auth clear': ['dryRun', 'action', 'cleared'],
|
|
1798
1522
|
'account switch-team': ['dryRun', 'action', 'groupId', 'selected'],
|
|
1799
|
-
'project
|
|
1523
|
+
'project switch': ['dryRun', 'action', 'projectGroupNo', 'selected'],
|
|
1800
1524
|
'project create': ['dryRun', 'action', 'projectGroupName', 'point', 'memberCount', 'note'],
|
|
1801
1525
|
'project update': ['dryRun', 'action', 'projectGroupNo', 'projectGroupName', 'point', 'memberCount'],
|
|
1802
1526
|
'project ensure': ['dryRun', 'action', 'projectGroupName', 'point', 'memberCount', 'note'],
|
|
@@ -1815,15 +1539,9 @@ const DRY_RUN_FIELDS_BY_COMMAND = {
|
|
|
1815
1539
|
'create subject': ['dryRun', 'action', 'name', 'modelCode', 'elementFrontalImage', 'assetCount', 'localFileCount', 'nextRefSubject'],
|
|
1816
1540
|
'create subject-voice': ['dryRun', 'action', 'name', 'voiceName', 'voiceUrl', 'remoteUrl', 'remoteUpload', 'localFileCount', 'nextVoiceArg'],
|
|
1817
1541
|
'create subject-batch': ['dryRun', 'count', 'modelCode'],
|
|
1818
|
-
'artifact script import': ['dryRun', 'action', 'projectId', 'sourceFile', 'inputFile', 'rowCount', 'actorCount', 'episodeCount', 'sceneCount', 'clipCount'],
|
|
1819
|
-
'artifact asset import': ['dryRun', 'action', 'projectId', 'inputDir', 'actorCount', 'propCount', 'locationCount'],
|
|
1820
|
-
'artifact video import-storyboard': ['dryRun', 'action', 'projectId', 'inputFile', 'episodeId', 'sceneCount', 'clipCount'],
|
|
1821
|
-
'artifact clip upsert-batch': ['dryRun', 'action', 'projectId', 'episodeCount'],
|
|
1822
|
-
'artifact clip update-status': ['dryRun', 'action', 'projectId', 'videoEpisodeId', 'status', 'messageCount'],
|
|
1823
1542
|
};
|
|
1824
1543
|
|
|
1825
1544
|
const LIST_KEY_BY_KIND = {
|
|
1826
|
-
artifact_list: 'items',
|
|
1827
1545
|
asset_group_list: 'groups',
|
|
1828
1546
|
asset_match_list: 'matches',
|
|
1829
1547
|
asset_review_model_list: 'models',
|
|
@@ -746,13 +746,13 @@ export async function selectProjectGroupCommand(kwargs = {}) {
|
|
|
746
746
|
if (toBool(kwargs.dryRun)) {
|
|
747
747
|
return {
|
|
748
748
|
dryRun: true,
|
|
749
|
-
action: 'project
|
|
749
|
+
action: 'project switch',
|
|
750
750
|
selected: false,
|
|
751
751
|
request: { projectGroupNo },
|
|
752
752
|
};
|
|
753
753
|
}
|
|
754
754
|
ensureConfirmed(kwargs, '切换项目组会改变后续生成任务归属,需要确认', {
|
|
755
|
-
action: 'project
|
|
755
|
+
action: 'project switch',
|
|
756
756
|
projectGroupNo,
|
|
757
757
|
});
|
|
758
758
|
await awbApi.selectProjectGroup(projectGroupNo);
|
|
@@ -997,7 +997,6 @@ function modelListMetadata(kind, paramKeys = [], rulesByKey = new Map()) {
|
|
|
997
997
|
const controls = [];
|
|
998
998
|
if (keys.has('ratio')) controls.push('ratio');
|
|
999
999
|
if (keys.has('quality')) controls.push('quality');
|
|
1000
|
-
if (kind === 'image' && keys.has('generate_num')) controls.push('generateNum');
|
|
1001
1000
|
if (kind === 'video' && keys.has('generated_time')) controls.push('duration');
|
|
1002
1001
|
if (kind === 'video' && (keys.has('need_audio') || keys.has('audio'))) controls.push('needAudio');
|
|
1003
1002
|
return {
|
|
@@ -1032,6 +1031,14 @@ function modelSuccessRate(item = {}) {
|
|
|
1032
1031
|
);
|
|
1033
1032
|
}
|
|
1034
1033
|
|
|
1034
|
+
function modelParamEnumValues(rawOptions, paramKey) {
|
|
1035
|
+
const option = (Array.isArray(rawOptions) ? rawOptions : []).find((item) => item?.paramKey === paramKey);
|
|
1036
|
+
const list = Array.isArray(option?.optionList) ? option.optionList : [];
|
|
1037
|
+
return uniqueNonEmpty(list
|
|
1038
|
+
.filter((entry) => entry?.available !== false)
|
|
1039
|
+
.map((entry) => entry?.enumValue ?? entry?.value ?? entry?.enumName));
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1035
1042
|
function normalizeModelRows(payload, kind, options = {}) {
|
|
1036
1043
|
const includeRaw = Boolean(options.includeRaw);
|
|
1037
1044
|
const includeInternal = Boolean(options.includeInternal);
|
|
@@ -1058,6 +1065,10 @@ function normalizeModelRows(payload, kind, options = {}) {
|
|
|
1058
1065
|
feeCalcType: item?.feeCalcType ?? item?.feeType ?? null,
|
|
1059
1066
|
inputModes: metadata.inputModes,
|
|
1060
1067
|
params: metadata.controls,
|
|
1068
|
+
ratios: modelParamEnumValues(rawOptions, 'ratio'),
|
|
1069
|
+
qualities: modelParamEnumValues(rawOptions, 'quality'),
|
|
1070
|
+
durations: modelParamEnumValues(rawOptions, 'generated_time'),
|
|
1071
|
+
needAudio: metadata.controls.includes('needAudio'),
|
|
1061
1072
|
_searchText: JSON.stringify([
|
|
1062
1073
|
modelCode,
|
|
1063
1074
|
modelGroupCode,
|
|
@@ -1074,18 +1085,114 @@ function normalizeModelRows(payload, kind, options = {}) {
|
|
|
1074
1085
|
});
|
|
1075
1086
|
}
|
|
1076
1087
|
|
|
1088
|
+
const MODEL_USAGE_FAMILY = {
|
|
1089
|
+
image: { default: 'IMAGE_CREATE', allow: new Set(['IMAGE_CREATE', 'IMAGE_EDIT']) },
|
|
1090
|
+
video: { default: 'VIDEO_CREATE', allow: new Set(['VIDEO_CREATE']) },
|
|
1091
|
+
};
|
|
1092
|
+
|
|
1093
|
+
export function resolveModelUsage(kind, kwargs = {}) {
|
|
1094
|
+
const family = MODEL_USAGE_FAMILY[kind] ?? MODEL_USAGE_FAMILY.image;
|
|
1095
|
+
const explicit = trimToNull(kwargs.usage);
|
|
1096
|
+
if (!explicit) return family.default;
|
|
1097
|
+
const usage = explicit.toUpperCase();
|
|
1098
|
+
if (!family.allow.has(usage)) {
|
|
1099
|
+
throw argumentError(
|
|
1100
|
+
`不支持的 usage:${explicit}`,
|
|
1101
|
+
`${kind} 模型可选 usage:${[...family.allow].join(' / ')}。`,
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
return usage;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
export function buildModelFilters(kwargs = {}) {
|
|
1108
|
+
const keyword = trimToNull(kwargs.model ?? kwargs.keyword)?.toLowerCase() ?? null;
|
|
1109
|
+
const provider = trimToNull(kwargs.provider)?.toLowerCase() ?? null;
|
|
1110
|
+
const inputMode = trimToNull(kwargs.inputMode) ?? null;
|
|
1111
|
+
const supports = trimToNull(kwargs.supports) ?? null;
|
|
1112
|
+
const quality = trimToNull(kwargs.quality) ?? null;
|
|
1113
|
+
const ratio = trimToNull(kwargs.ratio) ?? null;
|
|
1114
|
+
const duration = trimToNull(kwargs.duration) ?? null;
|
|
1115
|
+
const needAudio = toBool(kwargs.needAudio) ? true : null;
|
|
1116
|
+
const applied = [];
|
|
1117
|
+
if (keyword) applied.push('keyword');
|
|
1118
|
+
if (provider) applied.push('provider');
|
|
1119
|
+
if (inputMode) applied.push('inputMode');
|
|
1120
|
+
if (supports) applied.push('supports');
|
|
1121
|
+
if (quality) applied.push('quality');
|
|
1122
|
+
if (ratio) applied.push('ratio');
|
|
1123
|
+
if (duration) applied.push('duration');
|
|
1124
|
+
if (needAudio) applied.push('needAudio');
|
|
1125
|
+
return { keyword, provider, inputMode, supports, quality, ratio, duration, needAudio, applied };
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
function includesCI(haystack, needle) {
|
|
1129
|
+
return String(haystack ?? '').toLowerCase().includes(needle);
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
function memberCI(list, value) {
|
|
1133
|
+
const target = String(value).toLowerCase();
|
|
1134
|
+
return (Array.isArray(list) ? list : []).some((item) => String(item).toLowerCase() === target);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
export function applyModelFilters(rows, filters = {}) {
|
|
1138
|
+
return (Array.isArray(rows) ? rows : []).filter((row) => {
|
|
1139
|
+
if (filters.keyword && !includesCI(row._searchText, filters.keyword)) return false;
|
|
1140
|
+
if (filters.provider && !includesCI(row.provider, filters.provider)) return false;
|
|
1141
|
+
if (filters.inputMode && !memberCI(row.inputModes, filters.inputMode)) return false;
|
|
1142
|
+
if (filters.supports && !memberCI(row.params, filters.supports)) return false;
|
|
1143
|
+
if (filters.quality && !memberCI(row.qualities, filters.quality)) return false;
|
|
1144
|
+
if (filters.ratio && !memberCI(row.ratios, filters.ratio)) return false;
|
|
1145
|
+
if (filters.duration && !memberCI(row.durations, filters.duration)) return false;
|
|
1146
|
+
if (filters.needAudio && row.needAudio !== true) return false;
|
|
1147
|
+
return true;
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
export function availableFilterValues(rows) {
|
|
1152
|
+
const list = Array.isArray(rows) ? rows : [];
|
|
1153
|
+
const providers = new Set();
|
|
1154
|
+
const inputModes = new Set();
|
|
1155
|
+
const supports = new Set();
|
|
1156
|
+
const qualities = new Set();
|
|
1157
|
+
const ratios = new Set();
|
|
1158
|
+
const durations = new Set();
|
|
1159
|
+
for (const row of list) {
|
|
1160
|
+
if (row.provider) providers.add(row.provider);
|
|
1161
|
+
for (const mode of row.inputModes || []) inputModes.add(mode);
|
|
1162
|
+
for (const param of row.params || []) supports.add(param);
|
|
1163
|
+
for (const q of row.qualities || []) qualities.add(q);
|
|
1164
|
+
for (const r of row.ratios || []) ratios.add(r);
|
|
1165
|
+
for (const d of row.durations || []) durations.add(d);
|
|
1166
|
+
}
|
|
1167
|
+
return {
|
|
1168
|
+
providers: [...providers],
|
|
1169
|
+
inputModes: [...inputModes],
|
|
1170
|
+
supports: [...supports],
|
|
1171
|
+
qualities: [...qualities],
|
|
1172
|
+
ratios: [...ratios],
|
|
1173
|
+
durations: [...durations],
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1077
1177
|
export async function listModels(kind, kwargs = {}) {
|
|
1078
|
-
const usage = kind
|
|
1178
|
+
const usage = resolveModelUsage(kind, kwargs);
|
|
1079
1179
|
const payload = await awbApi.fetchModelsByUsage(usage, {});
|
|
1080
|
-
const keyword = trimToNull(kwargs.model ?? kwargs.keyword)?.toLowerCase();
|
|
1081
1180
|
const includeRaw = toBool(kwargs.includeRaw);
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1181
|
+
const allRows = normalizeModelRows(payload, kind, { includeRaw });
|
|
1182
|
+
const filters = buildModelFilters(kwargs);
|
|
1183
|
+
const matched = applyModelFilters(allRows, filters);
|
|
1184
|
+
const models = matched.map(({ _searchText, _modelCode, ...item }) => item);
|
|
1185
|
+
const result = {
|
|
1186
|
+
usage,
|
|
1187
|
+
models,
|
|
1188
|
+
matchedCount: models.length,
|
|
1189
|
+
totalCount: allRows.length,
|
|
1190
|
+
filtersApplied: filters.applied,
|
|
1191
|
+
};
|
|
1192
|
+
if (models.length === 0 && allRows.length > 0) {
|
|
1193
|
+
result.availableValues = availableFilterValues(allRows);
|
|
1194
|
+
}
|
|
1195
|
+
return result;
|
|
1089
1196
|
}
|
|
1090
1197
|
|
|
1091
1198
|
function requireAssetPlatform(value, options = {}) {
|