@lingjingai/lj-awb-cli 0.3.14 → 0.3.15
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 +9 -2
- package/build/pre.mjs +72 -9
- package/build/prod.mjs +30 -4
- package/package.json +4 -2
- package/packages/awb-cli/package.json +2 -2
- package/packages/awb-core/package.json +2 -1
- package/packages/awb-core/src/artifact.js +867 -0
- package/packages/awb-core/src/commands.js +412 -2
- package/packages/awb-core/src/output.js +70 -0
- package/packages/awb-core/src/services.js +13 -1
- package/packages/awb-core/src/standalone.js +156 -5
- package/skills/lj-awb/SKILL.md +4 -3
- package/skills/lj-awb/VERSION +1 -1
- package/skills/lj-awb/compat.json +2 -2
- package/skills/lj-awb/modules/artifact.md +86 -0
- package/skills/lj-awb/modules/auth.md +2 -1
- package/skills/lj-awb/modules/create-contract.md +2 -2
- package/skills/lj-awb/modules/image.md +2 -0
- package/skills/lj-awb/modules/task-manual.md +9 -1
- package/skills/lj-awb/modules/upload.md +2 -0
- package/skills/lj-awb/modules/video.md +6 -4
- package/skills/lj-awb/modules/workflows.md +66 -0
|
@@ -13,6 +13,68 @@ function formatOptionName(value) {
|
|
|
13
13
|
return `--${String(value || '').replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`)}`;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
const OPTION_SYNONYMS = {
|
|
17
|
+
timeout: ['waitSeconds'],
|
|
18
|
+
deadline: ['waitSeconds'],
|
|
19
|
+
maxWait: ['waitSeconds'],
|
|
20
|
+
wait: ['waitSeconds'],
|
|
21
|
+
parallel: ['concurrency'],
|
|
22
|
+
workers: ['concurrency'],
|
|
23
|
+
jobs: ['concurrency'],
|
|
24
|
+
threads: ['concurrency'],
|
|
25
|
+
output: ['format'],
|
|
26
|
+
json: ['format'],
|
|
27
|
+
input: ['inputFile'],
|
|
28
|
+
in: ['inputFile'],
|
|
29
|
+
dry: ['dryRun'],
|
|
30
|
+
force: ['yes'],
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
function levenshtein(a, b) {
|
|
34
|
+
if (a === b) return 0;
|
|
35
|
+
const m = a.length;
|
|
36
|
+
const n = b.length;
|
|
37
|
+
if (!m) return n;
|
|
38
|
+
if (!n) return m;
|
|
39
|
+
let prev = Array.from({ length: n + 1 }, (_, j) => j);
|
|
40
|
+
let curr = new Array(n + 1);
|
|
41
|
+
for (let i = 1; i <= m; i++) {
|
|
42
|
+
curr[0] = i;
|
|
43
|
+
for (let j = 1; j <= n; j++) {
|
|
44
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
45
|
+
curr[j] = Math.min(prev[j] + 1, curr[j - 1] + 1, prev[j - 1] + cost);
|
|
46
|
+
}
|
|
47
|
+
[prev, curr] = [curr, prev];
|
|
48
|
+
}
|
|
49
|
+
return prev[n];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function suggestSimilarOptions(unknownKey, allowedKeys) {
|
|
53
|
+
const scored = new Map();
|
|
54
|
+
const record = (key, score) => {
|
|
55
|
+
if (!scored.has(key) || scored.get(key) > score) scored.set(key, score);
|
|
56
|
+
};
|
|
57
|
+
const synonyms = OPTION_SYNONYMS[unknownKey] || [];
|
|
58
|
+
for (const syn of synonyms) {
|
|
59
|
+
if (allowedKeys.includes(syn)) record(syn, -1);
|
|
60
|
+
}
|
|
61
|
+
for (const allowed of allowedKeys) {
|
|
62
|
+
const a = unknownKey.toLowerCase();
|
|
63
|
+
const b = allowed.toLowerCase();
|
|
64
|
+
if (b.includes(a) || a.includes(b)) {
|
|
65
|
+
record(allowed, 0);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const d = levenshtein(a, b);
|
|
69
|
+
const threshold = Math.max(2, Math.ceil(Math.min(a.length, b.length) / 3));
|
|
70
|
+
if (d <= threshold) record(allowed, d);
|
|
71
|
+
}
|
|
72
|
+
return [...scored.entries()]
|
|
73
|
+
.sort((x, y) => x[1] - y[1])
|
|
74
|
+
.slice(0, 3)
|
|
75
|
+
.map(([key]) => formatOptionName(key));
|
|
76
|
+
}
|
|
77
|
+
|
|
16
78
|
function commandPrefix() {
|
|
17
79
|
return process.env.LINGJING_AWB_COMMAND_PREFIX || 'lj-awb';
|
|
18
80
|
}
|
|
@@ -211,6 +273,7 @@ const GROUP_DESCRIPTIONS = {
|
|
|
211
273
|
video: '视频:估价、提交、批量提交、查询和去字幕',
|
|
212
274
|
task: '任务:任务列表、等待和本地任务台账',
|
|
213
275
|
asset: '资产:素材库匹配、素材组和素材注册',
|
|
276
|
+
artifact: '最终产物:Workbench 剧本、资产、视频 CRUD 与本地 JSON 导入',
|
|
214
277
|
subject: '主体:发布和查询可复用主体资产',
|
|
215
278
|
};
|
|
216
279
|
|
|
@@ -223,6 +286,7 @@ const GROUP_EXAMPLES = {
|
|
|
223
286
|
],
|
|
224
287
|
auth: [
|
|
225
288
|
'lj-awb auth status',
|
|
289
|
+
'lj-awb auth verify',
|
|
226
290
|
'lj-awb auth login-key --access-key <access-key>',
|
|
227
291
|
'LINGJING_AWB_ACCESS_KEY=<access-key> lj-awb auth login-key --from-env',
|
|
228
292
|
'lj-awb auth clear --dry-run',
|
|
@@ -272,6 +336,11 @@ const GROUP_EXAMPLES = {
|
|
|
272
336
|
'lj-awb asset match-actor --description "十八岁少女,古风" --tags-json \'{"gender":"女"}\'',
|
|
273
337
|
'lj-awb asset group-create --name "女主素材组" --dry-run',
|
|
274
338
|
],
|
|
339
|
+
artifact: [
|
|
340
|
+
'lj-awb artifact script import --project-id <projectId> --input-file 1_script/output/script.json --dry-run',
|
|
341
|
+
'lj-awb artifact asset import --project-id <projectId> --input-dir 2_asset/output --dry-run',
|
|
342
|
+
'lj-awb artifact video import-storyboard --project-id <projectId> --input-file 3_footage/output/ep001/ep001_storyboard.json --dry-run',
|
|
343
|
+
],
|
|
275
344
|
subject: [
|
|
276
345
|
'lj-awb subject list --name "女主"',
|
|
277
346
|
'lj-awb subject publish --name 女主 --primary-file ./three-view.png --dry-run',
|
|
@@ -299,6 +368,33 @@ const COMMAND_REQUIRED_OPTIONS = {
|
|
|
299
368
|
'asset group-create': ['name'],
|
|
300
369
|
'asset group-update': ['groupId'],
|
|
301
370
|
'asset register': ['groupId', 'name'],
|
|
371
|
+
'artifact script row': ['rowKind', 'entityKey'],
|
|
372
|
+
'artifact script children': ['parentKey'],
|
|
373
|
+
'artifact script delete-row': ['rowKind', 'entityKey'],
|
|
374
|
+
'artifact asset actor': ['actorKey'],
|
|
375
|
+
'artifact asset prop': ['propKey'],
|
|
376
|
+
'artifact asset location': ['locationKey'],
|
|
377
|
+
'artifact asset upsert-actor-state': ['actorKey'],
|
|
378
|
+
'artifact asset upsert-prop-state': ['propKey'],
|
|
379
|
+
'artifact asset upsert-location-state': ['locationKey'],
|
|
380
|
+
'artifact asset delete-actor': ['actorKey'],
|
|
381
|
+
'artifact asset delete-prop': ['propKey'],
|
|
382
|
+
'artifact asset delete-location': ['locationKey'],
|
|
383
|
+
'artifact asset delete-actor-state': ['actorKey', 'stateKey'],
|
|
384
|
+
'artifact asset delete-prop-state': ['propKey', 'stateKey'],
|
|
385
|
+
'artifact asset delete-location-state': ['locationKey', 'stateKey'],
|
|
386
|
+
'artifact video episode': ['episodeId'],
|
|
387
|
+
'artifact video scenes': ['episodeId'],
|
|
388
|
+
'artifact video scene': ['episodeId', 'sceneId'],
|
|
389
|
+
'artifact video clips': ['episodeId', 'sceneId'],
|
|
390
|
+
'artifact video clip': ['episodeId', 'sceneId', 'clipId'],
|
|
391
|
+
'artifact video upsert-scene': ['episodeId'],
|
|
392
|
+
'artifact video upsert-clip': ['episodeId', 'sceneId'],
|
|
393
|
+
'artifact video update-clip-video-urls': ['episodeId', 'sceneId', 'clipId', 'videoUrlsJson'],
|
|
394
|
+
'artifact video delete-episode': ['episodeId'],
|
|
395
|
+
'artifact video delete-scene': ['episodeId', 'sceneId'],
|
|
396
|
+
'artifact video delete-clip': ['episodeId', 'sceneId', 'clipId'],
|
|
397
|
+
'artifact video import-storyboard': ['inputFile'],
|
|
302
398
|
'subject publish': ['name'],
|
|
303
399
|
'subject wait': ['elementId'],
|
|
304
400
|
'subject publish-batch': ['inputFile'],
|
|
@@ -312,9 +408,48 @@ const COMMAND_REQUIRED_ANY_OPTIONS = {
|
|
|
312
408
|
'video create': [['prompt', 'resource', 'resourcesJson']],
|
|
313
409
|
'asset group-update': [['name', 'description', 'projectName']],
|
|
314
410
|
'asset register': [['file', 'url', 'backendPath']],
|
|
411
|
+
'artifact script upsert-row': [['bodyJson', 'inputFile']],
|
|
412
|
+
'artifact asset upsert-actor': [['bodyJson', 'inputFile']],
|
|
413
|
+
'artifact asset upsert-prop': [['bodyJson', 'inputFile']],
|
|
414
|
+
'artifact asset upsert-location': [['bodyJson', 'inputFile']],
|
|
415
|
+
'artifact asset upsert-actor-state': [['bodyJson', 'inputFile']],
|
|
416
|
+
'artifact asset upsert-prop-state': [['bodyJson', 'inputFile']],
|
|
417
|
+
'artifact asset upsert-location-state': [['bodyJson', 'inputFile']],
|
|
418
|
+
'artifact video upsert-episode': [['bodyJson', 'inputFile']],
|
|
419
|
+
'artifact video upsert-scene': [['bodyJson', 'inputFile']],
|
|
420
|
+
'artifact video upsert-clip': [['bodyJson', 'inputFile']],
|
|
315
421
|
'subject publish': [['primaryFile', 'primaryUrl', 'threeViewFile', 'threeViewUrl']],
|
|
316
422
|
};
|
|
317
423
|
|
|
424
|
+
const ARTIFACT_WRITE_COMMANDS = [
|
|
425
|
+
'artifact script upsert-row',
|
|
426
|
+
'artifact script delete-row',
|
|
427
|
+
'artifact script import',
|
|
428
|
+
'artifact asset upsert-actor',
|
|
429
|
+
'artifact asset upsert-prop',
|
|
430
|
+
'artifact asset upsert-location',
|
|
431
|
+
'artifact asset upsert-actor-state',
|
|
432
|
+
'artifact asset upsert-prop-state',
|
|
433
|
+
'artifact asset upsert-location-state',
|
|
434
|
+
'artifact asset delete-actor',
|
|
435
|
+
'artifact asset delete-prop',
|
|
436
|
+
'artifact asset delete-location',
|
|
437
|
+
'artifact asset delete-actor-state',
|
|
438
|
+
'artifact asset delete-prop-state',
|
|
439
|
+
'artifact asset delete-location-state',
|
|
440
|
+
'artifact asset import',
|
|
441
|
+
'artifact video upsert-episode',
|
|
442
|
+
'artifact video upsert-scene',
|
|
443
|
+
'artifact video upsert-clip',
|
|
444
|
+
'artifact video update-clip-video-urls',
|
|
445
|
+
'artifact video delete-episode',
|
|
446
|
+
'artifact video delete-scene',
|
|
447
|
+
'artifact video delete-clip',
|
|
448
|
+
'artifact video import-storyboard',
|
|
449
|
+
];
|
|
450
|
+
|
|
451
|
+
const ARTIFACT_DELETE_COMMANDS = ARTIFACT_WRITE_COMMANDS.filter((name) => name.includes(' delete-'));
|
|
452
|
+
|
|
318
453
|
const CONFIRMATION_COMMANDS = new Set([
|
|
319
454
|
'auth clear',
|
|
320
455
|
'account switch-team',
|
|
@@ -330,6 +465,7 @@ const CONFIRMATION_COMMANDS = new Set([
|
|
|
330
465
|
'asset group-create',
|
|
331
466
|
'asset group-update',
|
|
332
467
|
'asset register',
|
|
468
|
+
...ARTIFACT_WRITE_COMMANDS,
|
|
333
469
|
'subject publish',
|
|
334
470
|
'subject publish-batch',
|
|
335
471
|
]);
|
|
@@ -356,6 +492,7 @@ const REMOTE_WRITE_COMMANDS = new Set([
|
|
|
356
492
|
'asset group-create',
|
|
357
493
|
'asset group-update',
|
|
358
494
|
'asset register',
|
|
495
|
+
...ARTIFACT_WRITE_COMMANDS,
|
|
359
496
|
'subject publish',
|
|
360
497
|
'subject publish-batch',
|
|
361
498
|
]);
|
|
@@ -368,7 +505,7 @@ const LOCAL_STATE_WRITE_COMMANDS = new Set([
|
|
|
368
505
|
'project ensure',
|
|
369
506
|
]);
|
|
370
507
|
|
|
371
|
-
const DESTRUCTIVE_COMMANDS = new Set(['auth clear']);
|
|
508
|
+
const DESTRUCTIVE_COMMANDS = new Set(['auth clear', ...ARTIFACT_DELETE_COMMANDS]);
|
|
372
509
|
const LONG_RUNNING_COMMANDS = new Set(['task wait', 'task record-poll', 'subject wait']);
|
|
373
510
|
const NETWORK_NONE_COMMANDS = new Set(['schema', 'auth status', 'auth clear', 'model input-guide', 'task records']);
|
|
374
511
|
const NETWORK_CONDITIONAL_COMMANDS = new Set(['doctor', 'auth login-key']);
|
|
@@ -377,6 +514,7 @@ const OUTPUT_KIND_BY_COMMAND = {
|
|
|
377
514
|
doctor: 'environment_report',
|
|
378
515
|
schema: 'command_schema',
|
|
379
516
|
'auth status': 'auth_status',
|
|
517
|
+
'auth verify': 'auth_status',
|
|
380
518
|
'auth login-key': 'auth_result',
|
|
381
519
|
'account info': 'account_summary',
|
|
382
520
|
'account teams': 'team_list',
|
|
@@ -498,7 +636,7 @@ function buildCommandSafety(command, optionKeys) {
|
|
|
498
636
|
}
|
|
499
637
|
|
|
500
638
|
function buildCommandWorkflow(command) {
|
|
501
|
-
const outputKind = OUTPUT_KIND_BY_COMMAND[command.name] || 'generic';
|
|
639
|
+
const outputKind = OUTPUT_KIND_BY_COMMAND[command.name] || (commandGroup(command) === 'artifact' ? 'artifact_result' : 'generic');
|
|
502
640
|
const next = [];
|
|
503
641
|
if (['image create', 'video create'].includes(command.name)) {
|
|
504
642
|
next.push('读取 data.taskId 和 data.nextCommand', '运行 task wait 等待结果');
|
|
@@ -511,7 +649,7 @@ function buildCommandWorkflow(command) {
|
|
|
511
649
|
}
|
|
512
650
|
return {
|
|
513
651
|
outputKind,
|
|
514
|
-
recommendedPreflight: PREFLIGHTS_BY_COMMAND[command.name] || [],
|
|
652
|
+
recommendedPreflight: PREFLIGHTS_BY_COMMAND[command.name] || (ARTIFACT_WRITE_COMMANDS.includes(command.name) ? [`${command.name} --dry-run`] : []),
|
|
515
653
|
nextActions: next,
|
|
516
654
|
};
|
|
517
655
|
}
|
|
@@ -627,6 +765,7 @@ function buildCommandSchema(commands, kwargs = {}, version = 'unknown') {
|
|
|
627
765
|
.sort((a, b) => a.name.localeCompare(b.name)),
|
|
628
766
|
commands: filteredCommands.map((command) => {
|
|
629
767
|
const requiredOptions = new Set(COMMAND_REQUIRED_OPTIONS[command.name] || []);
|
|
768
|
+
if (commandGroup(command) === 'artifact') requiredOptions.add('projectId');
|
|
630
769
|
const requiredAnyOptions = COMMAND_REQUIRED_ANY_OPTIONS[command.name] || [];
|
|
631
770
|
const optionKeys = new Set((command.args || []).map((arg) => normalizeKey(arg.name)));
|
|
632
771
|
return {
|
|
@@ -760,16 +899,28 @@ function printCommandHelp(command) {
|
|
|
760
899
|
}
|
|
761
900
|
|
|
762
901
|
function validateCommandOptions(command, kwargs) {
|
|
763
|
-
const
|
|
902
|
+
const allowedKeys = (command.args || []).map((arg) => normalizeKey(arg.name));
|
|
903
|
+
const allowed = new Set(allowedKeys);
|
|
764
904
|
const unknown = Object.keys(kwargs).filter((key) => !allowed.has(key));
|
|
765
905
|
if (!unknown.length) return;
|
|
906
|
+
const suggestions = {};
|
|
907
|
+
for (const unk of unknown) {
|
|
908
|
+
const matches = suggestSimilarOptions(unk, allowedKeys);
|
|
909
|
+
if (matches.length) suggestions[formatOptionName(unk)] = matches;
|
|
910
|
+
}
|
|
911
|
+
const baseHint = `运行 ${commandPrefix()} ${command.name} -h 查看可用参数。`;
|
|
912
|
+
const suggestionParts = Object.entries(suggestions).map(([opt, matches]) => `${opt} → ${matches.join(' / ')}`);
|
|
913
|
+
const hint = suggestionParts.length
|
|
914
|
+
? `你是不是想用:${suggestionParts.join(';')}?否则 ${baseHint}`
|
|
915
|
+
: baseHint;
|
|
766
916
|
throw new LingjingAwbCliError(`未知参数:${unknown.map(formatOptionName).join(', ')}`, {
|
|
767
917
|
type: 'unknown_option',
|
|
768
918
|
exitCode: 2,
|
|
769
|
-
hint
|
|
919
|
+
hint,
|
|
770
920
|
details: {
|
|
771
921
|
command: command.name,
|
|
772
922
|
unknownOptions: unknown.map(formatOptionName),
|
|
923
|
+
...(Object.keys(suggestions).length ? { suggestions } : {}),
|
|
773
924
|
},
|
|
774
925
|
});
|
|
775
926
|
}
|
package/skills/lj-awb/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lj-awb
|
|
3
|
-
version: 0.3.
|
|
4
|
-
description: "灵境 AWB CLI skill。使用 `lj-awb` 命令调用动漫平台 / AWB
|
|
3
|
+
version: 0.3.15
|
|
4
|
+
description: "灵境 AWB CLI skill。使用 `lj-awb` 命令调用动漫平台 / AWB 云端能力,覆盖认证、项目组、积分、模型发现、上传、生图、生视频、任务查询、最终产物 artifact CRUD 与 E2B 输出导入。正式生成、切换项目组、清空认证、artifact 写入等写入或扣费动作前必须确认。"
|
|
5
5
|
metadata:
|
|
6
6
|
requires:
|
|
7
7
|
bins: ["lj-awb"]
|
|
@@ -43,6 +43,7 @@ fi
|
|
|
43
43
|
| 视频 | 生视频估价、提交、等待、批量 | [`modules/video.md`](modules/video.md) |
|
|
44
44
|
| 任务 | 任务列表、等待、任务台账 | [`modules/task.md`](modules/task.md) |
|
|
45
45
|
| 资产 | 素材匹配、素材组、素材注册 | [`modules/asset.md`](modules/asset.md) |
|
|
46
|
+
| 最终产物 | Workbench 剧本、资产、视频 CRUD 与 E2B 输出导入 | [`modules/artifact.md`](modules/artifact.md) |
|
|
46
47
|
| 主体 | 可复用主体资产发布与查询 | [`modules/subject.md`](modules/subject.md) |
|
|
47
48
|
| 工作流 | Agent 面向任务的标准编排流程 | [`modules/workflows.md`](modules/workflows.md) |
|
|
48
49
|
| 压测 | 多轮对话 eval 用例和反模式检查 | [`modules/evals.md`](modules/evals.md) |
|
|
@@ -59,7 +60,7 @@ fi
|
|
|
59
60
|
- Agent 不确定命令参数时,优先运行 `lj-awb schema -f json`,不要从记忆里猜。
|
|
60
61
|
- 读取 `schema.commands[].requiredOptions` 和 `requiredAnyOptions` 后再组装命令;缺少必填参数时先问用户或用查询命令补齐。
|
|
61
62
|
- 读取 `schema.commands[].safety` 决定是否能自动执行:`safeToAutoRun=false` 时必须说明影响;`requiresConfirmation=true` 时必须先确认再追加 `--yes`。
|
|
62
|
-
- 只读验证命令可以先执行,包括 `doctor --verify`、模型列表、`model options`、`model create-spec`、账号和项目组查询;`fee` 和 `create --dry-run` 必须等缺失关键参数确认后再跑。
|
|
63
|
+
- 只读验证命令可以先执行,包括 `auth verify`、`doctor --verify`、模型列表、`model options`、`model create-spec`、账号和项目组查询;`auth status` 只看本地配置,不代表远端有效;`fee` 和 `create --dry-run` 必须等缺失关键参数确认后再跑。
|
|
63
64
|
- 关键参数是会影响价格或生成效果的枚举:视频 `quality`、`duration`、约束后仍可选的 `ratio`,以及用户明确要输出音效时的 `needAudio`;图片 `quality`、`ratio`、`generateNum`。候选值和默认值来自 `model options.params[]`,不能静默用默认值先估价或 dry-run。
|
|
64
65
|
- 写入 / 扣费命令如果 `supportsDryRun=true`,在关键参数已确认后跑 `--dry-run` 给用户确认请求体。
|
|
65
66
|
- 进入正式任务前先运行 `lj-awb doctor --verify`,确认认证、API、项目组和 UTF-8 环境。
|
package/skills/lj-awb/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.15
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Artifact Module
|
|
2
|
+
|
|
3
|
+
artifact 模块用于把 E2B / 本地流水线产出的最终 JSON 写入 Workbench 数据库化产物,也可直接查询或单条 CRUD。写入都是云端动作,必须先 dry-run,再经用户确认后追加 `--yes`。
|
|
4
|
+
|
|
5
|
+
## 项目 ID
|
|
6
|
+
|
|
7
|
+
所有 artifact 命令都需要 `--project-id <id>`。在 E2B 沙箱里通常从环境变量读取:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
PROJECT_ID="${SANDBOX_PROJECT_ID:?missing SANDBOX_PROJECT_ID}"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 标准导入
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
lj-awb artifact script import \
|
|
17
|
+
--project-id "$PROJECT_ID" \
|
|
18
|
+
--input-file 1_script/output/script.json \
|
|
19
|
+
--dry-run
|
|
20
|
+
|
|
21
|
+
lj-awb artifact asset import \
|
|
22
|
+
--project-id "$PROJECT_ID" \
|
|
23
|
+
--input-dir 2_asset/output \
|
|
24
|
+
--dry-run
|
|
25
|
+
|
|
26
|
+
lj-awb artifact video import-storyboard \
|
|
27
|
+
--project-id "$PROJECT_ID" \
|
|
28
|
+
--input-file 3_footage/output/ep001/ep001_storyboard.json \
|
|
29
|
+
--dry-run
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
用户确认后,把对应命令的 `--dry-run` 替换为 `--yes`。批量 storyboard 需要逐个 episode 文件执行 `artifact video import-storyboard`。
|
|
33
|
+
|
|
34
|
+
## 查询命令
|
|
35
|
+
|
|
36
|
+
| 命令 | 用途 |
|
|
37
|
+
|------|------|
|
|
38
|
+
| `lj-awb artifact script get --project-id <id>` | 查询完整剧本产物 |
|
|
39
|
+
| `lj-awb artifact script rows --project-id <id> --row-kind scene` | 查询剧本行 |
|
|
40
|
+
| `lj-awb artifact script row --project-id <id> --row-kind action --entity-key "ep_001/scn_001#0"` | 查询单行 |
|
|
41
|
+
| `lj-awb artifact asset actors --project-id <id> --include-states true` | 查询角色资产 |
|
|
42
|
+
| `lj-awb artifact asset props --project-id <id>` | 查询道具资产 |
|
|
43
|
+
| `lj-awb artifact asset locations --project-id <id>` | 查询场景资产 |
|
|
44
|
+
| `lj-awb artifact video episodes --project-id <id>` | 查询视频集 |
|
|
45
|
+
| `lj-awb artifact video clips --project-id <id> --episode-id ep_001 --scene-id scn_001` | 查询某场 clips |
|
|
46
|
+
|
|
47
|
+
## 单条写入
|
|
48
|
+
|
|
49
|
+
单条 upsert 可用 `--body-json` 或 `--input-file` 传 camelCase body:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
lj-awb artifact script upsert-row --project-id <id> --input-file row.json --dry-run
|
|
53
|
+
lj-awb artifact asset upsert-actor --project-id <id> --input-file actor.json --dry-run
|
|
54
|
+
lj-awb artifact asset upsert-actor-state --project-id <id> --actor-key act_001 --input-file state.json --dry-run
|
|
55
|
+
lj-awb artifact video upsert-clip --project-id <id> --episode-id ep_001 --scene-id scn_001 --input-file clip.json --dry-run
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
视频生成完成后,只回写 clip 链接:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
lj-awb artifact video update-clip-video-urls \
|
|
62
|
+
--project-id <id> \
|
|
63
|
+
--episode-id ep_001 \
|
|
64
|
+
--scene-id scn_001 \
|
|
65
|
+
--clip-id clip_001 \
|
|
66
|
+
--video-urls-json '["https://example.com/a.mp4"]' \
|
|
67
|
+
--dry-run
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 删除
|
|
71
|
+
|
|
72
|
+
删除命令都是逻辑删除,并且需要确认:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
lj-awb artifact script delete-row --project-id <id> --row-kind action --entity-key "ep_001/scn_001#0" --dry-run
|
|
76
|
+
lj-awb artifact asset delete-actor --project-id <id> --actor-key act_001 --dry-run
|
|
77
|
+
lj-awb artifact video delete-clip --project-id <id> --episode-id ep_001 --scene-id scn_001 --clip-id clip_001 --dry-run
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## 规则
|
|
81
|
+
|
|
82
|
+
- 不确定命令参数时先读 `lj-awb schema --domain artifact -f json`。
|
|
83
|
+
- `script import` 会把 `script.json` 拆成 `document / asset / state / speaker / episode / scene / action` 行。
|
|
84
|
+
- `asset import` 默认在 `--input-dir` 下查找 `actors/actors.json`、`props/props.json`、`locations/locations.json`,也兼容扁平 `actors.json` 等文件。
|
|
85
|
+
- `video import-storyboard` 会写入 episode、scenes 和 clips;`episodeId` 优先取 JSON 字段,否则从 `ep001_storyboard.json` 文件名推断。
|
|
86
|
+
- 单条 body 使用 Workbench 接口 camelCase 字段,不要传数据库内部 `id`、`projectId`、`createdAt`、`updatedAt`、`isDeleted`。
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
| 命令 | 用途 |
|
|
8
8
|
|------|------|
|
|
9
9
|
| `lj-awb auth status` | 查看本地是否有 access key |
|
|
10
|
+
| `lj-awb auth verify` | 联网校验 access key 是否远端有效 |
|
|
10
11
|
| `lj-awb account info` | 联网确认 access key 有效,并查看当前用户 / 团队 / 项目组 |
|
|
11
12
|
| `lj-awb doctor --verify` | 联网体检认证、API、项目组和运行环境 |
|
|
12
13
|
| `lj-awb auth login-key --access-key <key>` | 校验并保存 access key |
|
|
@@ -19,5 +20,5 @@
|
|
|
19
20
|
|
|
20
21
|
- 自动化环境优先使用 `LINGJING_AWB_ACCESS_KEY`,兼容 `AWB_ACCESS_KEY` / `AWB_CODE` / `ANIME_ACCESS_KEY`。
|
|
21
22
|
- 不要把 access key 明文写入对话、日志、文档或任务台账。
|
|
22
|
-
- `auth status` 只读本地配置;正式创作前用 `account info` 或 `doctor --verify` 确认远端可用。
|
|
23
|
+
- `auth status` 只读本地配置;正式创作前用 `auth verify`、`account info` 或 `doctor --verify` 确认远端可用。
|
|
23
24
|
- `auth clear` 是本地破坏性动作,必须先确认或 dry-run。
|
|
@@ -54,11 +54,11 @@ JSON 语法:
|
|
|
54
54
|
|
|
55
55
|
- 图片生图一次性参考图只用 `image:reference=...`,不传 `reference_key`,prompt 中也不写 `<<<key>>>`;用“图一 / 图二 / 参考图 / 白发女 / 背景图”等自然语言指代。
|
|
56
56
|
- 视频 reference 的 `reference_key` 用于和 prompt 中的 `<<<key>>>` 对齐,例如 `<<<hero>>>`;这是可选绑定,prompt 不写占位符时资源可以不带 key。
|
|
57
|
-
- 视频一次性参考图用 `image:reference=...`;需要在 prompt 中明确绑定对象时才用 `image:reference:<key
|
|
57
|
+
- 视频一次性参考图用 `image:reference=...`;需要在 prompt 中明确绑定对象时才用 `image:reference:<key>=...`。取值优先级:平台素材的 `backendPath`(`material/...`) > 本地文件路径 > 真正外部公网完整 URL;视频参考生还可使用普通素材 `asset:<assetId>`。**不要把 `lj-awb upload files` 回显的 `url`(`https://*.myqcloud.com/material/...`)当作 source.value 直接复用,应改用 `backendPath`。**
|
|
58
58
|
- 参考音频 / 音乐 / 配音只有在 `model options.resources[]` 暴露 `media=AUDIO usage=reference` 时,才可用 `audio:reference=...` 或 `audio:reference:<key>=...`;这会进入 `multi_param` 参考资源,不要改成 `--need-audio`。
|
|
59
59
|
- 用户明确要求在 prompt 中指代音频时,可以使用 `audio:reference:<key>=...` 并在 prompt 中插入同名 `<<<key>>>`。
|
|
60
60
|
- 可长期复用角色用 `subject publish` 生成主体,再用 `subject:reference:<key>=asset:<externalId>`。
|
|
61
|
-
- 首尾帧用 `image:first_frame=...` / `image:last_frame
|
|
61
|
+
- 首尾帧用 `image:first_frame=...` / `image:last_frame=...`;取值优先级与参考图一致:`backendPath` > 本地文件 > 真正外部公网完整 URL,也可以是 `asset:<assetId>`。
|
|
62
62
|
- `image:last_frame` 默认和 `image:first_frame` 成对使用;只有模型资源约束声明 `supportLastFrameOnly=true` 时才可仅传尾帧。
|
|
63
63
|
- `subject:reference:<key>=asset:<externalId>` 表示主体引用;`image:first_frame=asset:<assetId>` 表示首尾帧资产,两者语义不同,不要混用。
|
|
64
64
|
|
|
@@ -57,10 +57,12 @@ lj-awb image create \
|
|
|
57
57
|
- 不要提交 `generated_time`、`iref`、`frames`、`multi_param`、`generated_mode` 这类平台旧字段。
|
|
58
58
|
- `--prompt` 的重点是组装资源、参数和模型约束;用户没有明确需求时不要主动编内容补空白,用户要求优化时再做提示词创作。
|
|
59
59
|
- 参考素材统一使用 `--resource image:reference=...` 或 `--resources-json`。
|
|
60
|
+
- 参考图取值优先级:**平台素材的 `backendPath`(`material/...`) > 本地文件路径 > 真正外部公网完整 URL**。`lj-awb upload files` 回显的 `backendPath`、历史任务结果里的 COS 对象路径,都必须用 `backendPath` 形式传入;不要把回显的 `url`(`https://*.myqcloud.com/material/...`)当作 source.value 直接复用。
|
|
60
61
|
- 生图参考资源不使用 `reference_key`,不要写 `image:reference:<key>=...`,也不要在 prompt 中插入 `<<<key>>>`。
|
|
61
62
|
- 多张参考图用资源顺序和自然语言描述映射,例如“图一中的白发女保持表情,在图二背景里坐秋千”。
|
|
62
63
|
- `ratio` / `quality` / `generate-num` 不确定时,先查 `model options`,不要猜一个模型不支持的值。
|
|
63
64
|
- `fee` 和 `create --dry-run` 前必须确认缺失的 `ratio`、`quality`、`generate-num`;不要静默用默认值估价。用户说“按默认”后才继续。
|
|
64
65
|
- 正式提交必须带 `--yes`;如果需要看请求体,先用 `--dry-run`。
|
|
65
66
|
- 批量 JSON/JSONL 每项只写 `prompt`、`ratio`、`quality`、`generate_num`、`resources`、`resource`、`customBizId`;模型组和项目组放命令行公共参数。
|
|
67
|
+
- **多镜头 / 多 prompt 时主动建议并行**:用户一次给出 ≥2 个同模型同参数的图片任务(典型场景:分镜、组图、多 prompt 候选)时,Agent 必须先告知"这批可以用 `image create-batch --concurrency N` 并行执行(n 个任务,预计耗时 / 单次估价 × n)",并询问用户是否要并行。用户同意 → 走 batch;用户希望逐条审稿 / 调 prompt → 继续单条 create。**不要默认一条一条串行还不告知**,这种沉默会浪费用户时间。
|
|
66
68
|
- 等待超时只代表本轮轮询结束,不能对用户说任务失败。
|
|
@@ -33,7 +33,15 @@
|
|
|
33
33
|
| 固定角色长期复用 | `subject publish` -> `subject wait` -> `--resource subject:reference:<key>=asset:<externalId>` | key 必填;是否写入 prompt 取决于用户表达 | `subject` + `video create` |
|
|
34
34
|
| 参考图生图 | `--resource image:reference=<source>` | 不使用 key / `<<<>>>`;用“图一 / 图二 / 参考图 / 主体”等自然语言指代 | `image create` |
|
|
35
35
|
|
|
36
|
-
`<source>`
|
|
36
|
+
`<source>` 可以是本地文件、material backendPath、完整 URL,或普通素材 `asset:<assetId>`;主体引用的 `asset:<externalId>` 只用于 `subject:reference`。
|
|
37
|
+
|
|
38
|
+
`<source>` 优先级(**Agent 必须遵守**):
|
|
39
|
+
|
|
40
|
+
1. **平台已有素材** → 一律使用 `backendPath`(`material/...` 或 `/material/...`)。`lj-awb upload files` 返回的 `backendPath`、历史任务结果里的 COS 对象路径都属于这一类。
|
|
41
|
+
2. **本地文件** → 直接传文件路径,CLI 会自动上传并改写为 `backendPath`。
|
|
42
|
+
3. **真正外部公网素材** → 才用完整 https URL(例如用户自己贴的第三方域名链接)。
|
|
43
|
+
|
|
44
|
+
不要把上传命令回显的 `url`(`https://*.myqcloud.com/material/...`)当作 `source.value` 重新塞回任务请求 — CLI 虽然会做自愈剥离,但请求体冗余且容易在跨命令复制时出错。
|
|
37
45
|
|
|
38
46
|
## 参考图生图
|
|
39
47
|
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
## 规则
|
|
14
14
|
|
|
15
15
|
- 上传命令返回 `backendPath`、`url`、`mimeType`、`size`、`width`、`height`。
|
|
16
|
+
- 后续任务的 `source.value` 一律使用 `backendPath`(例如 `material/...` 或 `/material/...`),**不要使用回显的 `url` 字段**。`url` 只是用于人工预览,把完整 `https://*.myqcloud.com/...` 直接塞回任务请求会让请求体冗余,也会破坏请求一致性。
|
|
16
17
|
- 对 Agent 来说,优先使用返回的结构化字段,不要从自然语言输出里猜 URL。
|
|
17
18
|
- 不直接调用或暴露 COS 临时凭证接口。
|
|
18
19
|
- 生图 / 生视频命令传本地参考文件时,会在内部自动上传;只有需要复用素材时才单独调用 `upload files`。
|
|
20
|
+
- 即使把平台 COS 完整 URL 当作 `source.value` 传入,CLI 会自动剥离 host 还原为 `backendPath`;但不要依赖该自愈,仍以传 `backendPath` 为准。
|
|
@@ -80,12 +80,14 @@ lj-awb video create \
|
|
|
80
80
|
- `media=IMAGE` 的 `fileTypes` 不要机械理解成唯一允许格式:空列表表示不支持 webp,本地 webp 会自动转 jpg;仅 `webp` 表示普通图片格式外也支持 webp;多值列表才按允许列表强校验并尝试转换。默认 text 里看 `formats` 和 `webpInput`,不要把 `formats=...|webp` 理解成“只支持 webp”。
|
|
81
81
|
- `supportLastFrameOnly=false` 只表示不支持“仅尾帧”;不要据此判断不支持首尾帧过渡。是否可传 `image:last_frame` 看 `model options.resources[].usage` / `model create-spec.supportedIntents[].usage` 是否包含 `last_frame`。
|
|
82
82
|
- prompt 中出现 `<<<key>>>` 时,必须有同名 `reference_key`,例如 `--resource image:reference:hero=./hero.png` 或 `--resource audio:reference:voice=./voice.wav`;反过来不强制。
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
- 首帧 /
|
|
86
|
-
- 关键帧 `image:keyframe#1=...`
|
|
83
|
+
- 参考图生视频取值优先级:`backendPath`(`material/...`) > 本地文件 > 真正外部公网完整 URL,也可使用普通素材 `asset:<assetId>`。这和 `subject:reference:<key>=asset:<externalId>` 不是一回事。
|
|
84
|
+
- 参考音频取值优先级同上;并且必须以 `model options.resources[]` 暴露 AUDIO reference 为准。
|
|
85
|
+
- 首帧 / 尾帧取值优先级:`backendPath` > 本地文件 > 外部公网 URL,也可以是 `asset:<assetId>`。
|
|
86
|
+
- 关键帧 `image:keyframe#1=...` 取值优先级:`backendPath` > 本地文件 > 外部公网 URL。
|
|
87
|
+
- **平台素材一律用 `backendPath`,不要把 `upload files` 回显的 `url`(`https://*.myqcloud.com/material/...`)当作 source.value 直接复用。**
|
|
87
88
|
- `image:first_frame=asset:<assetId>` 是资产首帧;`subject:reference:<key>=asset:<externalId>` 是主体引用,两者不是同一类资源。
|
|
88
89
|
- 主体引用必须先 `subject publish` + `subject wait` 得到 `externalId`。
|
|
89
90
|
- 批量 JSON/JSONL 每项只写 `prompt`、`ratio`、`quality`、`duration`、`need_audio`、`resources`、`resource`、`customBizId`;其中 `need_audio` 表示是否需要输出音效,音频素材仍写入 `resources`。
|
|
90
91
|
- 视频任务默认可能耗时较长,批量和复杂任务应异步提交并记录 task id。
|
|
92
|
+
- **多镜头 / 多分镜时主动建议并行**:用户一次给出 ≥2 个同模型同参数的视频任务(典型场景:分镜流水线、批量首尾帧动画)时,Agent 必须先告知"这批可以用 `video create-batch --concurrency N` 并行执行(n 个任务,预计耗时 / 单次估价 × n)",并询问用户是否要并行。用户同意 → 走 batch;用户希望逐条审稿 → 继续单条 create。**不要默认一条一条串行还不告知**。
|
|
91
93
|
- 去字幕服务适合处理 Seedance 原始结果链接,不要把无关 CDN 链接误传。
|
|
@@ -218,6 +218,7 @@ lj-awb video create-batch \
|
|
|
218
218
|
--model-group-code <modelGroupCode> \
|
|
219
219
|
--project-group-no <projectGroupNo> \
|
|
220
220
|
--task-record-file .awb/tasks.jsonl \
|
|
221
|
+
--concurrency 3 \
|
|
221
222
|
--yes \
|
|
222
223
|
|
|
223
224
|
|
|
@@ -228,8 +229,73 @@ lj-awb task record-poll \
|
|
|
228
229
|
|
|
229
230
|
```
|
|
230
231
|
|
|
232
|
+
并发数建议(`--concurrency`,默认 1):
|
|
233
|
+
|
|
234
|
+
- 生图:默认建议 `--concurrency 4`;上游图片模型并行较稳,账户额度通常可撑。
|
|
235
|
+
- 生视频:默认建议 `--concurrency 3`;视频任务本身耗时长且更易触发上游限流,过高反而拖慢整体。
|
|
236
|
+
- 出现 ≥30% 任务返回 `[任务创建失败]` 或上游 429 / 限流相关错误时,下次重跑降为 1-2。
|
|
237
|
+
- 用户对成本敏感(想观察前几条结果再决定是否继续)时主动建议先 `--concurrency 1` 跑前 1-2 条。
|
|
238
|
+
|
|
231
239
|
规则:
|
|
232
240
|
|
|
233
241
|
- 批量任务必须使用 `--task-record-file`,否则 Agent 难以恢复上下文。
|
|
234
242
|
- 单条失败不代表整批失败;读取每项 `status`、`taskId`、`error` 再汇总。
|
|
235
243
|
- 不要把全部结果原始 JSON 粘给用户,只汇报成功数、失败数、任务 ID 和结果 URL。
|
|
244
|
+
- **不要用 `image create` / `video create` 单条循环跑 ≥2 个同模型同参数任务**:识别到这种场景,先告知用户可以走 batch + 并行(n 个任务、预估耗时、单次估价 × n),询问后再决定走 batch 还是单条。
|
|
245
|
+
|
|
246
|
+
## 分镜流水线(分镜图 → 视频)
|
|
247
|
+
|
|
248
|
+
适用:用户给出多个镜头描述(例如剧本分镜、storyboard),希望 GPT Image 类模型先按一致角色 / 场景生成分镜图,再用视频模型把每张分镜图动起来。
|
|
249
|
+
|
|
250
|
+
1. 准备 `image.jsonl`,每行一个镜头的 `prompt` 和共用参考图(人物、场景):
|
|
251
|
+
|
|
252
|
+
```json
|
|
253
|
+
{"prompt":"镜头1:徐然推开 502 户门,门缝透出暖光...","ratio":"9:16","quality":"2k","resources":[{"type":"image","usage":"reference","source":{"kind":"url","value":"material/image-edit/<人物参考>"}},{"type":"image","usage":"reference","source":{"kind":"url","value":"material/image-edit/<场景参考>"}}]}
|
|
254
|
+
{"prompt":"镜头2:徐然侧身贴墙,听门外脚步声...","ratio":"9:16","quality":"2k","resources":[{"type":"image","usage":"reference","source":{"kind":"url","value":"material/image-edit/<人物参考>"}}]}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
2. 批量生分镜图(GPT Image 2 通道,并行 4):
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
lj-awb image create-batch \
|
|
261
|
+
--input-file ./image.jsonl \
|
|
262
|
+
--model-group-code GPT2_ImageCreate_Group_Discount \
|
|
263
|
+
--project-group-no <projectGroupNo> \
|
|
264
|
+
--task-record-file .awb/storyboard.jsonl \
|
|
265
|
+
--concurrency 4 \
|
|
266
|
+
--yes
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
3. 轮询全部完成并取结果 URL:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
lj-awb task record-poll \
|
|
273
|
+
--task-record-file .awb/storyboard.jsonl \
|
|
274
|
+
--pending-only --wait-seconds 600
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
4. 把每条 `taskId` 的 `result` 图(COS 对象路径,**用 `backendPath` 形式**)作为视频任务的 `first_frame`,组装 `video.jsonl`:
|
|
278
|
+
|
|
279
|
+
```json
|
|
280
|
+
{"prompt":"镜头1 动起来:徐然缓慢推门,光线从门缝渐扩","duration":5,"ratio":"9:16","quality":"720","resources":[{"type":"image","usage":"first_frame","source":{"kind":"url","value":"material/image-edit/<镜头1结果>"}}]}
|
|
281
|
+
{"prompt":"镜头2 动起来:徐然贴墙呼吸起伏,听门外动静","duration":5,"ratio":"9:16","quality":"720","resources":[{"type":"image","usage":"first_frame","source":{"kind":"url","value":"material/image-edit/<镜头2结果>"}}]}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
5. 批量生视频(视频模型通道,并行 3):
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
lj-awb video create-batch \
|
|
288
|
+
--input-file ./video.jsonl \
|
|
289
|
+
--model-group-code <video-model-group-code> \
|
|
290
|
+
--project-group-no <projectGroupNo> \
|
|
291
|
+
--task-record-file .awb/storyboard-video.jsonl \
|
|
292
|
+
--concurrency 3 \
|
|
293
|
+
--yes
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
执行约束:
|
|
297
|
+
|
|
298
|
+
- 步骤 2 / 5 提交前各做一次 `--dry-run`,把请求体打给用户看,确认 prompt 和参考图无误。
|
|
299
|
+
- 单次价格 × n 后总积分超过 50 或项目预算接近耗尽时,必须先向用户确认。
|
|
300
|
+
- 步骤 4 复用步骤 2 的结果时,资源 `source.value` 必须用 `backendPath`(`material/...`)形式,不要复制 `result.url` 字段里的完整 https URL。
|
|
301
|
+
- 中途要修改单个镜头 prompt 时,单独跑 `image create` / `video create`,不要全批重跑。
|