@lingjingai/lj-awb-cli 0.5.3 → 0.5.5
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/package.json +2 -2
- package/packages/awb-cli/bin/lj-awb.js +19 -0
- package/packages/awb-cli/package.json +2 -2
- package/packages/awb-core/package.json +1 -1
- package/packages/awb-core/src/commands.js +2 -2
- package/packages/awb-core/src/output.js +93 -25
- package/packages/awb-core/src/services.js +99 -12
- package/packages/awb-core/src/standalone.js +27 -15
- package/skills/lj-awb/SKILL.md +2 -2
- package/skills/lj-awb/VERSION +1 -1
- package/skills/lj-awb/compat.json +3 -3
- package/skills/lj-awb/modules/create-contract.md +5 -5
- package/skills/lj-awb/modules/driver.md +9 -7
- package/skills/lj-awb/modules/image.md +4 -4
- package/skills/lj-awb/modules/model.md +6 -4
- package/skills/lj-awb/modules/task-manual.md +3 -3
- package/skills/lj-awb/modules/task.md +8 -13
- package/skills/lj-awb/modules/video.md +6 -6
- package/skills/lj-awb/modules/workflows.md +10 -19
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingjingai/lj-awb-cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Lingjing AWB CLI monorepo with shared core, standalone CLI, and agent skills",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"lj-awb": "packages/awb-cli/bin/lj-awb"
|
|
8
|
+
"lj-awb": "packages/awb-cli/bin/lj-awb.js"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"chalk": "^5.6.2",
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// NODE_EXTRA_CA_CERTS 只在 Node 启动那一刻读取并初始化 TLS,进程内再设无效。
|
|
3
|
+
// 旧的 sh 包装脚本靠"先设变量再起 node"来兜底 macOS 的系统证书;现在 bin 直接指向
|
|
4
|
+
// 本文件(去掉了对 /bin/sh 的依赖,修复 Windows),故在此用 re-exec 保留同样的行为:
|
|
5
|
+
// unix 上证书存在且变量未设时,带上它重启一次自己。Windows 无 /etc/ssl/cert.pem,整段跳过。
|
|
6
|
+
if (!process.env.NODE_EXTRA_CA_CERTS) {
|
|
7
|
+
const { existsSync } = await import('node:fs');
|
|
8
|
+
if (existsSync('/etc/ssl/cert.pem')) {
|
|
9
|
+
const { spawnSync } = await import('node:child_process');
|
|
10
|
+
const { fileURLToPath } = await import('node:url');
|
|
11
|
+
const result = spawnSync(
|
|
12
|
+
process.execPath,
|
|
13
|
+
[fileURLToPath(import.meta.url), ...process.argv.slice(2)],
|
|
14
|
+
{ stdio: 'inherit', env: { ...process.env, NODE_EXTRA_CA_CERTS: '/etc/ssl/cert.pem' } },
|
|
15
|
+
);
|
|
16
|
+
if (result.error) throw result.error;
|
|
17
|
+
process.exit(result.status ?? 1);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
2
21
|
process.env.LINGJING_AWB_COMMAND_PREFIX ??= 'lj-awb';
|
|
3
22
|
|
|
4
23
|
let standaloneModule;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingjingai/awb-cli-bin",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
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.5.
|
|
16
|
+
"@lingjingai/awb-core": "0.5.5"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -621,7 +621,7 @@ export function registerAwbCommands(cli) {
|
|
|
621
621
|
'lj-awb create image-batch --input-file ./prompts.txt --model-group-code <code> --dry-run',
|
|
622
622
|
'lj-awb create image-batch --input-file ./image-input.jsonl --model-group-code <code> --concurrency 3 --yes',
|
|
623
623
|
],
|
|
624
|
-
hint: 'JSON/JSONL 每项只写任务差异字段:prompt、ratio、quality、generate_num、resources、resource、model_params
|
|
624
|
+
hint: 'JSON/JSONL 每项只写任务差异字段:prompt、ratio、quality、generate_num、resources、resource、model_params;提交后默认用 results[].taskId / statusCommand 查询本批次;需要中断恢复时可显式传 --task-record-file。',
|
|
625
625
|
}),
|
|
626
626
|
args: [
|
|
627
627
|
{ name: 'input-file', valueName: 'path', description: '批量输入文件' },
|
|
@@ -698,7 +698,7 @@ export function registerAwbCommands(cli) {
|
|
|
698
698
|
'lj-awb create video-batch --input-file ./prompts.txt --model-group-code <code> --dry-run',
|
|
699
699
|
'lj-awb create video-batch --input-file ./video-input.jsonl --model-group-code <code> --concurrency 2 --yes',
|
|
700
700
|
],
|
|
701
|
-
hint: 'JSON/JSONL 每项只写任务差异字段:prompt、ratio、quality、duration、need_audio、resources、resource、model_params
|
|
701
|
+
hint: 'JSON/JSONL 每项只写任务差异字段:prompt、ratio、quality、duration、need_audio、resources、resource、model_params;提交后默认用 results[].taskId / statusCommand 查询本批次;需要中断恢复时可显式传 --task-record-file。',
|
|
702
702
|
}),
|
|
703
703
|
args: [
|
|
704
704
|
{ name: 'input-file', valueName: 'path', description: '批量输入文件' },
|
|
@@ -241,6 +241,42 @@ function normalizeTaskSubmission(commandName, data = {}) {
|
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
function normalizeBatchTaskResult(row = {}) {
|
|
245
|
+
return compactRecord({
|
|
246
|
+
...row,
|
|
247
|
+
inputIndex: row.inputIndex,
|
|
248
|
+
status: row.status,
|
|
249
|
+
taskId: row.taskId,
|
|
250
|
+
taskType: row.taskType,
|
|
251
|
+
modelGroupCode: row.modelGroupCode,
|
|
252
|
+
projectGroupNo: row.projectGroupNo,
|
|
253
|
+
promptSummary: row.promptSummary,
|
|
254
|
+
resultCount: row.resultCount,
|
|
255
|
+
resultUrls: row.resultUrls,
|
|
256
|
+
error: row.error,
|
|
257
|
+
errorMessage: row.errorMessage,
|
|
258
|
+
nextCommand: rewriteCommandPrefix(row.nextCommand),
|
|
259
|
+
statusCommand: rewriteCommandPrefix(row.statusCommand || submissionStatusCommand('create image', row)),
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function normalizeBatchTaskSubmission(data = {}) {
|
|
264
|
+
const results = Array.isArray(data.results) ? data.results.map((row) => normalizeBatchTaskResult(row)) : [];
|
|
265
|
+
const successCount = data.successCount ?? results.filter((row) => row.status === 'success' || row.taskId).length;
|
|
266
|
+
const failureCount = data.failureCount ?? results.filter((row) => row.status === 'error' || row.error || row.errorMessage).length;
|
|
267
|
+
return compactRecord({
|
|
268
|
+
...data,
|
|
269
|
+
dryRun: data.dryRun,
|
|
270
|
+
submitted: data.submitted,
|
|
271
|
+
count: data.count ?? results.length,
|
|
272
|
+
successCount,
|
|
273
|
+
failureCount,
|
|
274
|
+
taskRecordFile: data.taskRecordFile,
|
|
275
|
+
nextCommand: rewriteCommandPrefix(data.nextCommand),
|
|
276
|
+
results,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
244
280
|
function normalizeSubtitleSubmission(data = {}) {
|
|
245
281
|
return compactRecord({
|
|
246
282
|
submitted: data.submitted,
|
|
@@ -476,6 +512,9 @@ function normalizeList(data = {}, keys) {
|
|
|
476
512
|
|
|
477
513
|
export function normalizeOutputData(commandName, data) {
|
|
478
514
|
if (!isPlainObject(data)) return cleanNested(data);
|
|
515
|
+
if (commandName === 'create image-batch' || commandName === 'create video-batch') {
|
|
516
|
+
return normalizeBatchTaskSubmission(data);
|
|
517
|
+
}
|
|
479
518
|
switch (commandName) {
|
|
480
519
|
case 'auth status':
|
|
481
520
|
case 'auth verify':
|
|
@@ -664,6 +703,28 @@ function pushSectionRecordItem(lines, index, record, preferredKeys = []) {
|
|
|
664
703
|
if (rendered) lines.push(` [${index}]: ${rendered}`);
|
|
665
704
|
}
|
|
666
705
|
|
|
706
|
+
function pushUniqueLine(lines, seen, line) {
|
|
707
|
+
if (!line || seen.has(line)) return;
|
|
708
|
+
seen.add(line);
|
|
709
|
+
lines.push(line);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
function pushTextFollowUps(lines, seen, commandName, normalized, context = {}) {
|
|
713
|
+
if (normalized.nextCommand) pushUniqueLine(lines, seen, `next=${normalized.nextCommand}`);
|
|
714
|
+
if (normalized.statusCommand) pushUniqueLine(lines, seen, `statusCommand=${normalized.statusCommand}`);
|
|
715
|
+
if (normalized.nextRefSubject) pushUniqueLine(lines, seen, `nextRefSubject=${normalized.nextRefSubject}`);
|
|
716
|
+
if (normalized.dryRun && context.confirmCommand) pushUniqueLine(lines, seen, `nextAfterConfirm=${context.confirmCommand}`);
|
|
717
|
+
if (normalized.dryRun && !context.confirmCommand && context.executeCommand) pushUniqueLine(lines, seen, `next=${context.executeCommand}`);
|
|
718
|
+
const modelNext = modelListNextCommand(commandName);
|
|
719
|
+
if (modelNext) pushUniqueLine(lines, seen, `next=${modelNext}`);
|
|
720
|
+
const modelHint = modelListAgentHint(commandName);
|
|
721
|
+
if (modelHint) pushUniqueLine(lines, seen, `agentHint=${shortValue(modelHint)}`);
|
|
722
|
+
const waitNext = statusNextCommand(commandName, normalized);
|
|
723
|
+
if (waitNext) pushUniqueLine(lines, seen, `next=${waitNext}`);
|
|
724
|
+
const subtitleNext = subtitleRemoveNextCommand(commandName, normalized);
|
|
725
|
+
if (subtitleNext) pushUniqueLine(lines, seen, `nextSubtitleRemove=${subtitleNext}`);
|
|
726
|
+
}
|
|
727
|
+
|
|
667
728
|
function firstList(data) {
|
|
668
729
|
for (const [key, value] of Object.entries(data || {})) {
|
|
669
730
|
if (['resultUrls', 'originUrls'].includes(key)) continue;
|
|
@@ -676,7 +737,9 @@ function rowSummary(row) {
|
|
|
676
737
|
if (!isPlainObject(row)) return shortValue(row);
|
|
677
738
|
const keys = [
|
|
678
739
|
'id',
|
|
740
|
+
'inputIndex',
|
|
679
741
|
'taskId',
|
|
742
|
+
'statusCommand',
|
|
680
743
|
'publicId',
|
|
681
744
|
'remoteTaskId',
|
|
682
745
|
'taskType',
|
|
@@ -772,7 +835,6 @@ function rowSummary(row) {
|
|
|
772
835
|
'url',
|
|
773
836
|
'sceneType',
|
|
774
837
|
'projectName',
|
|
775
|
-
'inputIndex',
|
|
776
838
|
'rowKind',
|
|
777
839
|
'entityKey',
|
|
778
840
|
'parentKey',
|
|
@@ -1387,6 +1449,7 @@ const FIELD_LABELS = {
|
|
|
1387
1449
|
description: '描述',
|
|
1388
1450
|
displayName: '展示名',
|
|
1389
1451
|
taskKind: '任务类型',
|
|
1452
|
+
taskRecordFile: '任务台账',
|
|
1390
1453
|
doctorStatus: '体检状态',
|
|
1391
1454
|
dryRun: '预览模式',
|
|
1392
1455
|
duration: '时长',
|
|
@@ -1398,6 +1461,7 @@ const FIELD_LABELS = {
|
|
|
1398
1461
|
errorMessage: '错误信息',
|
|
1399
1462
|
externalId: '外部 ID',
|
|
1400
1463
|
fileCount: '文件数',
|
|
1464
|
+
failureCount: '失败数',
|
|
1401
1465
|
feeCommand: '估价命令',
|
|
1402
1466
|
format: '格式',
|
|
1403
1467
|
generateNum: '生成数量',
|
|
@@ -1471,6 +1535,7 @@ const FIELD_LABELS = {
|
|
|
1471
1535
|
statusCommand: '状态查询命令',
|
|
1472
1536
|
statusCommandTaskType: '状态任务类型',
|
|
1473
1537
|
submitted: '已提交',
|
|
1538
|
+
successCount: '成功数',
|
|
1474
1539
|
successRate: '成功率',
|
|
1475
1540
|
subjectId: '主体 ID',
|
|
1476
1541
|
taskCount: '任务数',
|
|
@@ -1535,7 +1600,7 @@ const DETAIL_FIELDS_BY_KIND = {
|
|
|
1535
1600
|
auth_status: ['configured', 'authType', 'accessKey', 'source', 'verified', 'verification', 'verifyCommand', 'userId', 'userName', 'groupId', 'groupName'],
|
|
1536
1601
|
batch_subject_publish_result: ['dryRun', 'submitted', 'count', 'successCount', 'failureCount', 'modelCode', 'projectGroupNo'],
|
|
1537
1602
|
batch_task_status: ['count', 'taskCount', 'successTaskCount', 'resultCount', 'pointTotal', 'timedOut', 'waitedMs'],
|
|
1538
|
-
batch_task_submission: ['dryRun', 'submitted', 'count', 'taskCount', 'successCount', 'failureCount', 'modelGroupCode', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'projectBudgetBalance'],
|
|
1603
|
+
batch_task_submission: ['dryRun', 'submitted', 'count', 'taskCount', 'successCount', 'failureCount', 'modelGroupCode', 'projectGroupNo', 'pointCost', 'billingPointBalance', 'projectBudgetBalance', 'taskRecordFile', 'nextCommand'],
|
|
1539
1604
|
credit_detail_status: ['detailId', 'status', 'statusText', 'lockTime', 'lockPoint', 'useTime', 'usePoint', 'regetTime', 'regetPoint'],
|
|
1540
1605
|
credits_balance: ['billingPointBalance', 'currentProjectGroupNo', 'currentProjectGroupName', 'projectBudgetBalance', 'projectBudgetMax'],
|
|
1541
1606
|
credits_records: ['remainPoint', 'dataPlanPoint', 'topUpPoint', 'queryType', 'total', 'page', 'size', 'pages'],
|
|
@@ -2014,7 +2079,8 @@ const TABLE_COLUMNS = {
|
|
|
2014
2079
|
column('状态', ['status', 'taskStatus'], { maxWidth: 16 }),
|
|
2015
2080
|
column('任务 ID', 'taskId', { maxWidth: 28 }),
|
|
2016
2081
|
column('模型/主体', ['modelGroupCode', 'modelCode', 'name'], { maxWidth: 30 }),
|
|
2017
|
-
column('说明', ['message', 'errorMessage', 'prompt'], { maxWidth: 42 }),
|
|
2082
|
+
column('说明', ['promptSummary', 'message', 'errorMessage', 'prompt'], { maxWidth: 42 }),
|
|
2083
|
+
column('状态查询', 'statusCommand', { maxWidth: 48 }),
|
|
2018
2084
|
],
|
|
2019
2085
|
subjects: [
|
|
2020
2086
|
column('主体 ID', ['elementId', 'subjectId'], { maxWidth: 24 }),
|
|
@@ -2717,10 +2783,10 @@ function formatPrettySchema(data = {}, context = {}) {
|
|
|
2717
2783
|
if (!isBrief) renderArraySection(lines, '命令', data.commands, 'commands');
|
|
2718
2784
|
renderNextActions(lines, [
|
|
2719
2785
|
...(isBrief ? [
|
|
2720
|
-
{ label: '精确 Schema', value: `${commandPrefix()} schema --domain <domain> --command <command> -f
|
|
2721
|
-
{ label: '完整 Schema', value: `${commandPrefix()} schema -f
|
|
2786
|
+
{ label: '精确 Schema', value: `${commandPrefix()} schema --domain <domain> --command <command> -f text` },
|
|
2787
|
+
{ label: '完整 Schema', value: `${commandPrefix()} schema -f text` },
|
|
2722
2788
|
] : [
|
|
2723
|
-
{ label: 'Agent Brief', value: `${commandPrefix()} schema --brief -f
|
|
2789
|
+
{ label: 'Agent Brief', value: `${commandPrefix()} schema --brief -f text` },
|
|
2724
2790
|
{ label: 'Schema JSON', value: `${commandPrefix()} schema -f json` },
|
|
2725
2791
|
]),
|
|
2726
2792
|
...(context.jsonCommand ? [{ label: '当前筛选 JSON', value: context.jsonCommand }] : []),
|
|
@@ -3004,7 +3070,10 @@ export function formatTextOutput(commandName, data, context = {}) {
|
|
|
3004
3070
|
'sourceFile',
|
|
3005
3071
|
'inputDir',
|
|
3006
3072
|
'inputFile',
|
|
3073
|
+
'taskRecordFile',
|
|
3007
3074
|
'count',
|
|
3075
|
+
'successCount',
|
|
3076
|
+
'failureCount',
|
|
3008
3077
|
'rowCount',
|
|
3009
3078
|
'actorCount',
|
|
3010
3079
|
'propCount',
|
|
@@ -3060,6 +3129,8 @@ export function formatTextOutput(commandName, data, context = {}) {
|
|
|
3060
3129
|
['nextCommand', 'statusCommand', 'nextRefSubject', ...(list ? ['count'] : []), ...(isModelList ? ['usage'] : [])],
|
|
3061
3130
|
);
|
|
3062
3131
|
if (scalarLine) lines.push(scalarLine);
|
|
3132
|
+
const followUpLines = new Set();
|
|
3133
|
+
pushTextFollowUps(lines, followUpLines, commandName, normalized, context);
|
|
3063
3134
|
if (list) {
|
|
3064
3135
|
const total = list.rows.length;
|
|
3065
3136
|
lines.push(`${list.key}.count=${total}`);
|
|
@@ -3069,34 +3140,31 @@ export function formatTextOutput(commandName, data, context = {}) {
|
|
|
3069
3140
|
: (Number.isFinite(context.listLimit) ? context.listLimit : defaultListLimit);
|
|
3070
3141
|
const visibleLimit = Math.max(0, configuredLimit);
|
|
3071
3142
|
const visibleRows = list.rows.slice(0, visibleLimit);
|
|
3143
|
+
const listUrlLimit = Number.isFinite(context.listUrlLimit) ? Math.max(0, context.listUrlLimit) : 6;
|
|
3144
|
+
let emittedListUrls = 0;
|
|
3145
|
+
let omittedListUrls = 0;
|
|
3072
3146
|
for (const [index, row] of visibleRows.entries()) {
|
|
3073
3147
|
const summary = rowSummary(row);
|
|
3074
3148
|
if (summary) lines.push(`${list.key}[${index}]: ${summary}`);
|
|
3075
|
-
if (isPlainObject(row)
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3149
|
+
if (isPlainObject(row)) {
|
|
3150
|
+
const resultUrls = Array.isArray(row.resultUrls) ? row.resultUrls : [];
|
|
3151
|
+
const originUrls = !resultUrls.length && Array.isArray(row.originUrls) ? row.originUrls : [];
|
|
3152
|
+
const urls = resultUrls.length ? resultUrls : originUrls;
|
|
3153
|
+
const urlKey = resultUrls.length ? 'resultUrl' : 'originUrl';
|
|
3154
|
+
const room = Math.max(0, listUrlLimit - emittedListUrls);
|
|
3155
|
+
for (const [urlIndex, url] of urls.slice(0, room).entries()) {
|
|
3156
|
+
lines.push(`${list.key}[${index}].${urlKey}[${urlIndex}]=${url}`);
|
|
3157
|
+
}
|
|
3158
|
+
emittedListUrls += Math.min(urls.length, room);
|
|
3159
|
+
omittedListUrls += Math.max(0, urls.length - room);
|
|
3080
3160
|
}
|
|
3081
3161
|
}
|
|
3162
|
+
if (omittedListUrls) lines.push(`${list.key}.urlMore=${omittedListUrls}`);
|
|
3082
3163
|
if (total > visibleRows.length) {
|
|
3083
3164
|
lines.push(`${list.key}.more=${total - visibleRows.length}`);
|
|
3084
|
-
lines.push(`moreCommand=${context.moreCommand || context.jsonCommand || defaultJsonCommand(commandName)}`);
|
|
3165
|
+
lines.push(`moreCommand=${context.moreCommand || context.textCommand || context.jsonCommand || defaultJsonCommand(commandName)}`);
|
|
3085
3166
|
}
|
|
3086
3167
|
}
|
|
3087
|
-
if (normalized.nextCommand) lines.push(`next=${normalized.nextCommand}`);
|
|
3088
|
-
if (normalized.statusCommand) lines.push(`statusCommand=${normalized.statusCommand}`);
|
|
3089
|
-
if (normalized.nextRefSubject) lines.push(`nextRefSubject=${normalized.nextRefSubject}`);
|
|
3090
|
-
if (normalized.dryRun && context.confirmCommand) lines.push(`nextAfterConfirm=${context.confirmCommand}`);
|
|
3091
|
-
if (normalized.dryRun && !context.confirmCommand && context.executeCommand) lines.push(`next=${context.executeCommand}`);
|
|
3092
|
-
const modelNext = modelListNextCommand(commandName);
|
|
3093
|
-
if (modelNext) lines.push(`next=${modelNext}`);
|
|
3094
|
-
const modelHint = modelListAgentHint(commandName);
|
|
3095
|
-
if (modelHint) lines.push(`agentHint=${shortValue(modelHint)}`);
|
|
3096
|
-
const waitNext = statusNextCommand(commandName, normalized);
|
|
3097
|
-
if (waitNext) lines.push(`next=${waitNext}`);
|
|
3098
|
-
const subtitleNext = subtitleRemoveNextCommand(commandName, normalized);
|
|
3099
|
-
if (subtitleNext) lines.push(`nextSubtitleRemove=${subtitleNext}`);
|
|
3100
3168
|
if (Array.isArray(normalized.resultUrls)) {
|
|
3101
3169
|
for (const [index, url] of normalized.resultUrls.slice(0, 3).entries()) lines.push(`resultUrl[${index}]=${url}`);
|
|
3102
3170
|
}
|
|
@@ -1393,6 +1393,37 @@ function modelSummaryFromRaw(rawModel = {}, modelGroupCode, taskKind) {
|
|
|
1393
1393
|
});
|
|
1394
1394
|
}
|
|
1395
1395
|
|
|
1396
|
+
function normalizeModelMatchText(value) {
|
|
1397
|
+
return String(value ?? '')
|
|
1398
|
+
.toLowerCase()
|
|
1399
|
+
.replace(/[_.\-·\s]+/g, '');
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
function isKeling3oVideoModel(model = {}) {
|
|
1403
|
+
const text = [
|
|
1404
|
+
model?.modelGroupCode,
|
|
1405
|
+
model?.displayName,
|
|
1406
|
+
model?.modelDesc,
|
|
1407
|
+
model?.provider,
|
|
1408
|
+
].map(normalizeModelMatchText).join(' ');
|
|
1409
|
+
const isKeling = /可灵|kling|keling/.test(text);
|
|
1410
|
+
const is3o = /3(?:0|o)/i.test(text);
|
|
1411
|
+
return isKeling && is3o;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
function paramsSupportNeedAudio(params = []) {
|
|
1415
|
+
return (Array.isArray(params) ? params : []).some((param) => (
|
|
1416
|
+
param?.key === 'needAudio'
|
|
1417
|
+
|| param?.modelParamKey === 'need_audio'
|
|
1418
|
+
|| param?.modelParamKey === 'audio'
|
|
1419
|
+
));
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
export function shouldDefaultNeedAudioForVideoModel(model = {}, params = [], promptParams = {}) {
|
|
1423
|
+
if (Object.prototype.hasOwnProperty.call(promptParams || {}, 'need_audio')) return false;
|
|
1424
|
+
return isKeling3oVideoModel(model) && paramsSupportNeedAudio(params);
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1396
1427
|
async function fetchModelConstraintSchema(rawModel = {}, modelGroupCode) {
|
|
1397
1428
|
const usage = trimToNull(rawModel?.usage);
|
|
1398
1429
|
if (!usage) return [];
|
|
@@ -2194,7 +2225,7 @@ function createParamForModelOption(option = {}, taskKind = 'image') {
|
|
|
2194
2225
|
requestPath: 'promptParams.need_audio',
|
|
2195
2226
|
materialLegacyKey: 'need_audio',
|
|
2196
2227
|
meaning: '是否需要输出音效 / 模型生成音频。',
|
|
2197
|
-
valueSource: '布尔值 true / false
|
|
2228
|
+
valueSource: '布尔值 true / false;普通模型仅在用户明确要求输出音效时使用。可灵 3o / Kling 3.0 支持该项时 CLI 默认开启音效;用户明确不要声音时传 false。它不是上传音频文件的入口。',
|
|
2198
2229
|
controlKind: 'output_audio_toggle',
|
|
2199
2230
|
},
|
|
2200
2231
|
audio: {
|
|
@@ -2203,7 +2234,7 @@ function createParamForModelOption(option = {}, taskKind = 'image') {
|
|
|
2203
2234
|
requestPath: 'promptParams.need_audio',
|
|
2204
2235
|
materialLegacyKey: 'audio',
|
|
2205
2236
|
meaning: '是否需要输出音效 / 模型生成音频。',
|
|
2206
|
-
valueSource: '布尔值 true / false
|
|
2237
|
+
valueSource: '布尔值 true / false;普通模型仅在用户明确要求输出音效时使用。可灵 3o / Kling 3.0 支持该项时 CLI 默认开启音效;用户明确不要声音时传 false。它不是上传音频文件的入口。',
|
|
2207
2238
|
controlKind: 'output_audio_toggle',
|
|
2208
2239
|
},
|
|
2209
2240
|
iref: {
|
|
@@ -2689,7 +2720,7 @@ function createSpecParameterControls(createParams, inputModes = []) {
|
|
|
2689
2720
|
|
|
2690
2721
|
function createSpecAgentGuidance(taskKind, inputRequirement) {
|
|
2691
2722
|
const keyParamGuidance = taskKind === 'video'
|
|
2692
|
-
? 'fee 或 create --dry-run 前,必须先确认用户未提供的价格 / 效果关键参数:quality、duration、约束后仍可选的 ratio;needAudio
|
|
2723
|
+
? 'fee 或 create --dry-run 前,必须先确认用户未提供的价格 / 效果关键参数:quality、duration、约束后仍可选的 ratio;needAudio 普通模型只在用户明确要输出音效时确认。可灵 3o / Kling 3.0 支持 needAudio 时 CLI 默认开声音,用户明确不要声音时传 --need-audio false。不要静默使用 defaultValue 先估价。'
|
|
2693
2724
|
: 'fee 或 create --dry-run 前,必须先确认用户未提供的价格 / 效果关键参数:quality、ratio、generateNum。不要静默使用 defaultValue 先估价。';
|
|
2694
2725
|
const guidance = [
|
|
2695
2726
|
'先用 model options 获取枚举值、文件类型、数量、大小、时长和条件约束;create-spec 只负责创建方式。',
|
|
@@ -4874,8 +4905,13 @@ async function buildVideoRequest(kwargs = {}, options = {}) {
|
|
|
4874
4905
|
if (kwargs.ratio != null && kwargs.ratio !== '') defaultParams.ratio = kwargs.ratio;
|
|
4875
4906
|
if (kwargs.quality != null && kwargs.quality !== '') defaultParams.quality = kwargs.quality;
|
|
4876
4907
|
if (kwargs.needAudio != null && kwargs.needAudio !== '') defaultParams.need_audio = toBool(kwargs.needAudio);
|
|
4877
|
-
|
|
4908
|
+
let promptParams = normalizeUnifiedPromptParams(defaultParams);
|
|
4878
4909
|
const validation = await validateCreateRequestAgainstModel('video', model.modelGroupCode, promptParams, validationResources.resourceDetails);
|
|
4910
|
+
if (shouldDefaultNeedAudioForVideoModel(validation.context.model, validation.params, promptParams)) {
|
|
4911
|
+
defaultParams.need_audio = true;
|
|
4912
|
+
promptParams = normalizeUnifiedPromptParams(defaultParams);
|
|
4913
|
+
assertParamsAgainstModel(promptParams, validation.params, validation.context.constraints);
|
|
4914
|
+
}
|
|
4879
4915
|
const resolvedResources = await resolveResources(kwargs, {
|
|
4880
4916
|
dryRun,
|
|
4881
4917
|
kind: 'video',
|
|
@@ -5071,17 +5107,22 @@ export async function imageCreateBatch(kwargs = {}) {
|
|
|
5071
5107
|
if (toBool(kwargs.dryRun)) {
|
|
5072
5108
|
const results = [];
|
|
5073
5109
|
for (const [index, item] of items.entries()) {
|
|
5074
|
-
results.push({
|
|
5110
|
+
results.push({
|
|
5111
|
+
inputIndex: index,
|
|
5112
|
+
promptSummary: taskPromptSummary(item),
|
|
5113
|
+
...(await imageCreate({ ...kwargs, ...item, dryRun: true })),
|
|
5114
|
+
});
|
|
5075
5115
|
}
|
|
5076
|
-
return { dryRun: true, count: items.length
|
|
5116
|
+
return summarizeBatchSubmission('image', kwargs, results, { dryRun: true, count: items.length });
|
|
5077
5117
|
}
|
|
5078
5118
|
ensureConfirmed(kwargs, '批量生图会多次消耗积分,需要确认', { action: 'create image-batch', count: items.length });
|
|
5079
5119
|
const results = await runConcurrent(items, kwargs.concurrency ?? 1, async (item, index) => ({
|
|
5080
5120
|
inputIndex: index,
|
|
5081
5121
|
status: 'success',
|
|
5122
|
+
promptSummary: taskPromptSummary(item),
|
|
5082
5123
|
...(await imageCreate({ ...kwargs, ...item, yes: true, dryRun: false })),
|
|
5083
5124
|
}));
|
|
5084
|
-
return { count: items.length
|
|
5125
|
+
return summarizeBatchSubmission('image', kwargs, results, { count: items.length });
|
|
5085
5126
|
}
|
|
5086
5127
|
|
|
5087
5128
|
export async function videoCreateBatch(kwargs = {}) {
|
|
@@ -5090,17 +5131,22 @@ export async function videoCreateBatch(kwargs = {}) {
|
|
|
5090
5131
|
if (toBool(kwargs.dryRun)) {
|
|
5091
5132
|
const results = [];
|
|
5092
5133
|
for (const [index, item] of items.entries()) {
|
|
5093
|
-
results.push({
|
|
5134
|
+
results.push({
|
|
5135
|
+
inputIndex: index,
|
|
5136
|
+
promptSummary: taskPromptSummary(item),
|
|
5137
|
+
...(await videoCreate({ ...kwargs, ...item, dryRun: true })),
|
|
5138
|
+
});
|
|
5094
5139
|
}
|
|
5095
|
-
return { dryRun: true, count: items.length
|
|
5140
|
+
return summarizeBatchSubmission('video', kwargs, results, { dryRun: true, count: items.length });
|
|
5096
5141
|
}
|
|
5097
5142
|
ensureConfirmed(kwargs, '批量生视频会多次消耗积分,需要确认', { action: 'create video-batch', count: items.length });
|
|
5098
5143
|
const results = await runConcurrent(items, kwargs.concurrency ?? 1, async (item, index) => ({
|
|
5099
5144
|
inputIndex: index,
|
|
5100
5145
|
status: 'success',
|
|
5146
|
+
promptSummary: taskPromptSummary(item),
|
|
5101
5147
|
...(await videoCreate({ ...kwargs, ...item, yes: true, dryRun: false })),
|
|
5102
5148
|
}));
|
|
5103
|
-
return { count: items.length
|
|
5149
|
+
return summarizeBatchSubmission('video', kwargs, results, { count: items.length });
|
|
5104
5150
|
}
|
|
5105
5151
|
|
|
5106
5152
|
function taskPromptSummary(input = {}) {
|
|
@@ -5113,6 +5159,47 @@ function resolveTaskRecordFile(kwargs = {}) {
|
|
|
5113
5159
|
return filePath ? path.resolve(filePath) : null;
|
|
5114
5160
|
}
|
|
5115
5161
|
|
|
5162
|
+
function shellArg(value) {
|
|
5163
|
+
const text = String(value ?? '');
|
|
5164
|
+
return /^[A-Za-z0-9_./:=@,+-]+$/.test(text) ? text : JSON.stringify(text);
|
|
5165
|
+
}
|
|
5166
|
+
|
|
5167
|
+
function taskStatusCommand(taskId) {
|
|
5168
|
+
return taskId ? `lj-awb task status --task-id ${shellArg(taskId)} -f text` : null;
|
|
5169
|
+
}
|
|
5170
|
+
|
|
5171
|
+
function taskRecordPollCommand(taskRecordFile, options = {}) {
|
|
5172
|
+
if (!taskRecordFile) return null;
|
|
5173
|
+
const waitSeconds = options.waitSeconds ?? 300;
|
|
5174
|
+
return `lj-awb task record-poll --task-record-file ${shellArg(taskRecordFile)} --wait-seconds ${shellArg(waitSeconds)} -f text`;
|
|
5175
|
+
}
|
|
5176
|
+
|
|
5177
|
+
function summarizeBatchSubmission(kind, kwargs = {}, results = [], options = {}) {
|
|
5178
|
+
const taskRecordFile = resolveTaskRecordFile(kwargs);
|
|
5179
|
+
const taskType = kind === 'video' ? 'VIDEO_GROUP' : 'IMAGE_CREATE';
|
|
5180
|
+
const normalizedResults = (Array.isArray(results) ? results : []).map((row) => {
|
|
5181
|
+
const taskId = trimToNull(row?.taskId);
|
|
5182
|
+
return compactRecord({
|
|
5183
|
+
...row,
|
|
5184
|
+
taskType: row?.taskType ?? (taskId ? taskType : undefined),
|
|
5185
|
+
promptSummary: row?.promptSummary ?? taskPromptSummary(row),
|
|
5186
|
+
statusCommand: row?.statusCommand ?? taskStatusCommand(taskId),
|
|
5187
|
+
});
|
|
5188
|
+
});
|
|
5189
|
+
const successCount = normalizedResults.filter((row) => row.status === 'success' || row.taskId).length;
|
|
5190
|
+
const failureCount = normalizedResults.filter((row) => row.status === 'error' || row.error).length;
|
|
5191
|
+
return compactRecord({
|
|
5192
|
+
dryRun: options.dryRun,
|
|
5193
|
+
submitted: !options.dryRun,
|
|
5194
|
+
count: options.count ?? normalizedResults.length,
|
|
5195
|
+
successCount,
|
|
5196
|
+
failureCount,
|
|
5197
|
+
taskRecordFile,
|
|
5198
|
+
nextCommand: options.dryRun ? null : taskRecordPollCommand(taskRecordFile),
|
|
5199
|
+
results: normalizedResults,
|
|
5200
|
+
});
|
|
5201
|
+
}
|
|
5202
|
+
|
|
5116
5203
|
async function appendTaskRecord(kwargs, record) {
|
|
5117
5204
|
const filePath = resolveTaskRecordFile(kwargs);
|
|
5118
5205
|
if (!filePath || !record?.taskId) return null;
|
|
@@ -6139,7 +6226,7 @@ export async function subtitleRemove(kwargs = {}) {
|
|
|
6139
6226
|
return {
|
|
6140
6227
|
...result,
|
|
6141
6228
|
nextCommand: result.taskId
|
|
6142
|
-
? `lj-awb task status --task-id ${result.taskId} -f
|
|
6229
|
+
? `lj-awb task status --task-id ${result.taskId} -f text`
|
|
6143
6230
|
: null,
|
|
6144
6231
|
};
|
|
6145
6232
|
}
|
|
@@ -6250,7 +6337,7 @@ export async function videoSuperResolution(kwargs = {}) {
|
|
|
6250
6337
|
return {
|
|
6251
6338
|
...result,
|
|
6252
6339
|
nextCommand: result.taskId
|
|
6253
|
-
? `lj-awb task status --task-id ${result.taskId} -f
|
|
6340
|
+
? `lj-awb task status --task-id ${result.taskId} -f text`
|
|
6254
6341
|
: null,
|
|
6255
6342
|
};
|
|
6256
6343
|
}
|
|
@@ -341,10 +341,10 @@ const VIRTUAL_COMMANDS = [
|
|
|
341
341
|
'输出机器可读命令 schema,供 Agent / 脚本理解命令、参数和示例',
|
|
342
342
|
'',
|
|
343
343
|
'Examples:',
|
|
344
|
-
' lj-awb schema --brief -f
|
|
345
|
-
' lj-awb schema -f
|
|
346
|
-
' lj-awb schema --domain create -f
|
|
347
|
-
' lj-awb schema --domain create --command image -f
|
|
344
|
+
' lj-awb schema --brief -f text',
|
|
345
|
+
' lj-awb schema -f text',
|
|
346
|
+
' lj-awb schema --domain create -f text',
|
|
347
|
+
' lj-awb schema --domain create --command image -f text',
|
|
348
348
|
'',
|
|
349
349
|
'Hint: Agent 先读 --brief 掌握能力地图;执行具体命令前再读精确 schema。',
|
|
350
350
|
].join('\n'),
|
|
@@ -480,9 +480,9 @@ const GROUP_EXAMPLES = {
|
|
|
480
480
|
'lj-awb doctor --verify',
|
|
481
481
|
'lj-awb update --check',
|
|
482
482
|
'lj-awb update',
|
|
483
|
-
'lj-awb schema --brief -f
|
|
484
|
-
'lj-awb schema -f
|
|
485
|
-
'lj-awb schema --domain create -f
|
|
483
|
+
'lj-awb schema --brief -f text',
|
|
484
|
+
'lj-awb schema -f text',
|
|
485
|
+
'lj-awb schema --domain create -f text',
|
|
486
486
|
],
|
|
487
487
|
auth: [
|
|
488
488
|
'lj-awb auth status',
|
|
@@ -754,6 +754,14 @@ function asJsonExample(example) {
|
|
|
754
754
|
return `${text} -f json`;
|
|
755
755
|
}
|
|
756
756
|
|
|
757
|
+
function asAgentExample(example) {
|
|
758
|
+
const text = renderCliText(example);
|
|
759
|
+
if (/(^|\s)-f\s+json(\s|$)/.test(text)) return text.replace(/(^|\s)-f\s+json(?=\s|$)/, '$1-f text');
|
|
760
|
+
if (/(^|\s)--format\s+json(\s|$)/.test(text)) return text.replace(/(^|\s)--format\s+json(?=\s|$)/, '$1--format text');
|
|
761
|
+
if (/(^|\s)(-f\s+text|--format\s+text|--json)(\s|$)/.test(text)) return text;
|
|
762
|
+
return `${text} -f text`;
|
|
763
|
+
}
|
|
764
|
+
|
|
757
765
|
function commandNetworkMode(commandName) {
|
|
758
766
|
if (NETWORK_NONE_COMMANDS.has(commandName)) return 'none';
|
|
759
767
|
if (NETWORK_CONDITIONAL_COMMANDS.has(commandName)) return 'conditional';
|
|
@@ -837,7 +845,9 @@ function buildCommandWorkflow(command) {
|
|
|
837
845
|
next.push('运行 model image-models 或 model video-models 选择模型', '选定模型后运行 model options --model-group-code <code>');
|
|
838
846
|
}
|
|
839
847
|
if (['create image-batch', 'create video-batch', 'create subject-batch'].includes(command.name)) {
|
|
840
|
-
next.push('读取每项 status / taskId /
|
|
848
|
+
next.push('读取每项 status / taskId / statusCommand / error');
|
|
849
|
+
next.push('默认使用 results[].taskId 或 results[].statusCommand 逐个 task status 查询;不要用 task list 查本批次结果');
|
|
850
|
+
next.push('如果调用方显式传了 --task-record-file 且响应包含 taskRecordFile / nextCommand,可运行 nextCommand 用 task record-poll 恢复查询');
|
|
841
851
|
}
|
|
842
852
|
return {
|
|
843
853
|
outputKind,
|
|
@@ -882,6 +892,7 @@ function buildCommandSchemaEntry(command) {
|
|
|
882
892
|
summary: summaryOf(command),
|
|
883
893
|
description: renderCliText(summaryOf(command)),
|
|
884
894
|
examples: extractExamples(command).map(renderCliText),
|
|
895
|
+
agentExamples: extractExamples(command).map(asAgentExample),
|
|
885
896
|
jsonExamples: extractExamples(command).map(asJsonExample),
|
|
886
897
|
requiredOptions,
|
|
887
898
|
requiredAnyOptions,
|
|
@@ -971,11 +982,11 @@ function buildAgentBrief(commands, version = 'unknown') {
|
|
|
971
982
|
{
|
|
972
983
|
intent: '异步任务和批量恢复',
|
|
973
984
|
start: ['task wait', 'task record-poll', 'task records'],
|
|
974
|
-
rule: '优先复用 create 返回的 nextCommand
|
|
985
|
+
rule: '优先复用 create 返回的 nextCommand;批量创建默认用 results[].taskId / statusCommand 查本批次,只有显式传 task-record-file 时才用 record-poll,失败项单独重试。',
|
|
975
986
|
},
|
|
976
987
|
],
|
|
977
988
|
lookup: {
|
|
978
|
-
preciseSchema: `${commandPrefix()} schema --domain <domain> --command <command> -f
|
|
989
|
+
preciseSchema: `${commandPrefix()} schema --domain <domain> --command <command> -f text`,
|
|
979
990
|
fullSchema: `${commandPrefix()} schema -f json`,
|
|
980
991
|
commandHelp: `${commandPrefix()} <domain> <command> -h`,
|
|
981
992
|
modelInputGuide: contract.modelInputGuide.textCommand,
|
|
@@ -1000,7 +1011,7 @@ function buildAgentContract() {
|
|
|
1000
1011
|
jsonFlag: '-f json',
|
|
1001
1012
|
textFlag: '-f text',
|
|
1002
1013
|
outputFormats: ['pretty', 'text', 'json', 'yaml', 'csv', 'auto'],
|
|
1003
|
-
outputPolicy: '默认输出 pretty 人类友好视图,包含标题、摘要表格、列表表格和下一步建议;Agent 推荐显式传 -f text 读取稳定的分区 key=value
|
|
1014
|
+
outputPolicy: '默认输出 pretty 人类友好视图,包含标题、摘要表格、列表表格和下一步建议;Agent 推荐显式传 -f text 读取稳定的分区 key=value 输出,不要为了图省事把模型探索 / 状态查询默认改成 -f json;脚本严格解析或需要完整嵌套结构时再传 -f json 或 --json。JSON envelope 字段已做归一化,见 canonicalFields。',
|
|
1004
1015
|
statePolicy: {
|
|
1005
1016
|
purpose: 'Agent 应在同一轮 / 同一项目中维护 AWB 上下文账本,减少重复查询和重复提交。',
|
|
1006
1017
|
cacheKeys: [
|
|
@@ -1021,7 +1032,8 @@ function buildAgentContract() {
|
|
|
1021
1032
|
'模型探索阶段只读 model list / options / create-spec;fee 只在用户确认关键参数后跑一次。',
|
|
1022
1033
|
'model options.params[] 中带 cliArg/genericModelParam 的新增模型配置参数可通过 --model-param key=value、--model-params-json 或同名下划线长参数传入;defaultValue 只能展示为候选默认,不能静默代选。',
|
|
1023
1034
|
'supportsDryRun=true 的写入 / 扣费命令先 dry-run,确认后 yes;不要把 dry-run 当参数探索工具反复跑。',
|
|
1024
|
-
'用户给出多条同模型同参数任务时优先 batch
|
|
1035
|
+
'用户给出多条同模型同参数任务时优先 batch,不要单条循环 create。',
|
|
1036
|
+
'批量创建后默认读取 results[].taskId / statusCommand 逐条查询本批次结果;不要用 task list 查本批次结果。只有调用方显式传 --task-record-file 且响应包含 taskRecordFile / nextCommand 时,才用 task record-poll 恢复查询。',
|
|
1025
1037
|
'命令返回 nextCommand / nextRefSubject / nextVoiceArg 时优先复用返回值,不手拼等价命令。',
|
|
1026
1038
|
'素材加白平台先通过 model asset-review-models 或用户明确输入确定;create asset-* 必须显式传 --platform,不要依赖默认平台。create asset 会自动判断 assetType=Image/Video/Audio,本地文件会用 ffprobe 校验图片/视频尺寸、视频时长/FPS/像素数和音频时长;不合法素材正式执行时会询问是否转码,非交互场景可追加 --auto-convert;macOS + Homebrew 环境缺失时 CLI 会自动安装 ffmpeg。',
|
|
1027
1039
|
'旧根域 image / video / asset / subject 已移除;只使用 create / task 等 schema 暴露的 domain。',
|
|
@@ -1037,7 +1049,7 @@ function buildAgentContract() {
|
|
|
1037
1049
|
{ canonical: 'pointCost', aliases: ['points', 'point', 'costPoint', 'estimatePoint'], meaning: '本次任务预计 / 实际消耗积分' },
|
|
1038
1050
|
],
|
|
1039
1051
|
},
|
|
1040
|
-
schemaPolicy: 'Agent 先读 schema --brief 建立能力地图;执行具体命令前再读精确 schema --domain <domain> --command <command
|
|
1052
|
+
schemaPolicy: 'Agent 先读 schema --brief -f text 建立能力地图;执行具体命令前再读精确 schema --domain <domain> --command <command> -f text。完整 schema -f json 只用于覆盖校验、脚本生成或调试 schema 本身;查看长帮助用 schema.commands[].helpCommand 或 lj-awb <domain> <command> -h。',
|
|
1041
1053
|
confirmationPolicy: 'schema.commands[].safety.requiresConfirmation=true 的命令,Agent 必须先向用户确认,再追加 --yes。',
|
|
1042
1054
|
dryRunPolicy: 'schema.commands[].safety.supportsDryRun=true 的写入 / 扣费命令,正式执行前优先跑 --dry-run。',
|
|
1043
1055
|
resourceShortcut: {
|
|
@@ -1195,8 +1207,8 @@ function printRootHelp(commands, version) {
|
|
|
1195
1207
|
helpHeading('More help:'),
|
|
1196
1208
|
helpCommand(` ${commandPrefix()} <domain> -h`),
|
|
1197
1209
|
helpCommand(` ${commandPrefix()} <domain> <command> -h`),
|
|
1198
|
-
helpCommand(` ${commandPrefix()} schema --brief -f
|
|
1199
|
-
helpCommand(` ${commandPrefix()} schema -f
|
|
1210
|
+
helpCommand(` ${commandPrefix()} schema --brief -f text`),
|
|
1211
|
+
helpCommand(` ${commandPrefix()} schema -f text`),
|
|
1200
1212
|
helpCommand(` ${commandPrefix()} doctor -h`),
|
|
1201
1213
|
'',
|
|
1202
1214
|
helpHeading('Global options:'),
|
package/skills/lj-awb/SKILL.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lj-awb
|
|
3
|
-
version: 0.5.
|
|
3
|
+
version: 0.5.5
|
|
4
4
|
description: "灵境 AWB CLI skill。使用 `lj-awb` 命令调用动漫平台 / AWB 云端能力,覆盖认证、项目组、积分余额/明细/用量(含充值购买与兑换码兑换)、模型发现、上传、统一 create 创建域、任务查询、视频超分。用户说生图、生视频、积分明细、积分流水、充值记录、消耗记录、主体、音色、素材加白、去字幕时使用。正式生成、切换项目组、清空认证、兑换码等写入或扣费动作前必须确认。"
|
|
5
5
|
metadata:
|
|
6
6
|
bootstrap:
|
|
7
7
|
package: "@lingjingai/lj-awb-cli"
|
|
8
|
-
version: "0.5.
|
|
8
|
+
version: "0.5.5"
|
|
9
9
|
bin: "lj-awb"
|
|
10
10
|
cliHelp: "lj-awb --help"
|
|
11
11
|
---
|
package/skills/lj-awb/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.5.
|
|
1
|
+
0.5.5
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
| `--quality` | 清晰度 / 分辨率档位 | 只能从 `model options.params[key=quality].values` 选择 |
|
|
13
13
|
| `--generate-num` | 生图张数 | 仅图片模型支持时使用 |
|
|
14
14
|
| `--duration` | 生视频时长,单位秒 | 对应平台旧参数 `generated_time`,只能从允许值选择 |
|
|
15
|
-
| `--need-audio` | 是否需要输出音效 | 仅用户明确要求输出音效,且 `model options.params[key=needAudio]`
|
|
15
|
+
| `--need-audio` | 是否需要输出音效 | 仅用户明确要求输出音效,且 `model options.params[key=needAudio]` 存在时使用;不是上传音频入口。**例外:可灵 3o / Kling 3.0 支持 needAudio 时 CLI 默认开启音效**;用户明确不要声音时传 `--need-audio false`。模型未暴露该 param 时不要为了"显式关闭"传 `--need-audio false`,CLI 会以 `argument_error: 模型不支持参数:needAudio` 拒绝 |
|
|
16
16
|
| `--model-param key=value` | 新增 / 未硬编码的模型配置参数 | key 必须来自 `model options.params[]`;可重复传。适合 `generation_effort=high` 这类通用 Enum / Boolean / Number / String 配置 |
|
|
17
17
|
| `--model-params-json` | 一次传多个通用模型配置参数 | JSON 对象或 JSON 文件路径;命令行专用参数如 `--ratio`、`--quality`、`--duration` 优先级更高 |
|
|
18
18
|
| `--resource` | 单个素材输入,可重复传 | `type:usage[:key]=path|url|asset:<id>` |
|
|
@@ -111,18 +111,18 @@ Agent 必须按顺序做:
|
|
|
111
111
|
2. 没有可复用候选时运行 `model image-models` 或 `model video-models`,按用户目的筛候选模型。
|
|
112
112
|
3. 向用户展示候选是硬门槛,**不是只列名字,也不是内部摘要**;没有完成这一步,不得推荐默认模型 / 参数,不得进入 `fee` 或 `create --dry-run`。按三步走:
|
|
113
113
|
- **基本信息**:`displayName` + `modelDesc`(运营填的特性描述,没填就只报 displayName)+ `taskQueueNum` 的人话表达(0 = 队列空闲 / 1-10 = 排队中 / >10 = 等待较长)。
|
|
114
|
-
- **参数取值**:对每个候选**并行**跑 `lj-awb model options --model-group-code <code> -f
|
|
114
|
+
- **参数取值**:对每个候选**并行**跑 `lj-awb model options --model-group-code <code> -f text`,把可控参数实际取值列出来:quality 档位列表 / ratio 比例列表 / video 的 duration 范围 / image 的 generateNum 上限 / 支持的资源模式(reference · first_frame · last_frame · audio · subject) / 是否暴露 needAudio / feeCalcType 转人话。只有必须程序化校验完整嵌套结构时才改用 `-f json`。
|
|
115
115
|
- **追问参数**:用户看完真实选项后再追问 quality / ratio / duration / generateNum。**不要在用户看过 `model options` 输出前就给出 16:9 / 720P 这类自编选项**——必须是模型真实支持的值。
|
|
116
116
|
|
|
117
117
|
**不要把 `modelGroupCode` 报给用户**——那是 agent 内部跑命令用的技术 ID,除非用户主动问"具体代码"。**不要自己从 `feeCalcType` / 参数上限里推**价格档 / 质量档 / 成功率。用户描述笼统时给 2-4 个常用候选;用户已经报了口语名时把同族所有变体(不同代次 / fast / pro / 不同渠道)全列出来;即使只匹配到 1 个也要把上面三步走完。
|
|
118
118
|
|
|
119
119
|
候选只是渠道差异(同款底模不同 vendor)时,**告诉用户**"这几个是同一底模的不同接入渠道",并按 `model options` 确认参数是否一致后建议按队列 / 计费选。
|
|
120
|
-
4. 对用户选中的模型,若本轮已读取 `model options` 则直接复用;否则运行 `model options --model-group-code <code> -f
|
|
121
|
-
5. 若本轮已读取 `model create-spec` 则直接复用;否则运行 `model create-spec --model-group-code <code> -f
|
|
120
|
+
4. 对用户选中的模型,若本轮已读取 `model options` 则直接复用;否则运行 `model options --model-group-code <code> -f text`。
|
|
121
|
+
5. 若本轮已读取 `model create-spec` 则直接复用;否则运行 `model create-spec --model-group-code <code> -f text`。
|
|
122
122
|
6. 先读 `inputRequirement`,确认是否必须提供视觉输入。
|
|
123
123
|
7. 用 `supportedIntents[]` 匹配用户意图;不要只看模型列表摘要就生成最终能力结论。
|
|
124
124
|
8. 参数枚举值只从 `model options.params[].values` 选择,素材限制只从 `model options.resources[]` 校验,参数 / 资源联动限制按 `model options.constraints[]` 收窄。新增通用参数只要在 `params[]` 中出现且带 `cliArg`,就通过 `--model-param` / `--model-params-json` 显式传入。
|
|
125
|
-
9. 不主动列举所有缺失控制项;只追问会影响价格 / 效果的关键参数。视频包括 `quality`、`duration`、约束后仍可选的 `ratio`,以及用户明确要求输出音效时的 `needAudio`;图片包括 `quality`、`ratio`、`generateNum`。
|
|
125
|
+
9. 不主动列举所有缺失控制项;只追问会影响价格 / 效果的关键参数。视频包括 `quality`、`duration`、约束后仍可选的 `ratio`,以及用户明确要求输出音效时的 `needAudio`;图片包括 `quality`、`ratio`、`generateNum`。例外:可灵 3o / Kling 3.0 支持 `needAudio` 时默认开启音效,用户明确不要声音时再传 `--need-audio false`。
|
|
126
126
|
10. 组装最终 prompt;默认使用用户原文。若用户明确要求优化 / 代写且最终 prompt 与用户原文发生任何可见语义变化,先展示原始 prompt 和最终 prompt,等待用户确认。
|
|
127
127
|
11. 若用户上传或指定音频文件,必须先确认 `model options.resources[]` 中存在 `mediaType=AUDIO usage=reference` 后再组织 `audio:reference` 资源;只有用户明确要求“输出是否带模型生成音效/音频”时,才检查 `model options.params[]` 是否存在 `needAudio`。
|
|
128
128
|
12. 用户未提供关键参数时,把 `model options.params[].values` 和 `defaultValue` 转成候选问题;用户选择或确认“按默认”前,不跑 `create image-fee` / `create video-fee`,也不跑 `create --dry-run`。即使模型给了 `defaultValue`,也不要静默写入请求。
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
## 核心原则
|
|
6
6
|
|
|
7
|
-
- CLI schema 是命令事实来源,但不要默认吞完整 schema:非单条查询任务先读一次 `lj-awb schema --brief -f
|
|
8
|
-
- 执行具体命令前,如果命令、参数、requiredOptions、safety 或 nextActions
|
|
7
|
+
- CLI schema 是命令事实来源,但不要默认吞完整 schema:非单条查询任务先读一次 `lj-awb schema --brief -f text`,掌握能力域、安全分组、路由和 agentContract。
|
|
8
|
+
- 执行具体命令前,如果命令、参数、requiredOptions、safety 或 nextActions 不确定,优先运行精确 schema 的 text 输出(例如 `lj-awb schema --domain model --command video-models -f text`)并等结果返回,再根据 `options[].flag` 组织业务命令;不要把 schema 查询和猜测命令放在同一批并行工具调用里。
|
|
9
9
|
- 只有生成覆盖报告、调试 schema 本身或 brief 缺失字段时,才运行完整 `lj-awb schema -f json`。
|
|
10
10
|
- Skill 是驱动器,不是命令百科。先在本模块决定链路,只在需要时加载一个细节模块。
|
|
11
11
|
- 同一对话维护 AWB 状态账本;除非用户切换账号、团队、项目组、模型、素材、prompt 或关键参数,否则不要重复跑同样的查询。
|
|
@@ -20,8 +20,8 @@ Agent 在当前任务中记录这些值,后续直接复用:
|
|
|
20
20
|
|
|
21
21
|
| 键 | 来源 | 失效条件 |
|
|
22
22
|
|----|------|----------|
|
|
23
|
-
| `agentBrief` | `lj-awb schema --brief -f
|
|
24
|
-
| `commandSchema:<name>` | `lj-awb schema --domain <domain> --command <command> -f
|
|
23
|
+
| `agentBrief` | `lj-awb schema --brief -f text` | CLI 版本变化 |
|
|
24
|
+
| `commandSchema:<name>` | `lj-awb schema --domain <domain> --command <command> -f text` | CLI 版本变化或命令不匹配 |
|
|
25
25
|
| `auth/account/team` | `doctor --verify`、`account info` | 登录 / 团队切换 |
|
|
26
26
|
| `projectGroupNo` | `project current` 或用户指定 | 项目组切换 |
|
|
27
27
|
| `modelCandidates` | `model image-models` / `model video-models` | 任务类型或关键词变化 |
|
|
@@ -198,8 +198,8 @@ CLI 当前能力分为:
|
|
|
198
198
|
这是硬 STOP 门,不是内部检查清单。Agent 输出候选清单后必须停下,等待用户选择模型和关键参数,或等待用户明确说“按默认 / 你来选”。没有这个确认,不得写批量输入文件、不得估价、不得 dry-run、不得正式 create。
|
|
199
199
|
|
|
200
200
|
1. 用 schema 或命令帮助确认过滤参数名,模型关键词统一走 `--model <keyword>`,不要猜 `--keyword`。
|
|
201
|
-
2. 跑 `model image-models --model <keyword> -f
|
|
202
|
-
3. 对每个候选并行跑 `model options --model-group-code <code> -f
|
|
201
|
+
2. 跑 `model image-models --model <keyword> -f text` 或 `model video-models --model <keyword> -f text`。用户已经给出口语名时,同族候选全部保留;不要只取第一个。
|
|
202
|
+
3. 对每个候选并行跑 `model options --model-group-code <code> -f text`,读取真实 `quality`、`ratio`、`duration` / `generateNum`、默认值、资源模式和约束;只有必须程序化校验完整嵌套结构时才改用 `-f json`。
|
|
203
203
|
4. 必须向用户输出可见清单:模型显示名、描述、排队状态、可选参数、默认值、支持的资源模式(图片 / 视频 / 音频 reference、首帧 / 首尾帧、主体等)、渠道差异。`modelGroupCode` 默认只内部使用,除非用户主动问技术 ID。
|
|
204
204
|
5. 用户看完清单后再问关键参数或给建议。即使只命中 1 个候选,也要展示该模型的真实可选项;不要用“我倾向 4:3 / 5s / 720P”代替候选清单。
|
|
205
205
|
6. 如果精确关键词 0 命中后扩展搜索,必须明确说明“未命中 <原词>,以下是 <扩展词> 候选”,并在清单后 STOP;不要直接把扩展候选当成用户已选模型。
|
|
@@ -207,7 +207,9 @@ CLI 当前能力分为:
|
|
|
207
207
|
### 批量任务
|
|
208
208
|
|
|
209
209
|
- 用户给出 2 条以上同模型同参数任务时,优先建议 `create image-batch` / `create video-batch`。
|
|
210
|
-
-
|
|
210
|
+
- 批量提交后默认读取 `results[].taskId` / `results[].statusCommand`,逐条查询本批次结果。
|
|
211
|
+
- 只有显式传了 `--task-record-file` 且响应包含 `taskRecordFile` / `nextCommand` 时,才运行 `nextCommand` 用台账恢复查询。
|
|
212
|
+
- 不要用 `task list` 查本批次结果;它是远端列表,可能混入其他人或其他批次任务。
|
|
211
213
|
- 单条失败只重跑失败项,不全批重跑。
|
|
212
214
|
|
|
213
215
|
### 主体与音色
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
lj-awb model image-models --model "<keyword>"
|
|
34
|
-
lj-awb model options --model-group-code <modelGroupCode> -f
|
|
35
|
-
lj-awb model create-spec --model-group-code <modelGroupCode> -f
|
|
34
|
+
lj-awb model options --model-group-code <modelGroupCode> -f text
|
|
35
|
+
lj-awb model create-spec --model-group-code <modelGroupCode> -f text
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
如果用户没有指定 `ratio`、`quality` 或 `generateNum`,先展示 `model options.params[].values` 和默认值让用户选择;用户确认后再执行(命中「简单生图一次性选择门」时,把这些参数和模型合并成一条让用户一次选好,没提到的取 `defaultValue`,选完直接生成):
|
|
@@ -66,7 +66,7 @@ lj-awb create image \
|
|
|
66
66
|
- `generation_effort` 这类新增模型配置参数如果出现在 `model options.params[]`,先把可选值 / `defaultValue` 展示给用户;用户确认后用 `--model-param generation_effort=<value>` 或 `--model-params-json` 传入,不要等专用 CLI flag。
|
|
67
67
|
- 正式提交必须带 `--yes`;如果需要看请求体,先用 `--dry-run`。
|
|
68
68
|
- 批量 JSON/JSONL 每项只写 `prompt`、`ratio`、`quality`、`generate_num`、`resources`、`resource`、`model_params`,也可直接写模型配置下划线参数;模型组和项目组放命令行公共参数。
|
|
69
|
-
- **批量是 best-effort**:`create-batch` 子任务**单条失败不会回滚整批**,已成功项依然扣分并产生 taskId
|
|
69
|
+
- **批量是 best-effort**:`create-batch` 子任务**单条失败不会回滚整批**,已成功项依然扣分并产生 taskId。提交后必读响应里的 `successCount` / `failureCount` 和每项 `status` / `taskId` / `statusCommand` / `error`,给用户汇总"成功 N / 失败 M",对失败项单独 fix + 重跑(不要全批重跑)。只有显式传了 `--task-record-file` 且响应包含 `taskRecordFile` / `nextCommand` 时,才使用台账恢复查询。
|
|
70
70
|
- **多镜头 / 多 prompt 时主动建议并行**:用户一次给出 ≥2 个同模型同参数的图片任务(典型场景:分镜、组图、多 prompt 候选)时,Agent 必须先告知"这批可以用 `create image-batch --concurrency N` 并行执行(n 个任务,预计耗时 / 单次估价 × n)",并询问用户是否要并行。用户同意 → 走 batch;用户希望逐条审稿 / 调 prompt → 继续单条 create。**不要默认一条一条串行还不告知**,这种沉默会浪费用户时间。
|
|
71
71
|
- 等待超时只代表本轮轮询结束,不能对用户说任务失败。
|
|
72
72
|
- 输出字段速查见 [`../references/output-fields.md`](../references/output-fields.md) 的"生图 / 生视频"小节;错误恢复见 [`../references/error-codes.md`](../references/error-codes.md)。
|
|
@@ -74,6 +74,6 @@ lj-awb create image \
|
|
|
74
74
|
## 下一步
|
|
75
75
|
|
|
76
76
|
- `create image` 返回 `taskId` + `nextCommand`(通常 = `task wait`)→ **立刻接着跑** `task wait --task-id <id> --wait-seconds 180`,不要让用户再问"好了没"。
|
|
77
|
-
- `create image-batch`
|
|
77
|
+
- `create image-batch` 提交后,默认用响应里的 `results[].taskId` / `results[].statusCommand` 逐条查本批次;如果响应包含 `taskRecordFile` / `nextCommand`,可直接运行 `nextCommand` 恢复查询;不要用 `task list` 查本批次。
|
|
78
78
|
- 任务终态拿到 `resultUrls` → 视场景决定:① 直接交付给用户(整条 URL **原样**贴出,含 `?sign=` 签名查询串,不可只贴基础部分,见 [`task.md`](task.md) 交付规则);② 用作下一轮生图 / 生视频的参考图(直接以 result URL 喂 `--resource image:reference=<url>`)。
|
|
79
79
|
- 任务 `SUCCESS` 后**立刻**查素材库可能查不到——后端 `saveResourceToMaterial` 是事务提交后异步执行,详见 [`task.md`](task.md) 规则。优先用 `resultUrls` 直接消费;非要列素材库时先 sleep 2-3 秒。
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
| `lj-awb model image-models --model "<keyword>"` | 查询生图候选模型 |
|
|
10
10
|
| `lj-awb model video-models --model "<keyword>"` | 查询生视频候选模型 |
|
|
11
11
|
| `lj-awb model asset-review-models --model-group-code <code>` | 查询支持素材加白的模型组与平台关系 |
|
|
12
|
-
| `lj-awb model input-guide -f
|
|
13
|
-
| `lj-awb model options --model-group-code <code> -f
|
|
14
|
-
| `lj-awb model create-spec --model-group-code <code> -f
|
|
12
|
+
| `lj-awb model input-guide -f text` | 查看统一创建参数、resources 字段和素材绑定规则 |
|
|
13
|
+
| `lj-awb model options --model-group-code <code> -f text` | 查看该模型支持的 CLI 参数、枚举值、默认值、素材约束和条件约束 |
|
|
14
|
+
| `lj-awb model create-spec --model-group-code <code> -f text` | 查看该模型如何创建任务:输入模式、素材绑定规则、示例和前置步骤 |
|
|
15
15
|
|
|
16
16
|
## 选择模型
|
|
17
17
|
|
|
@@ -60,9 +60,11 @@ Agent 读取这些字段:
|
|
|
60
60
|
用户选定模型后,若本轮未缓存该模型的创建规格,运行:
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
lj-awb model create-spec --model-group-code <modelGroupCode> -f
|
|
63
|
+
lj-awb model create-spec --model-group-code <modelGroupCode> -f text
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
Agent 默认用 `-f text` 读取;只有需要程序化校验完整嵌套结构时才改用 `-f json`。
|
|
67
|
+
|
|
66
68
|
Agent 读取这些字段:
|
|
67
69
|
|
|
68
70
|
- `taskKind`:`image` 或 `video`,决定使用 `create image` 还是 `create video`。
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
1. 本轮尚未验证时运行 `lj-awb doctor --verify`,确认认证、API、项目组、UTF-8。
|
|
8
8
|
2. 没有可复用候选时运行 `model image-models` 或 `model video-models`,按用户目标筛候选;用户给了口语名时保留同族全部候选,不只取第一项。
|
|
9
|
-
3. 进入“模型候选展示门”:对候选跑 `model options --model-group-code <code> -f json
|
|
10
|
-
4. 选中模型的创建规格未缓存时运行 `model create-spec --model-group-code <code> -f
|
|
9
|
+
3. 进入“模型候选展示门”:对候选跑 `model options --model-group-code <code> -f text`,把每个候选的参数取值、默认值、素材约束和资源模式转成用户可见清单;只有必须程序化校验完整嵌套结构时才用 `-f json`。
|
|
10
|
+
4. 选中模型的创建规格未缓存时运行 `model create-spec --model-group-code <code> -f text`。
|
|
11
11
|
5. 用 `inputRequirement` 判断是否必须有视觉输入;用 `supportedIntents` 判断素材模式;用 `model options.params` 判断 `ratio`、`quality`、`duration` 等枚举。
|
|
12
|
-
6. 在 `fee` 或 `create --dry-run` 前,先确认用户未提供但会影响价格 / 效果的关键参数:视频 `quality`、`duration`、约束后仍可选的 `ratio`,以及用户明确要输出音效时的 `needAudio`;图片 `quality`、`ratio`、`generateNum`。
|
|
12
|
+
6. 在 `fee` 或 `create --dry-run` 前,先确认用户未提供但会影响价格 / 效果的关键参数:视频 `quality`、`duration`、约束后仍可选的 `ratio`,以及用户明确要输出音效时的 `needAudio`;图片 `quality`、`ratio`、`generateNum`。例外:可灵 3o / Kling 3.0 支持 `needAudio` 时默认开声音,用户明确不要声音时再传 `--need-audio false`。
|
|
13
13
|
7. 组装最终 prompt:用户有明确 prompt / 创作描述时默认原文直出;操作性指令只用于模型和资源选择;没有明确需求时先追问或用最小中性表达;只有用户明确要求绑定参考对象时才考虑 `<<<key>>>`。任何可见语义变化都必须先展示原始 prompt 和最终 prompt,等待确认。
|
|
14
14
|
8. 用户确认关键参数和最终 prompt 后,先 `fee`,再 `create --dry-run`。
|
|
15
15
|
9. 用户确认模型、项目组、最终 prompt、素材、参数和预估积分后,才加 `--yes`。
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
| `lj-awb task list --task-type IMAGE_CREATE --project-group-no <no>` | 列出远端任务(按类型过滤) |
|
|
10
10
|
| `lj-awb task status --task-id <id>` | 按 taskId 查询单个任务状态(生图 / 生视频 / 去字幕 / 超分统一返回结构) |
|
|
11
11
|
| `lj-awb task wait --task-id <id> --wait-seconds 180` | 等待单个任务进入终态 |
|
|
12
|
-
| `lj-awb task records --task-record-file .awb/tasks.jsonl` |
|
|
12
|
+
| `lj-awb task records --task-record-file .awb/tasks.jsonl` | 读本地任务台账 |
|
|
13
13
|
| `lj-awb task records --pending-only --task-record-file .awb/tasks.jsonl` | 只看未终态记录 |
|
|
14
14
|
| `lj-awb task record-poll --task-record-file .awb/tasks.jsonl --wait-seconds 180` | 一次性轮询台账里所有未终态任务 |
|
|
15
15
|
|
|
@@ -24,21 +24,16 @@ lj-awb task wait --task-id <id> --wait-seconds 180
|
|
|
24
24
|
|
|
25
25
|
返回 `task_still_running`(exit 20)= 等待窗口结束、任务**未失败**。直接续跑(增大 `--wait-seconds` 或重复几轮)。详见 [`../references/error-codes.md`](../references/error-codes.md) 场景 2。
|
|
26
26
|
|
|
27
|
-
###
|
|
27
|
+
### 批量查询
|
|
28
28
|
|
|
29
|
-
`create image-batch` / `create video-batch` / `
|
|
29
|
+
`create image-batch` / `create video-batch` 返回每个子任务的 `taskId` / `statusCommand`。批量提交后优先直接用响应里的 `statusCommand` 逐条查询:
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
|
|
33
|
-
lj-awb task records --pending-only
|
|
34
|
-
|
|
35
|
-
# 2. 一键续等所有未完(推荐,免去逐个 wait)
|
|
36
|
-
lj-awb task record-poll --wait-seconds 180
|
|
37
|
-
|
|
38
|
-
# 3. 终态后做汇总
|
|
39
|
-
lj-awb task records
|
|
32
|
+
lj-awb task status --task-id <taskId>
|
|
40
33
|
```
|
|
41
34
|
|
|
35
|
+
`--task-record-file` / `task record-poll` 只作为高级恢复能力使用:如果调用方明确传了台账文件,且 batch 响应包含 `taskRecordFile` / `nextCommand`,才用台账续等;普通批量结果不要为了查询本批次去创建额外文件。
|
|
36
|
+
|
|
42
37
|
### 历史查询
|
|
43
38
|
|
|
44
39
|
不知道 `taskId` 但记得做过:
|
|
@@ -69,7 +64,7 @@ CLI 当前**不暴露 task cancel**;用户问"能不能停掉这个任务"时
|
|
|
69
64
|
|
|
70
65
|
## 规则
|
|
71
66
|
|
|
72
|
-
- 异步任务必须保存 `taskId
|
|
67
|
+
- 异步任务必须保存 `taskId`;批量任务默认使用 `results[].taskId` / `results[].statusCommand` 逐条查询本批次结果。只有响应包含 `taskRecordFile` / `nextCommand` 时才用台账恢复查询。
|
|
73
68
|
- `task wait` 返回 `task_still_running` 时复述 hint,不要误报失败;`taskStatus=FAILED` 或 `errorMessage` 非空才是真失败。
|
|
74
69
|
- **`task wait` 成功 ≠ 素材库立刻可读**:后端在事务提交后**异步**执行 `saveResourceToMaterial`(`afterCommit` 钩子),即使 `taskStatus=SUCCESS` 拿到 `resultUrls`,对应的 `material` / `asset` 行也可能还没落库。需要立刻复用结果时,优先使用 `resultUrls` / `assetPath` / `taskRecordId` 直接推进;非要查素材库时先 sleep 2-3 秒,不要靠 list 接口密集轮询。
|
|
75
70
|
- 输出字段只提取 `taskId / taskStatus / isTerminal / resultUrls / errorMessage`,详见 [`../references/output-fields.md`](../references/output-fields.md) 的"生图 / 生视频"和"任务台账"小节。
|
|
@@ -77,7 +72,7 @@ CLI 当前**不暴露 task cancel**;用户问"能不能停掉这个任务"时
|
|
|
77
72
|
- `create video-subtitle-removal` / `create video-super-resolution` 返回 `nextCommand` 时直接执行该命令;不要把它改写成通用 `task wait`。
|
|
78
73
|
- `task status` / `task wait` 只依赖 `taskId` 查询状态。
|
|
79
74
|
- 不要把大型 raw JSON 整段塞回上下文。
|
|
80
|
-
- `task list` 是远端查询、`task records`
|
|
75
|
+
- `task list` 是远端查询、`task records` 是本地台账;两者覆盖范围不同(台账只有本机创建的任务)。批量结果优先用本次返回的 taskId,不要用 `task list` 找本批次。
|
|
81
76
|
|
|
82
77
|
## 下一步
|
|
83
78
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
| `--duration` | 指定视频秒数 | `model options.params[key=duration].values` |
|
|
29
29
|
| `--ratio` | 指定画幅比例 | `model options.params[key=ratio].values`,并受 `model options.constraints[]` 联动限制 |
|
|
30
30
|
| `--quality` | 指定清晰度 | `model options.params[key=quality].values` |
|
|
31
|
-
| `--need-audio` | 是否需要输出音效 | 仅 `model options.params[key=needAudio]`
|
|
31
|
+
| `--need-audio` | 是否需要输出音效 | 仅 `model options.params[key=needAudio]` 存在时可用;普通模型用户明确要求输出音效时才传。可灵 3o / Kling 3.0 默认开启音效,用户明确不要声音时传 `--need-audio false` |
|
|
32
32
|
| `--model-param key=value` / `--model-params-json` | 新增通用模型配置参数,如 `generation_effort` | `model options.params[]` 中带 `cliArg` / `genericModelParam` 的参数 |
|
|
33
33
|
| `--resource image:reference[:key]=...` | 参考图生视频 | `model create-spec.supportedIntents.mode=reference` 必须存在,格式 / 数量约束看 `model options.resources[]` |
|
|
34
34
|
| `--resource audio:reference=...` | 参考音频 / 配乐 / 配音 / 节奏参考 | `model options.resources[]` 中必须存在 `mediaType=AUDIO usage=reference` |
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
42
|
lj-awb model video-models --model "<keyword>"
|
|
43
|
-
lj-awb model options --model-group-code <modelGroupCode> -f
|
|
44
|
-
lj-awb model create-spec --model-group-code <modelGroupCode> -f
|
|
43
|
+
lj-awb model options --model-group-code <modelGroupCode> -f text
|
|
44
|
+
lj-awb model create-spec --model-group-code <modelGroupCode> -f text
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
如果用户没有指定 `quality`、`duration` 或约束后仍可选的 `ratio`,先展示 `model options.params[].values` 和默认值让用户选择;用户确认后再执行:
|
|
@@ -76,7 +76,7 @@ lj-awb create video \
|
|
|
76
76
|
- Agent 向用户解释模型能力时,默认说“支持参考图 / 首帧 / 首尾帧 / 主体引用”等正向能力;不要默认列“无音频参数、无多条数参数”。
|
|
77
77
|
- `fee` 和 `create --dry-run` 前必须确认缺失的关键参数;不要把 `model options.params[].defaultValue` 当成用户选择。用户说“按默认”后才继续。
|
|
78
78
|
- `generation_effort` 这类新增模型配置参数如果出现在 `model options.params[]`,先把可选值 / `defaultValue` 展示给用户;用户确认后用 `--model-param generation_effort=<value>` 或 `--model-params-json` 传入,不要等专用 CLI flag。
|
|
79
|
-
- 面向用户列参数时,`needAudio` 说成“音效:是否需要输出音效”;不要用 CLI flag
|
|
79
|
+
- 面向用户列参数时,`needAudio` 说成“音效:是否需要输出音效”;不要用 CLI flag 加技术解释的写法。可灵 3o / Kling 3.0 支持该参数时默认开声音;用户明确不要声音时写 `--need-audio false`。只有展示最终命令时才写 `--need-audio true/false`。
|
|
80
80
|
- 音频参考:必须先确认 `model options.resources[]` 暴露 `mediaType=AUDIO usage=reference`,否则不要硬传;统一用 `--resource audio:reference=...` 或 JSON `{ "type": "audio", "usage": "reference" }`。
|
|
81
81
|
- `--need-audio` / `audio:reference` / 资源模式互斥 / `reference_key` 对齐 / `<<<key>>>` 等创建协议统一见 [`create-contract.md`](create-contract.md) §素材组织 + §参数含义,不在本文重复。
|
|
82
82
|
- 使用首帧 / 首尾帧等资源后,如果 `model options.constraints[]` 对 `ratio` 等目标参数返回 `effect=no_selectable_values`,不要再追问或传该参数。
|
|
@@ -84,7 +84,7 @@ lj-awb create video \
|
|
|
84
84
|
- `supportLastFrameOnly=false` 只表示不支持"仅尾帧";不要据此判断不支持首尾帧过渡。是否可传 `image:last_frame` 看 `model options.resources[].usage` / `model create-spec.supportedIntents[].usage` 是否包含 `last_frame`。
|
|
85
85
|
- 视频素材(参考图 / 首帧 / 尾帧 / 关键帧 / 音频)source.value 取值优先级、不要复用 myqcloud 完整 URL 规则统一在 [`create-contract.md`](create-contract.md) §素材组织。`image:reference=asset:<assetId>` / `image:first_frame=asset:<assetId>` / `image:last_frame=asset:<assetId>` 是素材引用;`subject:reference:<key>=asset:<subjectId>` 是主体引用。主体引用必须先 `create subject` + `create subject-wait` 得到 `externalId`。
|
|
86
86
|
- 批量 JSON/JSONL 每项只写 `prompt`、`ratio`、`quality`、`duration`、`need_audio`、`resources`、`resource`、`model_params`,也可直接写模型配置下划线参数;其中 `need_audio` 表示是否需要输出音效,音频素材仍写入 `resources`。
|
|
87
|
-
- **批量是 best-effort**:`create-batch` 子任务**单条失败不会回滚整批**,已成功项依然扣分并产生 taskId
|
|
87
|
+
- **批量是 best-effort**:`create-batch` 子任务**单条失败不会回滚整批**,已成功项依然扣分并产生 taskId。提交后必读响应里的 `successCount` / `failureCount` 和每项 `status` / `taskId` / `statusCommand` / `error`,给用户汇总"成功 N / 失败 M",对失败项单独 fix + 重跑(不要全批重跑)。只有显式传了 `--task-record-file` 且响应包含 `taskRecordFile` / `nextCommand` 时,才使用台账恢复查询。
|
|
88
88
|
- 视频任务默认可能耗时较长,批量和复杂任务应异步提交并记录 task id。
|
|
89
89
|
- 视频超分直接传 `objectName`,通常是 material backendPath 或 COS 对象路径;正式提交前先跑 `create video-super-resolution-fee`,再 `--dry-run`,确认后 `--yes`,返回后按 `nextCommand` 或 `task status --task-id <id>` 查询。
|
|
90
90
|
- **多镜头 / 多分镜时主动建议并行**:用户一次给出 ≥2 个同模型同参数的视频任务(典型场景:分镜流水线、批量首尾帧动画)时,Agent 必须先告知"这批可以用 `create video-batch --concurrency N` 并行执行(n 个任务,预计耗时 / 单次估价 × n)",并询问用户是否要并行。用户同意 → 走 batch;用户希望逐条审稿 → 继续单条 create。**不要默认一条一条串行还不告知**。
|
|
@@ -96,7 +96,7 @@ lj-awb create video \
|
|
|
96
96
|
|
|
97
97
|
- `create video` 返回 `taskId` + `nextCommand` → 立刻 `task wait --task-id <id> --wait-seconds 300`。
|
|
98
98
|
- `create video-super-resolution` 返回 `taskId` + `nextCommand` → 立刻运行返回的 `task status --task-id <id>`。
|
|
99
|
-
- `create video-batch`
|
|
99
|
+
- `create video-batch` 提交后,默认用响应里的 `results[].taskId` / `results[].statusCommand` 逐条查本批次;如果响应包含 `taskRecordFile` / `nextCommand`,可直接运行 `nextCommand` 恢复查询;不要用 `task list` 查本批次。
|
|
100
100
|
- 任务终态 `resultUrls` → 按集 / 场 / 镜头交付给用户(整条 URL **原样**贴出,含 `?sign=` / `?X-Tos-*` 签名查询串,不可只贴 `.mp4` 前的基础部分,见 [`task.md`](task.md) 交付规则),或用作后续生成的参考。
|
|
101
101
|
- 任务 `SUCCESS` 后**立刻**用素材库接口找这条视频时可能查不到——后端 `saveResourceToMaterial` 是事务提交后异步执行,详见 [`task.md`](task.md) 规则。优先用 `resultUrls` 直接消费;非要列素材库时先 sleep 2-3 秒。
|
|
102
102
|
- Seedance 原始视频带英文字幕 → 对成功的视频任务运行 `create video-subtitle-removal --source-task-id <videoTaskId> --yes` → `task status --task-id <subtitleTaskId>`。
|
|
@@ -52,8 +52,8 @@ lj-awb project current
|
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
lj-awb model video-models --model Seedance
|
|
55
|
-
lj-awb model options --model-group-code <modelGroupCode> -f
|
|
56
|
-
lj-awb model create-spec --model-group-code <modelGroupCode> -f
|
|
55
|
+
lj-awb model options --model-group-code <modelGroupCode> -f text
|
|
56
|
+
lj-awb model create-spec --model-group-code <modelGroupCode> -f text
|
|
57
57
|
|
|
58
58
|
lj-awb create video-fee --model-group-code <code> --prompt "<...>" \
|
|
59
59
|
--resource image:reference=<path-or-url> \
|
|
@@ -63,7 +63,7 @@ lj-awb create video-fee --model-group-code <code> --prompt "<...>" \
|
|
|
63
63
|
lj-awb create video --model-group-code <code> --prompt "<...>" \
|
|
64
64
|
--resource image:reference=<path-or-url> \
|
|
65
65
|
--ratio <ratio> --quality <quality> --duration <seconds> \
|
|
66
|
-
--project-group-no <projectGroupNo> --
|
|
66
|
+
--project-group-no <projectGroupNo> --dry-run
|
|
67
67
|
|
|
68
68
|
# 用户确认后把 --dry-run 换成 --yes 正式提交,再 task wait --task-id <id>
|
|
69
69
|
```
|
|
@@ -85,7 +85,7 @@ lj-awb create video --model-group-code <code> --prompt "<...>" \
|
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
87
|
lj-awb model image-models --model <keyword>
|
|
88
|
-
lj-awb model options --model-group-code <code> -f
|
|
88
|
+
lj-awb model options --model-group-code <code> -f text
|
|
89
89
|
lj-awb create image --model-group-code <code> --prompt "<...>" \
|
|
90
90
|
--resource image:reference=<path-or-url> \
|
|
91
91
|
--ratio <ratio> --quality <quality> \
|
|
@@ -106,15 +106,11 @@ lj-awb create video-batch \
|
|
|
106
106
|
--input-file ./video.jsonl \
|
|
107
107
|
--model-group-code <modelGroupCode> \
|
|
108
108
|
--project-group-no <projectGroupNo> \
|
|
109
|
-
--task-record-file .awb/tasks.jsonl \
|
|
110
109
|
--concurrency 3 \
|
|
111
110
|
--yes \
|
|
112
111
|
|
|
113
112
|
|
|
114
|
-
lj-awb task
|
|
115
|
-
--task-record-file .awb/tasks.jsonl \
|
|
116
|
-
--pending-only \
|
|
117
|
-
--wait-seconds 300 \
|
|
113
|
+
lj-awb task status --task-id <taskId> -f text
|
|
118
114
|
|
|
119
115
|
```
|
|
120
116
|
|
|
@@ -127,8 +123,8 @@ lj-awb task record-poll \
|
|
|
127
123
|
|
|
128
124
|
规则:
|
|
129
125
|
|
|
130
|
-
-
|
|
131
|
-
- 单条失败不代表整批失败;读取每项 `status`、`taskId`、`error` 再汇总。
|
|
126
|
+
- 批量任务默认使用返回的 `results[].taskId` / `results[].statusCommand` 查询本批次;只有显式需要中断恢复时才传 `--task-record-file` 并使用 `task record-poll`。
|
|
127
|
+
- 单条失败不代表整批失败;读取每项 `status`、`taskId`、`statusCommand`、`error` 再汇总。
|
|
132
128
|
- 不要把全部结果原始 JSON 粘给用户,只汇报成功数、失败数、任务 ID 和结果 URL。
|
|
133
129
|
- **不要用 `create image` / `create video` 单条循环跑 ≥2 个同模型同参数任务**:识别到这种场景,先告知用户可以走 batch + 并行(n 个任务、预估耗时、单次估价 × n),询问后再决定走 batch 还是单条。
|
|
134
130
|
|
|
@@ -150,17 +146,14 @@ lj-awb task record-poll \
|
|
|
150
146
|
--input-file ./image.jsonl \
|
|
151
147
|
--model-group-code GPT2_ImageCreate_Group_Discount \
|
|
152
148
|
--project-group-no <projectGroupNo> \
|
|
153
|
-
--task-record-file .awb/storyboard.jsonl \
|
|
154
149
|
--concurrency 4 \
|
|
155
150
|
--yes
|
|
156
151
|
```
|
|
157
152
|
|
|
158
|
-
3.
|
|
153
|
+
3. 读取批量响应中的 `results[].taskId` / `results[].statusCommand`,逐条轮询完成并取结果 URL:
|
|
159
154
|
|
|
160
155
|
```bash
|
|
161
|
-
lj-awb task
|
|
162
|
-
--task-record-file .awb/storyboard.jsonl \
|
|
163
|
-
--pending-only --wait-seconds 600
|
|
156
|
+
lj-awb task wait --task-id <taskId> --wait-seconds 600 -f text
|
|
164
157
|
```
|
|
165
158
|
|
|
166
159
|
4. 把每条 `taskId` 的 `result` 图(COS 对象路径,**用 `backendPath` 形式**)作为视频任务的 `first_frame`,组装 `video.jsonl`:
|
|
@@ -177,7 +170,6 @@ lj-awb task record-poll \
|
|
|
177
170
|
--input-file ./video.jsonl \
|
|
178
171
|
--model-group-code <video-model-group-code> \
|
|
179
172
|
--project-group-no <projectGroupNo> \
|
|
180
|
-
--task-record-file .awb/storyboard-video.jsonl \
|
|
181
173
|
--concurrency 3 \
|
|
182
174
|
--yes
|
|
183
175
|
```
|
|
@@ -196,7 +188,7 @@ lj-awb task record-poll \
|
|
|
196
188
|
```bash
|
|
197
189
|
lj-awb upload files \
|
|
198
190
|
--files ./hero.png,./scene.png \
|
|
199
|
-
-f
|
|
191
|
+
-f text
|
|
200
192
|
```
|
|
201
193
|
|
|
202
194
|
读取响应 `data.files[].backendPath`(形如 `material/...`),把这个值(**不是 `url` 字段**)写入下游。上面是图片创建参考图,默认 scene 是 `material-image-draw`;如果预上传后要作为视频首帧 / 尾帧 / 参考图或主体素材复用,命令必须显式加 `--scene-type material-video-create`。
|
|
@@ -206,7 +198,6 @@ lj-awb create video-batch \
|
|
|
206
198
|
--input-file ./video.jsonl \
|
|
207
199
|
--model-group-code <modelGroupCode> \
|
|
208
200
|
--project-group-no <projectGroupNo> \
|
|
209
|
-
--task-record-file .awb/tasks.jsonl \
|
|
210
201
|
--concurrency 3 \
|
|
211
202
|
--yes
|
|
212
203
|
```
|