@lingjingai/lj-awb-cli-pre 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.
Files changed (49) hide show
  1. package/README.md +335 -0
  2. package/build/_shared.mjs +130 -0
  3. package/build/build.mjs +50 -0
  4. package/build/pre-publish.mjs +57 -0
  5. package/build/pre.mjs +42 -0
  6. package/build/prod.mjs +52 -0
  7. package/install.mjs +53 -0
  8. package/package.json +44 -0
  9. package/packages/awb-cli/README.md +19 -0
  10. package/packages/awb-cli/bin/lj-awb +19 -0
  11. package/packages/awb-cli/bin/lj-awb.js +11 -0
  12. package/packages/awb-cli/package.json +18 -0
  13. package/packages/awb-core/README.md +12 -0
  14. package/packages/awb-core/package.json +21 -0
  15. package/packages/awb-core/src/api.js +349 -0
  16. package/packages/awb-core/src/artifact.js +936 -0
  17. package/packages/awb-core/src/auth.js +80 -0
  18. package/packages/awb-core/src/commands.js +1321 -0
  19. package/packages/awb-core/src/common.js +508 -0
  20. package/packages/awb-core/src/output.js +1189 -0
  21. package/packages/awb-core/src/services.js +3811 -0
  22. package/packages/awb-core/src/standalone.js +1213 -0
  23. package/skills/lj-awb/SKILL.md +160 -0
  24. package/skills/lj-awb/VERSION +1 -0
  25. package/skills/lj-awb/compat.json +6 -0
  26. package/skills/lj-awb/modules/account.md +30 -0
  27. package/skills/lj-awb/modules/artifact/asset.md +64 -0
  28. package/skills/lj-awb/modules/artifact/clip.md +65 -0
  29. package/skills/lj-awb/modules/artifact/script.md +37 -0
  30. package/skills/lj-awb/modules/artifact/video.md +65 -0
  31. package/skills/lj-awb/modules/artifact.md +65 -0
  32. package/skills/lj-awb/modules/asset.md +53 -0
  33. package/skills/lj-awb/modules/auth.md +30 -0
  34. package/skills/lj-awb/modules/create-contract.md +118 -0
  35. package/skills/lj-awb/modules/credits.md +28 -0
  36. package/skills/lj-awb/modules/evals.md +186 -0
  37. package/skills/lj-awb/modules/image.md +75 -0
  38. package/skills/lj-awb/modules/model.md +110 -0
  39. package/skills/lj-awb/modules/project.md +30 -0
  40. package/skills/lj-awb/modules/subject.md +32 -0
  41. package/skills/lj-awb/modules/task-manual.md +185 -0
  42. package/skills/lj-awb/modules/task.md +62 -0
  43. package/skills/lj-awb/modules/upload.md +33 -0
  44. package/skills/lj-awb/modules/video.md +102 -0
  45. package/skills/lj-awb/modules/workflows.md +482 -0
  46. package/skills/lj-awb/references/error-codes.md +102 -0
  47. package/skills/lj-awb/references/model-options-read.md +49 -0
  48. package/skills/lj-awb/references/output-fields.md +113 -0
  49. package/skills/lj-awb/scripts/resolve-lj-awb-cmd.sh +10 -0
@@ -0,0 +1,185 @@
1
+ # Task Manual Module
2
+
3
+ 本模块是面向用户 / Agent 的任务手册:先判断用户真正要完成什么,再选择模型、素材语法和创建参数。不要从一句话直接拼 `image create` / `video create`。
4
+
5
+ ## 创作前固定流程
6
+
7
+ 1. 运行 `lj-awb doctor --verify`,确认认证、API、项目组、UTF-8。
8
+ 2. 运行 `model image-models` 或 `model video-models`,按用户目标筛 2-4 个候选。
9
+ 3. 用户选定模型后运行 `model options --model-group-code <code> -f json`,读取参数取值和素材约束。
10
+ 4. 再运行 `model create-spec --model-group-code <code> -f json`。
11
+ 5. 用 `inputRequirement` 判断是否必须有视觉输入;用 `supportedIntents` 判断素材模式;用 `model options.params` 判断 `ratio`、`quality`、`duration` 等枚举。
12
+ 6. 在 `fee` 或 `create --dry-run` 前,先确认用户未提供但会影响价格 / 效果的关键参数:视频 `quality`、`duration`、约束后仍可选的 `ratio`,以及用户明确要输出音效时的 `needAudio`;图片 `quality`、`ratio`、`generateNum`。
13
+ 7. 组装最终 prompt:以用户明确创作描述为基底,操作性指令只用于模型和资源选择;没有明确需求时先追问或用最小中性表达;只有视频 reference / subject 需要占位绑定时才考虑 `<<<key>>>`,并先展示最终文本。
14
+ 8. 用户确认关键参数和最终 prompt 后,先 `fee`,再 `create --dry-run`。
15
+ 9. 用户确认模型、项目组、最终 prompt、素材、参数和预估积分后,才加 `--yes`。
16
+
17
+ ## 确认选项和验证拆开
18
+
19
+ - `model options` / `model create-spec` 是只读验证,可以先跑,用来收集候选值、默认值、素材模式和约束。
20
+ - `fee` 会基于已选参数估价,`create --dry-run` 会基于已选参数组装请求;如果用户还没给 `quality`、`duration`、可选 `ratio`、`generateNum` 这类关键参数,先问用户,不要先用默认值跑一遍。
21
+ - 追问时给出候选值和默认值,例如:“还差会影响价格 / 效果的参数:画质 720 / 1080(默认 720),时长 3-15 秒(默认 5)。你希望用哪组?”
22
+ - 用户回复“按默认”后,才可以使用 `model options.params[].defaultValue` 继续估价和 dry-run。
23
+ - 如果 `model options.constraints[]` 命中后让某个参数 `effect=no_selectable_values`,不要追问或传入该参数。
24
+
25
+ ## 任务选择速查
26
+
27
+ | 用户目标 | 资源语法 | Prompt 处理 | 典型命令 |
28
+ |----------|----------|-------------|----------|
29
+ | 参考图生视频 | `--resource image:reference=<source>`;需要明确绑定时才用 `:key` | 普通参考不需要 `<<<key>>>`;显式绑定时 prompt 才出现同名占位符 | `video create` |
30
+ | 让这张图动起来 / 从这张图开始 | `--resource image:first_frame=<source>` | 不需要 `<<<key>>>` | `video create` |
31
+ | 首尾帧过渡 | `--resource image:first_frame=... --resource image:last_frame=...` | 不需要 `<<<key>>>` | `video create` |
32
+ | 使用音乐 / 配音 / 音频参考 | `--resource audio:reference=<source>` | 只有需要引用具体音频对象时才加 key | `video create` |
33
+ | 固定角色长期复用 | `subject publish` -> `subject wait` -> `--resource subject:reference:<key>=asset:<externalId>` | key 必填;是否写入 prompt 取决于用户表达 | `subject` + `video create` |
34
+ | 参考图生图 | `--resource image:reference=<source>` | 不使用 key / `<<<>>>`;用“图一 / 图二 / 参考图 / 主体”等自然语言指代 | `image create` |
35
+
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 虽然会做自愈剥离,但请求体冗余且容易在跨命令复制时出错。
45
+
46
+ ## 参考图生图
47
+
48
+ 适合用户说“用这张参考图生成图片”“保持图一人物表情,在图二场景里做某事”。生图模型没有 `reference_key` 绑定,素材映射靠 prompt 的自然描述和资源顺序。
49
+
50
+ ```bash
51
+ lj-awb image create \
52
+ --model-group-code <modelGroupCode> \
53
+ --prompt "图一中的白发女保持金鱼嘴表情,在图二背景里坐秋千" \
54
+ --resource image:reference=<firstSource> \
55
+ --resource image:reference=<secondSource> \
56
+ --ratio <allowedRatio> \
57
+ --quality <allowedQuality> \
58
+ --project-group-no <projectGroupNo> \
59
+ --dry-run \
60
+
61
+ ```
62
+
63
+ 判断要点:
64
+
65
+ - 不要写 `image:reference:hero=...`、`reference_key` 或 `<<<hero>>>`。
66
+ - 不要替用户自动生成 key;如果用户说“白发女 / 背景 / 图一 / 图二”,直接保留这些自然指代。
67
+ - 用户未给 `ratio`、`quality`、`generateNum` 时,先给候选值和默认值让用户确认,再估价或 dry-run。
68
+
69
+ ## 参考图生视频
70
+
71
+ 适合用户说“参考这张图”“引用这个角色 / 构图 / 风格”“根据这张图生成视频”。普通参考不需要 key;只有用户需要在 prompt 中明确绑定某个对象时才用 `image:reference:<key>`,如果 prompt 写了占位符,必须有同名 reference 资源。
72
+
73
+ ```bash
74
+ lj-awb video create \
75
+ --model-group-code <modelGroupCode> \
76
+ --prompt "<<<hero>>> 选择跳跃" \
77
+ --resource image:reference:hero=<source> \
78
+ --duration <seconds> \
79
+ --ratio <allowedRatio> \
80
+ --quality <allowedQuality> \
81
+ --project-group-no <projectGroupNo> \
82
+ --dry-run \
83
+
84
+ ```
85
+
86
+ 判断要点:
87
+
88
+ - 用户只说“动作是选择跳跃”时,可以组装为 `<<<hero>>> 选择跳跃`,但不要额外加风格词。
89
+ - 视频参考图已经通过 `image:reference:<key>` 传入时,不要把图片内容自动写成“山谷风景、室内场景、某种服装”等 prompt 文案;用 `<<<key>>>` 代表该参考对象即可。
90
+ - 用户说“一个女人在图片上走动 一边说音频。使用 sd2fast参考生”时,正确处理是把 `sd2fast / 参考生` 当成模型和资源选择,把创作描述保留为接近 `<<<scene>>> 一个女人在图片上走动 一边说音频`,不要改成“山谷风景中、自然走动、口型跟随参考音频”。
91
+ - 用户明确说“prompt 就用选择跳跃”时,先确认是否允许补成 `<<<hero>>> 选择跳跃`。
92
+ - 如果模型 `inputRequirement.visualInputRequired=true`,不能只用 prompt 创建。
93
+
94
+ ## 首帧 / 首尾帧生视频
95
+
96
+ 适合用户说“让这张图动起来”“以这张图作为第一帧”“从 A 过渡到 B”。首帧和尾帧是画面起止状态,不是 reference subject,因此通常不需要 `<<<key>>>`。
97
+
98
+ ```bash
99
+ lj-awb video create \
100
+ --model-group-code <modelGroupCode> \
101
+ --prompt "镜头推进,人物缓慢转身" \
102
+ --resource image:first_frame=<firstSource> \
103
+ --resource image:last_frame=<lastSource> \
104
+ --duration <seconds> \
105
+ --project-group-no <projectGroupNo> \
106
+ --dry-run \
107
+
108
+ ```
109
+
110
+ 判断要点:
111
+
112
+ - 只有首帧时只传 `image:first_frame=...`。
113
+ - 传 `image:last_frame=...` 前先确认 `model options.resources[].usage` 或 `model create-spec.supportedIntents[].usage` 包含 `last_frame`;`supportLastFrameOnly=false` 只是不支持仅尾帧。
114
+ - 没有 `supportLastFrameOnly=true` 时,不要只传 `image:last_frame=...`;尾帧应和首帧成对表达起止画面。
115
+ - 首尾帧都可以用本地文件、完整 URL、material backendPath 或 `asset:<assetId>`。
116
+ - 不要把首帧资产误写成 `subject:reference`;主体引用只用于可复用主体 externalId。
117
+
118
+ ## 音频参考
119
+
120
+ 用户上传音频、指定音乐、配音、节奏参考时,这是素材输入,不是 `--need-audio`。
121
+
122
+ ```bash
123
+ lj-awb video create \
124
+ --model-group-code <modelGroupCode> \
125
+ --prompt "<<<hero>>> 按音乐节奏跳舞" \
126
+ --resource image:reference:hero=<heroImage> \
127
+ --resource audio:reference=<audioSource> \
128
+ --duration <seconds> \
129
+ --project-group-no <projectGroupNo> \
130
+ --dry-run \
131
+
132
+ ```
133
+
134
+ 判断要点:
135
+
136
+ - 固定使用 `audio:reference`,不要使用 `audio:source`。
137
+ - 用户强调“音频也要参考 / 显式参考音频”时,可以使用 `audio:reference:voice=<audioSource>`,并在 prompt 中插入 `<<<voice>>>` 这类同名占位符。
138
+ - 用户明确要输出音效时,先确认模型暴露 `needAudio`,再使用 `--need-audio true/false`;它不是上传音频入口。
139
+ - 不要因为 `needAudio` 不存在就说“模型不支持音频参考”;音频参考能力只看 `model options.resources[]` 是否存在 `mediaType=AUDIO usage=reference`。
140
+
141
+ ## 主体复用
142
+
143
+ 适合用户要“这个角色以后反复使用”“保持同一角色一致性”。一次性参考图不需要先发布主体。
144
+
145
+ ```bash
146
+ lj-awb subject publish \
147
+ --name <subjectName> \
148
+ --primary-file <imagePath> \
149
+ --dry-run \
150
+
151
+
152
+ lj-awb subject publish \
153
+ --name <subjectName> \
154
+ --primary-file <imagePath> \
155
+ --yes \
156
+
157
+
158
+ lj-awb subject wait --element-id <elementId> --wait-seconds 300
159
+
160
+ lj-awb video create \
161
+ --model-group-code <modelGroupCode> \
162
+ --prompt "<<<hero>>> 转身看向镜头" \
163
+ --resource subject:reference:hero=asset:<externalId> \
164
+ --duration <seconds> \
165
+ --project-group-no <projectGroupNo> \
166
+ --dry-run \
167
+
168
+ ```
169
+
170
+ 判断要点:
171
+
172
+ - `subject wait` 成功后优先使用返回的 `nextRefSubject`。
173
+ - `subject:reference:<key>=asset:<externalId>` 的 `asset:` 后面是主体 externalId,不是普通图片 assetId。
174
+ - prompt 中出现 `<<<key>>>` 时必须有同名 reference 资源;不出现时不强制补。
175
+
176
+ ## 创建前确认清单
177
+
178
+ 正式提交前,向用户确认这些不可替代信息:
179
+
180
+ - 模型组:`displayName` 和 `modelGroupCode`。
181
+ - 项目组:名称、编号、项目组预算余额;不要把项目组预算余额当作实际可扣积分余额。
182
+ - 最终 prompt:如果做了占位符补齐、资源绑定或用户要求的提示词优化,要让用户确认实际提交文本。
183
+ - 素材:每个资源的 type、usage、key、来源。
184
+ - 参数:ratio、quality、duration、generate-num、need-audio 等只列实际使用项;没有由用户明确给出时,必须在 fee / dry-run 前完成选择确认。
185
+ - 费用:预估积分、`billingPointBalance -> billingPointRemainingAfter` 实际可扣积分变化,以及 `projectBudgetBalance -> projectBudgetRemainingAfter` 项目组预算变化。
@@ -0,0 +1,62 @@
1
+ # Task Module
2
+
3
+ 任务模块负责图片 / 视频 / 字幕等异步任务的等待、查询和台账恢复。所有异步任务必须先用 `image create` / `video create` / `subject publish` 拿到 `taskId` 或 `elementId`,再来这里。
4
+
5
+ ## 命令
6
+
7
+ | 命令 | 用途 |
8
+ |------|------|
9
+ | `lj-awb task list --task-type IMAGE_CREATE --project-group-no <no>` | 列出远端任务(按类型过滤) |
10
+ | `lj-awb task wait --task-id <id> --task-type IMAGE_CREATE --wait-seconds 180` | 等待单个任务进入终态 |
11
+ | `lj-awb task records --task-record-file .awb/tasks.jsonl` | 读本地任务台账(未指定 `--task-record-file` 默认 `.awb/tasks.jsonl`) |
12
+ | `lj-awb task records --pending-only --task-record-file .awb/tasks.jsonl` | 只看未终态记录 |
13
+ | `lj-awb task record-poll --task-record-file .awb/tasks.jsonl --wait-seconds 180` | 一次性轮询台账里所有未终态任务 |
14
+
15
+ ## 典型使用场景
16
+
17
+ ### 单任务等待
18
+
19
+ ```bash
20
+ # image / video create 返回 taskId 后立刻:
21
+ lj-awb task wait --task-id <id> --task-type IMAGE_CREATE --wait-seconds 180
22
+ ```
23
+
24
+ 返回 `task_still_running`(exit 20)= 等待窗口结束、任务**未失败**。直接续跑(增大 `--wait-seconds` 或重复几轮)。详见 [`../references/error-codes.md`](../references/error-codes.md) 场景 2。
25
+
26
+ ### 批量恢复
27
+
28
+ `image create-batch` / `video create-batch` / `subject publish-batch` 默认把每个子任务写到 `.awb/tasks.jsonl`。当对话被打断或机器重启后:
29
+
30
+ ```bash
31
+ # 1. 看还有几条未完
32
+ lj-awb task records --pending-only
33
+
34
+ # 2. 一键续等所有未完(推荐,免去逐个 wait)
35
+ lj-awb task record-poll --wait-seconds 180
36
+
37
+ # 3. 终态后做汇总
38
+ lj-awb task records
39
+ ```
40
+
41
+ ### 历史查询
42
+
43
+ 不知道 `taskId` 但记得做过:
44
+
45
+ ```bash
46
+ lj-awb task list --task-type VIDEO_GROUP --project-group-no <no>
47
+ ```
48
+
49
+ 按 `gmtCreate` 倒序,从最近找。
50
+
51
+ ## 规则
52
+
53
+ - 异步任务必须保存 `taskId`,批量任务统一传 `--task-record-file .awb/tasks.jsonl`(默认即此路径)。
54
+ - `task wait` 返回 `task_still_running` 时复述 hint,不要误报失败;`taskStatus=FAILED` 或 `errorMessage` 非空才是真失败。
55
+ - 输出字段只提取 `taskId / taskStatus / isTerminal / resultUrls / errorMessage`,详见 [`../references/output-fields.md`](../references/output-fields.md) 的"生图 / 生视频"和"任务台账"小节。
56
+ - 不要把大型 raw JSON 整段塞回上下文。
57
+ - `task list` 是远端查询、`task records` 是本地台账;两者覆盖范围不同(台账只有本机创建的任务)。
58
+
59
+ ## 下一步
60
+
61
+ - 任务终态 + `resultUrls` 非空 → 视具体场景写回 [`artifact/video.md`](artifact/video.md) (`update-clip-urls`) 或交付给用户。
62
+ - 任务 `FAILED` → 看 `errorMessage`;常见原因(积分 / 模型 / 资源)按 [`../references/error-codes.md`](../references/error-codes.md) 场景 7 处理。
@@ -0,0 +1,33 @@
1
+ # Upload Module
2
+
3
+ 上传模块用于把本地文件变成平台可访问素材。
4
+
5
+ ## 命令
6
+
7
+ | 命令 | 用途 |
8
+ |------|------|
9
+ | `lj-awb upload files --files ./a.png,./b.mp4 --dry-run` | 预览上传文件 |
10
+ | `lj-awb upload files --file ./ref.png --scene-type material-video-create` | 上传单个参考素材 |
11
+ | `lj-awb upload files --files-json ./files.json` | 按 JSON 清单上传 |
12
+
13
+ ## 规则
14
+
15
+ - 上传命令返回 `backendPath`、`url`、`mimeType`、`size`、`width`、`height`。
16
+ - 后续任务的 `source.value` 一律使用 `backendPath`(例如 `material/...` 或 `/material/...`),**不要使用回显的 `url` 字段**。`url` 只是用于人工预览,把完整 `https://*.myqcloud.com/...` 直接塞回任务请求会让请求体冗余,也会破坏请求一致性。
17
+ - 对 Agent 来说,优先使用返回的结构化字段,不要从自然语言输出里猜 URL。
18
+ - 不直接调用或暴露 COS 临时凭证接口。
19
+ - 生图 / 生视频命令传本地参考文件时,会在内部自动上传;只有需要复用素材时才单独调用 `upload files`。
20
+ - 即使把平台 COS 完整 URL 当作 `source.value` 传入,CLI 会自动剥离 host 还原为 `backendPath`;但不要依赖该自愈,仍以传 `backendPath` 为准。
21
+ - 输出字段速查见 [`../references/output-fields.md`](../references/output-fields.md) 的"文件上传"小节;上传失败(exit 30 / `upload_failed`)见 [`../references/error-codes.md`](../references/error-codes.md) 场景 6。
22
+
23
+ ## 下一步
24
+
25
+ 拿到 `uploads[].backendPath`(形如 `material/...`)后立刻就近喂给下游命令,不要重复 upload:
26
+
27
+ - 生图参考图:`lj-awb image create ... --resource image:reference=material/...`
28
+ - 生视频首帧 / 尾帧 / 参考图:`lj-awb video create ... --resource image:first_frame=material/...`
29
+ - 视频参考音频:`lj-awb video create ... --resource audio:reference=material/...`
30
+ - 主体发布参考图:`lj-awb subject publish ... --resource primary:material/...`
31
+ - 注册到素材库(长期复用):`lj-awb asset register --group-id <id> --url material/... --name "..." --yes`
32
+
33
+ > `image create` / `video create` / `subject publish` 传 `--file` / 本地路径时**会自动 upload**——只有需要"先看 backendPath / 跨任务复用同一份素材"时才单独跑 `upload files`。
@@ -0,0 +1,102 @@
1
+ # Video Module
2
+
3
+ 视频模块用于生视频模型选择、估价、提交、批量提交、查询和去字幕。创建前必须先读取 `model options` 和 `model create-spec`,确认模型支持目标输入模式和素材约束。
4
+
5
+ ## 命令
6
+
7
+ | 命令 | 用途 |
8
+ |------|------|
9
+ | `lj-awb video fee --model-group-code <code> --prompt "..." --duration 5` | 生视频估价 |
10
+ | `lj-awb video create --model-group-code <code> --prompt "..." --dry-run` | 预览生视频请求 |
11
+ | `lj-awb video create --model-group-code <code> --prompt "镜头推进" --resource image:first_frame=./actor.png --duration 5 --yes` | 首帧生视频 |
12
+ | `lj-awb video create --model-group-code <code> --prompt "镜头推进" --resource image:first_frame=asset:<assetId> --duration 5 --yes` | 资产首帧生视频 |
13
+ | `lj-awb video create --model-group-code <code> --prompt "<<<女主>>> 奔跑" --resource subject:reference:女主=asset:asset_xxx --duration 5 --yes` | 主体参考生视频 |
14
+ | `lj-awb video create-batch --input-file ./video.jsonl --model-group-code <code> --yes` | 批量生视频 |
15
+ | `lj-awb video status --task-id <id>` | 查询生视频任务 |
16
+ | `lj-awb task wait --task-id <id> --task-type VIDEO_GROUP --wait-seconds 300` | 等待生视频结果 |
17
+ | `lj-awb video subtitle-remove --video-url "https://..." --yes` | 提交去字幕任务 |
18
+ | `lj-awb video subtitle-status --remote-task-id <id>` | 查询去字幕任务 |
19
+
20
+ ## 创建参数
21
+
22
+ | 参数 | 何时使用 | 约束来源 |
23
+ |------|----------|----------|
24
+ | `--prompt` | 视频提示词 | 以用户明确创作描述为基底组装的最终提交文本;没有明确需求时先追问或用最小中性表达 |
25
+ | `--duration` | 指定视频秒数 | `model options.params[key=duration].values` |
26
+ | `--ratio` | 指定画幅比例 | `model options.params[key=ratio].values`,并受 `model options.constraints[]` 联动限制 |
27
+ | `--quality` | 指定清晰度 | `model options.params[key=quality].values` |
28
+ | `--need-audio` | 是否需要输出音效 | 仅 `model options.params[key=needAudio]` 存在,且用户明确要求输出音效时 |
29
+ | `--resource image:reference[:key]=...` | 参考图生视频 | `model create-spec.supportedIntents.mode=reference` 必须存在,格式 / 数量约束看 `model options.resources[]` |
30
+ | `--resource audio:reference=...` | 参考音频 / 配乐 / 配音 / 节奏参考 | `model options.resources[]` 中必须存在 `mediaType=AUDIO usage=reference` |
31
+ | `--resource image:first_frame=...` | 首帧生视频 | `model create-spec.supportedIntents.mode=frames` 必须存在,且 usage 包含 `first_frame` |
32
+ | `--resource image:last_frame=...` | 首尾帧过渡 / 仅尾帧 | `model create-spec.supportedIntents.mode=frames` 必须存在,且 usage 包含 `last_frame` |
33
+ | `--resource subject:reference:<key>=asset:<externalId>` | 长期复用主体 | `model create-spec.supportedIntents.mode=reference` 必须存在 |
34
+
35
+ ## 标准流程
36
+
37
+ ```bash
38
+ lj-awb model video-models --model "<keyword>"
39
+ lj-awb model options --model-group-code <modelGroupCode> -f json
40
+ lj-awb model create-spec --model-group-code <modelGroupCode> -f json
41
+ ```
42
+
43
+ 如果用户没有指定 `quality`、`duration` 或约束后仍可选的 `ratio`,先展示 `model options.params[].values` 和默认值让用户选择;用户确认后再执行:
44
+
45
+ ```bash
46
+ lj-awb video fee --model-group-code <modelGroupCode> --prompt "<prompt>" --duration <seconds>
47
+ lj-awb video create --model-group-code <modelGroupCode> --prompt "<prompt>" --duration <seconds> --dry-run
48
+ ```
49
+
50
+ 用户确认后:
51
+
52
+ ```bash
53
+ lj-awb video create \
54
+ --model-group-code <modelGroupCode> \
55
+ --prompt "<user prompt>" \
56
+ --resource image:reference:hero=./hero.png \
57
+ --ratio <allowedRatio> \
58
+ --quality <allowedQuality> \
59
+ --duration <allowedSeconds> \
60
+ --project-group-no <projectGroupNo> \
61
+ --yes \
62
+
63
+ ```
64
+
65
+ ## 规则
66
+
67
+ - 视频时长统一用 `--duration`,不要传平台旧字段 `generated_time`。
68
+ - `--prompt` 的重点是组装资源、参数和模型约束;用户没有明确需求时不要主动编内容补空白,用户要求优化时再做提示词创作。
69
+ - 素材统一用 `--resource type:usage[:key]=...` 或 `--resources-json`,不要直接传 `frames` / `multi_param`。
70
+ - `generated_mode` 不需要也不允许用户填写;Material 会根据资源推导 `frames` 或 `multi_param`。
71
+ - 创建前先看 `inputRequirement.visualInputRequired`。如果为 `true`,必须选择 `supportedIntents` 中的一种素材输入,不能纯 prompt 创建。
72
+ - Agent 向用户解释模型能力时,默认说“支持参考图 / 首帧 / 首尾帧 / 主体引用”等正向能力;不要默认列“无音频参数、无多条数参数”。
73
+ - `fee` 和 `create --dry-run` 前必须确认缺失的关键参数;不要把 `model options.params[].defaultValue` 当成用户选择。用户说“按默认”后才继续。
74
+ - 面向用户列参数时,`needAudio` 说成“音效:是否需要输出音效”;不要用 CLI flag 加技术解释的写法。只有展示最终命令时才写 `--need-audio true/false`。
75
+ - 用户上传音频、音乐或配音时,先检查 `model options.resources[]` 是否存在 `mediaType=AUDIO usage=reference`;存在时使用 `--resource audio:reference=...`,不存在时不要把音频文件硬塞给该模型。
76
+ - 音频素材输入统一使用 `--resource audio:reference=...` 或 resources JSON 中的 `{ "type": "audio", "usage": "reference" }`,前提是模型明确暴露 AUDIO reference 资源。
77
+ - 用户明确要在 prompt 中指代音频时,可以使用 `audio:reference:<key>=...`,并在 prompt 中插入同名 `<<<key>>>`。
78
+ - 用户明确要输出音效时,先看 `model options.params` 是否有 `needAudio`;存在才传 `--need-audio true/false`。它不接收音频文件。
79
+ - 使用首帧 / 首尾帧等资源后,如果 `model options.constraints[]` 对 `ratio` 等目标参数返回 `effect=no_selectable_values`,不要再追问或传该参数。
80
+ - `media=IMAGE` 的 `fileTypes` 不要机械理解成唯一允许格式:空列表表示不支持 webp,本地 webp 会自动转 jpg;仅 `webp` 表示普通图片格式外也支持 webp;多值列表才按允许列表强校验并尝试转换。默认 text 里看 `formats` 和 `webpInput`,不要把 `formats=...|webp` 理解成“只支持 webp”。
81
+ - `supportLastFrameOnly=false` 只表示不支持“仅尾帧”;不要据此判断不支持首尾帧过渡。是否可传 `image:last_frame` 看 `model options.resources[].usage` / `model create-spec.supportedIntents[].usage` 是否包含 `last_frame`。
82
+ - prompt 中出现 `<<<key>>>` 时,必须有同名 `reference_key`,例如 `--resource image:reference:hero=./hero.png` 或 `--resource audio:reference:voice=./voice.wav`;反过来不强制。
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 直接复用。**
88
+ - `image:first_frame=asset:<assetId>` 是资产首帧;`subject:reference:<key>=asset:<externalId>` 是主体引用,两者不是同一类资源。
89
+ - 主体引用必须先 `subject publish` + `subject wait` 得到 `externalId`。
90
+ - 批量 JSON/JSONL 每项只写 `prompt`、`ratio`、`quality`、`duration`、`need_audio`、`resources`、`resource`、`customBizId`;其中 `need_audio` 表示是否需要输出音效,音频素材仍写入 `resources`。
91
+ - 视频任务默认可能耗时较长,批量和复杂任务应异步提交并记录 task id。
92
+ - **多镜头 / 多分镜时主动建议并行**:用户一次给出 ≥2 个同模型同参数的视频任务(典型场景:分镜流水线、批量首尾帧动画)时,Agent 必须先告知"这批可以用 `video create-batch --concurrency N` 并行执行(n 个任务,预计耗时 / 单次估价 × n)",并询问用户是否要并行。用户同意 → 走 batch;用户希望逐条审稿 → 继续单条 create。**不要默认一条一条串行还不告知**。
93
+ - 去字幕服务适合处理 Seedance 原始结果链接,不要把无关 CDN 链接误传。
94
+ - 输出字段速查见 [`../references/output-fields.md`](../references/output-fields.md) 的"生图 / 生视频"小节;错误恢复(积分 / 模型 / 资源约束)见 [`../references/error-codes.md`](../references/error-codes.md)。
95
+
96
+ ## 下一步
97
+
98
+ - `video create` 返回 `taskId` + `nextCommand` → 立刻 `task wait --task-id <id> --task-type VIDEO_GROUP --wait-seconds 300`。
99
+ - `video create-batch` 写 `.awb/tasks.jsonl`,用 [`task.md`](task.md) → `task record-poll` 批量等。
100
+ - 任务终态 `resultUrls` → 通常按集 / 场 / 镜头回写到 [`artifact/video.md`](artifact/video.md):`artifact video update-clip-urls --project-id <id> --episode-id ... --scene-id ... --clip-id ... --video-urls-json '[...]'`。
101
+ - Seedance 原始视频带英文字幕 → `video subtitle-remove --video-url <result-url> --yes` → `video subtitle-status --remote-task-id <id>`。
102
+ - 想长期复用同一角色(避免每次都传图) → [`subject.md`](subject.md) 先 `subject publish` + `wait` 拿 externalId。