Compare commits
290
Commits
0ce9ae00e7
...
72a86171dc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72a86171dc | ||
|
|
5b134207b8 | ||
|
|
470b52e26d | ||
|
|
967c4ebea1 | ||
|
|
d588e0d033 | ||
|
|
c89306effc | ||
|
|
cd00236563 | ||
|
|
c67b73a6c0 | ||
|
|
9867a1e2b2 | ||
|
|
bad6f2864c | ||
|
|
5ecb06140b | ||
|
|
9ad693fa8b | ||
|
|
383448961b | ||
|
|
ca70e4d888 | ||
|
|
ebc66dd704 | ||
|
|
67dafd69e2 | ||
|
|
cc58453145 | ||
|
|
aea4167ba6 | ||
|
|
2b9d16d58c | ||
|
|
a39774ee55 | ||
|
|
38ce68dd04 | ||
|
|
c888dc40d6 | ||
|
|
6df91eb9b6 | ||
|
|
1c22f7d5f8 | ||
|
|
e5b2b4b2cf | ||
|
|
bfc8ebc452 | ||
|
|
35f17fe3b3 | ||
|
|
74ff7bd855 | ||
|
|
1b1091ee45 | ||
|
|
21ba1ec001 | ||
|
|
8fcd9651af | ||
|
|
919ff73afd | ||
|
|
dfbf6b6a36 | ||
|
|
0647068ddf | ||
|
|
676c362617 | ||
|
|
75df688bd9 | ||
|
|
c493d9338c | ||
|
|
afe394347d | ||
|
|
e7fb0dc652 | ||
|
|
a7e19045bb | ||
|
|
dd4c4a48b0 | ||
|
|
34a885c6ce | ||
|
|
86b3d41eae | ||
|
|
b4b101b86b | ||
|
|
5a24a9d107 | ||
|
|
19845afea0 | ||
|
|
721bbeba17 | ||
|
|
092b53c071 | ||
|
|
235e43862e | ||
|
|
5ae5bde836 | ||
|
|
1a53259322 | ||
|
|
f098d579ca | ||
|
|
3ddcad54cd | ||
|
|
d8639e752e | ||
|
|
e6780b4f3b | ||
|
|
1502f31692 | ||
|
|
904590d978 | ||
|
|
598855b9dd | ||
|
|
5b9b0b28fb | ||
|
|
7191566c95 | ||
|
|
745bf53025 | ||
|
|
29cb68e398 | ||
|
|
415a6c8b59 | ||
|
|
f7ca07cc4d | ||
|
|
54dac744cb | ||
|
|
e1f9a475da | ||
|
|
bc0cd345d7 | ||
|
|
69f381454a | ||
|
|
02b1528f30 | ||
|
|
afbb762106 | ||
|
|
c8f26b27ee | ||
|
|
7077ede749 | ||
|
|
b8f26d33d7 | ||
|
|
f71a5a84bf | ||
|
|
9f8268654c | ||
|
|
de1dbfaa2b | ||
|
|
e2f1661327 | ||
|
|
a9422863ba | ||
|
|
79f907e2ed | ||
|
|
2bd3f3c616 | ||
|
|
2be6e2da19 | ||
|
|
cd102a2cfa | ||
|
|
205261efde | ||
|
|
7ae468be09 | ||
|
|
dfbb4a0055 | ||
|
|
2b1c3386df | ||
|
|
c3d40e025f | ||
|
|
cf03009cfb | ||
|
|
1681b11af6 | ||
|
|
623dbc7f01 | ||
|
|
e53d2aed37 | ||
|
|
ba77994924 | ||
|
|
6df7c71c8e | ||
|
|
c232dc21e9 | ||
|
|
fb0d977f3e | ||
|
|
ceaeaf96dd | ||
|
|
62708406bc | ||
|
|
f908026c17 | ||
|
|
ee71a16534 | ||
|
|
928c5ce0c6 | ||
|
|
36d51a6b1e | ||
|
|
af799387f8 | ||
|
|
e692298184 | ||
|
|
3f942e1dcf | ||
|
|
d1a3523041 | ||
|
|
207df39217 | ||
|
|
1d3ae5a8c2 | ||
|
|
50cf17a4af | ||
|
|
f7a7bf482a | ||
|
|
76dc431449 | ||
|
|
c804d849b9 | ||
|
|
ad95ffaf0b | ||
|
|
1eb9fe3493 | ||
|
|
721f7df6cb | ||
|
|
91973415c1 | ||
|
|
e98f174256 | ||
|
|
86e7182afa | ||
|
|
4303a7c096 | ||
|
|
147c0419e3 | ||
|
|
da91a6d80b | ||
|
|
a149c4d6bc | ||
|
|
cc90520e97 | ||
|
|
379fedeccd | ||
|
|
b317802780 | ||
|
|
2e16f83558 | ||
|
|
aaf85510a1 | ||
|
|
ef5325eda3 | ||
|
|
adebc74cf5 | ||
|
|
9bc42765aa | ||
|
|
ac57a33a4b | ||
|
|
258c511789 | ||
|
|
90048c0b28 | ||
|
|
3d888ce28d | ||
|
|
e174a35a94 | ||
|
|
4f8c0815aa | ||
|
|
184cb4b1dd | ||
|
|
2a2a81772d | ||
|
|
dd30d5abe7 | ||
|
|
f0cc30422d | ||
|
|
bd389222af | ||
|
|
53fc3dde42 | ||
|
|
67fa09fd97 | ||
|
|
9da1e09b29 | ||
|
|
e66c848134 | ||
|
|
bb6137b47d | ||
|
|
8d98365d3c | ||
|
|
64aa048807 | ||
|
|
f0cbacb888 | ||
|
|
5c8107ecf9 | ||
|
|
76e586a5cd | ||
|
|
ffa8c4be52 | ||
|
|
291c731678 | ||
|
|
8af3cacb10 | ||
|
|
2563245a2e | ||
|
|
6f01e3afe3 | ||
|
|
f078d6874e | ||
|
|
f76c700e20 | ||
|
|
cebf830fd8 | ||
|
|
b84badaecb | ||
|
|
43e043c88d | ||
|
|
5968e1b954 | ||
|
|
6ae915e429 | ||
|
|
f8e08b8574 | ||
|
|
00032cf30d | ||
|
|
10d83e570f | ||
|
|
c74d1aa7e9 | ||
|
|
61768236e0 | ||
|
|
4b396a8b47 | ||
|
|
6de0b56fd8 | ||
|
|
407a97b81c | ||
|
|
9256b900d9 | ||
|
|
2c5a42fa78 | ||
|
|
33ebea2722 | ||
|
|
204cf25aaa | ||
|
|
0017965fec | ||
|
|
d6cd3ec792 | ||
|
|
03b0a48028 | ||
|
|
2304c65013 | ||
|
|
94a3bcb40b | ||
|
|
5502823524 | ||
|
|
6b3cb8c78b | ||
|
|
2baea6ccf7 | ||
|
|
3b7ef23774 | ||
|
|
9cd01eeec4 | ||
|
|
0b521d88c9 | ||
|
|
b242014af2 | ||
|
|
e5a65e514e | ||
|
|
66bbae3630 | ||
|
|
2bc67e971a | ||
|
|
aca4a4754c | ||
|
|
898778c20d | ||
|
|
a4def95ae0 | ||
|
|
496ab91651 | ||
|
|
f70230ce55 | ||
|
|
ed9035329e | ||
|
|
fde02144db | ||
|
|
c07325a955 | ||
|
|
68e73d2cbc | ||
|
|
0af510035f | ||
|
|
2128b37058 | ||
|
|
c77e8032e5 | ||
|
|
eb7de5c86f | ||
|
|
76dabe67e2 | ||
|
|
7432c964b1 | ||
|
|
3f9f2aab24 | ||
|
|
7ac23c1a24 | ||
|
|
bcc65a5c92 | ||
|
|
ac4a99a1eb | ||
|
|
1fdcda122e | ||
|
|
307d3b5ae5 | ||
|
|
db651e4afb | ||
|
|
087bd4aa6f | ||
|
|
ee659a97f3 | ||
|
|
e0f88b1e40 | ||
|
|
ad279f5556 | ||
|
|
cebe6cbb81 | ||
|
|
bb37c93439 | ||
|
|
7aa118f96c | ||
|
|
5e2221ea88 | ||
|
|
3014fa1ae6 | ||
|
|
271dd82155 | ||
|
|
f0bf6dd6ef | ||
|
|
61c14ec22e | ||
|
|
70fc636195 | ||
|
|
32145595d0 | ||
|
|
37961781f1 | ||
|
|
30d2c83860 | ||
|
|
02549188d2 | ||
|
|
2bc4c8f4c3 | ||
|
|
1523f3984d | ||
|
|
84123b9851 | ||
|
|
37a97217f3 | ||
|
|
6e6af5e9bb | ||
|
|
50bcb0dd8b | ||
|
|
97c43300e5 | ||
|
|
c390092d19 | ||
|
|
aafd23e9cb | ||
|
|
cd710bf921 | ||
|
|
6c31a21ef6 | ||
|
|
d67cfa8193 | ||
|
|
3d82e712c8 | ||
|
|
cec8aaafd6 | ||
|
|
5d7bc7f523 | ||
|
|
6de4faae2a | ||
|
|
b352560ee8 | ||
|
|
cafd14ea0e | ||
|
|
da03c41a37 | ||
|
|
ced9aa9ce1 | ||
|
|
a7a3f6b23b | ||
|
|
db7266471a | ||
|
|
dd7ad4b74d | ||
|
|
90c67e1aa8 | ||
|
|
7691346132 | ||
|
|
8d94c66f4c | ||
|
|
079317fb31 | ||
|
|
55af8f90d3 | ||
|
|
de2bf6632e | ||
|
|
ddd5b4b4da | ||
|
|
9ad9af468b | ||
|
|
253f858b4b | ||
|
|
91dafbb5e0 | ||
|
|
92f32e50b9 | ||
|
|
fd23e1f613 | ||
|
|
77ab525040 | ||
|
|
f0c707eedd | ||
|
|
23de200cfd | ||
|
|
0f5464465d | ||
|
|
89feacc1a2 | ||
|
|
375c4de7cc | ||
|
|
571f947503 | ||
|
|
ba03e7b92f | ||
|
|
6341911abd | ||
|
|
2d690548e3 | ||
|
|
8e402e2846 | ||
|
|
680024b792 | ||
|
|
553297ff50 | ||
|
|
8cdaf33936 | ||
|
|
2c3e72ae9a | ||
|
|
9747a8f0ab | ||
|
|
3496b472c4 | ||
|
|
6d569e828e | ||
|
|
41df65ab26 | ||
|
|
bb395b37f5 | ||
|
|
3caea26924 | ||
|
|
7d2900c705 | ||
|
|
158287c980 | ||
|
|
4298438219 | ||
|
|
a72d96506a | ||
|
|
3888ca0538 | ||
|
|
de26dd0c19 |
No files matched your search
@@ -8,3 +8,5 @@ coverage
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.worktree/
|
.worktree/
|
||||||
.worktrees/
|
.worktrees/
|
||||||
|
|
||||||
|
.pnpm-store/
|
||||||
@@ -2,6 +2,15 @@
|
|||||||
|
|
||||||
短剧 Agent 的前端工作台。支持剧本创作、拆解、视觉风格、角色选角、主体形态、分镜设计、镜头首帧与视频生产,使用真实后端 API,不包含演示数据或浏览器端模型调用。
|
短剧 Agent 的前端工作台。支持剧本创作、拆解、视觉风格、角色选角、主体形态、分镜设计、镜头首帧与视频生产,使用真实后端 API,不包含演示数据或浏览器端模型调用。
|
||||||
|
|
||||||
|
## 最新同步(2026-10-08)
|
||||||
|
|
||||||
|
- 生产计划预检改用正式 POST,支持断点、停止阶段及各阶段数量上限;预检与启动共用模型参数。
|
||||||
|
- 首帧质量生成接入后台任务、刷新恢复、单镜头重跑、校验历史和项目活动锁。
|
||||||
|
- 身份图接入实际输入预览、视觉校验与单主体稳定母版质量生成。道具预览可能调用结构模型,需明确确认费用。
|
||||||
|
- 视频质量详情与修复耗尽归因、分镜主体引用覆盖检查按需只读展示。
|
||||||
|
|
||||||
|
历史同步说明:
|
||||||
|
|
||||||
## 最新同步(2026-09-07)
|
## 最新同步(2026-09-07)
|
||||||
|
|
||||||
- 对齐后端 `dev@697cf864e1e8d6f66e3ad7beeebdfd0ae0d6c16c`:图片/视频模型由后端统一配置,前端不再发送固定 Provider。
|
- 对齐后端 `dev@697cf864e1e8d6f66e3ad7beeebdfd0ae0d6c16c`:图片/视频模型由后端统一配置,前端不再发送固定 Provider。
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
## 新增质量检查与修复
|
## 新增质量检查与修复
|
||||||
|
|
||||||
已接入:首帧 `validate`、`repair`,项目 `keyframes/generate-quality`,视频 `validate`/`repair`,以及单镜头和项目级 `videos/generate-quality`。严格视频候选由后端 Poller 自动执行 Validator,失败时按上限创建 Repair Candidate,只有 PASS 才晋升 Primary;公开视频列表不再提供质量标记;前端只有在本会话收到 PASS 校验回执后才显示候选的手动设主入口。生成请求不再传固定 Provider。质量接口的详细参数、默认一镜范围、费用确认、主图晋升、视频抽样与专项检查和会话回执限制见 [前端简化与质量功能同步](frontend-simplification.md)。首帧和视频均不虚构质量历史 GET;校验回执按项目、镜头和资产 ID 保存在当前会话。
|
已接入:首帧 `validate`、`repair`,项目 `keyframes/generate-quality`,视频 `validate`/`repair`,以及单镜头和项目级 `videos/generate-quality`。严格视频候选由后端 Poller 自动执行 Validator,失败时按上限创建 Repair Candidate,只有 PASS 才晋升 Primary;公开视频列表不再提供质量标记;前端只有在本会话收到 PASS 校验回执后才显示候选的手动设主入口。生成请求不再传固定 Provider。质量接口的详细参数、默认一镜范围、费用确认、主图晋升、视频抽样与专项检查和会话回执限制见 [前端简化与质量功能同步](frontend-simplification.md)。首帧已接入真实 `GET keyframes/:keyframeId/validations` 历史,查看不会再次调用视觉模型,也不据此自动晋升;视频质量链读取 `quality-status?detail=true`,耗尽时读取 `quality-exhaustion-analysis`。新的首帧质量生成接收 202 `executionId`,按持久化 metadata 恢复原集与镜头的最终回执;校验历史和本次生成结果分别展示。
|
||||||
|
|
||||||
## 高级串联生产边界
|
## 高级串联生产边界
|
||||||
|
|
||||||
@@ -95,3 +95,17 @@
|
|||||||
- 全局 GET `/assets` 已由现有资产库页面使用,无需新增重复页面。
|
- 全局 GET `/assets` 已由现有资产库页面使用,无需新增重复页面。
|
||||||
|
|
||||||
预览结果只用于提交前核对,不作为持久化任务或质量通过证明;真正生成仍需费用确认,并以刷新后的正式资产记录为准。
|
预览结果只用于提交前核对,不作为持久化任务或质量通过证明;真正生成仍需费用确认,并以刷新后的正式资产记录为准。
|
||||||
|
|
||||||
|
## 2026-10-08 正式接口同步
|
||||||
|
|
||||||
|
后端路由与服务以同步时本地 `dev` 为准,本次覆盖:
|
||||||
|
|
||||||
|
- 高级串联生产的计划预检改用 `POST production/plan`,图片模型、图片参数和视频模型通过 JSON 传递,与启动使用同一份预检配置。支持 `startFrom` / `stopAfter`(subjectImages、keyframes、videoPrompts)及稳定母版、主体图、首帧、视频提示词四类有限上限。参数变化撤销预检与费用确认,409 附着已有 executionId。
|
||||||
|
- 首帧质量生成后台化,支持指定 shotId(本镜最多一张)。弹窗与页面共享后台句柄,刷新或切工作区后继续观察;项目级活动锁直到真实终态才释放,迟到 running 不能重新上锁。完成统计区分通过、修复未通过和调用失败。
|
||||||
|
- 已完成主体也可以打开辅助图/母版候选配置,预览与实际生成共用最终参数;指定身份图校验和场景/道具单主体质量闭环均有明确费用确认。
|
||||||
|
- 道具预览存在后端结构编译限制:无有效缓存时可能调用文本模型并生成拓扑参考。因此使用明确的费用确认和项目锁,不能描述为绝对免费;人物和场景预览为只读。
|
||||||
|
- 分镜工具接入零费用主体引用覆盖审计,展示真实遗漏;按当前项目剧集与 Beat/Shot 坐标匹配正式镜头后定位,不猜镜头 ID。
|
||||||
|
|
||||||
|
页面验收使用本地 Chrome 的隔离服务。未执行真实图片、视频或视觉校验的付费任务;后台参数、恢复和竞态使用受控契约验证。
|
||||||
|
|
||||||
|
- 已有分镜重生成、导演设计、即时状态和普通首帧入口也对齐 202 后台句柄与终态回执。后端重生成终态仅返回 summary/validation,正式列表尚无新的标题/剧情;前端持久化按项目的旧正文失效集合,刷新或隐藏任务后仍不向新 Shot ID 回填旧标题/时长,明确展示编号与缺省说明。完整重新拆解成功后才恢复新快照辅助信息。
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
# 后端正式功能同步 Implementation Plan
|
||||||
|
|
||||||
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||||
|
|
||||||
|
**Goal:** 在现有页面完整接入已确认的六类后端正式能力。
|
||||||
|
**Architecture:** API/type 层依据本地后端路由与服务 DTO。持久化任务复用 useWorkflowExecution,诊断组件只读加载,付费操作复用 ConfirmAction。逐个实现任务,不并行修改同一文件。
|
||||||
|
**Tech Stack:** Vue 3 / TypeScript / Vite / Tailwind / Naive UI。
|
||||||
|
|
||||||
|
## Global Constraints
|
||||||
|
|
||||||
|
- 工作目录为 /Users/goujun/workspace/agents-workspace/short-drama-agent-front/.worktrees/backend-contract-sync;后端只读 /Users/goujun/workspace/agents-workspace/short-drama-agent。
|
||||||
|
- 所有新/改函数、类型字段、ref/computed/watch 与 UI 模块添加中文注释。
|
||||||
|
- 已有功能、15px 间距和主题保持;超过两处重复使用的功能抽公共方法或组件。
|
||||||
|
- 页面验收仅本地 Chrome,localhost,禁止 Playwright;由主代理统一操作浏览器,子代理不操作 UI。
|
||||||
|
- 不在验证中创建真实付费模型任务;API 请求不自动重试,显示范围和费用后用户主动确认才发送。
|
||||||
|
- 子代理不提交;主代理在全部完成并审查后统一提交。不要 push。
|
||||||
|
- 后端 API 文档可能滞后,最终契约取 routes/*.routes.ts 与对应 service 的实际返回。
|
||||||
|
|
||||||
|
### Task 1: 生产计划、断点与限流
|
||||||
|
|
||||||
|
**Files:** Modify src/features/production/api.ts, types.ts, useAdvancedProduction.ts, components/AdvancedProduction.vue; create non-UI contract tests under tests/features/production.
|
||||||
|
**Consumes:** /production/plan POST、/production/start POST、useWorkflowExecution、ApiError.details。
|
||||||
|
**Produces:** ProductionStartInput、ProductionPlanInput,productionApi.plan/startPipeline,预检后可编辑并确认的生产范围。
|
||||||
|
|
||||||
|
- [ ] 先验证现有 plan 的 GET 与后端 POST 不匹配,加入契约断言(真实 request 封装+受控 fetch)。
|
||||||
|
```ts
|
||||||
|
await productionApi.plan('p', undefined, {imageProvider:'qwen-image',videoProvider:'wan'})
|
||||||
|
// 最终请求必须为 POST /api/projects/p/production/plan;Provider 在 JSON body。
|
||||||
|
```
|
||||||
|
- [ ] 使用后端 production.routes.ts 的枚举与整数规则。
|
||||||
|
```ts
|
||||||
|
/** 可恢复的生产阶段 */
|
||||||
|
type ProductionStage = 'subjectImages' | 'keyframes' | 'videoPrompts'
|
||||||
|
// startFrom / stopAfter、stableIdentityAnchorLimit、subjectImageLimit、keyframeLimit、videoPromptLimit、imageGenerationOptions。
|
||||||
|
```
|
||||||
|
- [ ] AdvancedProduction 的参数变化废弃已确认预检和费用确认;safeMode 保留默认不提交视频的边界。所有上限默认有限值。显式结束阶段和起始阶段须检查顺序。
|
||||||
|
- [ ] 预检与实际提交共用项目模型和图片参数;409 从 details.executionId 追踪已有任务,显示“已有任务”,不创建第二次请求。任务失败保留真实结果详情,不显示已完成。
|
||||||
|
- [ ] 保持主要资产计数与项目归属检查;对照 production-plan.service.ts / production.service.ts 补足返回类型,不编造字段。
|
||||||
|
- [ ] 执行定向 API 检查、typecheck、改动文件 lint/format,自查并写 task-1-report.md,不提交。
|
||||||
|
|
||||||
|
### Task 2: 首帧质量后台任务与历史
|
||||||
|
|
||||||
|
**Files:** Modify src/features/production/quality-api.ts, quality.types.ts, quality.ts, useQuality.ts, components/QualityDialog.vue, components/QualityResult.vue; Create components/KeyframeValidationHistory.vue. Do not modify api.ts/types.ts、ProductionPage.vue 或 ShotProductionAssets.vue(主代理集成)。
|
||||||
|
**Consumes:** POST /projects/:id/keyframes/generate-quality 返回 {executionId,projectId,status:'running',total};GET /storyboard-shots/:shotId/keyframes/:keyframeId/validations 返回 {id,status,output,error,startedAt,finishedAt,createdAt}[]。
|
||||||
|
**Produces:** QualityInput.shotId?、批量任务跟踪与最终回执;KeyframeValidationHistory 组件 props(projectId?,shotId,keyframeId),仅只读加载;单镜头质量目标支持 kind:'batch' 和 shotId/episodeNo。
|
||||||
|
|
||||||
|
- [ ] 先为 202 任务启动/目标过滤与历史契约建立失败断言,UI 验收交给主代理 Chrome。
|
||||||
|
- [ ] qualityApi.generate 改为真实任务启动类型,useQuality 在收到 executionId 后追踪后台任务;未完成绝不能当 QualityBatchResult。每次启动参数固定,完成后按原项目/集/镜头保留回执和刷新。
|
||||||
|
- [ ] 重用 useWorkflowExecution(projectId,'keyframe-quality'),刷新后恢复;展示任务阶段、计数、失败、最终逐镜结果;活跃任务阻止重复操作,409 若后端支持则附着已有任务。
|
||||||
|
- [ ] 支持指定 shotId 且 limit=1 的单镜头重跑,显示明确费用范围;接入现有模型控制 provider / generationOptions(依后端参数)。保留 force 的清晰确认。
|
||||||
|
- [ ] 历史组件读取 output JSON 的真实校验结论、summary、issues 和错误/时间,raw 不当成成功。切换目标取消请求、防旧响应覆盖,不触发新的校验。
|
||||||
|
- [ ] 不根据历史 PASS 自动改变手动晋升政策,保留现有 currentness 和会话守卫。
|
||||||
|
- [ ] 定向 API 检查、typecheck、lint/format并写 task-2-report.md,给主代理精确集成说明,不提交。
|
||||||
|
|
||||||
|
### Task 3: 身份预览、校验与稳定母版质量生成
|
||||||
|
|
||||||
|
**Files:** Own src/features/subject-identity/**;新增 API/type、可复用诊断组件,避免重构其它工作区。
|
||||||
|
**Consumes:** subject-identity.routes.ts 的 /identity/images/preview POST、/images/:imageId/validate POST、/stable-anchor/generate-quality POST;对应服务 DTO。
|
||||||
|
**Produces:** 生图弹窗真实输入预览;身份图库指定图片质量校验及结果;Scene/Prop 单主体稳定母版质量生成和回执。
|
||||||
|
|
||||||
|
- [ ] 依据真实请求(provider、generationOptions、生成类型和参考图参数)验证预览参数与实际生成同源;只读预览不生成、不锁定。
|
||||||
|
- [ ] 预览显示实际模型、参考图、最终 Prompt 和最终参数;切换主体/参数清空旧预览,取消或忽略迟到响应。
|
||||||
|
- [ ] 身份校验保持显式费用确认;完成前不显示通过,失败显示后端 issues/summary,指定正式 subject/image ID,错误不清空原图库。
|
||||||
|
- [ ] Scene/Prop 单主体质量生成保留 maxRepairAttempts、provider/options 与有限预算,成功按真实返回刷新母版、锁定状态和图库;人物仍走既有选角流程。
|
||||||
|
- [ ] 新 API/DTO 基于后台服务返回,不沿用首帧 DTO 猜测。所有状态按原主体隔离。
|
||||||
|
- [ ] 定向 API 检查、typecheck、lint/format,写 task-3-report.md,不提交。主代理负责 Chrome。
|
||||||
|
|
||||||
|
### Task 4: 视频诊断与分镜引用审计(主代理)
|
||||||
|
|
||||||
|
**Files:** 新增 production/components/VideoQualityDiagnostics.vue 与 diagnostics.types.ts/api.ts;storyboard 的 api/types 与新增 SubjectCoverageAudit.vue;集成 ShotProductionAssets.vue、StoryboardPage.vue、ProductionPage.vue。
|
||||||
|
**Consumes:** GET videos/quality-status?detail=true、GET videos/quality-exhaustion-analysis;GET /projects/:id/storyboard/subject-coverage。
|
||||||
|
**Produces:** 只读失败详情与回退建议;分镜引用遗漏列表;首帧历史与单镜头质量入口,后台任务状态在弹窗外也可观察。
|
||||||
|
|
||||||
|
- [ ] 对照 video-quality-status.service.ts、video-quality-exhaustion-analyzer.service.ts 和 storyboard-subject-coverage-audit.service.ts 定义全部展示字段与 API;直接引用实际判定,不自行判成功。
|
||||||
|
- [ ] VideoQualityDiagnostics 按需加载,展示链路、问题、发生次数、后端疑因和 recommendedRollback。只读操作不调用修复;换目标取消请求。
|
||||||
|
- [ ] SubjectCoverageAudit 按需零费用读取,展示统计和遗漏主体/镜头;引用跳转使用当前项目正式 ID,不自动修复生成。
|
||||||
|
- [ ] ShotProductionAssets 添加历史与单镜头质量重跑入口,QualityDialog 使用 Task 2 提供的 batch shotId目标;ProductionPage 加持久化 keyframe-quality 观察面板。
|
||||||
|
- [ ] 共享诊断布局超过两处时抽离通用组件;尊重当前主题与15px间距。
|
||||||
|
|
||||||
|
### Task 5: 验证、审查与提交
|
||||||
|
|
||||||
|
- [ ] 本地 Chrome 在专用 localhost 端口检查全部六项入口、真实读取、错误显示、目标切换、弹窗关闭/重开及任务恢复;仅取消付费确认。
|
||||||
|
- [ ] 定向契约检查、lint、改动文件 format、typecheck、build;全量测试排除 .worktrees/** 和 .worktree/**,与基线已有失败比较,不修无关旧故障。
|
||||||
|
- [ ] 子代理逐任务审查及最终整分支审查,修复本次新增问题;用户已授权一次最终提交,无需再次问。
|
||||||
|
- [ ] git diff --stat、git diff 后提交 Conventional Commit:feat(short-drama-agent-front): 补齐后端生产与质量功能。报告实际分支/提交和验证限制,不 push。
|
||||||
|
|
||||||
|
### Task 6: 已有分镜与普通首帧入口的 202 契约补齐
|
||||||
|
|
||||||
|
**Files:** storyboard/api.ts/useStoryboard.ts/StoryboardPage.vue;production/api.ts/useProduction.ts/ProductionPage.vue;projects/ProjectLayout.vue;workflows/execution.ts(仅阶段标签)。
|
||||||
|
**Consumes:** storyboard.routes.ts 下正式 regenerate(workflowName breakdown,metadata 用于区分镜头重生成)、directions/generate(storyboard-direction)、visual-states/generate(storyboard-visual-state)、video-prompts/generate(video-prompt)、keyframes/generate(keyframe-generation)实际 202 启动与最终 result。
|
||||||
|
**Produces:** 这些已有入口与质量入口一样正确后台化,不接测试路由、不创建新页面。
|
||||||
|
|
||||||
|
- [ ] 对照真实路由的 workflowName 与 metadata,以及最终服务 DTO。API 启动方法返回 WorkflowExecutionStart,而不是最终批量/重生成回执。
|
||||||
|
- [ ] useStoryboard 分别跟踪任务,成功启动后不发布完成回执;在终态按原 projectId/episodeNo/metadata 归属发布真实结果。重生成仅在校验有效时更新当前正式缓存,旧 ID 缓存清理规则保留。
|
||||||
|
- [ ] useProduction 普通首帧生成同样跟踪 keyframe-generation,完成后生成原项目首帧回执并刷新;视频/提示词已有后台 track 补传原 projectId 防跨项目归属。
|
||||||
|
- [ ] 项目布局持续观察这些名字以维持跨页面活动锁,工作区展示状态面板与手动刷新;复用现有共享执行组件。
|
||||||
|
- [ ] 有限范围、旧结果不误报完成、费用确认、操作互斥与全部中文注释规范保持。不提交,不执行付费请求。
|
||||||
|
- [ ] 先验证旧 API 把202类型当成最终结果的契约问题,补充 API边界测试;主代理负责 Chrome 确认入口/取消费用对话框。
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# 镜头定位与项目配置 Implementation Plan
|
||||||
|
|
||||||
|
> **For agentic workers:** 本次在当前 worktree 内逐项执行,保持用户已确认的范围。
|
||||||
|
|
||||||
|
**Goal:** 刷新后恢复镜头,清理独立刷新按钮,统一项目配置入口。
|
||||||
|
|
||||||
|
**Architecture:** 共享地址同步 composable 接入两个现有页面查询。ProjectLayout 打开 AppDialog 并复用 CreativeProfileSettings,配置修订通过项目注入上下文通知消费者。
|
||||||
|
|
||||||
|
**Tech Stack:** Vue 3、TypeScript、Vue Router、Naive UI、Tailwind。
|
||||||
|
|
||||||
|
## Global Constraints
|
||||||
|
|
||||||
|
- 全部新增/修改函数、类型、响应式声明和页面模块写中文注释。
|
||||||
|
- 页面和功能在本地 Chrome 的 localhost:4314 验证,不使用 Playwright。
|
||||||
|
- 用户未要求本次提交,不提交、不推送;不执行付费生成。
|
||||||
|
|
||||||
|
### Task 1: 地址保存镜头选择
|
||||||
|
|
||||||
|
Files: 新建 src/features/storyboard/useShotSelection.ts;修改 useStoryboard.ts、useProduction.ts、ProductionPage.vue;新增 tests/features/storyboard/shot-selection.test.ts。
|
||||||
|
|
||||||
|
- [x] 用真实 memory router 写恢复、选镜头保留其它参数、切集清旧镜头、外部导航测试;先运行确认缺失功能失败。
|
||||||
|
- [x] 导出 useShotSelection(currentEpisode: () => number),使用注入 route/router 与独立 ref;写入 router.replace({query: {...route.query, episodeNo: String(currentEpisode()), shotId}}),切集删除 shotId。
|
||||||
|
- [x] 两个 hook 复用选择;移除生产页重复 route 同步;无效明确 ID 不回退其它镜头。
|
||||||
|
- [x] 运行定向测试及 Chrome 刷新和地址导航验证。
|
||||||
|
|
||||||
|
### Task 2: 项目配置弹窗
|
||||||
|
|
||||||
|
Files: ProjectLayout.vue、CreativeProfileSettings.vue;新建 ProjectSettingsDialog.vue 与 context.ts(generation-config);调整现有配置消费者。
|
||||||
|
|
||||||
|
- [x] 标题栏增加“项目配置”;AppDialog 显示宽高比、图片配置、视频配置,图片与视频左右两列,小屏单列;操作按钮放 footer。
|
||||||
|
- [x] 保留模型 schema 与现有保存 payload;保存期间 busy 锁关闭;读取和保存捕获原项目及请求归属。
|
||||||
|
- [x] 注入项目配置 revision,保存后自增;单镜参数和已打开配置查询重新读取;配置错误恢复共用新入口。
|
||||||
|
- [x] Chrome 打开、滚动、保存相同配置并刷新核对,取消修改不写入。
|
||||||
|
|
||||||
|
### Task 3: 清理独立刷新图标
|
||||||
|
|
||||||
|
Files: 搜索全部 src 下 RefreshCw 的组件。
|
||||||
|
|
||||||
|
- [x] 移除只有图标的 NButton(图库同时移除包装 NPopover);保留有文字的刷新操作与错误重试。
|
||||||
|
- [x] 清理无用图标导入、按钮说明文字,保留仍被操作完成后调用的 refresh 函数。
|
||||||
|
- [x] 格式化修改文件,lint、类型检查、构建;Chrome 核对各页面,检视地址恢复和配置弹窗。
|
||||||
|
|
||||||
|
用户后续调整:项目配置弹窗改为图片、视频左右布局,操作按钮放在 footer;保存草稿原样保留实际项目参数。
|
||||||
|
|
||||||
|
验收记录:Chrome 在 localhost:4314 验证分镜与生产选择刷新恢复、配置左右布局、footer 按钮、标题下 description slot、2px 间距、有效参数启用保存和取消草稿隔离;其它页面独立刷新图标已删除。49 项定向检查通过,类型、lint 与构建通过;全量检查的既有失败已在交付前同步修正并全部通过。
|
||||||
|
|
||||||
|
现有守株待兔项目配置 size=1080*1920 已被当前后端目录拒绝,真实保存验证得到该错误;表单保留原值并先提示校验问题。未写入替代尺寸,也未执行付费模型调用。
|
||||||
|
|
||||||
|
用户最新要求:新增与本次调整的布局、间距和文字样式优先直接使用 Tailwind utility class,减少自定义 class。
|
||||||
|
|
||||||
|
## 本次交付检查
|
||||||
|
|
||||||
|
用户明确要求提交、合并 dev、检查无错误后推送。完整 pnpm check 已通过:44 个测试文件、349 项测试全部通过,lint、格式与类型检查通过;build 通过。同步了旧参数 schema、202 执行句柄、readiness 门禁和 Modal 测试契约,并排除其它 worktree 的重复测试。修复新建 footer 校验、图库配置修订更新、失效镜头正文提示及内嵌配置操作锁。Chrome 验证空白创建输入被拦截、失效镜头可从目录恢复,未执行付费模型调用。
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# 后端正式功能同步设计
|
||||||
|
|
||||||
|
用户已确认补齐全部六项缺口,功能验证后提交。后端基线为本地 dev 的 c58cc51,前端基线为 dev 的 967c4eb。仅在本工作树修改前端。
|
||||||
|
|
||||||
|
沿用已有页面和公共组件,分别接入:生产计划 POST 与断点/限流配置;首帧质量后台 executionId 及指定镜头重跑;首帧历史;身份生图预览、校验与稳定母版质量生成;视频质量详情与修复耗尽归因;分镜主体引用覆盖审计。
|
||||||
|
|
||||||
|
真实数据与最终请求以 src/api/routes 和服务返回为准。保留 AbortSignal、目标归属校验、费用确认、任务恢复、过期阻断和手动刷新。读取历史与诊断不能自动调用生成,也不能因历史 PASS 而放宽现有资产晋升检查。Production 409 时跟踪已有 executionId,避免重复提交。后台开始与最终完成分别展示。
|
||||||
|
|
||||||
|
界面使用现有 Naive UI、公共 AppDialog/WorkspaceTools 与 15px 布局;中文标签清晰,次要诊断按需展开。所有新增/修改函数、类型字段、响应式变量和 UI 模块写中文注释。
|
||||||
|
|
||||||
|
在本地 Chrome 验证真实后端读取和交互,禁止 Playwright;验证时不提交真实付费模型任务。验证后统一提交本工作树,当前请求没有授权 push。已知基线 321 个自动测试中有 80 个已有失败、43 个已有格式问题,需单独记录并区分新增问题。
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# 镜头定位与项目配置设计
|
||||||
|
|
||||||
|
用户已确认:两个镜头页面通过地址的 episodeNo、shotId 恢复选择,保留其它参数;全站移除独立刷新图标;项目标题栏右侧打开图片、视频左右布局,操作按钮放 footer 的配置弹窗。
|
||||||
|
|
||||||
|
- 共用镜头选择 composable,选择镜头时写入正式 ID 与当前剧集;切集清除旧 ID;浏览器导航从地址同步。无 ID 首次显示首镜,错误 ID 不代选其它镜头。
|
||||||
|
- 配置使用现有 creative-profile GET/PUT 与 generation-models。宽高比在前,图片和视频区域左右两列,小屏回落单列,操作放 footer;使用 AppDialog 内滚动,保存期间禁止关闭,操作期间禁止保存。
|
||||||
|
- 保留带文字的刷新、重试与后台观察逻辑,移除全站仅有刷新图标的按钮及无用导入。
|
||||||
|
- 配置成功保存后通知当前项目消费者,重新读取默认参数;关闭未保存配置不影响实际生产。
|
||||||
|
- 开发在当前 worktree;后续按用户明确授权提交、合并 dev 并推送;localhost:4314 本地 Chrome 验证选择刷新、跨页、弹窗排版与保存。
|
||||||
|
|
||||||
|
用户后续调整:项目配置弹窗改为图片、视频左右布局,操作按钮放在 footer;保存草稿原样保留实际项目参数。
|
||||||
|
|
||||||
|
公共 AppDialog 新增 description slot:说明固定在 header 内标题下方,标题与说明间距 2px,正文滚动不带走说明。原 description 属性保留作为 slot 默认文本。按真实目录校验配置,旧尺寸不兼容时原样展示并提示重新选择,不自动写入替代尺寸。
|
||||||
|
|
||||||
|
用户最新要求:新增与本次调整的布局、间距和文字样式优先直接使用 Tailwind utility class,减少自定义 class。
|
||||||
|
|
||||||
|
字段说明收敛:使用公共 FieldLabel,在 label 后放问号图标;点击图标通过 NPopover 查看后端 schema 的完整说明。GenerationOptionFields 与 GenerationModelControls 共享此组件,项目配置、首帧质量、身份候选与形态图等弹窗同步生效。原字段下方说明不再占据版面,实时错误、校验问题、费用确认和实际数据保持直接可见。新组件全部使用 Tailwind utility class。
|
||||||
@@ -26,4 +26,3 @@
|
|||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
+119
-111
@@ -4,6 +4,7 @@ import { RouterLink, useRoute } from 'vue-router'
|
|||||||
import {
|
import {
|
||||||
NButton,
|
NButton,
|
||||||
NConfigProvider,
|
NConfigProvider,
|
||||||
|
NMessageProvider,
|
||||||
NGlobalStyle,
|
NGlobalStyle,
|
||||||
NLayout,
|
NLayout,
|
||||||
NLayoutHeader,
|
NLayoutHeader,
|
||||||
@@ -28,6 +29,7 @@ import {
|
|||||||
Settings2,
|
Settings2,
|
||||||
X
|
X
|
||||||
} from '@lucide/vue'
|
} from '@lucide/vue'
|
||||||
|
import ActionMessageProvider from './components/ui/ActionMessageProvider.vue'
|
||||||
import { AppDialog, StudioLogo } from './components/ui'
|
import { AppDialog, StudioLogo } from './components/ui'
|
||||||
import { useTheme } from './composables/useTheme'
|
import { useTheme } from './composables/useTheme'
|
||||||
import ThemeToggle from './components/ui/ThemeToggle.vue'
|
import ThemeToggle from './components/ui/ThemeToggle.vue'
|
||||||
@@ -70,7 +72,7 @@ function toggleNav() {
|
|||||||
collapsed.value = !collapsed.value
|
collapsed.value = !collapsed.value
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 打开后端连接说明;窄屏先收回侧栏给弹窗腾出宽度。 */
|
/** 打开连接信息;窄屏先收回侧栏给弹窗腾出宽度。 */
|
||||||
function openSettings() {
|
function openSettings() {
|
||||||
if (narrow.value) collapsed.value = true
|
if (narrow.value) collapsed.value = true
|
||||||
settingsOpen.value = true
|
settingsOpen.value = true
|
||||||
@@ -99,8 +101,8 @@ const { preference, theme, overrides } = useTheme()
|
|||||||
const projectId = computed(() => String(route.params.projectId || ''))
|
const projectId = computed(() => String(route.params.projectId || ''))
|
||||||
const projectAccess = shallowRef<ProjectAccess | null>(null)
|
const projectAccess = shallowRef<ProjectAccess | null>(null)
|
||||||
provide(projectAccessKey, projectAccess)
|
provide(projectAccessKey, projectAccess)
|
||||||
const workflowsUnlocked = computed(
|
const currentProjectAccess = computed(() =>
|
||||||
() => projectAccess.value?.projectId === projectId.value && projectAccess.value.completed
|
projectAccess.value?.projectId === projectId.value ? projectAccess.value : null
|
||||||
)
|
)
|
||||||
const apiBase = import.meta.env.VITE_API_BASE_URL || '/api'
|
const apiBase = import.meta.env.VITE_API_BASE_URL || '/api'
|
||||||
const workflowItems = [
|
const workflowItems = [
|
||||||
@@ -135,7 +137,8 @@ const menuOptions = computed<MenuOption[]>(() => {
|
|||||||
? [
|
? [
|
||||||
{ type: 'divider' as const, key: 'divider' },
|
{ type: 'divider' as const, key: 'divider' },
|
||||||
...workflowItems.map(([path, label, icon]) => {
|
...workflowItems.map(([path, label, icon]) => {
|
||||||
const disabled = path !== 'create-drama' && !workflowsUnlocked.value
|
const sectionAccess = currentProjectAccess.value?.sections[path]
|
||||||
|
const disabled = sectionAccess ? !sectionAccess.enabled : path !== 'create-drama'
|
||||||
const target = '/projects/' + projectId.value + '/' + path
|
const target = '/projects/' + projectId.value + '/' + path
|
||||||
return {
|
return {
|
||||||
key: target,
|
key: target,
|
||||||
@@ -144,7 +147,11 @@ const menuOptions = computed<MenuOption[]>(() => {
|
|||||||
disabled
|
disabled
|
||||||
? h(
|
? h(
|
||||||
'span',
|
'span',
|
||||||
{ class: 'admin-menu-label', title: '剧本完成后可用', 'aria-disabled': 'true' },
|
{
|
||||||
|
class: 'admin-menu-label',
|
||||||
|
title: sectionAccess?.reason || '请先完成前面的制作步骤',
|
||||||
|
'aria-disabled': 'true'
|
||||||
|
},
|
||||||
label
|
label
|
||||||
)
|
)
|
||||||
: h(RouterLink, { to: target }, () =>
|
: h(RouterLink, { to: target }, () =>
|
||||||
@@ -167,114 +174,115 @@ const menuOptions = computed<MenuOption[]>(() => {
|
|||||||
:date-locale="dateZhCN"
|
:date-locale="dateZhCN"
|
||||||
class="app-provider"
|
class="app-provider"
|
||||||
>
|
>
|
||||||
<NGlobalStyle />
|
<!-- 以下是全局轻量操作结果提示模块 -->
|
||||||
<a href="#main-content" class="skip-link">跳到主要内容</a>
|
<NMessageProvider :max="3">
|
||||||
<div
|
<ActionMessageProvider>
|
||||||
class="admin-layout"
|
<NGlobalStyle />
|
||||||
:style="{
|
<a href="#main-content" class="skip-link">跳到主要内容</a>
|
||||||
'--admin-sider-collapsed': siderCollapsedWidth + 'px',
|
<div
|
||||||
'--admin-sider-expanded': siderExpandedWidth + 'px'
|
class="admin-layout"
|
||||||
}"
|
:style="{
|
||||||
>
|
'--admin-sider-collapsed': siderCollapsedWidth + 'px',
|
||||||
<!-- 以下是主导航侧栏:桌面参与分栏,移动端固定覆盖整个视口。 -->
|
'--admin-sider-expanded': siderExpandedWidth + 'px'
|
||||||
<aside
|
}"
|
||||||
id="main-navigation"
|
>
|
||||||
class="admin-sider"
|
<!-- 以下是主导航侧栏:桌面参与分栏,移动端固定覆盖整个视口。 -->
|
||||||
:class="{ 'is-collapsed': collapsed }"
|
<aside
|
||||||
:style="{
|
id="main-navigation"
|
||||||
width: narrow ? '100%' : (collapsed ? siderCollapsedWidth : siderExpandedWidth) + 'px'
|
class="admin-sider"
|
||||||
}"
|
|
||||||
aria-label="主导航"
|
|
||||||
:aria-hidden="narrow && collapsed ? 'true' : undefined"
|
|
||||||
:inert="narrow && collapsed ? true : undefined"
|
|
||||||
>
|
|
||||||
<header class="admin-sider-header">
|
|
||||||
<!-- 以下是侧栏品牌:桌面折叠裁切文字,移动端始终展示完整品牌。 -->
|
|
||||||
<RouterLink
|
|
||||||
to="/projects"
|
|
||||||
class="admin-brand"
|
|
||||||
:class="{ 'is-collapsed': collapsed }"
|
:class="{ 'is-collapsed': collapsed }"
|
||||||
aria-label="短剧工作台首页"
|
:style="{
|
||||||
|
width: narrow ? '100%' : (collapsed ? siderCollapsedWidth : siderExpandedWidth) + 'px'
|
||||||
|
}"
|
||||||
|
aria-label="主导航"
|
||||||
|
:aria-hidden="narrow && collapsed ? 'true' : undefined"
|
||||||
|
:inert="narrow && collapsed ? true : undefined"
|
||||||
>
|
>
|
||||||
<StudioLogo :size="narrow ? 23 : 27" /><span class="admin-brand-copy"
|
<header class="admin-sider-header">
|
||||||
>短剧工作台<small>SHORT DRAMA STUDIO</small></span
|
<!-- 以下是侧栏品牌:桌面折叠裁切文字,移动端始终展示完整品牌。 -->
|
||||||
>
|
<RouterLink
|
||||||
</RouterLink>
|
to="/projects"
|
||||||
<!-- 移动端全屏侧栏覆盖顶栏,因此在侧栏内部提供明确关闭入口。 -->
|
class="admin-brand"
|
||||||
<NButton
|
:class="{ 'is-collapsed': collapsed }"
|
||||||
quaternary
|
aria-label="短剧工作台首页"
|
||||||
class="icon-button mobile-sider-close"
|
>
|
||||||
aria-label="关闭主菜单"
|
<StudioLogo :size="narrow ? 23 : 27" /><span class="admin-brand-copy"
|
||||||
@click="toggleNav"
|
>短剧工作台<small>SHORT DRAMA STUDIO</small></span
|
||||||
>
|
>
|
||||||
<template #icon><X :size="20" /></template>
|
</RouterLink>
|
||||||
</NButton>
|
<!-- 移动端全屏侧栏覆盖顶栏,因此在侧栏内部提供明确关闭入口。 -->
|
||||||
</header>
|
<NButton
|
||||||
<NScrollbar class="admin-nav-scroll">
|
quaternary
|
||||||
<NMenu
|
class="icon-button mobile-sider-close"
|
||||||
:value="route.path"
|
aria-label="关闭主菜单"
|
||||||
:options="menuOptions"
|
@click="toggleNav"
|
||||||
:collapsed="menuCollapsed"
|
>
|
||||||
:collapsed-width="siderCollapsedWidth"
|
<template #icon><X :size="20" /></template>
|
||||||
:icon-size="NAV_ICON_SIZE"
|
</NButton>
|
||||||
:collapsed-icon-size="NAV_ICON_SIZE"
|
</header>
|
||||||
:indent="navIconIndent"
|
<NScrollbar class="admin-nav-scroll">
|
||||||
:root-indent="navIconIndent"
|
<NMenu
|
||||||
/>
|
:value="route.path"
|
||||||
</NScrollbar>
|
:options="menuOptions"
|
||||||
<!-- 底部入口与菜单名称一起显示,图标始终可点击。 -->
|
:collapsed="menuCollapsed"
|
||||||
<footer class="admin-sider-footer">
|
:collapsed-width="siderCollapsedWidth"
|
||||||
<NButton
|
:icon-size="NAV_ICON_SIZE"
|
||||||
quaternary
|
:collapsed-icon-size="NAV_ICON_SIZE"
|
||||||
block
|
:indent="navIconIndent"
|
||||||
class="admin-settings-button"
|
:root-indent="navIconIndent"
|
||||||
:class="{ 'is-collapsed': collapsed }"
|
/>
|
||||||
aria-label="后端连接"
|
</NScrollbar>
|
||||||
@click="openSettings"
|
<!-- 底部入口与菜单名称一起显示,图标始终可点击。 -->
|
||||||
>
|
<footer class="admin-sider-footer">
|
||||||
<template #icon><Settings2 :size="18" /></template>
|
<NButton
|
||||||
<span class="admin-settings-label">后端连接</span>
|
quaternary
|
||||||
</NButton>
|
block
|
||||||
</footer>
|
class="admin-settings-button"
|
||||||
</aside>
|
:class="{ 'is-collapsed': collapsed }"
|
||||||
<!-- 以下是顶栏与主内容 -->
|
aria-label="连接设置"
|
||||||
<NLayout class="admin-main">
|
@click="openSettings"
|
||||||
<NLayoutHeader class="admin-topbar">
|
>
|
||||||
<div class="flex min-w-0 items-center gap-3">
|
<template #icon><Settings2 :size="18" /></template>
|
||||||
<NButton
|
<span class="admin-settings-label">连接设置</span>
|
||||||
quaternary
|
</NButton>
|
||||||
class="icon-button"
|
</footer>
|
||||||
:aria-label="navToggleLabel"
|
</aside>
|
||||||
:title="navToggleLabel"
|
<!-- 以下是顶栏与主内容 -->
|
||||||
:aria-expanded="!collapsed"
|
<NLayout class="admin-main">
|
||||||
aria-controls="main-navigation"
|
<NLayoutHeader class="admin-topbar">
|
||||||
@click="toggleNav"
|
<div class="flex min-w-0 items-center gap-3">
|
||||||
>
|
<NButton
|
||||||
<template #icon
|
quaternary
|
||||||
><component :is="collapsed ? PanelLeftOpen : PanelLeftClose" :size="20"
|
class="icon-button"
|
||||||
/></template>
|
:aria-label="navToggleLabel"
|
||||||
</NButton>
|
:title="navToggleLabel"
|
||||||
<span class="truncate text-sm">{{ route.meta.title || '工作空间' }}</span>
|
:aria-expanded="!collapsed"
|
||||||
</div>
|
aria-controls="main-navigation"
|
||||||
<ThemeToggle v-model="preference" />
|
@click="toggleNav"
|
||||||
</NLayoutHeader>
|
>
|
||||||
<main id="main-content" tabindex="-1" class="admin-content"><RouterView /></main>
|
<template #icon
|
||||||
</NLayout>
|
><component :is="collapsed ? PanelLeftOpen : PanelLeftClose" :size="20"
|
||||||
</div>
|
/></template>
|
||||||
<AppDialog v-model:open="settingsOpen" title="后端连接" description="查看当前 API 地址与代理配置。">
|
</NButton>
|
||||||
<dl class="detail-grid mt-6">
|
<span class="truncate text-sm">{{ route.meta.title || '工作空间' }}</span>
|
||||||
<dt>API 地址</dt>
|
</div>
|
||||||
<dd>
|
<ThemeToggle v-model="preference" />
|
||||||
<code>{{ apiBase }}</code>
|
</NLayoutHeader>
|
||||||
</dd>
|
<main id="main-content" tabindex="-1" class="admin-content"><RouterView /></main>
|
||||||
<dt>开发环境</dt>
|
</NLayout>
|
||||||
<dd>在 .env 中配置 API_PROXY_TARGET,修改后重启 Vite。</dd>
|
</div>
|
||||||
<dt>生产环境</dt>
|
<AppDialog v-model:open="settingsOpen" title="连接设置" description="查看当前服务地址。">
|
||||||
<dd>为 /api、/storage 配置反向代理,并为长工作流设置足够的超时。</dd>
|
<dl class="detail-grid mt-6">
|
||||||
<dt>状态更新</dt>
|
<dt>API 地址</dt>
|
||||||
<dd>已有刷新按钮的页面使用手动更新;剧本创作和拆解仍每 6 秒同步项目状态。</dd>
|
<dd>
|
||||||
</dl>
|
<code>{{ apiBase }}</code>
|
||||||
</AppDialog>
|
</dd>
|
||||||
|
<dt>状态更新</dt>
|
||||||
|
<dd>制作任务会保存进度;刷新或重新进入页面后可以继续查看。</dd>
|
||||||
|
</dl>
|
||||||
|
</AppDialog>
|
||||||
|
</ActionMessageProvider>
|
||||||
|
</NMessageProvider>
|
||||||
</NConfigProvider>
|
</NConfigProvider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { provide } from 'vue'
|
||||||
|
import { useMessage } from 'naive-ui'
|
||||||
|
import { actionMessageKey } from './useActionMessage'
|
||||||
|
|
||||||
|
/** 在应用消息层内取得实例,子页面和公共控件使用同一反馈区域。 */
|
||||||
|
const message = useMessage()
|
||||||
|
provide(actionMessageKey, message)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<slot />
|
||||||
|
</template>
|
||||||
+153
-13
@@ -1,15 +1,86 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { NModal, NScrollbar } from 'naive-ui'
|
import { NModal, NScrollbar } from 'naive-ui'
|
||||||
/** Naive UI 管理焦点锁定、Esc、遮罩与主题;长弹窗只滚动内部正文。 */
|
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||||
defineProps<{ title: string; description: string; busy?: boolean; wide?: boolean }>()
|
|
||||||
|
/** 公共弹窗的标题、说明、操作状态和宽度。 */
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
/** 弹窗标题,同时作为可访问名称。 */
|
||||||
|
title: string
|
||||||
|
/** 标题下的默认说明,可使用 description slot 覆盖。 */
|
||||||
|
description?: string
|
||||||
|
/** 提交期间锁定关闭操作。 */
|
||||||
|
busy?: boolean
|
||||||
|
/** 使用宽弹窗布局。 */
|
||||||
|
wide?: boolean
|
||||||
|
}>(),
|
||||||
|
{ description: '', busy: false, wide: false }
|
||||||
|
)
|
||||||
|
/** 弹窗显隐状态,关闭行为由 Naive 管理。 */
|
||||||
const open = defineModel<boolean>('open', { default: false })
|
const open = defineModel<boolean>('open', { default: false })
|
||||||
|
/** 正文容器隔离子元素外边距,保留完整的自然内容高度。 */
|
||||||
|
const bodyContent = ref<HTMLElement | null>(null)
|
||||||
|
/** 正文最大可用高度;未挂载时不限制自然高度。 */
|
||||||
|
const maxBodyHeight = ref<number | undefined>(undefined)
|
||||||
|
/** 监听正文和固定区域的尺寸变化,适配异步内容与换行。 */
|
||||||
|
let layoutObserver: ResizeObserver | undefined
|
||||||
|
|
||||||
|
/** 扣除视口上下间距、标题、底栏、正文内边距和边框,只限制正文最大高度。 */
|
||||||
|
function updateBodyHeight() {
|
||||||
|
const card = bodyContent.value?.closest('.app-dialog')
|
||||||
|
if (!card) return
|
||||||
|
const header = card.querySelector<HTMLElement>('.n-card-header')
|
||||||
|
const footer = card.querySelector<HTMLElement>('.n-card__footer')
|
||||||
|
const content = card.querySelector<HTMLElement>('.n-card-content')
|
||||||
|
const contentStyle = content ? getComputedStyle(content) : null
|
||||||
|
const cardStyle = getComputedStyle(card)
|
||||||
|
maxBodyHeight.value = Math.max(
|
||||||
|
0,
|
||||||
|
(window.visualViewport?.height ?? window.innerHeight) -
|
||||||
|
32 -
|
||||||
|
(header?.offsetHeight ?? 0) -
|
||||||
|
(footer?.offsetHeight ?? 0) -
|
||||||
|
(contentStyle ? parseFloat(contentStyle.paddingTop) + parseFloat(contentStyle.paddingBottom) : 0) -
|
||||||
|
parseFloat(cardStyle.borderTopWidth) -
|
||||||
|
parseFloat(cardStyle.borderBottomWidth)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
watch(
|
||||||
|
[open, bodyContent],
|
||||||
|
([shown]) => {
|
||||||
|
layoutObserver?.disconnect()
|
||||||
|
if (!shown) {
|
||||||
|
maxBodyHeight.value = undefined
|
||||||
|
return
|
||||||
|
}
|
||||||
|
updateBodyHeight()
|
||||||
|
const card = bodyContent.value?.closest('.app-dialog')
|
||||||
|
if (!card || !bodyContent.value) return
|
||||||
|
layoutObserver = new ResizeObserver(updateBodyHeight)
|
||||||
|
const header = card.querySelector('.n-card-header')
|
||||||
|
const footer = card.querySelector('.n-card__footer')
|
||||||
|
if (header) layoutObserver.observe(header)
|
||||||
|
if (footer) layoutObserver.observe(footer)
|
||||||
|
layoutObserver.observe(bodyContent.value)
|
||||||
|
},
|
||||||
|
{ flush: 'post', immediate: true }
|
||||||
|
)
|
||||||
|
onMounted(() => {
|
||||||
|
window.addEventListener('resize', updateBodyHeight)
|
||||||
|
window.visualViewport?.addEventListener('resize', updateBodyHeight)
|
||||||
|
})
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
layoutObserver?.disconnect()
|
||||||
|
window.removeEventListener('resize', updateBodyHeight)
|
||||||
|
window.visualViewport?.removeEventListener('resize', updateBodyHeight)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<slot name="trigger" />
|
<slot name="trigger" />
|
||||||
<NModal
|
<NModal
|
||||||
v-model:show="open"
|
v-model:show="open"
|
||||||
preset="card"
|
preset="card"
|
||||||
:title="title"
|
|
||||||
:closable="!busy"
|
:closable="!busy"
|
||||||
:mask-closable="!busy"
|
:mask-closable="!busy"
|
||||||
:close-on-esc="!busy"
|
:close-on-esc="!busy"
|
||||||
@@ -18,30 +89,99 @@ const open = defineModel<boolean>('open', { default: false })
|
|||||||
role="dialog"
|
role="dialog"
|
||||||
:aria-label="title"
|
:aria-label="title"
|
||||||
>
|
>
|
||||||
<NScrollbar class="dialog-body-scroll">
|
<!-- 以下是固定标题与说明模块,说明位于标题下并可自定义 -->
|
||||||
<p class="text-sm leading-6 text-muted">{{ description }}</p>
|
<template #header>
|
||||||
<slot />
|
<div class="min-w-0">
|
||||||
|
<div class="text-lg font-semibold">{{ title }}</div>
|
||||||
|
<div v-if="description || $slots.description" class="mt-[2px] text-sm leading-6 font-normal text-muted">
|
||||||
|
<slot name="description">{{ description }}</slot>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<!-- 以下是自然高度正文模块,仅超过剩余视口高度时滚动 -->
|
||||||
|
<NScrollbar
|
||||||
|
class="dialog-body-scroll"
|
||||||
|
:style="{ height: 'auto', maxHeight: maxBodyHeight === undefined ? undefined : maxBodyHeight + 'px' }"
|
||||||
|
>
|
||||||
|
<div ref="bodyContent" class="flow-root"><slot /></div>
|
||||||
</NScrollbar>
|
</NScrollbar>
|
||||||
|
<template v-if="$slots.footer" #footer>
|
||||||
|
<div class="dialog-footer"><slot name="footer" /></div>
|
||||||
|
</template>
|
||||||
</NModal>
|
</NModal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
||||||
@reference "../../styles/styles.css";
|
@reference "../../styles/styles.css";
|
||||||
|
|
||||||
.app-dialog {
|
.app-dialog {
|
||||||
--app-field: var(--app-control);
|
--app-field: var(--app-control);
|
||||||
--app-field-hover: var(--app-control-hover);
|
--app-field-hover: var(--app-control-hover);
|
||||||
|
@apply max-w-[calc(100vw-32px)] max-h-[calc(100dvh-32px)] overflow-hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
.app-dialog {
|
|
||||||
@apply max-w-[calc(100vw-32px)] max-h-[calc(100dvh-32px)];
|
|
||||||
}
|
|
||||||
.app-dialog .n-card-header {
|
.app-dialog .n-card-header {
|
||||||
@apply shrink-0;
|
@apply shrink-0 items-start;
|
||||||
}
|
}
|
||||||
.dialog-body-scroll {
|
/* 正文自然撑开,超过剩余视口高度后由 NScrollbar 内部滚动。 */
|
||||||
@apply max-h-[calc(100dvh-154px)];
|
.app-dialog .n-card-content {
|
||||||
|
@apply min-h-0 overflow-hidden;
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
.app-dialog .n-card__content {
|
|
||||||
|
.dialog-body-scroll.n-scrollbar {
|
||||||
@apply min-h-0;
|
@apply min-h-0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.app-dialog .n-card-header__close {
|
||||||
|
@apply grid place-items-center w-10 h-10 -m-2 rounded-none bg-transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-dialog .n-card-header__close .n-base-icon {
|
||||||
|
@apply p-2 box-content bg-(--app-subtle);
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-dialog .n-card-header__close:hover {
|
||||||
|
@apply bg-transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-dialog .n-card-header__close:hover .n-base-icon {
|
||||||
|
@apply bg-(--app-control-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-dialog .n-card__footer {
|
||||||
|
@apply shrink-0 bg-(--app-surface);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-dialog .dialog-footer {
|
||||||
|
@apply flex justify-end gap-2;
|
||||||
|
align-items: center;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 标题与底栏保留一致的边距,正文按内容和可用视口确定高度。 */
|
||||||
|
.app-dialog.n-card > .n-card-header {
|
||||||
|
padding-top: var(--n-padding-left);
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-dialog.n-card > .n-card-content {
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 没有按钮底栏时,正文保留与左右内边距一致的底部留白。 */
|
||||||
|
.app-dialog.n-card:not(:has(> .n-card__footer)) > .n-card-content {
|
||||||
|
padding-bottom: var(--n-padding-left);
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-dialog.n-card > .n-card__footer {
|
||||||
|
padding-top: var(--n-padding-left);
|
||||||
|
padding-bottom: var(--n-padding-left);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { NPopover } from 'naive-ui'
|
||||||
|
import type { PopoverProps } from 'naive-ui'
|
||||||
|
import { CircleHelp } from '@lucide/vue'
|
||||||
|
|
||||||
|
/** 字段标签与按需打开的说明,适用于项目配置和各类生成表单。 */
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
/** 字段标签,保持实际文案与必填标记。 */
|
||||||
|
label: string
|
||||||
|
/** 原有字段说明,没有说明时不显示提示图标。 */
|
||||||
|
description?: string
|
||||||
|
/** 提示位置可按字段单独指定,默认居中显示在图标上方。 */
|
||||||
|
placement?: PopoverProps['placement']
|
||||||
|
}>(),
|
||||||
|
{ placement: 'top' }
|
||||||
|
)
|
||||||
|
/** 点击或键盘激活提示按钮时打开说明,点击外部后关闭。 */
|
||||||
|
const open = ref(false)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- 以下是字段标签与说明提示模块 -->
|
||||||
|
<span class="inline-flex min-w-0 items-center gap-1.5">
|
||||||
|
<span>{{ label }}</span>
|
||||||
|
<!-- 浮层挂到视口层,按字段指定位置并自动翻转,避免被弹窗滚动容器裁剪。 -->
|
||||||
|
<NPopover v-if="description" v-model:show="open" trigger="click" :placement="placement" :to="true" :flip="true">
|
||||||
|
<template #trigger>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="inline-flex size-4 shrink-0 items-center justify-center text-muted hover:text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current"
|
||||||
|
:aria-label="`${label}说明`"
|
||||||
|
:aria-expanded="open"
|
||||||
|
@click.stop
|
||||||
|
>
|
||||||
|
<CircleHelp :size="14" aria-hidden="true" />
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<div class="max-w-[min(360px,calc(100vw-48px))] whitespace-pre-wrap break-words text-xs leading-5">
|
||||||
|
{{ description }}
|
||||||
|
</div>
|
||||||
|
</NPopover>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { h } from 'vue'
|
||||||
|
import { NButton } from 'naive-ui'
|
||||||
|
import { useActionMessage } from './useActionMessage'
|
||||||
|
|
||||||
|
/** 问题说明按需查看,页面不长期堆叠错误段落。 */
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
/** 当前实际问题的中文说明。 */
|
||||||
|
messages: string[]
|
||||||
|
/** 操作按钮名称。 */
|
||||||
|
label?: string
|
||||||
|
/** 问题对应的反馈级别。 */
|
||||||
|
type?: 'warning' | 'error' | 'info'
|
||||||
|
}>(),
|
||||||
|
{ label: '查看原因', type: 'warning' }
|
||||||
|
)
|
||||||
|
/** 统一使用应用的 Naive 消息层。 */
|
||||||
|
const message = useActionMessage()
|
||||||
|
|
||||||
|
/** 点击后展示去重问题,不重新请求或生成内容。 */
|
||||||
|
function showReasons() {
|
||||||
|
const content = [...new Set(props.messages.map(item => item.trim()).filter(Boolean))].join(';')
|
||||||
|
if (content)
|
||||||
|
message?.[props.type](() => h('div', { class: 'max-w-[min(600px,calc(100vw-48px))] break-words' }, content), {
|
||||||
|
duration: 7000,
|
||||||
|
closable: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- 以下是按需查看问题说明的操作模块 -->
|
||||||
|
<div v-if="messages.length" class="mt-3 flex items-center gap-2">
|
||||||
|
<NButton text size="small" @click="showReasons">{{ label }}</NButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import FieldLabel from './FieldLabel.vue'
|
||||||
|
import { NAlert, NButton } from 'naive-ui'
|
||||||
|
|
||||||
|
/** 只读诊断模块的展示参数。 */
|
||||||
|
interface Props {
|
||||||
|
/** 模块标题,同时用作无障碍名称。 */
|
||||||
|
title: string
|
||||||
|
/** 查询说明。 */
|
||||||
|
description?: string
|
||||||
|
/** 当前是否正在读取。 */
|
||||||
|
loading?: boolean
|
||||||
|
/** 当前查询错误。 */
|
||||||
|
error?: string
|
||||||
|
}
|
||||||
|
/** 多个历史和诊断入口共用折叠、刷新与错误展示。 */
|
||||||
|
defineProps<Props>()
|
||||||
|
/** 展开状态由调用方决定,只在展开后读取诊断。 */
|
||||||
|
const open = defineModel<boolean>('open', { default: false })
|
||||||
|
/** 显式刷新只发出读取事件,不产生任何生成或修复操作。 */
|
||||||
|
const emit = defineEmits<{ refresh: [] }>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- 以下是只读诊断的标题、展开与手动刷新模块 -->
|
||||||
|
<section class="workspace-panel text-xs leading-6" :aria-label="title">
|
||||||
|
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||||
|
<strong><FieldLabel :label="title" :description="description" /></strong>
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<NButton text size="small" :aria-label="`${open ? '收起' : '查看'}${title}`" @click="open = !open">
|
||||||
|
{{ open ? '收起' : '查看' }}
|
||||||
|
</NButton>
|
||||||
|
<NButton
|
||||||
|
v-if="open"
|
||||||
|
text
|
||||||
|
size="small"
|
||||||
|
:loading="loading"
|
||||||
|
:aria-label="`刷新${title}`"
|
||||||
|
@click="emit('refresh')"
|
||||||
|
>
|
||||||
|
刷新
|
||||||
|
</NButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- 以下是读取状态、错误与实际诊断结果模块 -->
|
||||||
|
<div v-if="open" class="mt-3">
|
||||||
|
<NAlert v-if="error" type="error" :show-icon="false" role="alert">{{ error }}</NAlert>
|
||||||
|
<p v-if="loading" class="text-muted" role="status">正在加载…</p>
|
||||||
|
<slot v-else />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
@@ -5,6 +5,8 @@ defineProps<{ split?: boolean; compact?: boolean }>()
|
|||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<section class="workspace-page" :class="{ 'content-first-workspace': compact }">
|
<section class="workspace-page" :class="{ 'content-first-workspace': compact }">
|
||||||
|
<!-- 以下是统一对齐的页面提示、标题与正文模块 -->
|
||||||
|
<div v-if="$slots.notice" class="workspace-notice"><slot name="notice" /></div>
|
||||||
<NScrollbar v-if="$slots.header" class="workspace-heading-scroll"
|
<NScrollbar v-if="$slots.header" class="workspace-heading-scroll"
|
||||||
><header class="workspace-heading"><slot name="header" /></header
|
><header class="workspace-heading"><slot name="header" /></header
|
||||||
></NScrollbar>
|
></NScrollbar>
|
||||||
@@ -18,21 +20,25 @@ defineProps<{ split?: boolean; compact?: boolean }>()
|
|||||||
@reference "../../styles/styles.css";
|
@reference "../../styles/styles.css";
|
||||||
.workspace-page {
|
.workspace-page {
|
||||||
@apply relative h-full flex flex-col min-h-0 overflow-hidden;
|
@apply relative h-full flex flex-col min-h-0 overflow-hidden;
|
||||||
|
/* 四周留白只由公共容器提供,内部模块不再叠加外层内边距。 */
|
||||||
|
padding: var(--app-content-padding);
|
||||||
|
gap: var(--app-content-gap);
|
||||||
|
}
|
||||||
|
.workspace-notice {
|
||||||
|
@apply shrink-0;
|
||||||
|
}
|
||||||
|
/* 条件提示未渲染时不占高度,也不留下额外的模块间距。 */
|
||||||
|
.workspace-notice:not(:has(> *)) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.workspace-notice > * {
|
||||||
|
@apply m-0;
|
||||||
}
|
}
|
||||||
.workspace-heading-scroll.n-scrollbar {
|
.workspace-heading-scroll.n-scrollbar {
|
||||||
@apply shrink-0 h-auto max-h-[min(35dvh,260px)] overflow-hidden;
|
@apply shrink-0 h-auto max-h-[min(35dvh,260px)] overflow-hidden;
|
||||||
}
|
}
|
||||||
.workspace-heading {
|
.workspace-heading {
|
||||||
@apply pt-4 px-6 pb-3;
|
@apply p-0;
|
||||||
}
|
|
||||||
.content-first-workspace .workspace-heading {
|
|
||||||
@apply py-2 px-5;
|
|
||||||
}
|
|
||||||
.content-first-workspace .workspace-split {
|
|
||||||
@apply pt-0 px-5 pb-3 gap-2;
|
|
||||||
}
|
|
||||||
.content-first-workspace .workspace-scroll-content {
|
|
||||||
@apply pt-0 px-5 pb-4;
|
|
||||||
}
|
}
|
||||||
.workspace-heading h2 {
|
.workspace-heading h2 {
|
||||||
@apply text-base;
|
@apply text-base;
|
||||||
@@ -50,32 +56,19 @@ defineProps<{ split?: boolean; compact?: boolean }>()
|
|||||||
@apply flex-1 min-h-0;
|
@apply flex-1 min-h-0;
|
||||||
}
|
}
|
||||||
.workspace-scroll-content {
|
.workspace-scroll-content {
|
||||||
@apply pt-1 px-6 pb-6;
|
@apply p-0;
|
||||||
}
|
}
|
||||||
.workspace-scroll > .n-scrollbar-container {
|
.workspace-scroll > .n-scrollbar-container {
|
||||||
@apply overscroll-contain;
|
@apply overscroll-contain;
|
||||||
}
|
}
|
||||||
.workspace-split {
|
.workspace-split {
|
||||||
@apply flex flex-col flex-1 min-h-0 overflow-hidden pt-1 px-6 pb-5 gap-3;
|
@apply flex flex-col flex-1 min-h-0 overflow-hidden p-0;
|
||||||
|
gap: var(--app-content-gap);
|
||||||
}
|
}
|
||||||
.workspace-split > .my-6 {
|
.workspace-split > .my-6 {
|
||||||
@apply m-0 shrink-0;
|
@apply m-0 shrink-0;
|
||||||
}
|
}
|
||||||
@media (max-width: 760px) {
|
@media (max-width: 760px) {
|
||||||
.workspace-heading {
|
|
||||||
@apply p-3;
|
|
||||||
}
|
|
||||||
.content-first-workspace .workspace-heading {
|
|
||||||
@apply py-2 px-3;
|
|
||||||
}
|
|
||||||
.content-first-workspace .workspace-split,
|
|
||||||
.content-first-workspace .workspace-scroll-content {
|
|
||||||
@apply pt-0 px-3 pb-3;
|
|
||||||
}
|
|
||||||
.workspace-scroll-content,
|
|
||||||
.workspace-split {
|
|
||||||
@apply pt-0 px-3 pb-3;
|
|
||||||
}
|
|
||||||
.workspace-heading .production-controls {
|
.workspace-heading .production-controls {
|
||||||
@apply grid-cols-[minmax(100px,_1fr)_80px];
|
@apply grid-cols-[minmax(100px,_1fr)_80px];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { NButton, NDrawer, NDrawerContent } from 'naive-ui'
|
import { NButton } from 'naive-ui'
|
||||||
import { Settings2, X } from '@lucide/vue'
|
import AppDialog from './AppDialog.vue'
|
||||||
|
import { Settings2 } from '@lucide/vue'
|
||||||
|
|
||||||
/** 所有业务抽屉挂到 body,以完整视口为边界;triggerless 允许业务页把入口放进自己的工具栏。 */
|
/** 批量设置与回执属于临时操作,统一使用大尺寸弹窗;完整制作流程继续保留独立页面。 */
|
||||||
withDefaults(defineProps<{ title: string; label?: string; hasReceipt?: boolean; triggerless?: boolean }>(), {
|
withDefaults(defineProps<{ title: string; label?: string; hasReceipt?: boolean; triggerless?: boolean }>(), {
|
||||||
label: '操作与回执',
|
label: '操作与回执',
|
||||||
triggerless: false
|
triggerless: false
|
||||||
@@ -24,53 +25,25 @@ const open = defineModel<boolean>('open', { default: false })
|
|||||||
<span class="workspace-tools-label">{{ label }}</span
|
<span class="workspace-tools-label">{{ label }}</span
|
||||||
><span v-if="hasReceipt" class="text-xs text-muted"> · 有回执</span>
|
><span v-if="hasReceipt" class="text-xs text-muted"> · 有回执</span>
|
||||||
</NButton>
|
</NButton>
|
||||||
<NDrawer
|
<AppDialog v-model:open="open" :title="title" description="" wide>
|
||||||
v-model:show="open"
|
<div class="workspace-tools-body"><slot /></div>
|
||||||
to="body"
|
</AppDialog>
|
||||||
width="min(960px, 100%)"
|
|
||||||
placement="right"
|
|
||||||
:block-scroll="true"
|
|
||||||
display-directive="show"
|
|
||||||
class="workspace-tools-drawer"
|
|
||||||
:aria-label="title"
|
|
||||||
>
|
|
||||||
<NDrawerContent :native-scrollbar="false" body-content-class="workspace-tools-body">
|
|
||||||
<template #header
|
|
||||||
><div class="workspace-tools-heading">
|
|
||||||
<span>{{ title }}</span
|
|
||||||
><NButton
|
|
||||||
quaternary
|
|
||||||
class="icon-button"
|
|
||||||
aria-label="关闭操作面板"
|
|
||||||
title="关闭操作面板"
|
|
||||||
@click="open = false"
|
|
||||||
><template #icon><X :size="18" /></template
|
|
||||||
></NButton></div
|
|
||||||
></template>
|
|
||||||
<slot />
|
|
||||||
</NDrawerContent>
|
|
||||||
</NDrawer>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
||||||
@reference "../../styles/styles.css";
|
@reference "../../styles/styles.css";
|
||||||
.workspace-tools-drawer .n-drawer-header {
|
|
||||||
@apply bg-(--app-subtle) p-4;
|
|
||||||
}
|
|
||||||
.workspace-tools-drawer .n-drawer-body {
|
|
||||||
@apply bg-(--app-body) p-0;
|
|
||||||
}
|
|
||||||
.workspace-tools-drawer {
|
|
||||||
--n-header-padding: 16px;
|
|
||||||
--n-body-padding: 16px;
|
|
||||||
@apply max-w-full;
|
|
||||||
}
|
|
||||||
.workspace-tools-heading {
|
|
||||||
@apply flex items-center justify-between gap-4 w-full text-[15px];
|
|
||||||
}
|
|
||||||
.workspace-tools-body {
|
.workspace-tools-body {
|
||||||
@apply p-4;
|
@apply px-0 pb-5;
|
||||||
|
}
|
||||||
|
.workspace-tools-body > * + * {
|
||||||
|
@apply mt-5;
|
||||||
|
}
|
||||||
|
.workspace-tools-body .panel {
|
||||||
|
@apply p-5;
|
||||||
|
}
|
||||||
|
.workspace-tools-body .overview-content {
|
||||||
|
@apply pb-0;
|
||||||
}
|
}
|
||||||
.workspace-tools-body .storyboard-controls,
|
.workspace-tools-body .storyboard-controls,
|
||||||
.workspace-tools-body .production-controls {
|
.workspace-tools-body .production-controls {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/** 公共 UI 的统一导出入口。 */
|
/** 公共 UI 的统一导出入口。 */
|
||||||
|
export { default as FieldLabel } from './FieldLabel.vue'
|
||||||
export { default as AppDialog } from './AppDialog.vue'
|
export { default as AppDialog } from './AppDialog.vue'
|
||||||
export { default as EmptyState } from './EmptyState.vue'
|
export { default as EmptyState } from './EmptyState.vue'
|
||||||
export { default as StatusBadge } from './StatusBadge.vue'
|
export { default as StatusBadge } from './StatusBadge.vue'
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { inject, type InjectionKey } from 'vue'
|
||||||
|
import type { MessageApi } from 'naive-ui'
|
||||||
|
|
||||||
|
/** 页面操作结果共用的 Naive Message 实例。 */
|
||||||
|
export const actionMessageKey: InjectionKey<MessageApi> = Symbol('action-message')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取应用提供的轻量反馈接口,独立使用组件时允许不提供消息层。
|
||||||
|
* @returns 当前应用消息接口,没有消息层时返回 null
|
||||||
|
*/
|
||||||
|
export function useActionMessage() {
|
||||||
|
return inject(actionMessageKey, null)
|
||||||
|
}
|
||||||
@@ -78,4 +78,3 @@ export function usePolling<T>(
|
|||||||
})
|
})
|
||||||
return { data, loading, error, updatedAt, refresh }
|
return { data, loading, error, updatedAt, refresh }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ export function useTheme() {
|
|||||||
groupLabelBorder: 'none'
|
groupLabelBorder: 'none'
|
||||||
},
|
},
|
||||||
Select: { peers: { InternalSelection: selection } },
|
Select: { peers: { InternalSelection: selection } },
|
||||||
Card: { borderColor: 'transparent' },
|
Card: { borderColor: 'transparent', paddingMedium: '19px 20px 20px' },
|
||||||
Drawer: { headerBorderBottom: 'none', footerBorderTop: 'none' },
|
Drawer: { headerBorderBottom: 'none', footerBorderTop: 'none' },
|
||||||
Alert: {
|
Alert: {
|
||||||
border: 'none',
|
border: 'none',
|
||||||
@@ -263,4 +263,3 @@ export function useTheme() {
|
|||||||
})
|
})
|
||||||
return { preference, isDark, theme, overrides }
|
return { preference, isDark, theme, overrides }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,13 +15,15 @@ import { breakdownSnapshot, recoveryOptions, workflowCheckpoints } from '../work
|
|||||||
import { getOperation, runOperation } from '../workflows/operations'
|
import { getOperation, runOperation } from '../workflows/operations'
|
||||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||||
import HistoryPanel from '../workflows/HistoryPanel.vue'
|
import HistoryPanel from '../workflows/HistoryPanel.vue'
|
||||||
|
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||||
|
import { useWorkflowExecution } from '../workflows/execution'
|
||||||
import SubjectList from './components/SubjectList.vue'
|
import SubjectList from './components/SubjectList.vue'
|
||||||
import StoryboardList from './components/StoryboardList.vue'
|
import StoryboardList from './components/StoryboardList.vue'
|
||||||
import { errorMessage } from '../../lib/http'
|
import { errorMessage } from '../../lib/http'
|
||||||
import { downloadText, nodeLabel } from '../../lib/format'
|
import { downloadText, nodeLabel } from '../../lib/format'
|
||||||
|
|
||||||
/** 拆解工作区:先预览真实分组,再启动;恢复操作根据 checkpoint 分阶段展示。 */
|
/** 拆解工作区:先预览真实分组,再启动;恢复操作根据 checkpoint 分阶段展示。 */
|
||||||
const { project, checkpoints, refresh, error } = useProjectContext()
|
const { project, checkpoints, refresh, refreshStageReadiness, stageReadiness, error } = useProjectContext()
|
||||||
const groupSize = ref(3)
|
const groupSize = ref(3)
|
||||||
const modules = ref<BreakdownModule[]>(['character', 'scene', 'prop'])
|
const modules = ref<BreakdownModule[]>(['character', 'scene', 'prop'])
|
||||||
const preview = ref<BreakdownPreview | null>(null)
|
const preview = ref<BreakdownPreview | null>(null)
|
||||||
@@ -44,10 +46,20 @@ const plans = computed(() => result.value?.storyboardPlans ?? [])
|
|||||||
const shots = computed(() => result.value?.storyboardEpisodeShots ?? [])
|
const shots = computed(() => result.value?.storyboardEpisodeShots ?? [])
|
||||||
const summary = computed(() => snapshot.value?.taskSummary)
|
const summary = computed(() => snapshot.value?.taskSummary)
|
||||||
const validation = computed(() => result.value?.storyboardShotValidation ?? snapshot.value?.storyboardShotValidation)
|
const validation = computed(() => result.value?.storyboardShotValidation ?? snapshot.value?.storyboardShotValidation)
|
||||||
const operation = computed(() => getOperation(project.value!.id))
|
const projectId = computed(() => project.value?.id ?? '')
|
||||||
|
const operation = computed(() => getOperation(projectId.value))
|
||||||
|
const backgroundExecution = useWorkflowExecution(projectId, 'breakdown')
|
||||||
const recovery = computed(() => recoveryOptions(checkpoints.value))
|
const recovery = computed(() => recoveryOptions(checkpoints.value))
|
||||||
const execution = computed(() => snapshot.value?.workflowExecution)
|
const execution = computed(() => snapshot.value?.workflowExecution)
|
||||||
const taskStopped = computed(() => execution.value?.status === 'failed' || execution.value?.status === 'completed')
|
const taskStopped = computed(() => execution.value?.status === 'failed' || execution.value?.status === 'completed')
|
||||||
|
/** 后台拆解结束后自动刷新项目、Checkpoint 与正式主体/分镜数据。 */
|
||||||
|
watch(
|
||||||
|
() => backgroundExecution.query.data.value?.status,
|
||||||
|
(status, previous) => {
|
||||||
|
if ((status === 'completed' || status === 'failed') && status !== previous)
|
||||||
|
void Promise.all([refresh(), refreshStageReadiness()])
|
||||||
|
}
|
||||||
|
)
|
||||||
const showRecovery = computed(
|
const showRecovery = computed(
|
||||||
() => records.value.length > 0 && (execution.value?.status !== 'completed' || validation.value?.valid === false)
|
() => records.value.length > 0 && (execution.value?.status !== 'completed' || validation.value?.valid === false)
|
||||||
)
|
)
|
||||||
@@ -55,6 +67,7 @@ const configValid = computed(
|
|||||||
() => Number.isSafeInteger(groupSize.value) && groupSize.value > 0 && modules.value.length > 0
|
() => Number.isSafeInteger(groupSize.value) && groupSize.value > 0 && modules.value.length > 0
|
||||||
)
|
)
|
||||||
const input = computed<BreakdownInput>(() => ({ groupSize: groupSize.value, modules: [...modules.value] }))
|
const input = computed<BreakdownInput>(() => ({ groupSize: groupSize.value, modules: [...modules.value] }))
|
||||||
|
const stageComplete = computed(() => stageReadiness.value?.breakdown.ready === true)
|
||||||
const canStart = computed(
|
const canStart = computed(
|
||||||
() =>
|
() =>
|
||||||
!!project.value?.episodes.length &&
|
!!project.value?.episodes.length &&
|
||||||
@@ -62,6 +75,7 @@ const canStart = computed(
|
|||||||
!!preview.value &&
|
!!preview.value &&
|
||||||
configValid.value &&
|
configValid.value &&
|
||||||
!operation.value.pending &&
|
!operation.value.pending &&
|
||||||
|
!backgroundExecution.active.value &&
|
||||||
!error.value &&
|
!error.value &&
|
||||||
(!records.value.length || taskStopped.value)
|
(!records.value.length || taskStopped.value)
|
||||||
)
|
)
|
||||||
@@ -120,13 +134,15 @@ async function run(action: BreakdownAction) {
|
|||||||
'resume-storyboard': '正在修复分镜绑定'
|
'resume-storyboard': '正在修复分镜绑定'
|
||||||
}
|
}
|
||||||
const id = project.value.id
|
const id = project.value.id
|
||||||
await runOperation(id, labels[action], () =>
|
await runOperation(id, labels[action], async () => {
|
||||||
breakdownApi.run(id, action, action === 'start' ? input.value : undefined)
|
const started = await breakdownApi.run(id, action, action === 'start' ? input.value : undefined)
|
||||||
)
|
await backgroundExecution.track(started.executionId)
|
||||||
|
return started
|
||||||
|
})
|
||||||
await refresh()
|
await refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出所见的后端结果;阶段性数据也明确标记为 snapshot。 */
|
/** 导出当前拆解结果;阶段性数据也明确标记为 snapshot。 */
|
||||||
function exportResult() {
|
function exportResult() {
|
||||||
if (!snapshot.value) return
|
if (!snapshot.value) return
|
||||||
downloadText(
|
downloadText(
|
||||||
@@ -144,6 +160,15 @@ const rules = {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<WorkspacePage split compact class="breakdown-workspace-page">
|
<WorkspacePage split compact class="breakdown-workspace-page">
|
||||||
|
<template #notice>
|
||||||
|
<!-- 以下是拆解完成后的下一步提示模块 -->
|
||||||
|
<NAlert v-if="stageComplete" type="success" :show-icon="false">
|
||||||
|
剧本拆解已经准备完成,人物、场景、道具和正式镜头都可以进入后续制作。
|
||||||
|
<RouterLink :to="`/projects/${projectId}/visual-style`" class="text-button ml-2"
|
||||||
|
>继续视觉风格 →</RouterLink
|
||||||
|
>
|
||||||
|
</NAlert>
|
||||||
|
</template>
|
||||||
<template #header>
|
<template #header>
|
||||||
<!-- 以下是拆解状态与设置 -->
|
<!-- 以下是拆解状态与设置 -->
|
||||||
<div class="workspace-toolbar">
|
<div class="workspace-toolbar">
|
||||||
@@ -166,8 +191,8 @@ const rules = {
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="project?.episodes.length" class="toolbar-actions">
|
<div v-if="project?.episodes.length" class="toolbar-actions">
|
||||||
<WorkspaceTools v-model:open="toolsOpen" title="拆解设置与恢复" label="拆解设置与恢复">
|
<WorkspaceTools v-model:open="toolsOpen" title="拆解设置与恢复" label="拆解设置与恢复">
|
||||||
<section class="panel breakdown-settings-panel p-5 lg:p-6">
|
<section class="panel workspace-panel breakdown-settings-panel">
|
||||||
<div class="mb-5 flex flex-wrap items-start justify-between gap-3">
|
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||||
<div>
|
<div>
|
||||||
<h2 class="flex items-center gap-2 font-semibold"><Layers :size="17" />拆解设置</h2>
|
<h2 class="flex items-center gap-2 font-semibold"><Layers :size="17" />拆解设置</h2>
|
||||||
<p class="mt-2 text-xs leading-5 text-muted">
|
<p class="mt-2 text-xs leading-5 text-muted">
|
||||||
@@ -279,10 +304,19 @@ const rules = {
|
|||||||
剧本仍在生成,暂不允许启动拆解,避免读取到不完整的剧集。
|
剧本仍在生成,暂不允许启动拆解,避免读取到不完整的剧集。
|
||||||
</p>
|
</p>
|
||||||
<p v-if="records.length && !taskStopped" class="mt-4 text-xs leading-5 text-muted">
|
<p v-if="records.length && !taskStopped" class="mt-4 text-xs leading-5 text-muted">
|
||||||
后端尚无明确的完成或失败记录。为避免重复执行,已禁用整条重新拆解;如进程已中断,请先核实后台,再选择对应恢复操作。
|
当前任务还没有明确的完成或失败记录。为避免重复执行,已暂停重新拆解;如任务已中断,请先刷新状态,再选择对应恢复操作。
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
<section v-if="snapshot" class="mt-5">
|
<WorkflowExecutionPanel
|
||||||
|
v-if="backgroundExecution.executionId.value"
|
||||||
|
title="剧本拆解任务"
|
||||||
|
:execution="backgroundExecution.query.data.value"
|
||||||
|
:loading="backgroundExecution.query.loading.value"
|
||||||
|
:error="backgroundExecution.query.error.value"
|
||||||
|
@refresh="backgroundExecution.query.refresh"
|
||||||
|
@dismiss="backgroundExecution.dismiss"
|
||||||
|
/>
|
||||||
|
<section v-if="snapshot">
|
||||||
<div class="mb-3 flex flex-wrap items-center justify-between gap-3">
|
<div class="mb-3 flex flex-wrap items-center justify-between gap-3">
|
||||||
<h2 class="text-sm font-medium">
|
<h2 class="text-sm font-medium">
|
||||||
最近可用拆解快照
|
最近可用拆解快照
|
||||||
@@ -499,7 +533,7 @@ const rules = {
|
|||||||
<EmptyState
|
<EmptyState
|
||||||
v-else
|
v-else
|
||||||
title="尚无抽取任务记录"
|
title="尚无抽取任务记录"
|
||||||
description="启动拆解后,任务会在后端保存 checkpoint 时更新。预览中的任务尚未执行。"
|
description="启动拆解后会持续保存进度;预览只展示本次处理范围,不会直接开始执行。"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</NScrollbar>
|
</NScrollbar>
|
||||||
@@ -593,6 +627,10 @@ const rules = {
|
|||||||
.breakdown-results-section > .content-with-history {
|
.breakdown-results-section > .content-with-history {
|
||||||
@apply flex-1 h-auto min-h-0 grid-rows-[minmax(0,_1fr)];
|
@apply flex-1 h-auto min-h-0 grid-rows-[minmax(0,_1fr)];
|
||||||
}
|
}
|
||||||
|
/* 亮色模式为结果正文增加浅灰背景,保持与页面底色的层次。 */
|
||||||
|
:root:not([data-theme='dark']) .breakdown-results-section > .content-with-history {
|
||||||
|
background: var(--app-subtle);
|
||||||
|
}
|
||||||
.breakdown-results-scroll .n-scrollbar-content {
|
.breakdown-results-scroll .n-scrollbar-content {
|
||||||
@apply wrap-anywhere;
|
@apply wrap-anywhere;
|
||||||
}
|
}
|
||||||
@@ -603,9 +641,6 @@ const rules = {
|
|||||||
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[minmax(0,_1fr)];
|
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[minmax(0,_1fr)];
|
||||||
}
|
}
|
||||||
@media (max-width: 800px) {
|
@media (max-width: 800px) {
|
||||||
.breakdown-workspace-page .workspace-heading {
|
|
||||||
@apply py-2 px-3;
|
|
||||||
}
|
|
||||||
.breakdown-workspace-page .workspace-toolbar {
|
.breakdown-workspace-page .workspace-toolbar {
|
||||||
@apply min-h-0 flex-nowrap gap-2;
|
@apply min-h-0 flex-nowrap gap-2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { optionalResource, request } from '../../lib/http'
|
import { optionalResource, request } from '../../lib/http'
|
||||||
import type { BreakdownAction, BreakdownInput, BreakdownPreview, BreakdownState } from './types'
|
import type { BreakdownAction, BreakdownInput, BreakdownPreview, BreakdownState } from './types'
|
||||||
|
import type { WorkflowExecutionStart } from '../workflows/execution.types'
|
||||||
|
|
||||||
/** Breakdown API;预览为 GET,启动和恢复为等待完成的长 POST。 */
|
/** Breakdown API;预览为 GET,启动和恢复为等待完成的长 POST。 */
|
||||||
export const breakdownApi = {
|
export const breakdownApi = {
|
||||||
@@ -10,9 +11,8 @@ export const breakdownApi = {
|
|||||||
latest: (id: string, signal?: AbortSignal) =>
|
latest: (id: string, signal?: AbortSignal) =>
|
||||||
optionalResource(request<BreakdownState>(`/projects/${encodeURIComponent(id)}/breakdown/latest`, { signal })),
|
optionalResource(request<BreakdownState>(`/projects/${encodeURIComponent(id)}/breakdown/latest`, { signal })),
|
||||||
run: (id: string, action: BreakdownAction, input?: BreakdownInput) =>
|
run: (id: string, action: BreakdownAction, input?: BreakdownInput) =>
|
||||||
request<BreakdownState>(`/projects/${encodeURIComponent(id)}/breakdown/${action}`, {
|
request<WorkflowExecutionStart>(`/projects/${encodeURIComponent(id)}/breakdown/${action}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: input,
|
body: input
|
||||||
timeoutMs: 0
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||||
import ActionMenu from '../../components/ui/ActionMenu.vue'
|
import ActionMenu from '../../components/ui/ActionMenu.vue'
|
||||||
import { NScrollbar, NCollapse, NCollapseItem, NProgress, NTab, NTabs, NTag } from 'naive-ui'
|
import { NScrollbar, NCollapse, NCollapseItem, NProgress, NTab, NTabs, NTag } from 'naive-ui'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { ArrowRight, Check, Circle } from '@lucide/vue'
|
import { ArrowRight, Check, Circle } from '@lucide/vue'
|
||||||
import { EmptyState } from '../../components/ui'
|
import { EmptyState } from '../../components/ui'
|
||||||
import { useProjectContext } from '../projects/context'
|
import { useProjectContext } from '../projects/context'
|
||||||
@@ -13,16 +13,27 @@ import HistoryPanel from '../workflows/HistoryPanel.vue'
|
|||||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||||
import { downloadText } from '../../lib/format'
|
import { downloadText } from '../../lib/format'
|
||||||
import EpisodeReader from './EpisodeReader.vue'
|
import EpisodeReader from './EpisodeReader.vue'
|
||||||
|
import { useWorkflowExecution } from '../workflows/execution'
|
||||||
|
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||||
|
|
||||||
/** 剧本创作工作区,正式数据库内容为准,checkpoint 只补充计划与恢复信息。 */
|
/** 剧本创作工作区,正式数据库内容为准,checkpoint 只补充计划与恢复信息。 */
|
||||||
const { project, checkpoints, refresh, error } = useProjectContext()
|
const { project, checkpoints, refresh, refreshStageReadiness, error } = useProjectContext()
|
||||||
const tab = ref('episodes')
|
const tab = ref('episodes')
|
||||||
const showHistory = ref(false)
|
const showHistory = ref(false)
|
||||||
const dramaRecords = computed(() => workflowCheckpoints(checkpoints.value, 'create-drama'))
|
const dramaRecords = computed(() => workflowCheckpoints(checkpoints.value, 'create-drama'))
|
||||||
const state = computed(() => dramaRecords.value.at(-1)?.state)
|
const state = computed(() => dramaRecords.value.at(-1)?.state)
|
||||||
const episodes = computed(() => project.value?.episodes ?? [])
|
const episodes = computed(() => project.value?.episodes ?? [])
|
||||||
const total = computed(() => state.value?.episodeCount)
|
const total = computed(() => state.value?.episodeCount)
|
||||||
const operation = computed(() => getOperation(project.value!.id))
|
const projectId = computed(() => project.value?.id ?? '')
|
||||||
|
const operation = computed(() => getOperation(projectId.value))
|
||||||
|
const backgroundExecution = useWorkflowExecution(projectId, 'create-drama')
|
||||||
|
watch(
|
||||||
|
() => backgroundExecution.query.data.value?.status,
|
||||||
|
(status, previous) => {
|
||||||
|
if ((status === 'completed' || status === 'failed') && status !== previous)
|
||||||
|
void Promise.all([refresh(), refreshStageReadiness()])
|
||||||
|
}
|
||||||
|
)
|
||||||
const complete = computed(() => project.value?.status === 'completed')
|
const complete = computed(() => project.value?.status === 'completed')
|
||||||
const hasCheckpoint = computed(() => dramaRecords.value.length > 0)
|
const hasCheckpoint = computed(() => dramaRecords.value.length > 0)
|
||||||
const canGenerate = computed(
|
const canGenerate = computed(
|
||||||
@@ -52,9 +63,11 @@ const stages = computed(() => [
|
|||||||
async function resume(action: 'resume-generation' | 'resume-rewrite') {
|
async function resume(action: 'resume-generation' | 'resume-rewrite') {
|
||||||
if (!project.value || operation.value.pending || error.value) return
|
if (!project.value || operation.value.pending || error.value) return
|
||||||
const id = project.value.id
|
const id = project.value.id
|
||||||
await runOperation(id, action === 'resume-generation' ? '恢复剧集生成' : '恢复剧本改写', () =>
|
await runOperation(id, action === 'resume-generation' ? '恢复剧集生成' : '恢复剧本改写', async () => {
|
||||||
projectsApi.resume(id, action)
|
const started = await projectsApi.resume(id, action)
|
||||||
)
|
await backgroundExecution.track(started.executionId)
|
||||||
|
return started
|
||||||
|
})
|
||||||
await refresh()
|
await refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,26 +98,36 @@ function exportScript() {
|
|||||||
</div>
|
</div>
|
||||||
</div></div
|
</div></div
|
||||||
></template>
|
></template>
|
||||||
|
<WorkflowExecutionPanel
|
||||||
|
v-if="backgroundExecution.executionId.value"
|
||||||
|
title="剧本创作任务"
|
||||||
|
:execution="backgroundExecution.query.data.value"
|
||||||
|
:loading="backgroundExecution.query.loading.value"
|
||||||
|
:error="backgroundExecution.query.error.value"
|
||||||
|
@refresh="backgroundExecution.query.refresh"
|
||||||
|
@dismiss="backgroundExecution.dismiss" />
|
||||||
<div v-if="!complete" class="mt-5 flex flex-wrap items-center justify-between gap-4">
|
<div v-if="!complete" class="mt-5 flex flex-wrap items-center justify-between gap-4">
|
||||||
<p class="text-sm text-muted">
|
<p class="text-sm text-muted">
|
||||||
已写入 {{ episodes.length }}<span v-if="total"> / {{ total }}</span> 集<span v-if="!total">
|
已写入 {{ episodes.length }}<span v-if="total"> / {{ total }}</span> 集<span v-if="!total">
|
||||||
· 等待计划集数</span
|
· 等待计划集数</span
|
||||||
>。{{
|
>。{{
|
||||||
project?.status === 'generating' ? '生成状态来自后端,请等待下一次更新。' : '可按中断阶段继续处理。'
|
project?.status === 'generating'
|
||||||
|
? '剧本仍在生成,请等待状态更新。'
|
||||||
|
: '如中途停止,可从当前阶段继续。'
|
||||||
}}
|
}}
|
||||||
</p>
|
</p>
|
||||||
<div class="flex flex-wrap gap-2">
|
<div class="flex flex-wrap gap-2">
|
||||||
<ConfirmAction
|
<ConfirmAction
|
||||||
label="恢复生成"
|
label="恢复生成"
|
||||||
description="用于剧集尚未写完的情况。后端会检查角色、世界观与 checkpoint,并继续处理剧集。"
|
description="用于剧集尚未写完的情况。系统会从已保存的角色、世界观和剧集进度继续生成。"
|
||||||
acknowledgement
|
acknowledgement
|
||||||
:disabled="!canGenerate || operation.pending || !!error"
|
:disabled="!canGenerate || operation.pending || backgroundExecution.active.value || !!error"
|
||||||
@confirm="resume('resume-generation')"
|
@confirm="resume('resume-generation')"
|
||||||
/><ConfirmAction
|
/><ConfirmAction
|
||||||
label="恢复改写"
|
label="恢复改写"
|
||||||
description="用于剧集已齐全但审核未通过的情况。将读取 checkpoint 的改写上下文并重新审核。"
|
description="用于剧集已齐全但审核未通过的情况。系统会从已保存的改写进度继续审核和调整。"
|
||||||
acknowledgement
|
acknowledgement
|
||||||
:disabled="!canRewrite || operation.pending || !!error"
|
:disabled="!canRewrite || operation.pending || backgroundExecution.active.value || !!error"
|
||||||
@confirm="resume('resume-rewrite')"
|
@confirm="resume('resume-rewrite')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -265,9 +288,6 @@ function exportScript() {
|
|||||||
@apply whitespace-pre-wrap wrap-anywhere p-4 bg-(--app-subtle) rounded-none font-mono text-[11px] leading-[1.9];
|
@apply whitespace-pre-wrap wrap-anywhere p-4 bg-(--app-subtle) rounded-none font-mono text-[11px] leading-[1.9];
|
||||||
}
|
}
|
||||||
@media (max-width: 800px) {
|
@media (max-width: 800px) {
|
||||||
.script-workspace-page .workspace-heading {
|
|
||||||
@apply py-2.5 px-3;
|
|
||||||
}
|
|
||||||
.stage-strip {
|
.stage-strip {
|
||||||
@apply gap-2;
|
@apply gap-2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||||
import { NAlert, NButton, NCollapse, NCollapseItem, NFormItem, NSelect, NSpin } from 'naive-ui'
|
import { NAlert, NButton, NFormItem, NSelect, NSpin } from 'naive-ui'
|
||||||
import { errorMessage } from '../../../lib/http'
|
import { errorMessage } from '../../../lib/http'
|
||||||
import { generationConfigApi } from '../api'
|
import { generationConfigApi } from '../api'
|
||||||
import type {
|
import type {
|
||||||
@@ -10,43 +10,86 @@ import type {
|
|||||||
GenerationModelItem,
|
GenerationModelItem,
|
||||||
GenerationOptions
|
GenerationOptions
|
||||||
} from '../types'
|
} from '../types'
|
||||||
|
import { creativeProfileDraft, creativeProfileIssues } from '../profile-draft'
|
||||||
|
import { useProjectGenerationRevision } from '../context'
|
||||||
import GenerationOptionFields from './GenerationOptionFields.vue'
|
import GenerationOptionFields from './GenerationOptionFields.vue'
|
||||||
|
|
||||||
const props = defineProps<{ projectId: string }>()
|
/** 项目配置表单参数。 */
|
||||||
const emit = defineEmits<{ saved: [profile: CreativeProfileInput] }>()
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
/** 当前项目 ID。 */
|
||||||
|
projectId: string
|
||||||
|
/** 弹窗由公共 footer 提供保存操作,隐藏表单自身操作区。 */
|
||||||
|
hideActions?: boolean
|
||||||
|
/** 有项目操作时禁止编辑和保存配置。 */
|
||||||
|
disabled?: boolean
|
||||||
|
}>(),
|
||||||
|
{ hideActions: false, disabled: false }
|
||||||
|
)
|
||||||
|
/** 保存后的实际配置与保存状态通知。 */
|
||||||
|
const emit = defineEmits<{ saved: [profile: CreativeProfileInput]; busy: [saving: boolean] }>()
|
||||||
|
/** 成功保存后通知当前项目生成表单更新默认值。 */
|
||||||
|
const revision = useProjectGenerationRevision()
|
||||||
|
|
||||||
|
/** 配置和模型目录读取状态。 */
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
/** 配置保存状态。 */
|
||||||
const saving = ref(false)
|
const saving = ref(false)
|
||||||
|
/** 读取或保存错误。 */
|
||||||
const error = ref('')
|
const error = ref('')
|
||||||
|
/** 真实保存结果提示。 */
|
||||||
const notice = ref('')
|
const notice = ref('')
|
||||||
|
/** 后端支持的图片与视频模型目录。 */
|
||||||
const catalog = ref<GenerationModelCatalog | null>(null)
|
const catalog = ref<GenerationModelCatalog | null>(null)
|
||||||
|
/** 当前项目的独立编辑草稿。 */
|
||||||
const profile = ref<CreativeProfileInput | null>(null)
|
const profile = ref<CreativeProfileInput | null>(null)
|
||||||
|
/** 当前读取请求控制器。 */
|
||||||
let controller: AbortController | null = null
|
let controller: AbortController | null = null
|
||||||
|
/** 组件销毁后忽略迟到保存响应,不更新新项目配置修订号。 */
|
||||||
|
let disposed = false
|
||||||
|
|
||||||
|
/** 项目画布支持的宽高比选项。 */
|
||||||
const aspectRatios = ['9:16', '16:9', '1:1', '4:3', '3:4'].map(value => ({ label: value, value }))
|
const aspectRatios = ['9:16', '16:9', '1:1', '4:3', '3:4'].map(value => ({ label: value, value }))
|
||||||
|
/** 当前可用的图片模型。 */
|
||||||
const enabledImages = computed(() => catalog.value?.images?.filter(item => item.enabled && item.model) ?? [])
|
const enabledImages = computed(() => catalog.value?.images?.filter(item => item.enabled && item.model) ?? [])
|
||||||
|
/** 当前可用的视频模型。 */
|
||||||
const enabledVideos = computed(() => catalog.value?.videos?.filter(item => item.enabled && item.model) ?? [])
|
const enabledVideos = computed(() => catalog.value?.videos?.filter(item => item.enabled && item.model) ?? [])
|
||||||
|
/** 当前图片模型的组合选项值。 */
|
||||||
const imageSelection = computed(() =>
|
const imageSelection = computed(() =>
|
||||||
profile.value ? selectionValue(profile.value.imageProvider, profile.value.imageModel) : null
|
profile.value ? selectionValue(profile.value.imageProvider, profile.value.imageModel) : null
|
||||||
)
|
)
|
||||||
|
/** 当前视频模型的组合选项值。 */
|
||||||
const videoSelection = computed(() =>
|
const videoSelection = computed(() =>
|
||||||
profile.value ? selectionValue(profile.value.videoProvider, profile.value.videoModel) : null
|
profile.value ? selectionValue(profile.value.videoProvider, profile.value.videoModel) : null
|
||||||
)
|
)
|
||||||
|
/** 图片模型对应的参数 schema。 */
|
||||||
const imageModel = computed(() =>
|
const imageModel = computed(() =>
|
||||||
enabledImages.value.find(item =>
|
enabledImages.value.find(item =>
|
||||||
profile.value ? item.provider === profile.value.imageProvider && item.model === profile.value.imageModel : false
|
profile.value ? item.provider === profile.value.imageProvider && item.model === profile.value.imageModel : false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
/** 视频模型对应的参数 schema。 */
|
||||||
const videoModel = computed(() =>
|
const videoModel = computed(() =>
|
||||||
enabledVideos.value.find(item =>
|
enabledVideos.value.find(item =>
|
||||||
profile.value ? item.provider === profile.value.videoProvider && item.model === profile.value.videoModel : false
|
profile.value ? item.provider === profile.value.videoProvider && item.model === profile.value.videoModel : false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组合供应方与模型,避免同名模型混淆。
|
||||||
|
* @param provider 模型供应方
|
||||||
|
* @param model 模型名称
|
||||||
|
* @returns 下拉选项唯一值
|
||||||
|
*/
|
||||||
function selectionValue(provider: string, model: string) {
|
function selectionValue(provider: string, model: string) {
|
||||||
return `${provider}\u0000${model}`
|
return `${provider}\u0000${model}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将实际模型目录转成下拉选项。
|
||||||
|
* @param items 当前媒介模型列表
|
||||||
|
* @returns 模型下拉选项
|
||||||
|
*/
|
||||||
function modelOptions(items: GenerationModelItem[]) {
|
function modelOptions(items: GenerationModelItem[]) {
|
||||||
return items.map(item => ({
|
return items.map(item => ({
|
||||||
label: `${item.providerLabel} · ${item.modelLabel}`,
|
label: `${item.providerLabel} · ${item.modelLabel}`,
|
||||||
@@ -54,6 +97,11 @@ function modelOptions(items: GenerationModelItem[]) {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 依据目标模型 schema 创建合法初始参数。
|
||||||
|
* @param item 当前模型
|
||||||
|
* @returns 模型初始参数
|
||||||
|
*/
|
||||||
function defaultOptions(item: GenerationModelItem): GenerationOptions {
|
function defaultOptions(item: GenerationModelItem): GenerationOptions {
|
||||||
return Object.fromEntries(
|
return Object.fromEntries(
|
||||||
item.generationOptions.flatMap(schema => {
|
item.generationOptions.flatMap(schema => {
|
||||||
@@ -66,12 +114,20 @@ function defaultOptions(item: GenerationModelItem): GenerationOptions {
|
|||||||
}
|
}
|
||||||
if ((schema.type === 'integer' || schema.type === 'number') && schema.min !== undefined)
|
if ((schema.type === 'integer' || schema.type === 'number') && schema.min !== undefined)
|
||||||
return [[schema.key, schema.min]]
|
return [[schema.key, schema.min]]
|
||||||
if (schema.type === 'size') return [[schema.key, 'auto']]
|
if (schema.type === 'size' && schema.options?.length) {
|
||||||
|
const first = schema.options[0]
|
||||||
|
return first ? [[schema.key, first.value]] : []
|
||||||
|
}
|
||||||
return []
|
return []
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换模型时清空上一模型参数。
|
||||||
|
* @param type 图片或视频媒介
|
||||||
|
* @param value 下拉选项唯一值
|
||||||
|
*/
|
||||||
function selectModel(type: 'image' | 'video', value: string) {
|
function selectModel(type: 'image' | 'video', value: string) {
|
||||||
if (!profile.value) return
|
if (!profile.value) return
|
||||||
const items = type === 'image' ? enabledImages.value : enabledVideos.value
|
const items = type === 'image' ? enabledImages.value : enabledVideos.value
|
||||||
@@ -88,6 +144,11 @@ function selectModel(type: 'image' | 'video', value: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未配置项目使用后端可用默认模型初始化草稿。
|
||||||
|
* @param nextCatalog 当前模型目录
|
||||||
|
* @returns 初始项目配置,无完整模型时返回 null
|
||||||
|
*/
|
||||||
function createInitial(nextCatalog: GenerationModelCatalog): CreativeProfileInput | null {
|
function createInitial(nextCatalog: GenerationModelCatalog): CreativeProfileInput | null {
|
||||||
const image =
|
const image =
|
||||||
nextCatalog.images.find(item => item.enabled && item.isDefault && item.model) ??
|
nextCatalog.images.find(item => item.enabled && item.isDefault && item.model) ??
|
||||||
@@ -107,132 +168,155 @@ function createInitial(nextCatalog: GenerationModelCatalog): CreativeProfileInpu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 读取实际目录与项目配置,取消旧目标请求并忽略迟到响应。 */
|
||||||
async function load() {
|
async function load() {
|
||||||
controller?.abort()
|
controller?.abort()
|
||||||
controller = new AbortController()
|
controller = new AbortController()
|
||||||
|
const signal = controller.signal
|
||||||
|
const projectId = props.projectId
|
||||||
|
profile.value = null
|
||||||
|
catalog.value = null
|
||||||
loading.value = true
|
loading.value = true
|
||||||
error.value = ''
|
error.value = ''
|
||||||
notice.value = ''
|
notice.value = ''
|
||||||
try {
|
try {
|
||||||
const [nextCatalog, saved] = await Promise.all([
|
const [nextCatalog, saved] = await Promise.all([
|
||||||
generationConfigApi.catalog(controller.signal),
|
generationConfigApi.catalog(signal),
|
||||||
generationConfigApi.profile(props.projectId, controller.signal)
|
generationConfigApi.profile(projectId, signal)
|
||||||
])
|
])
|
||||||
|
if (signal.aborted || props.projectId !== projectId) return
|
||||||
|
if (saved && saved.projectId !== projectId) throw new Error('项目配置返回了不匹配的项目。')
|
||||||
catalog.value = nextCatalog
|
catalog.value = nextCatalog
|
||||||
profile.value = saved
|
profile.value = saved ? creativeProfileDraft(saved) : createInitial(nextCatalog)
|
||||||
? {
|
|
||||||
aspectRatio: saved.aspectRatio,
|
|
||||||
imageProvider: saved.imageProvider,
|
|
||||||
imageModel: saved.imageModel,
|
|
||||||
imageOptions: { ...saved.imageOptions },
|
|
||||||
videoProvider: saved.videoProvider,
|
|
||||||
videoModel: saved.videoModel,
|
|
||||||
videoOptions: { ...saved.videoOptions }
|
|
||||||
}
|
|
||||||
: createInitial(nextCatalog)
|
|
||||||
} catch (cause) {
|
} catch (cause) {
|
||||||
if (!controller.signal.aborted) error.value = errorMessage(cause)
|
if (!signal.aborted && props.projectId === projectId) error.value = errorMessage(cause)
|
||||||
} finally {
|
} finally {
|
||||||
if (!controller.signal.aborted) loading.value = false
|
if (!signal.aborted && props.projectId === projectId) loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 保存独立配置快照,不因路由变化把结果写入其它项目。 */
|
||||||
async function save() {
|
async function save() {
|
||||||
if (!profile.value || saving.value) return
|
if (!canSave.value || !profile.value) return
|
||||||
|
const projectId = props.projectId
|
||||||
|
const input = creativeProfileDraft(profile.value)
|
||||||
saving.value = true
|
saving.value = true
|
||||||
error.value = ''
|
error.value = ''
|
||||||
notice.value = ''
|
notice.value = ''
|
||||||
try {
|
try {
|
||||||
const saved = await generationConfigApi.saveProfile(props.projectId, profile.value)
|
const saved = await generationConfigApi.saveProfile(projectId, input)
|
||||||
profile.value = {
|
if (disposed || props.projectId !== projectId) return
|
||||||
aspectRatio: saved.aspectRatio,
|
if (saved.projectId !== projectId) throw new Error('保存结果与当前项目不匹配,请重新读取配置。')
|
||||||
imageProvider: saved.imageProvider,
|
profile.value = creativeProfileDraft(saved)
|
||||||
imageModel: saved.imageModel,
|
|
||||||
imageOptions: { ...saved.imageOptions },
|
|
||||||
videoProvider: saved.videoProvider,
|
|
||||||
videoModel: saved.videoModel,
|
|
||||||
videoOptions: { ...saved.videoOptions }
|
|
||||||
}
|
|
||||||
notice.value = '项目生成配置已保存,后续首帧和视频生成会继承此配置。'
|
notice.value = '项目生成配置已保存,后续首帧和视频生成会继承此配置。'
|
||||||
|
revision.value++
|
||||||
emit('saved', profile.value)
|
emit('saved', profile.value)
|
||||||
} catch (cause) {
|
} catch (cause) {
|
||||||
error.value = errorMessage(cause)
|
if (!disposed && props.projectId === projectId) error.value = errorMessage(cause)
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false
|
saving.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 按后端实际 schema 展示不兼容参数,不静默替换用户已保存的值。 */
|
||||||
|
const validationIssues = computed(() =>
|
||||||
|
profile.value && catalog.value ? creativeProfileIssues(profile.value, catalog.value) : []
|
||||||
|
)
|
||||||
|
/** 有实际项目草稿、完整可用模型且无进行中的项目操作才允许保存。 */
|
||||||
|
const canSave = computed(
|
||||||
|
() =>
|
||||||
|
!props.disabled &&
|
||||||
|
!loading.value &&
|
||||||
|
!saving.value &&
|
||||||
|
!!profile.value &&
|
||||||
|
!!enabledImages.value.length &&
|
||||||
|
!!enabledVideos.value.length &&
|
||||||
|
!validationIssues.value.length
|
||||||
|
)
|
||||||
|
/** 向弹窗 footer 暴露同一个保存入口,避免复制表单与请求逻辑。 */
|
||||||
|
defineExpose({ save, canSave })
|
||||||
|
|
||||||
|
/** 保存状态同步给弹窗,保存完成前禁止关闭。 */
|
||||||
|
watch(saving, value => emit('busy', value), { flush: 'sync' })
|
||||||
|
/** 项目变化时重新读取配置。 */
|
||||||
watch(() => props.projectId, load, { immediate: true })
|
watch(() => props.projectId, load, { immediate: true })
|
||||||
onScopeDispose(() => controller?.abort())
|
onScopeDispose(() => {
|
||||||
|
disposed = true
|
||||||
|
controller?.abort()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NCollapse class="production-tool-section creative-profile-settings" :default-expanded-names="['creative-profile']">
|
<!-- 以下是项目画布与图片、视频模型配置模块 -->
|
||||||
<NCollapseItem name="creative-profile" title="项目画布与生成模型">
|
<section class="production-tool-section creative-profile-settings workspace-panel">
|
||||||
<NSpin :show="loading">
|
<h3 v-if="!hideActions" class="text-sm font-semibold">项目画布与生成模型</h3>
|
||||||
<NAlert v-if="error" type="error" :show-icon="false" class="mb-3">{{ error }}</NAlert>
|
<NSpin :show="loading">
|
||||||
<NAlert v-if="notice" type="success" :show-icon="false" class="mb-3">{{ notice }}</NAlert>
|
<NAlert v-if="disabled" type="info" :show-icon="false" class="mb-3"
|
||||||
<NAlert
|
>项目正在执行制作任务,完成后可以修改配置。</NAlert
|
||||||
v-if="!loading && (!enabledImages.length || !enabledVideos.length)"
|
>
|
||||||
type="warning"
|
<NAlert v-if="error" type="error" :show-icon="false" class="mb-3">{{ error }}</NAlert>
|
||||||
:show-icon="false"
|
<NAlert v-if="validationIssues.length" type="warning" :show-icon="false" class="mb-3">
|
||||||
>
|
<p v-for="issue in validationIssues" :key="issue">{{ issue }}</p>
|
||||||
后端尚未启用完整的图片和视频模型,暂时无法保存项目生成配置。
|
</NAlert>
|
||||||
</NAlert>
|
<NAlert v-if="notice" type="success" :show-icon="false" class="mb-3">{{ notice }}</NAlert>
|
||||||
<div v-if="profile" class="creative-profile-grid">
|
<NAlert
|
||||||
<NFormItem label="作品宽高比">
|
v-if="!loading && (!enabledImages.length || !enabledVideos.length)"
|
||||||
|
type="warning"
|
||||||
|
:show-icon="false"
|
||||||
|
>
|
||||||
|
当前没有可用的完整图片和视频模型,暂时无法保存项目生成配置。
|
||||||
|
</NAlert>
|
||||||
|
<div v-if="profile" class="creative-profile-grid">
|
||||||
|
<NFormItem label="作品宽高比">
|
||||||
|
<NSelect
|
||||||
|
:value="profile.aspectRatio"
|
||||||
|
:options="aspectRatios"
|
||||||
|
:disabled="saving || disabled"
|
||||||
|
@update:value="profile.aspectRatio = $event as CreativeProfileAspectRatio"
|
||||||
|
/>
|
||||||
|
</NFormItem>
|
||||||
|
<div></div>
|
||||||
|
<!-- 以下是项目图片生成配置模块 -->
|
||||||
|
<section class="model-section min-w-0 pt-5">
|
||||||
|
<h3 class="mb-4 text-sm font-semibold">图片配置</h3>
|
||||||
|
<NFormItem label="图片模型">
|
||||||
<NSelect
|
<NSelect
|
||||||
:value="profile.aspectRatio"
|
:value="imageSelection"
|
||||||
:options="aspectRatios"
|
:options="modelOptions(enabledImages)"
|
||||||
:disabled="saving"
|
:disabled="saving || disabled"
|
||||||
@update:value="profile.aspectRatio = $event as CreativeProfileAspectRatio"
|
@update:value="selectModel('image', $event)"
|
||||||
/>
|
/>
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
<div></div>
|
<GenerationOptionFields
|
||||||
<section class="model-section">
|
v-model="profile.imageOptions"
|
||||||
<NFormItem label="图片模型">
|
:schemas="imageModel?.generationOptions || []"
|
||||||
<NSelect
|
:disabled="saving || disabled"
|
||||||
:value="imageSelection"
|
/>
|
||||||
:options="modelOptions(enabledImages)"
|
</section>
|
||||||
:disabled="saving"
|
<!-- 以下是项目视频生成配置模块 -->
|
||||||
@update:value="selectModel('image', $event)"
|
<section class="model-section min-w-0 pt-5">
|
||||||
/>
|
<h3 class="mb-4 text-sm font-semibold">视频配置</h3>
|
||||||
</NFormItem>
|
<NFormItem label="视频模型">
|
||||||
<GenerationOptionFields
|
<NSelect
|
||||||
v-model="profile.imageOptions"
|
:value="videoSelection"
|
||||||
:schemas="imageModel?.generationOptions || []"
|
:options="modelOptions(enabledVideos)"
|
||||||
:disabled="saving"
|
:disabled="saving || disabled"
|
||||||
|
@update:value="selectModel('video', $event)"
|
||||||
/>
|
/>
|
||||||
</section>
|
</NFormItem>
|
||||||
<section class="model-section">
|
<GenerationOptionFields
|
||||||
<NFormItem label="视频模型">
|
v-model="profile.videoOptions"
|
||||||
<NSelect
|
:schemas="videoModel?.generationOptions || []"
|
||||||
:value="videoSelection"
|
:disabled="saving || disabled"
|
||||||
:options="modelOptions(enabledVideos)"
|
/>
|
||||||
:disabled="saving"
|
</section>
|
||||||
@update:value="selectModel('video', $event)"
|
</div>
|
||||||
/>
|
<div v-if="!hideActions" class="page-form-actions creative-profile-actions">
|
||||||
</NFormItem>
|
<NButton type="primary" :loading="saving" :disabled="!canSave" @click="save">保存项目生成配置</NButton>
|
||||||
<GenerationOptionFields
|
<span class="text-xs text-muted">切换模型时会按新模型重置生成参数。</span>
|
||||||
v-model="profile.videoOptions"
|
</div>
|
||||||
:schemas="videoModel?.generationOptions || []"
|
</NSpin>
|
||||||
:disabled="saving"
|
</section>
|
||||||
/>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
<div class="page-form-actions creative-profile-actions">
|
|
||||||
<NButton
|
|
||||||
type="primary"
|
|
||||||
:loading="saving"
|
|
||||||
:disabled="loading || !profile || !enabledImages.length || !enabledVideos.length"
|
|
||||||
@click="save"
|
|
||||||
>保存项目生成配置</NButton
|
|
||||||
>
|
|
||||||
<span class="text-xs text-muted">切换模型时会按新模型重置生成参数。</span>
|
|
||||||
</div>
|
|
||||||
</NSpin>
|
|
||||||
</NCollapseItem>
|
|
||||||
</NCollapse>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -240,9 +324,6 @@ onScopeDispose(() => controller?.abort())
|
|||||||
.creative-profile-grid {
|
.creative-profile-grid {
|
||||||
@apply grid grid-cols-[repeat(2,_minmax(0,_1fr))] items-start gap-x-5 gap-y-6;
|
@apply grid grid-cols-[repeat(2,_minmax(0,_1fr))] items-start gap-x-5 gap-y-6;
|
||||||
}
|
}
|
||||||
.model-section {
|
|
||||||
@apply min-w-0 p-4 bg-(--app-subtle);
|
|
||||||
}
|
|
||||||
.model-section > :deep(.n-form-item) {
|
.model-section > :deep(.n-form-item) {
|
||||||
@apply mb-6;
|
@apply mb-6;
|
||||||
}
|
}
|
||||||
@@ -261,10 +342,13 @@ onScopeDispose(() => controller?.abort())
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.creative-profile-settings {
|
.creative-profile-settings {
|
||||||
@apply mb-7;
|
@apply m-0;
|
||||||
|
}
|
||||||
|
.creative-profile-settings > h3 {
|
||||||
|
@apply mb-4;
|
||||||
}
|
}
|
||||||
.creative-profile-actions {
|
.creative-profile-actions {
|
||||||
@apply mt-5 pt-1;
|
@apply mt-4;
|
||||||
}
|
}
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
.creative-profile-grid {
|
.creative-profile-grid {
|
||||||
|
|||||||
@@ -0,0 +1,184 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { NFormItem, NInputNumber, NSelect, NSwitch, NTag } from 'naive-ui'
|
||||||
|
import FieldLabel from '../../../components/ui/FieldLabel.vue'
|
||||||
|
import type { SelectOption } from 'naive-ui'
|
||||||
|
import type {
|
||||||
|
CreativeProfileAspectRatio,
|
||||||
|
GenerationModelCatalog,
|
||||||
|
GenerationModelItem,
|
||||||
|
GenerationOptions
|
||||||
|
} from '../types'
|
||||||
|
|
||||||
|
/** 本次生成模型与参数控件,字段说明在标签图标中按需查看。 */
|
||||||
|
const props = defineProps<{
|
||||||
|
type: 'image' | 'video'
|
||||||
|
catalog: GenerationModelCatalog
|
||||||
|
provider: string
|
||||||
|
options: GenerationOptions
|
||||||
|
aspectRatio: CreativeProfileAspectRatio
|
||||||
|
disabled?: boolean
|
||||||
|
}>()
|
||||||
|
/** 模型与参数编辑通知。 */
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:provider': [value: string]
|
||||||
|
'update:options': [value: GenerationOptions]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
/** 当前已启用的媒介模型。 */
|
||||||
|
const models = computed(() =>
|
||||||
|
(props.type === 'image' ? props.catalog.images : props.catalog.videos).filter(item => item.enabled)
|
||||||
|
)
|
||||||
|
/** 本次选择的实际模型。 */
|
||||||
|
const model = computed(() => models.value.find(item => item.provider === props.provider) ?? models.value[0])
|
||||||
|
/** 可用模型的下拉选项。 */
|
||||||
|
const modelOptions = computed(() =>
|
||||||
|
models.value.map(item => ({
|
||||||
|
label: item.modelLabel ? `${item.providerLabel} · ${item.modelLabel}` : item.providerLabel,
|
||||||
|
value: item.provider
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
|
||||||
|
function selectProvider(provider: string) {
|
||||||
|
const next = models.value.find(item => item.provider === provider)
|
||||||
|
if (!next) return
|
||||||
|
emit('update:provider', provider)
|
||||||
|
emit('update:options', { ...next.defaults })
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateOption(key: string, value: string | number | boolean | null) {
|
||||||
|
const next = { ...props.options }
|
||||||
|
if (value === null) delete next[key]
|
||||||
|
else next[key] = value
|
||||||
|
emit('update:options', next)
|
||||||
|
}
|
||||||
|
|
||||||
|
function choices(item: GenerationModelItem['generationOptions'][number]): SelectOption[] {
|
||||||
|
const options = [...(item.options ?? []), ...(item.specialValues ?? [])]
|
||||||
|
.filter(option => typeof option.value === 'string' || typeof option.value === 'number')
|
||||||
|
.map(option => ({ label: option.label, value: option.value as string | number }))
|
||||||
|
if (
|
||||||
|
/duration|时长/i.test(`${item.key} ${item.label}`) &&
|
||||||
|
Number.isInteger(item.min) &&
|
||||||
|
Number.isInteger(item.max) &&
|
||||||
|
item.max! >= item.min! &&
|
||||||
|
item.max! - item.min! <= 60
|
||||||
|
) {
|
||||||
|
for (let value = item.min!; value <= item.max!; value++) options.push({ label: `${value} 秒`, value })
|
||||||
|
}
|
||||||
|
return options
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectValue(key: string): string | number | null {
|
||||||
|
const value = props.options[key]
|
||||||
|
return typeof value === 'string' || typeof value === 'number' ? value : null
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="generation-model-controls">
|
||||||
|
<NFormItem class="generation-model-field generation-model-field-wide" label="模型">
|
||||||
|
<div class="generation-model-field-control">
|
||||||
|
<NSelect
|
||||||
|
:value="model?.provider"
|
||||||
|
:options="modelOptions"
|
||||||
|
:disabled="disabled || !modelOptions.length"
|
||||||
|
@update:value="selectProvider"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</NFormItem>
|
||||||
|
|
||||||
|
<template v-if="model">
|
||||||
|
<NFormItem
|
||||||
|
v-for="item in model.generationOptions"
|
||||||
|
:key="item.key"
|
||||||
|
class="generation-model-field"
|
||||||
|
:label="item.label"
|
||||||
|
:show-feedback="false"
|
||||||
|
>
|
||||||
|
<!-- 以下是生成参数标签与说明提示模块 -->
|
||||||
|
<template #label><FieldLabel :label="item.label" :description="item.description" /></template>
|
||||||
|
<div class="generation-model-field-control">
|
||||||
|
<div v-if="item.type === 'boolean'" class="generation-model-toggle">
|
||||||
|
<NSwitch
|
||||||
|
:value="Boolean(options[item.key])"
|
||||||
|
:disabled="disabled || item.userEditable === false"
|
||||||
|
@update:value="updateOption(item.key, $event)"
|
||||||
|
/>
|
||||||
|
<span class="text-xs">{{ options[item.key] ? '已启用' : '未启用' }}</span>
|
||||||
|
</div>
|
||||||
|
<NSelect
|
||||||
|
v-else-if="/duration|时长/i.test(`${item.key} ${item.label}`)"
|
||||||
|
:value="selectValue(item.key)"
|
||||||
|
:options="choices(item)"
|
||||||
|
:disabled="disabled || item.userEditable === false"
|
||||||
|
@update:value="updateOption(item.key, $event)"
|
||||||
|
/>
|
||||||
|
<NInputNumber
|
||||||
|
v-else-if="item.type === 'integer' || item.type === 'number'"
|
||||||
|
:value="typeof options[item.key] === 'number' ? Number(options[item.key]) : null"
|
||||||
|
:min="item.min"
|
||||||
|
:max="item.max"
|
||||||
|
:disabled="disabled || item.userEditable === false"
|
||||||
|
@update:value="updateOption(item.key, $event)"
|
||||||
|
/>
|
||||||
|
<NSelect
|
||||||
|
v-else
|
||||||
|
:value="selectValue(item.key)"
|
||||||
|
:options="choices(item)"
|
||||||
|
:disabled="disabled || item.userEditable === false"
|
||||||
|
@update:value="updateOption(item.key, $event)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</NFormItem>
|
||||||
|
|
||||||
|
<NFormItem class="generation-model-field" label="画幅比例" :show-feedback="false">
|
||||||
|
<template #label><FieldLabel label="画幅比例" description="项目画幅 · 单次生成不可覆盖" /></template>
|
||||||
|
<div class="generation-model-static">
|
||||||
|
<NTag size="small">{{ aspectRatio }}</NTag>
|
||||||
|
</div>
|
||||||
|
</NFormItem>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
@reference "../../../styles/styles.css";
|
||||||
|
.generation-model-controls {
|
||||||
|
@apply grid grid-cols-[repeat(2,_minmax(0,_1fr))] items-start gap-x-5 gap-y-5;
|
||||||
|
}
|
||||||
|
.generation-model-field {
|
||||||
|
@apply min-w-0 mb-0;
|
||||||
|
}
|
||||||
|
.generation-model-field-wide {
|
||||||
|
@apply col-span-2;
|
||||||
|
}
|
||||||
|
.generation-model-field :deep(.n-form-item-label) {
|
||||||
|
min-height: 27px;
|
||||||
|
padding: 0 0 7px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
.generation-model-field :deep(.n-form-item-blank) {
|
||||||
|
@apply min-h-[34px] min-w-0;
|
||||||
|
}
|
||||||
|
.generation-model-field-control {
|
||||||
|
@apply flex w-full min-w-0 flex-col items-stretch gap-1.5;
|
||||||
|
}
|
||||||
|
.generation-model-field-control :deep(.n-input-number),
|
||||||
|
.generation-model-field-control :deep(.n-select) {
|
||||||
|
@apply w-full;
|
||||||
|
}
|
||||||
|
.generation-model-toggle,
|
||||||
|
.generation-model-static {
|
||||||
|
@apply flex min-h-[34px] min-w-0 items-center gap-2.5;
|
||||||
|
}
|
||||||
|
@media (max-width: 760px) {
|
||||||
|
.generation-model-controls {
|
||||||
|
@apply grid-cols-[minmax(0,_1fr)] gap-y-4;
|
||||||
|
}
|
||||||
|
.generation-model-field-wide {
|
||||||
|
@apply col-span-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,8 +1,18 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { NCheckbox, NFormItem, NInput, NInputNumber, NSelect } from 'naive-ui'
|
import { NCheckbox, NFormItem, NInput, NInputNumber, NSelect } from 'naive-ui'
|
||||||
|
import FieldLabel from '../../../components/ui/FieldLabel.vue'
|
||||||
import type { GenerationOptionSchema, GenerationOptions } from '../types'
|
import type { GenerationOptionSchema, GenerationOptions } from '../types'
|
||||||
|
|
||||||
defineProps<{ schemas: GenerationOptionSchema[]; modelValue: GenerationOptions; disabled?: boolean }>()
|
/** 动态模型参数字段,实际说明由后端 schema 提供。 */
|
||||||
|
defineProps<{
|
||||||
|
/** 当前模型开放的参数列表。 */
|
||||||
|
schemas: GenerationOptionSchema[]
|
||||||
|
/** 本次实际参数值。 */
|
||||||
|
modelValue: GenerationOptions
|
||||||
|
/** 上游操作期间禁止编辑。 */
|
||||||
|
disabled?: boolean
|
||||||
|
}>()
|
||||||
|
/** 字段编辑后通知上游更新参数。 */
|
||||||
const emit = defineEmits<{ 'update:modelValue': [value: GenerationOptions] }>()
|
const emit = defineEmits<{ 'update:modelValue': [value: GenerationOptions] }>()
|
||||||
|
|
||||||
function update(model: GenerationOptions, key: string, value: string | number | boolean | null) {
|
function update(model: GenerationOptions, key: string, value: string | number | boolean | null) {
|
||||||
@@ -36,7 +46,7 @@ function optionKey(value: string | number) {
|
|||||||
function constrainedOptions(schema: GenerationOptionSchema, current: string | number | boolean | undefined) {
|
function constrainedOptions(schema: GenerationOptionSchema, current: string | number | boolean | undefined) {
|
||||||
const options = selectOptions(schema)
|
const options = selectOptions(schema)
|
||||||
if (schema.type === 'size') {
|
if (schema.type === 'size') {
|
||||||
for (const value of ['1K', '1.5K', '2K']) options.push({ label: value, value })
|
// 图片尺寸完全由当前 Provider Schema 决定,禁止混入其它模型的分辨率档位。
|
||||||
} else if (
|
} else if (
|
||||||
isDuration(schema) &&
|
isDuration(schema) &&
|
||||||
Number.isInteger(schema.min) &&
|
Number.isInteger(schema.min) &&
|
||||||
@@ -70,9 +80,15 @@ function constrainedOptions(schema: GenerationOptionSchema, current: string | nu
|
|||||||
v-for="schema in schemas"
|
v-for="schema in schemas"
|
||||||
:key="schema.key"
|
:key="schema.key"
|
||||||
:label="`${schema.label}${schema.required ? ' *' : ''}`"
|
:label="`${schema.label}${schema.required ? ' *' : ''}`"
|
||||||
:feedback="schema.description"
|
:show-feedback="false"
|
||||||
:show-feedback="!!schema.description"
|
|
||||||
>
|
>
|
||||||
|
<!-- 以下是参数标签与按需说明模块 -->
|
||||||
|
<template #label>
|
||||||
|
<FieldLabel
|
||||||
|
:label="`${schema.label}${schema.required ? ' *' : ''}`"
|
||||||
|
:description="schema.description"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
<NCheckbox
|
<NCheckbox
|
||||||
v-if="schema.type === 'boolean'"
|
v-if="schema.type === 'boolean'"
|
||||||
:checked="modelValue[schema.key] === true"
|
:checked="modelValue[schema.key] === true"
|
||||||
@@ -131,11 +147,6 @@ function constrainedOptions(schema: GenerationOptionSchema, current: string | nu
|
|||||||
min-height: 34px;
|
min-height: 34px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.generation-option-grid :deep(.n-form-item-feedback-wrapper:not(:empty)) {
|
|
||||||
min-height: 0;
|
|
||||||
padding: 8px 0 0;
|
|
||||||
line-height: 1.55;
|
|
||||||
}
|
|
||||||
@media (max-width: 760px) {
|
@media (max-width: 760px) {
|
||||||
.generation-option-grid {
|
.generation-option-grid {
|
||||||
@apply grid-cols-[minmax(0,_1fr)];
|
@apply grid-cols-[minmax(0,_1fr)];
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { NButton } from 'naive-ui'
|
||||||
|
import { AppDialog } from '../../../components/ui'
|
||||||
|
import type { CreativeProfileInput } from '../types'
|
||||||
|
import CreativeProfileSettings from './CreativeProfileSettings.vue'
|
||||||
|
|
||||||
|
/** 项目全局配置弹窗参数。 */
|
||||||
|
const props = defineProps<{
|
||||||
|
/** 当前正式项目 ID。 */
|
||||||
|
projectId: string
|
||||||
|
/** 项目操作期间只读查看,禁止保存模型配置。 */
|
||||||
|
disabled: boolean
|
||||||
|
}>()
|
||||||
|
/** 真实保存成功后通知项目布局更新就绪信息。 */
|
||||||
|
const emit = defineEmits<{ saved: [profile: CreativeProfileInput] }>()
|
||||||
|
/** 弹窗显隐状态。 */
|
||||||
|
const open = defineModel<boolean>('open', { default: false })
|
||||||
|
/** 保存进行中时禁止关闭弹窗,避免重复写入。 */
|
||||||
|
const saving = ref(false)
|
||||||
|
/** 配置表单实例,footer 调用表单自身的校验与保存入口。 */
|
||||||
|
const form = ref<InstanceType<typeof CreativeProfileSettings> | null>(null)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- 以下是项目图片与视频全局配置弹窗模块 -->
|
||||||
|
<AppDialog v-model:open="open" title="项目全局配置" :busy="saving" wide>
|
||||||
|
<template #description>设置项目画布、图片和视频生成模型,后续生成默认使用这里保存的配置。</template>
|
||||||
|
<CreativeProfileSettings
|
||||||
|
v-if="open"
|
||||||
|
ref="form"
|
||||||
|
:key="props.projectId"
|
||||||
|
:project-id="props.projectId"
|
||||||
|
:disabled="props.disabled"
|
||||||
|
hide-actions
|
||||||
|
@busy="saving = $event"
|
||||||
|
@saved="emit('saved', $event)"
|
||||||
|
/>
|
||||||
|
<!-- 以下是固定底栏取消与保存配置模块 -->
|
||||||
|
<template #footer>
|
||||||
|
<NButton :disabled="saving" @click="open = false">取消</NButton>
|
||||||
|
<NButton type="primary" :loading="saving" :disabled="!form?.canSave" @click="form?.save()"
|
||||||
|
>保存配置</NButton
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</AppDialog>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { inject, ref, type InjectionKey, type Ref } from 'vue'
|
||||||
|
|
||||||
|
/** 项目内共享的配置修订号,成功保存后通知已挂载的生成表单重新读取。 */
|
||||||
|
export const projectGenerationRevisionKey: InjectionKey<Ref<number>> = Symbol('project-generation-revision')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取项目配置修订号,独立使用组件时保留本地修订状态。
|
||||||
|
* @returns 当前项目的响应式配置修订号
|
||||||
|
*/
|
||||||
|
export function useProjectGenerationRevision() {
|
||||||
|
return inject(projectGenerationRevisionKey, undefined) ?? ref(0)
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import type { CreativeProfileInput, GenerationModelCatalog } from './types'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建独立编辑或提交快照,原样保留后端已保存的生成参数。
|
||||||
|
* @param profile 后端配置或当前编辑草稿
|
||||||
|
* @returns 与原对象隔离的项目配置快照
|
||||||
|
*/
|
||||||
|
export function creativeProfileDraft(profile: CreativeProfileInput): CreativeProfileInput {
|
||||||
|
return {
|
||||||
|
aspectRatio: profile.aspectRatio,
|
||||||
|
imageProvider: profile.imageProvider,
|
||||||
|
imageModel: profile.imageModel,
|
||||||
|
imageOptions: { ...profile.imageOptions },
|
||||||
|
videoProvider: profile.videoProvider,
|
||||||
|
videoModel: profile.videoModel,
|
||||||
|
videoOptions: { ...profile.videoOptions }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按真实模型目录检查配置能否保存。
|
||||||
|
* @param profile 当前项目配置草稿
|
||||||
|
* @param catalog 后端实际模型目录
|
||||||
|
* @returns 可展示的参数问题列表
|
||||||
|
*/
|
||||||
|
export function creativeProfileIssues(profile: CreativeProfileInput, catalog: GenerationModelCatalog): string[] {
|
||||||
|
const issues: string[] = []
|
||||||
|
for (const media of ['image', 'video'] as const) {
|
||||||
|
const label = media === 'image' ? '图片配置' : '视频配置'
|
||||||
|
const models = media === 'image' ? catalog.images : catalog.videos
|
||||||
|
const model = models.find(
|
||||||
|
item =>
|
||||||
|
item.enabled && item.provider === profile[`${media}Provider`] && item.model === profile[`${media}Model`]
|
||||||
|
)
|
||||||
|
if (!model) {
|
||||||
|
issues.push(`${label}:已保存的模型当前不可用,请重新选择模型。`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const values = profile[`${media}Options`]
|
||||||
|
for (const schema of model.generationOptions) {
|
||||||
|
const value = values[schema.key]
|
||||||
|
const field = `${label} · ${schema.label}`
|
||||||
|
if (value === undefined || value === '') {
|
||||||
|
if (schema.required) issues.push(`${field}:请填写必填参数。`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const validType =
|
||||||
|
schema.type === 'boolean'
|
||||||
|
? typeof value === 'boolean'
|
||||||
|
: schema.type === 'integer'
|
||||||
|
? typeof value === 'number' && Number.isInteger(value)
|
||||||
|
: schema.type === 'number'
|
||||||
|
? typeof value === 'number' && Number.isFinite(value)
|
||||||
|
: typeof value === 'string'
|
||||||
|
if (!validType) {
|
||||||
|
issues.push(`${field}:参数格式不正确。`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (schema.options?.length && !schema.options.some(option => option.value === value)) {
|
||||||
|
issues.push(`${field}:当前值 ${String(value)} 已不在模型支持范围内,请重新选择。`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (typeof value === 'number' && !schema.specialValues?.some(option => option.value === value)) {
|
||||||
|
if (schema.min !== undefined && value < schema.min) issues.push(`${field}:不能小于 ${schema.min}。`)
|
||||||
|
if (schema.max !== undefined && value > schema.max) issues.push(`${field}:不能大于 ${schema.max}。`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return issues
|
||||||
|
}
|
||||||
@@ -18,6 +18,8 @@ export interface GenerationOptionSchema {
|
|||||||
max?: number
|
max?: number
|
||||||
specialValues?: GenerationOptionChoice[]
|
specialValues?: GenerationOptionChoice[]
|
||||||
providerDefault?: GenerationOptionValue
|
providerDefault?: GenerationOptionValue
|
||||||
|
userEditable?: boolean
|
||||||
|
source?: 'provider' | 'project'
|
||||||
description?: string
|
description?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,6 +34,8 @@ export interface GenerationModelItem {
|
|||||||
isDefault: boolean
|
isDefault: boolean
|
||||||
capabilities: Record<string, unknown>
|
capabilities: Record<string, unknown>
|
||||||
generationOptions: GenerationOptionSchema[]
|
generationOptions: GenerationOptionSchema[]
|
||||||
|
defaults: GenerationOptions
|
||||||
|
projectConstraints: GenerationOptionSchema[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GenerationModelCatalog {
|
export interface GenerationModelCatalog {
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -4,27 +4,31 @@ import type {
|
|||||||
GenerateKeyframeInput,
|
GenerateKeyframeInput,
|
||||||
GenerateKeyframesInput,
|
GenerateKeyframesInput,
|
||||||
GenerateQualityVideosInput,
|
GenerateQualityVideosInput,
|
||||||
KeyframeBatchResult,
|
|
||||||
KeyframeReadiness,
|
KeyframeReadiness,
|
||||||
KeyframeGenerationPreview,
|
KeyframeGenerationPreview,
|
||||||
KeyframeSpec,
|
KeyframeSpec,
|
||||||
ProjectVideoStatus,
|
ProjectVideoStatus,
|
||||||
|
ProjectVideoInputPlan,
|
||||||
PromptReadiness,
|
PromptReadiness,
|
||||||
ProductionPipelineResult,
|
|
||||||
ProductionPlan,
|
ProductionPlan,
|
||||||
|
ProductionPlanInput,
|
||||||
|
ProductionStartInput,
|
||||||
ProviderInputSpec,
|
ProviderInputSpec,
|
||||||
ProjectProductionStatus,
|
ProjectProductionStatus,
|
||||||
RetryVideosResult,
|
RetryVideosResult,
|
||||||
ShotKeyframe,
|
ShotKeyframe,
|
||||||
ShotVideo,
|
ShotVideo,
|
||||||
|
ShotVideoQualityStatus,
|
||||||
ShotVideoQualityResult,
|
ShotVideoQualityResult,
|
||||||
VideoQualityBatchResult,
|
VideoQualityBatchResult,
|
||||||
VideoQualityConfig,
|
VideoQualityConfig,
|
||||||
VideoGenerationSpec,
|
VideoGenerationSpec,
|
||||||
|
VideoInputPlan,
|
||||||
VideoReadiness,
|
VideoReadiness,
|
||||||
ProjectAssemblyReadiness,
|
ProjectAssemblyReadiness,
|
||||||
EpisodeAssemblyResult
|
EpisodeAssemblyResult
|
||||||
} from './types'
|
} from './types'
|
||||||
|
import type { WorkflowExecutionStart } from '../workflows/execution.types'
|
||||||
|
|
||||||
/** 项目路径统一编码,避免业务组件手工拼接 ID。 */
|
/** 项目路径统一编码,避免业务组件手工拼接 ID。 */
|
||||||
function projectPath(id: string) {
|
function projectPath(id: string) {
|
||||||
@@ -53,22 +57,32 @@ export const productionApi = {
|
|||||||
request<ProviderInputSpec>(`${shotPath(shotId)}/provider-input-spec?provider=${encodeURIComponent(provider)}`, {
|
request<ProviderInputSpec>(`${shotPath(shotId)}/provider-input-spec?provider=${encodeURIComponent(provider)}`, {
|
||||||
signal
|
signal
|
||||||
}),
|
}),
|
||||||
/** 查询当前计划,不生成图片、视频或提示词。 */
|
/**
|
||||||
plan: (projectId: string, signal?: AbortSignal, providers?: { imageProvider?: string; videoProvider?: string }) => {
|
* 使用正式 POST 预检当前生产计划,不产生生成费用。
|
||||||
const params = new URLSearchParams()
|
* @param projectId 正式项目 ID
|
||||||
if (providers?.imageProvider) params.set('imageProvider', providers.imageProvider)
|
* @param signal 取消信号
|
||||||
if (providers?.videoProvider) params.set('videoProvider', providers.videoProvider)
|
* @param input 与启动同源的模型及图片参数
|
||||||
const query = params.size ? `?${params}` : ''
|
* @returns 后端实际生产计划
|
||||||
return request<ProductionPlan>(`${projectPath(projectId)}/production/plan${query}`, { signal })
|
*/
|
||||||
},
|
plan: (projectId: string, signal?: AbortSignal, input: ProductionPlanInput = {}) =>
|
||||||
|
request<ProductionPlan>(`${projectPath(projectId)}/production/plan`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: input,
|
||||||
|
signal
|
||||||
|
}),
|
||||||
/** 读取真实主资产完成状态,不能用任务提交回执代替。 */
|
/** 读取真实主资产完成状态,不能用任务提交回执代替。 */
|
||||||
status: (projectId: string, signal?: AbortSignal) =>
|
status: (projectId: string, signal?: AbortSignal) =>
|
||||||
request<ProjectProductionStatus>(`${projectPath(projectId)}/production/status`, { signal }),
|
request<ProjectProductionStatus>(`${projectPath(projectId)}/production/status`, { signal }),
|
||||||
startPipeline: (projectId: string, providers?: { imageProvider?: string; videoProvider?: string }) =>
|
/**
|
||||||
request<ProductionPipelineResult>(`${projectPath(projectId)}/production/start`, {
|
* 启动有限范围的串联生产,最终结果通过任务查询取得。
|
||||||
|
* @param projectId 正式项目 ID
|
||||||
|
* @param input 模型、断点、停止阶段和各阶段上限
|
||||||
|
* @returns 真实后台任务观察句柄
|
||||||
|
*/
|
||||||
|
startPipeline: (projectId: string, input: ProductionStartInput = {}) =>
|
||||||
|
request<WorkflowExecutionStart>(`${projectPath(projectId)}/production/start`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: providers ?? {},
|
body: input
|
||||||
timeoutMs: 0
|
|
||||||
}),
|
}),
|
||||||
promptReadiness: (projectId: string, force: boolean, signal?: AbortSignal) =>
|
promptReadiness: (projectId: string, force: boolean, signal?: AbortSignal) =>
|
||||||
request<PromptReadiness>(`${projectPath(projectId)}/video-prompts/readiness?force=${force}`, { signal }),
|
request<PromptReadiness>(`${projectPath(projectId)}/video-prompts/readiness?force=${force}`, { signal }),
|
||||||
@@ -78,16 +92,38 @@ export const productionApi = {
|
|||||||
body: input,
|
body: input,
|
||||||
timeoutMs: 0
|
timeoutMs: 0
|
||||||
}),
|
}),
|
||||||
|
/** 后台生成视频提示词;刷新页面后可凭 executionId 继续观察。 */
|
||||||
|
startPromptExecution: (projectId: string, input: StoryboardBatchInput) =>
|
||||||
|
request<WorkflowExecutionStart>(`${projectPath(projectId)}/video-prompts/generate/start`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: input
|
||||||
|
}),
|
||||||
keyframeReadiness: (projectId: string, force: boolean, signal?: AbortSignal) =>
|
keyframeReadiness: (projectId: string, force: boolean, signal?: AbortSignal) =>
|
||||||
request<KeyframeReadiness>(`${projectPath(projectId)}/keyframes/readiness?force=${force}`, { signal }),
|
request<KeyframeReadiness>(`${projectPath(projectId)}/keyframes/readiness?force=${force}`, { signal }),
|
||||||
|
/**
|
||||||
|
* 后台批量生成普通首帧候选。
|
||||||
|
* @param projectId 正式项目 ID
|
||||||
|
* @param input 当前生成范围和模型参数
|
||||||
|
* @returns 真实后台任务观察句柄
|
||||||
|
*/
|
||||||
generateKeyframes: (projectId: string, input: GenerateKeyframesInput) =>
|
generateKeyframes: (projectId: string, input: GenerateKeyframesInput) =>
|
||||||
request<KeyframeBatchResult>(`${projectPath(projectId)}/keyframes/generate`, {
|
request<WorkflowExecutionStart>(`${projectPath(projectId)}/keyframes/generate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: input,
|
body: input,
|
||||||
timeoutMs: 0
|
timeoutMs: 0
|
||||||
}),
|
}),
|
||||||
videoReadiness: (projectId: string, force: boolean, signal?: AbortSignal) =>
|
videoReadiness: (projectId: string, force: boolean, signal?: AbortSignal) =>
|
||||||
request<VideoReadiness>(`${projectPath(projectId)}/videos/readiness?force=${force}`, { signal }),
|
request<VideoReadiness>(`${projectPath(projectId)}/videos/readiness?force=${force}`, { signal }),
|
||||||
|
/** 预览当前项目或剧集的推荐视频输入模式,不创建 Provider 任务。 */
|
||||||
|
videoInputPlans: (projectId: string, episodeNo?: number, signal?: AbortSignal) => {
|
||||||
|
const params = new URLSearchParams()
|
||||||
|
if (episodeNo) params.set('episodeNo', String(episodeNo))
|
||||||
|
const query = params.size ? `?${params}` : ''
|
||||||
|
return request<ProjectVideoInputPlan>(`${projectPath(projectId)}/video-input-plans${query}`, { signal })
|
||||||
|
},
|
||||||
|
/** 读取单镜头的确定性输入规划。 */
|
||||||
|
videoInputPlan: (shotId: string, signal?: AbortSignal) =>
|
||||||
|
request<VideoInputPlan>(`${shotPath(shotId)}/video-input-plan`, { signal }),
|
||||||
/** 启动项目级严格视频质量流水线;创建后由后端自动完成校验、有限修复与晋升。 */
|
/** 启动项目级严格视频质量流水线;创建后由后端自动完成校验、有限修复与晋升。 */
|
||||||
generateQualityVideos: (projectId: string, input: GenerateQualityVideosInput) =>
|
generateQualityVideos: (projectId: string, input: GenerateQualityVideosInput) =>
|
||||||
request<VideoQualityBatchResult>(`${projectPath(projectId)}/videos/generate-quality`, {
|
request<VideoQualityBatchResult>(`${projectPath(projectId)}/videos/generate-quality`, {
|
||||||
@@ -95,8 +131,17 @@ export const productionApi = {
|
|||||||
body: input,
|
body: input,
|
||||||
timeoutMs: 0
|
timeoutMs: 0
|
||||||
}),
|
}),
|
||||||
|
/** 后台启动项目级视频质量任务;后续状态通过 WorkflowExecution 查询。 */
|
||||||
|
startQualityVideoExecution: (projectId: string, input: GenerateQualityVideosInput) =>
|
||||||
|
request<WorkflowExecutionStart>(`${projectPath(projectId)}/videos/generate-quality/start`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: input
|
||||||
|
}),
|
||||||
projectVideoStatus: (projectId: string, signal?: AbortSignal) =>
|
projectVideoStatus: (projectId: string, signal?: AbortSignal) =>
|
||||||
request<ProjectVideoStatus>(`${projectPath(projectId)}/videos/status`, { signal }),
|
request<ProjectVideoStatus>(`${projectPath(projectId)}/videos/status`, { signal }),
|
||||||
|
/** 读取单镜头已持久化的质量链状态,不触发新的视觉校验。 */
|
||||||
|
videoQualityStatus: (shotId: string, signal?: AbortSignal) =>
|
||||||
|
request<ShotVideoQualityStatus>(`${shotPath(shotId)}/videos/quality-status`, { signal }),
|
||||||
retryVideos: (projectId: string, concurrency: number) =>
|
retryVideos: (projectId: string, concurrency: number) =>
|
||||||
request<RetryVideosResult>(`${projectPath(projectId)}/videos/retry-failed`, {
|
request<RetryVideosResult>(`${projectPath(projectId)}/videos/retry-failed`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -107,9 +152,12 @@ export const productionApi = {
|
|||||||
request<ShotKeyframe[]>(`${shotPath(shotId)}/keyframes`, { signal }),
|
request<ShotKeyframe[]>(`${shotPath(shotId)}/keyframes`, { signal }),
|
||||||
keyframeSpec: (shotId: string, signal?: AbortSignal) =>
|
keyframeSpec: (shotId: string, signal?: AbortSignal) =>
|
||||||
request<KeyframeSpec>(`${shotPath(shotId)}/keyframe-spec`, { signal }),
|
request<KeyframeSpec>(`${shotPath(shotId)}/keyframe-spec`, { signal }),
|
||||||
/** 预览最终参考图规划与 Provider Prompt,不创建首帧任务。 */
|
/** 按本次请求选择的图片模型与参数预览最终输入,不创建首帧任务。 */
|
||||||
previewKeyframe: (shotId: string) =>
|
previewKeyframe: (shotId: string, input: Pick<GenerateKeyframeInput, 'provider' | 'generationOptions'>) =>
|
||||||
request<KeyframeGenerationPreview>(`${shotPath(shotId)}/keyframe/preview`, { method: 'POST', body: {} }),
|
request<KeyframeGenerationPreview>(`${shotPath(shotId)}/keyframe/preview`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: input
|
||||||
|
}),
|
||||||
generateKeyframe: (shotId: string, input: GenerateKeyframeInput) =>
|
generateKeyframe: (shotId: string, input: GenerateKeyframeInput) =>
|
||||||
request<ShotKeyframe | null>(`${shotPath(shotId)}/keyframe`, {
|
request<ShotKeyframe | null>(`${shotPath(shotId)}/keyframe`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -1,14 +1,37 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { NAlert, NButton, NCollapse, NCollapseItem } from 'naive-ui'
|
import { NAlert, NButton, NCheckbox, NCollapse, NCollapseItem, NInputNumber, NSelect } from 'naive-ui'
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import ConfirmAction from '../../workflows/ConfirmAction.vue'
|
import ConfirmAction from '../../workflows/ConfirmAction.vue'
|
||||||
import { downloadText, formatDate } from '../../../lib/format'
|
import { downloadText, formatDate } from '../../../lib/format'
|
||||||
import { useAdvancedProduction } from '../useAdvancedProduction'
|
import { useAdvancedProduction } from '../useAdvancedProduction'
|
||||||
import ProductionPlanPanel from './ProductionPlanPanel.vue'
|
import ProductionPlanPanel from './ProductionPlanPanel.vue'
|
||||||
|
import WorkflowExecutionPanel from '../../workflows/WorkflowExecutionPanel.vue'
|
||||||
|
|
||||||
/** 高级入口默认展示真实流程边界,但不会在挂载时触发预检或生成。 */
|
/** 高级入口默认展示真实流程边界,但不会在挂载时触发预检或生成。 */
|
||||||
const { id, operation, session, checking, error, check, blocked, preflight, start } = useAdvancedProduction()
|
const {
|
||||||
|
id,
|
||||||
|
operation,
|
||||||
|
session,
|
||||||
|
execution,
|
||||||
|
checking,
|
||||||
|
error,
|
||||||
|
check,
|
||||||
|
blocked,
|
||||||
|
safeMode,
|
||||||
|
testKeyframeLimit,
|
||||||
|
startFrom,
|
||||||
|
stopAfter,
|
||||||
|
stableIdentityAnchorLimit,
|
||||||
|
subjectImageLimit,
|
||||||
|
videoPromptLimit,
|
||||||
|
scope,
|
||||||
|
scopeError,
|
||||||
|
preflight,
|
||||||
|
start
|
||||||
|
} = useAdvancedProduction()
|
||||||
|
/** 本轮真实生产回执。 */
|
||||||
const receipt = computed(() => session.value.pipelineReceipt)
|
const receipt = computed(() => session.value.pipelineReceipt)
|
||||||
|
/** 高级工具折叠状态。 */
|
||||||
const expanded = ref<string[]>(['advanced'])
|
const expanded = ref<string[]>(['advanced'])
|
||||||
watch(
|
watch(
|
||||||
receipt,
|
receipt,
|
||||||
@@ -17,6 +40,7 @@ watch(
|
|||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
|
/** 实际批次结果展示行。 */
|
||||||
const rows = computed(() => [
|
const rows = computed(() => [
|
||||||
{ name: '形态正式提示词', result: receipt.value?.visualPromptResult },
|
{ name: '形态正式提示词', result: receipt.value?.visualPromptResult },
|
||||||
{ name: '形态参考图', result: receipt.value?.subjectImageResult },
|
{ name: '形态参考图', result: receipt.value?.subjectImageResult },
|
||||||
@@ -27,6 +51,21 @@ function exportReceipt() {
|
|||||||
if (receipt.value)
|
if (receipt.value)
|
||||||
downloadText(`project-${id.value}-pipeline.json`, JSON.stringify(receipt.value, null, 2), 'application/json')
|
downloadText(`project-${id.value}-pipeline.json`, JSON.stringify(receipt.value, null, 2), 'application/json')
|
||||||
}
|
}
|
||||||
|
/** 失败任务保留后端真实结果,独立于完成回执展示。 */
|
||||||
|
const failedResult = computed(() =>
|
||||||
|
execution.query.data.value?.status === 'failed' ? execution.query.data.value.result : null
|
||||||
|
)
|
||||||
|
/** 后端支持的断点阶段选项。 */
|
||||||
|
const stageOptions = [
|
||||||
|
{ label: '主体图片', value: 'subjectImages' },
|
||||||
|
{ label: '首帧质量', value: 'keyframes' },
|
||||||
|
{ label: '视频提示词', value: 'videoPrompts' }
|
||||||
|
]
|
||||||
|
/** 确认内容涵盖所有付费范围,变更后公共确认组件会废弃原勾选。 */
|
||||||
|
const confirmationDescription = computed(
|
||||||
|
() =>
|
||||||
|
`项目 ${id.value}:从 ${startFrom.value ?? '默认入口'} 执行至 ${scope.value.stopAfter ?? '视频任务提交'};稳定身份母版最多 ${stableIdentityAnchorLimit.value} 个、主体图片最多 ${subjectImageLimit.value} 张、首帧最多 ${testKeyframeLimit.value} 张、视频提示词最多 ${videoPromptLimit.value} 条。${scope.value.stopAfter ? '会产生图片、语言或视觉模型费用,不提交视频任务。' : '会产生较高视频模型费用。'} 项目模型和图片参数以本次预检为准。`
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<NCollapse v-model:expanded-names="expanded" class="production-tool-section"
|
<NCollapse v-model:expanded-names="expanded" class="production-tool-section"
|
||||||
@@ -35,20 +74,78 @@ function exportReceipt() {
|
|||||||
>依次补齐形态提示词、参考图、首帧质量校验与修复、视频提示词,再提交视频任务。视觉风格、身份母版、导演设计和即时状态仍需提前准备。</NAlert
|
>依次补齐形态提示词、参考图、首帧质量校验与修复、视频提示词,再提交视频任务。视觉风格、身份母版、导演设计和即时状态仍需提前准备。</NAlert
|
||||||
>
|
>
|
||||||
<p class="mt-3 text-xs leading-6 text-muted">
|
<p class="mt-3 text-xs leading-6 text-muted">
|
||||||
范围固定为全项目,跳过已有结果;不使用上方并发、覆盖、数量上限和尺寸配置。可能产生文字、图片、首帧校验与修复、视频模型费用。模型与并发由服务端配置决定。请确认其他页面没有任务;断网后先刷新制作状态,勿直接重试。
|
范围固定为全项目并跳过已有有效结果。默认开启测试安全模式:允许 LLM、Vision、主体图、少量首帧和 Video
|
||||||
|
Prompt,但会在视频生成前正常停止,不向视频 Provider 提交任务。
|
||||||
</p>
|
</p>
|
||||||
|
<!-- 以下是生产范围配置模块,修改任一参数后须重新预检。 -->
|
||||||
|
<div class="surface-inset mt-4 p-4">
|
||||||
|
<NCheckbox v-model:checked="safeMode">测试安全模式(不生成视频)</NCheckbox>
|
||||||
|
<!-- 以下是本轮断点与生成上限模块。 -->
|
||||||
|
<div class="advanced-production-fields">
|
||||||
|
<label
|
||||||
|
>起始阶段<NSelect
|
||||||
|
v-model:value="startFrom"
|
||||||
|
:options="stageOptions"
|
||||||
|
clearable
|
||||||
|
placeholder="默认入口"
|
||||||
|
/></label>
|
||||||
|
<label
|
||||||
|
>结束阶段<NSelect
|
||||||
|
v-model:value="stopAfter"
|
||||||
|
:options="stageOptions"
|
||||||
|
clearable
|
||||||
|
:placeholder="safeMode ? '视频提示词(安全模式)' : '完整流程(提交视频)'"
|
||||||
|
/></label>
|
||||||
|
<label
|
||||||
|
>稳定身份母版上限<NInputNumber
|
||||||
|
v-model:value="stableIdentityAnchorLimit"
|
||||||
|
:min="1"
|
||||||
|
:step="1"
|
||||||
|
:precision="0"
|
||||||
|
/></label>
|
||||||
|
<label
|
||||||
|
>主体图片上限<NInputNumber v-model:value="subjectImageLimit" :min="1" :step="1" :precision="0"
|
||||||
|
/></label>
|
||||||
|
<label
|
||||||
|
>首帧上限<NInputNumber v-model:value="testKeyframeLimit" :min="1" :step="1" :precision="0"
|
||||||
|
/></label>
|
||||||
|
<label
|
||||||
|
>视频提示词上限<NInputNumber v-model:value="videoPromptLimit" :min="1" :step="1" :precision="0"
|
||||||
|
/></label>
|
||||||
|
</div>
|
||||||
|
<NAlert v-if="scopeError" type="error" :show-icon="false" class="mt-3">{{ scopeError }}</NAlert>
|
||||||
|
<NAlert v-if="!safeMode && !stopAfter" type="warning" :show-icon="false" class="mt-3">
|
||||||
|
已关闭测试安全模式。启动后会进入视频任务提交阶段并产生较高视频生成费用。
|
||||||
|
</NAlert>
|
||||||
|
</div>
|
||||||
|
<!-- 以下是无消耗预检与费用确认模块。 -->
|
||||||
<div class="mt-4 flex flex-wrap items-center gap-3">
|
<div class="mt-4 flex flex-wrap items-center gap-3">
|
||||||
<NButton :disabled="blocked || checking" :loading="checking" @click="preflight"
|
<NButton :disabled="blocked || checking || !!scopeError" :loading="checking" @click="preflight"
|
||||||
>检查串联生产条件</NButton
|
>检查串联生产条件</NButton
|
||||||
>
|
>
|
||||||
<ConfirmAction
|
<ConfirmAction
|
||||||
label="启动串联生产"
|
label="启动串联生产"
|
||||||
:disabled="blocked || checking || !check || !!check.issues.length"
|
:disabled="blocked || checking || !!scopeError || !check || !!check.issues.length"
|
||||||
acknowledgement
|
acknowledgement
|
||||||
:description="`项目 ${id}:全项目串联生产,包含首帧生成、校验与有限修复,不等待异步视频完成。确认后会重新读取计划;有阻塞时先处理可执行部分,成功资产会保留。可能产生文字、图片、校验和视频模型费用。`"
|
:description="confirmationDescription"
|
||||||
@confirm="start"
|
@confirm="start"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 以下是后台任务与真实结果模块。 -->
|
||||||
|
<WorkflowExecutionPanel
|
||||||
|
v-if="execution.executionId.value"
|
||||||
|
title="串联生产后台任务"
|
||||||
|
:execution="execution.query.data.value"
|
||||||
|
:loading="execution.query.loading.value"
|
||||||
|
:error="execution.query.error.value"
|
||||||
|
@refresh="execution.query.refresh"
|
||||||
|
@dismiss="execution.dismiss"
|
||||||
|
/>
|
||||||
|
<!-- 以下是失败任务真实结果详情模块。 -->
|
||||||
|
<details v-if="failedResult" class="mt-3 text-xs">
|
||||||
|
<summary>失败任务结果详情</summary>
|
||||||
|
<pre class="mt-2 whitespace-pre-wrap break-all">{{ JSON.stringify(failedResult, null, 2) }}</pre>
|
||||||
|
</details>
|
||||||
<NAlert v-if="error" type="error" class="mt-3" :show-icon="false">{{ error }}</NAlert>
|
<NAlert v-if="error" type="error" class="mt-3" :show-icon="false">{{ error }}</NAlert>
|
||||||
<NAlert
|
<NAlert
|
||||||
v-if="operation.label === '高级串联生产' && operation.error"
|
v-if="operation.label === '高级串联生产' && operation.error"
|
||||||
@@ -68,7 +165,7 @@ function exportReceipt() {
|
|||||||
<p v-if="operation.pending && operation.label === '高级串联生产'" role="status" class="mt-3 text-sm">
|
<p v-if="operation.pending && operation.label === '高级串联生产'" role="status" class="mt-3 text-sm">
|
||||||
请求进行中,请勿重复提交。
|
请求进行中,请勿重复提交。
|
||||||
</p>
|
</p>
|
||||||
<section v-if="receipt" aria-label="串联生产回执" class="surface-inset mt-4 p-4">
|
<section v-if="receipt" aria-label="串联生产回执" class="surface-inset workspace-panel">
|
||||||
<div class="flex items-center justify-between gap-3">
|
<div class="flex items-center justify-between gap-3">
|
||||||
<h3 class="text-sm font-semibold">
|
<h3 class="text-sm font-semibold">
|
||||||
串联生产回执 ·
|
串联生产回执 ·
|
||||||
@@ -79,11 +176,18 @@ function exportReceipt() {
|
|||||||
? '制作已完成'
|
? '制作已完成'
|
||||||
: receipt.dispatchCompleted
|
: receipt.dispatchCompleted
|
||||||
? '任务已分发,等待视频完成'
|
? '任务已分发,等待视频完成'
|
||||||
: '本轮未完成'
|
: receipt.stopReason
|
||||||
|
? '测试执行已正常停止'
|
||||||
|
: '本轮未完成'
|
||||||
}}
|
}}
|
||||||
</h3>
|
</h3>
|
||||||
<NButton text size="small" @click="exportReceipt">导出回执</NButton>
|
<NButton text size="small" @click="exportReceipt">导出回执</NButton>
|
||||||
</div>
|
</div>
|
||||||
|
<p v-if="receipt.stableIdentityAnchorResult" class="mt-2 text-xs">
|
||||||
|
稳定身份母版:共 {{ receipt.stableIdentityAnchorResult.total }} · 生成
|
||||||
|
{{ receipt.stableIdentityAnchorResult.generated }} · 失败
|
||||||
|
{{ receipt.stableIdentityAnchorResult.failed }}
|
||||||
|
</p>
|
||||||
<p class="mt-3 text-xs text-muted">
|
<p class="mt-3 text-xs text-muted">
|
||||||
流程返回不等于成片完成。已保存结果不会回滚,最终结果以各资产页为准。
|
流程返回不等于成片完成。已保存结果不会回滚,最终结果以各资产页为准。
|
||||||
</p>
|
</p>
|
||||||
@@ -124,3 +228,16 @@ function exportReceipt() {
|
|||||||
</NCollapseItem></NCollapse
|
</NCollapseItem></NCollapse
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
@reference "../../../styles/styles.css";
|
||||||
|
|
||||||
|
/* 串联生产表单统一标签间距与行列间距,窄屏改为单列。 */
|
||||||
|
.advanced-production-fields {
|
||||||
|
@apply mt-4 grid grid-cols-1 gap-x-5 gap-y-4 text-xs sm:grid-cols-2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.advanced-production-fields > label {
|
||||||
|
@apply flex min-w-0 flex-col gap-2;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import IssueHint from '../../../components/ui/IssueHint.vue'
|
||||||
|
import { productionMessage } from '../production-messages'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { BadgeCheck } from '@lucide/vue'
|
||||||
|
import { NAlert, NButton, NTag } from 'naive-ui'
|
||||||
|
import { AssetImage, StatusBadge } from '../../../components/ui'
|
||||||
|
import { formatDate } from '../../../lib/format'
|
||||||
|
import { productionStatusLabel } from '../model'
|
||||||
|
import type { ShotKeyframe } from '../types'
|
||||||
|
|
||||||
|
/** 首帧卡片统一主图标识、质量结论和晋升限制。 */
|
||||||
|
const props = defineProps<{
|
||||||
|
item: ShotKeyframe
|
||||||
|
shotNo: number
|
||||||
|
stale: boolean
|
||||||
|
blocked: boolean
|
||||||
|
validationPassed: boolean | null
|
||||||
|
confirming: boolean
|
||||||
|
}>()
|
||||||
|
const emit = defineEmits<{ quality: []; select: []; confirm: []; cancel: [] }>()
|
||||||
|
const canSelect = computed(
|
||||||
|
() =>
|
||||||
|
props.item.status === 'completed' &&
|
||||||
|
!!props.item.imageUrl &&
|
||||||
|
props.item.source !== 'provider_variant' &&
|
||||||
|
!props.item.isPrimary &&
|
||||||
|
props.validationPassed === true
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<article class="keyframe-card">
|
||||||
|
<div class="keyframe-image">
|
||||||
|
<AssetImage
|
||||||
|
:src="item.status === 'completed' ? item.imageUrl : null"
|
||||||
|
:alt="`镜头 ${shotNo} 首帧`"
|
||||||
|
preview
|
||||||
|
:empty-text="item.status === 'failed' ? '首帧生成失败' : '首帧生成中'"
|
||||||
|
/>
|
||||||
|
<span v-if="item.isPrimary" class="primary-keyframe-mark" aria-label="当前主首帧" title="当前主首帧">
|
||||||
|
<BadgeCheck :size="15" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="p-3">
|
||||||
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
|
<StatusBadge :status="item.status" :label="productionStatusLabel(item.status)" />
|
||||||
|
<NTag v-if="validationPassed === true" size="small" type="success" :bordered="false">质量通过</NTag>
|
||||||
|
<NTag v-else-if="validationPassed === false" size="small" type="error" :bordered="false"
|
||||||
|
>质量未通过</NTag
|
||||||
|
>
|
||||||
|
<NTag v-if="item.source === 'provider_variant'" size="small" :bordered="false">视频参考图</NTag>
|
||||||
|
<NTag v-if="item.isPrimary && stale" size="small" :bordered="false">已过期</NTag>
|
||||||
|
<span class="text-[10px] text-muted">{{ item.width || '—' }} × {{ item.height || '—' }}</span>
|
||||||
|
</div>
|
||||||
|
<IssueHint v-if="item.error" :messages="[productionMessage(item.error)]" type="error" />
|
||||||
|
<p class="mt-2 text-[10px] text-muted">{{ formatDate(item.createdAt) }}</p>
|
||||||
|
<div v-if="item.status === 'completed' && item.imageUrl" class="mt-2 flex flex-wrap items-center gap-3">
|
||||||
|
<NButton text size="small" @click="emit('quality')">
|
||||||
|
{{ validationPassed === null ? '质量检查' : '重新检查' }}
|
||||||
|
</NButton>
|
||||||
|
<NButton v-if="canSelect" :disabled="blocked" text size="small" @click="emit('select')">
|
||||||
|
设为主首帧
|
||||||
|
</NButton>
|
||||||
|
</div>
|
||||||
|
<NAlert v-if="confirming" type="info" :show-icon="false" class="mt-2 text-xs">
|
||||||
|
<p>该候选已通过本次质量检查。确认让后续视频使用此首帧?</p>
|
||||||
|
<div class="mt-2 flex gap-3">
|
||||||
|
<NButton type="primary" @click="emit('confirm')">确认切换</NButton>
|
||||||
|
<NButton text size="small" @click="emit('cancel')">取消</NButton>
|
||||||
|
</div>
|
||||||
|
</NAlert>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
@@ -1,60 +1,76 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import AppForm from '../../../components/ui/AppForm.vue'
|
import AppForm from '../../../components/ui/AppForm.vue'
|
||||||
import { NFormItem } from 'naive-ui'
|
import { NAlert, NButton, NCheckbox, NCollapse, NCollapseItem, NTag } from 'naive-ui'
|
||||||
import { sizeRules } from '../../../lib/form-rules'
|
|
||||||
import { NAlert, NButton, NCheckbox, NCollapse, NCollapseItem, NInputNumber, NTag } from 'naive-ui'
|
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { AppDialog } from '../../../components/ui'
|
import { generationConfigApi } from '../../generation-config/api'
|
||||||
|
import type {
|
||||||
|
CreativeProfileAspectRatio,
|
||||||
|
GenerationModelCatalog,
|
||||||
|
GenerationOptions
|
||||||
|
} from '../../generation-config/types'
|
||||||
|
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||||||
|
import { AppDialog, FieldLabel } from '../../../components/ui'
|
||||||
import { errorMessage } from '../../../lib/http'
|
import { errorMessage } from '../../../lib/http'
|
||||||
import { productionApi } from '../api'
|
import { productionApi } from '../api'
|
||||||
import { validOptionalSize } from '../model'
|
import type { GenerateKeyframeInput, KeyframeGenerationPreview } from '../types'
|
||||||
import type { GenerateKeyframeInput, KeyframeGenerationPreview, ShotKeyframe } from '../types'
|
|
||||||
|
|
||||||
/** 单镜头首帧表单;普通候选仍由用户明确选择,过期主首帧默认替换为新图。 */
|
/** 单镜头首帧表单;所有新图先生成候选,通过质量检查后再人工晋升。 */
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
shotId: string
|
shotId: string
|
||||||
shotTitle: string
|
shotTitle: string
|
||||||
keyframes: ShotKeyframe[]
|
projectId: string
|
||||||
disabled: boolean
|
disabled: boolean
|
||||||
replacePrimary?: boolean
|
replacePrimary?: boolean
|
||||||
}>()
|
}>()
|
||||||
const open = defineModel<boolean>('open', { default: false })
|
const open = defineModel<boolean>('open', { default: false })
|
||||||
const emit = defineEmits<{ generate: [input: GenerateKeyframeInput] }>()
|
const emit = defineEmits<{ generate: [input: GenerateKeyframeInput] }>()
|
||||||
const width = ref<number | ''>('')
|
const formRef = ref<InstanceType<typeof AppForm> | null>(null)
|
||||||
const height = ref<number | ''>('')
|
|
||||||
const setPrimary = ref(false)
|
|
||||||
const confirmed = ref(false)
|
const confirmed = ref(false)
|
||||||
const preview = ref<KeyframeGenerationPreview | null>(null)
|
const preview = ref<KeyframeGenerationPreview | null>(null)
|
||||||
const previewError = ref('')
|
const previewError = ref('')
|
||||||
const previewPending = ref(false)
|
const previewPending = ref(false)
|
||||||
const hasPrimary = computed(() => props.keyframes.some(item => item.isPrimary && item.status === 'completed'))
|
const generationCatalog = ref<GenerationModelCatalog | null>(null)
|
||||||
const sizeValid = computed(() => validOptionalSize(width.value, height.value))
|
const generationCatalogError = ref('')
|
||||||
const canSubmit = computed(() => !props.disabled && sizeValid.value && confirmed.value)
|
const imageProvider = ref('')
|
||||||
|
const imageGenerationOptions = ref<GenerationOptions>({})
|
||||||
|
const projectAspectRatio = ref<CreativeProfileAspectRatio>('9:16')
|
||||||
|
const canSubmit = computed(() => !props.disabled && confirmed.value)
|
||||||
|
|
||||||
/** 切换镜头或重新打开时清空费用确认;过期首帧默认让新结果成为 Primary。 */
|
/** 切换镜头或重新打开时清空费用确认;新图一律先作为候选。 */
|
||||||
function reset() {
|
async function reset() {
|
||||||
width.value = ''
|
|
||||||
height.value = ''
|
|
||||||
setPrimary.value = !!props.replacePrimary || !hasPrimary.value
|
|
||||||
confirmed.value = false
|
confirmed.value = false
|
||||||
preview.value = null
|
preview.value = null
|
||||||
previewError.value = ''
|
previewError.value = ''
|
||||||
previewPending.value = false
|
previewPending.value = false
|
||||||
|
generationCatalogError.value = ''
|
||||||
|
if (!open.value) return
|
||||||
|
try {
|
||||||
|
const [catalog, profile] = await Promise.all([
|
||||||
|
generationConfigApi.catalog(),
|
||||||
|
generationConfigApi.profile(props.projectId)
|
||||||
|
])
|
||||||
|
generationCatalog.value = catalog
|
||||||
|
projectAspectRatio.value = profile?.aspectRatio ?? '9:16'
|
||||||
|
imageProvider.value = profile?.imageProvider || catalog.defaults.imageProvider
|
||||||
|
const selected = catalog.images.find(item => item.provider === imageProvider.value)
|
||||||
|
imageGenerationOptions.value = { ...selected?.defaults, ...profile?.imageOptions }
|
||||||
|
} catch (cause) {
|
||||||
|
generationCatalogError.value = errorMessage(cause)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
watch([() => props.shotId, open], reset, { immediate: true })
|
watch([() => props.shotId, open], reset, { immediate: true })
|
||||||
|
|
||||||
/** 只发送后端允许的字段,未填写尺寸时使用 Provider 默认值。 */
|
/** 发送当前模型与动态生成参数;图片尺寸统一由 generationOptions.size 管理。 */
|
||||||
function submit() {
|
function submit() {
|
||||||
if (!canSubmit.value) return
|
if (!canSubmit.value) return
|
||||||
emit('generate', {
|
emit('generate', {
|
||||||
...(width.value === '' ? {} : { width: width.value, height: height.value as number }),
|
provider: imageProvider.value || undefined,
|
||||||
setPrimary: setPrimary.value
|
generationOptions: imageGenerationOptions.value,
|
||||||
|
setPrimary: false
|
||||||
})
|
})
|
||||||
open.value = false
|
open.value = false
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
const formModel = computed(() => ({ width: width.value, height: height.value }))
|
|
||||||
const rules = sizeRules(() => formModel.value)
|
|
||||||
|
|
||||||
/** 读取后端最终参考图选择与 Prompt,不创建首帧候选。 */
|
/** 读取后端最终参考图选择与 Prompt,不创建首帧候选。 */
|
||||||
async function loadPreview() {
|
async function loadPreview() {
|
||||||
@@ -62,7 +78,10 @@ async function loadPreview() {
|
|||||||
previewPending.value = true
|
previewPending.value = true
|
||||||
previewError.value = ''
|
previewError.value = ''
|
||||||
try {
|
try {
|
||||||
const result = await productionApi.previewKeyframe(props.shotId)
|
const result = await productionApi.previewKeyframe(props.shotId, {
|
||||||
|
provider: imageProvider.value || undefined,
|
||||||
|
generationOptions: imageGenerationOptions.value
|
||||||
|
})
|
||||||
if (!result || result.shotId !== props.shotId) throw new Error('预览结果与当前镜头不匹配。')
|
if (!result || result.shotId !== props.shotId) throw new Error('预览结果与当前镜头不匹配。')
|
||||||
preview.value = result
|
preview.value = result
|
||||||
} catch (cause) {
|
} catch (cause) {
|
||||||
@@ -77,12 +96,12 @@ async function loadPreview() {
|
|||||||
<template>
|
<template>
|
||||||
<AppDialog
|
<AppDialog
|
||||||
v-model:open="open"
|
v-model:open="open"
|
||||||
:title="`${replacePrimary ? '重新生成主首帧' : '生成首帧'} · ${shotTitle}`"
|
:title="`${replacePrimary ? '生成替代候选' : '生成首帧候选'} · ${shotTitle}`"
|
||||||
description="依据视觉风格、GenerationSpec 和主体主参考图编译首帧提示词,并调用 图片模型。"
|
description="新图先作为候选;完成质量检查并通过后,才能设为主首帧。"
|
||||||
>
|
>
|
||||||
<AppForm
|
<AppForm
|
||||||
:model="formModel"
|
ref="formRef"
|
||||||
:rules="rules"
|
:model="imageGenerationOptions"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:reset-key="`${open}:${shotId}`"
|
:reset-key="`${open}:${shotId}`"
|
||||||
validate-on-change
|
validate-on-change
|
||||||
@@ -91,6 +110,28 @@ async function loadPreview() {
|
|||||||
<NAlert v-if="replacePrimary" type="info" :show-icon="false" class="mt-5 text-xs">
|
<NAlert v-if="replacePrimary" type="info" :show-icon="false" class="mt-5 text-xs">
|
||||||
当前主首帧使用的主体参考资产已经变化。新图成功后应设为主首帧,旧图会继续保留为历史候选。
|
当前主首帧使用的主体参考资产已经变化。新图成功后应设为主首帧,旧图会继续保留为历史候选。
|
||||||
</NAlert>
|
</NAlert>
|
||||||
|
<section v-if="generationCatalog" class="dialog-section mt-5" aria-label="本次首帧生成模型设置">
|
||||||
|
<p class="text-xs font-medium">
|
||||||
|
<FieldLabel
|
||||||
|
label="本次生成设置"
|
||||||
|
description="仅覆盖当前镜头本次首帧生成,不修改项目默认图片模型。"
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
<GenerationModelControls
|
||||||
|
class="mt-4"
|
||||||
|
type="image"
|
||||||
|
:catalog="generationCatalog"
|
||||||
|
:provider="imageProvider"
|
||||||
|
:options="imageGenerationOptions"
|
||||||
|
:aspect-ratio="projectAspectRatio"
|
||||||
|
:disabled="disabled"
|
||||||
|
@update:provider="imageProvider = $event"
|
||||||
|
@update:options="imageGenerationOptions = $event"
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
<NAlert v-else-if="generationCatalogError" type="warning" :show-icon="false" class="mt-5 text-xs">
|
||||||
|
生成模型目录读取失败:{{ generationCatalogError }}
|
||||||
|
</NAlert>
|
||||||
<div class="mt-5 flex flex-wrap items-center gap-3">
|
<div class="mt-5 flex flex-wrap items-center gap-3">
|
||||||
<NButton :loading="previewPending" @click="loadPreview">预览实际生成输入</NButton>
|
<NButton :loading="previewPending" @click="loadPreview">预览实际生成输入</NButton>
|
||||||
<span class="text-xs text-muted">只读取参考图规划与最终 Prompt,不调用图片模型。</span>
|
<span class="text-xs text-muted">只读取参考图规划与最终 Prompt,不调用图片模型。</span>
|
||||||
@@ -134,40 +175,18 @@ async function loadPreview() {
|
|||||||
</NCollapseItem>
|
</NCollapseItem>
|
||||||
</NCollapse>
|
</NCollapse>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-5 grid grid-cols-2 gap-4">
|
|
||||||
<NFormItem path="width" label="宽度(可选)"
|
|
||||||
><NInputNumber
|
|
||||||
:input-props="{ 'aria-label': '宽度(可选)' }"
|
|
||||||
:value="typeof width === 'number' ? width : null"
|
|
||||||
@update:value="width = $event ?? ''"
|
|
||||||
:min="1"
|
|
||||||
></NInputNumber
|
|
||||||
></NFormItem>
|
|
||||||
<NFormItem path="height" label="高度(可选)"
|
|
||||||
><NInputNumber
|
|
||||||
:input-props="{ 'aria-label': '高度(可选)' }"
|
|
||||||
:value="typeof height === 'number' ? height : null"
|
|
||||||
@update:value="height = $event ?? ''"
|
|
||||||
:min="1"
|
|
||||||
></NInputNumber
|
|
||||||
></NFormItem>
|
|
||||||
</div>
|
|
||||||
<NCheckbox v-model:checked="setPrimary" class="mt-5 flex items-start gap-3 text-sm leading-6"
|
|
||||||
>生成成功后设为当前主首帧
|
|
||||||
</NCheckbox>
|
|
||||||
<NAlert v-if="hasPrimary && setPrimary" type="info" :show-icon="false" class="mt-3 text-xs">
|
|
||||||
当前已有主首帧。新图成功后将成为视频生成使用的首帧,旧图仍保留为候选。
|
|
||||||
</NAlert>
|
|
||||||
<NCheckbox
|
<NCheckbox
|
||||||
id="confirm-keyframe-cost"
|
id="confirm-keyframe-cost"
|
||||||
v-model:checked="confirmed"
|
v-model:checked="confirmed"
|
||||||
class="mt-5 flex items-start gap-3 text-sm leading-6"
|
class="mt-5 flex items-start gap-3 text-sm leading-6"
|
||||||
>我已确认调用图片模型可能产生费用,且当前没有相同镜头的生图任务。
|
>我已确认调用图片模型可能产生费用,且当前没有相同镜头的生图任务。
|
||||||
</NCheckbox>
|
</NCheckbox>
|
||||||
<div class="dialog-footer mt-6">
|
|
||||||
<NButton @click="open = false">取消</NButton>
|
|
||||||
<NButton :disabled="disabled || !confirmed" attr-type="submit" type="primary">确认生成首帧</NButton>
|
|
||||||
</div>
|
|
||||||
</AppForm>
|
</AppForm>
|
||||||
|
<template #footer>
|
||||||
|
<NButton @click="open = false">取消</NButton>
|
||||||
|
<NButton :disabled="disabled || !confirmed" @click="formRef?.validate(submit)" type="primary"
|
||||||
|
>确认生成首帧</NButton
|
||||||
|
>
|
||||||
|
</template>
|
||||||
</AppDialog>
|
</AppDialog>
|
||||||
</template>
|
</template>
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from 'vue'
|
||||||
|
import ReadonlyInspection from '../../../components/ui/ReadonlyInspection.vue'
|
||||||
|
import { useQuery } from '../../../composables/useQuery'
|
||||||
|
import { formatDate } from '../../../lib/format'
|
||||||
|
import { qualityApi } from '../quality-api'
|
||||||
|
import { parseKeyframeValidationOutput } from '../quality'
|
||||||
|
|
||||||
|
/** 历史仅按正式首帧目标读取,不写入手动晋升会话。 */
|
||||||
|
const props = defineProps<{
|
||||||
|
/** 项目范围用于隔离切换 */
|
||||||
|
projectId?: string
|
||||||
|
/** 所属镜头 */
|
||||||
|
shotId: string
|
||||||
|
/** 当前首帧 */
|
||||||
|
keyframeId: string
|
||||||
|
}>()
|
||||||
|
/** 默认折叠,仅展开后查询。 */
|
||||||
|
const open = ref(false)
|
||||||
|
/** 查询键包含全部归属信息,旧请求会被取消。 */
|
||||||
|
const key = computed(() =>
|
||||||
|
open.value && props.shotId && props.keyframeId
|
||||||
|
? JSON.stringify([props.projectId, props.shotId, props.keyframeId])
|
||||||
|
: ''
|
||||||
|
)
|
||||||
|
/** 后端历史查询支持取消,空目标不请求。 */
|
||||||
|
const query = useQuery(key, (value, signal) => {
|
||||||
|
if (!value) return Promise.resolve([])
|
||||||
|
const [, shotId, keyframeId] = JSON.parse(value) as [string | undefined, string, string]
|
||||||
|
return qualityApi.keyframeHistory(shotId, keyframeId, signal)
|
||||||
|
})
|
||||||
|
/** 仅真实结构化结论可以显示通过,调用完成不等于视觉通过。 */
|
||||||
|
const records = computed(() =>
|
||||||
|
(query.data.value ?? []).map(item => ({ ...item, validation: parseKeyframeValidationOutput(item.output) }))
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- 以下是首帧已有校验记录的只读查询模块 -->
|
||||||
|
<ReadonlyInspection
|
||||||
|
v-model:open="open"
|
||||||
|
title="首帧校验历史"
|
||||||
|
description="查看记录不收费;设置主首帧前仍需完成本次检查。"
|
||||||
|
:loading="query.loading.value"
|
||||||
|
:error="query.error.value"
|
||||||
|
@refresh="query.refresh"
|
||||||
|
>
|
||||||
|
<p v-if="!records.length" class="text-muted">暂无校验记录。</p>
|
||||||
|
<!-- 以下是实际校验结论、问题与调用错误模块 -->
|
||||||
|
<article v-for="record in records" :key="record.id" class="panel mt-3 p-3">
|
||||||
|
<p>
|
||||||
|
{{ formatDate(record.finishedAt || record.startedAt || record.createdAt) }} · {{ record.status }} ·
|
||||||
|
{{
|
||||||
|
record.status === 'completed' && record.validation
|
||||||
|
? record.validation.passed
|
||||||
|
? '视觉通过'
|
||||||
|
: '视觉未通过'
|
||||||
|
: '未取得完整视觉结论'
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
<p v-if="record.error" class="text-danger">{{ record.error }}</p>
|
||||||
|
<template v-if="record.validation">
|
||||||
|
<p>{{ record.validation.summary }}</p>
|
||||||
|
<p v-for="(issue, index) in record.validation.issues" :key="index" class="text-danger">
|
||||||
|
{{ issue.description }}
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
<details class="mt-2">
|
||||||
|
<summary class="cursor-pointer text-muted">原始记录</summary>
|
||||||
|
<pre class="whitespace-pre-wrap wrap-anywhere">{{ JSON.stringify(record.output, null, 2) }}</pre>
|
||||||
|
</details>
|
||||||
|
</article>
|
||||||
|
</ReadonlyInspection>
|
||||||
|
</template>
|
||||||
@@ -5,8 +5,13 @@ import { qualityApi } from '../quality-api'
|
|||||||
import type { ImageProviderCapability, ShotProviderCapability } from '../quality.types'
|
import type { ImageProviderCapability, ShotProviderCapability } from '../quality.types'
|
||||||
import { errorMessage } from '../../../lib/http'
|
import { errorMessage } from '../../../lib/http'
|
||||||
|
|
||||||
/** 模型由后端配置;此入口只读公开能力,不提供无效的前端模型切换。 */
|
/** 只读查询指定镜头及本次选择模型的公开能力。 */
|
||||||
const props = defineProps<{ shotId?: string }>()
|
const props = defineProps<{
|
||||||
|
/** 当前正式镜头 ID。 */
|
||||||
|
shotId?: string
|
||||||
|
/** 本次选择的图片模型,未提供时读取后端默认。 */
|
||||||
|
provider?: string
|
||||||
|
}>()
|
||||||
const providers = ref<ImageProviderCapability[] | null>(null)
|
const providers = ref<ImageProviderCapability[] | null>(null)
|
||||||
const capability = ref<ShotProviderCapability | null>(null)
|
const capability = ref<ShotProviderCapability | null>(null)
|
||||||
const error = ref('')
|
const error = ref('')
|
||||||
@@ -15,27 +20,26 @@ let revision = 0
|
|||||||
onScopeDispose(() => {
|
onScopeDispose(() => {
|
||||||
revision++
|
revision++
|
||||||
})
|
})
|
||||||
watch(
|
/** 切换镜头或本次模型后清除旧能力记录,迟到响应不能覆盖新目标。 */
|
||||||
() => props.shotId,
|
watch([() => props.shotId, () => props.provider], () => {
|
||||||
() => {
|
revision++
|
||||||
revision++
|
providers.value = null
|
||||||
providers.value = null
|
capability.value = null
|
||||||
capability.value = null
|
error.value = ''
|
||||||
error.value = ''
|
loading.value = false
|
||||||
loading.value = false
|
})
|
||||||
}
|
/** 按需检查当前模型,不自动生成图片;空上限表示未声明,不冒充无限制。 */
|
||||||
)
|
|
||||||
/** 按需检查,不自动生成图片;空上限表示未声明,不冒充无限制。 */
|
|
||||||
async function inspect() {
|
async function inspect() {
|
||||||
if (loading.value) return
|
if (loading.value) return
|
||||||
const version = ++revision
|
const version = ++revision
|
||||||
const shotId = props.shotId
|
const shotId = props.shotId
|
||||||
|
const provider = props.provider
|
||||||
loading.value = true
|
loading.value = true
|
||||||
error.value = ''
|
error.value = ''
|
||||||
try {
|
try {
|
||||||
const list = await qualityApi.providers()
|
const list = await qualityApi.providers()
|
||||||
if (version !== revision) return
|
if (version !== revision) return
|
||||||
const result = shotId ? await qualityApi.capability(shotId) : null
|
const result = shotId ? await qualityApi.capability(shotId, undefined, provider) : null
|
||||||
if (version !== revision) return
|
if (version !== revision) return
|
||||||
if (!Array.isArray(list) || list.some(item => !item.capabilities?.references))
|
if (!Array.isArray(list) || list.some(item => !item.capabilities?.references))
|
||||||
throw new Error('模型能力接口返回不完整。')
|
throw new Error('模型能力接口返回不完整。')
|
||||||
@@ -50,7 +54,7 @@ async function inspect() {
|
|||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<section class="mt-4 text-xs">
|
<section class="mt-4 text-xs">
|
||||||
<NButton size="small" :loading="loading" :disabled="loading" @click="inspect">查看后端模型能力</NButton>
|
<NButton size="small" :loading="loading" :disabled="loading" @click="inspect">查看模型限制</NButton>
|
||||||
<NAlert v-if="error" type="error" :show-icon="false" class="mt-3">{{ error }}</NAlert>
|
<NAlert v-if="error" type="error" :show-icon="false" class="mt-3">{{ error }}</NAlert>
|
||||||
<template v-if="providers">
|
<template v-if="providers">
|
||||||
<p v-if="!providers.some(item => item.active)" class="mt-2 text-danger">
|
<p v-if="!providers.some(item => item.active)" class="mt-2 text-danger">
|
||||||
@@ -69,8 +73,13 @@ async function inspect() {
|
|||||||
</template>
|
</template>
|
||||||
<NAlert v-if="capability" :type="capability.valid ? 'info' : 'error'" :show-icon="false" class="mt-3">{{
|
<NAlert v-if="capability" :type="capability.valid ? 'info' : 'error'" :show-icon="false" class="mt-3">{{
|
||||||
capability.valid
|
capability.valid
|
||||||
? `当前镜头需要 ${capability.referenceCount} 张参考图,符合 ${capability.provider} 的已声明能力。`
|
? capability.message ||
|
||||||
|
`当前镜头共有 ${capability.referenceCount} 张业务参考图,后端已判定本次规划符合 ${capability.provider} 能力。`
|
||||||
: capability.message || '当前镜头不满足模型能力限制。'
|
: capability.message || '当前镜头不满足模型能力限制。'
|
||||||
}}</NAlert>
|
}}</NAlert>
|
||||||
|
<p v-if="capability?.valid && capability.plannedReferenceCount !== undefined" class="mt-2 text-muted">
|
||||||
|
本次计划输入 {{ capability.plannedReferenceCount }} 张 · 转为文字约束
|
||||||
|
{{ capability.omittedReferenceCount ?? 0 }} 张
|
||||||
|
</p>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
@@ -3,9 +3,11 @@ import { computed } from 'vue'
|
|||||||
import { NAlert, NCollapse, NCollapseItem, NScrollbar } from 'naive-ui'
|
import { NAlert, NCollapse, NCollapseItem, NScrollbar } from 'naive-ui'
|
||||||
import type { ProductionPlan, ProjectProductionStatus } from '../types'
|
import type { ProductionPlan, ProjectProductionStatus } from '../types'
|
||||||
|
|
||||||
/** 展示后端只读执行计划与真实资产状态,不自行推断阻塞是否可自动解除。 */
|
/** 展示当前制作计划与真实资产状态,不在页面重复推断业务规则。 */
|
||||||
const props = defineProps<{ plan: ProductionPlan; status: ProjectProductionStatus }>()
|
const props = defineProps<{ plan: ProductionPlan; status: ProjectProductionStatus }>()
|
||||||
|
/** 生产阶段共享计划字段,角色身份就绪信息单独展示,避免混用不同 DTO。 */
|
||||||
const rows = computed(() => [
|
const rows = computed(() => [
|
||||||
|
...(props.plan.stableIdentityAnchors ? [{ label: '稳定身份锚点', stage: props.plan.stableIdentityAnchors }] : []),
|
||||||
{ label: '主体参考图', stage: props.plan.subjectImages },
|
{ label: '主体参考图', stage: props.plan.subjectImages },
|
||||||
{ label: '首帧质量', stage: props.plan.keyframes },
|
{ label: '首帧质量', stage: props.plan.keyframes },
|
||||||
{ label: '视频提示词', stage: props.plan.videoPrompts },
|
{ label: '视频提示词', stage: props.plan.videoPrompts },
|
||||||
@@ -40,6 +42,18 @@ const problems = computed(() => [
|
|||||||
<template>
|
<template>
|
||||||
<section class="surface-inset mt-3 p-4" aria-label="制作执行计划">
|
<section class="surface-inset mt-3 p-4" aria-label="制作执行计划">
|
||||||
<h3 class="text-sm font-semibold">执行计划 · 仅检查,不产生生成费用</h3>
|
<h3 class="text-sm font-semibold">执行计划 · 仅检查,不产生生成费用</h3>
|
||||||
|
<div class="mt-3 flex flex-wrap gap-2 text-xs" role="status">
|
||||||
|
<span class="status-chip">入口:{{ plan.canStart ? '可启动' : '未就绪' }}</span>
|
||||||
|
<span class="status-chip">自动执行:{{ plan.canAutoRun ? '可继续' : '需处理阻塞' }}</span>
|
||||||
|
<span class="status-chip">图片模型:{{ plan.providers.image }}</span>
|
||||||
|
<span class="status-chip">视频模型:{{ plan.providers.video }}</span>
|
||||||
|
</div>
|
||||||
|
<!-- 以下是角色身份实际就绪统计模块 -->
|
||||||
|
<p v-if="plan.characterIdentity" class="mt-2 text-xs">
|
||||||
|
角色身份:已就绪 {{ plan.characterIdentity.ready }} / {{ plan.characterIdentity.total }} · 待就绪
|
||||||
|
{{ plan.characterIdentity.pending }} · 可自动补齐 {{ plan.characterIdentity.autoResolvable }} · 需人工处理
|
||||||
|
{{ plan.characterIdentity.manualBlocked }}
|
||||||
|
</p>
|
||||||
<p class="mt-2 text-xs" role="status">
|
<p class="mt-2 text-xs" role="status">
|
||||||
当前制作状态:{{ status.completed ? '制作已完成' : `待完成${stageNames[status.stage]}` }} · 有效主体图
|
当前制作状态:{{ status.completed ? '制作已完成' : `待完成${stageNames[status.stage]}` }} · 有效主体图
|
||||||
{{ status.subjectImages.current }}/{{ status.subjectImages.total }} · 有效首帧
|
{{ status.subjectImages.current }}/{{ status.subjectImages.total }} · 有效首帧
|
||||||
@@ -59,7 +73,7 @@ const problems = computed(() => [
|
|||||||
<th scope="col">总数</th>
|
<th scope="col">总数</th>
|
||||||
<th scope="col">可执行</th>
|
<th scope="col">可执行</th>
|
||||||
<th scope="col">跳过</th>
|
<th scope="col">跳过</th>
|
||||||
<th scope="col">前置完成后可执行</th>
|
<th scope="col">准备完成后可执行</th>
|
||||||
<th scope="col">需人工处理</th>
|
<th scope="col">需人工处理</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -76,7 +90,7 @@ const problems = computed(() => [
|
|||||||
</table>
|
</table>
|
||||||
</NScrollbar>
|
</NScrollbar>
|
||||||
<p class="mt-2 text-xs text-muted">
|
<p class="mt-2 text-xs text-muted">
|
||||||
计划按当前资产估算,前置生成后会重新检查。视频“跳过”包含已有有效视频和进行中的任务。已有过期主体主图生成新候选后,仍需在形态图库确认新主图。
|
计划会根据当前素材自动更新。已有有效结果会直接复用;重新生成的过期主体图会自动设为当前主图,手动生成的候选仍可在形态图片页自行确认。
|
||||||
</p>
|
</p>
|
||||||
<NAlert v-if="plan.hasManualBlockers" type="warning" :show-icon="false" class="mt-3">
|
<NAlert v-if="plan.hasManualBlockers" type="warning" :show-icon="false" class="mt-3">
|
||||||
各阶段合计
|
各阶段合计
|
||||||
@@ -84,7 +98,7 @@ const problems = computed(() => [
|
|||||||
项需人工处理(同一镜头可能重复计数)。可先生成就绪的主体参考图;成功结果会保留,遇到阻塞时后续阶段可能暂停。
|
项需人工处理(同一镜头可能重复计数)。可先生成就绪的主体参考图;成功结果会保留,遇到阻塞时后续阶段可能暂停。
|
||||||
</NAlert>
|
</NAlert>
|
||||||
<NCollapse v-if="problems.length" class="mt-3" :default-expanded-names="['issues']">
|
<NCollapse v-if="problems.length" class="mt-3" :default-expanded-names="['issues']">
|
||||||
<NCollapseItem name="issues" title="查看前置条件与阻塞原因">
|
<NCollapseItem name="issues" title="查看还需要准备的内容">
|
||||||
<ul class="space-y-3 text-xs">
|
<ul class="space-y-3 text-xs">
|
||||||
<li v-for="item in problems" :key="item.key">
|
<li v-for="item in problems" :key="item.key">
|
||||||
<strong class="break-all">{{ item.label }}</strong>
|
<strong class="break-all">{{ item.label }}</strong>
|
||||||
@@ -122,4 +136,10 @@ const problems = computed(() => [
|
|||||||
.production-plan-table tbody tr:nth-child(even) {
|
.production-plan-table tbody tr:nth-child(even) {
|
||||||
background: var(--app-subtle);
|
background: var(--app-subtle);
|
||||||
}
|
}
|
||||||
|
.status-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 4px 8px;
|
||||||
|
background: var(--app-subtle);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -50,10 +50,8 @@ async function inspect() {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="surface-inset mt-4 p-4" aria-label="视频模型最终输入检查">
|
<section class="surface-inset mt-4 p-4" aria-label="视频模型最终输入检查">
|
||||||
<h4 class="text-sm font-medium">按模型检查实际输入</h4>
|
<h4 class="text-sm font-medium">检查视频素材</h4>
|
||||||
<p class="mt-2 text-xs text-muted">
|
<p class="mt-2 text-xs text-muted">输入模型名称,检查素材是否满足要求。查看不收费。</p>
|
||||||
填写后端使用的视频模型标识,检查实际首帧与授权素材。只读查询,不产生生成费用。
|
|
||||||
</p>
|
|
||||||
<div class="mt-3 flex flex-wrap gap-2">
|
<div class="mt-3 flex flex-wrap gap-2">
|
||||||
<NInput
|
<NInput
|
||||||
v-model:value="provider"
|
v-model:value="provider"
|
||||||
|
|||||||
@@ -19,34 +19,84 @@ import { allowedTextLines, validQualityInput } from '../quality'
|
|||||||
import type { QualityAction, QualityInput, QualityTarget } from '../quality.types'
|
import type { QualityAction, QualityInput, QualityTarget } from '../quality.types'
|
||||||
import { useQuality } from '../useQuality'
|
import { useQuality } from '../useQuality'
|
||||||
import QualityResult from './QualityResult.vue'
|
import QualityResult from './QualityResult.vue'
|
||||||
|
import KeyframeValidationHistory from './KeyframeValidationHistory.vue'
|
||||||
|
import WorkflowExecutionPanel from '../../workflows/WorkflowExecutionPanel.vue'
|
||||||
|
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||||||
|
import { generationConfigApi } from '../../generation-config/api'
|
||||||
|
import type { GenerationOptions } from '../../generation-config/types'
|
||||||
|
import { useQuery } from '../../../composables/useQuery'
|
||||||
import ModelCapabilities from './ModelCapabilities.vue'
|
import ModelCapabilities from './ModelCapabilities.vue'
|
||||||
|
|
||||||
/** 单素材与当前集质量生成共用一个按需打开的面板,默认小批量且不自动调用模型。 */
|
/** 单素材与当前集质量生成共用一个按需打开的面板,默认小批量且不自动调用模型。 */
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
/** 当前项目 */
|
||||||
projectId: string
|
projectId: string
|
||||||
|
/** 固定质量目标 */
|
||||||
target: QualityTarget | null
|
target: QualityTarget | null
|
||||||
|
/** 上游状态阻断 */
|
||||||
disabled: boolean
|
disabled: boolean
|
||||||
}>()
|
}>()
|
||||||
|
/** 质量面板的open状态,随目标更新。 */
|
||||||
const open = defineModel<boolean>('open', { default: false })
|
const open = defineModel<boolean>('open', { default: false })
|
||||||
const emit = defineEmits<{ changed: []; locate: [shotId: string] }>()
|
/** 通知外部刷新、定位与后台任务开始。 */
|
||||||
const { key, session, operation, blocked, run } = useQuality(
|
const emit = defineEmits<{ changed: []; locate: [shotId: string]; started: [executionId: string] }>()
|
||||||
|
const { key, session, operation, execution, blocked, run } = useQuality(
|
||||||
props,
|
props,
|
||||||
() => open.value,
|
() => open.value,
|
||||||
() => emit('changed')
|
() => emit('changed'),
|
||||||
|
id => emit('started', id)
|
||||||
)
|
)
|
||||||
|
/** 模型目录只读查询,随当前项目和弹窗状态取消过期请求。 */
|
||||||
|
const modelKey = computed(() =>
|
||||||
|
open.value && props.target?.kind === 'batch' && props.projectId ? props.projectId : ''
|
||||||
|
)
|
||||||
|
/** 模型与项目画幅读取,不自动写入配置。 */
|
||||||
|
const modelQuery = useQuery(modelKey, async (projectId, signal) =>
|
||||||
|
projectId
|
||||||
|
? {
|
||||||
|
catalog: await generationConfigApi.catalog(signal),
|
||||||
|
profile: await generationConfigApi.profile(projectId, signal)
|
||||||
|
}
|
||||||
|
: null
|
||||||
|
)
|
||||||
|
/** 本次明确选择的图片供应方。 */
|
||||||
|
const provider = ref('')
|
||||||
|
/** 本次生成与修复共用参数。 */
|
||||||
|
const generationOptions = ref<GenerationOptions>({})
|
||||||
|
/** 后台任务期间表单也保持锁定。 */
|
||||||
|
const pending = computed(() => operation.value.pending || execution.active.value)
|
||||||
|
/** 当前目标的单镜头范围。 */
|
||||||
|
const singleShot = computed(() => props.target?.kind === 'batch' && !!props.target.shotId)
|
||||||
|
/** 质量面板的formRef状态,随目标更新。 */
|
||||||
|
const formRef = ref<InstanceType<typeof AppForm> | null>(null)
|
||||||
|
/** 质量面板的action状态,随目标更新。 */
|
||||||
const action = ref<QualityAction>('validate')
|
const action = ref<QualityAction>('validate')
|
||||||
|
/** 质量面板的attempts状态,随目标更新。 */
|
||||||
const attempts = ref<number | null>(1)
|
const attempts = ref<number | null>(1)
|
||||||
|
/** 质量面板的concurrency状态,随目标更新。 */
|
||||||
const concurrency = ref<number | null>(1)
|
const concurrency = ref<number | null>(1)
|
||||||
|
/** 质量面板的limit状态,随目标更新。 */
|
||||||
const limit = ref<number | null>(1)
|
const limit = ref<number | null>(1)
|
||||||
|
/** 质量面板的force状态,随目标更新。 */
|
||||||
const force = ref(false)
|
const force = ref(false)
|
||||||
|
/** 质量面板的width状态,随目标更新。 */
|
||||||
const width = ref<number | null>(null)
|
const width = ref<number | null>(null)
|
||||||
|
/** 质量面板的height状态,随目标更新。 */
|
||||||
const height = ref<number | null>(null)
|
const height = ref<number | null>(null)
|
||||||
|
/** 质量面板的texts状态,随目标更新。 */
|
||||||
const texts = ref('')
|
const texts = ref('')
|
||||||
|
/** 质量面板的acknowledged状态,随目标更新。 */
|
||||||
const acknowledged = ref(false)
|
const acknowledged = ref(false)
|
||||||
|
/** 质量面板的videoRepair状态,随目标更新。 */
|
||||||
const videoRepair = computed(() => props.target?.kind === 'video' && action.value === 'repair')
|
const videoRepair = computed(() => props.target?.kind === 'video' && action.value === 'repair')
|
||||||
|
/** 质量面板的input状态,随目标更新。 */
|
||||||
const input = computed<QualityInput>(() => ({
|
const input = computed<QualityInput>(() => ({
|
||||||
concurrency: action.value === 'batch' ? (concurrency.value ?? 0) : 1,
|
concurrency: action.value === 'batch' ? (concurrency.value ?? 0) : 1,
|
||||||
limit: action.value === 'batch' ? (limit.value ?? 0) : 1,
|
limit: action.value === 'batch' && !singleShot.value ? (limit.value ?? 0) : 1,
|
||||||
|
...(props.target?.kind === 'batch' && props.target.shotId ? { shotId: props.target.shotId } : {}),
|
||||||
|
...(action.value === 'batch' && provider.value
|
||||||
|
? { provider: provider.value, generationOptions: { ...generationOptions.value } }
|
||||||
|
: {}),
|
||||||
maxRepairAttempts: action.value === 'validate' ? 0 : (attempts.value ?? -1),
|
maxRepairAttempts: action.value === 'validate' ? 0 : (attempts.value ?? -1),
|
||||||
force: force.value,
|
force: force.value,
|
||||||
episodeNo: props.target?.kind === 'batch' ? props.target.episodeNo : 1,
|
episodeNo: props.target?.kind === 'batch' ? props.target.episodeNo : 1,
|
||||||
@@ -54,10 +104,23 @@ const input = computed<QualityInput>(() => ({
|
|||||||
...(action.value === 'validate' || width.value === null ? {} : { width: width.value }),
|
...(action.value === 'validate' || width.value === null ? {} : { width: width.value }),
|
||||||
...(action.value === 'validate' || height.value === null ? {} : { height: height.value })
|
...(action.value === 'validate' || height.value === null ? {} : { height: height.value })
|
||||||
}))
|
}))
|
||||||
const valid = computed(
|
/** 批量生图必须读到真实配置并显式选定启用模型,不能回退到未确认的全局默认。 */
|
||||||
() => validQualityInput(input.value) && (!videoRepair.value || input.value.maxRepairAttempts > 0)
|
const modelReady = computed(
|
||||||
|
() =>
|
||||||
|
props.target?.kind !== 'batch' ||
|
||||||
|
(!modelQuery.loading.value &&
|
||||||
|
!modelQuery.error.value &&
|
||||||
|
!!modelQuery.data.value?.profile &&
|
||||||
|
modelQuery.data.value.catalog.images.some(model => model.provider === provider.value && model.enabled))
|
||||||
)
|
)
|
||||||
|
/** 参数及模型均有效时才允许进入费用确认后的提交。 */
|
||||||
|
const valid = computed(
|
||||||
|
() =>
|
||||||
|
modelReady.value && validQualityInput(input.value) && (!videoRepair.value || input.value.maxRepairAttempts > 0)
|
||||||
|
)
|
||||||
|
/** 质量面板的generating状态,随目标更新。 */
|
||||||
const generating = computed(() => action.value !== 'validate')
|
const generating = computed(() => action.value !== 'validate')
|
||||||
|
/** 质量面板的label状态,随目标更新。 */
|
||||||
const label = computed(() =>
|
const label = computed(() =>
|
||||||
action.value === 'batch'
|
action.value === 'batch'
|
||||||
? '开始质量生成'
|
? '开始质量生成'
|
||||||
@@ -67,6 +130,7 @@ const label = computed(() =>
|
|||||||
: '校验并修复'
|
: '校验并修复'
|
||||||
: '开始视觉校验'
|
: '开始视觉校验'
|
||||||
)
|
)
|
||||||
|
/** 质量面板的maxImages状态,随目标更新。 */
|
||||||
const maxImages = computed(() =>
|
const maxImages = computed(() =>
|
||||||
action.value === 'batch'
|
action.value === 'batch'
|
||||||
? input.value.limit * (1 + input.value.maxRepairAttempts)
|
? input.value.limit * (1 + input.value.maxRepairAttempts)
|
||||||
@@ -74,10 +138,13 @@ const maxImages = computed(() =>
|
|||||||
? input.value.maxRepairAttempts
|
? input.value.maxRepairAttempts
|
||||||
: 0
|
: 0
|
||||||
)
|
)
|
||||||
|
/** 质量面板的maxValidations状态,随目标更新。 */
|
||||||
const maxValidations = computed(() =>
|
const maxValidations = computed(() =>
|
||||||
action.value === 'batch' ? maxImages.value : action.value === 'repair' ? input.value.maxRepairAttempts + 1 : 1
|
action.value === 'batch' ? maxImages.value : action.value === 'repair' ? input.value.maxRepairAttempts + 1 : 1
|
||||||
)
|
)
|
||||||
|
/** 质量面板的saved状态,随目标更新。 */
|
||||||
const saved = computed(() => (props.target?.kind === 'video' ? (session.value.videoValidation ?? null) : null))
|
const saved = computed(() => (props.target?.kind === 'video' ? (session.value.videoValidation ?? null) : null))
|
||||||
|
/** 质量面板的repairAvailable状态,随目标更新。 */
|
||||||
const repairAvailable = computed(
|
const repairAvailable = computed(
|
||||||
() =>
|
() =>
|
||||||
!videoRepair.value ||
|
!videoRepair.value ||
|
||||||
@@ -98,19 +165,35 @@ watch(
|
|||||||
width.value = null
|
width.value = null
|
||||||
height.value = null
|
height.value = null
|
||||||
texts.value = ''
|
texts.value = ''
|
||||||
|
provider.value = ''
|
||||||
|
generationOptions.value = {}
|
||||||
acknowledged.value = false
|
acknowledged.value = false
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
|
/** 参数变化撤销付费确认。 */
|
||||||
watch([input, action], () => {
|
watch([input, action], () => {
|
||||||
acknowledged.value = false
|
acknowledged.value = false
|
||||||
})
|
})
|
||||||
|
/** 模型目录加载后使用项目已保存的供应方与参数,切镜头重置单次覆盖。 */
|
||||||
|
watch(
|
||||||
|
[() => modelQuery.data.value, key],
|
||||||
|
([data]) => {
|
||||||
|
if (!data?.profile || props.target?.kind !== 'batch') return
|
||||||
|
const selected = data.catalog.images.find(item => item.provider === data.profile!.imageProvider && item.enabled)
|
||||||
|
if (!selected) return
|
||||||
|
provider.value = selected.provider
|
||||||
|
generationOptions.value = { ...selected.defaults, ...data.profile.imageOptions }
|
||||||
|
},
|
||||||
|
{ flush: 'post' }
|
||||||
|
)
|
||||||
/** 付费入口保留明确确认,不因菜单选择或查看历史自动提交。 */
|
/** 付费入口保留明确确认,不因菜单选择或查看历史自动提交。 */
|
||||||
async function submit() {
|
async function submit() {
|
||||||
if (!acknowledged.value || !valid.value || blocked.value || !repairAvailable.value) return
|
if (!acknowledged.value || !valid.value || blocked.value || !repairAvailable.value) return
|
||||||
acknowledged.value = false
|
acknowledged.value = false
|
||||||
await run(action.value, input.value)
|
await run(action.value, input.value)
|
||||||
}
|
}
|
||||||
|
/** 质量面板的formModel状态,随目标更新。 */
|
||||||
const formModel = computed(() => ({
|
const formModel = computed(() => ({
|
||||||
attempts: attempts.value,
|
attempts: attempts.value,
|
||||||
concurrency: concurrency.value,
|
concurrency: concurrency.value,
|
||||||
@@ -119,16 +202,19 @@ const formModel = computed(() => ({
|
|||||||
height: height.value,
|
height: height.value,
|
||||||
texts: texts.value
|
texts: texts.value
|
||||||
}))
|
}))
|
||||||
|
/** 质量面板的rules状态,随目标更新。 */
|
||||||
const rules = computed(() => ({
|
const rules = computed(() => ({
|
||||||
attempts: integerRule('修复次数', videoRepair.value ? 1 : 0),
|
attempts: integerRule('修复次数', videoRepair.value ? 1 : 0),
|
||||||
concurrency: integerRule('批量并发'),
|
concurrency: integerRule('批量并发'),
|
||||||
limit: integerRule('本批镜头上限'),
|
limit: integerRule('本批镜头上限'),
|
||||||
...sizeRules(() => formModel.value)
|
...sizeRules(() => formModel.value)
|
||||||
}))
|
}))
|
||||||
|
/** 更多参数折叠状态。 */
|
||||||
const optionsExpanded = ref<string[]>(['options'])
|
const optionsExpanded = ref<string[]>(['options'])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<!-- 以下是质量操作与显式费用确认模块 -->
|
||||||
<AppDialog
|
<AppDialog
|
||||||
v-model:open="open"
|
v-model:open="open"
|
||||||
:title="`质量检查 · ${target?.title ?? ''}`"
|
:title="`质量检查 · ${target?.title ?? ''}`"
|
||||||
@@ -136,9 +222,10 @@ const optionsExpanded = ref<string[]>(['options'])
|
|||||||
wide
|
wide
|
||||||
>
|
>
|
||||||
<AppForm
|
<AppForm
|
||||||
|
ref="formRef"
|
||||||
:model="formModel"
|
:model="formModel"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
:disabled="operation.pending"
|
:disabled="pending"
|
||||||
:reset-key="`${open}:${key}:${action}`"
|
:reset-key="`${open}:${key}:${action}`"
|
||||||
validate-on-change
|
validate-on-change
|
||||||
@invalid="optionsExpanded = ['options']"
|
@invalid="optionsExpanded = ['options']"
|
||||||
@@ -147,7 +234,7 @@ const optionsExpanded = ref<string[]>(['options'])
|
|||||||
<NRadioGroup
|
<NRadioGroup
|
||||||
v-if="target && target.kind !== 'batch'"
|
v-if="target && target.kind !== 'batch'"
|
||||||
v-model:value="action"
|
v-model:value="action"
|
||||||
:disabled="operation.pending"
|
:disabled="pending"
|
||||||
class="mt-4"
|
class="mt-4"
|
||||||
aria-label="素材质量操作"
|
aria-label="素材质量操作"
|
||||||
>
|
>
|
||||||
@@ -163,30 +250,26 @@ const optionsExpanded = ref<string[]>(['options'])
|
|||||||
<NFormItem path="attempts" :label="videoRepair ? '修复链次数上限' : '每镜最多修复'"
|
<NFormItem path="attempts" :label="videoRepair ? '修复链次数上限' : '每镜最多修复'"
|
||||||
><NInputNumber
|
><NInputNumber
|
||||||
v-model:value="attempts"
|
v-model:value="attempts"
|
||||||
:disabled="operation.pending"
|
:disabled="pending"
|
||||||
:min="videoRepair ? 1 : 0"
|
:min="videoRepair ? 1 : 0"
|
||||||
:step="1"
|
:step="1"
|
||||||
:input-props="{ 'aria-label': '每镜最多修复次数' }"
|
:input-props="{ 'aria-label': '每镜最多修复次数' }"
|
||||||
/></NFormItem>
|
/></NFormItem>
|
||||||
<NFormItem v-if="target?.kind === 'batch'" path="limit" label="本批镜头上限"
|
<NFormItem v-if="target?.kind === 'batch' && !singleShot" path="limit" label="本批镜头上限"
|
||||||
><NInputNumber
|
><NInputNumber
|
||||||
v-model:value="limit"
|
v-model:value="limit"
|
||||||
:disabled="operation.pending"
|
:disabled="pending"
|
||||||
:min="1"
|
:min="1"
|
||||||
:step="1"
|
:step="1"
|
||||||
:input-props="{ 'aria-label': '质量生成镜头上限' }"
|
:input-props="{ 'aria-label': '质量生成镜头上限' }"
|
||||||
/></NFormItem>
|
/></NFormItem>
|
||||||
</div>
|
</div>
|
||||||
<NCheckbox
|
<NCheckbox v-if="target?.kind === 'batch'" v-model:checked="force" :disabled="pending" class="mt-4"
|
||||||
v-if="target?.kind === 'batch'"
|
>重做当前范围已有有效首帧(通过后替换主图)</NCheckbox
|
||||||
v-model:checked="force"
|
|
||||||
:disabled="operation.pending"
|
|
||||||
class="mt-4"
|
|
||||||
>重做本集已有有效首帧(通过后替换主图)</NCheckbox
|
|
||||||
>
|
>
|
||||||
<p v-if="target?.kind === 'batch'" class="mt-3 text-xs text-muted">
|
<p v-if="target?.kind === 'batch'" class="mt-3 text-xs text-muted">
|
||||||
仅第 {{ target.episodeNo }} 集,最多
|
仅第 {{ target.episodeNo }} 集{{ singleShot ? `,指定镜头 ${target.shotId}` : '' }},最多
|
||||||
{{ limit ?? '—' }} 镜;非重做模式优先处理过期项,若全项目无过期项则补缺失首帧。
|
{{ singleShot ? 1 : (limit ?? '—') }} 镜;非重做模式处理符合条件的过期和缺失首帧。
|
||||||
</p>
|
</p>
|
||||||
<p v-if="videoRepair" class="mt-3 text-xs text-muted">
|
<p v-if="videoRepair" class="mt-3 text-xs text-muted">
|
||||||
本次仅创建一个修复视频,不自动等待或复检。完成后请打开新候选的质量检查;修复约束沿用上次失败校验,不使用额外参数。
|
本次仅创建一个修复视频,不自动等待或复检。完成后请打开新候选的质量检查;修复约束沿用上次失败校验,不使用额外参数。
|
||||||
@@ -205,7 +288,7 @@ const optionsExpanded = ref<string[]>(['options'])
|
|||||||
<NFormItem v-if="target?.kind === 'batch'" path="concurrency" label="批量并发"
|
<NFormItem v-if="target?.kind === 'batch'" path="concurrency" label="批量并发"
|
||||||
><NInputNumber
|
><NInputNumber
|
||||||
v-model:value="concurrency"
|
v-model:value="concurrency"
|
||||||
:disabled="operation.pending"
|
:disabled="pending"
|
||||||
:min="1"
|
:min="1"
|
||||||
:step="1"
|
:step="1"
|
||||||
:input-props="{ 'aria-label': '质量生成并发' }"
|
:input-props="{ 'aria-label': '质量生成并发' }"
|
||||||
@@ -213,14 +296,14 @@ const optionsExpanded = ref<string[]>(['options'])
|
|||||||
<NFormItem v-if="generating" path="width" label="宽度(可选)"
|
<NFormItem v-if="generating" path="width" label="宽度(可选)"
|
||||||
><NInputNumber
|
><NInputNumber
|
||||||
v-model:value="width"
|
v-model:value="width"
|
||||||
:disabled="operation.pending"
|
:disabled="pending"
|
||||||
:min="1"
|
:min="1"
|
||||||
:input-props="{ 'aria-label': '质量生成宽度' }"
|
:input-props="{ 'aria-label': '质量生成宽度' }"
|
||||||
/></NFormItem>
|
/></NFormItem>
|
||||||
<NFormItem v-if="generating" path="height" label="高度(可选)"
|
<NFormItem v-if="generating" path="height" label="高度(可选)"
|
||||||
><NInputNumber
|
><NInputNumber
|
||||||
v-model:value="height"
|
v-model:value="height"
|
||||||
:disabled="operation.pending"
|
:disabled="pending"
|
||||||
:min="1"
|
:min="1"
|
||||||
:input-props="{ 'aria-label': '质量生成高度' }"
|
:input-props="{ 'aria-label': '质量生成高度' }"
|
||||||
/></NFormItem>
|
/></NFormItem>
|
||||||
@@ -228,12 +311,39 @@ const optionsExpanded = ref<string[]>(['options'])
|
|||||||
<NFormItem class="mt-4 block" path="texts" label="额外允许的画面文字(一行一项,可留空)"
|
<NFormItem class="mt-4 block" path="texts" label="额外允许的画面文字(一行一项,可留空)"
|
||||||
><NInput
|
><NInput
|
||||||
v-model:value="texts"
|
v-model:value="texts"
|
||||||
:disabled="operation.pending"
|
:disabled="pending"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:autosize="{ minRows: 2, maxRows: 5 }"
|
:autosize="{ minRows: 2, maxRows: 5 }"
|
||||||
:input-props="{ 'aria-label': '额外允许的画面文字' }"
|
:input-props="{ 'aria-label': '额外允许的画面文字' }"
|
||||||
/></NFormItem>
|
/></NFormItem>
|
||||||
<ModelCapabilities :shot-id="target && target.kind !== 'batch' ? target.shotId : undefined" />
|
<!-- 以下是复用现有模型目录的单次质量生成配置模块 -->
|
||||||
|
<GenerationModelControls
|
||||||
|
v-if="target?.kind === 'batch' && modelQuery.data.value?.profile"
|
||||||
|
v-model:provider="provider"
|
||||||
|
v-model:options="generationOptions"
|
||||||
|
type="image"
|
||||||
|
:catalog="modelQuery.data.value.catalog"
|
||||||
|
:aspect-ratio="modelQuery.data.value.profile.aspectRatio"
|
||||||
|
:disabled="pending"
|
||||||
|
/>
|
||||||
|
<NAlert v-if="modelQuery.error.value" type="error" :show-icon="false">{{
|
||||||
|
modelQuery.error.value
|
||||||
|
}}</NAlert>
|
||||||
|
<NAlert
|
||||||
|
v-if="target?.kind === 'batch' && !modelReady && !modelQuery.error.value"
|
||||||
|
type="warning"
|
||||||
|
:show-icon="false"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
modelQuery.loading.value
|
||||||
|
? '正在读取项目模型配置,请稍候。'
|
||||||
|
: '请先保存有效的项目图片模型配置,再选择本次模型。'
|
||||||
|
}}
|
||||||
|
</NAlert>
|
||||||
|
<ModelCapabilities
|
||||||
|
:shot-id="target?.shotId"
|
||||||
|
:provider="target?.kind === 'batch' ? provider : undefined"
|
||||||
|
/>
|
||||||
</NCollapseItem>
|
</NCollapseItem>
|
||||||
</NCollapse>
|
</NCollapse>
|
||||||
<NAlert type="warning" :show-icon="false" class="mt-4">
|
<NAlert type="warning" :show-icon="false" class="mt-4">
|
||||||
@@ -256,26 +366,27 @@ const optionsExpanded = ref<string[]>(['options'])
|
|||||||
: '仅校验,不修改主资产。'
|
: '仅校验,不修改主资产。'
|
||||||
}}</template>
|
}}</template>
|
||||||
</NAlert>
|
</NAlert>
|
||||||
<NCheckbox v-model:checked="acknowledged" :disabled="operation.pending" class="mt-4"
|
|
||||||
>我已确认费用、处理范围,且同项目没有其他生成任务。</NCheckbox
|
|
||||||
>
|
|
||||||
<div class="dialog-footer mt-4">
|
|
||||||
<NButton @click="open = false">关闭</NButton>
|
|
||||||
<NButton
|
|
||||||
type="primary"
|
|
||||||
:loading="operation.pending"
|
|
||||||
:disabled="blocked || !acknowledged || !repairAvailable"
|
|
||||||
attr-type="submit"
|
|
||||||
>{{ label }}</NButton
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</AppForm>
|
</AppForm>
|
||||||
<p v-if="operation.pending" role="status" class="mt-3 text-xs text-muted">
|
<p v-if="pending" role="status" class="mt-3 text-xs text-muted">{{ operation.label }}进行中,请勿重复提交。</p>
|
||||||
{{ operation.label }}进行中,请勿重复提交。
|
|
||||||
</p>
|
|
||||||
<NAlert v-if="session.error" role="alert" type="error" :show-icon="false" class="mt-4">{{
|
<NAlert v-if="session.error" role="alert" type="error" :show-icon="false" class="mt-4">{{
|
||||||
session.error
|
session.error
|
||||||
}}</NAlert>
|
}}</NAlert>
|
||||||
|
<!-- 以下是持久化任务进度与原目标最终回执模块 -->
|
||||||
|
<WorkflowExecutionPanel
|
||||||
|
v-if="execution.executionId.value"
|
||||||
|
title="首帧质量后台任务"
|
||||||
|
:execution="execution.query.data.value"
|
||||||
|
:loading="execution.query.loading.value"
|
||||||
|
:error="execution.query.error.value"
|
||||||
|
@refresh="execution.query.refresh"
|
||||||
|
@dismiss="execution.dismiss"
|
||||||
|
/>
|
||||||
|
<KeyframeValidationHistory
|
||||||
|
v-if="target?.kind === 'keyframe'"
|
||||||
|
:project-id="projectId"
|
||||||
|
:shot-id="target.shotId"
|
||||||
|
:keyframe-id="target.assetId"
|
||||||
|
/>
|
||||||
<QualityResult v-if="session.receipt" :receipt="session.receipt" @locate="emit('locate', $event)" />
|
<QualityResult v-if="session.receipt" :receipt="session.receipt" @locate="emit('locate', $event)" />
|
||||||
<NCollapse v-else-if="saved" class="mt-4" :default-expanded-names="['saved']"
|
<NCollapse v-else-if="saved" class="mt-4" :default-expanded-names="['saved']"
|
||||||
><NCollapseItem name="saved" :title="`本会话最近校验 · ${saved.passed ? '通过' : '未通过'}`"
|
><NCollapseItem name="saved" :title="`本会话最近校验 · ${saved.passed ? '通过' : '未通过'}`"
|
||||||
@@ -287,8 +398,26 @@ const optionsExpanded = ref<string[]>(['options'])
|
|||||||
></NCollapse
|
></NCollapse
|
||||||
>
|
>
|
||||||
<p v-if="target?.kind !== 'batch'" class="mt-3 text-xs text-muted">
|
<p v-if="target?.kind !== 'batch'" class="mt-3 text-xs text-muted">
|
||||||
校验回执保留在当前会话,可导出;素材列表不提供历史质量结果,刷新浏览器后需重新校验。
|
本会话回执可导出;首帧已有校验可在历史中只读查看,后台质量任务刷新后继续恢复。
|
||||||
</p>
|
</p>
|
||||||
|
<!-- 以下是底栏左侧费用确认与右侧操作按钮模块 -->
|
||||||
|
<template #footer>
|
||||||
|
<div class="quality-dialog-footer">
|
||||||
|
<NCheckbox v-model:checked="acknowledged" :disabled="pending" class="quality-dialog-acknowledgement"
|
||||||
|
>我已确认费用、处理范围,且同项目没有其他生成任务。</NCheckbox
|
||||||
|
>
|
||||||
|
<div class="quality-dialog-actions">
|
||||||
|
<NButton @click="open = false">关闭</NButton>
|
||||||
|
<NButton
|
||||||
|
type="primary"
|
||||||
|
:loading="pending"
|
||||||
|
:disabled="blocked || !acknowledged || !repairAvailable"
|
||||||
|
@click="formRef?.validate(submit)"
|
||||||
|
>{{ label }}</NButton
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</AppDialog>
|
</AppDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -298,4 +427,19 @@ const optionsExpanded = ref<string[]>(['options'])
|
|||||||
.quality-fields {
|
.quality-fields {
|
||||||
@apply grid grid-cols-[repeat(auto-fit,_minmax(min(100%,_180px),_1fr))] items-start gap-4;
|
@apply grid grid-cols-[repeat(auto-fit,_minmax(min(100%,_180px),_1fr))] items-start gap-4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 确认项固定在底栏左侧,操作按钮在右侧;窄屏允许分行。 */
|
||||||
|
.app-dialog .dialog-footer:has(> .quality-dialog-footer) {
|
||||||
|
@apply w-full;
|
||||||
|
}
|
||||||
|
.quality-dialog-footer {
|
||||||
|
@apply flex w-full flex-wrap items-center justify-between gap-4;
|
||||||
|
}
|
||||||
|
.quality-dialog-acknowledgement {
|
||||||
|
@apply min-w-0 flex-1;
|
||||||
|
flex-basis: 360px;
|
||||||
|
}
|
||||||
|
.quality-dialog-actions {
|
||||||
|
@apply ml-auto flex shrink-0 items-center gap-2;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -6,7 +6,9 @@ import type { QualityReceipt } from '../quality.types'
|
|||||||
|
|
||||||
/** 摘要、失败与完整逐轮信息默认直接显示,不用完成请求冒充质量通过。 */
|
/** 摘要、失败与完整逐轮信息默认直接显示,不用完成请求冒充质量通过。 */
|
||||||
const props = defineProps<{ receipt: QualityReceipt }>()
|
const props = defineProps<{ receipt: QualityReceipt }>()
|
||||||
|
/** 逐镜结果定位事件。 */
|
||||||
const emit = defineEmits<{ locate: [shotId: string] }>()
|
const emit = defineEmits<{ locate: [shotId: string] }>()
|
||||||
|
/** 完整最终回执的视觉结论。 */
|
||||||
const passed = computed(() =>
|
const passed = computed(() =>
|
||||||
props.receipt.kind === 'batch'
|
props.receipt.kind === 'batch'
|
||||||
? props.receipt.result.targetCount > 0 && props.receipt.result.passed === props.receipt.result.targetCount
|
? props.receipt.result.targetCount > 0 && props.receipt.result.passed === props.receipt.result.targetCount
|
||||||
@@ -14,6 +16,7 @@ const passed = computed(() =>
|
|||||||
? false
|
? false
|
||||||
: props.receipt.result.passed
|
: props.receipt.result.passed
|
||||||
)
|
)
|
||||||
|
/** 当前失败问题列表。 */
|
||||||
const issues = computed(() => {
|
const issues = computed(() => {
|
||||||
const value = props.receipt
|
const value = props.receipt
|
||||||
return value.kind === 'batch' || value.kind === 'video-repair'
|
return value.kind === 'batch' || value.kind === 'video-repair'
|
||||||
@@ -22,6 +25,7 @@ const issues = computed(() => {
|
|||||||
? (value.result.attempts.at(-1)?.issues ?? [])
|
? (value.result.attempts.at(-1)?.issues ?? [])
|
||||||
: value.result.issues
|
: value.result.issues
|
||||||
})
|
})
|
||||||
|
/** 视频专项检查详情。 */
|
||||||
const videoChecks = computed(() => {
|
const videoChecks = computed(() => {
|
||||||
if (props.receipt.kind !== 'video') return []
|
if (props.receipt.kind !== 'video') return []
|
||||||
const result = props.receipt.result
|
const result = props.receipt.result
|
||||||
@@ -43,6 +47,7 @@ function exportResult() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<!-- 以下是最终校验结论与逐镜执行结果模块 -->
|
||||||
<section class="quality-result" aria-label="质量检查结果">
|
<section class="quality-result" aria-label="质量检查结果">
|
||||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||||
<strong :class="receipt.kind === 'video-repair' ? '' : passed ? 'text-success' : 'text-danger'">{{
|
<strong :class="receipt.kind === 'video-repair' ? '' : passed ? 'text-success' : 'text-danger'">{{
|
||||||
@@ -67,7 +72,9 @@ function exportResult() {
|
|||||||
<NButton text size="small" @click="emit('locate', item.shotId)">定位镜头</NButton>
|
<NButton text size="small" @click="emit('locate', item.shotId)">定位镜头</NButton>
|
||||||
<code class="text-xs text-muted">{{ item.shotId }}</code>
|
<code class="text-xs text-muted">{{ item.shotId }}</code>
|
||||||
<span :class="item.success ? 'text-success' : 'text-danger'">{{
|
<span :class="item.success ? 'text-success' : 'text-danger'">{{
|
||||||
item.success ? '已通过' : item.error || '未通过'
|
item.success
|
||||||
|
? '已通过'
|
||||||
|
: item.error || (item.status === 'repair_failed' ? '达到修复上限仍未通过' : '调用失败')
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import IssueHint from '../../../components/ui/IssueHint.vue'
|
||||||
|
import { useActionMessage } from '../../../components/ui/useActionMessage'
|
||||||
import ProviderInputInspector from './ProviderInputInspector.vue'
|
import ProviderInputInspector from './ProviderInputInspector.vue'
|
||||||
import { NAlert, NButton, NCollapse, NCollapseItem, NTag } from 'naive-ui'
|
import { NAlert, NButton, NCollapse, NCollapseItem, NSelect, NTag } from 'naive-ui'
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||||
import { ExternalLink, ImagePlus, RefreshCw } from '@lucide/vue'
|
import { ExternalLink, ImagePlus, RefreshCw } from '@lucide/vue'
|
||||||
import { AssetImage, StatusBadge } from '../../../components/ui'
|
import { AssetImage, StatusBadge } from '../../../components/ui'
|
||||||
import { usePolling } from '../../../composables/usePolling'
|
import { usePolling } from '../../../composables/usePolling'
|
||||||
@@ -11,9 +13,10 @@ import { formatDate } from '../../../lib/format'
|
|||||||
import type { DesignedShot } from '../../storyboard/types'
|
import type { DesignedShot } from '../../storyboard/types'
|
||||||
import { storyboardApi } from '../../storyboard/api'
|
import { storyboardApi } from '../../storyboard/api'
|
||||||
import ConfirmAction from '../../workflows/ConfirmAction.vue'
|
import ConfirmAction from '../../workflows/ConfirmAction.vue'
|
||||||
import { getOperation, runOperation } from '../../workflows/operations'
|
import { runOperation } from '../../workflows/operations'
|
||||||
import { productionApi } from '../api'
|
import { productionApi } from '../api'
|
||||||
import { isActiveVideo, issueLabel, primaryKeyframe, primaryVideo, productionStatusLabel } from '../model'
|
import { isActiveVideo, primaryKeyframe, primaryVideo, productionStatusLabel, videoQualityStatusLabel } from '../model'
|
||||||
|
import { productionIssueText, productionMessage } from '../production-messages'
|
||||||
import type {
|
import type {
|
||||||
GenerateKeyframeInput,
|
GenerateKeyframeInput,
|
||||||
KeyframeReadinessItem,
|
KeyframeReadinessItem,
|
||||||
@@ -23,52 +26,178 @@ import type {
|
|||||||
VideoReadinessItem
|
VideoReadinessItem
|
||||||
} from '../types'
|
} from '../types'
|
||||||
import KeyframeDialog from './KeyframeDialog.vue'
|
import KeyframeDialog from './KeyframeDialog.vue'
|
||||||
|
import KeyframeCard from './KeyframeCard.vue'
|
||||||
import QualityDialog from './QualityDialog.vue'
|
import QualityDialog from './QualityDialog.vue'
|
||||||
|
import VideoQualityDiagnostics from './VideoQualityDiagnostics.vue'
|
||||||
|
import KeyframeValidationHistory from './KeyframeValidationHistory.vue'
|
||||||
import ActionMenu from '../../../components/ui/ActionMenu.vue'
|
import ActionMenu from '../../../components/ui/ActionMenu.vue'
|
||||||
import { AppDialog } from '../../../components/ui'
|
import { AppDialog } from '../../../components/ui'
|
||||||
import ModelCapabilities from './ModelCapabilities.vue'
|
import ModelCapabilities from './ModelCapabilities.vue'
|
||||||
import type { QualityTarget } from '../quality.types'
|
import type { QualityTarget } from '../quality.types'
|
||||||
import { sessionVideoValidation } from '../quality'
|
import { sessionKeyframePassed, sessionVideoValidation } from '../quality'
|
||||||
|
import { useProjectGenerationRevision } from '../../generation-config/context'
|
||||||
|
import { generationConfigApi } from '../../generation-config/api'
|
||||||
|
import type {
|
||||||
|
CreativeProfileAspectRatio,
|
||||||
|
GenerationModelCatalog,
|
||||||
|
GenerationOptions
|
||||||
|
} from '../../generation-config/types'
|
||||||
|
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||||||
|
|
||||||
|
/** 当前页面操作反馈使用消息提示,不长期占据正文。 */
|
||||||
|
const actionMessage = useActionMessage()
|
||||||
|
/** 离开镜头后忽略迟到的手动读取反馈。 */
|
||||||
|
let disposed = false
|
||||||
|
onScopeDispose(() => {
|
||||||
|
disposed = true
|
||||||
|
})
|
||||||
|
|
||||||
/** 单镜头生产面板只负责正式资产,不修改上游导演设计与即时状态。 */
|
/** 单镜头生产面板只负责正式资产,不修改上游导演设计与即时状态。 */
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
/** 当前正式项目 ID。 */
|
||||||
projectId: string
|
projectId: string
|
||||||
|
/** 当前正式镜头。 */
|
||||||
shot: DesignedShot
|
shot: DesignedShot
|
||||||
|
/** 当前剧集编号,用于限制单镜头质量生成。 */
|
||||||
|
episodeNo?: number
|
||||||
|
/** 视频提示词就绪项。 */
|
||||||
promptReadiness?: PromptReadinessItem
|
promptReadiness?: PromptReadinessItem
|
||||||
|
/** 首帧就绪项。 */
|
||||||
keyframeReadiness?: KeyframeReadinessItem
|
keyframeReadiness?: KeyframeReadinessItem
|
||||||
|
/** 视频就绪项。 */
|
||||||
videoReadiness?: VideoReadinessItem
|
videoReadiness?: VideoReadinessItem
|
||||||
|
/** 是否从深链接打开首帧生成。 */
|
||||||
|
openKeyframe?: boolean
|
||||||
|
/** 页面上游状态是否阻断操作。 */
|
||||||
disabled: boolean
|
disabled: boolean
|
||||||
}>()
|
}>()
|
||||||
const emit = defineEmits<{ changed: [] }>()
|
/** 通知父页面刷新及观察已启动的质量任务。 */
|
||||||
|
const emit = defineEmits<{ changed: []; qualityStarted: [executionId: string] }>()
|
||||||
const key = computed(() => props.shot.shotId)
|
const key = computed(() => props.shot.shotId)
|
||||||
/** 单镜头资产已有刷新入口,不再定时轮询。 */
|
/** 仅当前镜头存在后台首帧或视频任务时临时轮询,终态后自动停止。 */
|
||||||
const query = usePolling(
|
let query!: ReturnType<
|
||||||
|
typeof usePolling<{
|
||||||
|
keyframes: Awaited<ReturnType<typeof productionApi.listKeyframes>>
|
||||||
|
videos: Awaited<ReturnType<typeof productionApi.listVideos>>
|
||||||
|
qualityStatus: Awaited<ReturnType<typeof productionApi.videoQualityStatus>> | null
|
||||||
|
qualityStatusError: string
|
||||||
|
inputPlan: Awaited<ReturnType<typeof productionApi.videoInputPlan>> | null
|
||||||
|
inputPlanError: string
|
||||||
|
}>
|
||||||
|
>
|
||||||
|
const assetPollInterval = computed(() => {
|
||||||
|
const data = query?.data.value
|
||||||
|
if (!data) return false
|
||||||
|
const keyframeRunning = data.keyframes.some(item => ['pending', 'generating'].includes(item.status))
|
||||||
|
const videoRunning = data.videos.some(isActiveVideo)
|
||||||
|
return keyframeRunning || videoRunning ? 5000 : false
|
||||||
|
})
|
||||||
|
query = usePolling(
|
||||||
key,
|
key,
|
||||||
async (shotId, signal) => {
|
async (shotId, signal) => {
|
||||||
const [keyframes, videos] = await Promise.all([
|
const [keyframes, videos, qualityState, inputPlanState] = await Promise.all([
|
||||||
productionApi.listKeyframes(shotId, signal),
|
productionApi.listKeyframes(shotId, signal),
|
||||||
productionApi.listVideos(shotId, signal)
|
productionApi.listVideos(shotId, signal),
|
||||||
|
productionApi
|
||||||
|
.videoQualityStatus(shotId, signal)
|
||||||
|
.then(data => ({ data, error: '' }))
|
||||||
|
.catch(cause => ({ data: null, error: errorMessage(cause) })),
|
||||||
|
productionApi
|
||||||
|
.videoInputPlan(shotId, signal)
|
||||||
|
.then(data => ({ data, error: '' }))
|
||||||
|
.catch(cause => ({ data: null, error: errorMessage(cause) }))
|
||||||
])
|
])
|
||||||
if (keyframes.some(item => item.shotId !== shotId) || videos.some(item => item.shotId !== shotId))
|
if (keyframes.some(item => item.shotId !== shotId) || videos.some(item => item.shotId !== shotId))
|
||||||
throw new Error('资产记录与当前镜头不匹配,请刷新后重试。')
|
throw new Error('资产记录与当前镜头不匹配,请刷新后重试。')
|
||||||
return { keyframes, videos }
|
const qualityStatus = qualityState.data?.shotId === shotId ? qualityState.data : null
|
||||||
|
const inputPlan = inputPlanState.data?.shotId === shotId ? inputPlanState.data : null
|
||||||
|
return {
|
||||||
|
keyframes,
|
||||||
|
videos,
|
||||||
|
qualityStatus,
|
||||||
|
qualityStatusError: qualityState.error,
|
||||||
|
inputPlan,
|
||||||
|
inputPlanError: inputPlanState.error
|
||||||
|
}
|
||||||
},
|
},
|
||||||
false
|
assetPollInterval
|
||||||
|
)
|
||||||
|
/** 单独读取已保存的提示词,查询失败不影响首帧和视频资产展示。 */
|
||||||
|
const promptQuery = usePolling(key, (shotId, signal) => storyboardApi.videoPrompt(shotId, signal), false)
|
||||||
|
const savedPrompt = computed(() => (promptQuery.data.value?.shotId === key.value ? promptQuery.data.value : null))
|
||||||
|
/** 当前视频生成规格的首帧和主体参考图,独立查询避免影响资产列表。 */
|
||||||
|
const videoInputQuery = usePolling(key, (shotId, signal) => productionApi.videoGenerationSpec(shotId, signal), false)
|
||||||
|
/** 素材查询问题与就绪检查使用同一中文说明,避免重复展示后端术语。 */
|
||||||
|
const videoInputError = computed(() => productionMessage(videoInputQuery.error.value))
|
||||||
|
/** 视频准备问题按实际含义去重,保留所有不同的处理建议。 */
|
||||||
|
const videoIssueMessages = computed(() => [...new Set((props.videoReadiness?.issues ?? []).map(productionIssueText))])
|
||||||
|
const currentVideoInput = computed(() =>
|
||||||
|
videoInputQuery.data.value?.shotId === key.value ? videoInputQuery.data.value : null
|
||||||
)
|
)
|
||||||
const keyframes = computed(() => query.data.value?.keyframes ?? [])
|
const keyframes = computed(() => query.data.value?.keyframes ?? [])
|
||||||
const videos = computed(() => query.data.value?.videos ?? [])
|
const videos = computed(() => query.data.value?.videos ?? [])
|
||||||
|
const videoQualityStatus = computed(() => query.data.value?.qualityStatus ?? null)
|
||||||
|
const videoInputPlan = computed(() => query.data.value?.inputPlan ?? null)
|
||||||
const currentKeyframe = computed(() => primaryKeyframe(keyframes.value))
|
const currentKeyframe = computed(() => primaryKeyframe(keyframes.value))
|
||||||
const currentVideo = computed(() => primaryVideo(videos.value))
|
const currentVideo = computed(() => primaryVideo(videos.value))
|
||||||
const activeVideo = computed(() => videos.value.find(isActiveVideo))
|
const activeVideo = computed(() => videos.value.find(isActiveVideo))
|
||||||
const operation = computed(() => getOperation(props.projectId))
|
const assetBlocked = computed(() => props.disabled || !!query.error.value)
|
||||||
const assetBlocked = computed(() => props.disabled || operation.value.pending || !!query.error.value)
|
/**
|
||||||
|
* 项目级 operation 只用于防止同一批量命令重复提交,不应锁住其它 Shot 的单资产操作。
|
||||||
|
* 当前 Shot 的图片/视频重复提交分别由本镜头持久化资产状态约束。
|
||||||
|
*/
|
||||||
const keyframeOpen = ref(false)
|
const keyframeOpen = ref(false)
|
||||||
|
watch(
|
||||||
|
() => props.openKeyframe,
|
||||||
|
requested => {
|
||||||
|
if (requested) keyframeOpen.value = true
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
const qualityOpen = ref(false)
|
const qualityOpen = ref(false)
|
||||||
|
const candidatesOpen = ref(false)
|
||||||
const qualityTarget = ref<QualityTarget | null>(null)
|
const qualityTarget = ref<QualityTarget | null>(null)
|
||||||
const specsOpen = ref(false)
|
const specsOpen = ref(false)
|
||||||
|
const generationCatalog = ref<GenerationModelCatalog | null>(null)
|
||||||
|
const generationCatalogError = ref('')
|
||||||
|
const videoProvider = ref('')
|
||||||
|
const videoGenerationOptions = ref<GenerationOptions>({})
|
||||||
|
const videoInputModeOverride = ref<'auto' | 'first_frame' | 'omni_reference'>('auto')
|
||||||
|
const projectAspectRatio = ref<CreativeProfileAspectRatio>('9:16')
|
||||||
|
|
||||||
|
/** 项目配置成功保存后同步当前单镜头默认参数。 */
|
||||||
|
const generationRevision = useProjectGenerationRevision()
|
||||||
|
/** 单镜手动生成默认继承项目配置,用户修改只作用于本次请求;取消旧项目响应。 */
|
||||||
|
watch(
|
||||||
|
[() => props.projectId, generationRevision],
|
||||||
|
async ([projectId], _previous, onCleanup) => {
|
||||||
|
const controller = new AbortController()
|
||||||
|
onCleanup(() => controller.abort())
|
||||||
|
generationCatalogError.value = ''
|
||||||
|
try {
|
||||||
|
const [catalog, profile] = await Promise.all([
|
||||||
|
generationConfigApi.catalog(controller.signal),
|
||||||
|
generationConfigApi.profile(projectId, controller.signal)
|
||||||
|
])
|
||||||
|
if (controller.signal.aborted) return
|
||||||
|
generationCatalog.value = catalog
|
||||||
|
projectAspectRatio.value = profile?.aspectRatio ?? '9:16'
|
||||||
|
videoProvider.value = profile?.videoProvider || catalog.defaults.videoProvider
|
||||||
|
const selected = catalog.videos.find(item => item.provider === videoProvider.value)
|
||||||
|
videoGenerationOptions.value = {
|
||||||
|
...selected?.defaults,
|
||||||
|
...profile?.videoOptions
|
||||||
|
}
|
||||||
|
} catch (cause) {
|
||||||
|
if (!controller.signal.aborted) generationCatalogError.value = errorMessage(cause)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
|
||||||
/** 从实际候选打开质量面板,保留单镜头主操作。 */
|
/** 从实际候选打开质量面板,保留单镜头主操作。 */
|
||||||
function openQuality(kind: 'keyframe' | 'video', assetId: string) {
|
function openQuality(kind: 'keyframe' | 'video', assetId: string) {
|
||||||
|
candidatesOpen.value = false
|
||||||
qualityTarget.value = {
|
qualityTarget.value = {
|
||||||
kind,
|
kind,
|
||||||
shotId: props.shot.shotId,
|
shotId: props.shot.shotId,
|
||||||
@@ -77,6 +206,17 @@ function openQuality(kind: 'keyframe' | 'video', assetId: string) {
|
|||||||
}
|
}
|
||||||
qualityOpen.value = true
|
qualityOpen.value = true
|
||||||
}
|
}
|
||||||
|
/** 只打开当前镜头的有限质量重跑表单,费用确认后才发送任务。 */
|
||||||
|
function openShotKeyframeQuality() {
|
||||||
|
if (!props.episodeNo || !canGenerateKeyframe.value) return
|
||||||
|
qualityTarget.value = {
|
||||||
|
kind: 'batch',
|
||||||
|
episodeNo: props.episodeNo,
|
||||||
|
shotId: props.shot.shotId,
|
||||||
|
title: `${props.shot.title} · 本镜首帧质量重跑`
|
||||||
|
}
|
||||||
|
qualityOpen.value = true
|
||||||
|
}
|
||||||
const confirmingKeyframe = ref('')
|
const confirmingKeyframe = ref('')
|
||||||
const confirmingVideo = ref('')
|
const confirmingVideo = ref('')
|
||||||
const inspecting = ref(false)
|
const inspecting = ref(false)
|
||||||
@@ -95,9 +235,18 @@ const canGenerateKeyframe = computed(
|
|||||||
)
|
)
|
||||||
const canGenerateVideo = computed(
|
const canGenerateVideo = computed(
|
||||||
() =>
|
() =>
|
||||||
!assetBlocked.value && !activeVideo.value && !!props.videoReadiness && props.videoReadiness.issues.length === 0
|
!assetBlocked.value &&
|
||||||
|
!activeVideo.value &&
|
||||||
|
!!props.videoReadiness &&
|
||||||
|
props.videoReadiness.issues.length === 0 &&
|
||||||
|
(!currentKeyframe.value || keyframePassed(currentKeyframe.value.id) !== false)
|
||||||
)
|
)
|
||||||
const keyframeStale = computed(() => !!props.keyframeReadiness?.primaryKeyframeStale)
|
const keyframeStale = computed(() => !!props.keyframeReadiness?.primaryKeyframeStale)
|
||||||
|
const keyframeCandidates = computed(() => keyframes.value.filter(item => item.id !== currentKeyframe.value?.id))
|
||||||
|
/** 质量历史尚无 GET;只消费当前会话中该候选的真实校验结果。 */
|
||||||
|
function keyframePassed(assetId: string) {
|
||||||
|
return sessionKeyframePassed(props.projectId, props.shot.shotId, assetId)
|
||||||
|
}
|
||||||
const videoStale = computed(() => !!props.videoReadiness?.primaryVideoStale)
|
const videoStale = computed(() => !!props.videoReadiness?.primaryVideoStale)
|
||||||
|
|
||||||
watch(key, () => {
|
watch(key, () => {
|
||||||
@@ -118,10 +267,21 @@ function safeVideoUrl(value: string | null): string | null {
|
|||||||
|
|
||||||
/** 重新读取单镜头资产,并通知父页刷新项目就绪状态。 */
|
/** 重新读取单镜头资产,并通知父页刷新项目就绪状态。 */
|
||||||
async function refreshAll() {
|
async function refreshAll() {
|
||||||
await query.refresh()
|
await Promise.all([query.refresh(), promptQuery.refresh(), videoInputQuery.refresh()])
|
||||||
emit('changed')
|
emit('changed')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 手动更新素材时才反馈查询结果,切换镜头后不显示旧目标提示。 */
|
||||||
|
async function refreshVideoInput() {
|
||||||
|
if (videoInputQuery.loading.value) return
|
||||||
|
const target = `${props.projectId}:${props.shot.shotId}`
|
||||||
|
await videoInputQuery.refresh()
|
||||||
|
if (disposed || target !== `${props.projectId}:${props.shot.shotId}`) return
|
||||||
|
if (videoInputQuery.error.value)
|
||||||
|
actionMessage?.warning(productionMessage(videoInputQuery.error.value), { duration: 7000, closable: true })
|
||||||
|
else actionMessage?.success('视频素材已更新。', { duration: 3000 })
|
||||||
|
}
|
||||||
|
|
||||||
/** 单镜头提示词根据现有状态决定是否 force 覆盖。 */
|
/** 单镜头提示词根据现有状态决定是否 force 覆盖。 */
|
||||||
async function generatePrompt() {
|
async function generatePrompt() {
|
||||||
if (!canGeneratePrompt.value) return
|
if (!canGeneratePrompt.value) return
|
||||||
@@ -151,6 +311,7 @@ async function setPrimaryKeyframe() {
|
|||||||
if (
|
if (
|
||||||
assetBlocked.value ||
|
assetBlocked.value ||
|
||||||
!keyframeId ||
|
!keyframeId ||
|
||||||
|
keyframePassed(keyframeId) !== true ||
|
||||||
keyframes.value.find(item => item.id === keyframeId)?.source === 'provider_variant'
|
keyframes.value.find(item => item.id === keyframeId)?.source === 'provider_variant'
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@@ -170,6 +331,12 @@ async function generateVideo() {
|
|||||||
const shotId = props.shot.shotId
|
const shotId = props.shot.shotId
|
||||||
await runOperation(props.projectId, `提交镜头 ${props.shot.shotNo} 视频质量任务`, async () => {
|
await runOperation(props.projectId, `提交镜头 ${props.shot.shotNo} 视频质量任务`, async () => {
|
||||||
const result = await productionApi.generateQualityVideo(shotId, {
|
const result = await productionApi.generateQualityVideo(shotId, {
|
||||||
|
provider: videoProvider.value || undefined,
|
||||||
|
inputMode:
|
||||||
|
videoInputModeOverride.value === 'auto'
|
||||||
|
? videoInputPlan.value?.inputMode
|
||||||
|
: videoInputModeOverride.value,
|
||||||
|
generationOptions: videoGenerationOptions.value,
|
||||||
maxRepairAttempts: 2,
|
maxRepairAttempts: 2,
|
||||||
allowedTexts: []
|
allowedTexts: []
|
||||||
})
|
})
|
||||||
@@ -248,15 +415,6 @@ async function inspectSpecs() {
|
|||||||
:items="[{ key: 'specs', label: '检查生成规格与模型限制', disabled: inspecting }]"
|
:items="[{ key: 'specs', label: '检查生成规格与模型限制', disabled: inspecting }]"
|
||||||
@select="inspectSpecs"
|
@select="inspectSpecs"
|
||||||
/>
|
/>
|
||||||
<NButton
|
|
||||||
:disabled="query.loading.value"
|
|
||||||
@click="refreshAll"
|
|
||||||
quaternary
|
|
||||||
class="icon-button"
|
|
||||||
aria-label="刷新资产"
|
|
||||||
title="刷新资产"
|
|
||||||
><RefreshCw :size="16" :class="{ 'animate-spin': query.loading.value }" />
|
|
||||||
</NButton>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<NAlert v-if="query.error.value" role="alert" type="error" :show-icon="false" class="mt-4"
|
<NAlert v-if="query.error.value" role="alert" type="error" :show-icon="false" class="mt-4"
|
||||||
@@ -274,12 +432,29 @@ async function inspectSpecs() {
|
|||||||
:label="productionStatusLabel(promptReadiness.status)"
|
:label="productionStatusLabel(promptReadiness.status)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ul v-if="promptReadiness?.issues.length" class="mt-3 space-y-2 text-xs text-danger">
|
<IssueHint :messages="(promptReadiness?.issues ?? []).map(productionIssueText)" />
|
||||||
<li v-for="issue in promptReadiness.issues" :key="issue.code">
|
<div v-if="savedPrompt?.videoPrompt" class="surface-inset mt-4 p-4" aria-label="本镜视频提示词">
|
||||||
{{ issueLabel(issue.code) }}:{{ issue.reason }}
|
<p class="text-xs font-medium">本镜视频提示词</p>
|
||||||
</li>
|
<p class="mt-3 whitespace-pre-wrap break-words text-sm leading-6">{{ savedPrompt.videoPrompt }}</p>
|
||||||
</ul>
|
<template v-if="savedPrompt.negativePrompt">
|
||||||
<div class="mt-4">
|
<p class="mt-4 text-xs font-medium">负向提示词</p>
|
||||||
|
<p class="mt-2 whitespace-pre-wrap break-words text-xs leading-6 text-muted">
|
||||||
|
{{ savedPrompt.negativePrompt }}
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
<p v-if="promptReadiness?.stalePrompt" class="mt-3 text-xs text-danger">
|
||||||
|
此提示词已过期,请重新生成后再制作视频。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<p v-else-if="promptQuery.loading.value" role="status" class="mt-4 text-xs text-muted">
|
||||||
|
正在读取视频提示词…
|
||||||
|
</p>
|
||||||
|
<p v-else-if="!promptQuery.error.value" class="mt-4 text-xs text-muted">尚未生成本镜视频提示词。</p>
|
||||||
|
<NAlert v-if="promptQuery.error.value" role="alert" type="warning" :show-icon="false" class="mt-4 text-xs">
|
||||||
|
提示词读取失败:{{ promptQuery.error.value }}
|
||||||
|
<NButton text size="small" @click="promptQuery.refresh">重试</NButton>
|
||||||
|
</NAlert>
|
||||||
|
<div class="production-stage-actions">
|
||||||
<ConfirmAction
|
<ConfirmAction
|
||||||
:label="promptReadiness?.status === 'skipped' ? '重新生成本镜提示词' : '生成本镜提示词'"
|
:label="promptReadiness?.status === 'skipped' ? '重新生成本镜提示词' : '生成本镜提示词'"
|
||||||
:disabled="!canGeneratePrompt"
|
:disabled="!canGeneratePrompt"
|
||||||
@@ -305,79 +480,52 @@ async function inspectSpecs() {
|
|||||||
:label="keyframeStale ? '主首帧已过期' : productionStatusLabel(keyframeReadiness.status)"
|
:label="keyframeStale ? '主首帧已过期' : productionStatusLabel(keyframeReadiness.status)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<NAlert v-if="keyframeStale" role="status" type="info" :show-icon="false" class="mt-3 text-xs">
|
<IssueHint :messages="(keyframeReadiness?.issues ?? []).map(productionIssueText)" />
|
||||||
当前主首帧使用的主体参考资产已经变化,旧图仍保留但不会继续进入视频生成。请重新生成主首帧。
|
<div v-if="currentKeyframe" class="keyframe-grid mt-4">
|
||||||
</NAlert>
|
<KeyframeCard
|
||||||
<ul v-if="keyframeReadiness?.issues.length" class="mt-3 space-y-2 text-xs text-danger">
|
:item="currentKeyframe"
|
||||||
<li v-for="issue in keyframeReadiness.issues" :key="issue.code">
|
:shot-no="shot.shotNo"
|
||||||
{{ issueLabel(issue.code) }}:{{ issue.reason }}
|
:stale="keyframeStale"
|
||||||
</li>
|
:blocked="assetBlocked"
|
||||||
</ul>
|
:validation-passed="keyframePassed(currentKeyframe.id)"
|
||||||
<div v-if="keyframes.length" class="keyframe-grid mt-4">
|
:confirming="false"
|
||||||
<article v-for="item in keyframes" :key="item.id" class="keyframe-card">
|
@quality="openQuality('keyframe', currentKeyframe.id)"
|
||||||
<AssetImage
|
/>
|
||||||
:src="item.status === 'completed' ? item.imageUrl : null"
|
|
||||||
:alt="`镜头 ${shot.shotNo} 首帧`"
|
|
||||||
preview
|
|
||||||
:empty-text="item.status === 'failed' ? '首帧生成失败' : '首帧生成中'"
|
|
||||||
/>
|
|
||||||
<div class="p-3">
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
|
||||||
<StatusBadge :status="item.status" :label="productionStatusLabel(item.status)" />
|
|
||||||
<NTag v-if="item.isPrimary" size="small" :bordered="false">主首帧</NTag>
|
|
||||||
<NTag v-if="item.source === 'provider_variant'" size="small" :bordered="false"
|
|
||||||
>模型输入变体</NTag
|
|
||||||
>
|
|
||||||
<NTag v-if="item.isPrimary && keyframeStale" size="small" :bordered="false">已过期</NTag>
|
|
||||||
<span class="text-[10px] text-muted"
|
|
||||||
>{{ item.width || '—' }} × {{ item.height || '—' }}</span
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<p v-if="item.error" class="mt-2 line-clamp-3 text-xs text-danger">{{ item.error }}</p>
|
|
||||||
<p class="mt-2 text-[10px] text-muted">{{ formatDate(item.createdAt) }}</p>
|
|
||||||
<NButton
|
|
||||||
v-if="item.status === 'completed' && item.imageUrl"
|
|
||||||
text
|
|
||||||
size="small"
|
|
||||||
class="mt-2 mr-3"
|
|
||||||
@click="openQuality('keyframe', item.id)"
|
|
||||||
>质量检查</NButton
|
|
||||||
>
|
|
||||||
<NButton
|
|
||||||
v-if="
|
|
||||||
item.status === 'completed' &&
|
|
||||||
item.imageUrl &&
|
|
||||||
item.source !== 'provider_variant' &&
|
|
||||||
!item.isPrimary
|
|
||||||
"
|
|
||||||
:disabled="assetBlocked"
|
|
||||||
@click="confirmingKeyframe = item.id"
|
|
||||||
text
|
|
||||||
size="small"
|
|
||||||
class="mt-2"
|
|
||||||
>
|
|
||||||
设为主首帧
|
|
||||||
</NButton>
|
|
||||||
<NAlert
|
|
||||||
v-if="confirmingKeyframe === item.id"
|
|
||||||
type="info"
|
|
||||||
:show-icon="false"
|
|
||||||
class="mt-2 text-xs"
|
|
||||||
><p>确认让后续视频使用此首帧?已有视频不会自动重生成。</p>
|
|
||||||
<div class="mt-2 flex gap-3">
|
|
||||||
<NButton @click="setPrimaryKeyframe" type="primary">确认切换</NButton>
|
|
||||||
<NButton @click="confirmingKeyframe = ''" text size="small">取消</NButton>
|
|
||||||
</div></NAlert
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</div>
|
</div>
|
||||||
<p v-else class="mt-4 text-xs text-muted">尚无首帧记录。</p>
|
<p v-else class="mt-4 text-xs text-muted">尚无已确认主首帧。请生成候选,完成质量检查后再设为主首帧。</p>
|
||||||
<NButton :disabled="!canGenerateKeyframe" @click="keyframeOpen = true" class="mt-4"
|
<!-- 以下是当前主首帧的只读视觉校验历史模块 -->
|
||||||
><ImagePlus :size="14" />{{
|
<KeyframeValidationHistory
|
||||||
keyframeStale ? '重新生成主首帧' : currentKeyframe ? '再生成一张候选' : '生成首帧'
|
v-if="currentKeyframe"
|
||||||
}}</NButton
|
:key="currentKeyframe.id"
|
||||||
|
:project-id="projectId"
|
||||||
|
:shot-id="shot.shotId"
|
||||||
|
:keyframe-id="currentKeyframe.id"
|
||||||
|
class="mt-3"
|
||||||
|
/>
|
||||||
|
<NAlert
|
||||||
|
v-if="currentKeyframe && keyframePassed(currentKeyframe.id) === false"
|
||||||
|
type="error"
|
||||||
|
:show-icon="false"
|
||||||
|
class="mt-3 text-xs"
|
||||||
>
|
>
|
||||||
|
当前主首帧在本次质量检查中未通过,已阻止继续生成视频。请从候选中选择质量通过的图片。
|
||||||
|
</NAlert>
|
||||||
|
<NAlert v-if="query.data.value?.qualityStatusError" type="warning" :show-icon="false" class="mt-3 text-xs">
|
||||||
|
视频质量链状态暂时无法读取;视频资产仍可查看。请稍后刷新。
|
||||||
|
</NAlert>
|
||||||
|
<div class="production-stage-actions">
|
||||||
|
<NButton :disabled="!episodeNo || !canGenerateKeyframe" @click="openShotKeyframeQuality"
|
||||||
|
>本镜首帧质量重跑</NButton
|
||||||
|
>
|
||||||
|
<NButton v-if="keyframeCandidates.length" @click="candidatesOpen = true">
|
||||||
|
管理候选({{ keyframeCandidates.length }})
|
||||||
|
</NButton>
|
||||||
|
<NButton :disabled="!canGenerateKeyframe" @click="keyframeOpen = true"
|
||||||
|
><ImagePlus :size="14" />{{
|
||||||
|
keyframeStale ? '生成替代候选' : currentKeyframe ? '再生成一张候选' : '生成首帧候选'
|
||||||
|
}}</NButton
|
||||||
|
>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="production-stage">
|
<div class="production-stage">
|
||||||
@@ -391,15 +539,103 @@ async function inspectSpecs() {
|
|||||||
:label="videoStale ? '主视频已过期' : productionStatusLabel(videoReadiness.status)"
|
:label="videoStale ? '主视频已过期' : productionStatusLabel(videoReadiness.status)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<NAlert v-if="videoStale" role="status" type="info" :show-icon="false" class="mt-3 text-xs">
|
<div v-if="videoInputPlan" class="mt-3 flex flex-wrap items-center gap-2 text-xs">
|
||||||
当前主视频使用的主首帧或主体参考图已经变化。旧视频仍保留;重新生成完成后,新视频会自动接替过期主视频。
|
<NTag size="small" :bordered="false" type="info">
|
||||||
</NAlert>
|
{{ videoInputPlan.inputMode === 'omni_reference' ? '使用多张参考图' : '使用首帧' }}
|
||||||
<ul v-if="videoReadiness?.issues.length" class="mt-3 space-y-2 text-xs text-danger">
|
</NTag>
|
||||||
<li v-for="issue in videoReadiness.issues" :key="issue.code">
|
<span class="text-muted">{{ videoInputPlan.reasons.map(productionMessage).join(';') }}</span>
|
||||||
{{ issueLabel(issue.code) }}:{{ issue.reason }}
|
</div>
|
||||||
</li>
|
<IssueHint :messages="videoIssueMessages" />
|
||||||
</ul>
|
<section class="surface-inset mt-4 p-4" aria-label="当前视频生成素材引用">
|
||||||
<div v-if="videos.length" class="mt-4 space-y-3">
|
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||||
|
<h6 class="text-xs font-medium">视频使用的素材</h6>
|
||||||
|
<span v-if="currentVideoInput" class="text-[11px] text-muted">
|
||||||
|
首帧 1 张 · 参考图 {{ currentVideoInput.references.length }} 张
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div v-if="currentVideoInput" class="video-input-grid mt-4">
|
||||||
|
<article class="video-input-card">
|
||||||
|
<div class="video-input-image">
|
||||||
|
<AssetImage
|
||||||
|
:src="currentVideoInput.providerInputKeyframe.imageUrl"
|
||||||
|
:alt="`镜头 ${shot.shotNo} 视频输入首帧`"
|
||||||
|
preview
|
||||||
|
object-fit="cover"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="min-w-0 p-2 text-center text-xs">
|
||||||
|
<p class="font-medium">视频输入首帧</p>
|
||||||
|
<p class="mt-1 text-[11px] text-muted">
|
||||||
|
{{
|
||||||
|
currentVideoInput.providerInputKeyframe.source === 'provider_variant'
|
||||||
|
? '模型专用变体'
|
||||||
|
: '当前主首帧'
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
<article
|
||||||
|
v-for="reference in currentVideoInput.references"
|
||||||
|
:key="`${reference.subjectId}:${reference.imageId}`"
|
||||||
|
class="video-input-card"
|
||||||
|
>
|
||||||
|
<div class="video-input-image">
|
||||||
|
<AssetImage
|
||||||
|
:src="reference.imageUrl"
|
||||||
|
:alt="`${reference.subjectName} ${reference.subjectFormName} 参考图`"
|
||||||
|
preview
|
||||||
|
object-fit="cover"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="min-w-0 p-2 text-center text-xs">
|
||||||
|
<p class="truncate font-medium" :title="reference.subjectName">
|
||||||
|
{{ reference.subjectName }}
|
||||||
|
</p>
|
||||||
|
<p class="mt-1 truncate text-[11px] text-muted" :title="reference.subjectFormName">
|
||||||
|
{{ reference.subjectFormName }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
<p v-else-if="videoInputQuery.loading.value" role="status" class="mt-4 text-xs text-muted">
|
||||||
|
正在读取视频生成素材…
|
||||||
|
</p>
|
||||||
|
<div v-else class="mt-4 text-xs text-muted">
|
||||||
|
<p>视频素材还未准备好,请先检查视频提示词、首帧和参考图。</p>
|
||||||
|
<IssueHint v-if="!videoIssueMessages.length" :messages="videoInputError ? [videoInputError] : []" />
|
||||||
|
<!-- 以下是重新获取素材的操作模块,与上下正文保持间距 -->
|
||||||
|
<div v-if="videoInputQuery.error.value" class="mt-3 flex pb-1">
|
||||||
|
<NButton text size="small" :loading="videoInputQuery.loading.value" @click="refreshVideoInput"
|
||||||
|
>重新获取</NButton
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<div
|
||||||
|
v-if="videoQualityStatus && videoQualityStatus.status !== 'not_started'"
|
||||||
|
class="mt-3 flex items-center gap-2"
|
||||||
|
>
|
||||||
|
<NTag
|
||||||
|
size="small"
|
||||||
|
:type="
|
||||||
|
videoQualityStatus.status === 'passed'
|
||||||
|
? 'success'
|
||||||
|
: videoQualityStatus.status === 'exhausted'
|
||||||
|
? 'error'
|
||||||
|
: 'info'
|
||||||
|
"
|
||||||
|
:bordered="false"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
videoQualityStatus.status === 'passed'
|
||||||
|
? '视频检查通过'
|
||||||
|
: videoQualityStatusLabel(videoQualityStatus.status)
|
||||||
|
}}
|
||||||
|
</NTag>
|
||||||
|
</div>
|
||||||
|
<!-- 以下是当前镜头只读视频质量详情与失败归因模块 -->
|
||||||
|
<VideoQualityDiagnostics :key="shot.shotId" :shot-id="shot.shotId" class="mt-3" />
|
||||||
|
<div v-if="videos.length" class="video-grid mt-4">
|
||||||
<article v-for="item in videos" :key="item.id" class="video-record">
|
<article v-for="item in videos" :key="item.id" class="video-record">
|
||||||
<video
|
<video
|
||||||
v-if="item.status === 'completed' && safeVideoUrl(item.videoUrl)"
|
v-if="item.status === 'completed' && safeVideoUrl(item.videoUrl)"
|
||||||
@@ -408,7 +644,7 @@ async function inspectSpecs() {
|
|||||||
preload="metadata"
|
preload="metadata"
|
||||||
class="production-video"
|
class="production-video"
|
||||||
></video>
|
></video>
|
||||||
<div class="min-w-0 flex-1 p-4">
|
<div class="min-w-0 p-3">
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
<StatusBadge :status="item.status" :label="productionStatusLabel(item.status)" />
|
<StatusBadge :status="item.status" :label="productionStatusLabel(item.status)" />
|
||||||
<NTag v-if="item.isPrimary" size="small" :bordered="false">主视频</NTag>
|
<NTag v-if="item.isPrimary" size="small" :bordered="false">主视频</NTag>
|
||||||
@@ -474,9 +710,56 @@ async function inspectSpecs() {
|
|||||||
</div>
|
</div>
|
||||||
<p v-else class="mt-4 text-xs text-muted">尚无视频任务记录。</p>
|
<p v-else class="mt-4 text-xs text-muted">尚无视频任务记录。</p>
|
||||||
<p v-if="videos.some(item => !item.isPrimary)" class="mt-3 text-xs text-muted">
|
<p v-if="videos.some(item => !item.isPrimary)" class="mt-3 text-xs text-muted">
|
||||||
候选视频的历史质量结果未公开;手动设为主视频前需在本会话完成视觉校验。自动质量任务的晋升结果以刷新后的主视频标记为准。
|
质量链状态来自后端持久化记录;手动晋升候选仍需在当前页面完成一次视觉校验。自动质量任务通过后会直接更新主视频。
|
||||||
</p>
|
</p>
|
||||||
<div class="mt-4 flex flex-wrap gap-3">
|
<section
|
||||||
|
v-if="generationCatalog"
|
||||||
|
class="generation-settings-panel surface-inset mt-4"
|
||||||
|
aria-label="本次视频生成模型设置"
|
||||||
|
>
|
||||||
|
<div class="generation-settings-content">
|
||||||
|
<div>
|
||||||
|
<h6 class="text-sm font-medium">本次生成设置</h6>
|
||||||
|
<p class="mt-1 text-[11px] leading-5 text-muted">
|
||||||
|
仅覆盖当前镜头本次生成,不修改项目默认模型。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<GenerationModelControls
|
||||||
|
class="mt-5"
|
||||||
|
type="video"
|
||||||
|
:catalog="generationCatalog"
|
||||||
|
:provider="videoProvider"
|
||||||
|
:options="videoGenerationOptions"
|
||||||
|
:aspect-ratio="projectAspectRatio"
|
||||||
|
:disabled="assetBlocked"
|
||||||
|
@update:provider="videoProvider = $event"
|
||||||
|
@update:options="videoGenerationOptions = $event"
|
||||||
|
/>
|
||||||
|
<div class="generation-input-mode">
|
||||||
|
<p class="generation-input-mode-label">生成方式</p>
|
||||||
|
<NSelect
|
||||||
|
:value="videoInputModeOverride"
|
||||||
|
:disabled="assetBlocked"
|
||||||
|
:options="[
|
||||||
|
{
|
||||||
|
label: `自动(推荐:${videoInputPlan?.inputMode === 'omni_reference' ? '多张参考图' : '首帧'})`,
|
||||||
|
value: 'auto'
|
||||||
|
},
|
||||||
|
{ label: '首帧模式', value: 'first_frame' },
|
||||||
|
{ label: '多张参考图', value: 'omni_reference' }
|
||||||
|
]"
|
||||||
|
@update:value="videoInputModeOverride = $event"
|
||||||
|
/>
|
||||||
|
<p class="mt-1.5 text-[11px] leading-5 text-muted">
|
||||||
|
自动选择合适的生成方式;手动选择只影响本次生成。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<NAlert v-else-if="generationCatalogError" type="warning" :show-icon="false" class="mt-4 text-xs">
|
||||||
|
生成模型目录读取失败:{{ generationCatalogError }}
|
||||||
|
</NAlert>
|
||||||
|
<div class="production-stage-actions">
|
||||||
<ConfirmAction
|
<ConfirmAction
|
||||||
:label="
|
:label="
|
||||||
videoStale ? '重新生成质量视频' : currentVideo ? '再生成一个质量候选' : '提交本镜视频质量任务'
|
videoStale ? '重新生成质量视频' : currentVideo ? '再生成一个质量候选' : '提交本镜视频质量任务'
|
||||||
@@ -499,17 +782,17 @@ async function inspectSpecs() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<AppDialog v-model:open="specsOpen" title="生成规格与模型限制" description="只读检查,不调用生成模型。" wide>
|
<AppDialog v-model:open="specsOpen" title="生成设置与模型限制" description="查看不收费。" wide>
|
||||||
<NAlert v-if="specError" role="alert" type="error" :show-icon="false" class="mt-4">{{ specError }}</NAlert>
|
<NAlert v-if="specError" role="alert" type="error" :show-icon="false" class="mt-4">{{ specError }}</NAlert>
|
||||||
<p v-if="inspecting" role="status" class="mt-4 text-xs text-muted">正在读取生成规格…</p>
|
<p v-if="inspecting" role="status" class="mt-4 text-xs text-muted">正在读取生成规格…</p>
|
||||||
<ModelCapabilities :shot-id="shot.shotId" />
|
<ModelCapabilities :shot-id="shot.shotId" />
|
||||||
<ProviderInputInspector :shot-id="shot.shotId" />
|
<ProviderInputInspector :shot-id="shot.shotId" />
|
||||||
<NCollapse v-if="keyframeSpec || videoSpec" class="mt-5 pt-4 text-xs" :default-expanded-names="['details']"
|
<NCollapse v-if="keyframeSpec || videoSpec" class="mt-5 pt-4 text-xs"
|
||||||
><NCollapseItem name="details"
|
><NCollapseItem name="details"
|
||||||
><template #header>本镜确定性生成规格</template>
|
><template #header>查看生成描述</template>
|
||||||
<div class="mt-4 grid gap-5 lg:grid-cols-2">
|
<div class="mt-4 grid gap-5 lg:grid-cols-2">
|
||||||
<div v-if="keyframeSpec">
|
<div v-if="keyframeSpec">
|
||||||
<h5 class="font-medium">首帧 Prompt · {{ keyframeSpec.references.length }} 张参考图</h5>
|
<h5 class="font-medium">首帧描述 · {{ keyframeSpec.references.length }} 张参考图</h5>
|
||||||
<p class="mt-3 whitespace-pre-wrap leading-6 text-muted">{{ keyframeSpec.prompt }}</p>
|
<p class="mt-3 whitespace-pre-wrap leading-6 text-muted">{{ keyframeSpec.prompt }}</p>
|
||||||
<ul v-if="keyframeSpec.references.length" class="mt-3 space-y-1 text-[11px] text-muted">
|
<ul v-if="keyframeSpec.references.length" class="mt-3 space-y-1 text-[11px] text-muted">
|
||||||
<li
|
<li
|
||||||
@@ -517,27 +800,15 @@ async function inspectSpecs() {
|
|||||||
:key="`${reference.role}:${reference.imageId}`"
|
:key="`${reference.role}:${reference.imageId}`"
|
||||||
>
|
>
|
||||||
{{ reference.subjectRef }} ·
|
{{ reference.subjectRef }} ·
|
||||||
{{ reference.role === 'identity-anchor' ? '演员身份母版' : '形态主图' }} ·
|
{{ reference.role === 'identity-anchor' ? '演员身份母版' : '形态主图' }}
|
||||||
<code>{{ reference.imageId }}</code>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="videoSpec">
|
<div v-if="videoSpec">
|
||||||
<h5 class="font-medium">视频 Prompt · {{ videoSpec.durationSeconds }}s</h5>
|
<h5 class="font-medium">视频描述 · {{ videoSpec.durationSeconds }} 秒</h5>
|
||||||
<p class="mt-3 whitespace-pre-wrap leading-6 text-muted">{{ videoSpec.videoPrompt }}</p>
|
<p class="mt-3 whitespace-pre-wrap leading-6 text-muted">{{ videoSpec.videoPrompt }}</p>
|
||||||
<p v-if="videoSpec.negativePrompt" class="mt-3 whitespace-pre-wrap leading-6 text-muted">
|
<p v-if="videoSpec.negativePrompt" class="mt-3 whitespace-pre-wrap leading-6 text-muted">
|
||||||
Negative prompt: {{ videoSpec.negativePrompt }}
|
不希望出现的内容: {{ videoSpec.negativePrompt }}
|
||||||
</p>
|
|
||||||
<p class="mt-3 break-all font-mono text-[10px] text-muted">
|
|
||||||
业务主首帧 ID · {{ videoSpec.keyframe.id }}
|
|
||||||
</p>
|
|
||||||
<p v-if="videoSpec.providerInputKeyframe" class="mt-2 break-all text-[10px] text-muted">
|
|
||||||
通用规格首帧 ID(未指定模型) · {{ videoSpec.providerInputKeyframe.id }}
|
|
||||||
{{
|
|
||||||
videoSpec.providerInputKeyframe.source === 'provider_variant'
|
|
||||||
? '(专用变体)'
|
|
||||||
: '(业务主首帧)'
|
|
||||||
}}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div></NCollapseItem
|
</div></NCollapseItem
|
||||||
@@ -550,12 +821,41 @@ async function inspectSpecs() {
|
|||||||
:target="qualityTarget"
|
:target="qualityTarget"
|
||||||
:disabled="assetBlocked"
|
:disabled="assetBlocked"
|
||||||
@changed="refreshAll"
|
@changed="refreshAll"
|
||||||
|
@started="emit('qualityStarted', $event)"
|
||||||
/>
|
/>
|
||||||
|
<AppDialog
|
||||||
|
v-model:open="candidatesOpen"
|
||||||
|
title="首帧候选管理"
|
||||||
|
description="先完成质量检查;只有本会话校验通过的候选才能设为主首帧。"
|
||||||
|
wide
|
||||||
|
>
|
||||||
|
<!-- 以下是自适应等宽候选图网格模块,完整行与弹窗正文两侧对齐 -->
|
||||||
|
<div
|
||||||
|
v-if="keyframeCandidates.length"
|
||||||
|
class="mt-4 grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-3 max-[760px]:grid-cols-2"
|
||||||
|
>
|
||||||
|
<KeyframeCard
|
||||||
|
v-for="item in keyframeCandidates"
|
||||||
|
:key="item.id"
|
||||||
|
:item="item"
|
||||||
|
:shot-no="shot.shotNo"
|
||||||
|
:stale="false"
|
||||||
|
:blocked="assetBlocked"
|
||||||
|
:validation-passed="keyframePassed(item.id)"
|
||||||
|
:confirming="confirmingKeyframe === item.id"
|
||||||
|
@quality="openQuality('keyframe', item.id)"
|
||||||
|
@select="confirmingKeyframe = item.id"
|
||||||
|
@confirm="setPrimaryKeyframe"
|
||||||
|
@cancel="confirmingKeyframe = ''"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p v-else class="text-xs text-muted">暂无其它首帧候选。</p>
|
||||||
|
</AppDialog>
|
||||||
<KeyframeDialog
|
<KeyframeDialog
|
||||||
v-model:open="keyframeOpen"
|
v-model:open="keyframeOpen"
|
||||||
:shot-id="shot.shotId"
|
:shot-id="shot.shotId"
|
||||||
:shot-title="shot.title"
|
:shot-title="shot.title"
|
||||||
:keyframes="keyframes"
|
:project-id="projectId"
|
||||||
:replace-primary="keyframeStale"
|
:replace-primary="keyframeStale"
|
||||||
:disabled="!canGenerateKeyframe"
|
:disabled="!canGenerateKeyframe"
|
||||||
@generate="generateKeyframe"
|
@generate="generateKeyframe"
|
||||||
@@ -575,33 +875,73 @@ async function inspectSpecs() {
|
|||||||
.production-stage-heading {
|
.production-stage-heading {
|
||||||
@apply flex items-start justify-between gap-4;
|
@apply flex items-start justify-between gap-4;
|
||||||
}
|
}
|
||||||
|
.production-stage-actions {
|
||||||
|
@apply mt-4 flex min-h-[34px] flex-wrap items-center gap-3;
|
||||||
|
}
|
||||||
.keyframe-grid {
|
.keyframe-grid {
|
||||||
@apply grid grid-cols-[repeat(3,_minmax(0,_1fr))] gap-3;
|
@apply grid gap-3;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(180px, 220px));
|
||||||
}
|
}
|
||||||
.keyframe-card {
|
.keyframe-card {
|
||||||
@apply overflow-hidden rounded-none bg-(--app-subtle);
|
@apply relative overflow-hidden rounded-none bg-(--app-subtle);
|
||||||
}
|
}
|
||||||
.keyframe-card .asset-image {
|
.keyframe-card .asset-image {
|
||||||
@apply aspect-video rounded-none;
|
@apply aspect-square rounded-none;
|
||||||
|
}
|
||||||
|
.keyframe-image {
|
||||||
|
@apply relative;
|
||||||
|
}
|
||||||
|
.primary-keyframe-mark {
|
||||||
|
@apply absolute top-2 left-2 z-1 flex size-7 items-center justify-center;
|
||||||
|
color: var(--app-on-accent);
|
||||||
|
background: var(--app-button-primary);
|
||||||
|
box-shadow:
|
||||||
|
0 0 0 1px rgb(0 0 0 / 55%),
|
||||||
|
0 2px 8px rgb(0 0 0 / 35%);
|
||||||
|
}
|
||||||
|
.video-input-grid,
|
||||||
|
.video-grid {
|
||||||
|
@apply grid gap-3;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(180px, 220px));
|
||||||
|
}
|
||||||
|
.video-input-grid .asset-image {
|
||||||
|
@apply aspect-square rounded-none;
|
||||||
|
}
|
||||||
|
.video-input-card {
|
||||||
|
@apply flex min-w-0 flex-col overflow-hidden bg-(--app-control);
|
||||||
|
}
|
||||||
|
.video-input-image {
|
||||||
|
@apply aspect-square w-full overflow-hidden bg-(--app-subtle);
|
||||||
|
}
|
||||||
|
.video-input-image .asset-image {
|
||||||
|
@apply h-full w-full aspect-auto;
|
||||||
}
|
}
|
||||||
.video-record {
|
.video-record {
|
||||||
@apply flex overflow-hidden rounded-none bg-(--app-subtle);
|
@apply min-w-0 overflow-hidden rounded-none bg-(--app-subtle);
|
||||||
}
|
}
|
||||||
.production-video {
|
.production-video {
|
||||||
@apply w-[min(44%,390px)] min-h-[170px] bg-ink object-contain;
|
@apply block w-full aspect-square bg-[#080808] object-contain;
|
||||||
|
}
|
||||||
|
.generation-settings-panel {
|
||||||
|
@apply p-5;
|
||||||
|
}
|
||||||
|
.generation-settings-content {
|
||||||
|
@apply w-full max-w-[1120px];
|
||||||
|
}
|
||||||
|
.generation-input-mode {
|
||||||
|
@apply mt-5 w-full max-w-[550px];
|
||||||
|
}
|
||||||
|
.generation-input-mode-label {
|
||||||
|
@apply mb-[7px] text-xs font-medium leading-5;
|
||||||
}
|
}
|
||||||
@media (max-width: 760px) {
|
@media (max-width: 760px) {
|
||||||
.keyframe-grid {
|
.keyframe-grid,
|
||||||
|
.video-input-grid,
|
||||||
|
.video-grid {
|
||||||
@apply grid-cols-[repeat(2,_minmax(0,_1fr))];
|
@apply grid-cols-[repeat(2,_minmax(0,_1fr))];
|
||||||
}
|
}
|
||||||
.video-record {
|
.generation-settings-panel {
|
||||||
@apply block;
|
@apply p-4;
|
||||||
}
|
}
|
||||||
.production-video {
|
|
||||||
@apply w-full;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.production-video {
|
|
||||||
@apply bg-[#080808];
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { productionIssueText } from '../production-messages'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { NAlert, NButton } from 'naive-ui'
|
import { NAlert, NButton } from 'naive-ui'
|
||||||
import { referenceLocation, referenceTargets } from '../asset-links'
|
import { referenceLocation, referenceTargets } from '../asset-links'
|
||||||
@@ -12,8 +13,9 @@ const references = useShotReferences(
|
|||||||
computed(() => props.shotId)
|
computed(() => props.shotId)
|
||||||
)
|
)
|
||||||
const targets = computed(() => referenceTargets(references.data.value, props.issues))
|
const targets = computed(() => referenceTargets(references.data.value, props.issues))
|
||||||
|
/** 以普通用户可以理解的原因说明当前首帧需要更新。 */
|
||||||
const reasons = computed(() => [
|
const reasons = computed(() => [
|
||||||
...new Set(props.issues.filter(issue => issue.code === 'stale_keyframe').map(issue => issue.reason))
|
...new Set(props.issues.filter(issue => issue.code === 'stale_keyframe').map(productionIssueText))
|
||||||
])
|
])
|
||||||
const precise = computed(() =>
|
const precise = computed(() =>
|
||||||
props.issues.some(issue => issue.code === 'stale_keyframe' && issue.missingSubjects?.length)
|
props.issues.some(issue => issue.code === 'stale_keyframe' && issue.missingSubjects?.length)
|
||||||
@@ -27,15 +29,11 @@ const precise = computed(() =>
|
|||||||
class="mt-4 text-xs"
|
class="mt-4 text-xs"
|
||||||
:title="inconsistent ? '主首帧状态待核对' : '主首帧已过期'"
|
:title="inconsistent ? '主首帧状态待核对' : '主首帧已过期'"
|
||||||
>
|
>
|
||||||
<p v-if="inconsistent">
|
<p v-if="inconsistent">首帧与视频准备状态不一致,请先核对相关素材,再决定是否更新首帧。</p>
|
||||||
首帧检查未标记过期,但视频检查报告参考资产已变化。两项后端检查结果不一致,请先核对下列素材与身份母版,不建议直接重复生图;视频仍会按后端检查阻止提交。
|
<p v-else>请先核对相关参考图,再重新生成并检查首帧。</p>
|
||||||
</p>
|
|
||||||
<p v-else>
|
|
||||||
当前参考资产与生成该首帧时不一致,旧首帧需重建。素材本身不一定过期,请先核对关联素材;确认有效后返回本镜头重新生成主首帧。
|
|
||||||
</p>
|
|
||||||
<p v-for="reason in reasons" :key="reason" class="mt-2">{{ reason }}</p>
|
<p v-for="reason in reasons" :key="reason" class="mt-2">{{ reason }}</p>
|
||||||
<p class="mt-3 font-medium">
|
<p class="mt-3 font-medium">
|
||||||
{{ precise ? '定位后端标记的变更主体' : '核对本镜头关联素材(后端未返回具体变更项)' }}
|
{{ precise ? '需要核对的素材' : '本镜头的相关素材' }}
|
||||||
</p>
|
</p>
|
||||||
<div class="mt-2 flex flex-wrap items-center gap-3">
|
<div class="mt-2 flex flex-wrap items-center gap-3">
|
||||||
<RouterLink
|
<RouterLink
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from 'vue'
|
||||||
|
import { NAlert, NTag } from 'naive-ui'
|
||||||
|
import ReadonlyInspection from '../../../components/ui/ReadonlyInspection.vue'
|
||||||
|
import { useQuery } from '../../../composables/useQuery'
|
||||||
|
import { formatDate } from '../../../lib/format'
|
||||||
|
import { videoDiagnosticsApi } from '../diagnostics-api'
|
||||||
|
import { videoQualityStatusLabel } from '../model'
|
||||||
|
import type { VideoQualityRollbackTarget } from '../diagnostics.types'
|
||||||
|
|
||||||
|
/** 视频诊断始终绑定当前正式镜头。 */
|
||||||
|
const props = defineProps<{ /** 正式镜头 ID。 */ shotId: string }>()
|
||||||
|
/** 仅用户展开后查询,关闭后取消旧请求。 */
|
||||||
|
const open = ref(false)
|
||||||
|
/** 镜头和展开状态共同决定查询目标。 */
|
||||||
|
const key = computed(() => (open.value ? props.shotId : ''))
|
||||||
|
/** 切换镜头时取消查询,先读取链状态,耗尽时再查询独立归因。 */
|
||||||
|
const query = useQuery(key, async (shotId, signal) => {
|
||||||
|
if (!shotId) return null
|
||||||
|
const detail = await videoDiagnosticsApi.qualityDetail(shotId, signal)
|
||||||
|
if (detail.shotId !== shotId || !Array.isArray(detail.chain)) throw new Error('质量记录与当前镜头不匹配,请刷新。')
|
||||||
|
const analysis =
|
||||||
|
detail.status === 'exhausted'
|
||||||
|
? await videoDiagnosticsApi.exhaustionAnalysis(shotId, signal)
|
||||||
|
: detail.exhaustionAnalysis
|
||||||
|
if (analysis && analysis.shotId !== shotId) throw new Error('失败归因与当前镜头不匹配,请刷新。')
|
||||||
|
return { detail, analysis }
|
||||||
|
})
|
||||||
|
/** 当前请求返回的权威质量链。 */
|
||||||
|
const detail = computed(() => query.data.value?.detail)
|
||||||
|
/** 当前链对应的后端确定性归因。 */
|
||||||
|
const analysis = computed(() => query.data.value?.analysis)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将后端回退层级转成业务标签,未知值保持原文。
|
||||||
|
* @param target 后端建议回退层级
|
||||||
|
* @returns 中文标签
|
||||||
|
*/
|
||||||
|
function rollbackLabel(target: VideoQualityRollbackTarget) {
|
||||||
|
const labels: Record<VideoQualityRollbackTarget, string> = {
|
||||||
|
identity_reference: '主体身份母版',
|
||||||
|
subject_reference: '形态参考图',
|
||||||
|
keyframe: '主首帧',
|
||||||
|
motion_plan: '运动计划',
|
||||||
|
video_prompt: '视频提示词',
|
||||||
|
provider: '视频模型'
|
||||||
|
}
|
||||||
|
return labels[target] ?? target
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- 以下是只读视频质量详情与自动修复失败归因模块 -->
|
||||||
|
<ReadonlyInspection
|
||||||
|
v-model:open="open"
|
||||||
|
title="视频质量详情"
|
||||||
|
description="查看检查结果和修改建议,不收费。"
|
||||||
|
:loading="query.loading.value"
|
||||||
|
:error="query.error.value"
|
||||||
|
@refresh="query.refresh"
|
||||||
|
>
|
||||||
|
<template v-if="detail">
|
||||||
|
<p>
|
||||||
|
<strong>{{ videoQualityStatusLabel(detail.status) }}</strong> · 修复 {{ detail.repairAttempt }} /
|
||||||
|
{{ detail.maxRepairAttempts ?? '未设置' }} · 候选 {{ detail.chain.length }}
|
||||||
|
</p>
|
||||||
|
<p v-if="!detail.chain.length" class="mt-2 text-muted">当前镜头尚无质量链记录。</p>
|
||||||
|
<article v-for="item in detail.chain" :key="item.videoId" class="surface-inset mt-3 p-3">
|
||||||
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
|
<code>{{ item.videoId }}</code>
|
||||||
|
<NTag size="small" :bordered="false">第 {{ item.repairAttempt }} 代</NTag>
|
||||||
|
<span
|
||||||
|
>{{ item.providerStatus }} ·
|
||||||
|
{{
|
||||||
|
item.validationPassed === true
|
||||||
|
? '校验通过'
|
||||||
|
: item.validationPassed === false
|
||||||
|
? '校验未通过'
|
||||||
|
: '尚未校验'
|
||||||
|
}}</span
|
||||||
|
>
|
||||||
|
<span class="text-muted">{{ formatDate(item.updatedAt) }}</span>
|
||||||
|
</div>
|
||||||
|
<ul v-if="item.issues.length" class="mt-2 space-y-1">
|
||||||
|
<li
|
||||||
|
v-for="(issue, index) in item.issues"
|
||||||
|
:key="index"
|
||||||
|
:class="issue.severity === 'error' ? 'text-danger' : 'text-muted'"
|
||||||
|
>
|
||||||
|
{{ issue.frameLabel ? `${issue.frameLabel} · ` : '' }}{{ issue.description }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</article>
|
||||||
|
<NAlert
|
||||||
|
v-if="analysis"
|
||||||
|
class="mt-3"
|
||||||
|
:type="analysis.requiresManualReview ? 'warning' : 'info'"
|
||||||
|
:show-icon="false"
|
||||||
|
>
|
||||||
|
{{ analysis.summary }}
|
||||||
|
<p v-if="analysis.recommendedRollback.length" class="mt-1">
|
||||||
|
建议检查:{{ analysis.recommendedRollback.map(rollbackLabel).join('、') }}
|
||||||
|
</p>
|
||||||
|
</NAlert>
|
||||||
|
<article v-for="issue in analysis?.persistentIssues ?? []" :key="issue.type" class="mt-3">
|
||||||
|
<strong>{{ issue.type }} · 出现 {{ issue.occurrences }} 次</strong>
|
||||||
|
<p>{{ issue.suspectedCause }}</p>
|
||||||
|
<ul class="text-muted">
|
||||||
|
<li v-for="description in issue.descriptions" :key="description">{{ description }}</li>
|
||||||
|
</ul>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
</ReadonlyInspection>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { request } from '../../lib/http'
|
||||||
|
import type { VideoQualityDetail, VideoQualityExhaustionAnalysis } from './diagnostics.types'
|
||||||
|
|
||||||
|
/** 视频诊断只读取持久化记录,不触发视觉模型或 Provider。 */
|
||||||
|
export const videoDiagnosticsApi = {
|
||||||
|
/**
|
||||||
|
* 查询指定镜头的完整视频质量链。
|
||||||
|
* @param shotId 正式镜头 ID
|
||||||
|
* @param signal 取消信号
|
||||||
|
* @returns 包含问题详情的质量链
|
||||||
|
*/
|
||||||
|
qualityDetail: (shotId: string, signal?: AbortSignal) =>
|
||||||
|
request<VideoQualityDetail>(
|
||||||
|
`/storyboard-shots/${encodeURIComponent(shotId)}/videos/quality-status?detail=true`,
|
||||||
|
{ signal }
|
||||||
|
),
|
||||||
|
/**
|
||||||
|
* 查询自动修复耗尽后的确定性失败归因。
|
||||||
|
* @param shotId 正式镜头 ID
|
||||||
|
* @param signal 取消信号
|
||||||
|
* @returns 后端实际失败归因和建议回退层级
|
||||||
|
*/
|
||||||
|
exhaustionAnalysis: (shotId: string, signal?: AbortSignal) =>
|
||||||
|
request<VideoQualityExhaustionAnalysis>(
|
||||||
|
`/storyboard-shots/${encodeURIComponent(shotId)}/videos/quality-exhaustion-analysis`,
|
||||||
|
{ signal }
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import type { QualityIssue } from './quality.types'
|
||||||
|
import type { ShotVideoQualityStatus } from './types'
|
||||||
|
|
||||||
|
/** 修复耗尽后后端建议回退的上游层级。 */
|
||||||
|
export type VideoQualityRollbackTarget =
|
||||||
|
| 'identity_reference'
|
||||||
|
| 'subject_reference'
|
||||||
|
| 'keyframe'
|
||||||
|
| 'motion_plan'
|
||||||
|
| 'video_prompt'
|
||||||
|
| 'provider'
|
||||||
|
|
||||||
|
/** 多轮视频中反复出现的质量问题,以后端实际归因为准。 */
|
||||||
|
export interface PersistentVideoQualityIssue {
|
||||||
|
/** 原始问题类型。 */
|
||||||
|
type: string
|
||||||
|
/** 累计出现次数。 */
|
||||||
|
occurrences: number
|
||||||
|
/** 出现该问题的候选代数。 */
|
||||||
|
generations: number[]
|
||||||
|
/** 实际失败描述。 */
|
||||||
|
descriptions: string[]
|
||||||
|
/** 后端疑似原因。 */
|
||||||
|
suspectedCause: string
|
||||||
|
/** 后端建议回退层级。 */
|
||||||
|
recommendedRollback: VideoQualityRollbackTarget[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 确定性失败归因结果,查询不会重新执行模型。 */
|
||||||
|
export interface VideoQualityExhaustionAnalysis {
|
||||||
|
/** 正式镜头 ID。 */
|
||||||
|
shotId: string
|
||||||
|
/** 当前链是否耗尽。 */
|
||||||
|
exhausted: boolean
|
||||||
|
/** 质量链候选数量。 */
|
||||||
|
generations: number
|
||||||
|
/** 未通过的候选数量。 */
|
||||||
|
failedGenerations: number
|
||||||
|
/** 后端判定的持续问题。 */
|
||||||
|
persistentIssues: PersistentVideoQualityIssue[]
|
||||||
|
/** 建议回退层级集合。 */
|
||||||
|
recommendedRollback: VideoQualityRollbackTarget[]
|
||||||
|
/** 是否需要人工检查。 */
|
||||||
|
requiresManualReview: boolean
|
||||||
|
/** 后端摘要。 */
|
||||||
|
summary: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 已有公开质量状态中的候选基础字段。 */
|
||||||
|
type VideoQualityChainBase = ShotVideoQualityStatus['chain'][number]
|
||||||
|
|
||||||
|
/** 单个候选的持久化质量记录。 */
|
||||||
|
export interface VideoQualityChainItem extends VideoQualityChainBase {
|
||||||
|
/** 本次视觉校验的问题详情。 */
|
||||||
|
issues: QualityIssue[]
|
||||||
|
/** 错误数量。 */
|
||||||
|
errorCount: number
|
||||||
|
/** 警告数量。 */
|
||||||
|
warningCount: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 请求 detail=true 时的完整质量链。 */
|
||||||
|
export interface VideoQualityDetail extends Omit<ShotVideoQualityStatus, 'issues' | 'chain'> {
|
||||||
|
/** 最近一次质量问题。 */
|
||||||
|
issues: QualityIssue[]
|
||||||
|
/** 当前失败链的实际记录。 */
|
||||||
|
chain: VideoQualityChainItem[]
|
||||||
|
/** 耗尽后的确定性归因,未耗尽时为空。 */
|
||||||
|
exhaustionAnalysis: VideoQualityExhaustionAnalysis | null
|
||||||
|
}
|
||||||
@@ -39,12 +39,17 @@ export function isActiveVideo(item: ShotVideo): boolean {
|
|||||||
return ['pending', 'queued', 'running'].includes(item.status)
|
return ['pending', 'queued', 'running'].includes(item.status)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 就绪问题转为短标签,后端详细 reason 仍在页面原样显示。 */
|
/**
|
||||||
|
* 就绪问题转为可直接理解的中文短标签,未知问题仍显示明确提示。
|
||||||
|
* @param code 后端就绪问题码
|
||||||
|
* @returns 页面显示的中文问题标签
|
||||||
|
*/
|
||||||
export function issueLabel(code: ProductionIssueCode): string {
|
export function issueLabel(code: ProductionIssueCode): string {
|
||||||
const labels: Record<ProductionIssueCode, string> = {
|
const labels: Record<ProductionIssueCode, string> = {
|
||||||
invalid_generation_spec: '生成规格不完整',
|
invalid_generation_spec: '生成规格不完整',
|
||||||
missing_visual_style: '缺少视觉风格',
|
missing_visual_style: '缺少视觉风格',
|
||||||
missing_reference: '缺少主体参考图',
|
missing_reference: '缺少主体参考图',
|
||||||
|
missing_primary_keyframe: '缺少可用首帧',
|
||||||
missing_identity: '缺少角色身份',
|
missing_identity: '缺少角色身份',
|
||||||
missing_identity_anchor: '缺少演员母版',
|
missing_identity_anchor: '缺少演员母版',
|
||||||
identity_unlocked: '演员身份未锁定',
|
identity_unlocked: '演员身份未锁定',
|
||||||
@@ -52,9 +57,10 @@ export function issueLabel(code: ProductionIssueCode): string {
|
|||||||
stale_prompt: '视频提示词需要更新',
|
stale_prompt: '视频提示词需要更新',
|
||||||
provider_input_recovery: '视频模型输入需要处理',
|
provider_input_recovery: '视频模型输入需要处理',
|
||||||
missing_keyframe: '缺少主首帧',
|
missing_keyframe: '缺少主首帧',
|
||||||
stale_keyframe: '主首帧已过期'
|
stale_keyframe: '主首帧已过期',
|
||||||
|
failed_keyframe_quality: '首帧画面检查未通过'
|
||||||
}
|
}
|
||||||
return labels[code]
|
return labels[code] ?? '生成条件需要完善'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 生产状态中文标签,未知值由状态组件回退显示原文。 */
|
/** 生产状态中文标签,未知值由状态组件回退显示原文。 */
|
||||||
@@ -74,3 +80,16 @@ export function productionStatusLabel(status: string): string {
|
|||||||
}
|
}
|
||||||
return labels[status] ?? status
|
return labels[status] ?? status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 视频质量链状态标签与后端状态机保持一致。 */
|
||||||
|
export function videoQualityStatusLabel(status: string): string {
|
||||||
|
const labels: Record<string, string> = {
|
||||||
|
not_started: '尚未开始质量流程',
|
||||||
|
generating: '正在生成候选视频',
|
||||||
|
validating: '正在执行质量校验',
|
||||||
|
repairing: '正在自动修复',
|
||||||
|
passed: '质量校验通过',
|
||||||
|
exhausted: '自动修复次数已用完'
|
||||||
|
}
|
||||||
|
return labels[status] ?? status
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import { issueLabel } from './model'
|
||||||
|
import type { ProductionIssue } from './types'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把后端生产原因转换为普通用户可读的中文提示。
|
||||||
|
* @param message 后端原始说明或错误信息
|
||||||
|
* @returns 页面展示的中文说明
|
||||||
|
*/
|
||||||
|
export function productionMessage(message: string): string {
|
||||||
|
const text = message.trim()
|
||||||
|
if (!text) return ''
|
||||||
|
if (
|
||||||
|
/(?:Primary Keyframe|主首帧|首帧)/i.test(text) &&
|
||||||
|
/(?:视觉|画面)(?:质量)?(?:校验|检查).*?(?:未通过|失败)/.test(text)
|
||||||
|
)
|
||||||
|
return '首帧画面检查未通过,请重新生成或修复首帧。'
|
||||||
|
if (/(?:Video Prompt|视频提示词).*未绑定.*(?:Primary Keyframe|首帧)/i.test(text))
|
||||||
|
return '视频提示词与当前首帧不一致,请重新生成视频提示词。'
|
||||||
|
if (/空间目标绑定.*(?:变化|变更|调整)/.test(text)) return '镜头画面设置已调整,请重新生成并检查首帧。'
|
||||||
|
if (/缺少.*(?:Primary Keyframe|主首帧)/i.test(text)) return '还没有可用首帧,请先生成并确认首帧。'
|
||||||
|
if (/(?:Primary Keyframe|主首帧).*(?:过期|旧版|参考资产.*变化)/i.test(text))
|
||||||
|
return '当前首帧需要更新,请重新生成并检查首帧。'
|
||||||
|
if (/fetch failed|failed to fetch|network error/i.test(text)) return '暂时无法连接服务,请稍后重新获取。'
|
||||||
|
const translated = text
|
||||||
|
.replace(/Storyboard Shot/gi, '镜头')
|
||||||
|
.replace(/Primary Keyframe/gi, '首帧')
|
||||||
|
.replace(/Video Prompt/gi, '视频提示词')
|
||||||
|
.replace(/Motion Plan/gi, '动作设计')
|
||||||
|
.replace(/Identity Anchor/gi, '身份母版')
|
||||||
|
.replace(/SubjectForm/gi, '主体形态')
|
||||||
|
.replace(/Provider/gi, '生成模型')
|
||||||
|
.replace(/\bShot\b/gi, '镜头')
|
||||||
|
.replace(/服务器内部错误[::]?\s*/g, '')
|
||||||
|
.replace(/\s*[::]?\s*\bc[a-z0-9]{20,}\b/g, '')
|
||||||
|
.trim()
|
||||||
|
return /[\u4e00-\u9fff]/.test(translated) ? translated : '暂时无法读取生成信息,请稍后重新获取。'
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将就绪检查问题转换为页面说明,不改变原始问题数据。
|
||||||
|
* @param issue 后端结构化就绪问题
|
||||||
|
* @returns 页面展示的原因与处理建议
|
||||||
|
*/
|
||||||
|
export function productionIssueText(issue: ProductionIssue): string {
|
||||||
|
if (issue.code === 'failed_keyframe_quality') return '首帧画面检查未通过,请重新生成或修复首帧。'
|
||||||
|
return productionMessage(issue.reason) || issueLabel(issue.code)
|
||||||
|
}
|
||||||
@@ -3,7 +3,8 @@ import type {
|
|||||||
ImageProviderCapability,
|
ImageProviderCapability,
|
||||||
KeyframeRepair,
|
KeyframeRepair,
|
||||||
KeyframeValidation,
|
KeyframeValidation,
|
||||||
QualityBatchResult,
|
KeyframeQualityStart,
|
||||||
|
KeyframeValidationHistoryItem,
|
||||||
QualityInput,
|
QualityInput,
|
||||||
ShotProviderCapability,
|
ShotProviderCapability,
|
||||||
VideoValidation,
|
VideoValidation,
|
||||||
@@ -19,9 +20,16 @@ export const qualityApi = {
|
|||||||
),
|
),
|
||||||
providers: (signal?: AbortSignal) =>
|
providers: (signal?: AbortSignal) =>
|
||||||
request<ImageProviderCapability[]>('/image-providers/capabilities', { signal }),
|
request<ImageProviderCapability[]>('/image-providers/capabilities', { signal }),
|
||||||
capability: (shotId: string, signal?: AbortSignal) =>
|
/**
|
||||||
|
* 只读检查本次选择模型的实际参考图规划能力。
|
||||||
|
* @param shotId 正式镜头 ID
|
||||||
|
* @param signal 取消信号
|
||||||
|
* @param provider 本次明确选择的模型
|
||||||
|
* @returns 后端实际能力和参考图规划
|
||||||
|
*/
|
||||||
|
capability: (shotId: string, signal?: AbortSignal, provider?: string) =>
|
||||||
request<ShotProviderCapability>(
|
request<ShotProviderCapability>(
|
||||||
`/storyboard-shots/${encodeURIComponent(shotId)}/keyframe-provider-capability`,
|
`/storyboard-shots/${encodeURIComponent(shotId)}/keyframe-provider-capability${provider ? `?provider=${encodeURIComponent(provider)}` : ''}`,
|
||||||
{ signal }
|
{ signal }
|
||||||
),
|
),
|
||||||
validateKeyframe: (shotId: string, assetId: string, allowedTexts: string[]) =>
|
validateKeyframe: (shotId: string, assetId: string, allowedTexts: string[]) =>
|
||||||
@@ -43,8 +51,26 @@ export const qualityApi = {
|
|||||||
`/storyboard-shots/${encodeURIComponent(shotId)}/videos/${encodeURIComponent(assetId)}/validate`,
|
`/storyboard-shots/${encodeURIComponent(shotId)}/videos/${encodeURIComponent(assetId)}/validate`,
|
||||||
{ method: 'POST', body: { allowedTexts }, timeoutMs: 0 }
|
{ method: 'POST', body: { allowedTexts }, timeoutMs: 0 }
|
||||||
),
|
),
|
||||||
|
/**
|
||||||
|
* 只读查询指定首帧的已有校验历史。
|
||||||
|
* @param shotId 正式镜头 ID
|
||||||
|
* @param keyframeId 指定首帧 ID
|
||||||
|
* @param signal 取消信号
|
||||||
|
* @returns 后端保存的校验记录列表
|
||||||
|
*/
|
||||||
|
keyframeHistory: (shotId: string, keyframeId: string, signal?: AbortSignal) =>
|
||||||
|
request<KeyframeValidationHistoryItem[]>(
|
||||||
|
`/storyboard-shots/${encodeURIComponent(shotId)}/keyframes/${encodeURIComponent(keyframeId)}/validations`,
|
||||||
|
{ signal }
|
||||||
|
),
|
||||||
|
/**
|
||||||
|
* 启动后台首帧质量生成,不把任务开始当作视觉通过。
|
||||||
|
* @param projectId 正式项目 ID
|
||||||
|
* @param input 已确认的镜头、模型和费用范围
|
||||||
|
* @returns 真实后台任务观察句柄
|
||||||
|
*/
|
||||||
generate: (projectId: string, input: QualityInput) =>
|
generate: (projectId: string, input: QualityInput) =>
|
||||||
request<QualityBatchResult>(`/projects/${encodeURIComponent(projectId)}/keyframes/generate-quality`, {
|
request<KeyframeQualityStart>(`/projects/${encodeURIComponent(projectId)}/keyframes/generate-quality`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: input,
|
body: input,
|
||||||
timeoutMs: 0
|
timeoutMs: 0
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { validOptionalSize } from './model'
|
import { validOptionalSize } from './model'
|
||||||
import type { KeyframeReadiness } from './types'
|
import type { KeyframeReadiness } from './types'
|
||||||
import type { QualityInput, QualityReceipt, QualityTarget, VisualValidation, VideoValidation } from './quality.types'
|
import type {
|
||||||
|
QualityBatchResult,
|
||||||
|
QualityInput,
|
||||||
|
QualityReceipt,
|
||||||
|
QualityTarget,
|
||||||
|
VisualValidation,
|
||||||
|
VideoValidation
|
||||||
|
} from './quality.types'
|
||||||
|
|
||||||
/** 未返回的操作不显示上次成功结论;网络失败不会自动重发。 */
|
/** 未返回的操作不显示上次成功结论;网络失败不会自动重发。 */
|
||||||
const sessions = reactive<
|
const sessions = reactive<
|
||||||
@@ -13,7 +20,7 @@ export function qualityKey(projectId: string, target: QualityTarget | null) {
|
|||||||
return JSON.stringify([
|
return JSON.stringify([
|
||||||
projectId,
|
projectId,
|
||||||
target?.kind,
|
target?.kind,
|
||||||
target && ('assetId' in target ? [target.shotId, target.assetId] : target.episodeNo)
|
target && ('assetId' in target ? [target.shotId, target.assetId] : [target.episodeNo, target.shotId])
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,21 +51,56 @@ export function validQualityInput(input: QualityInput) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 与后端保持同一优先级:全项目有过期项时先筛过期,再按当前集筛选。 */
|
/**
|
||||||
|
* 按真实后端就绪结果、剧集与指定镜头过滤,过期与缺失项均保留。
|
||||||
|
* @param readiness 后端就绪列表
|
||||||
|
* @param input 已确认的批次参数
|
||||||
|
* @returns 实际候选镜头
|
||||||
|
*/
|
||||||
export function qualityTargets(readiness: KeyframeReadiness, input: QualityInput) {
|
export function qualityTargets(readiness: KeyframeReadiness, input: QualityInput) {
|
||||||
return readiness.items
|
return readiness.items
|
||||||
.filter(
|
.filter(
|
||||||
item =>
|
item =>
|
||||||
item.status === 'ready' &&
|
item.status === 'ready' &&
|
||||||
(input.force ||
|
item.episodeNo === input.episodeNo &&
|
||||||
(readiness.stalePrimaryKeyframe > 0
|
(!input.shotId || item.shotId === input.shotId)
|
||||||
? item.primaryKeyframeStale === true
|
|
||||||
: !item.primaryKeyframeId)) &&
|
|
||||||
item.episodeNo === input.episodeNo
|
|
||||||
)
|
)
|
||||||
.slice(0, input.limit)
|
.slice(0, input.limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析数据库 JSON 校验结论;原始模型文字不能代替真实结构化结果。
|
||||||
|
* @param output 历史任务输出
|
||||||
|
* @returns 完整视觉结论或空值
|
||||||
|
*/
|
||||||
|
export function parseKeyframeValidationOutput(output: unknown): VisualValidation | null {
|
||||||
|
try {
|
||||||
|
const value: unknown = typeof output === 'string' ? JSON.parse(output) : output
|
||||||
|
return isVisualValidation(value) ? value : null
|
||||||
|
} catch {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区分最终逐镜回执与 202 句柄,防止后台开始被显示为完成。
|
||||||
|
* @param value 后端任务最终结果
|
||||||
|
* @returns 是否具有完整计数和逐镜结果
|
||||||
|
*/
|
||||||
|
export function isQualityBatchResult(value: unknown): value is QualityBatchResult {
|
||||||
|
if (!value || typeof value !== 'object') return false
|
||||||
|
const item = value as QualityBatchResult
|
||||||
|
return (
|
||||||
|
Array.isArray(item.results) &&
|
||||||
|
[item.targetCount, item.selected, item.passed, item.repairFailed, item.failed].every(
|
||||||
|
number => Number.isSafeInteger(number) && number >= 0
|
||||||
|
) &&
|
||||||
|
item.results.length === item.targetCount &&
|
||||||
|
item.passed + item.repairFailed + item.failed === item.targetCount &&
|
||||||
|
item.results.every(result => typeof result.shotId === 'string' && typeof result.success === 'boolean')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/** 最小响应校验,避免畸形响应或仅 HTTP 200 被显示成视觉通过。 */
|
/** 最小响应校验,避免畸形响应或仅 HTTP 200 被显示成视觉通过。 */
|
||||||
export function isVisualValidation(value: unknown): value is VisualValidation {
|
export function isVisualValidation(value: unknown): value is VisualValidation {
|
||||||
if (!value || typeof value !== 'object') return false
|
if (!value || typeof value !== 'object') return false
|
||||||
@@ -89,3 +131,13 @@ export function isVisualValidation(value: unknown): value is VisualValidation {
|
|||||||
export function sessionVideoValidation(projectId: string, shotId: string, assetId: string): VideoValidation | null {
|
export function sessionVideoValidation(projectId: string, shotId: string, assetId: string): VideoValidation | null {
|
||||||
return qualitySession(qualityKey(projectId, { kind: 'video', shotId, assetId, title: '' })).videoValidation ?? null
|
return qualitySession(qualityKey(projectId, { kind: 'video', shotId, assetId, title: '' })).videoValidation ?? null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 手动晋升仍只使用本会话实际校验回执,读取历史不改变晋升政策。 */
|
||||||
|
export function sessionKeyframePassed(projectId: string, shotId: string, assetId: string): boolean | null {
|
||||||
|
const receipt = qualitySession(qualityKey(projectId, { kind: 'keyframe', shotId, assetId, title: '' })).receipt
|
||||||
|
if (receipt?.kind === 'keyframe' && receipt.result.keyframeId === assetId) return receipt.result.passed
|
||||||
|
if (receipt?.kind !== 'repair') return null
|
||||||
|
if (receipt.result.finalKeyframeId === assetId) return receipt.result.passed
|
||||||
|
if (!receipt.result.repaired && receipt.result.initialKeyframeId === assetId) return receipt.result.passed
|
||||||
|
return null
|
||||||
|
}
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
/** 校验入口绑定正式镜头与资产 ID;批量默认只处理当前集。 */
|
/** 校验入口绑定正式镜头与资产 ID;批量默认只处理当前集。 */
|
||||||
export type QualityTarget =
|
export type QualityTarget =
|
||||||
| { kind: 'keyframe' | 'video'; shotId: string; assetId: string; title: string }
|
| { kind: 'keyframe' | 'video'; shotId: string; assetId: string; title: string }
|
||||||
| { kind: 'batch'; episodeNo: number; title: string }
|
| {
|
||||||
|
kind: 'batch'
|
||||||
|
/** 当前剧集 */ episodeNo: number
|
||||||
|
/** 指定单镜头 */ shotId?: string
|
||||||
|
/** 显示标题 */ title: string
|
||||||
|
}
|
||||||
|
|
||||||
/** 质量操作与普通生成独立,不复用生产面板的覆盖、并发或范围。 */
|
/** 质量操作与普通生成独立,不复用生产面板的覆盖、并发或范围。 */
|
||||||
export type QualityAction = 'validate' | 'repair' | 'batch'
|
export type QualityAction = 'validate' | 'repair' | 'batch'
|
||||||
@@ -122,13 +127,27 @@ export interface QualityBatchResult {
|
|||||||
|
|
||||||
/** 首帧质量生成配置;limit 强制由前端填写,避免无意执行全项目。 */
|
/** 首帧质量生成配置;limit 强制由前端填写,避免无意执行全项目。 */
|
||||||
export interface QualityInput {
|
export interface QualityInput {
|
||||||
|
/** 本批并发数 */
|
||||||
concurrency: number
|
concurrency: number
|
||||||
|
/** 每镜修复次数上限 */
|
||||||
maxRepairAttempts: number
|
maxRepairAttempts: number
|
||||||
|
/** 是否重做有效首帧 */
|
||||||
force: boolean
|
force: boolean
|
||||||
|
/** 固定本批剧集 */
|
||||||
episodeNo: number
|
episodeNo: number
|
||||||
|
/** 本批镜头上限 */
|
||||||
limit: number
|
limit: number
|
||||||
|
/** 指定镜头,单镜头重跑固定 limit=1 */
|
||||||
|
shotId?: string
|
||||||
|
/** 图片供应方 */
|
||||||
|
provider?: string
|
||||||
|
/** 首次生成与修复共享模型参数 */
|
||||||
|
generationOptions?: import('../generation-config/types').GenerationOptions
|
||||||
|
/** 允许的画面文字 */
|
||||||
allowedTexts?: string[]
|
allowedTexts?: string[]
|
||||||
|
/** 输出宽度 */
|
||||||
width?: number
|
width?: number
|
||||||
|
/** 输出高度 */
|
||||||
height?: number
|
height?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,10 +160,23 @@ export interface ImageProviderCapability {
|
|||||||
|
|
||||||
/** 只读能力检查不切换模型;无法满足参考图数量时阻止生图。 */
|
/** 只读能力检查不切换模型;无法满足参考图数量时阻止生图。 */
|
||||||
export interface ShotProviderCapability {
|
export interface ShotProviderCapability {
|
||||||
|
/** 本次检查的图片模型。 */
|
||||||
provider: string
|
provider: string
|
||||||
|
/** 镜头完整业务参考图候选数量。 */
|
||||||
referenceCount: number
|
referenceCount: number
|
||||||
|
/** 模型声明的实际输入上限。 */
|
||||||
maxReferenceImages: number | null
|
maxReferenceImages: number | null
|
||||||
|
/** 后端规划将输入模型的图片数量。 */
|
||||||
|
plannedReferenceCount?: number
|
||||||
|
/** 转为文字约束的参考图数量。 */
|
||||||
|
omittedReferenceCount?: number
|
||||||
|
/** 是否需要参考图规划。 */
|
||||||
|
requiresPlanning?: boolean
|
||||||
|
/** 后端实际规划策略。 */
|
||||||
|
strategy?: string
|
||||||
|
/** 规划后是否满足模型能力。 */
|
||||||
valid: boolean
|
valid: boolean
|
||||||
|
/** 后端实际能力或参考图规划说明。 */
|
||||||
message?: string
|
message?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,3 +192,33 @@ export type QualityReceipt =
|
|||||||
export type VideoValidationCheck =
|
export type VideoValidationCheck =
|
||||||
| { enabled: false; reason: string }
|
| { enabled: false; reason: string }
|
||||||
| { enabled: true; passed: boolean; summary: string; applicable?: boolean; [key: string]: unknown }
|
| { enabled: true; passed: boolean; summary: string; applicable?: boolean; [key: string]: unknown }
|
||||||
|
|
||||||
|
/** 首帧质量后台任务启动回执,不包含最终校验结论。 */
|
||||||
|
export interface KeyframeQualityStart {
|
||||||
|
/** 后台任务编号 */
|
||||||
|
executionId: string
|
||||||
|
/** 原项目编号 */
|
||||||
|
projectId: string
|
||||||
|
/** 后台已启动 */
|
||||||
|
status: 'running'
|
||||||
|
/** 本批镜头数 */
|
||||||
|
total: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 已保存的只读首帧校验任务记录。 */
|
||||||
|
export interface KeyframeValidationHistoryItem {
|
||||||
|
/** 校验任务编号 */
|
||||||
|
id: string
|
||||||
|
/** 任务状态,保留后端原值 */
|
||||||
|
status: string
|
||||||
|
/** 数据库保存的 JSON 输出 */
|
||||||
|
output: string | Record<string, unknown> | null
|
||||||
|
/** 调用错误 */
|
||||||
|
error: string | null
|
||||||
|
/** 开始时间 */
|
||||||
|
startedAt: string | null
|
||||||
|
/** 结束时间 */
|
||||||
|
finishedAt: string | null
|
||||||
|
/** 创建时间 */
|
||||||
|
createdAt: string
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import type { GenerationOptions, ResolvedGenerationConfig } from '../generation-config/types'
|
||||||
|
|
||||||
/** 项目生产链的就绪状态;进行中只会出现在视频阶段。 */
|
/** 项目生产链的就绪状态;进行中只会出现在视频阶段。 */
|
||||||
export type ProductionReadinessStatus = 'ready' | 'skipped' | 'in_progress' | 'blocked'
|
export type ProductionReadinessStatus = 'ready' | 'skipped' | 'in_progress' | 'blocked'
|
||||||
|
|
||||||
@@ -6,6 +8,7 @@ export type ProductionIssueCode =
|
|||||||
| 'invalid_generation_spec'
|
| 'invalid_generation_spec'
|
||||||
| 'missing_visual_style'
|
| 'missing_visual_style'
|
||||||
| 'missing_reference'
|
| 'missing_reference'
|
||||||
|
| 'missing_primary_keyframe'
|
||||||
| 'missing_identity'
|
| 'missing_identity'
|
||||||
| 'missing_identity_anchor'
|
| 'missing_identity_anchor'
|
||||||
| 'identity_unlocked'
|
| 'identity_unlocked'
|
||||||
@@ -14,6 +17,8 @@ export type ProductionIssueCode =
|
|||||||
| 'provider_input_recovery'
|
| 'provider_input_recovery'
|
||||||
| 'missing_keyframe'
|
| 'missing_keyframe'
|
||||||
| 'stale_keyframe'
|
| 'stale_keyframe'
|
||||||
|
/** 当前主首帧最新画面检查未通过。 */
|
||||||
|
| 'failed_keyframe_quality'
|
||||||
|
|
||||||
/** 就绪检查中的具体阻塞原因;部分参考图问题会附带主体引用。 */
|
/** 就绪检查中的具体阻塞原因;部分参考图问题会附带主体引用。 */
|
||||||
export interface ProductionIssue {
|
export interface ProductionIssue {
|
||||||
@@ -25,6 +30,7 @@ export interface ProductionIssue {
|
|||||||
/** 视频提示词就绪检查的逐镜结果。 */
|
/** 视频提示词就绪检查的逐镜结果。 */
|
||||||
export interface PromptReadinessItem {
|
export interface PromptReadinessItem {
|
||||||
shotId: string
|
shotId: string
|
||||||
|
episodeNo: number
|
||||||
shotNo: number
|
shotNo: number
|
||||||
status: Exclude<ProductionReadinessStatus, 'in_progress'>
|
status: Exclude<ProductionReadinessStatus, 'in_progress'>
|
||||||
stalePrompt?: boolean
|
stalePrompt?: boolean
|
||||||
@@ -64,6 +70,7 @@ export interface KeyframeReadiness extends PromptReadiness {
|
|||||||
/** 视频任务就绪检查的逐镜结果。 */
|
/** 视频任务就绪检查的逐镜结果。 */
|
||||||
export interface VideoReadinessItem {
|
export interface VideoReadinessItem {
|
||||||
shotId: string
|
shotId: string
|
||||||
|
episodeNo: number
|
||||||
shotNo: number
|
shotNo: number
|
||||||
status: ProductionReadinessStatus
|
status: ProductionReadinessStatus
|
||||||
issues: ProductionIssue[]
|
issues: ProductionIssue[]
|
||||||
@@ -74,6 +81,37 @@ export interface VideoReadinessItem {
|
|||||||
providerInputRecovery?: ProviderInputRecoveryStatus | null
|
providerInputRecovery?: ProviderInputRecoveryStatus | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 后端确定性选择的视频模型输入模式。 */
|
||||||
|
export type VideoInputMode = 'first_frame' | 'omni_reference'
|
||||||
|
|
||||||
|
/** 单镜头输入规划;只读预览不会创建模型任务。 */
|
||||||
|
export interface VideoInputPlan {
|
||||||
|
shotId: string
|
||||||
|
inputMode: VideoInputMode
|
||||||
|
reasons: string[]
|
||||||
|
metrics: {
|
||||||
|
characterCount: number
|
||||||
|
propCount: number
|
||||||
|
sceneCount: number
|
||||||
|
referenceCount: number
|
||||||
|
hasMultipleCharacters: boolean
|
||||||
|
hasProp: boolean
|
||||||
|
hasCharacterPropInteraction: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 当前项目或剧集内可生成镜头的输入模式分布。 */
|
||||||
|
export interface ProjectVideoInputPlan {
|
||||||
|
projectId: string
|
||||||
|
provider: string
|
||||||
|
episodeNo: number | null
|
||||||
|
projectReadyCount: number
|
||||||
|
readyCount: number
|
||||||
|
firstFrameCount: number
|
||||||
|
omniReferenceCount: number
|
||||||
|
plans: VideoInputPlan[]
|
||||||
|
}
|
||||||
|
|
||||||
/** 视频任务项目级就绪汇总。 */
|
/** 视频任务项目级就绪汇总。 */
|
||||||
export interface VideoReadiness {
|
export interface VideoReadiness {
|
||||||
total: number
|
total: number
|
||||||
@@ -241,9 +279,9 @@ export interface GenerateKeyframesInput {
|
|||||||
|
|
||||||
/** 单镜头首帧生成参数。 */
|
/** 单镜头首帧生成参数。 */
|
||||||
export interface GenerateKeyframeInput {
|
export interface GenerateKeyframeInput {
|
||||||
width?: number
|
|
||||||
height?: number
|
|
||||||
setPrimary: boolean
|
setPrimary: boolean
|
||||||
|
provider?: string
|
||||||
|
generationOptions?: Record<string, string | number | boolean>
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 首帧批量生成回执;详细阻塞原因应配合 readiness 查看。 */
|
/** 首帧批量生成回执;详细阻塞原因应配合 readiness 查看。 */
|
||||||
@@ -265,13 +303,20 @@ export interface KeyframeBatchResult {
|
|||||||
export interface VideoQualityConfig {
|
export interface VideoQualityConfig {
|
||||||
allowedTexts?: string[]
|
allowedTexts?: string[]
|
||||||
maxRepairAttempts: number
|
maxRepairAttempts: number
|
||||||
|
provider?: string
|
||||||
|
inputMode?: VideoInputMode
|
||||||
|
generationOptions?: Record<string, string | number | boolean>
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 项目级严格视频质量生成参数;limit 限制本次实际提交的镜头数。 */
|
/** 项目级严格视频质量生成参数;limit 限制本次实际提交的镜头数。 */
|
||||||
export interface GenerateQualityVideosInput extends VideoQualityConfig {
|
export interface GenerateQualityVideosInput extends VideoQualityConfig {
|
||||||
concurrency: number
|
concurrency: number
|
||||||
force: boolean
|
force: boolean
|
||||||
|
/** 仅处理当前剧集,避免批量操作误跑全项目。 */
|
||||||
|
episodeNo?: number
|
||||||
limit?: number
|
limit?: number
|
||||||
|
/** 只提交后端 Planner 判定为该模式的镜头。 */
|
||||||
|
inputMode?: VideoInputMode
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 单镜头严格视频质量任务回执;candidate 只是异步候选,不代表已经通过校验。 */
|
/** 单镜头严格视频质量任务回执;candidate 只是异步候选,不代表已经通过校验。 */
|
||||||
@@ -290,6 +335,8 @@ export interface VideoQualityBatchResult {
|
|||||||
qualityPipeline: Required<VideoQualityConfig>
|
qualityPipeline: Required<VideoQualityConfig>
|
||||||
total: number
|
total: number
|
||||||
readyTargetCount: number
|
readyTargetCount: number
|
||||||
|
episodeTargetCount?: number
|
||||||
|
filteredTargetCount?: number
|
||||||
targetCount: number
|
targetCount: number
|
||||||
remainingReady: number
|
remainingReady: number
|
||||||
created: number
|
created: number
|
||||||
@@ -299,6 +346,7 @@ export interface VideoQualityBatchResult {
|
|||||||
failed: number
|
failed: number
|
||||||
readiness: Omit<VideoReadiness, 'total' | 'items'>
|
readiness: Omit<VideoReadiness, 'total' | 'items'>
|
||||||
failures: { shotId: string; error: string }[]
|
failures: { shotId: string; error: string }[]
|
||||||
|
inputPlans?: VideoInputPlan[]
|
||||||
candidateIds: string[]
|
candidateIds: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,6 +376,28 @@ export interface ProjectVideoStatus {
|
|||||||
items: ProjectVideoStatusItem[]
|
items: ProjectVideoStatusItem[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 单镜头严格质量链的持久化状态;读取不会重新调用模型。 */
|
||||||
|
export interface ShotVideoQualityStatus {
|
||||||
|
shotId: string
|
||||||
|
status: 'not_started' | 'generating' | 'validating' | 'repairing' | 'passed' | 'exhausted'
|
||||||
|
primaryVideoId: string | null
|
||||||
|
latestVideoId: string | null
|
||||||
|
repairAttempt: number
|
||||||
|
maxRepairAttempts: number | null
|
||||||
|
validationPassed: boolean | null
|
||||||
|
issues: unknown[]
|
||||||
|
chain: {
|
||||||
|
videoId: string
|
||||||
|
providerStatus: ShotVideo['status']
|
||||||
|
isPrimary: boolean
|
||||||
|
repairAttempt: number
|
||||||
|
maxRepairAttempts: number | null
|
||||||
|
validationPassed: boolean | null
|
||||||
|
createdAt: string
|
||||||
|
updatedAt: string
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
|
||||||
/** 失败视频批量重试回执。 */
|
/** 失败视频批量重试回执。 */
|
||||||
export interface RetryVideosResult {
|
export interface RetryVideosResult {
|
||||||
totalFailed: number
|
totalFailed: number
|
||||||
@@ -354,6 +424,8 @@ export interface ProductionSession {
|
|||||||
/** 串联生产回执;completed 由后端核对全部当前有效主资产后给出。 */
|
/** 串联生产回执;completed 由后端核对全部当前有效主资产后给出。 */
|
||||||
export interface ProductionPipelineResult {
|
export interface ProductionPipelineResult {
|
||||||
projectId: string
|
projectId: string
|
||||||
|
/** 稳定身份母版生成的实际汇总。 */
|
||||||
|
stableIdentityAnchorResult?: Pick<PipelineBatchResult, 'total' | 'generated' | 'failed'>
|
||||||
visualPromptResult?: PipelineBatchResult
|
visualPromptResult?: PipelineBatchResult
|
||||||
subjectImageResult?: PipelineBatchResult
|
subjectImageResult?: PipelineBatchResult
|
||||||
videoPromptResult?: PipelineBatchResult
|
videoPromptResult?: PipelineBatchResult
|
||||||
@@ -374,8 +446,10 @@ export interface ProductionPipelineResult {
|
|||||||
/** 后端串联节点只有汇总数量,逐项失败信息保留在 errors。 */
|
/** 后端串联节点只有汇总数量,逐项失败信息保留在 errors。 */
|
||||||
export interface PipelineBatchResult {
|
export interface PipelineBatchResult {
|
||||||
total: number
|
total: number
|
||||||
|
targetCount?: number
|
||||||
generated: number
|
generated: number
|
||||||
skipped: number
|
skipped: number
|
||||||
|
blocked?: number
|
||||||
failed: number
|
failed: number
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +465,7 @@ export interface VideoInputKeyframe {
|
|||||||
export type ProviderInputRecoveryStatus = 'not_required' | 'required' | 'variant_ready' | 'exhausted'
|
export type ProviderInputRecoveryStatus = 'not_required' | 'required' | 'variant_ready' | 'exhausted'
|
||||||
|
|
||||||
/** 项目当前制作阶段,与剧本创作状态分别展示。 */
|
/** 项目当前制作阶段,与剧本创作状态分别展示。 */
|
||||||
export type ProductionStage = 'subject_images' | 'keyframes' | 'videos' | 'completed'
|
export type ProductionStatusStage = 'subject_images' | 'keyframes' | 'videos' | 'completed'
|
||||||
|
|
||||||
/** 主体参考图的公开就绪明细,阻塞原因由后端提供。 */
|
/** 主体参考图的公开就绪明细,阻塞原因由后端提供。 */
|
||||||
export interface SubjectImageReadinessItem {
|
export interface SubjectImageReadinessItem {
|
||||||
@@ -418,8 +492,21 @@ export interface ProductionPlanStage {
|
|||||||
/** 后端执行计划只读取资产,不触发模型生成。 */
|
/** 后端执行计划只读取资产,不触发模型生成。 */
|
||||||
export interface ProductionPlan {
|
export interface ProductionPlan {
|
||||||
projectId: string
|
projectId: string
|
||||||
|
providers: { image: string; video: string }
|
||||||
|
/** 实际解析后的图片模型与参数。 */
|
||||||
|
generationConfig?: { image?: ResolvedGenerationConfig }
|
||||||
completed: boolean
|
completed: boolean
|
||||||
stage: ProductionStage
|
canStart: boolean
|
||||||
|
canAutoRun: boolean
|
||||||
|
entryReadiness?: { ready: boolean; reason?: string | null }
|
||||||
|
/** 角色身份实际就绪汇总。 */
|
||||||
|
characterIdentity?: ProductionCharacterIdentityPlan
|
||||||
|
/** 稳定身份母版阶段与真实逐项计划。 */
|
||||||
|
stableIdentityAnchors?: ProductionPlanStage & {
|
||||||
|
/** 稳定主体的逐项就绪结果。 */
|
||||||
|
items?: ProductionStableIdentityItem[]
|
||||||
|
}
|
||||||
|
stage: ProductionStatusStage
|
||||||
hasManualBlockers: boolean
|
hasManualBlockers: boolean
|
||||||
manualBlocked: number
|
manualBlocked: number
|
||||||
subjectImages: ProductionPlanStage
|
subjectImages: ProductionPlanStage
|
||||||
@@ -427,6 +514,8 @@ export interface ProductionPlan {
|
|||||||
videoPrompts: ProductionPlanStage
|
videoPrompts: ProductionPlanStage
|
||||||
videos: ProductionPlanStage
|
videos: ProductionPlanStage
|
||||||
details: {
|
details: {
|
||||||
|
/** 稳定身份母版的逐项计划。 */
|
||||||
|
stableIdentityAnchors?: ProductionStableIdentityItem[]
|
||||||
subjectImages: SubjectImageReadinessItem[]
|
subjectImages: SubjectImageReadinessItem[]
|
||||||
keyframes: KeyframeReadinessItem[]
|
keyframes: KeyframeReadinessItem[]
|
||||||
videoPrompts: PromptReadinessItem[]
|
videoPrompts: PromptReadinessItem[]
|
||||||
@@ -438,7 +527,7 @@ export interface ProductionPlan {
|
|||||||
export interface ProjectProductionStatus {
|
export interface ProjectProductionStatus {
|
||||||
projectId: string
|
projectId: string
|
||||||
completed: boolean
|
completed: boolean
|
||||||
stage: ProductionStage
|
stage: ProductionStatusStage
|
||||||
subjectImages: {
|
subjectImages: {
|
||||||
total: number
|
total: number
|
||||||
current: number
|
current: number
|
||||||
@@ -484,6 +573,7 @@ export interface PipelineKeyframeQualityResult {
|
|||||||
skipped: number
|
skipped: number
|
||||||
blocked: number
|
blocked: number
|
||||||
stalePrimaryKeyframe: number
|
stalePrimaryKeyframe: number
|
||||||
|
targetCount?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 指定模型的最终输入查询回执;此接口不会生成图片或视频。 */
|
/** 指定模型的最终输入查询回执;此接口不会生成图片或视频。 */
|
||||||
@@ -543,3 +633,62 @@ export interface EpisodeAssemblyResult {
|
|||||||
durationSeconds: number
|
durationSeconds: number
|
||||||
videoUrl: string
|
videoUrl: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 后端允许恢复或正常停止的生产阶段。 */
|
||||||
|
export type ProductionStage = 'subjectImages' | 'keyframes' | 'videoPrompts'
|
||||||
|
|
||||||
|
/** 无消耗生产计划与实际启动共用的模型配置。 */
|
||||||
|
export interface ProductionPlanInput {
|
||||||
|
/** 本轮图片模型供应方。 */
|
||||||
|
imageProvider?: string
|
||||||
|
/** 主体图片与首帧共用的图片生成参数。 */
|
||||||
|
imageGenerationOptions?: GenerationOptions
|
||||||
|
/** 本轮视频模型供应方。 */
|
||||||
|
videoProvider?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 后端生产启动范围;上限必须是大于零的整数。 */
|
||||||
|
export interface ProductionStartInput extends ProductionPlanInput {
|
||||||
|
/** 从具备前置资产的阶段继续。 */
|
||||||
|
startFrom?: ProductionStage
|
||||||
|
/** 完成此阶段后正常停止;省略则允许提交视频。 */
|
||||||
|
stopAfter?: ProductionStage
|
||||||
|
/** 本轮稳定身份母版上限。 */
|
||||||
|
stableIdentityAnchorLimit?: number
|
||||||
|
/** 本轮主体图上限。 */
|
||||||
|
subjectImageLimit?: number
|
||||||
|
/** 本轮首帧上限。 */
|
||||||
|
keyframeLimit?: number
|
||||||
|
/** 本轮视频提示词上限。 */
|
||||||
|
videoPromptLimit?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 生产计划中的角色身份汇总,字段遵循后端实际返回。 */
|
||||||
|
export interface ProductionCharacterIdentityPlan {
|
||||||
|
/** 角色数量。 */
|
||||||
|
total: number
|
||||||
|
/** 已锁定身份数量。 */
|
||||||
|
ready: number
|
||||||
|
/** 待处理数量。 */
|
||||||
|
pending: number
|
||||||
|
/** 生产流程可自动处理数量。 */
|
||||||
|
autoResolvable: number
|
||||||
|
/** 需要人工选角数量。 */
|
||||||
|
manualBlocked: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 后端稳定身份母版计划的单个主体。 */
|
||||||
|
export interface ProductionStableIdentityItem {
|
||||||
|
/** 数据库主体 ID。 */
|
||||||
|
subjectId: string
|
||||||
|
/** 主体引用标识。 */
|
||||||
|
subjectRef: string
|
||||||
|
/** 主体名称。 */
|
||||||
|
subjectName: string
|
||||||
|
/** 主体模块。 */
|
||||||
|
module: string
|
||||||
|
/** 已就绪、待生成、上游可补齐或人工阻塞。 */
|
||||||
|
status: 'skipped' | 'ready' | 'upstream' | 'blocked'
|
||||||
|
/** 后端提供的就绪或阻塞原因。 */
|
||||||
|
reason: string
|
||||||
|
}
|
||||||
@@ -4,17 +4,28 @@ import { useProjectContext } from '../projects/context'
|
|||||||
import { subjectImagesApi } from '../subject-images/api'
|
import { subjectImagesApi } from '../subject-images/api'
|
||||||
import { hasRunningImages } from '../subject-images/model'
|
import { hasRunningImages } from '../subject-images/model'
|
||||||
import { getOperation, runOperation } from '../workflows/operations'
|
import { getOperation, runOperation } from '../workflows/operations'
|
||||||
|
import { useWorkflowExecution } from '../workflows/execution'
|
||||||
import { hasRunningWorkflow } from '../workflows/selectors'
|
import { hasRunningWorkflow } from '../workflows/selectors'
|
||||||
import { errorMessage } from '../../lib/http'
|
import { ApiError, errorMessage } from '../../lib/http'
|
||||||
import { generationConfigApi } from '../generation-config/api'
|
import { generationConfigApi } from '../generation-config/api'
|
||||||
import { productionApi } from './api'
|
import { productionApi } from './api'
|
||||||
import { getProductionSession } from './model'
|
import { getProductionSession } from './model'
|
||||||
|
import type { ProductionStartInput, ProductionStage } from './types'
|
||||||
|
|
||||||
/** 使用后端计划区分可自动补齐和人工阻塞,保留项目归属及活动任务检查。 */
|
/**
|
||||||
export async function checkPipeline(projectId: string) {
|
* 使用后端计划区分可自动补齐和人工阻塞,保留项目归属及活动任务检查。
|
||||||
|
* @param projectId 当前项目 ID
|
||||||
|
* @param scope 已选择的生产范围
|
||||||
|
* @returns 无消耗计划、实际状态与同源请求参数
|
||||||
|
*/
|
||||||
|
export async function checkPipeline(projectId: string, scope: ProductionStartInput = {}) {
|
||||||
const profile = await generationConfigApi.profile(projectId)
|
const profile = await generationConfigApi.profile(projectId)
|
||||||
const providers = profile
|
const providers = profile
|
||||||
? { imageProvider: profile.imageProvider, videoProvider: profile.videoProvider }
|
? {
|
||||||
|
imageProvider: profile.imageProvider,
|
||||||
|
videoProvider: profile.videoProvider,
|
||||||
|
imageGenerationOptions: { ...profile.imageOptions }
|
||||||
|
}
|
||||||
: undefined
|
: undefined
|
||||||
const [project, checkpoints, forms, plan, status] = await Promise.all([
|
const [project, checkpoints, forms, plan, status] = await Promise.all([
|
||||||
projectsApi.detail(projectId),
|
projectsApi.detail(projectId),
|
||||||
@@ -31,7 +42,9 @@ export async function checkPipeline(projectId: string) {
|
|||||||
)
|
)
|
||||||
throw new Error('预检返回了其他项目的数据,请重新读取。')
|
throw new Error('预检返回了其他项目的数据,请重新读取。')
|
||||||
const issues: string[] = []
|
const issues: string[] = []
|
||||||
if (!profile) issues.push('尚未配置项目画布与生成模型,请先在批量生产工具中保存配置。')
|
if (plan.entryReadiness && !plan.entryReadiness.ready)
|
||||||
|
issues.push(plan.entryReadiness.reason || '项目尚未满足生产入口条件。')
|
||||||
|
if (!profile) issues.push('尚未配置项目画布与生成模型,请先在右上角“项目配置”中保存配置。')
|
||||||
const shotIds = new Set(plan.details.keyframes.map(item => item.shotId))
|
const shotIds = new Set(plan.details.keyframes.map(item => item.shotId))
|
||||||
if (
|
if (
|
||||||
shotIds.size !== plan.keyframes.total ||
|
shotIds.size !== plan.keyframes.total ||
|
||||||
@@ -67,23 +80,61 @@ export async function checkPipeline(projectId: string) {
|
|||||||
status,
|
status,
|
||||||
profile,
|
profile,
|
||||||
shotCount: plan.keyframes.total,
|
shotCount: plan.keyframes.total,
|
||||||
|
input: { ...scope, ...providers } as ProductionStartInput,
|
||||||
checkedAt: new Date().toISOString()
|
checkedAt: new Date().toISOString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 预检不付费;确认后再次预检并锁住本浏览器项目,长请求不自动重发。 */
|
/**
|
||||||
|
* 预检不付费;确认后再次预检并锁住本浏览器项目,长请求不自动重发。
|
||||||
|
* @returns 生产范围、预检状态及一次性提交操作
|
||||||
|
*/
|
||||||
export function useAdvancedProduction() {
|
export function useAdvancedProduction() {
|
||||||
const context = useProjectContext()
|
const context = useProjectContext()
|
||||||
|
/** 当前项目 ID。 */
|
||||||
const id = computed(() => context.project.value?.id ?? '')
|
const id = computed(() => context.project.value?.id ?? '')
|
||||||
|
/** 项目级操作锁。 */
|
||||||
const operation = computed(() => getOperation(id.value))
|
const operation = computed(() => getOperation(id.value))
|
||||||
|
/** 项目生产回执。 */
|
||||||
const session = computed(() => getProductionSession(id.value))
|
const session = computed(() => getProductionSession(id.value))
|
||||||
|
const execution = useWorkflowExecution(id, 'production')
|
||||||
|
/** 正在读取预检。 */
|
||||||
const checking = ref(false)
|
const checking = ref(false)
|
||||||
|
/** 预检错误或已有任务说明。 */
|
||||||
const error = ref('')
|
const error = ref('')
|
||||||
|
/** 默认使用无视频测试模式,只有用户明确切换后才允许提交高费用视频任务。 */
|
||||||
|
const safeMode = ref(true)
|
||||||
|
/** 本轮有限首帧数量,保留原安全模式字段。 */
|
||||||
|
const testKeyframeLimit = ref<number | null>(1)
|
||||||
|
/** 恢复起点;留空从默认入口开始。 */
|
||||||
|
const startFrom = ref<ProductionStage | null>(null)
|
||||||
|
/** 显式结束阶段;安全模式下为空时默认在视频提示词后停止。 */
|
||||||
|
const stopAfter = ref<ProductionStage | null>(null)
|
||||||
|
/** 本轮稳定身份母版上限。 */
|
||||||
|
const stableIdentityAnchorLimit = ref<number | null>(1)
|
||||||
|
/** 本轮主体图片上限。 */
|
||||||
|
const subjectImageLimit = ref<number | null>(1)
|
||||||
|
/** 本轮视频提示词上限。 */
|
||||||
|
const videoPromptLimit = ref<number | null>(1)
|
||||||
|
/** 可供界面和确认描述共用的生产范围。 */
|
||||||
|
const scope = computed<ProductionStartInput>(() => ({
|
||||||
|
...(startFrom.value ? { startFrom: startFrom.value } : {}),
|
||||||
|
...(stopAfter.value || safeMode.value ? { stopAfter: stopAfter.value ?? 'videoPrompts' } : {}),
|
||||||
|
stableIdentityAnchorLimit: stableIdentityAnchorLimit.value ?? 0,
|
||||||
|
subjectImageLimit: subjectImageLimit.value ?? 0,
|
||||||
|
keyframeLimit: testKeyframeLimit.value ?? 0,
|
||||||
|
videoPromptLimit: videoPromptLimit.value ?? 0
|
||||||
|
}))
|
||||||
|
/** 阶段顺序与后端正整数约束。 */
|
||||||
|
const scopeError = computed(() => validateProductionScope(scope.value))
|
||||||
|
/** 已读取的预检与其不可变请求快照。 */
|
||||||
const check = ref<Awaited<ReturnType<typeof checkPipeline>> | null>(null)
|
const check = ref<Awaited<ReturnType<typeof checkPipeline>> | null>(null)
|
||||||
|
/** 当前项目不可提交条件。 */
|
||||||
const blocked = computed(
|
const blocked = computed(
|
||||||
() =>
|
() =>
|
||||||
!id.value ||
|
!id.value ||
|
||||||
operation.value.pending ||
|
operation.value.pending ||
|
||||||
|
execution.active.value ||
|
||||||
!!context.error.value ||
|
!!context.error.value ||
|
||||||
context.project.value?.status !== 'completed'
|
context.project.value?.status !== 'completed'
|
||||||
)
|
)
|
||||||
@@ -100,15 +151,27 @@ export function useAdvancedProduction() {
|
|||||||
checking.value = false
|
checking.value = false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
[scope, safeMode],
|
||||||
|
() => {
|
||||||
|
version++
|
||||||
|
check.value = null
|
||||||
|
checking.value = false
|
||||||
|
error.value = ''
|
||||||
|
},
|
||||||
|
{ deep: true, flush: 'sync' }
|
||||||
|
)
|
||||||
|
|
||||||
|
/** 只读取无消耗计划,保存此次范围与模型参数。 */
|
||||||
async function preflight() {
|
async function preflight() {
|
||||||
if (blocked.value || checking.value) return
|
if (blocked.value || checking.value || scopeError.value) return
|
||||||
const current = ++version
|
const current = ++version
|
||||||
const projectId = id.value
|
const projectId = id.value
|
||||||
checking.value = true
|
checking.value = true
|
||||||
check.value = null
|
check.value = null
|
||||||
error.value = ''
|
error.value = ''
|
||||||
try {
|
try {
|
||||||
const result = await checkPipeline(projectId)
|
const result = await checkPipeline(projectId, scope.value)
|
||||||
if (current === version && id.value === projectId) check.value = result
|
if (current === version && id.value === projectId) check.value = result
|
||||||
} catch (cause) {
|
} catch (cause) {
|
||||||
if (current === version) error.value = errorMessage(cause)
|
if (current === version) error.value = errorMessage(cause)
|
||||||
@@ -117,9 +180,11 @@ export function useAdvancedProduction() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 确认后校验参数快照并提交一次;冲突时观察现有任务。 */
|
||||||
async function start() {
|
async function start() {
|
||||||
if (
|
if (
|
||||||
blocked.value ||
|
blocked.value ||
|
||||||
|
!!scopeError.value ||
|
||||||
checking.value ||
|
checking.value ||
|
||||||
!check.value ||
|
!check.value ||
|
||||||
check.value.projectId !== id.value ||
|
check.value.projectId !== id.value ||
|
||||||
@@ -128,37 +193,121 @@ export function useAdvancedProduction() {
|
|||||||
return
|
return
|
||||||
const projectId = id.value
|
const projectId = id.value
|
||||||
const target = getProductionSession(projectId)
|
const target = getProductionSession(projectId)
|
||||||
|
const confirmedInput = JSON.stringify(check.value.input)
|
||||||
|
const confirmedVersion = version
|
||||||
let submitted = false
|
let submitted = false
|
||||||
await runOperation(projectId, '高级串联生产', async () => {
|
await runOperation(projectId, '高级串联生产', async () => {
|
||||||
const result = await checkPipeline(projectId)
|
const result = await checkPipeline(projectId, scope.value)
|
||||||
if (
|
if (
|
||||||
|
confirmedVersion !== version ||
|
||||||
disposed ||
|
disposed ||
|
||||||
id.value !== projectId ||
|
id.value !== projectId ||
|
||||||
context.project.value?.status !== 'completed' ||
|
context.project.value?.status !== 'completed' ||
|
||||||
context.error.value
|
context.error.value
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
if (JSON.stringify(result.input) !== confirmedInput) {
|
||||||
|
check.value = null
|
||||||
|
throw new Error('项目模型或图片参数已变化,请重新预检并确认费用。')
|
||||||
|
}
|
||||||
check.value = result
|
check.value = result
|
||||||
if (result.issues.length) throw new Error('提交前预检发现条件变化,未启动生产。请处理下方问题。')
|
if (result.issues.length) throw new Error('提交前预检发现条件变化,未启动生产。请处理下方问题。')
|
||||||
target.pipelineReceipt = null
|
target.pipelineReceipt = null
|
||||||
submitted = true
|
submitted = true
|
||||||
const receipt = await productionApi.startPipeline(
|
let started
|
||||||
projectId,
|
try {
|
||||||
result.profile
|
started = await productionApi.startPipeline(projectId, result.input)
|
||||||
? {
|
} catch (cause) {
|
||||||
imageProvider: result.profile.imageProvider,
|
if (
|
||||||
videoProvider: result.profile.videoProvider
|
cause instanceof ApiError &&
|
||||||
}
|
cause.status === 409 &&
|
||||||
: undefined
|
cause.details &&
|
||||||
)
|
typeof cause.details === 'object' &&
|
||||||
if (!receipt || receipt.projectId !== projectId)
|
'executionId' in cause.details &&
|
||||||
throw new Error('回执项目不匹配,请读取资产状态核对,不要直接重试。')
|
typeof cause.details.executionId === 'string' &&
|
||||||
target.pipelineReceipt = receipt
|
cause.details.executionId
|
||||||
|
) {
|
||||||
|
if (!disposed && id.value === projectId)
|
||||||
|
error.value = '已有任务:已附着当前生产后台任务,请等待其结束。'
|
||||||
|
await execution.track(cause.details.executionId, projectId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
throw cause
|
||||||
|
}
|
||||||
|
if (!started.executionId) throw new Error('后端未返回 Production executionId,请勿重复提交。')
|
||||||
|
await execution.track(started.executionId, projectId)
|
||||||
})
|
})
|
||||||
if (!disposed && id.value === projectId) {
|
if (!disposed && id.value === projectId) {
|
||||||
if (submitted) check.value = null
|
if (submitted) check.value = null
|
||||||
await context.refresh()
|
await context.refresh()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { id, operation, session, checking, error, check, blocked, preflight, start }
|
watch(
|
||||||
|
() => execution.query.data.value?.status,
|
||||||
|
async (status, previous) => {
|
||||||
|
if ((status === 'completed' || status === 'failed') && status !== previous) {
|
||||||
|
const result = execution.query.data.value?.result
|
||||||
|
if (status === 'completed' && result && typeof result === 'object') {
|
||||||
|
targetPipelineReceipt(id.value, result, session.value)
|
||||||
|
}
|
||||||
|
await context.refresh()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
id,
|
||||||
|
operation,
|
||||||
|
session,
|
||||||
|
execution,
|
||||||
|
checking,
|
||||||
|
error,
|
||||||
|
check,
|
||||||
|
blocked,
|
||||||
|
safeMode,
|
||||||
|
testKeyframeLimit,
|
||||||
|
startFrom,
|
||||||
|
stopAfter,
|
||||||
|
stableIdentityAnchorLimit,
|
||||||
|
subjectImageLimit,
|
||||||
|
videoPromptLimit,
|
||||||
|
scope,
|
||||||
|
scopeError,
|
||||||
|
preflight,
|
||||||
|
start
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成任务结果只在项目归属正确时保存为回执。
|
||||||
|
* @param projectId 当前项目 ID
|
||||||
|
* @param result 后端真实完成结果
|
||||||
|
* @param session 当前项目回执容器
|
||||||
|
*/
|
||||||
|
function targetPipelineReceipt(projectId: string, result: object, session: ReturnType<typeof getProductionSession>) {
|
||||||
|
if (!projectId || !('projectId' in result) || result.projectId !== projectId) return
|
||||||
|
session.pipelineReceipt = result as import('./types').ProductionPipelineResult
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证后端阶段枚举、顺序和本轮生成上限。
|
||||||
|
* @param input 本轮启动范围
|
||||||
|
* @returns 可直接展示的阻断原因;空字符串表示有效
|
||||||
|
*/
|
||||||
|
export function validateProductionScope(input: ProductionStartInput): string {
|
||||||
|
const stages: ProductionStage[] = ['subjectImages', 'keyframes', 'videoPrompts']
|
||||||
|
if (
|
||||||
|
(input.startFrom && !stages.includes(input.startFrom)) ||
|
||||||
|
(input.stopAfter && !stages.includes(input.stopAfter))
|
||||||
|
)
|
||||||
|
return '请选择有效的生产阶段。'
|
||||||
|
if (input.startFrom && input.stopAfter && stages.indexOf(input.startFrom) > stages.indexOf(input.stopAfter))
|
||||||
|
return '结束阶段不能早于起始阶段。'
|
||||||
|
if (
|
||||||
|
[input.stableIdentityAnchorLimit, input.subjectImageLimit, input.keyframeLimit, input.videoPromptLimit].some(
|
||||||
|
value => value !== undefined && (!Number.isInteger(value) || value <= 0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return '所有生成上限必须是大于 0 的整数。'
|
||||||
|
return ''
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,18 @@
|
|||||||
import { computed, ref } from 'vue'
|
import { useShotSelection } from '../storyboard/useShotSelection'
|
||||||
import { useQuery } from '../../composables/useQuery'
|
import type { KeyframeBatchResult } from './types'
|
||||||
|
import type { PromptBatchResult } from '../storyboard/types'
|
||||||
|
import { computed, ref, watch } from 'vue'
|
||||||
|
import { usePolling } from '../../composables/usePolling'
|
||||||
import { useProjectContext } from '../projects/context'
|
import { useProjectContext } from '../projects/context'
|
||||||
import { mergeDesignedShots } from '../storyboard/model'
|
import { currentEpisodeSource, getStoryboardSession, mergeDesignedShots } from '../storyboard/model'
|
||||||
import { storyboardApi } from '../storyboard/api'
|
import { storyboardApi } from '../storyboard/api'
|
||||||
import { breakdownSnapshot } from '../workflows/selectors'
|
import { breakdownSnapshot } from '../workflows/selectors'
|
||||||
import { getOperation, runOperation } from '../workflows/operations'
|
import { getOperation, runOperation } from '../workflows/operations'
|
||||||
|
import { useWorkflowExecution } from '../workflows/execution'
|
||||||
import { productionApi } from './api'
|
import { productionApi } from './api'
|
||||||
import { getProductionSession, validOptionalSize } from './model'
|
import { getProductionSession, validOptionalSize } from './model'
|
||||||
|
import type { VideoInputMode } from './types'
|
||||||
|
import { errorMessage } from '../../lib/http'
|
||||||
|
|
||||||
/** 项目级生产动作;每次请求都由统一项目锁防止重复提交。 */
|
/** 项目级生产动作;每次请求都由统一项目锁防止重复提交。 */
|
||||||
export type ProductionCommand = 'prompts' | 'keyframes' | 'videos' | 'retry-videos'
|
export type ProductionCommand = 'prompts' | 'keyframes' | 'videos' | 'retry-videos'
|
||||||
@@ -14,20 +20,35 @@ export type ProductionCommand = 'prompts' | 'keyframes' | 'videos' | 'retry-vide
|
|||||||
/** 镜头生产页的查询、筛选、就绪状态与批量操作。 */
|
/** 镜头生产页的查询、筛选、就绪状态与批量操作。 */
|
||||||
export function useProduction() {
|
export function useProduction() {
|
||||||
const context = useProjectContext()
|
const context = useProjectContext()
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const id = computed(() => context.project.value?.id ?? '')
|
const id = computed(() => context.project.value?.id ?? '')
|
||||||
const selectedEpisode = ref<number>()
|
/** 两个镜头工作区共用地址选择,刷新恢复同一正式镜头。 */
|
||||||
const selectedShot = ref('')
|
const { selectedEpisode, selectedShot } = useShotSelection(() => episodeNo.value)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const concurrency = ref(2)
|
const concurrency = ref(2)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const force = ref(false)
|
const force = ref(false)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const keyframeLimit = ref<number | ''>('')
|
const keyframeLimit = ref<number | ''>('')
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const keyframeWidth = ref<number | ''>('')
|
const keyframeWidth = ref<number | ''>('')
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const keyframeHeight = ref<number | ''>('')
|
const keyframeHeight = ref<number | ''>('')
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
|
const promptLimit = ref<number | null>(1)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const videoLimit = ref<number | null>(1)
|
const videoLimit = ref<number | null>(1)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const videoRepairAttempts = ref<number | null>(2)
|
const videoRepairAttempts = ref<number | null>(2)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
|
const videoInputMode = ref<VideoInputMode | 'all'>('all')
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const snapshot = computed(() => breakdownSnapshot(context.checkpoints.value))
|
const snapshot = computed(() => breakdownSnapshot(context.checkpoints.value))
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const sourceEpisodes = computed(
|
const sourceEpisodes = computed(
|
||||||
() => snapshot.value?.storyboardEpisodeShots ?? snapshot.value?.breakdownResult?.storyboardEpisodeShots ?? []
|
() => snapshot.value?.storyboardEpisodeShots ?? snapshot.value?.breakdownResult?.storyboardEpisodeShots ?? []
|
||||||
)
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const episodeOptions = computed(() => {
|
const episodeOptions = computed(() => {
|
||||||
const entries = new Map(context.project.value?.episodes.map(episode => [episode.episode, episode.title]) ?? [])
|
const entries = new Map(context.project.value?.episodes.map(episode => [episode.episode, episode.title]) ?? [])
|
||||||
for (const episode of sourceEpisodes.value) {
|
for (const episode of sourceEpisodes.value) {
|
||||||
@@ -37,42 +58,90 @@ export function useProduction() {
|
|||||||
.map(([episodeNo, title]) => ({ episodeNo, title }))
|
.map(([episodeNo, title]) => ({ episodeNo, title }))
|
||||||
.toSorted((a, b) => a.episodeNo - b.episodeNo)
|
.toSorted((a, b) => a.episodeNo - b.episodeNo)
|
||||||
})
|
})
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const episodeNo = computed(
|
const episodeNo = computed(
|
||||||
() =>
|
() =>
|
||||||
episodeOptions.value.find(item => item.episodeNo === selectedEpisode.value)?.episodeNo ??
|
episodeOptions.value.find(item => item.episodeNo === selectedEpisode.value)?.episodeNo ??
|
||||||
episodeOptions.value[0]?.episodeNo ??
|
episodeOptions.value[0]?.episodeNo ??
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const queryKey = computed(() => JSON.stringify([id.value, episodeNo.value, force.value]))
|
const queryKey = computed(() => JSON.stringify([id.value, episodeNo.value, force.value]))
|
||||||
/** 生产页已有刷新按钮,就绪状态改为手动更新。 */
|
/** 就绪状态在进入、切集或自身操作完成后读取,不定时刷新。 */
|
||||||
const query = useQuery(queryKey, async (key, signal) => {
|
const query = usePolling(
|
||||||
const [projectId, number, overwrite] = JSON.parse(key) as [string, number, boolean]
|
queryKey,
|
||||||
if (!projectId || !number) return null
|
async (key, signal) => {
|
||||||
const [directions, prompts, keyframes, videos, videoStatus] = await Promise.all([
|
const [projectId, number, overwrite] = JSON.parse(key) as [string, number, boolean]
|
||||||
storyboardApi.directions(projectId, number, signal),
|
if (!projectId || !number) return null
|
||||||
productionApi.promptReadiness(projectId, overwrite, signal),
|
const [directions, prompts, keyframes, videos, videoStatus, videoInputPlanState] = await Promise.all([
|
||||||
productionApi.keyframeReadiness(projectId, overwrite, signal),
|
storyboardApi.directions(projectId, number, signal),
|
||||||
productionApi.videoReadiness(projectId, overwrite, signal),
|
productionApi.promptReadiness(projectId, overwrite, signal),
|
||||||
productionApi.projectVideoStatus(projectId, signal)
|
productionApi.keyframeReadiness(projectId, overwrite, signal),
|
||||||
])
|
productionApi.videoReadiness(projectId, overwrite, signal),
|
||||||
if (directions.projectId !== projectId || directions.episodeNo !== number)
|
productionApi.projectVideoStatus(projectId, signal),
|
||||||
throw new Error('镜头生产查询返回了不匹配的项目或剧集,请刷新后重试。')
|
productionApi
|
||||||
return { directions, prompts, keyframes, videos, videoStatus }
|
.videoInputPlans(projectId, number, signal)
|
||||||
})
|
.then(data => ({ data, error: '' }))
|
||||||
const source = computed(() => sourceEpisodes.value.find(item => item.episodeNo === episodeNo.value))
|
.catch(cause => ({ data: null, error: errorMessage(cause) }))
|
||||||
|
])
|
||||||
|
if (directions.projectId !== projectId || directions.episodeNo !== number)
|
||||||
|
throw new Error('镜头生产查询返回了不匹配的项目或剧集,请刷新后重试。')
|
||||||
|
return {
|
||||||
|
directions,
|
||||||
|
prompts,
|
||||||
|
keyframes,
|
||||||
|
videos,
|
||||||
|
videoStatus,
|
||||||
|
videoInputPlans: videoInputPlanState.data,
|
||||||
|
videoInputPlansError: videoInputPlanState.error
|
||||||
|
}
|
||||||
|
},
|
||||||
|
false
|
||||||
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
|
/** 重生成后不拿旧剧情快照补充新的正式镜头。 */
|
||||||
|
const source = computed(() =>
|
||||||
|
currentEpisodeSource(
|
||||||
|
id.value,
|
||||||
|
episodeNo.value,
|
||||||
|
sourceEpisodes.value.find(item => item.episodeNo === episodeNo.value)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
/** 未取得重生成后的正文时,只展示正式镜头编号,不填充旧剧情或时长。 */
|
||||||
|
const episodeSourceUnavailable = computed(
|
||||||
|
() => !!getStoryboardSession(id.value).invalidatedEpisodeSources[episodeNo.value]
|
||||||
|
)
|
||||||
|
/** 当前剧集的正式镜头目录。 */
|
||||||
const shots = computed(() => mergeDesignedShots(query.data.value?.directions ?? null, null, source.value))
|
const shots = computed(() => mergeDesignedShots(query.data.value?.directions ?? null, null, source.value))
|
||||||
const shot = computed(() => shots.value.find(item => item.shotId === selectedShot.value) ?? shots.value[0])
|
/** 明确指定的镜头不存在时不代选其它镜头;首次进入才选择第一镜。 */
|
||||||
|
const shot = computed(() =>
|
||||||
|
selectedShot.value ? shots.value.find(item => item.shotId === selectedShot.value) : shots.value[0]
|
||||||
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const promptItem = computed(() => query.data.value?.prompts.items.find(item => item.shotId === shot.value?.shotId))
|
const promptItem = computed(() => query.data.value?.prompts.items.find(item => item.shotId === shot.value?.shotId))
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const keyframeItem = computed(() =>
|
const keyframeItem = computed(() =>
|
||||||
query.data.value?.keyframes.items.find(item => item.shotId === shot.value?.shotId)
|
query.data.value?.keyframes.items.find(item => item.shotId === shot.value?.shotId)
|
||||||
)
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const videoItem = computed(() => query.data.value?.videos.items.find(item => item.shotId === shot.value?.shotId))
|
const videoItem = computed(() => query.data.value?.videos.items.find(item => item.shotId === shot.value?.shotId))
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const videoStatusItem = computed(() =>
|
const videoStatusItem = computed(() =>
|
||||||
query.data.value?.videoStatus.items.find(item => item.shotId === shot.value?.shotId)
|
query.data.value?.videoStatus.items.find(item => item.shotId === shot.value?.shotId)
|
||||||
)
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const operation = computed(() => getOperation(id.value))
|
const operation = computed(() => getOperation(id.value))
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const session = computed(() => getProductionSession(id.value))
|
const session = computed(() => getProductionSession(id.value))
|
||||||
|
/** 普通首帧后台观察器,刷新页面后恢复真实执行状态。 */
|
||||||
|
const keyframeExecution = useWorkflowExecution(id, 'keyframe-generation')
|
||||||
|
const promptExecution = useWorkflowExecution(id, 'video-prompt')
|
||||||
|
const videoExecution = useWorkflowExecution(id, 'video-quality')
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const batchValid = computed(() => Number.isSafeInteger(concurrency.value) && concurrency.value > 0)
|
const batchValid = computed(() => Number.isSafeInteger(concurrency.value) && concurrency.value > 0)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
|
const promptValid = computed(() => Number.isSafeInteger(promptLimit.value) && (promptLimit.value ?? 0) > 0)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const keyframeValid = computed(
|
const keyframeValid = computed(
|
||||||
() =>
|
() =>
|
||||||
(keyframeLimit.value === '' || (Number.isSafeInteger(keyframeLimit.value) && keyframeLimit.value > 0)) &&
|
(keyframeLimit.value === '' || (Number.isSafeInteger(keyframeLimit.value) && keyframeLimit.value > 0)) &&
|
||||||
@@ -86,20 +155,64 @@ export function useProduction() {
|
|||||||
Number.isSafeInteger(videoRepairAttempts.value) &&
|
Number.isSafeInteger(videoRepairAttempts.value) &&
|
||||||
(videoRepairAttempts.value ?? 0) > 0
|
(videoRepairAttempts.value ?? 0) > 0
|
||||||
)
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const blocked = computed(
|
const blocked = computed(
|
||||||
() =>
|
() =>
|
||||||
operation.value.pending ||
|
operation.value.pending ||
|
||||||
|
promptExecution.active.value ||
|
||||||
|
videoExecution.active.value ||
|
||||||
!!context.error.value ||
|
!!context.error.value ||
|
||||||
!!query.error.value ||
|
!!query.error.value ||
|
||||||
!query.data.value ||
|
!query.data.value ||
|
||||||
context.project.value?.status !== 'completed'
|
context.project.value?.status !== 'completed'
|
||||||
)
|
)
|
||||||
|
|
||||||
/** 批量操作只向就绪镜头提交;最终资产状态由显式刷新确认。 */
|
/** 后台质量任务收口后重新读取资产;失败也要保留已经成功的镜头状态。 */
|
||||||
|
watch(
|
||||||
|
() => videoExecution.query.data.value?.status,
|
||||||
|
(status, previous) => {
|
||||||
|
if ((status === 'completed' || status === 'failed') && status !== previous) void query.refresh()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
/** 观察后台状态变化并同步正式资产。 */
|
||||||
|
watch(
|
||||||
|
() => promptExecution.query.data.value?.status,
|
||||||
|
(status, previous) => {
|
||||||
|
const record = promptExecution.query.data.value
|
||||||
|
if (status === 'completed' && record?.projectId === id.value && record.result) {
|
||||||
|
const result = record.result as unknown as PromptBatchResult
|
||||||
|
if (typeof result.total === 'number' && Array.isArray(result.failures)) {
|
||||||
|
getProductionSession(record.projectId).receipt = {
|
||||||
|
kind: 'prompts',
|
||||||
|
title: '项目视频提示词',
|
||||||
|
result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((status === 'completed' || status === 'failed') && status !== previous) void query.refresh()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
/** 普通首帧任务完成后才展示后端回执;失败仍刷新已经保存的资产。 */
|
||||||
|
watch(
|
||||||
|
() => keyframeExecution.query.data.value,
|
||||||
|
record => {
|
||||||
|
if (!record || record.projectId !== id.value || !['completed', 'failed'].includes(record.status)) return
|
||||||
|
if (record.status === 'completed' && record.result) {
|
||||||
|
const result = record.result as unknown as KeyframeBatchResult
|
||||||
|
if (typeof result.total !== 'number' || !Array.isArray(result.failures)) return
|
||||||
|
getProductionSession(record.projectId).receipt = { kind: 'keyframes', title: '项目首帧生成', result }
|
||||||
|
}
|
||||||
|
void query.refresh()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
/** 批量操作只向就绪镜头提交;最终资产状态由轮询查询确认。 */
|
||||||
async function run(command: ProductionCommand) {
|
async function run(command: ProductionCommand) {
|
||||||
if (
|
if (
|
||||||
blocked.value ||
|
blocked.value ||
|
||||||
!batchValid.value ||
|
!batchValid.value ||
|
||||||
|
(command === 'prompts' && !promptValid.value) ||
|
||||||
(command === 'keyframes' && !keyframeValid.value) ||
|
(command === 'keyframes' && !keyframeValid.value) ||
|
||||||
(command === 'videos' && !videoQualityValid.value)
|
(command === 'videos' && !videoQualityValid.value)
|
||||||
)
|
)
|
||||||
@@ -126,35 +239,32 @@ export function useProduction() {
|
|||||||
}
|
}
|
||||||
await runOperation(projectId, labels[command], async () => {
|
await runOperation(projectId, labels[command], async () => {
|
||||||
if (command === 'prompts') {
|
if (command === 'prompts') {
|
||||||
target.receipt = {
|
const started = await productionApi.startPromptExecution(projectId, {
|
||||||
kind: 'prompts',
|
...input,
|
||||||
title: labels[command],
|
episodeNo: episodeNo.value,
|
||||||
result: await productionApi.generatePrompts(projectId, input)
|
limit: promptLimit.value ?? undefined
|
||||||
}
|
})
|
||||||
|
await promptExecution.track(started.executionId, projectId)
|
||||||
} else if (command === 'keyframes') {
|
} else if (command === 'keyframes') {
|
||||||
target.receipt = {
|
const started = await productionApi.generateKeyframes(projectId, {
|
||||||
kind: 'keyframes',
|
...input,
|
||||||
title: labels[command],
|
// 有 stale 时由后端优先处理全部 stale;否则只补当前剧集,避免误跑整个项目。
|
||||||
result: await productionApi.generateKeyframes(projectId, {
|
...(force.value || staleKeyframes > 0 ? {} : { episodeNo: episodeNo.value }),
|
||||||
...input,
|
...(keyframeLimit.value === '' ? {} : { limit: keyframeLimit.value }),
|
||||||
// 有 stale 时由后端优先处理全部 stale;否则只补当前剧集,避免误跑整个项目。
|
...(keyframeWidth.value === '' || keyframeHeight.value === ''
|
||||||
...(force.value || staleKeyframes > 0 ? {} : { episodeNo: episodeNo.value }),
|
? {}
|
||||||
...(keyframeLimit.value === '' ? {} : { limit: keyframeLimit.value }),
|
: { width: keyframeWidth.value, height: keyframeHeight.value })
|
||||||
...(keyframeWidth.value === '' || keyframeHeight.value === ''
|
})
|
||||||
? {}
|
await keyframeExecution.track(started.executionId, projectId)
|
||||||
: { width: keyframeWidth.value, height: keyframeHeight.value })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else if (command === 'videos') {
|
} else if (command === 'videos') {
|
||||||
target.receipt = {
|
const started = await productionApi.startQualityVideoExecution(projectId, {
|
||||||
kind: 'videos',
|
...input,
|
||||||
title: labels[command],
|
episodeNo: episodeNo.value,
|
||||||
result: await productionApi.generateQualityVideos(projectId, {
|
limit: videoLimit.value ?? undefined,
|
||||||
...input,
|
...(videoInputMode.value === 'all' ? {} : { inputMode: videoInputMode.value }),
|
||||||
limit: videoLimit.value ?? undefined,
|
maxRepairAttempts: videoRepairAttempts.value ?? 0
|
||||||
maxRepairAttempts: videoRepairAttempts.value ?? 0
|
})
|
||||||
})
|
await videoExecution.track(started.executionId, projectId)
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
target.receipt = {
|
target.receipt = {
|
||||||
kind: 'retry',
|
kind: 'retry',
|
||||||
@@ -179,6 +289,7 @@ export function useProduction() {
|
|||||||
videoItem,
|
videoItem,
|
||||||
videoStatusItem,
|
videoStatusItem,
|
||||||
query,
|
query,
|
||||||
|
episodeSourceUnavailable,
|
||||||
operation,
|
operation,
|
||||||
session,
|
session,
|
||||||
concurrency,
|
concurrency,
|
||||||
@@ -186,12 +297,18 @@ export function useProduction() {
|
|||||||
keyframeLimit,
|
keyframeLimit,
|
||||||
keyframeWidth,
|
keyframeWidth,
|
||||||
keyframeHeight,
|
keyframeHeight,
|
||||||
|
promptLimit,
|
||||||
videoLimit,
|
videoLimit,
|
||||||
videoRepairAttempts,
|
videoRepairAttempts,
|
||||||
|
videoInputMode,
|
||||||
keyframeValid,
|
keyframeValid,
|
||||||
|
promptValid,
|
||||||
videoQualityValid,
|
videoQualityValid,
|
||||||
batchValid,
|
batchValid,
|
||||||
blocked,
|
blocked,
|
||||||
run
|
run,
|
||||||
|
keyframeExecution,
|
||||||
|
promptExecution,
|
||||||
|
videoExecution
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import { computed, onScopeDispose } from 'vue'
|
import { computed, onScopeDispose, watch } from 'vue'
|
||||||
|
import { useWorkflowExecution } from '../workflows/execution'
|
||||||
|
import { isQualityBatchResult } from './quality'
|
||||||
import { projectsApi } from '../projects/api'
|
import { projectsApi } from '../projects/api'
|
||||||
import { hasRunningWorkflow } from '../workflows/selectors'
|
import { hasRunningWorkflow } from '../workflows/selectors'
|
||||||
import { getOperation, runOperation } from '../workflows/operations'
|
import { getOperation, runOperation } from '../workflows/operations'
|
||||||
@@ -26,22 +28,82 @@ function validAttempts(attempts: RepairAttempt[]) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 统一质量操作:只读预检 → 显式付费请求 → 按原目标保存回执,不自动重试。 */
|
/**
|
||||||
|
* 只读预检后显式启动质量操作,按原目标保存回执与后台状态。
|
||||||
|
* @param props 当前项目、目标和阻断状态
|
||||||
|
* @param visible 弹窗是否仍可见
|
||||||
|
* @param changed 原项目资产刷新通知
|
||||||
|
* @param started 后台启动编号通知
|
||||||
|
* @returns 质量会话、任务状态与执行入口
|
||||||
|
*/
|
||||||
export function useQuality(
|
export function useQuality(
|
||||||
props: { projectId: string; target: QualityTarget | null; disabled: boolean },
|
props: { projectId: string; target: QualityTarget | null; disabled: boolean },
|
||||||
visible: () => boolean,
|
visible: () => boolean,
|
||||||
changed: () => void
|
changed: () => void,
|
||||||
|
started: (executionId: string) => void = () => {}
|
||||||
) {
|
) {
|
||||||
|
/** 原项目与目标共同隔离结果。 */
|
||||||
const key = computed(() => qualityKey(props.projectId, props.target))
|
const key = computed(() => qualityKey(props.projectId, props.target))
|
||||||
|
/** 当前目标的会话回执。 */
|
||||||
const session = computed(() => qualitySession(key.value))
|
const session = computed(() => qualitySession(key.value))
|
||||||
|
/** 当前项目的短操作锁。 */
|
||||||
const operation = computed(() => getOperation(props.projectId))
|
const operation = computed(() => getOperation(props.projectId))
|
||||||
const blocked = computed(() => props.disabled || operation.value.pending || !props.target || !props.projectId)
|
/** 按项目恢复后台句柄,关闭弹窗仍继续观察。 */
|
||||||
|
const execution = useWorkflowExecution(
|
||||||
|
computed(() => props.projectId),
|
||||||
|
'keyframe-quality'
|
||||||
|
)
|
||||||
|
/** 已结束任务只写入其原始范围的回执。 */
|
||||||
|
const handled = new Set<string>()
|
||||||
|
/** 后台任务阻止重复启动。 */
|
||||||
|
const blocked = computed(
|
||||||
|
() => props.disabled || operation.value.pending || execution.active.value || !props.target || !props.projectId
|
||||||
|
)
|
||||||
|
/** 完成后由 metadata 恢复原目标;当前目标变化不改变任务归属。 */
|
||||||
|
watch(
|
||||||
|
() => execution.query.data.value,
|
||||||
|
record => {
|
||||||
|
if (
|
||||||
|
!record ||
|
||||||
|
record.projectId !== props.projectId ||
|
||||||
|
record.workflowName !== 'keyframe-quality' ||
|
||||||
|
!['completed', 'failed'].includes(record.status) ||
|
||||||
|
handled.has(record.id)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
handled.add(record.id)
|
||||||
|
const metadata = record.metadata
|
||||||
|
const episodeNo = metadata?.episodeNo
|
||||||
|
if (typeof episodeNo !== 'number') return
|
||||||
|
const target: QualityTarget = {
|
||||||
|
kind: 'batch',
|
||||||
|
episodeNo,
|
||||||
|
title: '',
|
||||||
|
...(typeof metadata?.shotId === 'string' ? { shotId: metadata.shotId } : {})
|
||||||
|
}
|
||||||
|
const original = qualitySession(qualityKey(record.projectId, target))
|
||||||
|
if (record.status === 'failed') original.error = record.error || '首帧质量后台任务失败,请核对已完成资产。'
|
||||||
|
else if (
|
||||||
|
isQualityBatchResult(record.result) &&
|
||||||
|
record.result.results.every(item => !target.shotId || item.shotId === target.shotId) &&
|
||||||
|
(typeof metadata?.limit !== 'number' || record.result.targetCount <= metadata.limit)
|
||||||
|
)
|
||||||
|
original.receipt = { kind: 'batch', result: record.result }
|
||||||
|
else original.error = '后台最终回执不完整或范围不匹配,请核对资产,不要重复生成。'
|
||||||
|
changed()
|
||||||
|
}
|
||||||
|
)
|
||||||
let disposed = false
|
let disposed = false
|
||||||
onScopeDispose(() => {
|
onScopeDispose(() => {
|
||||||
disposed = true
|
disposed = true
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 确认之后重新读取后端状态;打开弹窗和查看结果不会调用此函数。 */
|
/**
|
||||||
|
* 确认之后重读状态并只提交一次,固定原目标与费用范围。
|
||||||
|
* @param action 已确认的质量操作
|
||||||
|
* @param input 已确认的参数
|
||||||
|
* @returns 操作结束通知,后台生成由持久化任务继续跟踪
|
||||||
|
*/
|
||||||
async function run(action: QualityAction, input: QualityInput) {
|
async function run(action: QualityAction, input: QualityInput) {
|
||||||
if (blocked.value || !visible() || !props.target || !validQualityInput(input)) return
|
if (blocked.value || !visible() || !props.target || !validQualityInput(input)) return
|
||||||
const target = { ...props.target }
|
const target = { ...props.target }
|
||||||
@@ -50,10 +112,20 @@ export function useQuality(
|
|||||||
(target.kind === 'video' && action === 'repair' && input.maxRepairAttempts <= 0)
|
(target.kind === 'video' && action === 'repair' && input.maxRepairAttempts <= 0)
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
if (target.kind === 'batch' && input.episodeNo !== target.episodeNo) return
|
if (
|
||||||
|
target.kind === 'batch' &&
|
||||||
|
(input.episodeNo !== target.episodeNo ||
|
||||||
|
input.shotId !== target.shotId ||
|
||||||
|
(target.shotId && input.limit !== 1))
|
||||||
|
)
|
||||||
|
return
|
||||||
const projectId = props.projectId
|
const projectId = props.projectId
|
||||||
// 固定本次确认的参数,预检期间的表单变化不能扩大已确认的生成范围。
|
// 固定本次确认的参数,预检期间的表单变化不能扩大已确认的生成范围。
|
||||||
input = { ...input, allowedTexts: input.allowedTexts?.slice() }
|
input = {
|
||||||
|
...input,
|
||||||
|
allowedTexts: input.allowedTexts?.slice(),
|
||||||
|
generationOptions: input.generationOptions ? { ...input.generationOptions } : undefined
|
||||||
|
}
|
||||||
const originalKey = key.value
|
const originalKey = key.value
|
||||||
const receiptTarget = qualitySession(originalKey)
|
const receiptTarget = qualitySession(originalKey)
|
||||||
receiptTarget.receipt = null
|
receiptTarget.receipt = null
|
||||||
@@ -90,11 +162,13 @@ export function useQuality(
|
|||||||
if (!targets.length)
|
if (!targets.length)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
readiness.stalePrimaryKeyframe > 0
|
readiness.stalePrimaryKeyframe > 0
|
||||||
? '当前集没有可更新的过期首帧;后端优先处理全项目过期项,请切换剧集。'
|
? '当前范围没有可执行的首帧质量镜头,请刷新就绪状态。'
|
||||||
: '当前集没有符合条件的镜头;请补齐设计与参考图,或明确选择重做有效首帧。'
|
: '当前集没有符合条件的镜头;请补齐设计与参考图,或明确选择重做有效首帧。'
|
||||||
)
|
)
|
||||||
// 逐镜只读检查已选的小批量;任何模型能力不足都不启动本批付费流水线。
|
// 逐镜只读检查已选的小批量;任何模型能力不足都不启动本批付费流水线。
|
||||||
const capabilities = await Promise.all(targets.map(item => qualityApi.capability(item.shotId)))
|
const capabilities = await Promise.all(
|
||||||
|
targets.map(item => qualityApi.capability(item.shotId, undefined, input.provider))
|
||||||
|
)
|
||||||
const invalid = capabilities.find(item => item.valid !== true)
|
const invalid = capabilities.find(item => item.valid !== true)
|
||||||
if (invalid) throw new Error(invalid.message || '当前图片模型不支持所需参考图。')
|
if (invalid) throw new Error(invalid.message || '当前图片模型不支持所需参考图。')
|
||||||
const assets = await Promise.all(targets.map(item => productionApi.listKeyframes(item.shotId)))
|
const assets = await Promise.all(targets.map(item => productionApi.listKeyframes(item.shotId)))
|
||||||
@@ -112,22 +186,18 @@ export function useQuality(
|
|||||||
const result = await qualityApi.generate(projectId, input)
|
const result = await qualityApi.generate(projectId, input)
|
||||||
if (
|
if (
|
||||||
!result ||
|
!result ||
|
||||||
!Array.isArray(result.results) ||
|
result.projectId !== projectId ||
|
||||||
![result.targetCount, result.passed, result.repairFailed, result.failed, result.selected].every(
|
typeof result.executionId !== 'string' ||
|
||||||
value => Number.isSafeInteger(value) && value >= 0
|
!result.executionId ||
|
||||||
) ||
|
result.status !== 'running' ||
|
||||||
result.targetCount > input.limit ||
|
!Number.isSafeInteger(result.total) ||
|
||||||
result.results.length !== result.targetCount ||
|
result.total < 0 ||
|
||||||
result.passed + result.repairFailed + result.failed !== result.targetCount ||
|
result.total > input.limit
|
||||||
result.results.some(
|
|
||||||
item =>
|
|
||||||
!readiness.items.some(
|
|
||||||
shot => shot.shotId === item.shotId && shot.episodeNo === input.episodeNo
|
|
||||||
) || typeof item.success !== 'boolean'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
throw new Error('质量流水线回执不完整,请先核对资产,不要重复提交。')
|
throw new Error('后台启动回执不完整,请刷新状态,不要重复提交。')
|
||||||
receipt = { kind: 'batch', result }
|
await execution.track(result.executionId, projectId)
|
||||||
|
if (!disposed && props.projectId === projectId) started(result.executionId)
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
if (!readiness.items.some(item => item.shotId === target.shotId))
|
if (!readiness.items.some(item => item.shotId === target.shotId))
|
||||||
throw new Error('指定镜头不属于当前项目,未提交质量任务。')
|
throw new Error('指定镜头不属于当前项目,未提交质量任务。')
|
||||||
@@ -245,5 +315,5 @@ export function useQuality(
|
|||||||
// 已提交请求即使切换页面也归原会话;只刷新仍在查看的原项目。
|
// 已提交请求即使切换页面也归原会话;只刷新仍在查看的原项目。
|
||||||
if (!disposed && props.projectId === projectId) changed()
|
if (!disposed && props.projectId === projectId) changed()
|
||||||
}
|
}
|
||||||
return { key, session, operation, blocked, run }
|
return { key, session, operation, execution, blocked, run }
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, reactive, ref } from 'vue'
|
import { computed, reactive, ref } from 'vue'
|
||||||
import { NAlert, NButton, NFormItem, NInput, NPopconfirm, NSelect, NTag, NTooltip } from 'naive-ui'
|
import { NAlert, NButton, NFormItem, NInput, NPopconfirm, NSelect, NTag, NTooltip } from 'naive-ui'
|
||||||
import { RefreshCw, Search, Trash2, Upload } from '@lucide/vue'
|
import { Search, Trash2, Upload } from '@lucide/vue'
|
||||||
import { AppDialog, AssetImage, EmptyState } from '../../components/ui'
|
import { AppDialog, AssetImage, EmptyState } from '../../components/ui'
|
||||||
import AppForm from '../../components/ui/AppForm.vue'
|
import AppForm from '../../components/ui/AppForm.vue'
|
||||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||||
@@ -111,11 +111,6 @@ function clearFilters() {
|
|||||||
category.value = null
|
category.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 同时刷新图片与上传所需的剧本选项。 */
|
|
||||||
async function refreshAll() {
|
|
||||||
await Promise.all([query.refresh(), projectsQuery.refresh()])
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 先校验本地文件,再在当前页选择剧本并确认资料。 */
|
/** 先校验本地文件,再在当前页选择剧本并确认资料。 */
|
||||||
function selectFile(event: Event) {
|
function selectFile(event: Event) {
|
||||||
const input = event.target as HTMLInputElement
|
const input = event.target as HTMLInputElement
|
||||||
@@ -237,16 +232,6 @@ async function removeAsset() {
|
|||||||
>
|
>
|
||||||
<template #icon><Upload :size="16" /></template>上传图片
|
<template #icon><Upload :size="16" /></template>上传图片
|
||||||
</NButton>
|
</NButton>
|
||||||
<NButton
|
|
||||||
quaternary
|
|
||||||
class="icon-button"
|
|
||||||
:loading="query.loading.value || projectsQuery.loading.value"
|
|
||||||
aria-label="刷新资产库"
|
|
||||||
title="刷新资产库"
|
|
||||||
@click="refreshAll"
|
|
||||||
>
|
|
||||||
<template #icon><RefreshCw :size="16" /></template>
|
|
||||||
</NButton>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, reactive, ref } from 'vue'
|
import { computed, reactive, ref } from 'vue'
|
||||||
import { NAlert, NButton, NFormItem, NInput, NPopconfirm, NSelect, NTag } from 'naive-ui'
|
import { NAlert, NButton, NFormItem, NInput, NPopconfirm, NSelect, NTag } from 'naive-ui'
|
||||||
import { Pencil, RefreshCw, Search, Trash2, Upload } from '@lucide/vue'
|
import { Pencil, Search, Trash2, Upload } from '@lucide/vue'
|
||||||
import { AppDialog, AssetImage, EmptyState } from '../../components/ui'
|
import { AppDialog, AssetImage, EmptyState } from '../../components/ui'
|
||||||
import AppForm from '../../components/ui/AppForm.vue'
|
import AppForm from '../../components/ui/AppForm.vue'
|
||||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||||
@@ -187,15 +187,6 @@ async function removeAsset(asset: ProjectAsset) {
|
|||||||
<NButton type="primary" :disabled="disabled" @click="fileInput?.click()">
|
<NButton type="primary" :disabled="disabled" @click="fileInput?.click()">
|
||||||
<template #icon><Upload :size="16" /></template>上传图片
|
<template #icon><Upload :size="16" /></template>上传图片
|
||||||
</NButton>
|
</NButton>
|
||||||
<NButton
|
|
||||||
quaternary
|
|
||||||
class="icon-button"
|
|
||||||
aria-label="刷新资产库"
|
|
||||||
title="刷新资产库"
|
|
||||||
:loading="query.loading.value"
|
|
||||||
@click="query.refresh"
|
|
||||||
><template #icon><RefreshCw :size="16" /></template
|
|
||||||
></NButton>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,43 +1,123 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, inject, onScopeDispose, provide, ref, watchEffect } from 'vue'
|
import { computed, h, inject, onScopeDispose, provide, ref, watch, watchEffect } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { NScrollbar, NAlert, NButton, NPageHeader, NSpin, NEllipsis } from 'naive-ui'
|
import { NScrollbar, NAlert, NButton, NPageHeader, NSpin, NEllipsis } from 'naive-ui'
|
||||||
import { EmptyState } from '../../components/ui'
|
import { EmptyState } from '../../components/ui'
|
||||||
import { projectContextKey, useProjectData } from './context'
|
import { projectContextKey, useProjectData } from './context'
|
||||||
import { getOperation } from '../workflows/operations'
|
import { getOperation } from '../workflows/operations'
|
||||||
import { isProjectComplete, projectAccessKey, type ProjectAccess } from './access'
|
import { projectAccessKey, projectSectionFromPath, type ProjectAccess } from './access'
|
||||||
|
import { useProjectStageAccess } from './useProjectStageAccess'
|
||||||
|
import { useWorkflowExecution } from '../workflows/execution'
|
||||||
|
import { clearEpisodeSourceInvalidations, invalidateEpisodeSource } from '../storyboard/model'
|
||||||
|
import { useActionMessage } from '../../components/ui/useActionMessage'
|
||||||
|
import { productionMessage } from '../production/production-messages'
|
||||||
|
import ProjectSettingsDialog from '../generation-config/components/ProjectSettingsDialog.vue'
|
||||||
|
import { projectGenerationRevisionKey } from '../generation-config/context'
|
||||||
|
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||||
|
|
||||||
/** 项目标题只保留名称;下游工作区在剧本完成前不挂载,直接链接也无法越过限制。 */
|
/** 项目标题只保留名称;下游工作区在剧本完成前不挂载,直接链接也无法越过限制。 */
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const id = computed(() => String(route.params.projectId))
|
const id = computed(() => String(route.params.projectId))
|
||||||
/** 移动端标题只截断,不弹悬浮提示;跟随视口变化并在卸载时清理监听。 */
|
|
||||||
const mobileMedia = window.matchMedia('(max-width: 760px)')
|
|
||||||
const isMobile = ref(mobileMedia.matches)
|
|
||||||
function syncMobile() {
|
|
||||||
isMobile.value = mobileMedia.matches
|
|
||||||
}
|
|
||||||
mobileMedia.addEventListener('change', syncMobile)
|
|
||||||
onScopeDispose(() => mobileMedia.removeEventListener('change', syncMobile))
|
|
||||||
|
|
||||||
// 图库使用手动刷新,父布局也停止轮询,避免浏览素材时被周期性更新打断。
|
// 图库使用手动刷新,父布局也停止轮询,避免浏览素材时被周期性更新打断。
|
||||||
const isGallery = computed(() => {
|
const isGallery = computed(() => {
|
||||||
const path = route.path.replace(/\/+$/, '')
|
const path = route.path.replace(/\/+$/, '')
|
||||||
return path.endsWith('/subject-images') || path.endsWith('/assets')
|
return path.endsWith('/subject-images') || path.endsWith('/assets')
|
||||||
})
|
})
|
||||||
const context = useProjectData(
|
const context = useProjectData(id)
|
||||||
id,
|
|
||||||
computed(() => (isGallery.value ? false : 6000))
|
|
||||||
)
|
|
||||||
provide(projectContextKey, context)
|
provide(projectContextKey, context)
|
||||||
|
/** 项目全局配置保存后更新已挂载生成表单。 */
|
||||||
|
const generationRevision = ref(0)
|
||||||
|
provide(projectGenerationRevisionKey, generationRevision)
|
||||||
|
/** 项目标题栏共用配置弹窗开关。 */
|
||||||
|
const settingsOpen = ref(false)
|
||||||
|
/** 既有配置恢复链接打开同一个全局弹窗,不切换工作区。 */
|
||||||
|
watch(
|
||||||
|
() => route.query.configure,
|
||||||
|
value => {
|
||||||
|
if (value === 'profile') settingsOpen.value = true
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
/** 关闭弹窗清除仅用于打开配置的参数,保留镜头与其它地址信息。 */
|
||||||
|
watch(settingsOpen, shown => {
|
||||||
|
if (!shown && route.query.configure === 'profile') {
|
||||||
|
const query = { ...route.query }
|
||||||
|
delete query.configure
|
||||||
|
void router.replace({ path: route.path, query, hash: route.hash })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
/** 切项目时关闭旧配置,禁止把草稿带入其它项目。 */
|
||||||
|
watch(id, () => {
|
||||||
|
settingsOpen.value = false
|
||||||
|
generationRevision.value = 0
|
||||||
|
})
|
||||||
const operation = computed(() => getOperation(id.value))
|
const operation = computed(() => getOperation(id.value))
|
||||||
const complete = computed(() => isProjectComplete(context.project.value, id.value))
|
const createDramaExecution = useWorkflowExecution(id, 'create-drama')
|
||||||
const isCreation = computed(() => route.path.replace(/\/+$/, '').endsWith('/create-drama'))
|
/** 项目内跨页面继续观察首帧后台任务,维持活动锁并在真实终态后释放。 */
|
||||||
type OperationGuide = { title: string; description: string; action?: string; target?: 'profile' | 'style' | 'identity' }
|
useWorkflowExecution(id, 'keyframe-quality')
|
||||||
|
/** 既有生成入口在跨页面时继续观察,保持项目活动锁。 */
|
||||||
|
for (const workflowName of [
|
||||||
|
'storyboard-direction',
|
||||||
|
'storyboard-visual-state',
|
||||||
|
'video-prompt',
|
||||||
|
'keyframe-generation',
|
||||||
|
'video-quality'
|
||||||
|
]) {
|
||||||
|
useWorkflowExecution(id, workflowName)
|
||||||
|
}
|
||||||
|
/** 即使直接刷新到生产页,也按真实重生成任务恢复旧剧情快照的失效标记。 */
|
||||||
|
const breakdownExecution = useWorkflowExecution(id, 'breakdown')
|
||||||
|
/** 只有后端确认有效的新分镜才废弃旧正文,不推测未完成或失败任务。 */
|
||||||
|
watchEffect(() => {
|
||||||
|
const record = breakdownExecution.query.data.value
|
||||||
|
if (!record || record.projectId !== id.value || record.status !== 'completed') return
|
||||||
|
if (record.metadata?.action !== 'regenerate-storyboard-episode') {
|
||||||
|
if (record.metadata?.action === 'start') clearEpisodeSourceInvalidations(record.projectId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const number = record.metadata.episodeNo
|
||||||
|
const validation = record.result?.storyboardShotValidation
|
||||||
|
if (
|
||||||
|
typeof number === 'number' &&
|
||||||
|
validation &&
|
||||||
|
typeof validation === 'object' &&
|
||||||
|
'valid' in validation &&
|
||||||
|
validation.valid === true
|
||||||
|
)
|
||||||
|
invalidateEpisodeSource(record.projectId, number)
|
||||||
|
})
|
||||||
|
watchEffect(() => {
|
||||||
|
const status = createDramaExecution.query.data.value?.status
|
||||||
|
if ((status === 'completed' || status === 'failed') && context.project.value?.status === 'generating') {
|
||||||
|
void context.refresh()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const stageAccess = useProjectStageAccess(id, context.stageReadiness)
|
||||||
|
const complete = stageAccess.scriptReady
|
||||||
|
const currentSection = computed(() => projectSectionFromPath(route.path))
|
||||||
|
const currentAccess = computed(() => {
|
||||||
|
const section = currentSection.value
|
||||||
|
return section ? stageAccess.sections.value[section] : null
|
||||||
|
})
|
||||||
|
const isCreation = computed(() => currentSection.value === 'create-drama')
|
||||||
|
type OperationGuide = {
|
||||||
|
title: string
|
||||||
|
description: string
|
||||||
|
action?: string
|
||||||
|
target?: 'profile' | 'style' | 'identity' | 'keyframe'
|
||||||
|
}
|
||||||
const operationGuide = computed<OperationGuide | null>(() => {
|
const operationGuide = computed<OperationGuide | null>(() => {
|
||||||
const error = operation.value.error?.trim()
|
const error = operation.value.error?.trim()
|
||||||
if (!error) return null
|
if (!error) return null
|
||||||
const normalized = error.toLowerCase()
|
const normalized = error.toLowerCase()
|
||||||
|
if (normalized.includes('primary keyframe') || error.includes('主首帧'))
|
||||||
|
return {
|
||||||
|
title: '缺少镜头主首帧',
|
||||||
|
description: '视频提示词需要主首帧完成起点校验。请先生成并确认主首帧,再返回分镜页读取/生成提示词。',
|
||||||
|
action: '先生成主首帧',
|
||||||
|
target: 'keyframe'
|
||||||
|
}
|
||||||
if (normalized.includes('creative profile'))
|
if (normalized.includes('creative profile'))
|
||||||
return {
|
return {
|
||||||
title: '缺少项目生成配置',
|
title: '缺少项目生成配置',
|
||||||
@@ -62,23 +142,75 @@ const operationGuide = computed<OperationGuide | null>(() => {
|
|||||||
return { title: '操作未完成', description: error }
|
return { title: '操作未完成', description: error }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** 镜头工作区的操作结果只在用户发起操作后显示,不在进入页面时重放旧提示。 */
|
||||||
|
const actionMessage = useActionMessage()
|
||||||
|
/** 分镜和生产页保留必要进度,操作成功或失败改用临时消息。 */
|
||||||
|
const quietFeedback = computed(() => currentSection.value === 'production' || currentSection.value === 'storyboard')
|
||||||
|
/** 只通知仍在当前项目的真实新结果,不把任务提交当作素材生成完成。 */
|
||||||
|
watch(
|
||||||
|
() => [id.value, operation.value.error, operation.value.notice] as const,
|
||||||
|
([projectId, error, notice], [previousProject, previousError, previousNotice]) => {
|
||||||
|
if (!quietFeedback.value || projectId !== previousProject) return
|
||||||
|
if (error && error !== previousError) {
|
||||||
|
const guide = operationGuide.value
|
||||||
|
const content = productionMessage(error)
|
||||||
|
actionMessage?.error(
|
||||||
|
() =>
|
||||||
|
h('div', { class: 'flex max-w-[min(600px,calc(100vw-48px))] flex-wrap items-center gap-3' }, [
|
||||||
|
h('span', content),
|
||||||
|
guide?.action
|
||||||
|
? h(
|
||||||
|
NButton,
|
||||||
|
{
|
||||||
|
text: true,
|
||||||
|
size: 'small',
|
||||||
|
onClick: () => {
|
||||||
|
if (id.value === projectId && operation.value.error === error)
|
||||||
|
resolveOperationError()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
() => guide.action
|
||||||
|
)
|
||||||
|
: null
|
||||||
|
]),
|
||||||
|
{ duration: 8000, closable: true }
|
||||||
|
)
|
||||||
|
} else if (notice && notice !== previousNotice) {
|
||||||
|
if (/生成|提交/.test(operation.value.label))
|
||||||
|
actionMessage?.info('任务已提交,完成后会显示结果。', { duration: 4000 })
|
||||||
|
else actionMessage?.success('操作已完成。', { duration: 3000 })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ flush: 'post' }
|
||||||
|
)
|
||||||
|
|
||||||
/** 已知前置条件直接送达对应工作区;保留当前页面,修复后可继续原操作。 */
|
/** 已知前置条件直接送达对应工作区;保留当前页面,修复后可继续原操作。 */
|
||||||
function resolveOperationError() {
|
function resolveOperationError() {
|
||||||
const target = operationGuide.value?.target
|
const target = operationGuide.value?.target
|
||||||
if (target === 'style') void router.push(`/projects/${id.value}/visual-style`)
|
if (target === 'keyframe') {
|
||||||
|
const recovery = operation.value.recovery?.target === 'keyframe' ? operation.value.recovery : null
|
||||||
|
const query = recovery
|
||||||
|
? {
|
||||||
|
...(recovery.episodeNo ? { episodeNo: String(recovery.episodeNo) } : {}),
|
||||||
|
shotId: recovery.shotId,
|
||||||
|
action: 'keyframe'
|
||||||
|
}
|
||||||
|
: { action: 'keyframe' }
|
||||||
|
operation.value.error = ''
|
||||||
|
void router.push({ path: `/projects/${id.value}/production`, query })
|
||||||
|
} else if (target === 'style') void router.push(`/projects/${id.value}/visual-style`)
|
||||||
else if (target === 'identity') void router.push(`/projects/${id.value}/subject-identity`)
|
else if (target === 'identity') void router.push(`/projects/${id.value}/subject-identity`)
|
||||||
else if (target === 'profile') {
|
else if (target === 'profile') settingsOpen.value = true
|
||||||
const onIdentityPage = route.path.replace(/\/+$/, '').endsWith('/subject-identity')
|
}
|
||||||
void router.push({
|
/** 配置真实保存后更新当前项目的就绪门禁并解除配置缺失提示。 */
|
||||||
path: onIdentityPage ? route.path : `/projects/${id.value}/production`,
|
function projectSettingsSaved() {
|
||||||
query: { ...route.query, configure: 'profile' }
|
if (operationGuide.value?.target === 'profile') operation.value.error = ''
|
||||||
})
|
void context.refreshStageReadiness()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const access = inject(projectAccessKey, undefined)
|
const access = inject(projectAccessKey, undefined)
|
||||||
let published: ProjectAccess | null = null
|
let published: ProjectAccess | null = null
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
published = { projectId: id.value, completed: complete.value }
|
published = { projectId: id.value, completed: complete.value, sections: stageAccess.sections.value }
|
||||||
if (access) access.value = published
|
if (access) access.value = published
|
||||||
})
|
})
|
||||||
onScopeDispose(() => {
|
onScopeDispose(() => {
|
||||||
@@ -88,16 +220,22 @@ onScopeDispose(() => {
|
|||||||
<template>
|
<template>
|
||||||
<section class="project-frame">
|
<section class="project-frame">
|
||||||
<header class="project-header">
|
<header class="project-header">
|
||||||
|
<!-- 以下是项目标题与全局配置入口模块 -->
|
||||||
<NPageHeader @back="router.push('/projects')">
|
<NPageHeader @back="router.push('/projects')">
|
||||||
<template #title
|
<template #title
|
||||||
><NEllipsis :key="isMobile ? 'mobile' : 'desktop'" class="project-title" :tooltip="!isMobile">{{
|
><NEllipsis class="project-title" :tooltip="false">{{
|
||||||
context.project.value?.title || context.project.value?.topic || '读取项目'
|
context.project.value?.title || context.project.value?.topic || '读取项目'
|
||||||
}}</NEllipsis></template
|
}}</NEllipsis></template
|
||||||
>
|
>
|
||||||
|
<template #extra>
|
||||||
|
<NButton size="small" :disabled="!context.project.value" @click="settingsOpen = true"
|
||||||
|
>项目配置</NButton
|
||||||
|
>
|
||||||
|
</template>
|
||||||
</NPageHeader>
|
</NPageHeader>
|
||||||
</header>
|
</header>
|
||||||
<NScrollbar
|
<NScrollbar
|
||||||
v-if="context.error.value || operation.pending || operation.error || operation.notice"
|
v-if="context.error.value || operation.pending || (!quietFeedback && (operation.error || operation.notice))"
|
||||||
class="project-notices"
|
class="project-notices"
|
||||||
content-class="project-notices-content"
|
content-class="project-notices-content"
|
||||||
>
|
>
|
||||||
@@ -108,9 +246,9 @@ onScopeDispose(() => {
|
|||||||
></NAlert
|
></NAlert
|
||||||
>
|
>
|
||||||
<NAlert v-if="operation.pending" :show-icon="false" role="status"
|
<NAlert v-if="operation.pending" :show-icon="false" role="status"
|
||||||
>{{ operation.label }}。可切换页面查看结果,请勿重复提交。</NAlert
|
>{{ operation.label || '后台制作任务执行中' }}。可切换页面查看结果,请勿重复提交。</NAlert
|
||||||
>
|
>
|
||||||
<NAlert v-if="operationGuide" type="error" :show-icon="false" class="operation-guide">
|
<NAlert v-if="operationGuide && !quietFeedback" type="error" :show-icon="false" class="operation-guide">
|
||||||
<div class="operation-guide-content">
|
<div class="operation-guide-content">
|
||||||
<div>
|
<div>
|
||||||
<strong>{{ operationGuide.title }}</strong>
|
<strong>{{ operationGuide.title }}</strong>
|
||||||
@@ -121,26 +259,48 @@ onScopeDispose(() => {
|
|||||||
}}</NButton>
|
}}</NButton>
|
||||||
</div>
|
</div>
|
||||||
</NAlert>
|
</NAlert>
|
||||||
<NAlert v-if="operation.notice" :show-icon="false" role="status">{{ operation.notice }}</NAlert>
|
<NAlert v-if="operation.notice && !quietFeedback" :show-icon="false" role="status">{{
|
||||||
|
operation.notice
|
||||||
|
}}</NAlert>
|
||||||
</NScrollbar>
|
</NScrollbar>
|
||||||
|
<WorkflowExecutionPanel
|
||||||
|
v-if="isCreation && createDramaExecution.executionId.value"
|
||||||
|
class="project-workflow-status"
|
||||||
|
title="剧本创作后台任务"
|
||||||
|
:execution="createDramaExecution.query.data.value"
|
||||||
|
:loading="createDramaExecution.query.loading.value"
|
||||||
|
:error="createDramaExecution.query.error.value"
|
||||||
|
@refresh="createDramaExecution.query.refresh"
|
||||||
|
@dismiss="createDramaExecution.dismiss"
|
||||||
|
/>
|
||||||
|
<!-- 以下是当前项目图片与视频配置弹窗模块 -->
|
||||||
|
<ProjectSettingsDialog
|
||||||
|
:key="id"
|
||||||
|
v-if="context.project.value?.id === id"
|
||||||
|
v-model:open="settingsOpen"
|
||||||
|
:project-id="id"
|
||||||
|
:disabled="operation.pending"
|
||||||
|
@saved="projectSettingsSaved"
|
||||||
|
/>
|
||||||
<div class="project-view">
|
<div class="project-view">
|
||||||
<RouterView v-if="context.project.value?.id === id && (isCreation || complete)" :key="id" />
|
<RouterView v-if="context.project.value?.id === id && currentAccess?.enabled" :key="id" />
|
||||||
<EmptyState
|
<EmptyState
|
||||||
v-else-if="context.project.value?.id === id"
|
v-else-if="context.project.value?.id === id"
|
||||||
class="project-access-gate"
|
class="project-access-gate"
|
||||||
title="请先完成剧本创作"
|
:title="currentAccess?.reason || '当前步骤还不能开始'"
|
||||||
:description="`剧本完成后,才能使用拆解、视觉风格、主体身份、形态图片、资产库、分镜设计与镜头生产。${isGallery ? '请手动刷新项目状态。' : '状态会自动更新。'}`"
|
:description="`完成前面的制作步骤后,这里会自动开放。${isGallery ? '如刚完成操作,请刷新项目状态。' : ''}`"
|
||||||
>
|
>
|
||||||
<NButton type="primary" @click="router.push(`/projects/${id}/create-drama`)">返回剧本创作</NButton>
|
<NButton
|
||||||
|
v-if="currentAccess?.nextPath"
|
||||||
|
type="primary"
|
||||||
|
@click="router.push(`/projects/${id}/${currentAccess.nextPath}`)"
|
||||||
|
>{{ currentAccess.nextLabel || '前往上一步' }}</NButton
|
||||||
|
>
|
||||||
<NButton v-if="isGallery" class="ml-3" :loading="context.loading.value" @click="context.refresh"
|
<NButton v-if="isGallery" class="ml-3" :loading="context.loading.value" @click="context.refresh"
|
||||||
>刷新项目状态</NButton
|
>刷新项目状态</NButton
|
||||||
>
|
>
|
||||||
</EmptyState>
|
</EmptyState>
|
||||||
<NSpin
|
<NSpin v-else-if="context.loading.value" class="workspace-loading" description="正在读取项目内容…" />
|
||||||
v-else-if="context.loading.value"
|
|
||||||
class="workspace-loading"
|
|
||||||
description="正在读取项目和工作流记录…"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
@@ -152,7 +312,8 @@ onScopeDispose(() => {
|
|||||||
@apply flex flex-col h-full min-h-0 overflow-hidden;
|
@apply flex flex-col h-full min-h-0 overflow-hidden;
|
||||||
}
|
}
|
||||||
.project-header {
|
.project-header {
|
||||||
@apply shrink-0 py-[9px] px-5 bg-(--app-surface);
|
@apply shrink-0 py-[9px] bg-(--app-surface);
|
||||||
|
padding-inline: var(--app-content-padding);
|
||||||
}
|
}
|
||||||
.project-header .n-page-header__main,
|
.project-header .n-page-header__main,
|
||||||
.project-header .n-page-header__title {
|
.project-header .n-page-header__title {
|
||||||
@@ -162,13 +323,15 @@ onScopeDispose(() => {
|
|||||||
@apply max-w-full text-base font-semibold;
|
@apply max-w-full text-base font-semibold;
|
||||||
}
|
}
|
||||||
.project-notices.n-scrollbar {
|
.project-notices.n-scrollbar {
|
||||||
@apply shrink-0 h-auto max-h-[100px] overflow-hidden;
|
@apply shrink-0 h-auto max-h-[min(24dvh,160px)] overflow-hidden;
|
||||||
}
|
}
|
||||||
.project-notices-content {
|
.project-notices-content {
|
||||||
@apply py-2 px-6 grid gap-[5px];
|
@apply grid;
|
||||||
|
padding: var(--app-content-padding) var(--app-content-padding) 0;
|
||||||
|
gap: var(--app-content-gap);
|
||||||
}
|
}
|
||||||
.project-notices .n-alert {
|
.project-workflow-status {
|
||||||
@apply py-[7px] px-3 text-xs;
|
margin: var(--app-content-gap) var(--app-content-padding) 0;
|
||||||
}
|
}
|
||||||
.operation-guide-content {
|
.operation-guide-content {
|
||||||
@apply flex items-center justify-between gap-4;
|
@apply flex items-center justify-between gap-4;
|
||||||
@@ -187,7 +350,7 @@ onScopeDispose(() => {
|
|||||||
}
|
}
|
||||||
@media (max-width: 760px) {
|
@media (max-width: 760px) {
|
||||||
.project-header {
|
.project-header {
|
||||||
@apply py-2 px-3;
|
@apply py-2;
|
||||||
}
|
}
|
||||||
.project-title {
|
.project-title {
|
||||||
@apply text-sm;
|
@apply text-sm;
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ import {
|
|||||||
NButton,
|
NButton,
|
||||||
NDataTable,
|
NDataTable,
|
||||||
NInput,
|
NInput,
|
||||||
|
NDropdown,
|
||||||
NRadioButton,
|
NRadioButton,
|
||||||
NRadioGroup,
|
NRadioGroup,
|
||||||
type DataTableColumns,
|
type DataTableColumns,
|
||||||
type DataTableInst
|
type DataTableInst
|
||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
import { RefreshCw, Search } from '@lucide/vue'
|
import { MoreHorizontal, Pencil, Search, Trash2 } from '@lucide/vue'
|
||||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||||
import { useQuery } from '../../composables/useQuery'
|
import { useQuery } from '../../composables/useQuery'
|
||||||
import { StatusBadge } from '../../components/ui'
|
import { StatusBadge } from '../../components/ui'
|
||||||
@@ -19,10 +20,12 @@ import { formatDate } from '../../lib/format'
|
|||||||
import { projectsApi } from './api'
|
import { projectsApi } from './api'
|
||||||
import type { Project } from './types'
|
import type { Project } from './types'
|
||||||
import CreateProjectDialog from './components/CreateProjectDialog.vue'
|
import CreateProjectDialog from './components/CreateProjectDialog.vue'
|
||||||
|
import EditProjectDialog from './components/EditProjectDialog.vue'
|
||||||
|
import DeleteProjectDialog from './components/DeleteProjectDialog.vue'
|
||||||
|
|
||||||
/** 项目表格使用固定表头与独立滚动;搜索筛选仍作用于真实接口数据。 */
|
/** 项目表格使用固定表头与独立滚动;搜索筛选仍作用于真实接口数据。 */
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
/** 列表已有刷新按钮,只在进入和手动刷新时读取;筛选在完整结果中进行。 */
|
/** 列表在进入或自身操作完成后读取;筛选在完整结果中进行。 */
|
||||||
const query = useQuery(ref('projects'), (_, signal) => projectsApi.list(signal))
|
const query = useQuery(ref('projects'), (_, signal) => projectsApi.list(signal))
|
||||||
const search = ref('')
|
const search = ref('')
|
||||||
const filter = ref('all')
|
const filter = ref('all')
|
||||||
@@ -31,6 +34,17 @@ const PAGE_SIZE = 20
|
|||||||
const visibleCount = ref(PAGE_SIZE)
|
const visibleCount = ref(PAGE_SIZE)
|
||||||
const table = ref<DataTableInst | null>(null)
|
const table = ref<DataTableInst | null>(null)
|
||||||
const projects = computed(() => query.data.value ?? [])
|
const projects = computed(() => query.data.value ?? [])
|
||||||
|
const editOpen = ref(false)
|
||||||
|
const deleteOpen = ref(false)
|
||||||
|
const managedProject = ref<Project | null>(null)
|
||||||
|
function editProject(project: Project) {
|
||||||
|
managedProject.value = project
|
||||||
|
editOpen.value = true
|
||||||
|
}
|
||||||
|
function deleteProject(project: Project) {
|
||||||
|
managedProject.value = project
|
||||||
|
deleteOpen.value = true
|
||||||
|
}
|
||||||
const filtered = computed(() =>
|
const filtered = computed(() =>
|
||||||
projects.value.filter(item => {
|
projects.value.filter(item => {
|
||||||
const matches = ((item.title ?? '') + ' ' + item.topic + ' ' + (item.style ?? ''))
|
const matches = ((item.title ?? '') + ' ' + item.topic + ' ' + (item.style ?? ''))
|
||||||
@@ -75,10 +89,47 @@ const columns: DataTableColumns<Project> = [
|
|||||||
},
|
},
|
||||||
{ title: '风格', key: 'style', width: 200, ellipsis: { tooltip: true }, render: row => row.style || '未设置' },
|
{ title: '风格', key: 'style', width: 200, ellipsis: { tooltip: true }, render: row => row.style || '未设置' },
|
||||||
{ title: '状态', key: 'status', width: 120, render: row => h(StatusBadge, { status: row.status }) },
|
{ title: '状态', key: 'status', width: 120, render: row => h(StatusBadge, { status: row.status }) },
|
||||||
{ title: '最近更新', key: 'updatedAt', width: 165, render: row => formatDate(row.updatedAt) }
|
{ title: '最近更新', key: 'updatedAt', width: 165, render: row => formatDate(row.updatedAt) },
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
key: 'actions',
|
||||||
|
width: 64,
|
||||||
|
render: row =>
|
||||||
|
h(
|
||||||
|
NDropdown,
|
||||||
|
{
|
||||||
|
trigger: 'click',
|
||||||
|
placement: 'bottom-end',
|
||||||
|
options: [
|
||||||
|
{ label: '编辑', key: 'edit', icon: () => h(Pencil, { size: 16 }) },
|
||||||
|
{ label: '删除', key: 'delete', icon: () => h(Trash2, { size: 16 }) }
|
||||||
|
],
|
||||||
|
onSelect: key => {
|
||||||
|
if (key === 'edit') editProject(row)
|
||||||
|
if (key === 'delete') deleteProject(row)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
default: () =>
|
||||||
|
h(
|
||||||
|
NButton,
|
||||||
|
{
|
||||||
|
quaternary: true,
|
||||||
|
circle: true,
|
||||||
|
title: '更多操作',
|
||||||
|
'aria-label': `${row.title || row.topic} 更多操作`
|
||||||
|
},
|
||||||
|
{ icon: () => h(MoreHorizontal, { size: 18 }) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
]
|
]
|
||||||
/** 创建回执只用于跳转,生成进度以后端查询为准。 */
|
/** 创建回执只用于跳转,生成进度以后端查询为准。 */
|
||||||
function openProject(id: string) {
|
function openProject(id: string, executionId: string) {
|
||||||
|
if (typeof localStorage !== 'undefined' && executionId) {
|
||||||
|
localStorage.setItem(`short-drama:workflow-execution:${id}:create-drama`, executionId)
|
||||||
|
}
|
||||||
void router.push('/projects/' + encodeURIComponent(id) + '/create-drama')
|
void router.push('/projects/' + encodeURIComponent(id) + '/create-drama')
|
||||||
}
|
}
|
||||||
/** 清空条件后返回首批,不改变后端数据。 */
|
/** 清空条件后返回首批,不改变后端数据。 */
|
||||||
@@ -99,7 +150,7 @@ function clearFilters() {
|
|||||||
</div>
|
</div>
|
||||||
<CreateProjectDialog @created="openProject" />
|
<CreateProjectDialog @created="openProject" />
|
||||||
</div>
|
</div>
|
||||||
<!-- 以下是状态筛选、搜索与刷新 -->
|
<!-- 以下是状态筛选与搜索模块 -->
|
||||||
<div class="project-index-toolbar">
|
<div class="project-index-toolbar">
|
||||||
<div class="project-status-filter-scroller">
|
<div class="project-status-filter-scroller">
|
||||||
<NRadioGroup
|
<NRadioGroup
|
||||||
@@ -121,14 +172,6 @@ function clearFilters() {
|
|||||||
:input-props="{ 'aria-label': '搜索项目' }"
|
:input-props="{ 'aria-label': '搜索项目' }"
|
||||||
><template #prefix><Search :size="15" /></template
|
><template #prefix><Search :size="15" /></template
|
||||||
></NInput>
|
></NInput>
|
||||||
<NButton
|
|
||||||
class="icon-button"
|
|
||||||
:loading="query.loading.value"
|
|
||||||
aria-label="刷新项目"
|
|
||||||
title="刷新项目"
|
|
||||||
@click="query.refresh"
|
|
||||||
><template #icon><RefreshCw :size="16" /></template
|
|
||||||
></NButton>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -136,6 +179,8 @@ function clearFilters() {
|
|||||||
<NAlert v-if="query.error.value" type="error" :show-icon="false"
|
<NAlert v-if="query.error.value" type="error" :show-icon="false"
|
||||||
>{{ query.error.value }}<NButton text class="ml-3" @click="query.refresh">重新连接</NButton></NAlert
|
>{{ query.error.value }}<NButton text class="ml-3" @click="query.refresh">重新连接</NButton></NAlert
|
||||||
>
|
>
|
||||||
|
<EditProjectDialog v-model:open="editOpen" :project="managedProject" @changed="query.refresh" />
|
||||||
|
<DeleteProjectDialog v-model:open="deleteOpen" :project="managedProject" @deleted="query.refresh" />
|
||||||
<div class="project-table-area">
|
<div class="project-table-area">
|
||||||
<NDataTable
|
<NDataTable
|
||||||
ref="table"
|
ref="table"
|
||||||
@@ -149,7 +194,7 @@ function clearFilters() {
|
|||||||
:loading="query.loading.value"
|
:loading="query.loading.value"
|
||||||
flex-height
|
flex-height
|
||||||
table-layout="fixed"
|
table-layout="fixed"
|
||||||
:scroll-x="785"
|
:scroll-x="850"
|
||||||
@scroll="loadMore"
|
@scroll="loadMore"
|
||||||
>
|
>
|
||||||
<template #empty
|
<template #empty
|
||||||
@@ -175,7 +220,7 @@ function clearFilters() {
|
|||||||
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
||||||
@reference "../../styles/styles.css";
|
@reference "../../styles/styles.css";
|
||||||
.page-heading {
|
.page-heading {
|
||||||
@apply flex items-center justify-between gap-6 mb-7;
|
@apply flex items-center justify-between gap-6;
|
||||||
}
|
}
|
||||||
.page-heading h1 {
|
.page-heading h1 {
|
||||||
@apply mt-[9px] mx-0 mb-0 text-[27px] font-semibold tracking-[-0.035em] leading-[1.4];
|
@apply mt-[9px] mx-0 mb-0 text-[27px] font-semibold tracking-[-0.035em] leading-[1.4];
|
||||||
@@ -210,7 +255,7 @@ function clearFilters() {
|
|||||||
@apply text-[22px] font-semibold;
|
@apply text-[22px] font-semibold;
|
||||||
}
|
}
|
||||||
.project-index-toolbar {
|
.project-index-toolbar {
|
||||||
@apply flex items-center justify-between flex-wrap gap-3 mb-1;
|
@apply flex items-center justify-between flex-wrap gap-3;
|
||||||
}
|
}
|
||||||
.project-index-search-row {
|
.project-index-search-row {
|
||||||
@apply flex min-w-0 items-center gap-2;
|
@apply flex min-w-0 items-center gap-2;
|
||||||
@@ -238,9 +283,6 @@ function clearFilters() {
|
|||||||
@apply text-muted mt-1 text-[11px];
|
@apply text-muted mt-1 text-[11px];
|
||||||
}
|
}
|
||||||
@media (max-width: 800px) {
|
@media (max-width: 800px) {
|
||||||
.workspace-heading:has(.project-index-heading) {
|
|
||||||
@apply py-2.5 px-3;
|
|
||||||
}
|
|
||||||
.project-index-chrome {
|
.project-index-chrome {
|
||||||
@apply gap-2;
|
@apply gap-2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,48 @@
|
|||||||
import type { InjectionKey, ShallowRef } from 'vue'
|
import type { InjectionKey, ShallowRef } from 'vue'
|
||||||
import type { Project } from './types'
|
import type { Project } from './types'
|
||||||
|
|
||||||
/** 由项目布局发布给应用侧栏的访问状态;不额外请求或持久化项目数据。 */
|
export type ProjectSection =
|
||||||
|
| 'create-drama'
|
||||||
|
| 'breakdown'
|
||||||
|
| 'visual-style'
|
||||||
|
| 'subject-identity'
|
||||||
|
| 'subject-images'
|
||||||
|
| 'storyboard'
|
||||||
|
| 'production'
|
||||||
|
|
||||||
|
export interface ProjectSectionAccess {
|
||||||
|
enabled: boolean
|
||||||
|
reason: string
|
||||||
|
nextPath?: ProjectSection
|
||||||
|
nextLabel?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 项目侧栏与项目布局共享同一份制作阶段准入结果。 */
|
||||||
export interface ProjectAccess {
|
export interface ProjectAccess {
|
||||||
projectId: string
|
projectId: string
|
||||||
completed: boolean
|
completed: boolean
|
||||||
|
sections: Record<ProjectSection, ProjectSectionAccess>
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 侧栏与项目布局共享同一份判定,初次读取和切换项目时默认锁定。 */
|
|
||||||
export const projectAccessKey: InjectionKey<ShallowRef<ProjectAccess | null>> = Symbol('project-access')
|
export const projectAccessKey: InjectionKey<ShallowRef<ProjectAccess | null>> = Symbol('project-access')
|
||||||
|
|
||||||
/** 仅正式项目状态 completed 解锁下游;已有部分剧集或旧 checkpoint 不代表剧本完成。 */
|
/** 正式项目状态 completed 才表示剧本创作结束。 */
|
||||||
export function isProjectComplete(project: Pick<Project, 'id' | 'status'> | null, projectId: string): boolean {
|
export function isProjectComplete(project: Pick<Project, 'id' | 'status'> | null, projectId: string): boolean {
|
||||||
return !!projectId && project?.id === projectId && project.status === 'completed'
|
return !!projectId && project?.id === projectId && project.status === 'completed'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 路由末段映射到制作工作区;项目资产库不参与主流程门禁。 */
|
||||||
|
export function projectSectionFromPath(path: string): ProjectSection | null {
|
||||||
|
const section = path.replace(/\/+$/, '').split('/').at(-1)
|
||||||
|
return [
|
||||||
|
'create-drama',
|
||||||
|
'breakdown',
|
||||||
|
'visual-style',
|
||||||
|
'subject-identity',
|
||||||
|
'subject-images',
|
||||||
|
'storyboard',
|
||||||
|
'production'
|
||||||
|
].includes(section ?? '')
|
||||||
|
? (section as ProjectSection)
|
||||||
|
: null
|
||||||
|
}
|
||||||
@@ -1,18 +1,42 @@
|
|||||||
import { request, optionalResource } from '../../lib/http'
|
import { request, optionalResource } from '../../lib/http'
|
||||||
import type { Checkpoint } from '../workflows/types'
|
import type { Checkpoint } from '../workflows/types'
|
||||||
import type { CreateProjectInput, DramaState, Project, ProjectDetail } from './types'
|
import type { WorkflowExecutionStart } from '../workflows/execution.types'
|
||||||
|
import type {
|
||||||
|
CreateProjectInput,
|
||||||
|
DramaState,
|
||||||
|
Project,
|
||||||
|
ProjectDetail,
|
||||||
|
ProjectStageReadiness,
|
||||||
|
UpdateProjectInput
|
||||||
|
} from './types'
|
||||||
|
|
||||||
/** 项目与 Create Drama API;路径严格对应后端 dev。 */
|
/** 项目与 Create Drama API;路径严格对应后端 dev。 */
|
||||||
export const projectsApi = {
|
export const projectsApi = {
|
||||||
list: (signal?: AbortSignal) => request<Project[]>('/projects', { signal }),
|
list: (signal?: AbortSignal) => request<Project[]>('/projects', { signal }),
|
||||||
detail: (id: string, signal?: AbortSignal) =>
|
detail: (id: string, signal?: AbortSignal) =>
|
||||||
request<ProjectDetail>(`/projects/${encodeURIComponent(id)}`, { signal }),
|
request<ProjectDetail>(`/projects/${encodeURIComponent(id)}`, { signal }),
|
||||||
|
stageReadiness: (id: string, signal?: AbortSignal) =>
|
||||||
|
request<ProjectStageReadiness>(`/projects/${encodeURIComponent(id)}/stage-readiness`, { signal }),
|
||||||
create: (input: CreateProjectInput) =>
|
create: (input: CreateProjectInput) =>
|
||||||
request<{ projectId: string; status: string }>('/projects', { method: 'POST', body: input }),
|
request<{ projectId: string; status: string; executionId: string }>('/projects', {
|
||||||
|
method: 'POST',
|
||||||
|
body: input
|
||||||
|
}),
|
||||||
|
update: (id: string, input: UpdateProjectInput) =>
|
||||||
|
request<Project>(`/projects/${encodeURIComponent(id)}`, { method: 'PUT', body: input }),
|
||||||
|
deleteReadiness: (id: string, signal?: AbortSignal) =>
|
||||||
|
request<{
|
||||||
|
projectId: string
|
||||||
|
canDelete: boolean
|
||||||
|
totalActiveTasks: number
|
||||||
|
activeTasks: Record<string, number>
|
||||||
|
}>(`/projects/${encodeURIComponent(id)}/delete-readiness`, { signal }),
|
||||||
|
delete: (id: string) =>
|
||||||
|
request<{ id: string; deleted: boolean }>(`/projects/${encodeURIComponent(id)}`, { method: 'DELETE' }),
|
||||||
state: (id: string, signal?: AbortSignal) =>
|
state: (id: string, signal?: AbortSignal) =>
|
||||||
optionalResource(request<DramaState>(`/projects/${encodeURIComponent(id)}/state`, { signal })),
|
optionalResource(request<DramaState>(`/projects/${encodeURIComponent(id)}/state`, { signal })),
|
||||||
checkpoints: (id: string, signal?: AbortSignal) =>
|
checkpoints: (id: string, signal?: AbortSignal) =>
|
||||||
request<Checkpoint[]>(`/projects/${encodeURIComponent(id)}/checkpoints`, { signal }),
|
request<Checkpoint[]>(`/projects/${encodeURIComponent(id)}/checkpoints`, { signal }),
|
||||||
resume: (id: string, action: 'resume-generation' | 'resume-rewrite') =>
|
resume: (id: string, action: 'resume-generation' | 'resume-rewrite') =>
|
||||||
request<unknown>(`/projects/${encodeURIComponent(id)}/${action}`, { method: 'POST', timeoutMs: 0 })
|
request<WorkflowExecutionStart>(`/projects/${encodeURIComponent(id)}/${action}`, { method: 'POST' })
|
||||||
}
|
}
|
||||||
@@ -10,13 +10,15 @@ import { projectsApi } from '../api'
|
|||||||
import { errorMessage } from '../../../lib/http'
|
import { errorMessage } from '../../../lib/http'
|
||||||
|
|
||||||
/** 新建剧本表单,202 成功后交由父级跳转,不在前端模拟生成。 */
|
/** 新建剧本表单,202 成功后交由父级跳转,不在前端模拟生成。 */
|
||||||
const emit = defineEmits<{ created: [projectId: string] }>()
|
const emit = defineEmits<{ created: [projectId: string, executionId: string] }>()
|
||||||
/** 新建剧本弹窗是否打开。 */
|
/** 新建剧本弹窗是否打开。 */
|
||||||
const open = ref(false)
|
const open = ref(false)
|
||||||
/** 创建请求是否正在提交。 */
|
/** 创建请求是否正在提交。 */
|
||||||
const busy = ref(false)
|
const busy = ref(false)
|
||||||
/** 创建请求的错误提示。 */
|
/** 创建请求的错误提示。 */
|
||||||
const error = ref('')
|
const error = ref('')
|
||||||
|
/** 公共表单实例,底栏和回车提交共用同一字段校验。 */
|
||||||
|
const formRef = ref<InstanceType<typeof AppForm> | null>(null)
|
||||||
/** 与后端 POST /projects 入参一致的创建表单。 */
|
/** 与后端 POST /projects 入参一致的创建表单。 */
|
||||||
const form = reactive({ title: '', topic: '', style: '', episodeCount: 1 })
|
const form = reactive({ title: '', topic: '', style: '', episodeCount: 1 })
|
||||||
|
|
||||||
@@ -35,7 +37,7 @@ async function submit() {
|
|||||||
open.value = false
|
open.value = false
|
||||||
form.title = ''
|
form.title = ''
|
||||||
form.topic = ''
|
form.topic = ''
|
||||||
emit('created', result.projectId)
|
emit('created', result.projectId, result.executionId)
|
||||||
} catch (cause) {
|
} catch (cause) {
|
||||||
error.value = errorMessage(cause)
|
error.value = errorMessage(cause)
|
||||||
} finally {
|
} finally {
|
||||||
@@ -61,6 +63,7 @@ const rules = {
|
|||||||
><NButton @click="open = true" type="primary"><Plus :size="16" />新建剧本</NButton></template
|
><NButton @click="open = true" type="primary"><Plus :size="16" />新建剧本</NButton></template
|
||||||
>
|
>
|
||||||
<AppForm
|
<AppForm
|
||||||
|
ref="formRef"
|
||||||
:model="form"
|
:model="form"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
:disabled="busy"
|
:disabled="busy"
|
||||||
@@ -116,14 +119,14 @@ const rules = {
|
|||||||
建议先用 1 集验证生成效果。生成会实际调用后端模型,产生相应费用。
|
建议先用 1 集验证生成效果。生成会实际调用后端模型,产生相应费用。
|
||||||
</p>
|
</p>
|
||||||
<NAlert v-if="error" role="alert" type="error" :show-icon="false" class=" ">{{ error }}</NAlert>
|
<NAlert v-if="error" role="alert" type="error" :show-icon="false" class=" ">{{ error }}</NAlert>
|
||||||
<div class="dialog-footer">
|
|
||||||
<NButton :disabled="busy" @click="open = false"> 取消</NButton
|
|
||||||
><NButton :disabled="busy" type="primary" attr-type="submit"
|
|
||||||
><LoaderCircle v-if="busy" :size="16" class="animate-spin" />开始生成<ArrowRight
|
|
||||||
v-if="!busy"
|
|
||||||
:size="16"
|
|
||||||
/></NButton>
|
|
||||||
</div>
|
|
||||||
</AppForm>
|
</AppForm>
|
||||||
|
<template #footer>
|
||||||
|
<NButton :disabled="busy" @click="open = false">取消</NButton>
|
||||||
|
<NButton :disabled="busy" type="primary" @click="formRef?.validate(submit)">
|
||||||
|
<LoaderCircle v-if="busy" :size="16" class="animate-spin" />
|
||||||
|
开始生成
|
||||||
|
<ArrowRight v-if="!busy" :size="16" />
|
||||||
|
</NButton>
|
||||||
|
</template>
|
||||||
</AppDialog>
|
</AppDialog>
|
||||||
</template>
|
</template>
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, reactive, ref, watch } from 'vue'
|
||||||
|
import { NAlert, NButton, NInput } from 'naive-ui'
|
||||||
|
import { AppDialog } from '../../../components/ui'
|
||||||
|
import { errorMessage } from '../../../lib/http'
|
||||||
|
import { projectsApi } from '../api'
|
||||||
|
import type { Project } from '../types'
|
||||||
|
|
||||||
|
/** 永久删除项目;要求输入项目名称二次确认。 */
|
||||||
|
const props = defineProps<{ project: Project | null }>()
|
||||||
|
const open = defineModel<boolean>('open', { default: false })
|
||||||
|
const emit = defineEmits<{ deleted: [id: string] }>()
|
||||||
|
const state = reactive({ confirm: '', pending: false, error: '' })
|
||||||
|
const readiness = ref<Awaited<ReturnType<typeof projectsApi.deleteReadiness>> | null>(null)
|
||||||
|
const readinessPending = ref(false)
|
||||||
|
const expected = computed(() => props.project?.title || props.project?.topic || '')
|
||||||
|
const confirmed = computed(() => !!props.project && state.confirm.trim() === expected.value)
|
||||||
|
watch(
|
||||||
|
() => [open.value, props.project?.id],
|
||||||
|
async () => {
|
||||||
|
if (!open.value || !props.project) return
|
||||||
|
state.confirm = ''
|
||||||
|
state.error = ''
|
||||||
|
readiness.value = null
|
||||||
|
readinessPending.value = true
|
||||||
|
try {
|
||||||
|
readiness.value = await projectsApi.deleteReadiness(props.project.id)
|
||||||
|
} catch (cause) {
|
||||||
|
state.error = errorMessage(cause)
|
||||||
|
} finally {
|
||||||
|
readinessPending.value = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
async function remove() {
|
||||||
|
if (!props.project || state.pending || !confirmed.value || !readiness.value?.canDelete) return
|
||||||
|
const id = props.project.id
|
||||||
|
state.pending = true
|
||||||
|
state.error = ''
|
||||||
|
try {
|
||||||
|
const result = await projectsApi.delete(id)
|
||||||
|
if (!result.deleted || result.id !== id) throw new Error('后端未确认项目删除结果。')
|
||||||
|
emit('deleted', id)
|
||||||
|
open.value = false
|
||||||
|
} catch (cause) {
|
||||||
|
state.error = errorMessage(cause)
|
||||||
|
} finally {
|
||||||
|
state.pending = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<AppDialog v-model:open="open" :title="`永久删除 · ${expected}`" description="删除后无法恢复。">
|
||||||
|
<NAlert type="error" :show-icon="false" class="mt-4">
|
||||||
|
会永久删除剧本、主体、身份、形态、分镜、首帧、视频、工作流记录,以及本地 Storage
|
||||||
|
中属于该项目的图片、视频和上传素材。
|
||||||
|
</NAlert>
|
||||||
|
<NAlert v-if="readinessPending" type="info" :show-icon="false" class="mt-3">正在检查项目后台任务…</NAlert>
|
||||||
|
<NAlert v-else-if="readiness && !readiness.canDelete" type="warning" :show-icon="false" class="mt-3">
|
||||||
|
当前有
|
||||||
|
{{ readiness.totalActiveTasks }}
|
||||||
|
个后台任务正在执行,暂不能删除。请等待图片、首帧、视频或工作流任务结束后再试。
|
||||||
|
</NAlert>
|
||||||
|
<NAlert v-if="state.error" type="error" :show-icon="false" class="mt-3">{{ state.error }}</NAlert>
|
||||||
|
<p class="mt-5 text-xs">
|
||||||
|
请输入 <strong>{{ expected }}</strong> 确认删除:
|
||||||
|
</p>
|
||||||
|
<NInput v-model:value="state.confirm" class="mt-2" placeholder="输入项目名称" />
|
||||||
|
<template #footer>
|
||||||
|
<NButton @click="open = false">取消</NButton>
|
||||||
|
<NButton
|
||||||
|
type="error"
|
||||||
|
:loading="state.pending"
|
||||||
|
:disabled="!confirmed || readinessPending || !readiness?.canDelete"
|
||||||
|
@click="remove"
|
||||||
|
>永久删除项目</NButton
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</AppDialog>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, reactive, watch } from 'vue'
|
||||||
|
import { NAlert, NButton, NInput } from 'naive-ui'
|
||||||
|
import { AppDialog } from '../../../components/ui'
|
||||||
|
import { errorMessage } from '../../../lib/http'
|
||||||
|
import { projectsApi } from '../api'
|
||||||
|
import type { Project } from '../types'
|
||||||
|
|
||||||
|
/** 编辑项目基础信息;不会触发已有剧本或 Production 资产重生成。 */
|
||||||
|
const props = defineProps<{ project: Project | null }>()
|
||||||
|
const open = defineModel<boolean>('open', { default: false })
|
||||||
|
const emit = defineEmits<{ changed: [] }>()
|
||||||
|
const form = reactive({ title: '', topic: '', style: '' })
|
||||||
|
const state = reactive({ pending: false, error: '' })
|
||||||
|
const dirty = computed(
|
||||||
|
() =>
|
||||||
|
!!props.project &&
|
||||||
|
(form.title.trim() !== (props.project.title ?? '').trim() ||
|
||||||
|
form.topic.trim() !== props.project.topic.trim() ||
|
||||||
|
form.style.trim() !== (props.project.style ?? '').trim())
|
||||||
|
)
|
||||||
|
watch(
|
||||||
|
() => [open.value, props.project?.id],
|
||||||
|
() => {
|
||||||
|
if (!open.value || !props.project) return
|
||||||
|
form.title = props.project.title ?? ''
|
||||||
|
form.topic = props.project.topic
|
||||||
|
form.style = props.project.style ?? ''
|
||||||
|
state.error = ''
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
async function save() {
|
||||||
|
if (
|
||||||
|
!props.project ||
|
||||||
|
state.pending ||
|
||||||
|
!dirty.value ||
|
||||||
|
!form.title.trim() ||
|
||||||
|
!form.topic.trim() ||
|
||||||
|
!form.style.trim()
|
||||||
|
)
|
||||||
|
return
|
||||||
|
state.pending = true
|
||||||
|
state.error = ''
|
||||||
|
try {
|
||||||
|
await projectsApi.update(props.project.id, {
|
||||||
|
title: form.title.trim(),
|
||||||
|
topic: form.topic.trim(),
|
||||||
|
style: form.style.trim()
|
||||||
|
})
|
||||||
|
emit('changed')
|
||||||
|
open.value = false
|
||||||
|
} catch (cause) {
|
||||||
|
state.error = errorMessage(cause)
|
||||||
|
} finally {
|
||||||
|
state.pending = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<AppDialog
|
||||||
|
v-model:open="open"
|
||||||
|
:title="`编辑项目 · ${project?.title || project?.topic || ''}`"
|
||||||
|
description="仅更新项目基础信息,不自动重生成剧本或 Production 资产。"
|
||||||
|
>
|
||||||
|
<NAlert v-if="state.error" type="error" :show-icon="false" class="mt-4">{{ state.error }}</NAlert>
|
||||||
|
<section class="dialog-form-stack">
|
||||||
|
<label class="block text-xs">项目名称<NInput v-model:value="form.title" class="mt-2" /></label>
|
||||||
|
<label class="block text-xs"
|
||||||
|
>故事主题<NInput
|
||||||
|
v-model:value="form.topic"
|
||||||
|
type="textarea"
|
||||||
|
:autosize="{ minRows: 3, maxRows: 8 }"
|
||||||
|
class="mt-2"
|
||||||
|
/></label>
|
||||||
|
<label class="block text-xs">风格<NInput v-model:value="form.style" class="mt-2" /></label>
|
||||||
|
</section>
|
||||||
|
<template #footer>
|
||||||
|
<NButton @click="open = false">取消</NButton>
|
||||||
|
<NButton
|
||||||
|
type="primary"
|
||||||
|
:loading="state.pending"
|
||||||
|
:disabled="!dirty || !form.title.trim() || !form.topic.trim() || !form.style.trim()"
|
||||||
|
@click="save"
|
||||||
|
>保存项目</NButton
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</AppDialog>
|
||||||
|
</template>
|
||||||
@@ -8,15 +8,25 @@ import type { Ref } from 'vue'
|
|||||||
/** 同一项目的各个 graph 共用一份查询,避免每个面板重复请求。 */
|
/** 同一项目的各个 graph 共用一份查询,避免每个面板重复请求。 */
|
||||||
export function useProjectData(id: Ref<string>) {
|
export function useProjectData(id: Ref<string>) {
|
||||||
const query = useQuery(id, async (projectId, signal) => {
|
const query = useQuery(id, async (projectId, signal) => {
|
||||||
const [project, checkpoints] = await Promise.all([
|
const [project, checkpoints, stageReadiness] = await Promise.all([
|
||||||
projectsApi.detail(projectId, signal),
|
projectsApi.detail(projectId, signal),
|
||||||
projectsApi.checkpoints(projectId, signal)
|
projectsApi.checkpoints(projectId, signal),
|
||||||
|
projectsApi.stageReadiness(projectId, signal)
|
||||||
])
|
])
|
||||||
return { project, checkpoints }
|
return { project, checkpoints, stageReadiness }
|
||||||
})
|
})
|
||||||
const project = computed<ProjectDetail | null>(() => query.data.value?.project ?? null)
|
const project = computed<ProjectDetail | null>(() => query.data.value?.project ?? null)
|
||||||
const checkpoints = computed<Checkpoint[]>(() => query.data.value?.checkpoints ?? [])
|
const checkpoints = computed<Checkpoint[]>(() => query.data.value?.checkpoints ?? [])
|
||||||
return { ...query, project, checkpoints }
|
const stageReadiness = computed(() => query.data.value?.stageReadiness ?? null)
|
||||||
|
/** 子页面完成当前步骤后调用,只刷新轻量项目状态与导航门禁。 */
|
||||||
|
async function refreshStageReadiness() {
|
||||||
|
const projectId = id.value
|
||||||
|
if (!projectId || !query.data.value) return
|
||||||
|
const nextReadiness = await projectsApi.stageReadiness(projectId)
|
||||||
|
if (id.value === projectId && query.data.value)
|
||||||
|
query.data.value = { ...query.data.value, stageReadiness: nextReadiness }
|
||||||
|
}
|
||||||
|
return { ...query, project, checkpoints, stageReadiness, refreshStageReadiness }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 项目布局向子页面提供的类型安全上下文。 */
|
/** 项目布局向子页面提供的类型安全上下文。 */
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ export interface CreateProjectInput {
|
|||||||
episodeCount: number
|
episodeCount: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 项目基础信息编辑;不会自动重生成已经存在的下游资产。 */
|
||||||
|
export interface UpdateProjectInput {
|
||||||
|
title: string
|
||||||
|
topic: string
|
||||||
|
style: string
|
||||||
|
}
|
||||||
|
|
||||||
/** 项目列表记录;列表接口不包含剧集数量,不能据此推断生成进度。 */
|
/** 项目列表记录;列表接口不包含剧集数量,不能据此推断生成进度。 */
|
||||||
export interface Project {
|
export interface Project {
|
||||||
id: string
|
id: string
|
||||||
@@ -73,3 +80,14 @@ export interface DramaState {
|
|||||||
rewriteSuggestion?: unknown
|
rewriteSuggestion?: unknown
|
||||||
rewritePlan?: unknown
|
rewritePlan?: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 项目制作导航使用的服务端统一阶段状态。 */
|
||||||
|
export interface ProjectStageReadiness {
|
||||||
|
projectId: string
|
||||||
|
script: { ready: boolean; reason: string | null }
|
||||||
|
breakdown: { ready: boolean; reason: string | null }
|
||||||
|
visualStyle: { ready: boolean; reason: string | null }
|
||||||
|
identity: { ready: boolean; reason: string | null }
|
||||||
|
subjectAssets: { ready: boolean; reason: string | null }
|
||||||
|
storyboard: { ready: boolean; reason: string | null }
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
import { computed, type Ref } from 'vue'
|
||||||
|
import type { ProjectAccess, ProjectSection } from './access'
|
||||||
|
import type { ProjectStageReadiness } from './types'
|
||||||
|
|
||||||
|
function accessState(ready: boolean | undefined, reason: string | null | undefined, fallback: string) {
|
||||||
|
return { enabled: Boolean(ready), reason: reason || fallback }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 将服务端统一 readiness 转为侧栏、URL 门禁和下一步引导,前端不复制制作规则。 */
|
||||||
|
export function useProjectStageAccess(projectId: Ref<string>, readiness: Ref<ProjectStageReadiness | null>) {
|
||||||
|
const sections = computed<Record<ProjectSection, ProjectAccess['sections'][ProjectSection]>>(() => {
|
||||||
|
const state = readiness.value
|
||||||
|
return {
|
||||||
|
'create-drama': { enabled: true, reason: '' },
|
||||||
|
breakdown: {
|
||||||
|
...accessState(state?.script.ready, state?.script.reason, '请先完成剧本创作'),
|
||||||
|
nextPath: 'create-drama',
|
||||||
|
nextLabel: '前往剧本创作'
|
||||||
|
},
|
||||||
|
'visual-style': {
|
||||||
|
...accessState(state?.breakdown.ready, state?.breakdown.reason, '请先完成剧本拆解'),
|
||||||
|
nextPath: 'breakdown',
|
||||||
|
nextLabel: '前往剧本拆解'
|
||||||
|
},
|
||||||
|
'subject-identity': {
|
||||||
|
enabled: Boolean(state?.breakdown.ready && state?.visualStyle.ready),
|
||||||
|
reason: state?.breakdown.reason || state?.visualStyle.reason || '请先准备视觉风格',
|
||||||
|
nextPath: state?.breakdown.ready ? 'visual-style' : 'breakdown',
|
||||||
|
nextLabel: state?.breakdown.ready ? '前往视觉风格' : '前往剧本拆解'
|
||||||
|
},
|
||||||
|
'subject-images': {
|
||||||
|
enabled: Boolean(state?.breakdown.ready && state?.visualStyle.ready && state?.identity.ready),
|
||||||
|
reason:
|
||||||
|
state?.breakdown.reason ||
|
||||||
|
state?.visualStyle.reason ||
|
||||||
|
state?.identity.reason ||
|
||||||
|
'请先完成主体身份准备',
|
||||||
|
nextPath: state?.visualStyle.ready
|
||||||
|
? 'subject-identity'
|
||||||
|
: state?.breakdown.ready
|
||||||
|
? 'visual-style'
|
||||||
|
: 'breakdown',
|
||||||
|
nextLabel: state?.visualStyle.ready
|
||||||
|
? '前往主体身份'
|
||||||
|
: state?.breakdown.ready
|
||||||
|
? '前往视觉风格'
|
||||||
|
: '前往剧本拆解'
|
||||||
|
},
|
||||||
|
storyboard: {
|
||||||
|
enabled: Boolean(state?.breakdown.ready && state?.subjectAssets.ready),
|
||||||
|
reason: state?.breakdown.reason || state?.subjectAssets.reason || '请先准备主体素材',
|
||||||
|
nextPath: state?.breakdown.ready ? 'subject-images' : 'breakdown',
|
||||||
|
nextLabel: state?.breakdown.ready ? '前往形态图片' : '前往剧本拆解'
|
||||||
|
},
|
||||||
|
production: {
|
||||||
|
enabled: Boolean(state?.breakdown.ready && state?.subjectAssets.ready && state?.storyboard.ready),
|
||||||
|
reason:
|
||||||
|
state?.breakdown.reason ||
|
||||||
|
state?.subjectAssets.reason ||
|
||||||
|
state?.storyboard.reason ||
|
||||||
|
'请先完成镜头制作准备',
|
||||||
|
nextPath: state?.subjectAssets.ready
|
||||||
|
? 'storyboard'
|
||||||
|
: state?.breakdown.ready
|
||||||
|
? 'subject-images'
|
||||||
|
: 'breakdown',
|
||||||
|
nextLabel: state?.subjectAssets.ready
|
||||||
|
? '前往分镜设计'
|
||||||
|
: state?.breakdown.ready
|
||||||
|
? '前往形态图片'
|
||||||
|
: '前往剧本拆解'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const scriptReady = computed(() => readiness.value?.script.ready === true)
|
||||||
|
return { projectId, scriptReady, sections }
|
||||||
|
}
|
||||||
@@ -5,21 +5,9 @@ import { integerRule } from '../../lib/form-rules'
|
|||||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||||
import ActionMenu from '../../components/ui/ActionMenu.vue'
|
import ActionMenu from '../../components/ui/ActionMenu.vue'
|
||||||
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
|
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
|
||||||
import {
|
import { NScrollbar, NAlert, NButton, NCheckbox, NInputNumber, NProgress, NSelect, NTab, NTabs } from 'naive-ui'
|
||||||
NScrollbar,
|
|
||||||
NAlert,
|
|
||||||
NButton,
|
|
||||||
NCheckbox,
|
|
||||||
NCollapse,
|
|
||||||
NCollapseItem,
|
|
||||||
NInputNumber,
|
|
||||||
NProgress,
|
|
||||||
NSelect,
|
|
||||||
NTab,
|
|
||||||
NTabs
|
|
||||||
} from 'naive-ui'
|
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { ArrowLeft, RefreshCw } from '@lucide/vue'
|
import { ArrowLeft } from '@lucide/vue'
|
||||||
import { EmptyState } from '../../components/ui'
|
import { EmptyState } from '../../components/ui'
|
||||||
import { downloadText } from '../../lib/format'
|
import { downloadText } from '../../lib/format'
|
||||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||||
@@ -27,6 +15,9 @@ import GenerationReceipt from './components/GenerationReceipt.vue'
|
|||||||
import ShotDesign from './components/ShotDesign.vue'
|
import ShotDesign from './components/ShotDesign.vue'
|
||||||
import ShotTools from './components/ShotTools.vue'
|
import ShotTools from './components/ShotTools.vue'
|
||||||
import BeatShotDirectory from './components/BeatShotDirectory.vue'
|
import BeatShotDirectory from './components/BeatShotDirectory.vue'
|
||||||
|
import SubjectCoverageAudit from './components/SubjectCoverageAudit.vue'
|
||||||
|
import type { SubjectCoverageIssue } from './coverage.types'
|
||||||
|
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||||
import { useStoryboard } from './useStoryboard'
|
import { useStoryboard } from './useStoryboard'
|
||||||
|
|
||||||
const detailTab = ref('design')
|
const detailTab = ref('design')
|
||||||
@@ -42,6 +33,7 @@ const {
|
|||||||
shot,
|
shot,
|
||||||
query,
|
query,
|
||||||
data,
|
data,
|
||||||
|
episodeSourceUnavailable,
|
||||||
prerequisites,
|
prerequisites,
|
||||||
session,
|
session,
|
||||||
operation,
|
operation,
|
||||||
@@ -51,9 +43,12 @@ const {
|
|||||||
allowed,
|
allowed,
|
||||||
blocked,
|
blocked,
|
||||||
directionComplete,
|
directionComplete,
|
||||||
|
visualStateComplete,
|
||||||
hasCurrentEpisodeShots,
|
hasCurrentEpisodeShots,
|
||||||
|
executions,
|
||||||
run
|
run
|
||||||
} = useStoryboard()
|
} = useStoryboard()
|
||||||
|
const productionReady = computed(() => directionComplete.value && visualStateComplete.value)
|
||||||
const coverage = computed(() => [
|
const coverage = computed(() => [
|
||||||
{
|
{
|
||||||
title: '导演设计',
|
title: '导演设计',
|
||||||
@@ -61,7 +56,7 @@ const coverage = computed(() => [
|
|||||||
total: data.value?.directions.shotCount ?? 0
|
total: data.value?.directions.shotCount ?? 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '即时状态',
|
title: '画面状态',
|
||||||
count: data.value?.visualStates.visualStateCount ?? 0,
|
count: data.value?.visualStates.visualStateCount ?? 0,
|
||||||
total: data.value?.visualStates.shotCount ?? 0
|
total: data.value?.visualStates.shotCount ?? 0
|
||||||
}
|
}
|
||||||
@@ -87,12 +82,55 @@ function exportEpisode() {
|
|||||||
}
|
}
|
||||||
/** 回执到达后打开诊断区;平时留出镜头检查空间。 */
|
/** 回执到达后打开诊断区;平时留出镜头检查空间。 */
|
||||||
const toolsOpen = ref(false)
|
const toolsOpen = ref(false)
|
||||||
const overview = ref<string[]>(['generation'])
|
/** 覆盖审计只保存剧集与镜头坐标,正式 ID 从当前查询结果中定位。 */
|
||||||
|
const auditLocation = ref<SubjectCoverageIssue | null>(null)
|
||||||
|
/** 覆盖定位失败时保留明确反馈,不猜测其它镜头。 */
|
||||||
|
const auditLocationError = ref('')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换到引用遗漏发生的剧集,等待正式镜头数据后定位。
|
||||||
|
* @param issue 后端实际覆盖问题
|
||||||
|
*/
|
||||||
|
function locateCoverageIssue(issue: SubjectCoverageIssue) {
|
||||||
|
if (!episodeOptions.value.some(episode => episode.episodeNo === issue.episodeNo)) {
|
||||||
|
auditLocationError.value = '审计中的剧集不在当前项目,请刷新分镜与审计结果。'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
auditLocation.value = issue
|
||||||
|
auditLocationError.value = ''
|
||||||
|
selectedEpisode.value = issue.episodeNo
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 当前集查询完成后按唯一坐标匹配正式镜头;目标缺失时不切到其他镜头。 */
|
||||||
|
watch(
|
||||||
|
[episodeNo, shots, () => query.loading.value, auditLocation],
|
||||||
|
() => {
|
||||||
|
const issue = auditLocation.value
|
||||||
|
if (
|
||||||
|
!issue ||
|
||||||
|
query.loading.value ||
|
||||||
|
episodeNo.value !== issue.episodeNo ||
|
||||||
|
data.value?.directions.episodeNo !== issue.episodeNo
|
||||||
|
)
|
||||||
|
return
|
||||||
|
if (issue.shotNo !== null) {
|
||||||
|
const target = shots.value.find(item => item.beatNo === issue.beatNo && item.shotNo === issue.shotNo)
|
||||||
|
if (!target) {
|
||||||
|
auditLocationError.value = '目标镜头已变化,请刷新后重新检查主体引用。'
|
||||||
|
auditLocation.value = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
selectedShot.value = target.shotId
|
||||||
|
}
|
||||||
|
toolsOpen.value = false
|
||||||
|
auditLocation.value = null
|
||||||
|
},
|
||||||
|
{ flush: 'post' }
|
||||||
|
)
|
||||||
watch(
|
watch(
|
||||||
() => session.value.receipt,
|
() => session.value.receipt,
|
||||||
receipt => {
|
receipt => {
|
||||||
if (receipt) {
|
if (receipt) {
|
||||||
overview.value = ['generation']
|
|
||||||
toolsOpen.value = true
|
toolsOpen.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,8 +140,13 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<WorkspacePage split compact class="storyboard-workspace-page"
|
<WorkspacePage split compact class="storyboard-workspace-page">
|
||||||
><template #header
|
<template #notice>
|
||||||
|
<NAlert v-if="episodeSourceUnavailable" type="info" :show-icon="false">
|
||||||
|
本集镜头已重新生成。新标题和剧情详情尚未提供,当前只显示正式镜头编号;请按实际生成规格核对内容。
|
||||||
|
</NAlert>
|
||||||
|
</template>
|
||||||
|
<template #header
|
||||||
><div class="workspace-toolbar">
|
><div class="workspace-toolbar">
|
||||||
<div class="toolbar-episode">
|
<div class="toolbar-episode">
|
||||||
<NSelect
|
<NSelect
|
||||||
@@ -127,15 +170,6 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
</div>
|
</div>
|
||||||
<div class="toolbar-actions">
|
<div class="toolbar-actions">
|
||||||
<div class="flex gap-3">
|
<div class="flex gap-3">
|
||||||
<NButton
|
|
||||||
:disabled="query.loading.value"
|
|
||||||
@click="query.refresh"
|
|
||||||
quaternary
|
|
||||||
class="icon-button"
|
|
||||||
aria-label="刷新分镜"
|
|
||||||
title="刷新分镜"
|
|
||||||
><RefreshCw :size="16" :class="{ 'animate-spin': query.loading.value }"
|
|
||||||
/></NButton>
|
|
||||||
<ActionMenu
|
<ActionMenu
|
||||||
label="分镜更多操作"
|
label="分镜更多操作"
|
||||||
:items="[{ key: 'export', label: '导出本集', disabled: !shots.length }]"
|
:items="[{ key: 'export', label: '导出本集', disabled: !shots.length }]"
|
||||||
@@ -218,114 +252,126 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="workspace-overview-panel">
|
<div class="workspace-overview-panel">
|
||||||
<NCollapse v-model:expanded-names="overview"
|
<div class="overview-content workspace-section-stack">
|
||||||
><NCollapseItem name="generation" title="生成配置、批量操作与回执"
|
<!-- 以下是零费用主体引用覆盖检查模块 -->
|
||||||
><div class="overview-content">
|
<SubjectCoverageAudit :project-id="id" @locate="locateCoverageIssue" />
|
||||||
<div class="generation-row">
|
<NAlert v-if="auditLocationError" type="warning" :show-icon="false">{{
|
||||||
<div>
|
auditLocationError
|
||||||
<h3 class="text-sm font-semibold">
|
}}</NAlert>
|
||||||
<span class="mr-2 font-mono text-xs text-muted">00</span
|
<h3 class="mb-3 text-sm font-semibold">生成与恢复</h3>
|
||||||
>本集镜头拆解
|
<div class="generation-row">
|
||||||
</h3>
|
<div>
|
||||||
<p class="mt-2 text-xs leading-6 text-muted">
|
<h3 class="text-sm font-semibold">
|
||||||
只重新拆解当前选择的第
|
<span class="mr-2 font-mono text-xs text-muted">00</span>本集镜头拆解
|
||||||
{{ episodeNo }}
|
</h3>
|
||||||
集,其它剧集不受影响。新镜头会替换旧镜头,并清空本集已有的导演设计、即时状态、首帧与视频结果。
|
<p class="mt-2 text-xs leading-6 text-muted">
|
||||||
</p>
|
只重新拆解当前选择的第
|
||||||
</div>
|
{{ episodeNo }}
|
||||||
<div class="flex flex-wrap gap-2">
|
集,其它剧集不受影响。新镜头会替换旧镜头,并清空本集已有的导演设计、即时状态、首帧与视频结果。
|
||||||
<ConfirmAction
|
|
||||||
:label="`重生成第 ${episodeNo} 集镜头`"
|
|
||||||
:disabled="!allowed['shots-current']"
|
|
||||||
acknowledgement
|
|
||||||
:description="`将删除并重建第 ${episodeNo} 集的正式镜头。该集已有导演设计、即时状态、首帧、提示词和视频结果会随旧镜头一并失效,且无法撤销;其它剧集保持不变。`"
|
|
||||||
@confirm="run('shots-current')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p v-if="!hasCurrentEpisodeShots" class="mt-3 text-[11px] text-muted">
|
|
||||||
当前集尚无正式 Storyboard Shot,不能执行单集重生成;请先完成拆解流程。
|
|
||||||
</p>
|
</p>
|
||||||
<div class="generation-row">
|
</div>
|
||||||
<div>
|
<div class="flex flex-wrap gap-2">
|
||||||
<h3 class="text-sm font-semibold">
|
<ConfirmAction
|
||||||
<span class="mr-2 font-mono text-xs text-muted">01</span
|
:label="`重生成第 ${episodeNo} 集镜头`"
|
||||||
>导演摄影设计
|
:disabled="!allowed['shots-current']"
|
||||||
</h3>
|
acknowledgement
|
||||||
<p class="mt-2 text-xs leading-6 text-muted">
|
:description="`将删除并重建第 ${episodeNo} 集的正式镜头。该集已有导演设计、即时状态、首帧、提示词和视频结果会随旧镜头一并失效,且无法撤销;其它剧集保持不变。`"
|
||||||
景别、机位、运镜与构图。正式项目生成默认跳过已完整剧集,覆盖模式会重新生成全部剧集。
|
@confirm="run('shots-current')"
|
||||||
</p>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-wrap gap-2">
|
</div>
|
||||||
<ConfirmAction
|
<p v-if="!hasCurrentEpisodeShots" class="mt-3 text-[11px] text-muted">
|
||||||
:label="force ? '重生成全部导演设计' : '补齐项目导演设计'"
|
当前集还没有可用镜头,请先完成剧本拆解。
|
||||||
:disabled="!allowed['direction-all']"
|
</p>
|
||||||
acknowledgement
|
<div class="generation-row">
|
||||||
:description="
|
<div>
|
||||||
force
|
<h3 class="text-sm font-semibold">
|
||||||
? '重新生成项目全部剧集的导演设计,覆盖已有结果。'
|
<span class="mr-2 font-mono text-xs text-muted">01</span>导演摄影设计
|
||||||
: '对整个项目生成导演设计,跳过已完整保存的剧集,可用于重试失败或未完成的剧集。'
|
</h3>
|
||||||
"
|
<p class="mt-2 text-xs leading-6 text-muted">
|
||||||
@confirm="run('direction-all')"
|
景别、机位、运镜与构图。正式项目生成默认跳过已完整剧集,覆盖模式会重新生成全部剧集。
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="generation-row">
|
|
||||||
<div>
|
|
||||||
<h3 class="text-sm font-semibold">
|
|
||||||
<span class="mr-2 font-mono text-xs text-muted">02</span
|
|
||||||
>即时视觉状态
|
|
||||||
</h3>
|
|
||||||
<p class="mt-2 text-xs leading-6 text-muted">
|
|
||||||
表情、姿态、位置、环境与连续性。每集需要完整导演设计;批量中缺少前置设计的剧集会单独报错。
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-wrap gap-2">
|
|
||||||
<ConfirmAction
|
|
||||||
:label="force ? '重生成全部即时状态' : '补齐项目即时状态'"
|
|
||||||
:disabled="!allowed['visual-all']"
|
|
||||||
acknowledgement
|
|
||||||
:description="
|
|
||||||
force
|
|
||||||
? '重新生成整个项目的即时状态,覆盖已有结果。每集必须先有完整导演设计。'
|
|
||||||
: '补齐项目即时状态,跳过完整剧集;未完成导演设计的剧集会返回失败原因。'
|
|
||||||
"
|
|
||||||
@confirm="run('visual-all')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p class="mt-4 text-[11px] leading-6 text-muted">
|
|
||||||
修改或覆盖上游设计后,后端不会自动使旧状态、旧提示词失效;请按顺序重生成下游内容。自动修复次数仅用于
|
|
||||||
VisualState。
|
|
||||||
</p>
|
</p>
|
||||||
<NCollapse class="mt-3 pt-3" :default-expanded-names="['details']"
|
</div>
|
||||||
><NCollapseItem name="details"
|
<div class="flex flex-wrap gap-2">
|
||||||
><template #header>视频提示词批量操作</template>
|
<ConfirmAction
|
||||||
<p class="my-3 text-xs leading-6 text-muted">
|
:label="force ? '重生成全部导演设计' : '补齐项目导演设计'"
|
||||||
后端会先校验 GenerationSpec
|
:disabled="!allowed['direction-all']"
|
||||||
与主体参考图。这里只生成提示词;首帧、视频任务、就绪诊断与失败重试已整理到
|
acknowledgement
|
||||||
<RouterLink
|
:description="
|
||||||
:to="`/projects/${id}/production`"
|
force
|
||||||
class="text-button mx-1"
|
? '重新生成项目全部剧集的导演设计,覆盖已有结果。'
|
||||||
>镜头生产</RouterLink
|
: '对整个项目生成导演设计,跳过已完整保存的剧集,可用于重试失败或未完成的剧集。'
|
||||||
>。
|
"
|
||||||
</p>
|
@confirm="run('direction-all')"
|
||||||
<ConfirmAction
|
/>
|
||||||
:label="force ? '重生成全部视频提示词' : '补齐项目视频提示词'"
|
</div>
|
||||||
:disabled="!allowed.prompts"
|
</div>
|
||||||
acknowledgement
|
<div class="generation-row">
|
||||||
:description="
|
<div>
|
||||||
force
|
<h3 class="text-sm font-semibold">
|
||||||
? '调用模型重新生成全项目镜头的视频提示词,覆盖已有正文。'
|
<span class="mr-2 font-mono text-xs text-muted">02</span>即时视觉状态
|
||||||
: '调用模型生成缺少视频提示词的镜头,已有提示词直接跳过。参考图缺失会返回失败。'
|
</h3>
|
||||||
"
|
<p class="mt-2 text-xs leading-6 text-muted">
|
||||||
@confirm="run('prompts')" /></NCollapseItem
|
表情、姿态、位置、环境与连续性。每集需要完整导演设计;批量中缺少前置设计的剧集会单独报错。
|
||||||
></NCollapse>
|
</p>
|
||||||
<GenerationReceipt
|
</div>
|
||||||
v-if="session.receipt"
|
<div class="flex flex-wrap gap-2">
|
||||||
:receipt="session.receipt"
|
<ConfirmAction
|
||||||
/></div></NCollapseItem
|
:label="force ? '重生成全部即时状态' : '补齐项目即时状态'"
|
||||||
></NCollapse>
|
:disabled="!allowed['visual-all']"
|
||||||
|
acknowledgement
|
||||||
|
:description="
|
||||||
|
force
|
||||||
|
? '重新生成整个项目的即时状态,覆盖已有结果。每集必须先有完整导演设计。'
|
||||||
|
: '补齐项目即时状态,跳过完整剧集;未完成导演设计的剧集会返回失败原因。'
|
||||||
|
"
|
||||||
|
@confirm="run('visual-all')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="mt-4 text-[11px] leading-6 text-muted">
|
||||||
|
修改或覆盖前面的设计后,已有状态和视频提示词不会自动更新;请按顺序重新生成后续内容。自动修复次数仅用于
|
||||||
|
VisualState。
|
||||||
|
</p>
|
||||||
|
<section>
|
||||||
|
<h3 class="text-sm font-semibold">视频提示词批量操作</h3>
|
||||||
|
<p class="my-3 text-xs leading-6 text-muted">
|
||||||
|
生成前会检查镜头设计和主体参考图是否齐全。这里只生成提示词;首帧、视频任务、状态检查与失败重试已整理到
|
||||||
|
<RouterLink :to="`/projects/${id}/production`" class="text-button mx-1"
|
||||||
|
>镜头生产</RouterLink
|
||||||
|
>。
|
||||||
|
</p>
|
||||||
|
<ConfirmAction
|
||||||
|
:label="force ? '重生成全部视频提示词' : '补齐项目视频提示词'"
|
||||||
|
:disabled="!allowed.prompts"
|
||||||
|
acknowledgement
|
||||||
|
:description="
|
||||||
|
force
|
||||||
|
? '调用模型重新生成全项目镜头的视频提示词,覆盖已有正文。'
|
||||||
|
: '调用模型生成缺少视频提示词的镜头,已有提示词直接跳过。参考图缺失会返回失败。'
|
||||||
|
"
|
||||||
|
@confirm="run('prompts')"
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
<!-- 以下是正式分镜后台执行状态模块 -->
|
||||||
|
<WorkflowExecutionPanel
|
||||||
|
v-for="entry in executions.filter(
|
||||||
|
item =>
|
||||||
|
item.observer.executionId.value &&
|
||||||
|
(item.title !== '单集镜头重生成' ||
|
||||||
|
item.observer.query.data.value?.metadata?.action ===
|
||||||
|
'regenerate-storyboard-episode')
|
||||||
|
)"
|
||||||
|
:key="entry.title"
|
||||||
|
:title="entry.title"
|
||||||
|
:execution="entry.observer.query.data.value"
|
||||||
|
:loading="entry.observer.query.loading.value"
|
||||||
|
:error="entry.observer.query.error.value"
|
||||||
|
@refresh="entry.observer.query.refresh"
|
||||||
|
@dismiss="entry.observer.dismiss"
|
||||||
|
/>
|
||||||
|
<GenerationReceipt v-if="session.receipt" :receipt="session.receipt" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</WorkspaceTools>
|
</WorkspaceTools>
|
||||||
</div></div
|
</div></div
|
||||||
@@ -348,6 +394,17 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
>
|
>
|
||||||
重试查询
|
重试查询
|
||||||
</NButton></NAlert
|
</NButton></NAlert
|
||||||
|
><NAlert
|
||||||
|
v-if="data && data.directions.shotCount && !productionReady"
|
||||||
|
type="warning"
|
||||||
|
:show-icon="false"
|
||||||
|
class="mt-4"
|
||||||
|
>
|
||||||
|
<strong>Production 前置设计未完成。</strong>
|
||||||
|
当前导演设计 {{ data.directions.directionCount }}/{{ data.directions.shotCount }},即时视觉状态
|
||||||
|
{{ data.visualStates.visualStateCount }}/{{
|
||||||
|
data.visualStates.shotCount
|
||||||
|
}}。请先补齐后再进入镜头生产,避免 后续镜头制作无法开始。 </NAlert
|
||||||
><NAlert
|
><NAlert
|
||||||
v-if="!prerequisites.directionEpisode || !prerequisites.visualEpisode"
|
v-if="!prerequisites.directionEpisode || !prerequisites.visualEpisode"
|
||||||
type="info"
|
type="info"
|
||||||
@@ -368,13 +425,13 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
<div v-if="!data && query.loading.value" class="panel p-8 text-sm text-muted" role="status">
|
<div v-if="!data && query.loading.value" class="panel p-8 text-sm text-muted" role="status">
|
||||||
正在读取正式分镜数据……
|
正在读取正式分镜数据……
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="shot" class="panel storyboard-workspace">
|
<div v-else-if="shots.length" class="panel storyboard-workspace workspace-surface">
|
||||||
<nav class="shot-list directory-panel" aria-label="本集镜头">
|
<nav class="shot-list directory-panel" aria-label="本集镜头">
|
||||||
<div class="directory-heading">
|
<div class="directory-heading">
|
||||||
<h3>
|
<h3>
|
||||||
镜头目录 <span>{{ shots.length }} 镜</span>
|
镜头目录 <span>{{ shots.length }} 镜</span>
|
||||||
</h3>
|
</h3>
|
||||||
<span>按 Beat 排列</span>
|
<span>按段落排列</span>
|
||||||
</div>
|
</div>
|
||||||
<NScrollbar
|
<NScrollbar
|
||||||
class="panel-scroll directory-scroll"
|
class="panel-scroll directory-scroll"
|
||||||
@@ -383,7 +440,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
>
|
>
|
||||||
<BeatShotDirectory
|
<BeatShotDirectory
|
||||||
:shots="shots"
|
:shots="shots"
|
||||||
:active-id="shot.shotId"
|
:active-id="shot?.shotId || ''"
|
||||||
item-class="shot-link"
|
item-class="shot-link"
|
||||||
@select="selectedShot = $event"
|
@select="selectedShot = $event"
|
||||||
>
|
>
|
||||||
@@ -395,10 +452,10 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
</NScrollbar>
|
</NScrollbar>
|
||||||
</nav>
|
</nav>
|
||||||
<article class="storyboard-detail min-w-0">
|
<article class="storyboard-detail min-w-0">
|
||||||
<NScrollbar class="panel-scroll" content-class="p-5 lg:p-7">
|
<NScrollbar v-if="shot" class="panel-scroll" content-class="p-5 lg:p-7">
|
||||||
<header class="mb-6">
|
<header class="mb-6">
|
||||||
<p class="eyebrow">
|
<p class="eyebrow">
|
||||||
BEAT {{ shot.beatNo }} / SHOT {{ shot.shotNo }}
|
段落 {{ shot.beatNo }} · 镜头 {{ shot.shotNo }}
|
||||||
<span v-if="shot.durationSeconds" class="ml-3">{{ shot.durationSeconds }}s</span>
|
<span v-if="shot.durationSeconds" class="ml-3">{{ shot.durationSeconds }}s</span>
|
||||||
</p>
|
</p>
|
||||||
<h3 class="mt-2 text-lg font-semibold">{{ shot.title }}</h3>
|
<h3 class="mt-2 text-lg font-semibold">{{ shot.title }}</h3>
|
||||||
@@ -408,10 +465,6 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
<p v-if="shot.visualFocus" class="mt-2 text-xs leading-6 text-muted">
|
<p v-if="shot.visualFocus" class="mt-2 text-xs leading-6 text-muted">
|
||||||
视觉重点:{{ shot.visualFocus }}
|
视觉重点:{{ shot.visualFocus }}
|
||||||
</p>
|
</p>
|
||||||
<p class="mt-3 break-all font-mono text-[10px] text-muted">Shot ID · {{ shot.shotId }}</p>
|
|
||||||
<p class="mt-1 text-[10px] text-muted">
|
|
||||||
标题与剧情描述取自最近可用 Breakdown 快照;以下设计与状态取自数据库。
|
|
||||||
</p>
|
|
||||||
</header>
|
</header>
|
||||||
<div>
|
<div>
|
||||||
<NTabs v-model:value="detailTab" type="line" size="small" aria-label="镜头详情"
|
<NTabs v-model:value="detailTab" type="line" size="small" aria-label="镜头详情"
|
||||||
@@ -419,16 +472,28 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
>
|
>
|
||||||
<div v-if="detailTab === 'design'" class="pt-6"><ShotDesign :shot="shot" /></div>
|
<div v-if="detailTab === 'design'" class="pt-6"><ShotDesign :shot="shot" /></div>
|
||||||
<div v-if="detailTab === 'tools'" class="pt-6">
|
<div v-if="detailTab === 'tools'" class="pt-6">
|
||||||
<ShotTools :key="shot.shotId" :project-id="id" :shot="shot" :disabled="blocked" />
|
<ShotTools
|
||||||
|
:key="shot.shotId"
|
||||||
|
:project-id="id"
|
||||||
|
:episode-no="episodeNo"
|
||||||
|
:shot="shot"
|
||||||
|
:disabled="blocked"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</NScrollbar>
|
</NScrollbar>
|
||||||
|
<!-- 以下是无效镜头地址的定位反馈模块 -->
|
||||||
|
<EmptyState
|
||||||
|
v-if="!shot"
|
||||||
|
title="链接中的镜头已不存在或不属于本集"
|
||||||
|
description="请在左侧目录重新选择镜头。"
|
||||||
|
/>
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
<EmptyState
|
<EmptyState
|
||||||
v-else-if="data"
|
v-else-if="data"
|
||||||
title="本集还没有正式分镜"
|
title="本集还没有正式分镜"
|
||||||
description="先完成剧本拆解与分镜持久化,再回来生成导演设计和即时状态。"
|
description="先完成剧本拆解,再回来完善镜头设计和画面状态。"
|
||||||
><RouterLink :to="`/projects/${id}/breakdown`" class="button button-secondary mt-4"
|
><RouterLink :to="`/projects/${id}/breakdown`" class="button button-secondary mt-4"
|
||||||
>前往拆解</RouterLink
|
>前往拆解</RouterLink
|
||||||
></EmptyState
|
></EmptyState
|
||||||
@@ -449,7 +514,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
@apply shrink-0;
|
@apply shrink-0;
|
||||||
}
|
}
|
||||||
.storyboard-workspace {
|
.storyboard-workspace {
|
||||||
@apply grid grid-cols-[220px_minmax(0,_1fr)] overflow-hidden;
|
@apply grid grid-cols-[220px_minmax(0,_1fr)] gap-3 overflow-hidden;
|
||||||
}
|
}
|
||||||
.shot-list {
|
.shot-list {
|
||||||
@apply max-h-[1000px] overflow-hidden bg-(--app-surface) pt-0 px-2 pb-5;
|
@apply max-h-[1000px] overflow-hidden bg-(--app-surface) pt-0 px-2 pb-5;
|
||||||
@@ -513,7 +578,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
@apply justify-start;
|
@apply justify-start;
|
||||||
}
|
}
|
||||||
.storyboard-workspace {
|
.storyboard-workspace {
|
||||||
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[184px_minmax(0,_1fr)];
|
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[184px_minmax(0,_1fr)] gap-3;
|
||||||
}
|
}
|
||||||
.storyboard-controls {
|
.storyboard-controls {
|
||||||
@apply grid-cols-[minmax(0,_1fr)_minmax(0,_1fr)];
|
@apply grid-cols-[minmax(0,_1fr)_minmax(0,_1fr)];
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
|
import type { WorkflowExecutionStart } from '../workflows/execution.types'
|
||||||
import { request } from '../../lib/http'
|
import { request } from '../../lib/http'
|
||||||
import type {
|
import type {
|
||||||
EpisodeDirections,
|
EpisodeDirections,
|
||||||
EpisodeVisualStates,
|
EpisodeVisualStates,
|
||||||
PromptBatchResult,
|
|
||||||
ShotPromptResult,
|
ShotPromptResult,
|
||||||
ShotReferences,
|
ShotReferences,
|
||||||
StoryboardBatchInput,
|
StoryboardBatchInput,
|
||||||
StoryboardBatchResult,
|
|
||||||
StoryboardShotRegenerationResult,
|
|
||||||
VisualStateBatchInput
|
VisualStateBatchInput
|
||||||
} from './types'
|
} from './types'
|
||||||
import type { ShotGenerationSpec } from './generation-spec.types'
|
import type { ShotGenerationSpec } from './generation-spec.types'
|
||||||
@@ -24,9 +22,14 @@ function shotPath(id: string) {
|
|||||||
|
|
||||||
/** Storyboard 正式路由契约;测试路由不暴露为前端生产入口。 */
|
/** Storyboard 正式路由契约;测试路由不暴露为前端生产入口。 */
|
||||||
export const storyboardApi = {
|
export const storyboardApi = {
|
||||||
/** 强制重生成指定单集的镜头拆解;后端校验通过后才覆盖正式 Storyboard。 */
|
/**
|
||||||
|
* 后台重生成指定单集镜头,终态后再读取正式分镜。
|
||||||
|
* @param id 正式项目 ID
|
||||||
|
* @param episodeNo 目标剧集编号
|
||||||
|
* @returns 真实后台任务观察句柄
|
||||||
|
*/
|
||||||
regenerateEpisodeShots: (id: string, episodeNo: number) =>
|
regenerateEpisodeShots: (id: string, episodeNo: number) =>
|
||||||
request<StoryboardShotRegenerationResult>(`${projectPath(id)}/storyboard-shots/regenerate`, {
|
request<WorkflowExecutionStart>(`${projectPath(id)}/storyboard-shots/regenerate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: { episodeNo },
|
body: { episodeNo },
|
||||||
timeoutMs: 0
|
timeoutMs: 0
|
||||||
@@ -35,14 +38,26 @@ export const storyboardApi = {
|
|||||||
request<EpisodeDirections>(`${projectPath(id)}/storyboard-directions?episodeNo=${episodeNo}`, { signal }),
|
request<EpisodeDirections>(`${projectPath(id)}/storyboard-directions?episodeNo=${episodeNo}`, { signal }),
|
||||||
visualStates: (id: string, episodeNo: number, signal?: AbortSignal) =>
|
visualStates: (id: string, episodeNo: number, signal?: AbortSignal) =>
|
||||||
request<EpisodeVisualStates>(`${projectPath(id)}/storyboard-visual-states?episodeNo=${episodeNo}`, { signal }),
|
request<EpisodeVisualStates>(`${projectPath(id)}/storyboard-visual-states?episodeNo=${episodeNo}`, { signal }),
|
||||||
|
/**
|
||||||
|
* 后台生成项目导演设计。
|
||||||
|
* @param id 正式项目 ID
|
||||||
|
* @param input 并发与覆盖范围
|
||||||
|
* @returns 真实后台任务观察句柄
|
||||||
|
*/
|
||||||
generateDirections: (id: string, input: StoryboardBatchInput) =>
|
generateDirections: (id: string, input: StoryboardBatchInput) =>
|
||||||
request<StoryboardBatchResult>(`${projectPath(id)}/storyboard-directions/generate`, {
|
request<WorkflowExecutionStart>(`${projectPath(id)}/storyboard-directions/generate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: input,
|
body: input,
|
||||||
timeoutMs: 0
|
timeoutMs: 0
|
||||||
}),
|
}),
|
||||||
|
/**
|
||||||
|
* 后台生成项目即时状态。
|
||||||
|
* @param id 正式项目 ID
|
||||||
|
* @param input 并发、覆盖与有限修复配置
|
||||||
|
* @returns 真实后台任务观察句柄
|
||||||
|
*/
|
||||||
generateVisualStates: (id: string, input: VisualStateBatchInput) =>
|
generateVisualStates: (id: string, input: VisualStateBatchInput) =>
|
||||||
request<StoryboardBatchResult>(`${projectPath(id)}/storyboard-visual-states/generate`, {
|
request<WorkflowExecutionStart>(`${projectPath(id)}/storyboard-visual-states/generate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: input,
|
body: input,
|
||||||
timeoutMs: 0
|
timeoutMs: 0
|
||||||
@@ -50,14 +65,23 @@ export const storyboardApi = {
|
|||||||
references: (id: string, signal?: AbortSignal) => request<ShotReferences>(`${shotPath(id)}/references`, { signal }),
|
references: (id: string, signal?: AbortSignal) => request<ShotReferences>(`${shotPath(id)}/references`, { signal }),
|
||||||
generationSpec: (id: string, signal?: AbortSignal) =>
|
generationSpec: (id: string, signal?: AbortSignal) =>
|
||||||
request<ShotGenerationSpec>(`${shotPath(id)}/generation-spec`, { signal }),
|
request<ShotGenerationSpec>(`${shotPath(id)}/generation-spec`, { signal }),
|
||||||
|
/** 只读获取已保存的视频提示词,不要求首帧已就绪。 */
|
||||||
|
videoPrompt: (id: string, signal?: AbortSignal) =>
|
||||||
|
request<ShotPromptResult>(`${shotPath(id)}/video-prompt`, { signal }),
|
||||||
generatePrompt: (id: string, force: boolean) =>
|
generatePrompt: (id: string, force: boolean) =>
|
||||||
request<ShotPromptResult | null>(`${shotPath(id)}/video-prompt`, {
|
request<ShotPromptResult | null>(`${shotPath(id)}/video-prompt`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: { force },
|
body: { force },
|
||||||
timeoutMs: 0
|
timeoutMs: 0
|
||||||
}),
|
}),
|
||||||
|
/**
|
||||||
|
* 后台批量生成项目视频提示词。
|
||||||
|
* @param id 正式项目 ID
|
||||||
|
* @param input 并发与覆盖参数
|
||||||
|
* @returns 真实后台任务观察句柄
|
||||||
|
*/
|
||||||
generatePrompts: (id: string, input: StoryboardBatchInput) =>
|
generatePrompts: (id: string, input: StoryboardBatchInput) =>
|
||||||
request<PromptBatchResult>(`${projectPath(id)}/video-prompts/generate`, {
|
request<WorkflowExecutionStart>(`${projectPath(id)}/video-prompts/generate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: input,
|
body: input,
|
||||||
timeoutMs: 0
|
timeoutMs: 0
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ const groups = computed(() => {
|
|||||||
:aria-labelledby="`${directoryId}-beat-${group.beatNo}`"
|
:aria-labelledby="`${directoryId}-beat-${group.beatNo}`"
|
||||||
>
|
>
|
||||||
<h4 :id="`${directoryId}-beat-${group.beatNo}`" class="directory-group-heading">
|
<h4 :id="`${directoryId}-beat-${group.beatNo}`" class="directory-group-heading">
|
||||||
<span>BEAT {{ String(group.beatNo).padStart(2, '0') }}</span>
|
<span>段落 {{ String(group.beatNo).padStart(2, '0') }}</span>
|
||||||
<span class="directory-group-count">{{ group.shots.length }} 镜</span>
|
<span class="directory-group-count">{{ group.shots.length }} 镜</span>
|
||||||
</h4>
|
</h4>
|
||||||
<div class="beat-directory-items">
|
<div class="beat-directory-items">
|
||||||
@@ -41,13 +41,13 @@ const groups = computed(() => {
|
|||||||
:key="shot.shotId"
|
:key="shot.shotId"
|
||||||
:active="activeId === shot.shotId"
|
:active="activeId === shot.shotId"
|
||||||
:class="itemClass"
|
:class="itemClass"
|
||||||
:aria-label="`BEAT ${group.beatNo} · 镜头 ${shot.shotNo} · ${shot.title}`"
|
:aria-label="`段落 ${group.beatNo} · 镜头 ${shot.shotNo} · ${shot.title}`"
|
||||||
@click="emit('select', shot.shotId)"
|
@click="emit('select', shot.shotId)"
|
||||||
>
|
>
|
||||||
{{ shot.title }}
|
{{ shot.title }}
|
||||||
<template #eyebrow>
|
<template #eyebrow>
|
||||||
<!-- 窄屏目录变为横向条目时补回归属,桌面不重复显示分组编号。 -->
|
<!-- 窄屏目录变为横向条目时补回归属,桌面不重复显示分组编号。 -->
|
||||||
<span class="directory-mobile-beat">BEAT {{ String(group.beatNo).padStart(2, '0') }} / </span>
|
<span class="directory-mobile-beat">段落 {{ String(group.beatNo).padStart(2, '0') }} / </span>
|
||||||
<span class="directory-shot-number">镜头 {{ String(shot.shotNo).padStart(2, '0') }}</span>
|
<span class="directory-shot-number">镜头 {{ String(shot.shotNo).padStart(2, '0') }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #meta><slot name="meta" :shot="shot" /></template>
|
<template #meta><slot name="meta" :shot="shot" /></template>
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ defineProps<{ shot: DesignedShot }>()
|
|||||||
<template>
|
<template>
|
||||||
<div class="space-y-7">
|
<div class="space-y-7">
|
||||||
<section>
|
<section>
|
||||||
<h3 class="mb-4 text-sm font-semibold">
|
<h3 class="mb-4 text-sm font-semibold">导演摄影设计</h3>
|
||||||
导演摄影设计 <span class="ml-2 font-mono text-[10px] font-normal text-muted">Direction</span>
|
|
||||||
</h3>
|
|
||||||
<template v-if="shot.direction"
|
<template v-if="shot.direction"
|
||||||
><div class="mb-5 flex flex-wrap gap-2">
|
><div class="mb-5 flex flex-wrap gap-2">
|
||||||
<NTag
|
<NTag
|
||||||
@@ -41,9 +39,7 @@ defineProps<{ shot: DesignedShot }>()
|
|||||||
<p v-else class="text-sm text-muted">此镜头尚无已保存的导演设计。</p>
|
<p v-else class="text-sm text-muted">此镜头尚无已保存的导演设计。</p>
|
||||||
</section>
|
</section>
|
||||||
<section class="pt-6">
|
<section class="pt-6">
|
||||||
<h3 class="mb-4 text-sm font-semibold">
|
<h3 class="mb-4 text-sm font-semibold">画面状态</h3>
|
||||||
即时视觉状态 <span class="ml-2 font-mono text-[10px] font-normal text-muted">VisualState</span>
|
|
||||||
</h3>
|
|
||||||
<template v-if="shot.visualState"
|
<template v-if="shot.visualState"
|
||||||
><dl class="detail-grid">
|
><dl class="detail-grid">
|
||||||
<dt>时间</dt>
|
<dt>时间</dt>
|
||||||
@@ -82,9 +78,7 @@ defineProps<{ shot: DesignedShot }>()
|
|||||||
</dl>
|
</dl>
|
||||||
</article></template
|
</article></template
|
||||||
>
|
>
|
||||||
<p v-else class="text-sm leading-6 text-muted">
|
<p v-else class="text-sm leading-6 text-muted">此镜头还没有画面状态,请先完成镜头设计。</p>
|
||||||
此镜头尚无已保存的即时状态。先补齐本集导演设计,再生成 VisualState。
|
|
||||||
</p>
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -9,19 +9,18 @@ import type { DesignedShot, ShotReferences } from '../types'
|
|||||||
import type { ShotGenerationSpec } from '../generation-spec.types'
|
import type { ShotGenerationSpec } from '../generation-spec.types'
|
||||||
import { errorMessage } from '../../../lib/http'
|
import { errorMessage } from '../../../lib/http'
|
||||||
import { downloadText } from '../../../lib/format'
|
import { downloadText } from '../../../lib/format'
|
||||||
import { getOperation, runOperation } from '../../workflows/operations'
|
import { runOperation } from '../../workflows/operations'
|
||||||
import ConfirmAction from '../../workflows/ConfirmAction.vue'
|
import ConfirmAction from '../../workflows/ConfirmAction.vue'
|
||||||
|
|
||||||
/** 镜头级只读资源与显式 Prompt 生成;查询与耗费模型的操作分开。 */
|
/** 镜头级只读资源与显式 Prompt 生成;查询与耗费模型的操作分开。 */
|
||||||
const props = defineProps<{ projectId: string; shot: DesignedShot; disabled: boolean }>()
|
const props = defineProps<{ projectId: string; shot: DesignedShot; episodeNo?: number; disabled: boolean }>()
|
||||||
const references = ref<ShotReferences | null>(null)
|
const references = ref<ShotReferences | null>(null)
|
||||||
const spec = ref<ShotGenerationSpec | null>(null)
|
const spec = ref<ShotGenerationSpec | null>(null)
|
||||||
const errors = ref({ references: '', spec: '' })
|
const errors = ref({ references: '', spec: '' })
|
||||||
const busy = ref({ references: false, spec: false })
|
const busy = ref({ references: false, spec: false })
|
||||||
const force = ref(false)
|
const force = ref(false)
|
||||||
const prompt = computed(() => getStoryboardSession(props.projectId).prompts[props.shot.shotId])
|
const prompt = computed(() => getStoryboardSession(props.projectId).prompts[props.shot.shotId])
|
||||||
const operation = computed(() => getOperation(props.projectId))
|
const locked = computed(() => props.disabled)
|
||||||
const locked = computed(() => props.disabled || operation.value.pending)
|
|
||||||
const controllers: Partial<Record<'references' | 'spec', AbortController>> = {}
|
const controllers: Partial<Record<'references' | 'spec', AbortController>> = {}
|
||||||
let revision = 0
|
let revision = 0
|
||||||
|
|
||||||
@@ -35,9 +34,16 @@ function reset() {
|
|||||||
busy.value = { references: false, spec: false }
|
busy.value = { references: false, spec: false }
|
||||||
}
|
}
|
||||||
watch(() => JSON.stringify([props.projectId, props.shot.shotId, props.shot.direction, props.shot.visualState]), reset)
|
watch(() => JSON.stringify([props.projectId, props.shot.shotId, props.shot.direction, props.shot.visualState]), reset)
|
||||||
|
watch(
|
||||||
|
() => [props.projectId, props.shot.shotId] as const,
|
||||||
|
() => {
|
||||||
|
void load('references')
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
onScopeDispose(reset)
|
onScopeDispose(reset)
|
||||||
|
|
||||||
/** 只在用户点击后读取参考图或编译规格;两种 GET 均不调用生成模型。 */
|
/** 参考图进入镜头时自动读取;生成规格仍由用户显式编译,两种 GET 均不调用生成模型。 */
|
||||||
async function load(kind: 'references' | 'spec') {
|
async function load(kind: 'references' | 'spec') {
|
||||||
if (busy.value[kind] || locked.value || (kind === 'spec' && (!props.shot.direction || !props.shot.visualState)))
|
if (busy.value[kind] || locked.value || (kind === 'spec' && (!props.shot.direction || !props.shot.visualState)))
|
||||||
return
|
return
|
||||||
@@ -72,15 +78,26 @@ async function generatePrompt() {
|
|||||||
const projectId = props.projectId
|
const projectId = props.projectId
|
||||||
const shotId = props.shot.shotId
|
const shotId = props.shot.shotId
|
||||||
const overwrite = force.value
|
const overwrite = force.value
|
||||||
await runOperation(projectId, `读取/生成镜头 ${props.shot.shotNo} 提示词`, async () => {
|
const ok = await runOperation(projectId, `读取/生成镜头 ${props.shot.shotNo} 提示词`, async () => {
|
||||||
const session = getStoryboardSession(projectId)
|
const session = getStoryboardSession(projectId)
|
||||||
// 请求结果不确定时不要保留可能已被覆盖的旧正文。
|
// 请求结果不确定时不要保留可能已被覆盖的旧正文。
|
||||||
delete session.prompts[shotId]
|
delete session.prompts[shotId]
|
||||||
const result = await storyboardApi.generatePrompt(shotId, overwrite)
|
const result = await storyboardApi.generatePrompt(shotId, overwrite)
|
||||||
if (!result || result.shotId !== shotId || !result.videoPrompt)
|
if (!result || result.shotId !== shotId || !result.videoPrompt)
|
||||||
throw new Error('接口未返回此镜头的有效提示词,请检查后端记录后重试。')
|
throw new Error('没有获取到此镜头的有效提示词,请刷新后重试。')
|
||||||
session.prompts[shotId] = result
|
session.prompts[shotId] = result
|
||||||
})
|
})
|
||||||
|
if (!ok) {
|
||||||
|
// 单镜头错误由 runOperation 记录到项目操作状态;这里只处理可恢复的首帧前置问题。
|
||||||
|
const { getOperation } = await import('../../workflows/operations')
|
||||||
|
const operation = getOperation(projectId)
|
||||||
|
if (!/primary keyframe|主首帧/i.test(operation.error)) return
|
||||||
|
operation.recovery = {
|
||||||
|
target: 'keyframe',
|
||||||
|
shotId,
|
||||||
|
episodeNo: props.episodeNo
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 仅导出已返回的真实规格或提示词,不在前端补造内容。 */
|
/** 仅导出已返回的真实规格或提示词,不在前端补造内容。 */
|
||||||
@@ -101,13 +118,11 @@ function exportResult(kind: 'spec' | 'prompt') {
|
|||||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||||
<h3 class="text-sm font-semibold">主体参考图</h3>
|
<h3 class="text-sm font-semibold">主体参考图</h3>
|
||||||
<NButton :disabled="busy.references || locked" @click="load('references')"
|
<NButton :disabled="busy.references || locked" @click="load('references')"
|
||||||
><RefreshCw :size="13" :class="{ 'animate-spin': busy.references }" />{{
|
><RefreshCw :size="13" :class="{ 'animate-spin': busy.references }" />刷新参考图</NButton
|
||||||
references ? '刷新参考图' : '读取参考图'
|
|
||||||
}}</NButton
|
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<p class="mt-2 text-xs leading-6 text-muted">
|
<p class="mt-2 text-xs leading-6 text-muted">
|
||||||
读取镜头已绑定形态的图片,不生成新图。参考图缺失会影响视频提示词生成。
|
自动读取镜头当前绑定形态的主参考图,不生成新图。切换镜头会同步刷新,参考图缺失会影响后续生成。
|
||||||
</p>
|
</p>
|
||||||
<NAlert v-if="errors.references" role="alert" type="error" :show-icon="false" class="mt-3">{{
|
<NAlert v-if="errors.references" role="alert" type="error" :show-icon="false" class="mt-3">{{
|
||||||
errors.references
|
errors.references
|
||||||
@@ -142,7 +157,7 @@ function exportResult(kind: 'spec' | 'prompt') {
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p v-if="!references.references.length && !references.missing.length" class="mt-3 text-xs text-muted">
|
<p v-if="!references.references.length && !references.missing.length" class="mt-3 text-xs text-muted">
|
||||||
后端未返回参考图或缺失记录。
|
当前镜头还没有可用参考图。
|
||||||
</p>
|
</p>
|
||||||
<p v-if="references.missing.length" class="mt-3 text-xs text-muted">
|
<p v-if="references.missing.length" class="mt-3 text-xs text-muted">
|
||||||
请在形态图库补齐图片或设置主图,再刷新本镜头参考图。
|
请在形态图库补齐图片或设置主图,再刷新本镜头参考图。
|
||||||
@@ -193,7 +208,7 @@ function exportResult(kind: 'spec' | 'prompt') {
|
|||||||
:description="
|
:description="
|
||||||
force
|
force
|
||||||
? '将覆盖此镜头已保存的视频提示词,并调用模型重新生成。'
|
? '将覆盖此镜头已保存的视频提示词,并调用模型重新生成。'
|
||||||
: '读取此镜头已有提示词;若不存在,将调用模型并保存结果。后端会检查参考图是否齐全。'
|
: '读取此镜头已有提示词;若不存在,将自动生成并保存。生成前会检查所需参考图是否齐全。'
|
||||||
"
|
"
|
||||||
@confirm="generatePrompt"
|
@confirm="generatePrompt"
|
||||||
/><NCheckbox v-model:checked="force" :disabled="locked" class="flex items-center gap-2 text-xs"
|
/><NCheckbox v-model:checked="force" :disabled="locked" class="flex items-center gap-2 text-xs"
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from 'vue'
|
||||||
|
import { NAlert, NButton } from 'naive-ui'
|
||||||
|
import ReadonlyInspection from '../../../components/ui/ReadonlyInspection.vue'
|
||||||
|
import { useQuery } from '../../../composables/useQuery'
|
||||||
|
import { auditSubjectCoverage } from '../coverage-api'
|
||||||
|
import type { SubjectCoverageIssue } from '../coverage.types'
|
||||||
|
|
||||||
|
/** 审计范围始终是当前正式项目。 */
|
||||||
|
const props = defineProps<{ /** 项目 ID。 */ projectId: string }>()
|
||||||
|
/** 定位只交给当前分镜页处理,不自行拼接猜测的镜头 ID。 */
|
||||||
|
const emit = defineEmits<{ locate: [issue: SubjectCoverageIssue] }>()
|
||||||
|
/** 展开才会读取零费用审计结果。 */
|
||||||
|
const open = ref(false)
|
||||||
|
/** 项目或展开状态变化时清空旧审计。 */
|
||||||
|
const key = computed(() => (open.value ? props.projectId : ''))
|
||||||
|
/** 请求取消和迟到响应保护复用公共查询。 */
|
||||||
|
const query = useQuery(key, async (projectId, signal) => {
|
||||||
|
if (!projectId) return null
|
||||||
|
const result = await auditSubjectCoverage(projectId, signal)
|
||||||
|
if (result.projectId !== projectId || !Array.isArray(result.issues) || typeof result.valid !== 'boolean')
|
||||||
|
throw new Error('覆盖检查返回了不匹配的项目或无效结果,请刷新。')
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
/** 当前后端实际审计汇总。 */
|
||||||
|
const result = computed(() => query.data.value)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- 以下是零费用主体引用覆盖审计模块 -->
|
||||||
|
<ReadonlyInspection
|
||||||
|
v-model:open="open"
|
||||||
|
title="主体引用覆盖检查"
|
||||||
|
description="检查分镜文本与主体绑定是否一致,只读取数据,不自动生成或修改分镜。"
|
||||||
|
:loading="query.loading.value"
|
||||||
|
:error="query.error.value"
|
||||||
|
@refresh="query.refresh"
|
||||||
|
>
|
||||||
|
<template v-if="result">
|
||||||
|
<NAlert :type="result.valid ? 'success' : 'warning'" :show-icon="false">
|
||||||
|
{{ result.valid ? '未发现主体引用遗漏' : `发现 ${result.issueCount} 项引用遗漏` }} ·
|
||||||
|
{{ result.episodeCount }} 集 / {{ result.beatCount }} 个 Beat / {{ result.shotCount }} 镜
|
||||||
|
</NAlert>
|
||||||
|
<p class="mt-2 text-muted">
|
||||||
|
检查主体 {{ result.subjectSummary.total }} · 人物 {{ result.subjectSummary.character }} / 场景
|
||||||
|
{{ result.subjectSummary.scene }} / 道具 {{ result.subjectSummary.prop }}
|
||||||
|
</p>
|
||||||
|
<article
|
||||||
|
v-for="(issue, index) in result.issues"
|
||||||
|
:key="`${issue.level}:${issue.episodeNo}:${issue.beatNo}:${issue.shotNo}:${issue.subjectRef}:${index}`"
|
||||||
|
class="surface-inset mt-3 p-3"
|
||||||
|
>
|
||||||
|
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||||
|
<strong
|
||||||
|
>第 {{ issue.episodeNo }} 集 · Beat {{ issue.beatNo
|
||||||
|
}}{{ issue.shotNo !== null ? ` · 镜头 ${issue.shotNo}` : '' }} · {{ issue.subjectName }}
|
||||||
|
{{ issue.subjectRef }}</strong
|
||||||
|
>
|
||||||
|
<NButton text size="small" @click="emit('locate', issue)">{{
|
||||||
|
issue.shotNo === null ? '查看所在剧集' : '定位镜头'
|
||||||
|
}}</NButton>
|
||||||
|
</div>
|
||||||
|
<p>{{ issue.message }}</p>
|
||||||
|
<p class="text-muted">
|
||||||
|
原文匹配:{{ issue.matchedTerm }} ·
|
||||||
|
{{
|
||||||
|
issue.level === 'visual_state'
|
||||||
|
? '即时状态'
|
||||||
|
: issue.level === 'beat'
|
||||||
|
? 'Beat 主体引用'
|
||||||
|
: '镜头主体绑定'
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
</ReadonlyInspection>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { request } from '../../lib/http'
|
||||||
|
import type { SubjectCoverageAudit } from './coverage.types'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 只读检查正式分镜的主体引用覆盖,不调用任何 Agent。
|
||||||
|
* @param projectId 当前正式项目 ID
|
||||||
|
* @param signal 取消信号
|
||||||
|
* @returns 后端实际覆盖审计结果
|
||||||
|
*/
|
||||||
|
export function auditSubjectCoverage(projectId: string, signal?: AbortSignal) {
|
||||||
|
return request<SubjectCoverageAudit>(`/projects/${encodeURIComponent(projectId)}/storyboard/subject-coverage`, {
|
||||||
|
signal
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/** 主体引用覆盖检查中的单个遗漏,不推测正式 Shot ID。 */
|
||||||
|
export interface SubjectCoverageIssue {
|
||||||
|
/** 遗漏发生的层级。 */
|
||||||
|
level: 'beat' | 'shot' | 'visual_state'
|
||||||
|
/** 正式剧集编号。 */
|
||||||
|
episodeNo: number
|
||||||
|
/** Beat 编号。 */
|
||||||
|
beatNo: number
|
||||||
|
/** 镜头编号,Beat 层级为空。 */
|
||||||
|
shotNo: number | null
|
||||||
|
/** 漏引用的主体 Ref。 */
|
||||||
|
subjectRef: string
|
||||||
|
/** 主体名称。 */
|
||||||
|
subjectName: string
|
||||||
|
/** 主体模块。 */
|
||||||
|
module: string
|
||||||
|
/** 原文中匹配的用语。 */
|
||||||
|
matchedTerm: string
|
||||||
|
/** 后端问题描述。 */
|
||||||
|
message: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 零费用主体引用覆盖审计的实际汇总。 */
|
||||||
|
export interface SubjectCoverageAudit {
|
||||||
|
/** 当前项目正式 ID。 */
|
||||||
|
projectId: string
|
||||||
|
/** 后端是否判定引用覆盖完整。 */
|
||||||
|
valid: boolean
|
||||||
|
/** 审计的剧集数量。 */
|
||||||
|
episodeCount: number
|
||||||
|
/** 审计的 Beat 数量。 */
|
||||||
|
beatCount: number
|
||||||
|
/** 审计的镜头数量。 */
|
||||||
|
shotCount: number
|
||||||
|
/** 遗漏问题数量。 */
|
||||||
|
issueCount: number
|
||||||
|
/** 后端用于本次审计的主体快照。 */
|
||||||
|
subjectSnapshot: {
|
||||||
|
/** 正式主体 ID。 */
|
||||||
|
id: string
|
||||||
|
/** 主体引用。 */
|
||||||
|
ref: string
|
||||||
|
/** 主体名称。 */
|
||||||
|
name: string
|
||||||
|
/** 主体模块。 */
|
||||||
|
module: string
|
||||||
|
}[]
|
||||||
|
/** 本次审计的各类型主体数量。 */
|
||||||
|
subjectSummary: {
|
||||||
|
/** 主体总数。 */
|
||||||
|
total: number
|
||||||
|
/** 人物数量。 */
|
||||||
|
character: number
|
||||||
|
/** 场景数量。 */
|
||||||
|
scene: number
|
||||||
|
/** 道具数量。 */
|
||||||
|
prop: number
|
||||||
|
}
|
||||||
|
/** 真实引用遗漏列表。 */
|
||||||
|
issues: SubjectCoverageIssue[]
|
||||||
|
}
|
||||||
@@ -7,9 +7,89 @@ import type { DesignedShot, EpisodeDirections, EpisodeVisualStates, StoryboardSe
|
|||||||
/** 仅保存本会话回执和已返回的 Prompt,切换路由不丢失长请求结果。 */
|
/** 仅保存本会话回执和已返回的 Prompt,切换路由不丢失长请求结果。 */
|
||||||
const sessions = reactive<Record<string, StoryboardSession>>({})
|
const sessions = reactive<Record<string, StoryboardSession>>({})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 恢复整个项目已失效的剧集集合,兼容隐私模式或损坏的浏览器缓存。
|
||||||
|
* @param projectId 正式项目 ID
|
||||||
|
* @returns 只包含正整数剧集编号的失效标记
|
||||||
|
*/
|
||||||
|
function savedEpisodeInvalidations(projectId: string): Record<number, boolean> {
|
||||||
|
try {
|
||||||
|
if (typeof localStorage === 'undefined') return {}
|
||||||
|
const value: unknown = JSON.parse(
|
||||||
|
localStorage.getItem(`short-drama:storyboard-invalidated:${projectId}`) ?? '[]'
|
||||||
|
)
|
||||||
|
if (!Array.isArray(value)) return {}
|
||||||
|
return Object.fromEntries(
|
||||||
|
value
|
||||||
|
.filter(number => typeof number === 'number' && Number.isSafeInteger(number) && number > 0)
|
||||||
|
.map(number => [number, true])
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 获取指定项目的独立回执容器。 */
|
/** 获取指定项目的独立回执容器。 */
|
||||||
export function getStoryboardSession(id: string): StoryboardSession {
|
export function getStoryboardSession(id: string): StoryboardSession {
|
||||||
return (sessions[id] ??= { receipt: null, prompts: {}, regeneratedEpisodes: {} })
|
return (sessions[id] ??= {
|
||||||
|
receipt: null,
|
||||||
|
prompts: {},
|
||||||
|
regeneratedEpisodes: {},
|
||||||
|
invalidatedEpisodeSources: savedEpisodeInvalidations(id)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据真实有效终态废弃旧正文,并持久化全部剧集,隐藏任务不影响恢复。
|
||||||
|
* @param projectId 正式项目 ID
|
||||||
|
* @param episodeNo 已有效重生成的剧集编号
|
||||||
|
*/
|
||||||
|
export function invalidateEpisodeSource(projectId: string, episodeNo: number) {
|
||||||
|
if (!Number.isSafeInteger(episodeNo) || episodeNo <= 0) return
|
||||||
|
const session = getStoryboardSession(projectId)
|
||||||
|
delete session.regeneratedEpisodes[episodeNo]
|
||||||
|
session.invalidatedEpisodeSources = {
|
||||||
|
...savedEpisodeInvalidations(projectId),
|
||||||
|
...session.invalidatedEpisodeSources,
|
||||||
|
[episodeNo]: true
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (typeof localStorage !== 'undefined')
|
||||||
|
localStorage.setItem(
|
||||||
|
`short-drama:storyboard-invalidated:${projectId}`,
|
||||||
|
JSON.stringify(Object.keys(session.invalidatedEpisodeSources).map(Number))
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
/* 浏览器禁止存储时仍保留当前会话保护。 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅可信完整重新拆解完成后清除旧失效集合。
|
||||||
|
* @param projectId 正式项目 ID
|
||||||
|
*/
|
||||||
|
export function clearEpisodeSourceInvalidations(projectId: string) {
|
||||||
|
getStoryboardSession(projectId).invalidatedEpisodeSources = {}
|
||||||
|
try {
|
||||||
|
if (typeof localStorage !== 'undefined')
|
||||||
|
localStorage.removeItem(`short-drama:storyboard-invalidated:${projectId}`)
|
||||||
|
} catch {
|
||||||
|
/* 当前会话已经清除,存储限制不会触发业务请求。 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重生成后不向新 Shot ID 回填旧 checkpoint 的标题、剧情或时长。
|
||||||
|
* @param projectId 当前正式项目 ID
|
||||||
|
* @param episodeNo 当前剧集编号
|
||||||
|
* @param fallback 未失效的原始分集快照
|
||||||
|
* @returns 实际正文或缺省;缺省时仅展示正式镜头编号
|
||||||
|
*/
|
||||||
|
export function currentEpisodeSource(projectId: string, episodeNo: number, fallback?: EpisodeShots) {
|
||||||
|
const session = getStoryboardSession(projectId)
|
||||||
|
return (
|
||||||
|
session.regeneratedEpisodes[episodeNo] ?? (session.invalidatedEpisodeSources[episodeNo] ? undefined : fallback)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 后端生成服务只读取最新 Breakdown;不能用历史可恢复快照冒充当前生成前置条件。 */
|
/** 后端生成服务只读取最新 Breakdown;不能用历史可恢复快照冒充当前生成前置条件。 */
|
||||||
|
|||||||
@@ -95,6 +95,10 @@ export interface StoryboardBatchResult {
|
|||||||
export interface StoryboardBatchInput {
|
export interface StoryboardBatchInput {
|
||||||
concurrency: number
|
concurrency: number
|
||||||
force: boolean
|
force: boolean
|
||||||
|
/** 可选试跑剧集范围。 */
|
||||||
|
episodeNo?: number
|
||||||
|
/** 可选本批实际处理上限。 */
|
||||||
|
limit?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 即时状态生成增加有限次的模型自动修复。 */
|
/** 即时状态生成增加有限次的模型自动修复。 */
|
||||||
@@ -177,13 +181,25 @@ export interface DesignedShot {
|
|||||||
|
|
||||||
/** 生成回执按操作区分,切换剧集时仍保留原始目标信息。 */
|
/** 生成回执按操作区分,切换剧集时仍保留原始目标信息。 */
|
||||||
export type StoryboardReceipt =
|
export type StoryboardReceipt =
|
||||||
| { kind: 'shots'; title: string; result: StoryboardShotRegenerationResult }
|
| {
|
||||||
|
kind: 'shots'
|
||||||
|
title: string
|
||||||
|
result: Pick<
|
||||||
|
StoryboardShotRegenerationResult,
|
||||||
|
'episodeNo' | 'storyboardShotSummary' | 'storyboardShotValidation'
|
||||||
|
>
|
||||||
|
}
|
||||||
| { kind: 'batch'; title: string; result: StoryboardBatchResult }
|
| { kind: 'batch'; title: string; result: StoryboardBatchResult }
|
||||||
| { kind: 'prompts'; title: string; result: PromptBatchResult }
|
| { kind: 'prompts'; title: string; result: PromptBatchResult }
|
||||||
|
|
||||||
/** 当前浏览器会话保存回执,不将其当作持久化运行状态。 */
|
/** 当前浏览器会话保存回执,不将其当作持久化运行状态。 */
|
||||||
export interface StoryboardSession {
|
export interface StoryboardSession {
|
||||||
|
/** 当前真实操作回执。 */
|
||||||
receipt: StoryboardReceipt | null
|
receipt: StoryboardReceipt | null
|
||||||
|
/** 按正式镜头缓存的实际视频提示词。 */
|
||||||
prompts: Record<string, ShotPromptResult>
|
prompts: Record<string, ShotPromptResult>
|
||||||
|
/** 已实际返回的重生成分集正文,缺少正文时不构造缓存。 */
|
||||||
regeneratedEpisodes: Record<number, EpisodeShots>
|
regeneratedEpisodes: Record<number, EpisodeShots>
|
||||||
|
/** 已重生成且旧 checkpoint 正文不再可信的剧集。 */
|
||||||
|
invalidatedEpisodeSources: Record<number, boolean>
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
import { computed, inject, ref, watch } from 'vue'
|
||||||
|
import { routeLocationKey, routerKey } from 'vue-router'
|
||||||
|
import type { LocationQueryRaw } from 'vue-router'
|
||||||
|
import { queryText } from '../production/asset-links'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 镜头选择与地址同步;初次读取及浏览器导航恢复正式 ID,切集清除上集镜头。
|
||||||
|
* @param currentEpisode 当前有效剧集,选择镜头时用于补全深链接
|
||||||
|
* @returns 可写的剧集和镜头选择状态
|
||||||
|
*/
|
||||||
|
export function useShotSelection(currentEpisode: () => number) {
|
||||||
|
/** 当前页面地址,非路由环境保留本地选择。 */
|
||||||
|
const route = inject(routeLocationKey, undefined)
|
||||||
|
/** 当前路由导航器,替换选择参数不产生逐镜头历史。 */
|
||||||
|
const router = inject(routerKey, undefined)
|
||||||
|
/** 当前选择的剧集,缺省时由页面决定首次有效剧集。 */
|
||||||
|
const episode = ref<number>()
|
||||||
|
/** 当前选择的正式镜头 ID。 */
|
||||||
|
const shotId = ref('')
|
||||||
|
|
||||||
|
/** 地址变化只读取选择,不触发反向写入或重置其它参数。 */
|
||||||
|
watch(
|
||||||
|
() => [route?.query.episodeNo, route?.query.shotId],
|
||||||
|
() => {
|
||||||
|
const number = Number(queryText(route?.query.episodeNo))
|
||||||
|
episode.value = Number.isSafeInteger(number) && number > 0 ? number : undefined
|
||||||
|
shotId.value = queryText(route?.query.shotId)
|
||||||
|
},
|
||||||
|
{ immediate: true, flush: 'sync' }
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅替换当前页面的选择参数,保留来源动作、筛选参数与 hash。
|
||||||
|
* @param query 更新后的地址参数
|
||||||
|
*/
|
||||||
|
function replaceSelection(query: LocationQueryRaw) {
|
||||||
|
if (router && route) void router.replace({ path: route.path, query, hash: route.hash })
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 切换剧集立即清除旧镜头,避免把上集 ID 带到下集。 */
|
||||||
|
const selectedEpisode = computed({
|
||||||
|
get: () => episode.value,
|
||||||
|
set: (number: number | undefined) => {
|
||||||
|
episode.value = number
|
||||||
|
shotId.value = ''
|
||||||
|
const query: LocationQueryRaw = { ...route?.query }
|
||||||
|
delete query.shotId
|
||||||
|
if (number && Number.isSafeInteger(number) && number > 0) query.episodeNo = String(number)
|
||||||
|
else delete query.episodeNo
|
||||||
|
replaceSelection(query)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
/** 选择镜头同时写入有效剧集和正式 ID,刷新后按地址恢复。 */
|
||||||
|
const selectedShot = computed({
|
||||||
|
get: () => shotId.value,
|
||||||
|
set: (value: string) => {
|
||||||
|
shotId.value = value.trim()
|
||||||
|
const query: LocationQueryRaw = { ...route?.query }
|
||||||
|
const number = currentEpisode()
|
||||||
|
if (Number.isSafeInteger(number) && number > 0) query.episodeNo = String(number)
|
||||||
|
if (shotId.value) query.shotId = shotId.value
|
||||||
|
else delete query.shotId
|
||||||
|
replaceSelection(query)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return { selectedEpisode, selectedShot }
|
||||||
|
}
|
||||||
@@ -1,10 +1,19 @@
|
|||||||
import { computed, ref } from 'vue'
|
import { useShotSelection } from './useShotSelection'
|
||||||
|
import { useWorkflowExecution } from '../workflows/execution'
|
||||||
|
import type { StoryboardBatchResult, PromptBatchResult, StoryboardShotRegenerationResult } from './types'
|
||||||
|
import { computed, ref, watch } from 'vue'
|
||||||
import { useQuery } from '../../composables/useQuery'
|
import { useQuery } from '../../composables/useQuery'
|
||||||
import { useProjectContext } from '../projects/context'
|
import { useProjectContext } from '../projects/context'
|
||||||
import { breakdownSnapshot } from '../workflows/selectors'
|
import { breakdownSnapshot } from '../workflows/selectors'
|
||||||
import { getOperation, runOperation } from '../workflows/operations'
|
import { getOperation, runOperation } from '../workflows/operations'
|
||||||
import { storyboardApi } from './api'
|
import { storyboardApi } from './api'
|
||||||
import { getStoryboardSession, mergeDesignedShots, storyboardPrerequisites } from './model'
|
import {
|
||||||
|
currentEpisodeSource,
|
||||||
|
getStoryboardSession,
|
||||||
|
invalidateEpisodeSource,
|
||||||
|
mergeDesignedShots,
|
||||||
|
storyboardPrerequisites
|
||||||
|
} from './model'
|
||||||
|
|
||||||
/** 分镜页只提供正式主流程命令,不暴露后端测试路由。 */
|
/** 分镜页只提供正式主流程命令,不暴露后端测试路由。 */
|
||||||
export type StoryboardCommand = 'shots-current' | 'direction-all' | 'visual-all' | 'prompts'
|
export type StoryboardCommand = 'shots-current' | 'direction-all' | 'visual-all' | 'prompts'
|
||||||
@@ -12,16 +21,23 @@ export type StoryboardCommand = 'shots-current' | 'direction-all' | 'visual-all'
|
|||||||
/** 分镜查询、依赖判断与操作入口;不修改后端 graph。 */
|
/** 分镜查询、依赖判断与操作入口;不修改后端 graph。 */
|
||||||
export function useStoryboard() {
|
export function useStoryboard() {
|
||||||
const context = useProjectContext()
|
const context = useProjectContext()
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const id = computed(() => context.project.value?.id ?? '')
|
const id = computed(() => context.project.value?.id ?? '')
|
||||||
const selectedEpisode = ref<number>()
|
/** 两个镜头工作区共用地址选择,刷新恢复同一正式镜头。 */
|
||||||
const selectedShot = ref('')
|
const { selectedEpisode, selectedShot } = useShotSelection(() => episodeNo.value)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const concurrency = ref(2)
|
const concurrency = ref(2)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const maxRepairAttempts = ref(2)
|
const maxRepairAttempts = ref(2)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const force = ref(false)
|
const force = ref(false)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const snapshot = computed(() => breakdownSnapshot(context.checkpoints.value))
|
const snapshot = computed(() => breakdownSnapshot(context.checkpoints.value))
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const sourceEpisodes = computed(
|
const sourceEpisodes = computed(
|
||||||
() => snapshot.value?.storyboardEpisodeShots ?? snapshot.value?.breakdownResult?.storyboardEpisodeShots ?? []
|
() => snapshot.value?.storyboardEpisodeShots ?? snapshot.value?.breakdownResult?.storyboardEpisodeShots ?? []
|
||||||
)
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const episodeOptions = computed(() => {
|
const episodeOptions = computed(() => {
|
||||||
const entries = new Map(context.project.value?.episodes.map(episode => [episode.episode, episode.title]) ?? [])
|
const entries = new Map(context.project.value?.episodes.map(episode => [episode.episode, episode.title]) ?? [])
|
||||||
for (const episode of sourceEpisodes.value) {
|
for (const episode of sourceEpisodes.value) {
|
||||||
@@ -31,12 +47,14 @@ export function useStoryboard() {
|
|||||||
.map(([episodeNo, title]) => ({ episodeNo, title }))
|
.map(([episodeNo, title]) => ({ episodeNo, title }))
|
||||||
.toSorted((a, b) => a.episodeNo - b.episodeNo)
|
.toSorted((a, b) => a.episodeNo - b.episodeNo)
|
||||||
})
|
})
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const episodeNo = computed(
|
const episodeNo = computed(
|
||||||
() =>
|
() =>
|
||||||
episodeOptions.value.find(item => item.episodeNo === selectedEpisode.value)?.episodeNo ??
|
episodeOptions.value.find(item => item.episodeNo === selectedEpisode.value)?.episodeNo ??
|
||||||
episodeOptions.value[0]?.episodeNo ??
|
episodeOptions.value[0]?.episodeNo ??
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const queryKey = computed(() => JSON.stringify([id.value, episodeNo.value]))
|
const queryKey = computed(() => JSON.stringify([id.value, episodeNo.value]))
|
||||||
/** 分镜页仅在进入、切换剧集或显式刷新时读取。 */
|
/** 分镜页仅在进入、切换剧集或显式刷新时读取。 */
|
||||||
const query = useQuery(queryKey, async (key, signal) => {
|
const query = useQuery(queryKey, async (key, signal) => {
|
||||||
@@ -57,21 +75,35 @@ export function useStoryboard() {
|
|||||||
return { directions, visualStates }
|
return { directions, visualStates }
|
||||||
})
|
})
|
||||||
const data = query.data
|
const data = query.data
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const session = computed(() => getStoryboardSession(id.value))
|
const session = computed(() => getStoryboardSession(id.value))
|
||||||
/** 单集重生成返回的是最新镜头正文,优先于不会随局部覆盖更新的历史 Breakdown 快照。 */
|
/** 单集重生成返回的是最新镜头正文,优先于不会随局部覆盖更新的历史 Breakdown 快照。 */
|
||||||
const source = computed(
|
const source = computed(() =>
|
||||||
() =>
|
currentEpisodeSource(
|
||||||
session.value.regeneratedEpisodes[episodeNo.value] ??
|
id.value,
|
||||||
|
episodeNo.value,
|
||||||
sourceEpisodes.value.find(item => item.episodeNo === episodeNo.value)
|
sourceEpisodes.value.find(item => item.episodeNo === episodeNo.value)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
/** 重生成接口未返回新正文时,明确标记辅助剧情信息不可用。 */
|
||||||
|
const episodeSourceUnavailable = computed(() => !!session.value.invalidatedEpisodeSources[episodeNo.value])
|
||||||
|
/** 当前剧集的正式镜头目录。 */
|
||||||
const shots = computed(() =>
|
const shots = computed(() =>
|
||||||
mergeDesignedShots(data.value?.directions ?? null, data.value?.visualStates ?? null, source.value)
|
mergeDesignedShots(data.value?.directions ?? null, data.value?.visualStates ?? null, source.value)
|
||||||
)
|
)
|
||||||
const shot = computed(() => shots.value.find(item => item.shotId === selectedShot.value) ?? shots.value[0])
|
/** 明确指定的镜头不存在时不代选其它镜头;首次进入才选择第一镜。 */
|
||||||
|
const shot = computed(() =>
|
||||||
|
selectedShot.value ? shots.value.find(item => item.shotId === selectedShot.value) : shots.value[0]
|
||||||
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const prerequisites = computed(() => storyboardPrerequisites(context.checkpoints.value, episodeNo.value))
|
const prerequisites = computed(() => storyboardPrerequisites(context.checkpoints.value, episodeNo.value))
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const operation = computed(() => getOperation(id.value))
|
const operation = computed(() => getOperation(id.value))
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const batchValid = computed(() => Number.isSafeInteger(concurrency.value) && concurrency.value > 0)
|
const batchValid = computed(() => Number.isSafeInteger(concurrency.value) && concurrency.value > 0)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const repairsValid = computed(() => Number.isSafeInteger(maxRepairAttempts.value) && maxRepairAttempts.value >= 0)
|
const repairsValid = computed(() => Number.isSafeInteger(maxRepairAttempts.value) && maxRepairAttempts.value >= 0)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const blocked = computed(
|
const blocked = computed(
|
||||||
() =>
|
() =>
|
||||||
operation.value.pending ||
|
operation.value.pending ||
|
||||||
@@ -81,12 +113,21 @@ export function useStoryboard() {
|
|||||||
context.project.value?.status !== 'completed' ||
|
context.project.value?.status !== 'completed' ||
|
||||||
prerequisites.value.breakdownRunning
|
prerequisites.value.breakdownRunning
|
||||||
)
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const directionComplete = computed(
|
const directionComplete = computed(
|
||||||
() =>
|
() =>
|
||||||
!!data.value?.directions.shotCount &&
|
!!data.value?.directions.shotCount &&
|
||||||
data.value.directions.directionCount === data.value.directions.shotCount &&
|
data.value.directions.directionCount === data.value.directions.shotCount &&
|
||||||
data.value.directions.coverage === 1
|
data.value.directions.coverage === 1
|
||||||
)
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
|
const visualStateComplete = computed(
|
||||||
|
() =>
|
||||||
|
!!data.value?.visualStates.shotCount &&
|
||||||
|
data.value.visualStates.visualStateCount === data.value.visualStates.shotCount &&
|
||||||
|
data.value.visualStates.coverage === 1
|
||||||
|
)
|
||||||
|
/** 当前工作区的响应式状态或派生业务条件。 */
|
||||||
const hasCurrentEpisodeShots = computed(
|
const hasCurrentEpisodeShots = computed(
|
||||||
() => Math.max(data.value?.directions.shotCount ?? 0, data.value?.visualStates.shotCount ?? 0) > 0
|
() => Math.max(data.value?.directions.shotCount ?? 0, data.value?.visualStates.shotCount ?? 0) > 0
|
||||||
)
|
)
|
||||||
@@ -97,6 +138,54 @@ export function useStoryboard() {
|
|||||||
prompts: !blocked.value && shots.value.length > 0 && batchValid.value
|
prompts: !blocked.value && shots.value.length > 0 && batchValid.value
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
/** 正式后台任务观察器;重生成使用后端 breakdown 名称并通过 metadata 区分。 */
|
||||||
|
const executions = [
|
||||||
|
{ title: '单集镜头重生成', observer: useWorkflowExecution(id, 'breakdown') },
|
||||||
|
{ title: '项目导演设计', observer: useWorkflowExecution(id, 'storyboard-direction') },
|
||||||
|
{ title: '项目即时状态', observer: useWorkflowExecution(id, 'storyboard-visual-state') },
|
||||||
|
{ title: '项目视频提示词', observer: useWorkflowExecution(id, 'video-prompt') }
|
||||||
|
]
|
||||||
|
/** 真实终态结果才发布回执;刷新恢复也按后端 metadata 归属。 */
|
||||||
|
for (const [index, entry] of executions.entries()) {
|
||||||
|
watch(
|
||||||
|
() => entry.observer.query.data.value,
|
||||||
|
record => {
|
||||||
|
if (!record || record.projectId !== id.value || !['completed', 'failed'].includes(record.status)) return
|
||||||
|
const target = getStoryboardSession(record.projectId)
|
||||||
|
if (index === 0 && record.metadata?.action !== 'regenerate-storyboard-episode') return
|
||||||
|
if (record.status === 'completed' && record.result) {
|
||||||
|
if (index === 0) {
|
||||||
|
const result = record.result as unknown as StoryboardShotRegenerationResult
|
||||||
|
const number = record.metadata?.episodeNo
|
||||||
|
if (
|
||||||
|
typeof number !== 'number' ||
|
||||||
|
result.episodeNo !== number ||
|
||||||
|
!result.storyboardShotValidation ||
|
||||||
|
!result.storyboardShotSummary
|
||||||
|
)
|
||||||
|
return
|
||||||
|
target.receipt = { kind: 'shots', title: `第 ${number} 集镜头`, result }
|
||||||
|
if (result.storyboardShotValidation.valid) {
|
||||||
|
delete target.regeneratedEpisodes[number]
|
||||||
|
invalidateEpisodeSource(record.projectId, number)
|
||||||
|
target.prompts = {}
|
||||||
|
if (episodeNo.value === number) selectedShot.value = ''
|
||||||
|
}
|
||||||
|
} else if (index === 3) {
|
||||||
|
const result = record.result as unknown as PromptBatchResult
|
||||||
|
if (typeof result.failed !== 'number') return
|
||||||
|
target.receipt = { kind: 'prompts', title: entry.title, result }
|
||||||
|
} else {
|
||||||
|
const result = record.result as unknown as StoryboardBatchResult
|
||||||
|
if (result.projectId !== record.projectId || !Array.isArray(result.episodes)) return
|
||||||
|
target.receipt = { kind: 'batch', title: entry.title, result }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Promise.all([query.refresh(), context.refresh(), context.refreshStageReadiness()])
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/** 捕获提交时的目标与配置,切换剧集不改变正在运行的请求或回执。 */
|
/** 捕获提交时的目标与配置,切换剧集不改变正在运行的请求或回执。 */
|
||||||
async function run(command: StoryboardCommand) {
|
async function run(command: StoryboardCommand) {
|
||||||
if (!allowed.value[command]) return
|
if (!allowed.value[command]) return
|
||||||
@@ -113,51 +202,25 @@ export function useStoryboard() {
|
|||||||
}
|
}
|
||||||
target.receipt = null
|
target.receipt = null
|
||||||
await runOperation(projectId, `生成${titles[command]}`, async () => {
|
await runOperation(projectId, `生成${titles[command]}`, async () => {
|
||||||
switch (command) {
|
if (command === 'shots-current') {
|
||||||
case 'shots-current': {
|
const started = await storyboardApi.regenerateEpisodeShots(projectId, targetEpisode)
|
||||||
const result = await storyboardApi.regenerateEpisodeShots(projectId, targetEpisode)
|
await executions[0]!.observer.track(started.executionId, projectId)
|
||||||
if (result.projectId !== projectId || result.episodeNo !== targetEpisode) {
|
} else if (command === 'direction-all') {
|
||||||
throw new Error('镜头重生成返回了不匹配的项目或剧集,请刷新后重试。')
|
const started = await storyboardApi.generateDirections(projectId, batch)
|
||||||
}
|
await executions[1]!.observer.track(started.executionId, projectId)
|
||||||
target.receipt = { kind: 'shots', title: titles[command], result }
|
} else if (command === 'visual-all') {
|
||||||
if (!result.storyboardShotValidation.valid) {
|
const started = await storyboardApi.generateVisualStates(projectId, {
|
||||||
throw new Error('本集镜头校验未通过,后端未覆盖正式 Storyboard。')
|
...batch,
|
||||||
}
|
maxRepairAttempts: repairs
|
||||||
target.regeneratedEpisodes[targetEpisode] = result.episodeShot
|
})
|
||||||
// 新镜头会获得新的数据库 ID,废弃所有按旧 Shot ID 缓存的提示词。
|
await executions[2]!.observer.track(started.executionId, projectId)
|
||||||
target.prompts = {}
|
} else {
|
||||||
if (episodeNo.value === targetEpisode) selectedShot.value = ''
|
target.prompts = {}
|
||||||
break
|
const started = await storyboardApi.generatePrompts(projectId, batch)
|
||||||
}
|
await executions[3]!.observer.track(started.executionId, projectId)
|
||||||
case 'direction-all':
|
|
||||||
target.receipt = {
|
|
||||||
kind: 'batch',
|
|
||||||
title: titles[command],
|
|
||||||
result: await storyboardApi.generateDirections(projectId, batch)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case 'visual-all':
|
|
||||||
target.receipt = {
|
|
||||||
kind: 'batch',
|
|
||||||
title: titles[command],
|
|
||||||
result: await storyboardApi.generateVisualStates(projectId, {
|
|
||||||
...batch,
|
|
||||||
maxRepairAttempts: repairs
|
|
||||||
})
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case 'prompts':
|
|
||||||
// 断网时也可能已部分覆盖,先清空缓存,避免继续展示可能失效的正文。
|
|
||||||
target.prompts = {}
|
|
||||||
target.receipt = {
|
|
||||||
kind: 'prompts',
|
|
||||||
title: titles[command],
|
|
||||||
result: await storyboardApi.generatePrompts(projectId, batch)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await Promise.all([query.refresh(), context.refresh()])
|
await Promise.all([query.refresh(), context.refreshStageReadiness()])
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -171,6 +234,7 @@ export function useStoryboard() {
|
|||||||
query,
|
query,
|
||||||
data,
|
data,
|
||||||
source,
|
source,
|
||||||
|
episodeSourceUnavailable,
|
||||||
prerequisites,
|
prerequisites,
|
||||||
session,
|
session,
|
||||||
operation,
|
operation,
|
||||||
@@ -182,7 +246,9 @@ export function useStoryboard() {
|
|||||||
repairsValid,
|
repairsValid,
|
||||||
blocked,
|
blocked,
|
||||||
directionComplete,
|
directionComplete,
|
||||||
|
visualStateComplete,
|
||||||
hasCurrentEpisodeShots,
|
hasCurrentEpisodeShots,
|
||||||
|
executions,
|
||||||
run
|
run
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,23 +18,26 @@ import {
|
|||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { Check, Circle, RefreshCw, UserCheck } from '@lucide/vue'
|
import { Check, Circle, UserCheck } from '@lucide/vue'
|
||||||
import { AssetImage, DirectoryItem, EmptyState, StatusBadge } from '../../components/ui'
|
import { AssetImage, DirectoryItem, EmptyState, StatusBadge } from '../../components/ui'
|
||||||
import { downloadText } from '../../lib/format'
|
import { downloadText } from '../../lib/format'
|
||||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||||
import { castingStatusLabel, currentAnchor } from './model'
|
import { castingStatusLabel, currentAnchor } from './model'
|
||||||
import { useSubjectIdentity } from './useSubjectIdentity'
|
import { useSubjectIdentity } from './useSubjectIdentity'
|
||||||
|
import { useProjectContext } from '../projects/context'
|
||||||
|
import StableAnchorQualityDialog from './components/StableAnchorQualityDialog.vue'
|
||||||
import IdentityEditor from './components/IdentityEditor.vue'
|
import IdentityEditor from './components/IdentityEditor.vue'
|
||||||
import IdentityGallery from './components/IdentityGallery.vue'
|
import IdentityGallery from './components/IdentityGallery.vue'
|
||||||
import IdentityImageDialog from './components/IdentityImageDialog.vue'
|
import IdentityImageDialog from './components/IdentityImageDialog.vue'
|
||||||
import CastingCandidateDialog from './components/CastingCandidateDialog.vue'
|
import CastingCandidateDialog from './components/CastingCandidateDialog.vue'
|
||||||
import IdentityThumbnail from './components/IdentityThumbnail.vue'
|
import IdentityThumbnail from './components/IdentityThumbnail.vue'
|
||||||
import CreativeProfileSettings from '../generation-config/components/CreativeProfileSettings.vue'
|
|
||||||
import type { IdentitySubject } from './types'
|
import type { IdentitySubject } from './types'
|
||||||
|
|
||||||
/** 主体身份工作区按正式主体聚合,不把同一主体的多个 Form 当成不同身份。 */
|
/** 主体身份工作区按正式主体聚合,不把同一主体的多个 Form 当成不同身份。 */
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const projectContext = useProjectContext()
|
||||||
|
const stageComplete = computed(() => projectContext.stageReadiness.value?.identity.ready === true)
|
||||||
const {
|
const {
|
||||||
projectId,
|
projectId,
|
||||||
operation,
|
operation,
|
||||||
@@ -42,6 +45,7 @@ const {
|
|||||||
subject,
|
subject,
|
||||||
subjects,
|
subjects,
|
||||||
catalog,
|
catalog,
|
||||||
|
generationModelsQuery,
|
||||||
castingQuery,
|
castingQuery,
|
||||||
styleQuery,
|
styleQuery,
|
||||||
profileQuery,
|
profileQuery,
|
||||||
@@ -62,6 +66,8 @@ const {
|
|||||||
canGenerateText,
|
canGenerateText,
|
||||||
canGenerateImage,
|
canGenerateImage,
|
||||||
canGenerateCandidate,
|
canGenerateCandidate,
|
||||||
|
activeIdentityGeneration,
|
||||||
|
latestIdentityFailure,
|
||||||
batchValid,
|
batchValid,
|
||||||
candidateLimitValid,
|
candidateLimitValid,
|
||||||
save,
|
save,
|
||||||
@@ -71,12 +77,18 @@ const {
|
|||||||
generateCastingCandidates,
|
generateCastingCandidates,
|
||||||
generateImage,
|
generateImage,
|
||||||
generateCastingCandidate,
|
generateCastingCandidate,
|
||||||
setAnchor,
|
confirmStableAnchor,
|
||||||
confirmCasting
|
confirmCasting,
|
||||||
|
validateImage,
|
||||||
|
generateStableAnchorQuality,
|
||||||
|
validationResult,
|
||||||
|
qualityResult
|
||||||
} = useSubjectIdentity()
|
} = useSubjectIdentity()
|
||||||
const search = ref('')
|
const search = ref('')
|
||||||
const module = ref('all')
|
const module = ref('all')
|
||||||
const identityBatchModule = ref<'all' | 'character' | 'scene' | 'prop'>('all')
|
const identityBatchModule = ref<'all' | 'character' | 'scene' | 'prop'>('all')
|
||||||
|
/** 单主体稳定母版质量生成弹窗开关。 */
|
||||||
|
const qualityOpen = ref(false)
|
||||||
const imageOpen = ref(false)
|
const imageOpen = ref(false)
|
||||||
const castingOpen = ref(false)
|
const castingOpen = ref(false)
|
||||||
const pendingSelection = ref('')
|
const pendingSelection = ref('')
|
||||||
@@ -116,6 +128,7 @@ watch(
|
|||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
watch(selectedId, () => {
|
watch(selectedId, () => {
|
||||||
|
qualityOpen.value = false
|
||||||
imageOpen.value = false
|
imageOpen.value = false
|
||||||
castingOpen.value = false
|
castingOpen.value = false
|
||||||
pendingSelection.value = ''
|
pendingSelection.value = ''
|
||||||
@@ -140,25 +153,28 @@ function exportReceipt() {
|
|||||||
downloadText('subject-identities-receipt.json', JSON.stringify(session.value.receipt, null, 2), 'application/json')
|
downloadText('subject-identities-receipt.json', JSON.stringify(session.value.receipt, null, 2), 'application/json')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 目录刷新同时读取正式形态和 Character Casting,避免无形态角色状态滞后。 */
|
/** Character 使用确认选角事务;Scene / Prop 保留普通母版切换。 */
|
||||||
function refreshDirectory() {
|
async function submitIdentityImage(input: Parameters<typeof generateImage>[0]) {
|
||||||
thumbnailRefreshKey.value++
|
await generateImage(input)
|
||||||
void Promise.all([catalog.refresh(), castingQuery.refresh()])
|
if (!operation.value.error) imageOpen.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitCastingCandidate(input: Parameters<typeof generateCastingCandidate>[0]) {
|
||||||
|
await generateCastingCandidate(input)
|
||||||
|
if (!operation.value.error) castingOpen.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Character 使用确认选角事务;Scene / Prop 保留普通母版切换。 */
|
/** Character 使用确认选角事务;Scene / Prop 保留普通母版切换。 */
|
||||||
function chooseAnchor(imageId: string) {
|
function chooseAnchor(imageId: string) {
|
||||||
if (subject.value?.module === 'character') void confirmCasting(imageId)
|
if (subject.value?.module === 'character') void confirmCasting(imageId)
|
||||||
else void setAnchor(imageId)
|
else void confirmStableAnchor(imageId)
|
||||||
}
|
}
|
||||||
/** 新回执自动展开,避免折叠区隐藏部分失败诊断。 */
|
/** 新回执自动展开,避免折叠区隐藏部分失败诊断。 */
|
||||||
const toolsOpen = ref(false)
|
const toolsOpen = ref(false)
|
||||||
const overview = ref<string[]>(['casting'])
|
|
||||||
watch(
|
watch(
|
||||||
() => session.value.receipt,
|
() => session.value.receipt,
|
||||||
receipt => {
|
receipt => {
|
||||||
if (receipt) {
|
if (receipt) {
|
||||||
overview.value = ['casting']
|
|
||||||
toolsOpen.value = true
|
toolsOpen.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,8 +186,15 @@ type IdentityFlowAction = 'style' | 'profile' | 'identity' | 'candidate' | 'conf
|
|||||||
const primaryCandidate = computed(() =>
|
const primaryCandidate = computed(() =>
|
||||||
images.value.find(image => image.viewType === 'primary' && image.status === 'completed' && image.imageUrl)
|
images.value.find(image => image.viewType === 'primary' && image.status === 'completed' && image.imageUrl)
|
||||||
)
|
)
|
||||||
|
/**
|
||||||
|
* Scene / Prop 的 primary 完成图本身即可进入确认母版阶段。
|
||||||
|
* Character 仍以正式 Anchor / Casting 状态为准。
|
||||||
|
*/
|
||||||
|
const referenceImageReady = computed(() =>
|
||||||
|
subject.value?.module === 'character' ? !!anchor.value || !!primaryCandidate.value : !!primaryCandidate.value
|
||||||
|
)
|
||||||
const identityTextReady = computed(() => !!identity.value?.generationPrompt?.trim())
|
const identityTextReady = computed(() => !!identity.value?.generationPrompt?.trim())
|
||||||
const candidateReady = computed(() => !!anchor.value || !!primaryCandidate.value)
|
const candidateReady = computed(() => referenceImageReady.value)
|
||||||
const identityReady = computed(() => !!anchor.value && !!identity.value?.isLocked)
|
const identityReady = computed(() => !!anchor.value && !!identity.value?.isLocked)
|
||||||
const identityFlow = computed(() => {
|
const identityFlow = computed(() => {
|
||||||
const character = subject.value?.module === 'character'
|
const character = subject.value?.module === 'character'
|
||||||
@@ -243,9 +266,8 @@ const nextAction = computed<{ action: IdentityFlowAction; title: string; descrip
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** 原配置恢复入口打开标题栏共用的全局配置弹窗。 */
|
||||||
function openProfileSettings() {
|
function openProfileSettings() {
|
||||||
toolsOpen.value = true
|
|
||||||
overview.value = []
|
|
||||||
if (route.query.configure !== 'profile') void router.replace({ query: { ...route.query, configure: 'profile' } })
|
if (route.query.configure !== 'profile') void router.replace({ query: { ...route.query, configure: 'profile' } })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,24 +289,19 @@ function runNextAction() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function profileSaved() {
|
|
||||||
operation.value.error = ''
|
|
||||||
await profileQuery.refresh()
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => route.query.configure,
|
|
||||||
value => {
|
|
||||||
if (value === 'profile') openProfileSettings()
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<WorkspacePage split compact class="identity-workspace-page"
|
<WorkspacePage split compact class="identity-workspace-page">
|
||||||
><template #header>
|
<template #notice>
|
||||||
|
<NAlert v-if="stageComplete" type="success" :show-icon="false">
|
||||||
|
所有需要确认的角色身份已经准备好,可以继续制作主体形态图片。
|
||||||
|
<RouterLink :to="`/projects/${projectId}/subject-images`" class="text-button ml-2"
|
||||||
|
>继续形态图片 →</RouterLink
|
||||||
|
>
|
||||||
|
</NAlert>
|
||||||
|
</template>
|
||||||
|
<template #header>
|
||||||
<!-- 以下是类型筛选、主体数量与操作入口 -->
|
<!-- 以下是类型筛选、主体数量与操作入口 -->
|
||||||
<div class="workspace-toolbar">
|
<div class="workspace-toolbar">
|
||||||
<div class="toolbar-type-filter">
|
<div class="toolbar-type-filter">
|
||||||
@@ -306,7 +323,7 @@ watch(
|
|||||||
title="角色选角总览与批量操作"
|
title="角色选角总览与批量操作"
|
||||||
:has-receipt="!!session.receipt"
|
:has-receipt="!!session.receipt"
|
||||||
>
|
>
|
||||||
<CreativeProfileSettings :project-id="projectId" @saved="profileSaved" />
|
<!-- 以下是主体身份说明与选角批量操作模块 -->
|
||||||
<div class="identity-tools-intro flex flex-wrap items-end justify-between gap-4">
|
<div class="identity-tools-intro flex flex-wrap items-end justify-between gap-4">
|
||||||
<div>
|
<div>
|
||||||
<h2 class="text-lg font-semibold">主体身份</h2>
|
<h2 class="text-lg font-semibold">主体身份</h2>
|
||||||
@@ -314,301 +331,257 @@ watch(
|
|||||||
为同一个人物、场景或道具固定稳定特征,再生成不同造型。
|
为同一个人物、场景或道具固定稳定特征,再生成不同造型。
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<RouterLink :to="`/projects/${projectId}/subject-images`" class="text-button"
|
|
||||||
>下一步:形态图片 →</RouterLink
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="workspace-overview-panel">
|
<div class="workspace-overview-panel">
|
||||||
<NCollapse v-model:expanded-names="overview"
|
<div class="overview-content workspace-section-stack dialog-flat-stack">
|
||||||
><NCollapseItem name="casting" title="角色选角总览与批量操作"
|
<h3 class="text-sm font-semibold">角色选角总览与批量操作</h3>
|
||||||
><div class="overview-content">
|
<NAlert type="info" :show-icon="false" class="text-xs">
|
||||||
<NAlert type="info" :show-icon="false" class="mt-5 text-xs">
|
人物需要依次完成身份描述、选角候选、确认角色母版并锁定,之后才能用于镜头制作。未明确人物背景时,AI
|
||||||
Character 现在需要依次完成身份文本、选角候选、确认演员并锁定
|
默认以中国人物作为选角基线;项目和角色的明确事实始终优先。场景和道具使用稳定身份母版流程。
|
||||||
Identity,之后首帧才能就绪。未明确人物背景时,AI
|
</NAlert>
|
||||||
默认以中国人物作为选角基线;项目和角色的明确事实始终优先。场景和道具仍使用普通身份母版流程。
|
<NAlert v-if="styleQuery.data.value && !hasStyle" type="info" :show-icon="false">
|
||||||
</NAlert>
|
先创建项目视觉风格,才能 AI 生成身份或身份图片。<RouterLink
|
||||||
<NAlert
|
:to="`/projects/${projectId}/visual-style`"
|
||||||
v-if="styleQuery.data.value && !hasStyle"
|
class="text-button ml-2"
|
||||||
type="info"
|
>设置视觉风格 →</RouterLink
|
||||||
:show-icon="false"
|
></NAlert
|
||||||
class="mt-4"
|
>
|
||||||
>
|
<section v-if="casting" class="workspace-panel" aria-label="角色选角流程">
|
||||||
先创建项目视觉风格,才能 AI 生成身份或身份图片。<RouterLink
|
<div class="flex flex-wrap items-start justify-between gap-4">
|
||||||
:to="`/projects/${projectId}/visual-style`"
|
<div class="flex items-start gap-3">
|
||||||
class="text-button ml-2"
|
<span class="production-step"><UserCheck :size="17" /></span>
|
||||||
>设置视觉风格 →</RouterLink
|
<div>
|
||||||
></NAlert
|
<h3 class="text-sm font-semibold">角色选角</h3>
|
||||||
>
|
<p class="mt-2 text-xs leading-6 text-muted">
|
||||||
<section v-if="casting" class="panel my-5 p-5" aria-label="角色选角流程">
|
只处理
|
||||||
<div class="flex flex-wrap items-start justify-between gap-4">
|
Character。每张候选都根据当前身份描述独立生成,不复用旧母版;确认选择后才会设为角色母版并锁定身份。
|
||||||
<div class="flex items-start gap-3">
|
|
||||||
<span class="production-step"><UserCheck :size="17" /></span>
|
|
||||||
<div>
|
|
||||||
<h3 class="text-sm font-semibold">角色选角</h3>
|
|
||||||
<p class="mt-2 text-xs leading-6 text-muted">
|
|
||||||
只处理 Character。每张候选都从 Identity 独立生成,不复用旧
|
|
||||||
Anchor;确认选择时才会同时切换 Anchor 并锁定 Identity。
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span class="font-mono text-xs text-muted"
|
|
||||||
>{{ casting.ready }} / {{ casting.total }} 已完成</span
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<dl class="casting-stats mt-4">
|
|
||||||
<div>
|
|
||||||
<dt>缺身份文本</dt>
|
|
||||||
<dd>{{ casting.missingIdentity }}</dd>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<dt>缺候选图</dt>
|
|
||||||
<dd>{{ casting.missingAnchor }}</dd>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<dt>待确认演员</dt>
|
|
||||||
<dd>{{ casting.candidatePending }}</dd>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<dt>母版未锁定</dt>
|
|
||||||
<dd>{{ casting.unlocked }}</dd>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<dt>选角完成</dt>
|
|
||||||
<dd>{{ casting.ready }}</dd>
|
|
||||||
</div>
|
|
||||||
</dl>
|
|
||||||
<AppForm
|
|
||||||
:model="formModel"
|
|
||||||
:rules="rules"
|
|
||||||
:disabled="operation.pending"
|
|
||||||
validate-on-change
|
|
||||||
>
|
|
||||||
<div class="form-controls mt-5 flex flex-wrap gap-4 pt-4">
|
|
||||||
<NFormItem class="w-28" path="concurrency" label="并发数">
|
|
||||||
<NInputNumber
|
|
||||||
:input-props="{ 'aria-label': '并发数' }"
|
|
||||||
:disabled="operation.pending"
|
|
||||||
:value="
|
|
||||||
typeof concurrency === 'number' ? concurrency : null
|
|
||||||
"
|
|
||||||
@update:value="concurrency = $event ?? 0"
|
|
||||||
:min="1"
|
|
||||||
:step="1"
|
|
||||||
></NInputNumber>
|
|
||||||
</NFormItem>
|
|
||||||
<NFormItem class="w-28" path="candidateLimit" label="本批上限">
|
|
||||||
<NInputNumber
|
|
||||||
:input-props="{ 'aria-label': '本批上限' }"
|
|
||||||
:disabled="operation.pending"
|
|
||||||
:value="
|
|
||||||
typeof candidateLimit === 'number'
|
|
||||||
? candidateLimit
|
|
||||||
: null
|
|
||||||
"
|
|
||||||
@update:value="candidateLimit = $event ?? 0"
|
|
||||||
:min="1"
|
|
||||||
:step="1"
|
|
||||||
></NInputNumber>
|
|
||||||
</NFormItem>
|
|
||||||
<NCheckbox
|
|
||||||
v-model:checked="force"
|
|
||||||
:disabled="operation.pending"
|
|
||||||
class="control-row-checkbox text-xs"
|
|
||||||
>覆盖未锁定身份文本
|
|
||||||
</NCheckbox>
|
|
||||||
<ConfirmAction
|
|
||||||
:label="force ? '重生成角色身份文本' : '补齐角色身份文本'"
|
|
||||||
:disabled="
|
|
||||||
blocked ||
|
|
||||||
!hasStyle ||
|
|
||||||
!batchValid ||
|
|
||||||
!candidateLimitValid ||
|
|
||||||
dirty ||
|
|
||||||
!casting.total
|
|
||||||
"
|
|
||||||
acknowledgement
|
|
||||||
description="只生成 Character Identity 文本,不生成图片。已锁定角色始终跳过;覆盖文本不会自动更新已有候选图。"
|
|
||||||
@confirm="generateProject(true)"
|
|
||||||
/>
|
|
||||||
<ConfirmAction
|
|
||||||
label="生成选角候选"
|
|
||||||
:disabled="
|
|
||||||
castingBlocked ||
|
|
||||||
!hasStyle ||
|
|
||||||
!batchValid ||
|
|
||||||
!candidateLimitValid ||
|
|
||||||
!casting.missingAnchor
|
|
||||||
"
|
|
||||||
acknowledgement
|
|
||||||
description="最多按本批上限为缺少 Anchor 的 Character 调用 图片模型,各自独立生成一张停用的 primary 候选,不复用旧身份母版。已有候选、已有母版或已完成选角的角色不会重复处理。"
|
|
||||||
@confirm="generateCastingCandidates"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</AppForm>
|
|
||||||
<div class="casting-list" role="group" aria-label="角色选角进度">
|
|
||||||
<NButton
|
|
||||||
v-for="item in casting.items"
|
|
||||||
:key="item.subjectId"
|
|
||||||
@click="select(item.subjectId)"
|
|
||||||
class="casting-item"
|
|
||||||
:class="{ selected: selectedId === item.subjectId }"
|
|
||||||
:aria-pressed="selectedId === item.subjectId"
|
|
||||||
><span class="casting-item-identity">
|
|
||||||
<span class="casting-item-name">{{ item.subjectName }}</span>
|
|
||||||
<span class="casting-item-ref">{{
|
|
||||||
item.subjectRef
|
|
||||||
}}</span> </span
|
|
||||||
><StatusBadge
|
|
||||||
class="casting-item-status"
|
|
||||||
:status="item.status"
|
|
||||||
:label="castingStatusLabel(item.status)"
|
|
||||||
/></NButton>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<section class="panel mb-5 p-5" aria-label="场景与道具身份母版">
|
|
||||||
<div class="flex flex-wrap items-start justify-between gap-4">
|
|
||||||
<div>
|
|
||||||
<h3 class="text-sm font-semibold">场景与道具稳定母版</h3>
|
|
||||||
<p class="mt-2 text-xs leading-6 text-muted">
|
|
||||||
为已有身份提示词但缺少有效母版的场景或道具小批量生图。成功后后端会自动设为
|
|
||||||
Anchor 并锁定 Identity。
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-wrap gap-3">
|
|
||||||
<ConfirmAction
|
|
||||||
label="生成场景母版"
|
|
||||||
:disabled="
|
|
||||||
blocked ||
|
|
||||||
!hasStyle ||
|
|
||||||
!batchValid ||
|
|
||||||
!candidateLimitValid ||
|
|
||||||
dirty ||
|
|
||||||
!subjects.length
|
|
||||||
"
|
|
||||||
acknowledgement
|
|
||||||
:description="`最多处理 ${candidateLimit} 个场景,生成成功后自动设为身份母版并锁定。可能产生图片模型费用。`"
|
|
||||||
@confirm="generateStableAnchors('scene')"
|
|
||||||
/>
|
|
||||||
<ConfirmAction
|
|
||||||
label="生成道具母版"
|
|
||||||
:disabled="
|
|
||||||
blocked ||
|
|
||||||
!hasStyle ||
|
|
||||||
!batchValid ||
|
|
||||||
dirty ||
|
|
||||||
!subjects.length
|
|
||||||
"
|
|
||||||
acknowledgement
|
|
||||||
:description="`最多处理 ${candidateLimit} 个道具,生成成功后自动设为身份母版并锁定。可能产生图片模型费用。`"
|
|
||||||
@confirm="generateStableAnchors('prop')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<NCollapse class="panel mb-5 p-5" :default-expanded-names="['details']"
|
|
||||||
><NCollapseItem name="details"
|
|
||||||
><template #header>高级:全部主体身份文本</template>
|
|
||||||
<p class="mt-3 text-xs leading-6 text-muted">
|
|
||||||
同时处理 Character、Scene 和
|
|
||||||
Prop;角色选角建议优先使用上方专用入口。已锁定身份始终跳过。
|
|
||||||
</p>
|
</p>
|
||||||
<NSelect
|
|
||||||
v-model:value="identityBatchModule"
|
|
||||||
class="mt-4 w-48"
|
|
||||||
aria-label="身份文本批处理范围"
|
|
||||||
:options="[
|
|
||||||
{ label: String('全部类型'), value: 'all' },
|
|
||||||
{ label: String('仅人物'), value: 'character' },
|
|
||||||
{ label: String('仅场景'), value: 'scene' },
|
|
||||||
{ label: String('仅道具'), value: 'prop' }
|
|
||||||
]" />
|
|
||||||
<ConfirmAction
|
|
||||||
class="mt-4"
|
|
||||||
:label="force ? '重生成全部未锁定身份' : '补齐全部主体身份文本'"
|
|
||||||
:disabled="
|
|
||||||
blocked || !hasStyle || !batchValid || dirty || !subjects.length
|
|
||||||
"
|
|
||||||
acknowledgement
|
|
||||||
description="生成全项目主体身份描述与提示词,不生成图片。覆盖不会自动更新旧身份图、形态图、首帧或视频。"
|
|
||||||
@confirm="
|
|
||||||
identityBatchModule === 'character'
|
|
||||||
? generateProject(true)
|
|
||||||
: generateProject(
|
|
||||||
false,
|
|
||||||
identityBatchModule === 'scene' ||
|
|
||||||
identityBatchModule === 'prop'
|
|
||||||
? identityBatchModule
|
|
||||||
: undefined
|
|
||||||
)
|
|
||||||
" /></NCollapseItem
|
|
||||||
></NCollapse>
|
|
||||||
<section
|
|
||||||
v-if="session.receipt"
|
|
||||||
class="panel mb-5 p-5"
|
|
||||||
aria-label="身份文本批量回执"
|
|
||||||
>
|
|
||||||
<div class="flex justify-between gap-3">
|
|
||||||
<h3 class="text-sm font-medium">
|
|
||||||
{{ session.receipt.title }} · 本次回执
|
|
||||||
</h3>
|
|
||||||
<NButton @click="exportReceipt" text size="small">导出诊断</NButton>
|
|
||||||
</div>
|
</div>
|
||||||
<p
|
</div>
|
||||||
v-if="session.receipt.kind === 'identities'"
|
<span class="font-mono text-xs text-muted"
|
||||||
class="mt-3 text-xs text-muted"
|
>{{ casting.ready }} / {{ casting.total }} 已完成</span
|
||||||
>
|
>
|
||||||
共 {{ session.receipt.result.total }} 个主体 · 目标
|
</div>
|
||||||
{{ session.receipt.result.targetCount }} · 生成
|
<dl class="casting-stats mt-4">
|
||||||
{{ session.receipt.result.generated }} · 跳过
|
<div>
|
||||||
{{ session.receipt.result.skipped }}(含锁定
|
<dt>缺身份文本</dt>
|
||||||
{{ session.receipt.result.skippedLocked }})· 失败
|
<dd>{{ casting.missingIdentity }}</dd>
|
||||||
{{ session.receipt.result.failed }}
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>缺候选图</dt>
|
||||||
|
<dd>{{ casting.missingAnchor }}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>待确认演员</dt>
|
||||||
|
<dd>{{ casting.candidatePending }}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>母版未锁定</dt>
|
||||||
|
<dd>{{ casting.unlocked }}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>选角完成</dt>
|
||||||
|
<dd>{{ casting.ready }}</dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
<AppForm
|
||||||
|
:model="formModel"
|
||||||
|
:rules="rules"
|
||||||
|
:disabled="operation.pending"
|
||||||
|
validate-on-change
|
||||||
|
>
|
||||||
|
<div class="form-controls mt-5 flex flex-wrap gap-4 pt-4">
|
||||||
|
<NFormItem class="w-28" path="concurrency" label="并发数">
|
||||||
|
<NInputNumber
|
||||||
|
:input-props="{ 'aria-label': '并发数' }"
|
||||||
|
:disabled="operation.pending"
|
||||||
|
:value="typeof concurrency === 'number' ? concurrency : null"
|
||||||
|
@update:value="concurrency = $event ?? 0"
|
||||||
|
:min="1"
|
||||||
|
:step="1"
|
||||||
|
></NInputNumber>
|
||||||
|
</NFormItem>
|
||||||
|
<NFormItem class="w-28" path="candidateLimit" label="本批上限">
|
||||||
|
<NInputNumber
|
||||||
|
:input-props="{ 'aria-label': '本批上限' }"
|
||||||
|
:disabled="operation.pending"
|
||||||
|
:value="typeof candidateLimit === 'number' ? candidateLimit : null"
|
||||||
|
@update:value="candidateLimit = $event ?? 0"
|
||||||
|
:min="1"
|
||||||
|
:step="1"
|
||||||
|
></NInputNumber>
|
||||||
|
</NFormItem>
|
||||||
|
<NCheckbox
|
||||||
|
v-model:checked="force"
|
||||||
|
:disabled="operation.pending"
|
||||||
|
class="control-row-checkbox text-xs"
|
||||||
|
>覆盖未锁定身份文本
|
||||||
|
</NCheckbox>
|
||||||
|
<ConfirmAction
|
||||||
|
:label="force ? '重生成角色身份文本' : '补齐角色身份文本'"
|
||||||
|
:disabled="
|
||||||
|
blocked ||
|
||||||
|
!hasStyle ||
|
||||||
|
!batchValid ||
|
||||||
|
!candidateLimitValid ||
|
||||||
|
dirty ||
|
||||||
|
!casting.total
|
||||||
|
"
|
||||||
|
acknowledgement
|
||||||
|
description="只生成 Character Identity 文本,不生成图片。已锁定角色始终跳过;覆盖文本不会自动更新已有候选图。"
|
||||||
|
@confirm="generateProject(true)"
|
||||||
|
/>
|
||||||
|
<ConfirmAction
|
||||||
|
label="生成选角候选"
|
||||||
|
:disabled="
|
||||||
|
castingBlocked ||
|
||||||
|
!hasStyle ||
|
||||||
|
!batchValid ||
|
||||||
|
!candidateLimitValid ||
|
||||||
|
!casting.missingAnchor
|
||||||
|
"
|
||||||
|
acknowledgement
|
||||||
|
description="最多按本批上限为缺少 Anchor 的 Character 调用 图片模型,各自独立生成一张停用的 primary 候选,不复用旧身份母版。已有候选、已有母版或已完成选角的角色不会重复处理。"
|
||||||
|
@confirm="generateCastingCandidates"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</AppForm>
|
||||||
|
<div class="casting-list" role="group" aria-label="角色选角进度">
|
||||||
|
<NButton
|
||||||
|
v-for="item in casting.items"
|
||||||
|
:key="item.subjectId"
|
||||||
|
@click="select(item.subjectId)"
|
||||||
|
class="casting-item"
|
||||||
|
:class="{ selected: selectedId === item.subjectId }"
|
||||||
|
:aria-pressed="selectedId === item.subjectId"
|
||||||
|
><span class="casting-item-identity">
|
||||||
|
<span class="casting-item-name">{{ item.subjectName }}</span>
|
||||||
|
<span class="casting-item-ref">{{ item.subjectRef }}</span> </span
|
||||||
|
><StatusBadge
|
||||||
|
class="casting-item-status"
|
||||||
|
:status="item.status"
|
||||||
|
:label="castingStatusLabel(item.status)"
|
||||||
|
/></NButton>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="workspace-panel" aria-label="场景与道具身份母版">
|
||||||
|
<div class="flex flex-wrap items-start justify-between gap-4">
|
||||||
|
<div>
|
||||||
|
<h3 class="text-sm font-semibold">场景与道具稳定母版</h3>
|
||||||
|
<p class="mt-2 text-xs leading-6 text-muted">
|
||||||
|
为已有身份描述但缺少有效母版的场景或道具小批量生图。成功后会自动设为身份母版并锁定。
|
||||||
</p>
|
</p>
|
||||||
<p
|
</div>
|
||||||
v-else-if="session.receipt.kind === 'casting'"
|
<div class="flex flex-wrap gap-3">
|
||||||
class="mt-3 text-xs text-muted"
|
<ConfirmAction
|
||||||
>
|
label="生成场景母版"
|
||||||
共 {{ session.receipt.result.totalCharacters }} 个角色 · 缺候选
|
:disabled="
|
||||||
{{ session.receipt.result.missingAnchor }} · 本批目标
|
blocked ||
|
||||||
{{ session.receipt.result.targetCount }} · 已生成
|
!hasStyle ||
|
||||||
{{ session.receipt.result.generated }} · 失败
|
!batchValid ||
|
||||||
{{ session.receipt.result.failed }}
|
!candidateLimitValid ||
|
||||||
</p>
|
dirty ||
|
||||||
<p v-else class="mt-3 text-xs text-muted">
|
!subjects.length
|
||||||
共 {{ session.receipt.result.total }} 个{{
|
"
|
||||||
session.receipt.result.module === 'scene' ? '场景' : '道具'
|
acknowledgement
|
||||||
}}
|
:description="`最多处理 ${candidateLimit} 个场景,生成成功后自动设为身份母版并锁定。可能产生图片模型费用。`"
|
||||||
· 符合条件 {{ session.receipt.result.eligibleCount }} · 本批目标
|
@confirm="generateStableAnchors('scene')"
|
||||||
{{ session.receipt.result.targetCount }} · 已生成并锁定
|
/>
|
||||||
{{ session.receipt.result.generated }} · 失败
|
<ConfirmAction
|
||||||
{{ session.receipt.result.failed }}
|
label="生成道具母版"
|
||||||
</p>
|
:disabled="
|
||||||
<NAlert
|
blocked || !hasStyle || !batchValid || dirty || !subjects.length
|
||||||
v-if="session.receipt.result.failed"
|
"
|
||||||
role="alert"
|
acknowledgement
|
||||||
type="error"
|
:description="`最多处理 ${candidateLimit} 个道具,生成成功后自动设为身份母版并锁定。可能产生图片模型费用。`"
|
||||||
:show-icon="false"
|
@confirm="generateStableAnchors('prop')"
|
||||||
class="mt-3"
|
/>
|
||||||
>
|
</div>
|
||||||
本次存在部分失败,成功结果不会回滚。请检查逐角色原因后再重试。
|
</div>
|
||||||
</NAlert>
|
</section>
|
||||||
<ul class="mt-3 space-y-2 text-xs text-danger">
|
<NCollapse class="workspace-panel" :default-expanded-names="['details']"
|
||||||
<li
|
><NCollapseItem name="details"
|
||||||
v-for="failure in session.receipt.result.failures"
|
><template #header>高级:全部主体身份文本</template>
|
||||||
:key="failure.subjectId"
|
<p class="mt-3 text-xs leading-6 text-muted">
|
||||||
>
|
同时处理 Character、Scene 和
|
||||||
{{ failure.subjectRef }} · {{ failure.subjectId }}:{{
|
Prop;角色选角建议优先使用上方专用入口。已锁定身份始终跳过。
|
||||||
failure.error
|
</p>
|
||||||
}}
|
<NSelect
|
||||||
</li>
|
v-model:value="identityBatchModule"
|
||||||
</ul>
|
class="mt-4 w-48"
|
||||||
<p class="mt-3 text-[11px] text-muted">
|
aria-label="身份文本批处理范围"
|
||||||
回执仅保留于当前浏览器会话;最终状态以刷新后的正式记录为准。
|
:options="[
|
||||||
</p>
|
{ label: String('全部类型'), value: 'all' },
|
||||||
</section>
|
{ label: String('仅人物'), value: 'character' },
|
||||||
</div></NCollapseItem
|
{ label: String('仅场景'), value: 'scene' },
|
||||||
></NCollapse
|
{ label: String('仅道具'), value: 'prop' }
|
||||||
>
|
]" />
|
||||||
|
<ConfirmAction
|
||||||
|
class="mt-4"
|
||||||
|
:label="force ? '重生成全部未锁定身份' : '补齐全部主体身份文本'"
|
||||||
|
:disabled="blocked || !hasStyle || !batchValid || dirty || !subjects.length"
|
||||||
|
acknowledgement
|
||||||
|
description="生成全项目主体身份描述与提示词,不生成图片。覆盖不会自动更新旧身份图、形态图、首帧或视频。"
|
||||||
|
@confirm="
|
||||||
|
identityBatchModule === 'character'
|
||||||
|
? generateProject(true)
|
||||||
|
: generateProject(
|
||||||
|
false,
|
||||||
|
identityBatchModule === 'scene' ||
|
||||||
|
identityBatchModule === 'prop'
|
||||||
|
? identityBatchModule
|
||||||
|
: undefined
|
||||||
|
)
|
||||||
|
" /></NCollapseItem
|
||||||
|
></NCollapse>
|
||||||
|
<section v-if="session.receipt" class="workspace-panel" aria-label="身份文本批量回执">
|
||||||
|
<div class="flex justify-between gap-3">
|
||||||
|
<h3 class="text-sm font-medium">{{ session.receipt.title }} · 本次回执</h3>
|
||||||
|
<NButton @click="exportReceipt" text size="small">导出诊断</NButton>
|
||||||
|
</div>
|
||||||
|
<p v-if="session.receipt.kind === 'identities'" class="mt-3 text-xs text-muted">
|
||||||
|
共 {{ session.receipt.result.total }} 个主体 · 目标
|
||||||
|
{{ session.receipt.result.targetCount }} · 生成
|
||||||
|
{{ session.receipt.result.generated }} · 跳过
|
||||||
|
{{ session.receipt.result.skipped }}(含锁定
|
||||||
|
{{ session.receipt.result.skippedLocked }})· 失败
|
||||||
|
{{ session.receipt.result.failed }}
|
||||||
|
</p>
|
||||||
|
<p v-else-if="session.receipt.kind === 'casting'" class="mt-3 text-xs text-muted">
|
||||||
|
共 {{ session.receipt.result.totalCharacters }} 个角色 · 缺候选
|
||||||
|
{{ session.receipt.result.missingAnchor }} · 本批目标
|
||||||
|
{{ session.receipt.result.targetCount }} · 已生成
|
||||||
|
{{ session.receipt.result.generated }} · 失败
|
||||||
|
{{ session.receipt.result.failed }}
|
||||||
|
</p>
|
||||||
|
<p v-else class="mt-3 text-xs text-muted">
|
||||||
|
共 {{ session.receipt.result.total }} 个{{
|
||||||
|
session.receipt.result.module === 'scene' ? '场景' : '道具'
|
||||||
|
}}
|
||||||
|
· 符合条件 {{ session.receipt.result.eligibleCount }} · 本批目标
|
||||||
|
{{ session.receipt.result.targetCount }} · 已生成并锁定
|
||||||
|
{{ session.receipt.result.generated }} · 失败
|
||||||
|
{{ session.receipt.result.failed }}
|
||||||
|
</p>
|
||||||
|
<NAlert
|
||||||
|
v-if="session.receipt.result.failed"
|
||||||
|
role="alert"
|
||||||
|
type="error"
|
||||||
|
:show-icon="false"
|
||||||
|
class="mt-3"
|
||||||
|
>
|
||||||
|
本次存在部分失败,成功结果不会回滚。请检查逐角色原因后再重试。
|
||||||
|
</NAlert>
|
||||||
|
<ul class="mt-3 space-y-2 text-xs text-danger">
|
||||||
|
<li v-for="failure in session.receipt.result.failures" :key="failure.subjectId">
|
||||||
|
{{ failure.subjectRef }} · {{ failure.subjectId }}:{{ failure.error }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p class="mt-3 text-[11px] text-muted">
|
||||||
|
回执仅保留于当前浏览器会话;最终状态以刷新后的正式记录为准。
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</WorkspaceTools>
|
</WorkspaceTools>
|
||||||
</div>
|
</div>
|
||||||
@@ -640,16 +613,6 @@ watch(
|
|||||||
<h3>
|
<h3>
|
||||||
主体目录 <span>{{ filtered.length }} / {{ subjects.length }}</span>
|
主体目录 <span>{{ filtered.length }} / {{ subjects.length }}</span>
|
||||||
</h3>
|
</h3>
|
||||||
<NButton
|
|
||||||
:disabled="catalog.loading.value || castingQuery.loading.value"
|
|
||||||
@click="refreshDirectory"
|
|
||||||
quaternary
|
|
||||||
class="icon-button"
|
|
||||||
size="small"
|
|
||||||
aria-label="刷新主体目录"
|
|
||||||
title="刷新主体目录"
|
|
||||||
><template #icon><RefreshCw :size="14" /></template
|
|
||||||
></NButton>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="directory-filters">
|
<div class="directory-filters">
|
||||||
<NInput
|
<NInput
|
||||||
@@ -703,7 +666,7 @@ watch(
|
|||||||
><NButton @click="pendingSelection = ''" text size="small">继续编辑</NButton>
|
><NButton @click="pendingSelection = ''" text size="small">继续编辑</NButton>
|
||||||
</div></NAlert
|
</div></NAlert
|
||||||
>
|
>
|
||||||
<section v-if="subject" class="panel p-5 sm:p-6">
|
<section v-if="subject" class="panel workspace-panel">
|
||||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||||
<div>
|
<div>
|
||||||
<h3 class="font-semibold">
|
<h3 class="font-semibold">
|
||||||
@@ -786,6 +749,30 @@ watch(
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 以下是场景与道具单主体母版质量生成模块 -->
|
||||||
|
<NButton
|
||||||
|
v-if="subject.module === 'scene' || subject.module === 'prop'"
|
||||||
|
class="mt-4"
|
||||||
|
:disabled="!canGenerateImage"
|
||||||
|
@click="qualityOpen = true"
|
||||||
|
>生成稳定母版并校验质量</NButton
|
||||||
|
>
|
||||||
|
<NAlert v-if="qualityResult" :type="qualityResult.passed ? 'success' : 'warning'" class="mt-3">
|
||||||
|
{{
|
||||||
|
qualityResult.passed
|
||||||
|
? '质量闭环通过,母版与锁定已确认'
|
||||||
|
: '质量闭环未通过,候选仍保留在图库'
|
||||||
|
}}
|
||||||
|
· 已修复 {{ qualityResult.repairAttempts }} 次
|
||||||
|
<p v-if="qualityResult.stopReason">停止原因:{{ qualityResult.stopReason }}</p>
|
||||||
|
<pre class="whitespace-pre-wrap break-all text-xs">{{
|
||||||
|
JSON.stringify(qualityResult.attempts, null, 2)
|
||||||
|
}}</pre>
|
||||||
|
</NAlert>
|
||||||
|
<!-- 以下是已完成主体的候选生成与真实输入预览入口模块 -->
|
||||||
|
<NButton class="mt-4" :disabled="!canGenerateImage" @click="imageOpen = true">
|
||||||
|
{{ subject.module === 'character' ? '生成辅助参考图' : '生成母版候选' }}
|
||||||
|
</NButton>
|
||||||
<IdentityGallery
|
<IdentityGallery
|
||||||
id="identity-reference-gallery"
|
id="identity-reference-gallery"
|
||||||
:key="selectedId"
|
:key="selectedId"
|
||||||
@@ -794,6 +781,8 @@ watch(
|
|||||||
:module="subject.module"
|
:module="subject.module"
|
||||||
:identity-locked="!!identity?.isLocked"
|
:identity-locked="!!identity?.isLocked"
|
||||||
:disabled="detailBlocked || (subject.module === 'character' && !!castingQuery.error.value)"
|
:disabled="detailBlocked || (subject.module === 'character' && !!castingQuery.error.value)"
|
||||||
|
:validation-result="validationResult"
|
||||||
|
@validate="validateImage"
|
||||||
@anchor="chooseAnchor"
|
@anchor="chooseAnchor"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -825,22 +814,52 @@ watch(
|
|||||||
>前往剧本拆解</RouterLink
|
>前往剧本拆解</RouterLink
|
||||||
></EmptyState
|
></EmptyState
|
||||||
>
|
>
|
||||||
|
<NAlert v-if="activeIdentityGeneration" type="info" :show-icon="false" class="mb-4 text-xs">
|
||||||
|
{{ subject?.name }} 的身份图片正在生成({{
|
||||||
|
activeIdentityGeneration.provider || '图片模型'
|
||||||
|
}}),刷新页面不会重复提交,请等待当前任务完成。
|
||||||
|
</NAlert>
|
||||||
|
<NAlert v-else-if="latestIdentityFailure" type="error" :show-icon="false" class="mb-4 text-xs">
|
||||||
|
最近一次身份图片生成失败:{{
|
||||||
|
latestIdentityFailure.error || '未返回具体错误'
|
||||||
|
}}。可以调整模型参数后重新生成。
|
||||||
|
</NAlert>
|
||||||
|
<StableAnchorQualityDialog
|
||||||
|
v-if="
|
||||||
|
subject &&
|
||||||
|
(subject.module === 'scene' || subject.module === 'prop') &&
|
||||||
|
profileQuery.data.value?.profile &&
|
||||||
|
generationModelsQuery.data.value
|
||||||
|
"
|
||||||
|
v-model:open="qualityOpen"
|
||||||
|
:subject-id="subject.id"
|
||||||
|
:subject-name="subject.name"
|
||||||
|
:catalog="generationModelsQuery.data.value"
|
||||||
|
:profile="profileQuery.data.value.profile"
|
||||||
|
:disabled="!canGenerateImage"
|
||||||
|
@generate="generateStableAnchorQuality" />
|
||||||
<IdentityImageDialog
|
<IdentityImageDialog
|
||||||
v-if="subject"
|
v-if="subject && profileQuery.data.value?.profile && generationModelsQuery.data.value"
|
||||||
v-model:open="imageOpen"
|
v-model:open="imageOpen"
|
||||||
:subject-id="subject.id"
|
:subject-id="subject.id"
|
||||||
:subject-name="subject.name"
|
:subject-name="subject.name"
|
||||||
:module="subject.module"
|
:module="subject.module"
|
||||||
:images="images"
|
:images="images"
|
||||||
|
:catalog="generationModelsQuery.data.value"
|
||||||
|
:profile="profileQuery.data.value.profile"
|
||||||
:disabled="!canGenerateImage"
|
:disabled="!canGenerateImage"
|
||||||
@generate="generateImage" />
|
@generate="submitIdentityImage" />
|
||||||
<CastingCandidateDialog
|
<CastingCandidateDialog
|
||||||
v-if="subject?.module === 'character'"
|
v-if="
|
||||||
|
subject?.module === 'character' && profileQuery.data.value?.profile && generationModelsQuery.data.value
|
||||||
|
"
|
||||||
v-model:open="castingOpen"
|
v-model:open="castingOpen"
|
||||||
:subject-id="subject.id"
|
:subject-id="subject.id"
|
||||||
:subject-name="subject.name"
|
:subject-name="subject.name"
|
||||||
|
:catalog="generationModelsQuery.data.value"
|
||||||
|
:profile="profileQuery.data.value.profile"
|
||||||
:disabled="!canGenerateCandidate"
|
:disabled="!canGenerateCandidate"
|
||||||
@generate="generateCastingCandidate"
|
@generate="submitCastingCandidate"
|
||||||
/></WorkspacePage>
|
/></WorkspacePage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -848,7 +867,7 @@ watch(
|
|||||||
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
||||||
@reference "../../styles/styles.css";
|
@reference "../../styles/styles.css";
|
||||||
.identity-workspace {
|
.identity-workspace {
|
||||||
@apply grid grid-cols-[240px_minmax(0,_1fr)] items-start gap-5;
|
@apply grid grid-cols-[240px_minmax(0,_1fr)] items-start gap-3;
|
||||||
}
|
}
|
||||||
.identity-subject-list {
|
.identity-subject-list {
|
||||||
@apply max-h-[560px] overflow-hidden;
|
@apply max-h-[560px] overflow-hidden;
|
||||||
@@ -952,7 +971,7 @@ watch(
|
|||||||
@apply max-h-none min-h-0 flex-1;
|
@apply max-h-none min-h-0 flex-1;
|
||||||
}
|
}
|
||||||
.directory-filters {
|
.directory-filters {
|
||||||
@apply grid gap-2.5 pt-0 px-3 pb-3 shrink-0;
|
@apply grid gap-3 p-3 shrink-0;
|
||||||
}
|
}
|
||||||
.directory-filters > * {
|
.directory-filters > * {
|
||||||
@apply min-w-0;
|
@apply min-w-0;
|
||||||
@@ -1010,7 +1029,7 @@ watch(
|
|||||||
@apply items-start flex-col;
|
@apply items-start flex-col;
|
||||||
}
|
}
|
||||||
.identity-workspace {
|
.identity-workspace {
|
||||||
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[auto_minmax(0,_1fr)] gap-2.5;
|
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[auto_minmax(0,_1fr)] gap-3;
|
||||||
}
|
}
|
||||||
.identity-directory {
|
.identity-directory {
|
||||||
@apply h-auto;
|
@apply h-auto;
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import { request } from '../../lib/http'
|
import { request } from '../../lib/http'
|
||||||
import type {
|
import type {
|
||||||
|
IdentityImagePreview,
|
||||||
|
IdentityValidationResult,
|
||||||
|
StableAnchorQualityInput,
|
||||||
|
StableAnchorQualityResult,
|
||||||
CastingBatchResult,
|
CastingBatchResult,
|
||||||
CharacterCastingReadiness,
|
CharacterCastingReadiness,
|
||||||
ConfirmCastingResult,
|
ConfirmCastingResult,
|
||||||
@@ -71,10 +75,54 @@ export const subjectIdentityApi = {
|
|||||||
request<IdentityImage[]>(`${identityPath(subjectId)}/images`, { signal }),
|
request<IdentityImage[]>(`${identityPath(subjectId)}/images`, { signal }),
|
||||||
generateImage: (subjectId: string, input: GenerateIdentityImageInput) =>
|
generateImage: (subjectId: string, input: GenerateIdentityImageInput) =>
|
||||||
request<IdentityImage>(`${identityPath(subjectId)}/images`, { method: 'POST', body: input, timeoutMs: 0 }),
|
request<IdentityImage>(`${identityPath(subjectId)}/images`, { method: 'POST', body: input, timeoutMs: 0 }),
|
||||||
|
/**
|
||||||
|
* 读取与实际生图同源的输入预览,道具可能执行已确认的结构模型编译。
|
||||||
|
* @param subjectId 正式主体 ID
|
||||||
|
* @param input 与实际生图相同的参数
|
||||||
|
* @param signal 只读预览取消信号,可能付费的道具不传
|
||||||
|
* @returns 后端真实输入与最终参数
|
||||||
|
*/
|
||||||
|
previewImage: (subjectId: string, input: GenerateIdentityImageInput, signal?: AbortSignal) =>
|
||||||
|
request<IdentityImagePreview>(`${identityPath(subjectId)}/images/preview`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: input,
|
||||||
|
signal,
|
||||||
|
timeoutMs: 0
|
||||||
|
}),
|
||||||
|
/**
|
||||||
|
* 明确确认后对指定身份图片执行视觉校验。
|
||||||
|
* @param subjectId 正式主体 ID
|
||||||
|
* @param imageId 此主体的正式图片 ID
|
||||||
|
* @returns 真实视觉校验回执
|
||||||
|
*/
|
||||||
|
validateImage: (subjectId: string, imageId: string) =>
|
||||||
|
request<IdentityValidationResult>(`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}/validate`, {
|
||||||
|
method: 'POST',
|
||||||
|
timeoutMs: 0
|
||||||
|
}),
|
||||||
|
/**
|
||||||
|
* 为单个场景或道具执行有限预算的稳定母版质量闭环。
|
||||||
|
* @param subjectId 正式主体 ID
|
||||||
|
* @param input 已确认的模型与修复预算
|
||||||
|
* @returns 候选、各轮质量和实际母版确认回执
|
||||||
|
*/
|
||||||
|
generateStableAnchorQuality: (subjectId: string, input: StableAnchorQualityInput) =>
|
||||||
|
request<StableAnchorQualityResult>(`${identityPath(subjectId)}/stable-anchor/generate-quality`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: input,
|
||||||
|
timeoutMs: 0
|
||||||
|
}),
|
||||||
setAnchor: (subjectId: string, imageId: string) =>
|
setAnchor: (subjectId: string, imageId: string) =>
|
||||||
request<IdentityImage>(`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}/anchor`, {
|
request<IdentityImage>(`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}/anchor`, {
|
||||||
method: 'PUT'
|
method: 'PUT'
|
||||||
}),
|
}),
|
||||||
|
confirmStableAnchor: (subjectId: string, imageId: string) =>
|
||||||
|
request<ConfirmCastingResult>(
|
||||||
|
`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}/stable-anchor`,
|
||||||
|
{
|
||||||
|
method: 'PUT'
|
||||||
|
}
|
||||||
|
),
|
||||||
confirmCasting: (subjectId: string, imageId: string) =>
|
confirmCasting: (subjectId: string, imageId: string) =>
|
||||||
request<ConfirmCastingResult>(`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}/casting`, {
|
request<ConfirmCastingResult>(`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}/casting`, {
|
||||||
method: 'PUT'
|
method: 'PUT'
|
||||||
|
|||||||
@@ -1,54 +1,73 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import AppForm from '../../../components/ui/AppForm.vue'
|
import { NAlert, NButton, NCheckbox, NFormItem, NInput } from 'naive-ui'
|
||||||
import { NFormItem } from 'naive-ui'
|
|
||||||
import { sizeRules } from '../../../lib/form-rules'
|
|
||||||
import { NAlert, NButton, NCheckbox, NInput, NInputNumber } from 'naive-ui'
|
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { AppDialog } from '../../../components/ui'
|
import { AppDialog } from '../../../components/ui'
|
||||||
import { validImageSize } from '../../subject-images/model'
|
import AppForm from '../../../components/ui/AppForm.vue'
|
||||||
|
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||||||
|
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
|
||||||
import type { GenerateCastingCandidateInput } from '../types'
|
import type { GenerateCastingCandidateInput } from '../types'
|
||||||
|
|
||||||
/** Character 选角候选表单固定使用 primary,每次独立生成且不会自动选择演员。 */
|
/** Character 选角候选表单固定使用 primary,每次独立生成且不会自动选择演员。 */
|
||||||
const props = defineProps<{ subjectId: string; subjectName: string; disabled: boolean }>()
|
const props = defineProps<{
|
||||||
|
subjectId: string
|
||||||
|
subjectName: string
|
||||||
|
disabled: boolean
|
||||||
|
catalog: GenerationModelCatalog
|
||||||
|
profile: CreativeProfile
|
||||||
|
}>()
|
||||||
const open = defineModel<boolean>('open', { default: false })
|
const open = defineModel<boolean>('open', { default: false })
|
||||||
const emit = defineEmits<{ generate: [input: GenerateCastingCandidateInput] }>()
|
const emit = defineEmits<{ generate: [input: GenerateCastingCandidateInput] }>()
|
||||||
|
const formRef = ref<InstanceType<typeof AppForm> | null>(null)
|
||||||
const prompt = ref('')
|
const prompt = ref('')
|
||||||
const width = ref<number | ''>('')
|
const provider = ref('')
|
||||||
const height = ref<number | ''>('')
|
const generationOptions = ref<GenerationOptions>({})
|
||||||
const acknowledged = ref(false)
|
const acknowledged = ref(false)
|
||||||
const valid = computed(() => validImageSize(width.value, height.value))
|
const valid = computed(() => Boolean(provider.value))
|
||||||
|
|
||||||
/** 每次切换角色或重新打开都清空自定义覆盖与费用确认。 */
|
/** 每次切换角色或重新打开都恢复项目当前图片模型与参数。 */
|
||||||
function reset() {
|
function reset() {
|
||||||
prompt.value = ''
|
prompt.value = ''
|
||||||
width.value = ''
|
provider.value = props.profile.imageProvider
|
||||||
height.value = ''
|
const selected =
|
||||||
|
props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
|
||||||
|
props.catalog.images.find(item => item.enabled)
|
||||||
|
provider.value = selected?.provider ?? ''
|
||||||
|
generationOptions.value = {
|
||||||
|
...selected?.defaults,
|
||||||
|
...(selected?.provider === props.profile.imageProvider ? props.profile.imageOptions : {})
|
||||||
|
}
|
||||||
|
const sizeSchema = selected?.generationOptions.find(item => item.key === 'size')
|
||||||
|
if (
|
||||||
|
sizeSchema?.options?.length &&
|
||||||
|
!sizeSchema.options.some(option => option.value === generationOptions.value.size)
|
||||||
|
) {
|
||||||
|
generationOptions.value.size = selected?.defaults.size ?? sizeSchema.options[0]?.value ?? ''
|
||||||
|
}
|
||||||
acknowledged.value = false
|
acknowledged.value = false
|
||||||
}
|
}
|
||||||
watch([() => props.subjectId, open], reset)
|
watch([() => props.subjectId, open, () => props.profile], reset, { immediate: true })
|
||||||
|
|
||||||
/** 只发送选角候选接口接受的字段,不携带普通身份图视角参数。 */
|
/** 候选生成显式携带当前图片 Provider 与动态参数,避免 Seedream 尺寸污染 Qwen。 */
|
||||||
function submit() {
|
function submit() {
|
||||||
if (props.disabled || !valid.value || !acknowledged.value) return
|
if (props.disabled || !valid.value || !acknowledged.value) return
|
||||||
emit('generate', {
|
emit('generate', {
|
||||||
...(prompt.value.trim() ? { prompt: prompt.value.trim() } : {}),
|
...(prompt.value.trim() ? { prompt: prompt.value.trim() } : {}),
|
||||||
...(width.value !== '' && height.value !== '' ? { width: width.value, height: height.value } : {})
|
provider: provider.value,
|
||||||
|
generationOptions: generationOptions.value
|
||||||
})
|
})
|
||||||
open.value = false
|
|
||||||
}
|
}
|
||||||
const formModel = computed(() => ({ width: width.value, height: height.value, prompt: prompt.value }))
|
const formModel = computed(() => ({ prompt: prompt.value }))
|
||||||
const rules = { ...sizeRules(() => formModel.value) }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AppDialog v-model:open="open" title="生成角色选角候选" :description="`${subjectName} · 候选不会自动成为身份母版`">
|
<AppDialog v-model:open="open" title="生成角色选角候选" :description="`${subjectName} · 候选不会自动成为身份母版`">
|
||||||
<AppForm
|
<AppForm
|
||||||
|
ref="formRef"
|
||||||
:model="formModel"
|
:model="formModel"
|
||||||
:rules="rules"
|
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:reset-key="`${open}:${subjectId}`"
|
:reset-key="`${open}:${subjectId}`"
|
||||||
validate-on-change
|
validate-on-change
|
||||||
class="mt-5 space-y-4"
|
class="dialog-form-stack"
|
||||||
@submit="submit"
|
@submit="submit"
|
||||||
>
|
>
|
||||||
<NAlert type="info" :show-icon="false" class="text-xs">
|
<NAlert type="info" :show-icon="false" class="text-xs">
|
||||||
@@ -73,38 +92,33 @@ const rules = { ...sizeRules(() => formModel.value) }
|
|||||||
<p v-if="prompt.trim()" class="text-xs text-danger">
|
<p v-if="prompt.trim()" class="text-xs text-danger">
|
||||||
自定义文本会替换后端完整提示词,请自行包含人物身份、基础服装和中性参考图要求。
|
自定义文本会替换后端完整提示词,请自行包含人物身份、基础服装和中性参考图要求。
|
||||||
</p>
|
</p>
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<GenerationModelControls
|
||||||
<NFormItem path="width" label="宽度(px)"
|
type="image"
|
||||||
><NInputNumber
|
:catalog="catalog"
|
||||||
:input-props="{ 'aria-label': '宽度(px)' }"
|
:provider="provider"
|
||||||
placeholder="后端默认"
|
:options="generationOptions"
|
||||||
:value="typeof width === 'number' ? width : null"
|
:aspect-ratio="profile.aspectRatio"
|
||||||
@update:value="width = $event ?? ''"
|
:disabled="disabled"
|
||||||
:min="1"
|
@update:provider="provider = $event"
|
||||||
></NInputNumber
|
@update:options="generationOptions = $event"
|
||||||
></NFormItem>
|
/>
|
||||||
<NFormItem path="height" label="高度(px)"
|
|
||||||
><NInputNumber
|
|
||||||
:input-props="{ 'aria-label': '高度(px)' }"
|
|
||||||
placeholder="后端默认"
|
|
||||||
:value="typeof height === 'number' ? height : null"
|
|
||||||
@update:value="height = $event ?? ''"
|
|
||||||
:min="1"
|
|
||||||
></NInputNumber
|
|
||||||
></NFormItem>
|
|
||||||
</div>
|
|
||||||
<NCheckbox
|
<NCheckbox
|
||||||
id="casting-candidate-cost"
|
id="casting-candidate-cost"
|
||||||
v-model:checked="acknowledged"
|
v-model:checked="acknowledged"
|
||||||
class="flex items-start gap-2 text-xs leading-6"
|
class="flex items-start gap-2 text-xs leading-6"
|
||||||
>我已确认调用图片模型可能产生费用,且当前没有同项目生成任务。
|
>我已确认调用图片模型可能产生费用,且当前没有同项目生成任务。
|
||||||
</NCheckbox>
|
</NCheckbox>
|
||||||
<div class="dialog-footer">
|
|
||||||
<NButton @click="open = false">取消</NButton>
|
|
||||||
<NButton :disabled="disabled || !valid || !acknowledged" type="primary" attr-type="submit">
|
|
||||||
确认生成候选
|
|
||||||
</NButton>
|
|
||||||
</div>
|
|
||||||
</AppForm>
|
</AppForm>
|
||||||
|
<template #footer>
|
||||||
|
<NButton @click="open = false">取消</NButton>
|
||||||
|
<NButton
|
||||||
|
:disabled="disabled || !valid || !acknowledged"
|
||||||
|
:loading="disabled"
|
||||||
|
type="primary"
|
||||||
|
@click="formRef?.validate(submit)"
|
||||||
|
>
|
||||||
|
{{ disabled ? '生成中…' : '确认生成候选' }}
|
||||||
|
</NButton>
|
||||||
|
</template>
|
||||||
</AppDialog>
|
</AppDialog>
|
||||||
</template>
|
</template>
|
||||||
@@ -69,8 +69,11 @@ function save() {
|
|||||||
>{{ module === 'character' ? '锁定演员身份' : '锁定身份' }}</NCheckbox
|
>{{ module === 'character' ? '锁定演员身份' : '锁定身份' }}</NCheckbox
|
||||||
>
|
>
|
||||||
<div class="page-form-actions">
|
<div class="page-form-actions">
|
||||||
<NButton :disabled="disabled" type="primary" attr-type="submit">保存主体身份</NButton>
|
<NButton :disabled="disabled || !dirty" type="primary" attr-type="submit">{{
|
||||||
|
dirty ? '保存主体身份' : '已保存'
|
||||||
|
}}</NButton>
|
||||||
<span v-if="dirty" class="text-xs text-muted">有未保存修改</span>
|
<span v-if="dirty" class="text-xs text-muted">有未保存修改</span>
|
||||||
|
<span v-else class="text-xs text-muted">当前内容已保存到项目</span>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</AppForm>
|
</AppForm>
|
||||||
|
|||||||
@@ -1,28 +1,38 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import ConfirmAction from '../../workflows/ConfirmAction.vue'
|
||||||
import { NScrollbar, NAlert, NButton, NTag } from 'naive-ui'
|
import { NScrollbar, NAlert, NButton, NTag } from 'naive-ui'
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { AssetImage, StatusBadge } from '../../../components/ui'
|
import { AssetImage, StatusBadge } from '../../../components/ui'
|
||||||
import { referenceImageUrl } from '../../../lib/assets'
|
import { referenceImageUrl } from '../../../lib/assets'
|
||||||
import { formatDate } from '../../../lib/format'
|
import { formatDate } from '../../../lib/format'
|
||||||
import { canBeAnchor, currentAnchor, identityViewLabels } from '../model'
|
import { canBeAnchor, currentAnchor, identityViewLabels } from '../model'
|
||||||
import type { IdentityImage } from '../types'
|
import type { IdentityImage, IdentityValidationResult } from '../types'
|
||||||
|
|
||||||
/** 身份图库区分权威母版、primary 候选和辅助视图,保留后端原始状态。 */
|
/** 身份图库区分权威母版、primary 候选和辅助视图,保留后端原始状态。 */
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
/** 指定图片本次校验回执。 */
|
||||||
|
validationResult?: IdentityValidationResult | null
|
||||||
images: IdentityImage[]
|
images: IdentityImage[]
|
||||||
subjectName: string
|
subjectName: string
|
||||||
module: string
|
module: string
|
||||||
identityLocked: boolean
|
identityLocked: boolean
|
||||||
disabled: boolean
|
disabled: boolean
|
||||||
}>()
|
}>()
|
||||||
const emit = defineEmits<{ anchor: [imageId: string] }>()
|
/** 用户确认的图片操作。 */
|
||||||
|
const emit = defineEmits<{ anchor: [imageId: string]; validate: [imageId: string] }>()
|
||||||
|
/** selectedId 的当前界面状态与输入绑定。 */
|
||||||
const selectedId = ref('')
|
const selectedId = ref('')
|
||||||
|
/** confirming 的当前界面状态与输入绑定。 */
|
||||||
const confirming = ref(false)
|
const confirming = ref(false)
|
||||||
|
/** anchor 的当前界面状态与输入绑定。 */
|
||||||
const anchor = computed(() => currentAnchor(props.images))
|
const anchor = computed(() => currentAnchor(props.images))
|
||||||
|
/** selected 的当前界面状态与输入绑定。 */
|
||||||
const selected = computed(
|
const selected = computed(
|
||||||
() => props.images.find(image => image.id === selectedId.value) ?? anchor.value ?? props.images[0]
|
() => props.images.find(image => image.id === selectedId.value) ?? anchor.value ?? props.images[0]
|
||||||
)
|
)
|
||||||
|
/** character 的当前界面状态与输入绑定。 */
|
||||||
const character = computed(() => props.module === 'character')
|
const character = computed(() => props.module === 'character')
|
||||||
|
/** canSelect 的当前界面状态与输入绑定。 */
|
||||||
const canSelect = computed(
|
const canSelect = computed(
|
||||||
() =>
|
() =>
|
||||||
!props.disabled &&
|
!props.disabled &&
|
||||||
@@ -30,7 +40,9 @@ const canSelect = computed(
|
|||||||
canBeAnchor(selected.value) &&
|
canBeAnchor(selected.value) &&
|
||||||
(!selected.value.isAnchor || (character.value && !props.identityLocked))
|
(!selected.value.isAnchor || (character.value && !props.identityLocked))
|
||||||
)
|
)
|
||||||
|
/** imageUrl 的当前界面状态与输入绑定。 */
|
||||||
const imageUrl = computed(() => referenceImageUrl(selected.value?.imageUrl ?? ''))
|
const imageUrl = computed(() => referenceImageUrl(selected.value?.imageUrl ?? ''))
|
||||||
|
/** 监听界面目标变化并重置关联确认状态。 */
|
||||||
watch(
|
watch(
|
||||||
() => selected.value?.id,
|
() => selected.value?.id,
|
||||||
() => {
|
() => {
|
||||||
@@ -133,6 +145,25 @@ function chooseAnchor() {
|
|||||||
>{{ selected.provider }} · {{ selected.model }} · {{ formatDate(selected.createdAt) }}</span
|
>{{ selected.provider }} · {{ selected.model }} · {{ formatDate(selected.createdAt) }}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 以下是指定身份图片质量校验模块 -->
|
||||||
|
<ConfirmAction
|
||||||
|
:key="selected.id"
|
||||||
|
label="校验此身份图片"
|
||||||
|
:description="`将校验图片 ${selected.id},会调用视觉模型并可能产生费用,不会切换母版。`"
|
||||||
|
:disabled="disabled || selected.status !== 'completed' || !selected.imageUrl"
|
||||||
|
acknowledgement
|
||||||
|
@confirm="emit('validate', selected.id)"
|
||||||
|
/>
|
||||||
|
<NAlert
|
||||||
|
v-if="validationResult?.imageId === selected.id"
|
||||||
|
:type="validationResult.passed ? 'success' : 'warning'"
|
||||||
|
class="mt-3"
|
||||||
|
>
|
||||||
|
<p>{{ validationResult.passed ? '本次校验通过' : '本次校验未通过' }}:{{ validationResult.summary }}</p>
|
||||||
|
<p v-for="(issue, index) in validationResult.issues" :key="index">
|
||||||
|
{{ issue.severity }} · {{ issue.type }}:{{ issue.description }}
|
||||||
|
</p>
|
||||||
|
</NAlert>
|
||||||
<p v-if="selected.viewType !== 'primary'" class="mt-2 text-xs text-muted">
|
<p v-if="selected.viewType !== 'primary'" class="mt-2 text-xs text-muted">
|
||||||
辅助视图不能直接设为母版;它会继承当前身份母版,不适合用来更换演员。
|
辅助视图不能直接设为母版;它会继承当前身份母版,不适合用来更换演员。
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import ConfirmAction from '../../workflows/ConfirmAction.vue'
|
||||||
|
import { getOperation, runOperation } from '../../workflows/operations'
|
||||||
import AppForm from '../../../components/ui/AppForm.vue'
|
import AppForm from '../../../components/ui/AppForm.vue'
|
||||||
import { NFormItem } from 'naive-ui'
|
import { NFormItem } from 'naive-ui'
|
||||||
import { sizeRules, fieldRule } from '../../../lib/form-rules'
|
import { fieldRule } from '../../../lib/form-rules'
|
||||||
import { NAlert, NButton, NCheckbox, NInput, NInputNumber, NSelect } from 'naive-ui'
|
import { NAlert, NButton, NCheckbox, NInput, NSelect } from 'naive-ui'
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, onBeforeUnmount, ref, watch } from 'vue'
|
||||||
import { AppDialog } from '../../../components/ui'
|
import { AppDialog, FieldLabel } from '../../../components/ui'
|
||||||
import { validImageSize } from '../../subject-images/model'
|
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||||||
|
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
|
||||||
|
import { subjectIdentityApi } from '../api'
|
||||||
|
import type { IdentityImagePreview } from '../types'
|
||||||
import { currentAnchor, identityViewLabels } from '../model'
|
import { currentAnchor, identityViewLabels } from '../model'
|
||||||
import type { GenerateIdentityImageInput, IdentityImage, IdentityViewType } from '../types'
|
import type { GenerateIdentityImageInput, IdentityImage, IdentityViewType } from '../types'
|
||||||
|
|
||||||
@@ -16,59 +21,146 @@ const props = defineProps<{
|
|||||||
module?: string
|
module?: string
|
||||||
images: IdentityImage[]
|
images: IdentityImage[]
|
||||||
disabled: boolean
|
disabled: boolean
|
||||||
|
catalog: GenerationModelCatalog
|
||||||
|
profile: CreativeProfile
|
||||||
}>()
|
}>()
|
||||||
|
/** open 的当前界面状态与输入绑定。 */
|
||||||
const open = defineModel<boolean>('open', { default: false })
|
const open = defineModel<boolean>('open', { default: false })
|
||||||
|
/** emit 的当前界面状态与输入绑定。 */
|
||||||
const emit = defineEmits<{ generate: [input: GenerateIdentityImageInput] }>()
|
const emit = defineEmits<{ generate: [input: GenerateIdentityImageInput] }>()
|
||||||
|
const formRef = ref<InstanceType<typeof AppForm> | null>(null)
|
||||||
const viewType = ref<IdentityViewType>('primary')
|
const viewType = ref<IdentityViewType>('primary')
|
||||||
|
/** referenceImageId 的当前界面状态与输入绑定。 */
|
||||||
const referenceImageId = ref('')
|
const referenceImageId = ref('')
|
||||||
|
/** prompt 的当前界面状态与输入绑定。 */
|
||||||
const prompt = ref('')
|
const prompt = ref('')
|
||||||
const width = ref<number | ''>('')
|
/** provider 的当前界面状态与输入绑定。 */
|
||||||
const height = ref<number | ''>('')
|
const provider = ref('')
|
||||||
|
const generationOptions = ref<GenerationOptions>({})
|
||||||
|
/** acknowledged 的当前界面状态与输入绑定。 */
|
||||||
const acknowledged = ref(false)
|
const acknowledged = ref(false)
|
||||||
|
/** anchor 的当前界面状态与输入绑定。 */
|
||||||
const anchor = computed(() => currentAnchor(props.images))
|
const anchor = computed(() => currentAnchor(props.images))
|
||||||
|
/** allowedViews 的当前界面状态与输入绑定。 */
|
||||||
const allowedViews = computed(() =>
|
const allowedViews = computed(() =>
|
||||||
Object.entries(identityViewLabels).filter(([value]) => props.module !== 'character' || value !== 'primary')
|
props.module === 'character'
|
||||||
|
? Object.entries(identityViewLabels).filter(([value]) => value !== 'primary')
|
||||||
|
: [['primary', identityViewLabels.primary]]
|
||||||
)
|
)
|
||||||
|
/** references 的当前界面状态与输入绑定。 */
|
||||||
const references = computed(() => props.images.filter(image => image.status === 'completed' && image.imageUrl))
|
const references = computed(() => props.images.filter(image => image.status === 'completed' && image.imageUrl))
|
||||||
|
/** valid 的当前界面状态与输入绑定。 */
|
||||||
const valid = computed(
|
const valid = computed(
|
||||||
() =>
|
() =>
|
||||||
validImageSize(width.value, height.value) &&
|
Boolean(provider.value) &&
|
||||||
(!referenceImageId.value || references.value.some(image => image.id === referenceImageId.value))
|
(!referenceImageId.value || references.value.some(image => image.id === referenceImageId.value))
|
||||||
)
|
)
|
||||||
|
/** 监听界面目标变化并重置关联确认状态。 */
|
||||||
watch(
|
watch(
|
||||||
() => [open.value, props.subjectId],
|
() => [open.value, props.subjectId],
|
||||||
() => {
|
() => {
|
||||||
viewType.value = props.module === 'character' ? 'front' : 'primary'
|
viewType.value = props.module === 'character' ? 'front' : 'primary'
|
||||||
referenceImageId.value = ''
|
referenceImageId.value = ''
|
||||||
prompt.value = ''
|
prompt.value = ''
|
||||||
width.value = ''
|
const selected =
|
||||||
height.value = ''
|
props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
|
||||||
|
props.catalog.images.find(item => item.enabled)
|
||||||
|
provider.value = selected?.provider ?? ''
|
||||||
|
generationOptions.value = {
|
||||||
|
...selected?.defaults,
|
||||||
|
...(selected?.provider === props.profile.imageProvider ? props.profile.imageOptions : {})
|
||||||
|
}
|
||||||
|
const sizeSchema = selected?.generationOptions.find(item => item.key === 'size')
|
||||||
|
if (
|
||||||
|
sizeSchema?.options?.length &&
|
||||||
|
!sizeSchema.options.some(option => option.value === generationOptions.value.size)
|
||||||
|
) {
|
||||||
|
generationOptions.value.size = selected?.defaults.size ?? sizeSchema.options[0]?.value ?? ''
|
||||||
|
}
|
||||||
acknowledged.value = false
|
acknowledged.value = false
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/** 预览与正式生图共享的最终请求参数。 */
|
||||||
|
const generationInput = computed<GenerateIdentityImageInput>(() => ({
|
||||||
|
viewType: props.module === 'character' ? viewType.value : 'primary',
|
||||||
|
...(referenceImageId.value ? { referenceImageId: referenceImageId.value } : {}),
|
||||||
|
...(prompt.value.trim() ? { prompt: prompt.value.trim() } : {}),
|
||||||
|
provider: provider.value,
|
||||||
|
generationOptions: { ...generationOptions.value }
|
||||||
|
}))
|
||||||
|
/** 当前参数的预览结果。 */
|
||||||
|
const preview = ref<IdentityImagePreview | null>(null)
|
||||||
|
/** 预览读取状态。 */
|
||||||
|
const previewLoading = ref(false)
|
||||||
|
/** 道具预览可能付费,保持项目锁直到真实请求结束,不能因关闭弹窗提前释放。 */
|
||||||
|
const paidPreviewPending = ref(false)
|
||||||
|
/** 预览读取错误。 */
|
||||||
|
const previewError = ref('')
|
||||||
|
/** 用于取消迟到预览的请求控制器。 */
|
||||||
|
let previewController: AbortController | undefined
|
||||||
|
/** 参数、主体或弹窗变化时清除旧结果和费用确认。 */
|
||||||
|
/** 监听界面目标变化并重置关联确认状态。 */
|
||||||
|
watch(
|
||||||
|
() => [props.subjectId, open.value, JSON.stringify(generationInput.value), JSON.stringify(props.images)],
|
||||||
|
() => {
|
||||||
|
previewController?.abort()
|
||||||
|
preview.value = null
|
||||||
|
previewError.value = ''
|
||||||
|
previewLoading.value = false
|
||||||
|
acknowledged.value = false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
/** 卸载时取消未完成的只读请求。 */
|
||||||
|
onBeforeUnmount(() => previewController?.abort())
|
||||||
|
/** 读取当前参数的真实预览;道具后端可能编译结构模型,禁止当作免费读取。 */
|
||||||
|
async function loadPreview() {
|
||||||
|
if (props.disabled || !valid.value || previewLoading.value || paidPreviewPending.value) return
|
||||||
|
previewController?.abort()
|
||||||
|
const controller = new AbortController()
|
||||||
|
previewController = controller
|
||||||
|
const subjectId = props.subjectId
|
||||||
|
const projectId = props.profile.projectId
|
||||||
|
const paid = props.module === 'prop'
|
||||||
|
const input = { ...generationInput.value, generationOptions: { ...generationInput.value.generationOptions } }
|
||||||
|
previewLoading.value = true
|
||||||
|
previewError.value = ''
|
||||||
|
paidPreviewPending.value = paid
|
||||||
|
/** 道具请求不传取消信号,取消客户端展示不能取消后端结构模型的工作。 */
|
||||||
|
const inspect = async () => {
|
||||||
|
const result = await subjectIdentityApi.previewImage(subjectId, input, paid ? undefined : controller.signal)
|
||||||
|
if (!controller.signal.aborted && previewController === controller && subjectId === props.subjectId)
|
||||||
|
preview.value = result
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (paid) {
|
||||||
|
const ok = await runOperation(projectId, '预览道具结构输入', inspect)
|
||||||
|
if (!ok && !controller.signal.aborted && subjectId === props.subjectId)
|
||||||
|
previewError.value = getOperation(projectId).error
|
||||||
|
} else await inspect()
|
||||||
|
} catch (error) {
|
||||||
|
if (!controller.signal.aborted)
|
||||||
|
previewError.value = error instanceof Error ? error.message : '身份输入预览读取失败'
|
||||||
|
} finally {
|
||||||
|
paidPreviewPending.value = false
|
||||||
|
if (previewController === controller) previewLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 提交生图参数;省略空参考 ID 以保留后端自动选择逻辑。 */
|
/** 提交生图参数;省略空参考 ID 以保留后端自动选择逻辑。 */
|
||||||
function submit() {
|
function submit() {
|
||||||
if (props.disabled || !valid.value || !acknowledged.value) return
|
if (props.disabled || paidPreviewPending.value || !valid.value || !acknowledged.value) return
|
||||||
emit('generate', {
|
emit('generate', generationInput.value)
|
||||||
viewType: viewType.value,
|
|
||||||
...(referenceImageId.value ? { referenceImageId: referenceImageId.value } : {}),
|
|
||||||
...(prompt.value.trim() ? { prompt: prompt.value.trim() } : {}),
|
|
||||||
...(width.value !== '' && height.value !== '' ? { width: width.value, height: height.value } : {})
|
|
||||||
})
|
|
||||||
open.value = false
|
|
||||||
}
|
}
|
||||||
|
/** formModel 的当前界面状态与输入绑定。 */
|
||||||
const formModel = computed(() => ({
|
const formModel = computed(() => ({
|
||||||
width: width.value,
|
|
||||||
height: height.value,
|
|
||||||
prompt: prompt.value,
|
prompt: prompt.value,
|
||||||
viewType: viewType.value,
|
viewType: viewType.value,
|
||||||
referenceImageId: referenceImageId.value,
|
referenceImageId: referenceImageId.value,
|
||||||
availableReferenceIds: references.value.map(image => image.id)
|
availableReferenceIds: references.value.map(image => image.id)
|
||||||
}))
|
}))
|
||||||
const rules = {
|
const rules = {
|
||||||
...sizeRules(() => formModel.value),
|
|
||||||
referenceImageId: fieldRule(
|
referenceImageId: fieldRule(
|
||||||
value => !value || references.value.some(image => image.id === value),
|
value => !value || references.value.some(image => image.id === value),
|
||||||
'请选择此主体当前可用的参考图'
|
'请选择此主体当前可用的参考图'
|
||||||
@@ -77,14 +169,15 @@ const rules = {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AppDialog v-model:open="open" title="生成身份参考图" :description="subjectName">
|
<AppDialog v-model:open="open" title="生成身份参考图" :description="subjectName" :busy="paidPreviewPending">
|
||||||
<AppForm
|
<AppForm
|
||||||
|
ref="formRef"
|
||||||
:model="formModel"
|
:model="formModel"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:reset-key="`${open}:${subjectId}`"
|
:reset-key="`${open}:${subjectId}`"
|
||||||
validate-on-change
|
validate-on-change
|
||||||
class="mt-5 space-y-4"
|
class="dialog-form-stack"
|
||||||
@submit="submit"
|
@submit="submit"
|
||||||
>
|
>
|
||||||
<NAlert type="info" :show-icon="false" class="text-xs">
|
<NAlert type="info" :show-icon="false" class="text-xs">
|
||||||
@@ -104,7 +197,14 @@ const rules = {
|
|||||||
path="referenceImageId"
|
path="referenceImageId"
|
||||||
label="身份锚定来源"
|
label="身份锚定来源"
|
||||||
:label-props="{ for: 'identity-reference' }"
|
:label-props="{ for: 'identity-reference' }"
|
||||||
><NSelect
|
>
|
||||||
|
<template #label>
|
||||||
|
<FieldLabel
|
||||||
|
label="身份锚定来源"
|
||||||
|
description="只能选择此主体已完成的图片。后端需取得图片服务可访问的远程地址;本地预览可见不保证远程地址仍有效。"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<NSelect
|
||||||
id="identity-reference"
|
id="identity-reference"
|
||||||
v-model:value="referenceImageId"
|
v-model:value="referenceImageId"
|
||||||
:options="[
|
:options="[
|
||||||
@@ -120,9 +220,6 @@ const rules = {
|
|||||||
class="select-control"
|
class="select-control"
|
||||||
></NSelect
|
></NSelect
|
||||||
></NFormItem>
|
></NFormItem>
|
||||||
<p class="text-xs leading-6 text-muted">
|
|
||||||
只能选择此主体已完成的图片。后端需取得 Provider 可访问的远程地址;本地预览可见不保证远程地址仍有效。
|
|
||||||
</p>
|
|
||||||
<NFormItem
|
<NFormItem
|
||||||
class="block"
|
class="block"
|
||||||
path="prompt"
|
path="prompt"
|
||||||
@@ -140,26 +237,43 @@ const rules = {
|
|||||||
<p v-if="prompt.trim()" class="text-xs text-danger">
|
<p v-if="prompt.trim()" class="text-xs text-danger">
|
||||||
自定义文本会替换后端编译的完整提示词,请自行包含身份约束和视角要求。
|
自定义文本会替换后端编译的完整提示词,请自行包含身份约束和视角要求。
|
||||||
</p>
|
</p>
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<GenerationModelControls
|
||||||
<NFormItem path="width" label="宽度(px)" :label-props="{ for: 'identity-width' }"
|
type="image"
|
||||||
><NInputNumber
|
:catalog="catalog"
|
||||||
placeholder="后端默认"
|
:provider="provider"
|
||||||
:input-props="{ id: 'identity-width' }"
|
:options="generationOptions"
|
||||||
:value="typeof width === 'number' ? width : null"
|
:aspect-ratio="profile.aspectRatio"
|
||||||
@update:value="width = $event ?? ''"
|
:disabled="disabled"
|
||||||
:min="1"
|
@update:provider="provider = $event"
|
||||||
:step="1"
|
@update:options="generationOptions = $event"
|
||||||
></NInputNumber></NFormItem
|
/>
|
||||||
><NFormItem path="height" label="高度(px)" :label-props="{ for: 'identity-height' }"
|
<!-- 以下是真实生图输入预览模块 -->
|
||||||
><NInputNumber
|
<ConfirmAction
|
||||||
placeholder="后端默认"
|
v-if="module === 'prop'"
|
||||||
:input-props="{ id: 'identity-height' }"
|
label="预览道具真实输入"
|
||||||
:value="typeof height === 'number' ? height : null"
|
description="缺少有效结构缓存时可能调用文本模型并产生费用;不会生成身份图片。确认后读取本次最终参数。"
|
||||||
@update:value="height = $event ?? ''"
|
:disabled="disabled || !valid || previewLoading"
|
||||||
:min="1"
|
acknowledgement
|
||||||
:step="1"
|
@confirm="loadPreview"
|
||||||
></NInputNumber
|
/>
|
||||||
></NFormItem>
|
<NButton v-else :disabled="disabled || !valid" :loading="previewLoading" @click="loadPreview"
|
||||||
|
>预览本次真实输入</NButton
|
||||||
|
>
|
||||||
|
<NAlert v-if="previewError" type="error">{{ previewError }}</NAlert>
|
||||||
|
<div v-if="preview" class="text-xs space-y-3">
|
||||||
|
<p>实际供应方:{{ preview.provider }} · 模型:{{ preview.model }}</p>
|
||||||
|
<p class="whitespace-pre-wrap">最终提示词:{{ preview.providerPrompt }}</p>
|
||||||
|
<pre class="whitespace-pre-wrap break-all">{{
|
||||||
|
JSON.stringify(
|
||||||
|
{
|
||||||
|
referenceImages: preview.referenceImages,
|
||||||
|
referencePlan: preview.referencePlan,
|
||||||
|
generationConfig: preview.generationConfig
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)
|
||||||
|
}}</pre>
|
||||||
</div>
|
</div>
|
||||||
<NCheckbox
|
<NCheckbox
|
||||||
id="identity-image-cost"
|
id="identity-image-cost"
|
||||||
@@ -167,12 +281,16 @@ const rules = {
|
|||||||
class="flex items-start gap-2 text-xs leading-6"
|
class="flex items-start gap-2 text-xs leading-6"
|
||||||
>我已确认后台没有同项目任务,了解本次会调用模型并可能产生费用。</NCheckbox
|
>我已确认后台没有同项目任务,了解本次会调用模型并可能产生费用。</NCheckbox
|
||||||
>
|
>
|
||||||
<div class="dialog-footer">
|
|
||||||
<NButton @click="open = false">取消</NButton
|
|
||||||
><NButton :disabled="disabled || !valid || !acknowledged" type="primary" attr-type="submit">
|
|
||||||
确认生成身份图
|
|
||||||
</NButton>
|
|
||||||
</div>
|
|
||||||
</AppForm>
|
</AppForm>
|
||||||
|
<template #footer>
|
||||||
|
<NButton @click="open = false">取消</NButton
|
||||||
|
><NButton
|
||||||
|
:disabled="disabled || paidPreviewPending || !valid || !acknowledged"
|
||||||
|
type="primary"
|
||||||
|
@click="formRef?.validate(submit)"
|
||||||
|
>
|
||||||
|
确认生成身份图
|
||||||
|
</NButton>
|
||||||
|
</template>
|
||||||
</AppDialog>
|
</AppDialog>
|
||||||
</template>
|
</template>
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref, watch } from 'vue'
|
||||||
|
import { NAlert, NButton, NCheckbox, NInputNumber } from 'naive-ui'
|
||||||
|
import { AppDialog } from '../../../components/ui'
|
||||||
|
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||||||
|
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
|
||||||
|
import type { StableAnchorQualityInput } from '../types'
|
||||||
|
|
||||||
|
/** 单主体稳定母版质量生成配置。 */
|
||||||
|
const props = defineProps<{
|
||||||
|
/** 正式主体 ID。 */
|
||||||
|
subjectId: string
|
||||||
|
/** 主体名称。 */
|
||||||
|
subjectName: string
|
||||||
|
/** 模型目录。 */
|
||||||
|
catalog: GenerationModelCatalog
|
||||||
|
/** 项目生成配置。 */
|
||||||
|
profile: CreativeProfile
|
||||||
|
/** 当前是否阻断提交。 */
|
||||||
|
disabled: boolean
|
||||||
|
}>()
|
||||||
|
/** 质量弹窗开关。 */
|
||||||
|
const open = defineModel<boolean>('open', { default: false })
|
||||||
|
/** 已确认费用的生成事件。 */
|
||||||
|
const emit = defineEmits<{ generate: [input: StableAnchorQualityInput] }>()
|
||||||
|
/** 本次供应方。 */
|
||||||
|
const provider = ref('')
|
||||||
|
/** 本次图片参数。 */
|
||||||
|
const options = ref<GenerationOptions>({})
|
||||||
|
/** 最多修复次数。 */
|
||||||
|
const maxRepairAttempts = ref(0)
|
||||||
|
/** 明确费用确认。 */
|
||||||
|
const acknowledged = ref(false)
|
||||||
|
/** 有限预算和供应方是否可用。 */
|
||||||
|
const valid = computed(
|
||||||
|
() =>
|
||||||
|
!!provider.value &&
|
||||||
|
Number.isInteger(maxRepairAttempts.value) &&
|
||||||
|
maxRepairAttempts.value >= 0 &&
|
||||||
|
maxRepairAttempts.value <= 3
|
||||||
|
)
|
||||||
|
/** 每次重新打开或切主体初始化项目参数。 */
|
||||||
|
watch(
|
||||||
|
() => [open.value, props.subjectId],
|
||||||
|
() => {
|
||||||
|
const selected =
|
||||||
|
props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
|
||||||
|
props.catalog.images.find(item => item.enabled)
|
||||||
|
provider.value = selected?.provider ?? ''
|
||||||
|
options.value = {
|
||||||
|
...selected?.defaults,
|
||||||
|
...(selected?.provider === props.profile.imageProvider ? props.profile.imageOptions : {})
|
||||||
|
}
|
||||||
|
maxRepairAttempts.value = 0
|
||||||
|
acknowledged.value = false
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
/** 改变预算或模型后必须再次确认。 */
|
||||||
|
watch(
|
||||||
|
() => [provider.value, JSON.stringify(options.value), maxRepairAttempts.value],
|
||||||
|
() => {
|
||||||
|
acknowledged.value = false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
/** 提交有限预算的模型生成参数。 */
|
||||||
|
function submit() {
|
||||||
|
if (props.disabled || !valid.value || !acknowledged.value) return
|
||||||
|
emit('generate', {
|
||||||
|
provider: provider.value,
|
||||||
|
generationOptions: { ...options.value },
|
||||||
|
maxRepairAttempts: maxRepairAttempts.value
|
||||||
|
})
|
||||||
|
open.value = false
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- 以下是单主体母版质量生成费用确认模块 -->
|
||||||
|
<AppDialog v-model:open="open" title="生成稳定母版并校验质量" :description="subjectName">
|
||||||
|
<div class="dialog-form-stack">
|
||||||
|
<NAlert type="warning" :show-icon="false"
|
||||||
|
>最多生成
|
||||||
|
{{ maxRepairAttempts + 1 }}
|
||||||
|
张候选,并逐张调用视觉校验;道具还可能调用结构编译模型,均可能产生费用。只有真实通过后,后端才会切换母版并锁定身份。</NAlert
|
||||||
|
>
|
||||||
|
<GenerationModelControls
|
||||||
|
type="image"
|
||||||
|
:catalog="catalog"
|
||||||
|
:provider="provider"
|
||||||
|
:options="options"
|
||||||
|
:aspect-ratio="profile.aspectRatio"
|
||||||
|
:disabled="disabled"
|
||||||
|
@update:provider="provider = $event"
|
||||||
|
@update:options="options = $event"
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
>最多修复次数(0–3)<NInputNumber v-model:value="maxRepairAttempts" :min="0" :max="3" :precision="0"
|
||||||
|
/></label>
|
||||||
|
<NCheckbox v-model:checked="acknowledged">我已确认本次候选数量、模型费用,且后台没有同项目任务。</NCheckbox>
|
||||||
|
</div>
|
||||||
|
<template #footer
|
||||||
|
><NButton @click="open = false">取消</NButton
|
||||||
|
><NButton type="primary" :disabled="disabled || !valid || !acknowledged" @click="submit"
|
||||||
|
>确认生成并校验</NButton
|
||||||
|
></template
|
||||||
|
>
|
||||||
|
</AppDialog>
|
||||||
|
</template>
|
||||||
@@ -45,15 +45,15 @@ export interface GenerateIdentityImageInput {
|
|||||||
viewType: IdentityViewType
|
viewType: IdentityViewType
|
||||||
referenceImageId?: string
|
referenceImageId?: string
|
||||||
prompt?: string
|
prompt?: string
|
||||||
width?: number
|
provider?: string
|
||||||
height?: number
|
generationOptions?: Record<string, string | number | boolean>
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Character 选角候选固定独立生成 primary,不复用旧 Anchor,也不会自动成为新 Anchor。 */
|
/** Character 选角候选固定独立生成 primary,不复用旧 Anchor,也不会自动成为新 Anchor。 */
|
||||||
export interface GenerateCastingCandidateInput {
|
export interface GenerateCastingCandidateInput {
|
||||||
prompt?: string
|
prompt?: string
|
||||||
width?: number
|
provider?: string
|
||||||
height?: number
|
generationOptions?: Record<string, string | number | boolean>
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 身份文本批量生成回执,不代表已生成参考图。 */
|
/** 身份文本批量生成回执,不代表已生成参考图。 */
|
||||||
@@ -167,3 +167,81 @@ export type IdentityReceipt =
|
|||||||
| { kind: 'identities'; title: string; result: IdentityBatchResult }
|
| { kind: 'identities'; title: string; result: IdentityBatchResult }
|
||||||
| { kind: 'casting'; title: string; result: CastingBatchResult }
|
| { kind: 'casting'; title: string; result: CastingBatchResult }
|
||||||
| { kind: 'stable-anchors'; title: string; result: StableAnchorBatchResult }
|
| { kind: 'stable-anchors'; title: string; result: StableAnchorBatchResult }
|
||||||
|
|
||||||
|
/** 最终身份图片 Provider 输入,直接对应身份预览接口。 */
|
||||||
|
export interface IdentityImagePreview {
|
||||||
|
/** 实际供应方。 */
|
||||||
|
provider: string
|
||||||
|
/** 实际模型。 */
|
||||||
|
model: string
|
||||||
|
/** 最终提示词。 */
|
||||||
|
providerPrompt: string
|
||||||
|
/** 实际引用图片地址。 */
|
||||||
|
referenceImages: string[]
|
||||||
|
/** 后端参考图选择计划。 */
|
||||||
|
referencePlan: Record<string, unknown>
|
||||||
|
/** 后端解析后的生成配置。 */
|
||||||
|
generationConfig: Record<string, unknown>
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 指定身份图片的视觉校验回执。 */
|
||||||
|
export interface IdentityValidationResult {
|
||||||
|
/** 正式主体 ID。 */
|
||||||
|
subjectId: string
|
||||||
|
/** 被校验的图片 ID。 */
|
||||||
|
imageId: string
|
||||||
|
/** 是否通过本次校验。 */
|
||||||
|
passed: boolean
|
||||||
|
/** 校验总结。 */
|
||||||
|
summary: string
|
||||||
|
/** 具体问题。 */
|
||||||
|
issues: Array<{
|
||||||
|
/** 问题类型。 */
|
||||||
|
type: string
|
||||||
|
/** 严重程度。 */
|
||||||
|
severity: string
|
||||||
|
/** 问题描述。 */
|
||||||
|
description: string
|
||||||
|
}>
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 有限预算的单主体稳定母版生成参数。 */
|
||||||
|
export interface StableAnchorQualityInput {
|
||||||
|
/** 最大修复次数,页面限制为 0 到 3。 */
|
||||||
|
maxRepairAttempts: number
|
||||||
|
/** 本次供应方。 */
|
||||||
|
provider: string
|
||||||
|
/** 本次图片生成参数。 */
|
||||||
|
generationOptions: Record<string, string | number | boolean>
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 单主体质量闭环的真实终态回执。 */
|
||||||
|
export interface StableAnchorQualityResult {
|
||||||
|
/** 最终是否通过。 */
|
||||||
|
passed: boolean
|
||||||
|
/** 最后一张候选图片 ID。 */
|
||||||
|
imageId?: string
|
||||||
|
/** 实际修复次数。 */
|
||||||
|
repairAttempts: number
|
||||||
|
/** 后端停止原因。 */
|
||||||
|
stopReason?: string
|
||||||
|
/** 重复错误签名。 */
|
||||||
|
repeatedErrorSignature?: string
|
||||||
|
/** 每轮结果。 */
|
||||||
|
attempts: Array<{
|
||||||
|
/** 从零开始的轮次。 */
|
||||||
|
attempt: number
|
||||||
|
/** 本轮图片 ID。 */
|
||||||
|
imageId: string
|
||||||
|
/** 本轮是否通过。 */
|
||||||
|
passed: boolean
|
||||||
|
/** 原始诊断问题。 */
|
||||||
|
issues: unknown[]
|
||||||
|
/** 结构问题类型。 */
|
||||||
|
structuralIssueTypes?: string[]
|
||||||
|
/** 错误签名。 */
|
||||||
|
errorSignature?: string
|
||||||
|
}>
|
||||||
|
/** 通过后原子确认的母版与锁定回执。 */
|
||||||
|
confirmed?: ConfirmCastingResult
|
||||||
|
}
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { usePolling } from '../../composables/usePolling'
|
import { usePolling } from '../../composables/usePolling'
|
||||||
import { visualStyleApi } from '../visual-style'
|
import { visualStyleApi } from '../visual-style'
|
||||||
|
import { useProjectGenerationRevision } from '../generation-config/context'
|
||||||
import { generationConfigApi } from '../generation-config/api'
|
import { generationConfigApi } from '../generation-config/api'
|
||||||
import { subjectImagesApi } from '../subject-images/api'
|
import { subjectImagesApi } from '../subject-images/api'
|
||||||
import { hasRunningImages } from '../subject-images/model'
|
import { hasRunningImages } from '../subject-images/model'
|
||||||
import { runOperation } from '../workflows/operations'
|
import { runOperation } from '../workflows/operations'
|
||||||
import { useProjectMutationGuard } from '../workflows/useProjectMutationGuard'
|
import { useProjectMutationGuard } from '../workflows/useProjectMutationGuard'
|
||||||
|
import { useProjectContext } from '../projects/context'
|
||||||
import { subjectIdentityApi } from './api'
|
import { subjectIdentityApi } from './api'
|
||||||
import { canBeAnchor, getIdentitySession, groupIdentitySubjects, mergeCastingSubjects } from './model'
|
import { canBeAnchor, getIdentitySession, groupIdentitySubjects, mergeCastingSubjects } from './model'
|
||||||
import type {
|
import type {
|
||||||
|
IdentityValidationResult,
|
||||||
|
StableAnchorQualityInput,
|
||||||
|
StableAnchorQualityResult,
|
||||||
GenerateCastingCandidateInput,
|
GenerateCastingCandidateInput,
|
||||||
GenerateIdentityImageInput,
|
GenerateIdentityImageInput,
|
||||||
IdentityImage,
|
IdentityImage,
|
||||||
@@ -18,19 +23,25 @@ import type {
|
|||||||
|
|
||||||
/** 单主体保存响应必须与提交时固定的正式 ID 一致。 */
|
/** 单主体保存响应必须与提交时固定的正式 ID 一致。 */
|
||||||
function assertIdentity(value: SubjectIdentity, id: string) {
|
function assertIdentity(value: SubjectIdentity, id: string) {
|
||||||
if (!value || value.subjectId !== id) throw new Error('后端未返回匹配的主体身份,请刷新核对。')
|
if (!value || value.subjectId !== id) throw new Error('没有获取到匹配的主体身份,请刷新后重试。')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 主体目录、项目风格和当前身份分开查询,未创建 Identity 不误报为空图库错误。 */
|
/** 主体目录、项目风格和当前身份分开查询,未创建 Identity 不误报为空图库错误。 */
|
||||||
export function useSubjectIdentity() {
|
export function useSubjectIdentity() {
|
||||||
const { projectId, operation, blocked: projectBlocked } = useProjectMutationGuard()
|
const { projectId, operation, blocked: projectBlocked } = useProjectMutationGuard()
|
||||||
|
const projectContext = useProjectContext()
|
||||||
const selectedId = ref('')
|
const selectedId = ref('')
|
||||||
const editorRevision = ref(0)
|
const editorRevision = ref(0)
|
||||||
const dirty = ref(false)
|
const dirty = ref(false)
|
||||||
const concurrency = ref(3)
|
const concurrency = ref(3)
|
||||||
const candidateLimit = ref(3)
|
const candidateLimit = ref(3)
|
||||||
const force = ref(false)
|
const force = ref(false)
|
||||||
/** 目录与身份已有刷新按钮,查询只在进入、切换和手动刷新时读取。 */
|
/** 主体与模型查询只在进入、切换和自身操作完成后读取。 */
|
||||||
|
const generationModelsQuery = usePolling(
|
||||||
|
projectId,
|
||||||
|
async (_id, signal) => generationConfigApi.catalog(signal),
|
||||||
|
false
|
||||||
|
)
|
||||||
const catalog = usePolling(
|
const catalog = usePolling(
|
||||||
projectId,
|
projectId,
|
||||||
async (id, signal) => {
|
async (id, signal) => {
|
||||||
@@ -57,9 +68,17 @@ export function useSubjectIdentity() {
|
|||||||
},
|
},
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
/** 全局配置成功保存后重新读取主体生图的实际默认参数。 */
|
||||||
|
const generationRevision = useProjectGenerationRevision()
|
||||||
|
/** 配置查询按当前项目和修订号隔离。 */
|
||||||
|
const profileKey = computed(() => JSON.stringify([projectId.value, generationRevision.value]))
|
||||||
|
/** 主体身份使用保存后的正式项目配置。 */
|
||||||
const profileQuery = usePolling(
|
const profileQuery = usePolling(
|
||||||
projectId,
|
profileKey,
|
||||||
async (id, signal) => ({ profile: await generationConfigApi.profile(id, signal) }),
|
async (key, signal) => {
|
||||||
|
const [id] = JSON.parse(key) as [string, number]
|
||||||
|
return { profile: await generationConfigApi.profile(id, signal) }
|
||||||
|
},
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
const castingQuery = usePolling(
|
const castingQuery = usePolling(
|
||||||
@@ -75,6 +94,14 @@ export function useSubjectIdentity() {
|
|||||||
)
|
)
|
||||||
const subject = computed(() => subjects.value.find(item => item.id === selectedId.value))
|
const subject = computed(() => subjects.value.find(item => item.id === selectedId.value))
|
||||||
const selectionKey = computed(() => subject.value?.id ?? '')
|
const selectionKey = computed(() => subject.value?.id ?? '')
|
||||||
|
const detailRef = {} as {
|
||||||
|
current?: ReturnType<typeof usePolling<{ identity: SubjectIdentity | null; images: IdentityImage[] }>>
|
||||||
|
}
|
||||||
|
const detailPollInterval = computed(() =>
|
||||||
|
detailRef.current?.data.value?.images.some(image => image.status === 'pending' || image.status === 'generating')
|
||||||
|
? 4000
|
||||||
|
: false
|
||||||
|
)
|
||||||
const detail = usePolling(
|
const detail = usePolling(
|
||||||
selectionKey,
|
selectionKey,
|
||||||
async (id, signal) => {
|
async (id, signal) => {
|
||||||
@@ -86,8 +113,9 @@ export function useSubjectIdentity() {
|
|||||||
if (images.some(image => image.identityId !== identity.id)) throw new Error('身份图片与当前主体不匹配。')
|
if (images.some(image => image.identityId !== identity.id)) throw new Error('身份图片与当前主体不匹配。')
|
||||||
return { identity, images }
|
return { identity, images }
|
||||||
},
|
},
|
||||||
false
|
detailPollInterval
|
||||||
)
|
)
|
||||||
|
detailRef.current = detail
|
||||||
const identity = computed(() => detail.data.value?.identity ?? null)
|
const identity = computed(() => detail.data.value?.identity ?? null)
|
||||||
const images = computed(() => detail.data.value?.images ?? [])
|
const images = computed(() => detail.data.value?.images ?? [])
|
||||||
const castingItem = computed(() =>
|
const castingItem = computed(() =>
|
||||||
@@ -99,7 +127,6 @@ export function useSubjectIdentity() {
|
|||||||
projectBlocked.value ||
|
projectBlocked.value ||
|
||||||
!!catalog.error.value ||
|
!!catalog.error.value ||
|
||||||
!catalog.data.value ||
|
!catalog.data.value ||
|
||||||
!!catalog.data.value.running ||
|
|
||||||
!!styleQuery.error.value ||
|
!!styleQuery.error.value ||
|
||||||
!styleQuery.data.value
|
!styleQuery.data.value
|
||||||
)
|
)
|
||||||
@@ -124,12 +151,17 @@ export function useSubjectIdentity() {
|
|||||||
!!identity.value?.generationPrompt?.trim() &&
|
!!identity.value?.generationPrompt?.trim() &&
|
||||||
!dirty.value
|
!dirty.value
|
||||||
)
|
)
|
||||||
|
const activeIdentityGeneration = computed(() =>
|
||||||
|
images.value.find(image => image.status === 'pending' || image.status === 'generating')
|
||||||
|
)
|
||||||
|
const latestIdentityFailure = computed(() => images.value.find(image => image.status === 'failed'))
|
||||||
const canGenerateCandidate = computed(
|
const canGenerateCandidate = computed(
|
||||||
() =>
|
() =>
|
||||||
canGenerateImage.value &&
|
canGenerateImage.value &&
|
||||||
subject.value?.module === 'character' &&
|
subject.value?.module === 'character' &&
|
||||||
!!castingQuery.data.value &&
|
!!castingQuery.data.value &&
|
||||||
!castingQuery.error.value
|
!castingQuery.error.value &&
|
||||||
|
!activeIdentityGeneration.value
|
||||||
)
|
)
|
||||||
const batchValid = computed(() => Number.isSafeInteger(concurrency.value) && concurrency.value > 0)
|
const batchValid = computed(() => Number.isSafeInteger(concurrency.value) && concurrency.value > 0)
|
||||||
const candidateLimitValid = computed(() => Number.isSafeInteger(candidateLimit.value) && candidateLimit.value > 0)
|
const candidateLimitValid = computed(() => Number.isSafeInteger(candidateLimit.value) && candidateLimit.value > 0)
|
||||||
@@ -145,6 +177,72 @@ export function useSubjectIdentity() {
|
|||||||
editorRevision.value++
|
editorRevision.value++
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** 校验结果以正式主体 ID 保存,切换主体不会串回执。 */
|
||||||
|
const validationResults = ref<Record<string, IdentityValidationResult>>({})
|
||||||
|
/** 质量闭环结果以正式主体 ID 保存。 */
|
||||||
|
const qualityResults = ref<Record<string, StableAnchorQualityResult>>({})
|
||||||
|
/** 当前主体的指定图片校验结果。 */
|
||||||
|
const validationResult = computed(() => validationResults.value[selectedId.value] ?? null)
|
||||||
|
/** 当前主体的质量闭环回执。 */
|
||||||
|
const qualityResult = computed(() => qualityResults.value[selectedId.value] ?? null)
|
||||||
|
/**
|
||||||
|
* 校验当前主体的正式图片,费用确认由图库负责。
|
||||||
|
* @param imageId 指定正式身份图片 ID
|
||||||
|
*/
|
||||||
|
async function validateImage(imageId: string) {
|
||||||
|
const image = images.value.find(item => item.id === imageId)
|
||||||
|
if (detailBlocked.value || !subject.value || image?.status !== 'completed' || !image.imageUrl) return
|
||||||
|
const id = subject.value.id
|
||||||
|
const project = projectId.value
|
||||||
|
delete validationResults.value[id]
|
||||||
|
await runOperation(project, '校验身份参考图质量', async () => {
|
||||||
|
const result = await subjectIdentityApi.validateImage(id, imageId)
|
||||||
|
if (result.subjectId !== id || result.imageId !== imageId) throw new Error('身份校验回执与提交目标不匹配')
|
||||||
|
validationResults.value[id] = result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 为场景或道具执行有限预算质量闭环,仅按真实回执确认锁定。
|
||||||
|
* @param input 模型、参数和修复次数
|
||||||
|
*/
|
||||||
|
async function generateStableAnchorQuality(input: StableAnchorQualityInput) {
|
||||||
|
if (
|
||||||
|
!canGenerateImage.value ||
|
||||||
|
!subject.value ||
|
||||||
|
!identity.value ||
|
||||||
|
!['scene', 'prop'].includes(subject.value.module)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
if (!Number.isInteger(input.maxRepairAttempts) || input.maxRepairAttempts < 0 || input.maxRepairAttempts > 3)
|
||||||
|
return
|
||||||
|
const id = subject.value.id
|
||||||
|
const identityId = identity.value.id
|
||||||
|
const project = projectId.value
|
||||||
|
delete qualityResults.value[id]
|
||||||
|
await runOperation(project, '生成稳定身份母版并校验质量', async () => {
|
||||||
|
const result = await subjectIdentityApi.generateStableAnchorQuality(id, input)
|
||||||
|
if (
|
||||||
|
result.passed &&
|
||||||
|
(!result.confirmed ||
|
||||||
|
result.confirmed.subjectId !== id ||
|
||||||
|
result.confirmed.identityId !== identityId ||
|
||||||
|
!result.confirmed.isLocked ||
|
||||||
|
!result.confirmed.anchor.isAnchor ||
|
||||||
|
result.confirmed.anchor.id !== result.imageId)
|
||||||
|
)
|
||||||
|
throw new Error('质量生成的母版与锁定回执未确认,请刷新核对')
|
||||||
|
qualityResults.value[id] = result
|
||||||
|
})
|
||||||
|
if (projectId.value === project) {
|
||||||
|
await Promise.all([
|
||||||
|
catalog.refresh(),
|
||||||
|
castingQuery.refresh(),
|
||||||
|
projectContext.refreshStageReadiness(),
|
||||||
|
...(selectedId.value === id ? [detail.refresh()] : [])
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 长请求跨主体切换后只更新原项目的操作回执,不用旧响应覆盖新主体。 */
|
/** 长请求跨主体切换后只更新原项目的操作回执,不用旧响应覆盖新主体。 */
|
||||||
async function writeIdentity(label: string, action: (id: string) => Promise<SubjectIdentity>) {
|
async function writeIdentity(label: string, action: (id: string) => Promise<SubjectIdentity>) {
|
||||||
if (detailBlocked.value || !subject.value) return
|
if (detailBlocked.value || !subject.value) return
|
||||||
@@ -175,9 +273,17 @@ export function useSubjectIdentity() {
|
|||||||
return writeIdentity('AI 生成主体身份', id => subjectIdentityApi.generate(id, overwrite))
|
return writeIdentity('AI 生成主体身份', id => subjectIdentityApi.generate(id, overwrite))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 批量仅生成身份文本,已锁定项由后端跳过,回执保留部分失败。 */
|
/** 批量仅生成身份文本,已锁定项会自动跳过,回执保留部分失败。 */
|
||||||
async function generateProject(charactersOnly = false, module?: 'scene' | 'prop') {
|
async function generateProject(charactersOnly = false, module?: 'scene' | 'prop') {
|
||||||
if (blocked.value || !hasStyle.value || !batchValid.value || dirty.value || !subjects.value.length) return
|
if (
|
||||||
|
blocked.value ||
|
||||||
|
!!catalog.data.value?.running ||
|
||||||
|
!hasStyle.value ||
|
||||||
|
!batchValid.value ||
|
||||||
|
dirty.value ||
|
||||||
|
!subjects.value.length
|
||||||
|
)
|
||||||
|
return
|
||||||
const id = projectId.value
|
const id = projectId.value
|
||||||
const target = getIdentitySession(id)
|
const target = getIdentitySession(id)
|
||||||
const input = { concurrency: concurrency.value, force: force.value, ...(module ? { module } : {}) }
|
const input = { concurrency: concurrency.value, force: force.value, ...(module ? { module } : {}) }
|
||||||
@@ -199,10 +305,11 @@ export function useSubjectIdentity() {
|
|||||||
await Promise.all([detail.refresh(), castingQuery.refresh()])
|
await Promise.all([detail.refresh(), castingQuery.refresh()])
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 场景/道具身份母版由后端独立生成、设为 Anchor 并锁定,保留逐主体失败回执。 */
|
/** 场景/道具身份母版会独立生成、设为母版并锁定,保留逐主体失败回执。 */
|
||||||
async function generateStableAnchors(module: 'scene' | 'prop') {
|
async function generateStableAnchors(module: 'scene' | 'prop') {
|
||||||
if (
|
if (
|
||||||
blocked.value ||
|
blocked.value ||
|
||||||
|
!!catalog.data.value?.running ||
|
||||||
!hasStyle.value ||
|
!hasStyle.value ||
|
||||||
!hasCreativeProfile.value ||
|
!hasCreativeProfile.value ||
|
||||||
!batchValid.value ||
|
!batchValid.value ||
|
||||||
@@ -232,6 +339,7 @@ export function useSubjectIdentity() {
|
|||||||
async function generateCastingCandidates() {
|
async function generateCastingCandidates() {
|
||||||
if (
|
if (
|
||||||
castingBlocked.value ||
|
castingBlocked.value ||
|
||||||
|
!!catalog.data.value?.running ||
|
||||||
!hasStyle.value ||
|
!hasStyle.value ||
|
||||||
!batchValid.value ||
|
!batchValid.value ||
|
||||||
!candidateLimitValid.value ||
|
!candidateLimitValid.value ||
|
||||||
@@ -267,12 +375,16 @@ export function useSubjectIdentity() {
|
|||||||
return
|
return
|
||||||
const id = subject.value.id
|
const id = subject.value.id
|
||||||
const identityId = identity.value.id
|
const identityId = identity.value.id
|
||||||
await runOperation(projectId.value, `生成 ${subject.value.name} 身份参考图`, async () => {
|
const ok = await runOperation(projectId.value, `提交 ${subject.value.name} 身份参考图生成`, async () => {
|
||||||
const image = await subjectIdentityApi.generateImage(id, input)
|
const image = await subjectIdentityApi.generateImage(id, input)
|
||||||
if (!image || image.identityId !== identityId || image.status !== 'completed' || !image.imageUrl)
|
if (!image || image.identityId !== identityId || !['pending', 'generating'].includes(image.status)) {
|
||||||
throw new Error(image?.error || '后端未返回已完成的身份图片,请先刷新核对,不要立即重复生图。')
|
throw new Error(image?.error || '身份参考图任务未成功创建,请刷新后重试。')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
await detail.refresh()
|
if (ok) {
|
||||||
|
await detail.refresh()
|
||||||
|
operation.value.notice = `${subject.value.name} 身份参考图已提交生成,可稍后刷新查看结果。`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 单角色候选图固定为独立 primary,不复用旧 Anchor,生成成功后仍需人工确认选角。 */
|
/** 单角色候选图固定为独立 primary,不复用旧 Anchor,生成成功后仍需人工确认选角。 */
|
||||||
@@ -280,12 +392,16 @@ export function useSubjectIdentity() {
|
|||||||
if (!canGenerateCandidate.value || !subject.value || !identity.value) return
|
if (!canGenerateCandidate.value || !subject.value || !identity.value) return
|
||||||
const id = subject.value.id
|
const id = subject.value.id
|
||||||
const identityId = identity.value.id
|
const identityId = identity.value.id
|
||||||
await runOperation(projectId.value, `生成 ${subject.value.name} 选角候选`, async () => {
|
const ok = await runOperation(projectId.value, `提交 ${subject.value.name} 选角候选生成`, async () => {
|
||||||
const image = await subjectIdentityApi.generateCastingCandidate(id, input)
|
const image = await subjectIdentityApi.generateCastingCandidate(id, input)
|
||||||
if (!image || image.identityId !== identityId || image.status !== 'completed' || !image.imageUrl)
|
if (!image || image.identityId !== identityId || !['pending', 'generating'].includes(image.status)) {
|
||||||
throw new Error(image?.error || '后端未返回已完成的选角候选,请刷新核对。')
|
throw new Error(image?.error || '选角候选任务未成功创建,请刷新后重试。')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
await Promise.all([detail.refresh(), castingQuery.refresh()])
|
if (ok) {
|
||||||
|
await Promise.all([detail.refresh(), castingQuery.refresh(), catalog.refresh()])
|
||||||
|
operation.value.notice = `${subject.value.name} 选角候选已提交生成,可稍后刷新查看结果。`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 候选切换母版只允许成功的 primary 图,不能将辅助视角直接升级为母版。 */
|
/** 候选切换母版只允许成功的 primary 图,不能将辅助视角直接升级为母版。 */
|
||||||
@@ -303,11 +419,41 @@ export function useSubjectIdentity() {
|
|||||||
!result.isAnchor ||
|
!result.isAnchor ||
|
||||||
!canBeAnchor(result)
|
!canBeAnchor(result)
|
||||||
)
|
)
|
||||||
throw new Error('接口未确认身份母版切换,请刷新核对。')
|
throw new Error('身份母版切换结果未确认,请刷新后核对。')
|
||||||
})
|
})
|
||||||
await detail.refresh()
|
await detail.refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Scene / Prop 人工确认母版时原子完成 Anchor 切换与 Identity 锁定。 */
|
||||||
|
async function confirmStableAnchor(imageId: string) {
|
||||||
|
const image = images.value.find(item => item.id === imageId)
|
||||||
|
if (
|
||||||
|
detailBlocked.value ||
|
||||||
|
(subject.value?.module !== 'scene' && subject.value?.module !== 'prop') ||
|
||||||
|
!identity.value ||
|
||||||
|
!image ||
|
||||||
|
!canBeAnchor(image)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
const subjectId = subject.value.id
|
||||||
|
const identityId = identity.value.id
|
||||||
|
await runOperation(projectId.value, `确认 ${subject.value.name} 身份母版`, async () => {
|
||||||
|
const result = await subjectIdentityApi.confirmStableAnchor(subjectId, imageId)
|
||||||
|
if (
|
||||||
|
!result ||
|
||||||
|
result.identityId !== identityId ||
|
||||||
|
result.subjectId !== subjectId ||
|
||||||
|
!result.isLocked ||
|
||||||
|
result.anchor.id !== imageId ||
|
||||||
|
!result.anchor.isAnchor ||
|
||||||
|
result.anchor.identityId !== identityId ||
|
||||||
|
!canBeAnchor(result.anchor)
|
||||||
|
)
|
||||||
|
throw new Error('身份母版确认结果未保存,请刷新后核对。')
|
||||||
|
})
|
||||||
|
await Promise.all([detail.refresh(), catalog.refresh()])
|
||||||
|
}
|
||||||
|
|
||||||
/** Character 确认选角必须原子切换 Anchor 并锁定 Identity。 */
|
/** Character 确认选角必须原子切换 Anchor 并锁定 Identity。 */
|
||||||
async function confirmCasting(imageId: string) {
|
async function confirmCasting(imageId: string) {
|
||||||
const image = images.value.find(item => item.id === imageId)
|
const image = images.value.find(item => item.id === imageId)
|
||||||
@@ -334,9 +480,9 @@ export function useSubjectIdentity() {
|
|||||||
result.anchor.identityId !== identityId ||
|
result.anchor.identityId !== identityId ||
|
||||||
!canBeAnchor(result.anchor)
|
!canBeAnchor(result.anchor)
|
||||||
)
|
)
|
||||||
throw new Error('接口未确认演员母版与身份锁定,请刷新核对。')
|
throw new Error('角色选角确认结果未保存,请刷新后核对。')
|
||||||
})
|
})
|
||||||
await Promise.all([detail.refresh(), castingQuery.refresh()])
|
await Promise.all([detail.refresh(), castingQuery.refresh(), projectContext.refreshStageReadiness()])
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -346,6 +492,7 @@ export function useSubjectIdentity() {
|
|||||||
subject,
|
subject,
|
||||||
subjects,
|
subjects,
|
||||||
catalog,
|
catalog,
|
||||||
|
generationModelsQuery,
|
||||||
castingQuery,
|
castingQuery,
|
||||||
styleQuery,
|
styleQuery,
|
||||||
profileQuery,
|
profileQuery,
|
||||||
@@ -367,6 +514,8 @@ export function useSubjectIdentity() {
|
|||||||
canGenerateText,
|
canGenerateText,
|
||||||
canGenerateImage,
|
canGenerateImage,
|
||||||
canGenerateCandidate,
|
canGenerateCandidate,
|
||||||
|
activeIdentityGeneration,
|
||||||
|
latestIdentityFailure,
|
||||||
batchValid,
|
batchValid,
|
||||||
candidateLimitValid,
|
candidateLimitValid,
|
||||||
save,
|
save,
|
||||||
@@ -377,6 +526,11 @@ export function useSubjectIdentity() {
|
|||||||
generateImage,
|
generateImage,
|
||||||
generateCastingCandidate,
|
generateCastingCandidate,
|
||||||
setAnchor,
|
setAnchor,
|
||||||
confirmCasting
|
confirmStableAnchor,
|
||||||
|
confirmCasting,
|
||||||
|
validateImage,
|
||||||
|
generateStableAnchorQuality,
|
||||||
|
validationResult,
|
||||||
|
qualityResult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,43 +6,22 @@ import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
|||||||
import ActionMenu from '../../components/ui/ActionMenu.vue'
|
import ActionMenu from '../../components/ui/ActionMenu.vue'
|
||||||
import DetailDisclosure from '../../components/ui/DetailDisclosure.vue'
|
import DetailDisclosure from '../../components/ui/DetailDisclosure.vue'
|
||||||
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
|
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
|
||||||
import {
|
import { NAlert, NButton, NCheckbox, NInput, NInputNumber, NPopover, NScrollbar, NSelect, NTag } from 'naive-ui'
|
||||||
NAlert,
|
|
||||||
NButton,
|
|
||||||
NCheckbox,
|
|
||||||
NCollapse,
|
|
||||||
NCollapseItem,
|
|
||||||
NInput,
|
|
||||||
NInputNumber,
|
|
||||||
NPopover,
|
|
||||||
NScrollbar,
|
|
||||||
NSelect,
|
|
||||||
NTag
|
|
||||||
} from 'naive-ui'
|
|
||||||
import { computed, onScopeDispose, ref, watch, type Directive } from 'vue'
|
import { computed, onScopeDispose, ref, watch, type Directive } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import {
|
import { Search, Download, ImagePlus, ArrowLeft, ArrowRight, LayoutGrid, Columns3, Settings2 } from '@lucide/vue'
|
||||||
Search,
|
|
||||||
RefreshCw,
|
|
||||||
Download,
|
|
||||||
ImagePlus,
|
|
||||||
ArrowLeft,
|
|
||||||
ArrowRight,
|
|
||||||
LayoutGrid,
|
|
||||||
Columns3,
|
|
||||||
Settings2
|
|
||||||
} from '@lucide/vue'
|
|
||||||
import { AssetImage, EmptyState, StatusBadge } from '../../components/ui'
|
import { AssetImage, EmptyState, StatusBadge } from '../../components/ui'
|
||||||
import { downloadText } from '../../lib/format'
|
import { downloadText } from '../../lib/format'
|
||||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||||
import { useSubjectImages } from './useSubjectImages'
|
import { useSubjectImages } from './useSubjectImages'
|
||||||
import { coverImage, hasRunningImages, primaryImage } from './model'
|
import { hasRunningImages, primaryImage } from './model'
|
||||||
import type { GenerateFormImageInput, SubjectFormAsset } from './types'
|
import type { GenerateFormImageInput, SubjectFormAsset } from './types'
|
||||||
import GenerateImageDialog from './components/GenerateImageDialog.vue'
|
import GenerateImageDialog from './components/GenerateImageDialog.vue'
|
||||||
import ImageGalleryDialog from './components/ImageGalleryDialog.vue'
|
import ImageGalleryDialog from './components/ImageGalleryDialog.vue'
|
||||||
import FormPromptDialog from './components/FormPromptDialog.vue'
|
import FormPromptDialog from './components/FormPromptDialog.vue'
|
||||||
import FormPromptBatch from './components/FormPromptBatch.vue'
|
import FormPromptBatch from './components/FormPromptBatch.vue'
|
||||||
import { useKeyframeImpact } from './useKeyframeImpact'
|
import { useKeyframeImpact } from './useKeyframeImpact'
|
||||||
|
import { useProjectContext } from '../projects/context'
|
||||||
import { queryText, referenceLocation, referenceTargets } from '../production/asset-links'
|
import { queryText, referenceLocation, referenceTargets } from '../production/asset-links'
|
||||||
import { masonryRowSpan, type GalleryLayout } from './layout'
|
import { masonryRowSpan, type GalleryLayout } from './layout'
|
||||||
|
|
||||||
@@ -53,6 +32,8 @@ const {
|
|||||||
id,
|
id,
|
||||||
forms,
|
forms,
|
||||||
query,
|
query,
|
||||||
|
generationModelsQuery,
|
||||||
|
profileQuery,
|
||||||
refreshProject,
|
refreshProject,
|
||||||
operation,
|
operation,
|
||||||
session,
|
session,
|
||||||
@@ -70,6 +51,7 @@ const {
|
|||||||
generate,
|
generate,
|
||||||
generateProject
|
generateProject
|
||||||
} = useSubjectImages()
|
} = useSubjectImages()
|
||||||
|
const project = useProjectContext()
|
||||||
const sourceShotId = computed(() => queryText(route.query.sourceShotId))
|
const sourceShotId = computed(() => queryText(route.query.sourceShotId))
|
||||||
const targetFormId = computed(() => queryText(route.query.subjectFormId))
|
const targetFormId = computed(() => queryText(route.query.subjectFormId))
|
||||||
const targetForm = computed(() => forms.value.find(form => form.id === targetFormId.value))
|
const targetForm = computed(() => forms.value.find(form => form.id === targetFormId.value))
|
||||||
@@ -236,6 +218,7 @@ const promptForm = computed(() => forms.value.find(form => form.id === promptId.
|
|||||||
const generateForm = computed(() => forms.value.find(form => form.id === generateId.value) ?? null)
|
const generateForm = computed(() => forms.value.find(form => form.id === generateId.value) ?? null)
|
||||||
const galleryForm = computed(() => forms.value.find(form => form.id === galleryId.value) ?? null)
|
const galleryForm = computed(() => forms.value.find(form => form.id === galleryId.value) ?? null)
|
||||||
const completeCount = computed(() => forms.value.filter(form => primaryImage(form.images)).length)
|
const completeCount = computed(() => forms.value.filter(form => primaryImage(form.images)).length)
|
||||||
|
const stageComplete = computed(() => project.stageReadiness.value?.subjectAssets.ready === true)
|
||||||
const filtered = computed(() =>
|
const filtered = computed(() =>
|
||||||
forms.value.filter(
|
forms.value.filter(
|
||||||
form =>
|
form =>
|
||||||
@@ -276,7 +259,7 @@ function openGallery(form: SubjectFormAsset) {
|
|||||||
galleryId.value = form.id
|
galleryId.value = form.id
|
||||||
galleryOpen.value = true
|
galleryOpen.value = true
|
||||||
}
|
}
|
||||||
/** 本次提交的 ID 和配置由弹窗固定,关闭弹窗不取消后台任务。 */
|
/** 本次提交的 ID 和配置由弹窗固定,关闭弹窗不会取消制作任务。 */
|
||||||
function submitGenerate(formId: string, input: GenerateFormImageInput) {
|
function submitGenerate(formId: string, input: GenerateFormImageInput) {
|
||||||
void generate(formId, input)
|
void generate(formId, input)
|
||||||
}
|
}
|
||||||
@@ -310,9 +293,15 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<WorkspacePage compact class="gallery-workspace-page"
|
<WorkspacePage compact class="gallery-workspace-page">
|
||||||
><template #default>
|
<template #notice>
|
||||||
<!-- 抽屉只保留内容,入口跟随图库显示控制移动到筛选区。 -->
|
<NAlert v-if="stageComplete" type="success" :show-icon="false">
|
||||||
|
当前制作需要的主体参考图已经准备好,可以继续进行分镜设计。
|
||||||
|
<RouterLink :to="`/projects/${id}/storyboard`" class="text-button ml-2">继续分镜设计 →</RouterLink>
|
||||||
|
</NAlert>
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
|
<!-- 批量设置使用弹窗,入口跟随图库筛选区。 -->
|
||||||
<WorkspaceTools
|
<WorkspaceTools
|
||||||
triggerless
|
triggerless
|
||||||
v-model:open="toolsOpen"
|
v-model:open="toolsOpen"
|
||||||
@@ -331,8 +320,7 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
/></RouterLink>
|
/></RouterLink>
|
||||||
</div>
|
</div>
|
||||||
<DetailDisclosure title="母版继承与过期处理" class="mt-4">
|
<DetailDisclosure title="母版继承与过期处理" class="mt-4">
|
||||||
人物、场景、道具形态图均可继承已锁定 Identity
|
人物、场景、道具形态图都会继承已锁定的主体母版。母版变化后,旧主图会自动标记为需要更新;候选图只有明确设为主参考图后才会供分镜使用。
|
||||||
的母版。母版变化后请核对形态图,按需生成候选并确认主图。当前图库不提供历史母版引用,无法自动判断形态图是否过期;下游状态以镜头就绪检查为准。
|
|
||||||
<RouterLink :to="`/projects/${id}/subject-identity`" class="text-button ml-2"
|
<RouterLink :to="`/projects/${id}/subject-identity`" class="text-button ml-2"
|
||||||
>管理主体身份 →</RouterLink
|
>管理主体身份 →</RouterLink
|
||||||
></DetailDisclosure
|
></DetailDisclosure
|
||||||
@@ -361,72 +349,70 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
/>
|
/>
|
||||||
<span class="text-xs text-muted">同时应用于批量提示词与批量生图。</span>
|
<span class="text-xs text-muted">同时应用于批量提示词与批量生图。</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel mt-5 p-5">
|
<div class="panel workspace-panel">
|
||||||
<div class="flex flex-wrap items-center justify-between gap-4">
|
<div class="flex flex-wrap items-center justify-between gap-4">
|
||||||
<p class="text-sm">
|
<p class="text-sm">
|
||||||
<strong>{{ completeCount }}</strong> / {{ forms.length }} 个形态已有主图
|
<strong>{{ completeCount }}</strong> / {{ forms.length }} 个形态已有主图
|
||||||
<span class="ml-3 text-xs text-muted">图片模型 · 后端配置</span>
|
<span class="ml-3 text-xs text-muted">使用项目图片模型</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="mt-2 text-[11px] leading-6 text-muted">
|
<p class="mt-2 text-[11px] leading-6 text-muted">
|
||||||
图库不自动刷新,可点击“刷新图库”读取最新记录。主图供分镜引用,候选图和历史失败记录均保留;过期主图不会自动删除或替换。
|
图库在进入和操作完成后读取最新记录。主图供分镜引用,候选图和历史失败记录均保留;过期主图不会自动删除或替换。
|
||||||
</p>
|
</p>
|
||||||
<NCollapse class="mt-4 pt-4" :default-expanded-names="['details']"
|
<section class="mt-4 pt-4">
|
||||||
><NCollapseItem name="details"
|
<h3 class="text-sm font-semibold">项目批量生图</h3>
|
||||||
><template #header>项目批量生图</template>
|
<AppForm :model="formModel" :rules="rules" :disabled="operation.pending" validate-on-change>
|
||||||
<AppForm :model="formModel" :rules="rules" :disabled="operation.pending" validate-on-change>
|
<div class="form-controls mt-4 flex flex-wrap gap-4">
|
||||||
<div class="form-controls mt-4 flex flex-wrap gap-4">
|
<NFormItem
|
||||||
<NFormItem
|
class="w-28"
|
||||||
class="w-28"
|
path="concurrency"
|
||||||
path="concurrency"
|
label="批量并发"
|
||||||
label="批量并发"
|
:label-props="{ for: 'image-concurrency' }"
|
||||||
:label-props="{ for: 'image-concurrency' }"
|
>
|
||||||
>
|
<NInputNumber
|
||||||
<NInputNumber
|
|
||||||
:disabled="operation.pending"
|
|
||||||
:input-props="{ id: 'image-concurrency' }"
|
|
||||||
:value="typeof concurrency === 'number' ? concurrency : null"
|
|
||||||
@update:value="concurrency = $event ?? 0"
|
|
||||||
:min="1"
|
|
||||||
:step="1"
|
|
||||||
></NInputNumber>
|
|
||||||
</NFormItem>
|
|
||||||
<NFormItem class="w-36" path="limit" label="本批上限(可选)"
|
|
||||||
><NInputNumber
|
|
||||||
:disabled="operation.pending"
|
|
||||||
:value="typeof limit === 'number' ? limit : null"
|
|
||||||
@update:value="limit = $event ?? ''"
|
|
||||||
:min="1"
|
|
||||||
:step="1"
|
|
||||||
placeholder="不限制"
|
|
||||||
:input-props="{ 'aria-label': '生图本批上限' }"
|
|
||||||
/></NFormItem>
|
|
||||||
<NCheckbox
|
|
||||||
v-model:checked="force"
|
|
||||||
:disabled="operation.pending"
|
:disabled="operation.pending"
|
||||||
class="control-row-checkbox text-xs"
|
:input-props="{ id: 'image-concurrency' }"
|
||||||
>已有主图也新增候选图
|
:value="typeof concurrency === 'number' ? concurrency : null"
|
||||||
</NCheckbox>
|
@update:value="concurrency = $event ?? 0"
|
||||||
<ConfirmAction
|
:min="1"
|
||||||
:label="force ? '为全项目新增候选图' : '补齐项目主参考图'"
|
:step="1"
|
||||||
:disabled="blocked || !batchValid || !forms.length"
|
></NInputNumber>
|
||||||
acknowledgement
|
</NFormItem>
|
||||||
:description="
|
<NFormItem class="w-36" path="limit" label="本批上限(可选)"
|
||||||
force
|
><NInputNumber
|
||||||
? '对项目全部形态调用图片模型新增一张图片。已有主图不会被替换,生成后可在图片记录中手动选择主图。'
|
:disabled="operation.pending"
|
||||||
: '对缺少主图或主图已过期的形态调用图片模型,仍有效的主图跳过。已有过期主图不会被自动替换,生成后请在图片记录中确认新主图。操作面向整个项目,不受列表筛选影响。'
|
:value="typeof limit === 'number' ? limit : null"
|
||||||
"
|
@update:value="limit = $event ?? ''"
|
||||||
@confirm="generateProject"
|
:min="1"
|
||||||
/>
|
:step="1"
|
||||||
</div>
|
placeholder="不限制"
|
||||||
</AppForm>
|
:input-props="{ 'aria-label': '生图本批上限' }"
|
||||||
<p class="mt-3 text-xs leading-6 text-muted">
|
/></NFormItem>
|
||||||
作用于整个项目,不受下方筛选影响。上限只限制本次真正生图数量,其余显示为“待后续处理”,不计入跳过。默认使用后端尺寸与正式提示词,不会启动视频生成。
|
<NCheckbox
|
||||||
</p></NCollapseItem
|
v-model:checked="force"
|
||||||
></NCollapse
|
:disabled="operation.pending"
|
||||||
>
|
class="control-row-checkbox text-xs"
|
||||||
|
>已有主图也新增候选图
|
||||||
|
</NCheckbox>
|
||||||
|
<ConfirmAction
|
||||||
|
:label="force ? '为全项目新增候选图' : '补齐项目主参考图'"
|
||||||
|
:disabled="blocked || running || !batchValid || !forms.length"
|
||||||
|
acknowledgement
|
||||||
|
:description="
|
||||||
|
force
|
||||||
|
? '对项目全部形态调用图片模型新增一张图片。已有主图不会被替换,生成后可在图片记录中手动选择主图。'
|
||||||
|
: '对缺少主图或主图已过期的形态调用图片模型,仍有效的主图跳过。已有过期主图不会被自动替换,生成后请在图片记录中确认新主图。操作面向整个项目,不受列表筛选影响。'
|
||||||
|
"
|
||||||
|
@confirm="generateProject"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</AppForm>
|
||||||
|
<p class="mt-3 text-xs leading-6 text-muted">
|
||||||
|
作用于整个项目,不受下方筛选影响。上限只限制本次真正生图数量,其余显示为“待后续处理”,不计入跳过。默认使用项目尺寸与正式提示词,不会启动视频生成。
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<section v-if="session.receipt" class="panel mt-4 p-5" aria-label="生图批量回执">
|
<section v-if="session.receipt" class="panel workspace-panel" aria-label="生图批量回执">
|
||||||
<div class="flex items-center justify-between gap-3">
|
<div class="flex items-center justify-between gap-3">
|
||||||
<h3 class="text-sm font-medium">{{ session.receipt.title }} · 本次回执</h3>
|
<h3 class="text-sm font-medium">{{ session.receipt.title }} · 本次回执</h3>
|
||||||
<NButton @click="exportReceipt" text size="small"><Download :size="13" />导出诊断</NButton>
|
<NButton @click="exportReceipt" text size="small"><Download :size="13" />导出诊断</NButton>
|
||||||
@@ -470,7 +456,7 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
data-keyframe-impact
|
data-keyframe-impact
|
||||||
>
|
>
|
||||||
{{ impact.stale.value.length }}
|
{{ impact.stale.value.length }}
|
||||||
个镜头被后端报告主首帧过期。此警告不表示形态图片本身失效;请选择镜头核对当前素材,确认过期后再重建首帧。
|
个镜头的主首帧已标记为过期。此警告不表示形态图片本身失效;请选择镜头核对当前素材,确认过期后再重建首帧。
|
||||||
<p v-if="impact.stale.value.some(item => item.inconsistent)" class="mt-2">
|
<p v-if="impact.stale.value.some(item => item.inconsistent)" class="mt-2">
|
||||||
其中
|
其中
|
||||||
{{ impact.stale.value.filter(item => item.inconsistent).length }}
|
{{ impact.stale.value.filter(item => item.inconsistent).length }}
|
||||||
@@ -592,25 +578,7 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
</template>
|
</template>
|
||||||
瀑布流布局
|
瀑布流布局
|
||||||
</NPopover>
|
</NPopover>
|
||||||
<NPopover trigger="hover" placement="top" :disabled="isMobile">
|
|
||||||
<template #trigger>
|
|
||||||
<NButton
|
|
||||||
class="icon-button gallery-action-button"
|
|
||||||
size="small"
|
|
||||||
:disabled="query.loading.value || impact.query.loading.value"
|
|
||||||
aria-label="刷新图库"
|
|
||||||
@click="refreshAssets"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<RefreshCw
|
|
||||||
:size="16"
|
|
||||||
:class="{ 'animate-spin': query.loading.value }"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</NButton>
|
|
||||||
</template>
|
|
||||||
刷新图库
|
|
||||||
</NPopover>
|
|
||||||
<NPopover trigger="hover" placement="top" :disabled="isMobile">
|
<NPopover trigger="hover" placement="top" :disabled="isMobile">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<NButton
|
<NButton
|
||||||
@@ -639,10 +607,10 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
<p v-if="sourceCurrent" class="text-xs">
|
<p v-if="sourceCurrent" class="text-xs">
|
||||||
当前检查:{{
|
当前检查:{{
|
||||||
sourceShot?.primaryKeyframeId ? '该镜头主首帧未被标记为过期' : '该镜头暂无主首帧'
|
sourceShot?.primaryKeyframeId ? '该镜头主首帧未被标记为过期' : '该镜头暂无主首帧'
|
||||||
}}。请以后端最新就绪状态为准。
|
}}。请以最新制作状态为准。
|
||||||
</p>
|
</p>
|
||||||
<p v-if="sourceShot?.inconsistent" class="text-xs text-danger">
|
<p v-if="sourceShot?.inconsistent" class="text-xs text-danger">
|
||||||
当前镜头:首帧检查未标记过期,但视频检查报告过期。请核对后端检查逻辑与身份母版,暂不建议重复生图。
|
当前镜头的首帧与视频状态不一致。请先核对身份母版和当前素材,暂不建议重复生图。
|
||||||
</p>
|
</p>
|
||||||
<p v-if="targetUnlinked" class="text-xs text-danger">
|
<p v-if="targetUnlinked" class="text-xs text-danger">
|
||||||
指定形态不在该镜头当前的有效引用列表中,关联可能已调整或主图缺失,请从下方关联素材重新核对。
|
指定形态不在该镜头当前的有效引用列表中,关联可能已调整或主图缺失,请从下方关联素材重新核对。
|
||||||
@@ -690,10 +658,16 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
}}</template>
|
}}</template>
|
||||||
<NButton text size="small" @click="resetFilters">清除定位</NButton>
|
<NButton text size="small" @click="resetFilters">清除定位</NButton>
|
||||||
</NAlert>
|
</NAlert>
|
||||||
|
<NAlert v-if="operation.notice" role="status" type="success" :show-icon="false" class="mt-4">
|
||||||
|
{{ operation.notice }}
|
||||||
|
</NAlert>
|
||||||
|
<NAlert v-if="operation.error" role="alert" type="error" :show-icon="false" class="mt-4">
|
||||||
|
{{ operation.error }}
|
||||||
|
</NAlert>
|
||||||
<NAlert v-if="query.error.value" role="alert" type="error" :show-icon="false" class="mt-4"
|
<NAlert v-if="query.error.value" role="alert" type="error" :show-icon="false" class="mt-4"
|
||||||
>{{ query.error.value }}<span v-if="forms.length"> 当前展示上次读取的数据。</span></NAlert
|
>{{ query.error.value }}<span v-if="forms.length"> 当前展示上次读取的数据。</span></NAlert
|
||||||
><NAlert v-if="running" role="status" type="info" :show-icon="false" class="mt-4">
|
><NAlert v-if="running" role="status" type="info" :show-icon="false" class="mt-4">
|
||||||
数据库中仍有排队或生成中的图片,已暂停新的生图操作。长时间无变化时请先核对任务状态。
|
数据库中有形态图片正在后台生成。对应形态会暂停重复提交,其它形态仍可继续生成;项目批量生图需等待当前任务完成。
|
||||||
</NAlert>
|
</NAlert>
|
||||||
<p v-if="!query.data.value && query.loading.value" class="py-10 text-sm text-muted" role="status">
|
<p v-if="!query.data.value && query.loading.value" class="py-10 text-sm text-muted" role="status">
|
||||||
正在读取形态和已有图片…
|
正在读取形态和已有图片…
|
||||||
@@ -714,12 +688,18 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
:data-form-id="form.id"
|
:data-form-id="form.id"
|
||||||
>
|
>
|
||||||
<AssetImage
|
<AssetImage
|
||||||
:src="coverImage(form)?.imageUrl"
|
:src="primaryImage(form.images)?.imageUrl"
|
||||||
:alt="`${form.subject.name} · ${form.name}`"
|
:alt="`${form.subject.name} · ${form.name}`"
|
||||||
:class="{ 'form-image-has-source': Boolean(coverImage(form)?.imageUrl) }"
|
:class="{ 'form-image-has-source': Boolean(primaryImage(form.images)?.imageUrl) }"
|
||||||
:object-fit="layout === 'masonry' ? 'contain' : 'cover'"
|
:object-fit="layout === 'masonry' ? 'contain' : 'cover'"
|
||||||
preview
|
preview
|
||||||
:empty-text="hasRunningImages(form.images) ? '后台正在生成图片' : '尚未生成图片'"
|
:empty-text="
|
||||||
|
hasRunningImages(form.images)
|
||||||
|
? '后台正在生成图片'
|
||||||
|
: form.images.some(image => image.status === 'completed' && image.imageUrl)
|
||||||
|
? '已有候选图,请确认主参考图'
|
||||||
|
: '尚未生成主参考图'
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
@@ -736,7 +716,12 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
<div class="mt-3 flex flex-wrap items-center gap-2">
|
<div class="mt-3 flex flex-wrap items-center gap-2">
|
||||||
<StatusBadge v-if="hasRunningImages(form.images)" status="generating" />
|
<StatusBadge v-if="hasRunningImages(form.images)" status="generating" />
|
||||||
<NTag v-else-if="primaryImage(form.images)" size="small" :bordered="false">主参考图</NTag>
|
<NTag v-else-if="primaryImage(form.images)" size="small" :bordered="false">主参考图</NTag>
|
||||||
<NTag v-else-if="coverImage(form)" size="small" :bordered="false">候选图 · 尚未设主图</NTag>
|
<NTag
|
||||||
|
v-else-if="form.images.some(image => image.status === 'completed' && image.imageUrl)"
|
||||||
|
size="small"
|
||||||
|
:bordered="false"
|
||||||
|
>候选图 · 尚未设主图</NTag
|
||||||
|
>
|
||||||
<span v-else-if="form.images[0]?.status === 'failed'" class="text-xs text-danger"
|
<span v-else-if="form.images[0]?.status === 'failed'" class="text-xs text-danger"
|
||||||
>最近一次生成失败</span
|
>最近一次生成失败</span
|
||||||
>
|
>
|
||||||
@@ -756,7 +741,7 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
{{ sourceShot.shotNo }} 的待处理首帧关联此素材。
|
{{ sourceShot.shotNo }} 的待处理首帧关联此素材。
|
||||||
{{
|
{{
|
||||||
sourceShot.inconsistent
|
sourceShot.inconsistent
|
||||||
? '后端首帧与视频检查结果不一致,请先核对,不要据此重复生图。'
|
? '首帧与视频检查结果不一致,请先核对,不要据此重复生图。'
|
||||||
: '关联不等于本素材失效;核对形态主图与身份母版,确认无误后只需重建首帧。'
|
: '关联不等于本素材失效;核对形态主图与身份母版,确认无误后只需重建首帧。'
|
||||||
}}
|
}}
|
||||||
<RouterLink v-if="sourceLocation" :to="sourceLocation" class="text-button mt-2"
|
<RouterLink v-if="sourceLocation" :to="sourceLocation" class="text-button mt-2"
|
||||||
@@ -783,8 +768,13 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
})
|
})
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<NButton :disabled="blocked" @click="openGenerate(form)"
|
<NButton :disabled="blocked || hasRunningImages(form.images)" @click="openGenerate(form)"
|
||||||
><ImagePlus :size="14" /> {{ coverImage(form) ? '再生成一张' : '生成图片' }}</NButton
|
><ImagePlus :size="14" />
|
||||||
|
{{
|
||||||
|
form.images.some(image => image.status === 'completed' && image.imageUrl)
|
||||||
|
? '再生成一张'
|
||||||
|
: '生成图片'
|
||||||
|
}}</NButton
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -808,9 +798,12 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
:form="promptForm"
|
:form="promptForm"
|
||||||
:disabled="blocked || !promptForm"
|
:disabled="blocked || !promptForm"
|
||||||
@generate="generatePrompt" /><GenerateImageDialog
|
@generate="generatePrompt" /><GenerateImageDialog
|
||||||
|
v-if="generationModelsQuery.data.value && profileQuery.data.value?.profile"
|
||||||
v-model:open="generateOpen"
|
v-model:open="generateOpen"
|
||||||
:form="generateForm"
|
:form="generateForm"
|
||||||
:disabled="blocked || !generateForm"
|
:catalog="generationModelsQuery.data.value"
|
||||||
|
:profile="profileQuery.data.value.profile"
|
||||||
|
:disabled="blocked || !generateForm || hasRunningImages(generateForm.images)"
|
||||||
@generate="submitGenerate" /><ImageGalleryDialog
|
@generate="submitGenerate" /><ImageGalleryDialog
|
||||||
v-model:open="galleryOpen"
|
v-model:open="galleryOpen"
|
||||||
:project-id="id"
|
:project-id="id"
|
||||||
@@ -839,14 +832,11 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
:root:not([data-theme='dark']) .form-image-card {
|
:root:not([data-theme='dark']) .form-image-card {
|
||||||
background: var(--app-subtle);
|
background: var(--app-subtle);
|
||||||
}
|
}
|
||||||
.gallery-workspace-page .workspace-scroll-content {
|
|
||||||
@apply pt-2;
|
|
||||||
}
|
|
||||||
.gallery-workspace-page .gallery-sticky-controls {
|
.gallery-workspace-page .gallery-sticky-controls {
|
||||||
@apply sticky top-0 z-10 bg-(--app-body) mt-2.5 mb-0;
|
@apply sticky top-0 z-10 bg-(--app-body) m-0;
|
||||||
}
|
}
|
||||||
.gallery-workspace-page .form-image-grid {
|
.gallery-workspace-page .form-image-grid {
|
||||||
@apply pt-3;
|
padding-top: var(--app-content-gap);
|
||||||
}
|
}
|
||||||
.gallery-workspace-page .form-image-masonry {
|
.gallery-workspace-page .form-image-masonry {
|
||||||
@apply grid grid-cols-[repeat(auto-fill,_minmax(min(260px,_100%),_1fr))] items-start;
|
@apply grid grid-cols-[repeat(auto-fill,_minmax(min(260px,_100%),_1fr))] items-start;
|
||||||
@@ -878,7 +868,7 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
|||||||
@apply [overflow-anchor:none];
|
@apply [overflow-anchor:none];
|
||||||
}
|
}
|
||||||
.form-image-filter-region {
|
.form-image-filter-region {
|
||||||
@apply my-4 p-3;
|
@apply my-3 p-3;
|
||||||
/* 外层使用浅灰分组,输入与下拉恢复为表面色,避免同色后失去控件边界。 */
|
/* 外层使用浅灰分组,输入与下拉恢复为表面色,避免同色后失去控件边界。 */
|
||||||
--app-field: var(--app-surface);
|
--app-field: var(--app-surface);
|
||||||
--app-field-hover: var(--app-surface);
|
--app-field-hover: var(--app-surface);
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ function exportPrompt() {
|
|||||||
结合形态描述与项目视觉风格生成并保存
|
结合形态描述与项目视觉风格生成并保存
|
||||||
generationPrompt。只调用文本模型,不生成图片;覆盖不会修改已有图片的实际提示词或主图。
|
generationPrompt。只调用文本模型,不生成图片;覆盖不会修改已有图片的实际提示词或主图。
|
||||||
</NAlert>
|
</NAlert>
|
||||||
<section class="surface-inset mt-5 p-4">
|
<section class="dialog-section mt-5">
|
||||||
<h3 class="text-sm font-medium">原始外观素材</h3>
|
<h3 class="text-sm font-medium">原始外观素材</h3>
|
||||||
<p class="mt-3 whitespace-pre-wrap break-words text-xs leading-6 text-muted">
|
<p class="mt-3 whitespace-pre-wrap break-words text-xs leading-6 text-muted">
|
||||||
{{ form?.appearancePrompt || form?.description || '暂无原始外观素材' }}
|
{{ form?.appearancePrompt || form?.description || '暂无原始外观素材' }}
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
<section class="surface-inset mt-4 p-4">
|
<section class="dialog-section mt-4">
|
||||||
<h3 class="text-sm font-medium">正式生图提示词</h3>
|
<h3 class="text-sm font-medium">正式生图提示词</h3>
|
||||||
<p class="mt-3 whitespace-pre-wrap break-words text-sm leading-6">
|
<p class="mt-3 whitespace-pre-wrap break-words text-sm leading-6">
|
||||||
{{ form?.generationPrompt || '尚未生成。可先在这里生成检查,也可由生图接口自动补齐。' }}
|
{{ form?.generationPrompt || '尚未生成。可先在这里生成检查,也可由生图接口自动补齐。' }}
|
||||||
|
|||||||
@@ -1,36 +1,55 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import AppForm from '../../../components/ui/AppForm.vue'
|
import AppForm from '../../../components/ui/AppForm.vue'
|
||||||
import { NFormItem } from 'naive-ui'
|
import { NFormItem } from 'naive-ui'
|
||||||
import { sizeRules } from '../../../lib/form-rules'
|
import { NAlert, NButton, NCheckbox, NCollapse, NCollapseItem, NInput, NTag } from 'naive-ui'
|
||||||
import { NAlert, NButton, NCheckbox, NCollapse, NCollapseItem, NInput, NInputNumber, NTag } from 'naive-ui'
|
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { AppDialog } from '../../../components/ui'
|
import { AppDialog } from '../../../components/ui'
|
||||||
import { errorMessage } from '../../../lib/http'
|
import { errorMessage } from '../../../lib/http'
|
||||||
import { subjectImagesApi } from '../api'
|
import { subjectImagesApi } from '../api'
|
||||||
import { primaryImage, validImageSize } from '../model'
|
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||||||
|
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
|
||||||
|
import { primaryImage } from '../model'
|
||||||
import type { GenerateFormImageInput, SubjectFormAsset, SubjectImageGenerationPreview } from '../types'
|
import type { GenerateFormImageInput, SubjectFormAsset, SubjectImageGenerationPreview } from '../types'
|
||||||
|
|
||||||
/** 单形态生成确认:尺寸与自定义 Prompt 只用于本次请求。 */
|
/** 单形态生成确认:尺寸与自定义 Prompt 只用于本次请求。 */
|
||||||
const props = defineProps<{ form: SubjectFormAsset | null; disabled: boolean }>()
|
const props = defineProps<{
|
||||||
|
form: SubjectFormAsset | null
|
||||||
|
disabled: boolean
|
||||||
|
catalog: GenerationModelCatalog
|
||||||
|
profile: CreativeProfile
|
||||||
|
}>()
|
||||||
const open = defineModel<boolean>('open', { default: false })
|
const open = defineModel<boolean>('open', { default: false })
|
||||||
const emit = defineEmits<{ generate: [formId: string, input: GenerateFormImageInput] }>()
|
const emit = defineEmits<{ generate: [formId: string, input: GenerateFormImageInput] }>()
|
||||||
|
const formRef = ref<InstanceType<typeof AppForm> | null>(null)
|
||||||
const prompt = ref('')
|
const prompt = ref('')
|
||||||
const width = ref<number | ''>('')
|
const provider = ref('')
|
||||||
const height = ref<number | ''>('')
|
const generationOptions = ref<GenerationOptions>({})
|
||||||
const setPrimary = ref(false)
|
const setPrimary = ref(false)
|
||||||
const acknowledged = ref(false)
|
const acknowledged = ref(false)
|
||||||
const preview = ref<SubjectImageGenerationPreview | null>(null)
|
const preview = ref<SubjectImageGenerationPreview | null>(null)
|
||||||
const previewError = ref('')
|
const previewError = ref('')
|
||||||
const previewPending = ref(false)
|
const previewPending = ref(false)
|
||||||
const dimensionsValid = computed(() => validImageSize(width.value, height.value))
|
|
||||||
|
|
||||||
/** 每次打开重新建立表单,避免把另一形态的 Prompt 或尺寸带入请求。 */
|
/** 每次打开重新建立表单,避免把另一形态的 Prompt 或尺寸带入请求。 */
|
||||||
watch(
|
watch(
|
||||||
() => [open.value, props.form?.id],
|
() => [open.value, props.form?.id],
|
||||||
() => {
|
() => {
|
||||||
prompt.value = ''
|
prompt.value = ''
|
||||||
width.value = ''
|
const selected =
|
||||||
height.value = ''
|
props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
|
||||||
|
props.catalog.images.find(item => item.enabled)
|
||||||
|
provider.value = selected?.provider ?? ''
|
||||||
|
generationOptions.value = {
|
||||||
|
...selected?.defaults,
|
||||||
|
...(selected?.provider === props.profile.imageProvider ? props.profile.imageOptions : {})
|
||||||
|
}
|
||||||
|
const sizeSchema = selected?.generationOptions.find(item => item.key === 'size')
|
||||||
|
if (
|
||||||
|
sizeSchema?.options?.length &&
|
||||||
|
!sizeSchema.options.some(option => option.value === generationOptions.value.size)
|
||||||
|
) {
|
||||||
|
generationOptions.value.size = selected?.defaults.size ?? sizeSchema.options[0]?.value ?? ''
|
||||||
|
}
|
||||||
acknowledged.value = false
|
acknowledged.value = false
|
||||||
preview.value = null
|
preview.value = null
|
||||||
previewError.value = ''
|
previewError.value = ''
|
||||||
@@ -59,31 +78,35 @@ async function loadPreview() {
|
|||||||
|
|
||||||
/** 完成前置确认后只发出一次明确的生图请求,不触发整条生产流程。 */
|
/** 完成前置确认后只发出一次明确的生图请求,不触发整条生产流程。 */
|
||||||
function submit() {
|
function submit() {
|
||||||
if (!props.form || props.disabled || !dimensionsValid.value || !acknowledged.value) return
|
if (!props.form || props.disabled || !provider.value || !acknowledged.value) return
|
||||||
emit('generate', props.form.id, {
|
emit('generate', props.form.id, {
|
||||||
setPrimary: setPrimary.value,
|
setPrimary: setPrimary.value,
|
||||||
...(prompt.value.trim() ? { prompt: prompt.value.trim() } : {}),
|
...(prompt.value.trim() ? { prompt: prompt.value.trim() } : {}),
|
||||||
...(width.value !== '' && height.value !== '' ? { width: width.value, height: height.value } : {})
|
provider: provider.value,
|
||||||
|
generationOptions: generationOptions.value
|
||||||
})
|
})
|
||||||
open.value = false
|
open.value = false
|
||||||
}
|
}
|
||||||
const formModel = computed(() => ({ width: width.value, height: height.value, prompt: prompt.value }))
|
const formModel = computed(() => ({ prompt: prompt.value }))
|
||||||
const rules = { ...sizeRules(() => formModel.value) }
|
const rules = {}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<!-- 以下是宽版形态图片生成弹窗模块,长提示词与模型参数保留完整空间 -->
|
||||||
<AppDialog
|
<AppDialog
|
||||||
v-model:open="open"
|
v-model:open="open"
|
||||||
title="生成形态图片"
|
title="生成形态图片"
|
||||||
|
wide
|
||||||
:description="`${form?.subject.name || ''} · ${form?.name || ''}`"
|
:description="`${form?.subject.name || ''} · ${form?.name || ''}`"
|
||||||
>
|
>
|
||||||
<AppForm
|
<AppForm
|
||||||
|
ref="formRef"
|
||||||
:model="formModel"
|
:model="formModel"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:reset-key="`${open}:${form?.id}`"
|
:reset-key="`${open}:${form?.id}`"
|
||||||
validate-on-change
|
validate-on-change
|
||||||
class="mt-6 space-y-5"
|
class="dialog-form-stack"
|
||||||
@submit="submit"
|
@submit="submit"
|
||||||
>
|
>
|
||||||
<NAlert type="info" :show-icon="false" class="text-xs"
|
<NAlert type="info" :show-icon="false" class="text-xs"
|
||||||
@@ -98,7 +121,7 @@ const rules = { ...sizeRules(() => formModel.value) }
|
|||||||
<span class="text-xs text-muted">只读取后端编译结果,不调用图片模型。</span>
|
<span class="text-xs text-muted">只读取后端编译结果,不调用图片模型。</span>
|
||||||
</div>
|
</div>
|
||||||
<NAlert v-if="previewError" type="error" :show-icon="false">{{ previewError }}</NAlert>
|
<NAlert v-if="previewError" type="error" :show-icon="false">{{ previewError }}</NAlert>
|
||||||
<div v-if="preview" class="panel p-4 text-xs leading-6">
|
<div v-if="preview" class="dialog-result-card text-xs leading-6">
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
<strong>{{ preview.provider }} / {{ preview.model }}</strong>
|
<strong>{{ preview.provider }} / {{ preview.model }}</strong>
|
||||||
<NTag size="small" :bordered="false">{{ preview.references.length }} 张参考图</NTag>
|
<NTag size="small" :bordered="false">{{ preview.references.length }} 张参考图</NTag>
|
||||||
@@ -147,28 +170,16 @@ const rules = { ...sizeRules(() => formModel.value) }
|
|||||||
</p></NCollapseItem
|
</p></NCollapseItem
|
||||||
></NCollapse
|
></NCollapse
|
||||||
>
|
>
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<GenerationModelControls
|
||||||
<NFormItem path="width" label="宽度(px)" :label-props="{ for: 'image-width' }"
|
type="image"
|
||||||
><NInputNumber
|
:catalog="catalog"
|
||||||
placeholder="后端默认"
|
:provider="provider"
|
||||||
:input-props="{ id: 'image-width' }"
|
:options="generationOptions"
|
||||||
:value="typeof width === 'number' ? width : null"
|
:aspect-ratio="profile.aspectRatio"
|
||||||
@update:value="width = $event ?? ''"
|
:disabled="disabled"
|
||||||
:min="1"
|
@update:provider="provider = $event"
|
||||||
:step="1"
|
@update:options="generationOptions = $event"
|
||||||
></NInputNumber></NFormItem
|
/>
|
||||||
><NFormItem path="height" label="高度(px)" :label-props="{ for: 'image-height' }"
|
|
||||||
><NInputNumber
|
|
||||||
placeholder="后端默认"
|
|
||||||
:input-props="{ id: 'image-height' }"
|
|
||||||
:value="typeof height === 'number' ? height : null"
|
|
||||||
@update:value="height = $event ?? ''"
|
|
||||||
:min="1"
|
|
||||||
:step="1"
|
|
||||||
></NInputNumber
|
|
||||||
></NFormItem>
|
|
||||||
</div>
|
|
||||||
<p class="text-xs text-muted">宽高同时留空时使用后端默认 2K;自定义尺寸须满足模型限制。</p>
|
|
||||||
<p v-if="!form?.generationPrompt" class="text-xs leading-6 text-muted">
|
<p v-if="!form?.generationPrompt" class="text-xs leading-6 text-muted">
|
||||||
未填写自定义提示词时,后端先调用文本模型补齐正式提示词,再生图;可能产生两类模型费用。原始外观素材不会直接作为最终生图提示词。
|
未填写自定义提示词时,后端先调用文本模型补齐正式提示词,再生图;可能产生两类模型费用。原始外观素材不会直接作为最终生图提示词。
|
||||||
</p>
|
</p>
|
||||||
@@ -182,16 +193,16 @@ const rules = { ...sizeRules(() => formModel.value) }
|
|||||||
class="flex items-start gap-2 text-xs leading-6"
|
class="flex items-start gap-2 text-xs leading-6"
|
||||||
>我已确认后台没有同项目的生成任务,了解本次会调用模型并产生费用。</NCheckbox
|
>我已确认后台没有同项目的生成任务,了解本次会调用模型并产生费用。</NCheckbox
|
||||||
>
|
>
|
||||||
<div class="dialog-footer">
|
|
||||||
<NButton @click="open = false">取消</NButton
|
|
||||||
><NButton
|
|
||||||
:disabled="disabled || !form || !acknowledged || !dimensionsValid"
|
|
||||||
type="primary"
|
|
||||||
attr-type="submit"
|
|
||||||
>
|
|
||||||
确认生成图片
|
|
||||||
</NButton>
|
|
||||||
</div>
|
|
||||||
</AppForm>
|
</AppForm>
|
||||||
|
<template #footer>
|
||||||
|
<NButton @click="open = false">取消</NButton
|
||||||
|
><NButton
|
||||||
|
:disabled="disabled || !form || !provider || !acknowledged"
|
||||||
|
type="primary"
|
||||||
|
@click="formRef?.validate(submit)"
|
||||||
|
>
|
||||||
|
确认生成图片
|
||||||
|
</NButton>
|
||||||
|
</template>
|
||||||
</AppDialog>
|
</AppDialog>
|
||||||
</template>
|
</template>
|
||||||
@@ -47,8 +47,8 @@ export interface SubjectFormAsset {
|
|||||||
/** 单形态生图配置;实际模型统一由后端 IMAGE 配置决定。 */
|
/** 单形态生图配置;实际模型统一由后端 IMAGE 配置决定。 */
|
||||||
export interface GenerateFormImageInput {
|
export interface GenerateFormImageInput {
|
||||||
prompt?: string
|
prompt?: string
|
||||||
width?: number
|
provider?: string
|
||||||
height?: number
|
generationOptions?: Record<string, string | number | boolean>
|
||||||
setPrimary: boolean
|
setPrimary: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,17 @@ import { ApiError } from '../../lib/http'
|
|||||||
import { useProjectContext } from '../projects/context'
|
import { useProjectContext } from '../projects/context'
|
||||||
import { getOperation, runOperation } from '../workflows/operations'
|
import { getOperation, runOperation } from '../workflows/operations'
|
||||||
import { workflowCheckpoints } from '../workflows/selectors'
|
import { workflowCheckpoints } from '../workflows/selectors'
|
||||||
|
import { useProjectGenerationRevision } from '../generation-config/context'
|
||||||
|
import { generationConfigApi } from '../generation-config/api'
|
||||||
import { subjectImagesApi } from './api'
|
import { subjectImagesApi } from './api'
|
||||||
import { getImageSession, hasRunningImages } from './model'
|
import { getImageSession, hasRunningImages } from './model'
|
||||||
import type { GenerateFormImageInput, SubjectModule } from './types'
|
import type { GenerateFormImageInput, SubjectModule } from './types'
|
||||||
|
|
||||||
|
/** 仅后台图片任务存在时开启临时轮询,终态后自动停止。 */
|
||||||
|
function queryDataHasRunningImages(forms: Awaited<ReturnType<typeof subjectImagesApi.listForms>> | null) {
|
||||||
|
return forms?.some(form => hasRunningImages(form.images)) ?? false
|
||||||
|
}
|
||||||
|
|
||||||
/** 形态图库统一读取数据库记录并管理单图/批量长请求,不调用生产流程。 */
|
/** 形态图库统一读取数据库记录并管理单图/批量长请求,不调用生产流程。 */
|
||||||
export function useSubjectImages() {
|
export function useSubjectImages() {
|
||||||
const context = useProjectContext()
|
const context = useProjectContext()
|
||||||
@@ -18,6 +25,26 @@ export function useSubjectImages() {
|
|||||||
const promptConcurrency = ref(3)
|
const promptConcurrency = ref(3)
|
||||||
const promptForce = ref(false)
|
const promptForce = ref(false)
|
||||||
const batchModule = ref<'all' | SubjectModule>('all')
|
const batchModule = ref<'all' | SubjectModule>('all')
|
||||||
|
const generationModelsQuery = usePolling(id, async (_id, signal) => generationConfigApi.catalog(signal), false)
|
||||||
|
/** 项目配置保存后重新读取实际默认参数,避免图库生图沿用旧模型。 */
|
||||||
|
const generationRevision = useProjectGenerationRevision()
|
||||||
|
/** 配置查询按项目和保存修订号隔离。 */
|
||||||
|
const profileKey = computed(() => JSON.stringify([id.value, generationRevision.value]))
|
||||||
|
/** 当前图库使用后端最新保存的项目配置。 */
|
||||||
|
const profileQuery = usePolling(
|
||||||
|
profileKey,
|
||||||
|
async (key, signal) => {
|
||||||
|
const [projectId] = JSON.parse(key) as [string, number]
|
||||||
|
return { profile: await generationConfigApi.profile(projectId, signal) }
|
||||||
|
},
|
||||||
|
false
|
||||||
|
)
|
||||||
|
const queryRef = {} as {
|
||||||
|
current?: ReturnType<typeof usePolling<Awaited<ReturnType<typeof subjectImagesApi.listForms>>>>
|
||||||
|
}
|
||||||
|
const pollInterval = computed(() =>
|
||||||
|
queryDataHasRunningImages(queryRef.current?.data.value ?? null) ? 4000 : false
|
||||||
|
)
|
||||||
const query = usePolling(
|
const query = usePolling(
|
||||||
id,
|
id,
|
||||||
async (projectId, signal) => {
|
async (projectId, signal) => {
|
||||||
@@ -35,15 +62,13 @@ export function useSubjectImages() {
|
|||||||
return forms
|
return forms
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof ApiError && error.status === 404)
|
if (error instanceof ApiError && error.status === 404)
|
||||||
throw new Error(
|
throw new Error('暂时无法读取形态图片,请稍后重试。', { cause: error })
|
||||||
'后端尚未提供形态图库查询,请更新后端 dev 并重启服务(GET /projects/:id/subject-forms)。',
|
|
||||||
{ cause: error }
|
|
||||||
)
|
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
false
|
pollInterval
|
||||||
)
|
)
|
||||||
|
queryRef.current = query
|
||||||
const forms = computed(() => query.data.value ?? [])
|
const forms = computed(() => query.data.value ?? [])
|
||||||
const operation = computed(() => getOperation(id.value))
|
const operation = computed(() => getOperation(id.value))
|
||||||
const session = computed(() => getImageSession(id.value))
|
const session = computed(() => getImageSession(id.value))
|
||||||
@@ -59,6 +84,10 @@ export function useSubjectImages() {
|
|||||||
!!context.error.value ||
|
!!context.error.value ||
|
||||||
!!query.error.value ||
|
!!query.error.value ||
|
||||||
query.data.value === null ||
|
query.data.value === null ||
|
||||||
|
!!generationModelsQuery.error.value ||
|
||||||
|
!generationModelsQuery.data.value ||
|
||||||
|
!!profileQuery.error.value ||
|
||||||
|
!profileQuery.data.value?.profile ||
|
||||||
running.value ||
|
running.value ||
|
||||||
breakdownRunning.value ||
|
breakdownRunning.value ||
|
||||||
context.project.value?.status !== 'completed'
|
context.project.value?.status !== 'completed'
|
||||||
@@ -83,7 +112,7 @@ export function useSubjectImages() {
|
|||||||
result.subjectId !== form.subjectId ||
|
result.subjectId !== form.subjectId ||
|
||||||
!result.generationPrompt?.trim()
|
!result.generationPrompt?.trim()
|
||||||
)
|
)
|
||||||
throw new Error('接口未确认正式提示词已保存,请先刷新形态记录核对。')
|
throw new Error('提示词保存结果未确认,请刷新后核对。')
|
||||||
})
|
})
|
||||||
await query.refresh()
|
await query.refresh()
|
||||||
}
|
}
|
||||||
@@ -112,19 +141,22 @@ export function useSubjectImages() {
|
|||||||
async function generate(formId: string, input: GenerateFormImageInput) {
|
async function generate(formId: string, input: GenerateFormImageInput) {
|
||||||
if (blocked.value) return
|
if (blocked.value) return
|
||||||
const form = forms.value.find(item => item.id === formId)
|
const form = forms.value.find(item => item.id === formId)
|
||||||
if (!form) return
|
if (!form || hasRunningImages(form.images)) return
|
||||||
const projectId = id.value
|
const projectId = id.value
|
||||||
await runOperation(projectId, `生成 ${form.subject.name} · ${form.name} 图片`, async () => {
|
const ok = await runOperation(projectId, `提交 ${form.subject.name} · ${form.name} 图片生成`, async () => {
|
||||||
const image = await subjectImagesApi.generate(formId, input)
|
const image = await subjectImagesApi.generate(formId, input)
|
||||||
if (!image || image.subjectFormId !== formId || image.status !== 'completed' || !image.imageUrl)
|
if (!image || image.subjectFormId !== formId || !['pending', 'generating'].includes(image.status))
|
||||||
throw new Error(image?.error || '接口未返回已完成的图片,请先刷新图片记录核对后端状态。')
|
throw new Error(image?.error || '图片生成任务未成功创建,请刷新后重试。')
|
||||||
})
|
})
|
||||||
await query.refresh()
|
if (ok) {
|
||||||
|
await query.refresh()
|
||||||
|
operation.value.notice = `${form.subject.name} · ${form.name} 已提交生成,可稍后刷新图库查看结果。`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 批量始终面向整个项目,不受页面筛选影响;force 仅新增候选图,不替换已有主图。 */
|
/** 批量始终面向整个项目,不受页面筛选影响;force 仅新增候选图,不替换已有主图。 */
|
||||||
async function generateProject() {
|
async function generateProject() {
|
||||||
if (blocked.value || !batchValid.value || !forms.value.length) return
|
if (blocked.value || running.value || !batchValid.value || !forms.value.length) return
|
||||||
const projectId = id.value
|
const projectId = id.value
|
||||||
const input = {
|
const input = {
|
||||||
concurrency: concurrency.value,
|
concurrency: concurrency.value,
|
||||||
@@ -146,6 +178,8 @@ export function useSubjectImages() {
|
|||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
forms,
|
forms,
|
||||||
|
generationModelsQuery,
|
||||||
|
profileQuery,
|
||||||
query,
|
query,
|
||||||
refreshProject: context.refresh,
|
refreshProject: context.refresh,
|
||||||
operation,
|
operation,
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||||
import DetailDisclosure from '../../components/ui/DetailDisclosure.vue'
|
import DetailDisclosure from '../../components/ui/DetailDisclosure.vue'
|
||||||
import { NAlert, NButton } from 'naive-ui'
|
import { NAlert, NButton } from 'naive-ui'
|
||||||
import { LoaderCircle, LockKeyhole, LockKeyholeOpen, Palette, RefreshCw, TriangleAlert } from '@lucide/vue'
|
import { LoaderCircle, LockKeyhole, LockKeyholeOpen, Palette, TriangleAlert } from '@lucide/vue'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { useQuery } from '../../composables/useQuery'
|
import { useQuery } from '../../composables/useQuery'
|
||||||
import { runOperation } from '../workflows/operations'
|
import { runOperation } from '../workflows/operations'
|
||||||
import { useProjectMutationGuard } from '../workflows/useProjectMutationGuard'
|
import { useProjectMutationGuard } from '../workflows/useProjectMutationGuard'
|
||||||
|
import { useProjectContext } from '../projects/context'
|
||||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||||
import { visualStyleApi } from './api'
|
import { visualStyleApi } from './api'
|
||||||
import type { AddStyleImageInput, SaveVisualStyleInput, VisualStyle, VisualStyleImage } from './types'
|
import type { AddStyleImageInput, SaveVisualStyleInput, VisualStyle, VisualStyleImage } from './types'
|
||||||
@@ -15,6 +16,7 @@ import StyleImages from './components/StyleImages.vue'
|
|||||||
|
|
||||||
/** 项目视觉风格工作区:文本编辑、锁定和风格图记录分开管理。 */
|
/** 项目视觉风格工作区:文本编辑、锁定和风格图记录分开管理。 */
|
||||||
const { projectId, blocked } = useProjectMutationGuard()
|
const { projectId, blocked } = useProjectMutationGuard()
|
||||||
|
const projectContext = useProjectContext()
|
||||||
/** 风格页仅在进入、切换项目或显式刷新时读取。 */
|
/** 风格页仅在进入、切换项目或显式刷新时读取。 */
|
||||||
const query = useQuery(projectId, async (id, signal) => {
|
const query = useQuery(projectId, async (id, signal) => {
|
||||||
const style = await visualStyleApi.get(id, signal)
|
const style = await visualStyleApi.get(id, signal)
|
||||||
@@ -26,10 +28,11 @@ const disabled = computed(() => blocked.value || !!query.error.value || !query.d
|
|||||||
const editorRevision = ref(0)
|
const editorRevision = ref(0)
|
||||||
const imageRevision = ref(0)
|
const imageRevision = ref(0)
|
||||||
const dirty = ref(false)
|
const dirty = ref(false)
|
||||||
|
const nextReady = computed(() => projectContext.stageReadiness.value?.visualStyle.ready === true)
|
||||||
|
|
||||||
/** 状态是只读说明,与操作按钮分组;读取失败不能被误报成尚未创建。 */
|
/** 状态是只读说明,与操作按钮分组;读取失败不能被误报成尚未创建。 */
|
||||||
const statusInfo = computed(() => {
|
const statusInfo = computed(() => {
|
||||||
if (query.error.value) return { label: '读取失败', hint: '请刷新重试,现有内容不会被覆盖', icon: TriangleAlert }
|
if (query.error.value) return { label: '读取失败', hint: '请重试读取,现有内容不会被覆盖', icon: TriangleAlert }
|
||||||
if (!query.data.value) return { label: '正在读取', hint: '正在获取项目视觉风格', icon: LoaderCircle }
|
if (!query.data.value) return { label: '正在读取', hint: '正在获取项目视觉风格', icon: LoaderCircle }
|
||||||
if (!style.value) return { label: '尚未创建', hint: '可使用 AI 生成,或在下方手动填写', icon: Palette }
|
if (!style.value) return { label: '尚未创建', hint: '可使用 AI 生成,或在下方手动填写', icon: Palette }
|
||||||
return style.value.isLocked
|
return style.value.isLocked
|
||||||
@@ -49,7 +52,7 @@ async function writeStyle(label: string, action: (id: string) => Promise<VisualS
|
|||||||
const id = projectId.value
|
const id = projectId.value
|
||||||
const ok = await runOperation(id, label, async () => {
|
const ok = await runOperation(id, label, async () => {
|
||||||
const result = await action(id)
|
const result = await action(id)
|
||||||
if (!result) throw new Error('后端未返回已保存的视觉风格,请刷新核对。')
|
if (!result) throw new Error('视觉风格保存结果未确认,请刷新后核对。')
|
||||||
assertProject(result, id)
|
assertProject(result, id)
|
||||||
if (projectId.value === id) {
|
if (projectId.value === id) {
|
||||||
query.data.value = { style: result }
|
query.data.value = { style: result }
|
||||||
@@ -57,7 +60,10 @@ async function writeStyle(label: string, action: (id: string) => Promise<VisualS
|
|||||||
dirty.value = false
|
dirty.value = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (ok) await query.refresh()
|
if (ok) {
|
||||||
|
await query.refresh()
|
||||||
|
await projectContext.refreshStageReadiness()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 人工保存允许修改锁定风格。 */
|
/** 人工保存允许修改锁定风格。 */
|
||||||
@@ -79,7 +85,7 @@ async function writeImage(label: string, action: (id: string) => Promise<VisualS
|
|||||||
const styleId = style.value.id
|
const styleId = style.value.id
|
||||||
const ok = await runOperation(id, label, async () => {
|
const ok = await runOperation(id, label, async () => {
|
||||||
const result = await action(id)
|
const result = await action(id)
|
||||||
if (!result || result.visualStyleId !== styleId) throw new Error('后端未确认风格图片变更,请刷新核对。')
|
if (!result || result.visualStyleId !== styleId) throw new Error('风格参考图变更结果未确认,请刷新后核对。')
|
||||||
})
|
})
|
||||||
if (ok && reset && projectId.value === id) imageRevision.value++
|
if (ok && reset && projectId.value === id) imageRevision.value++
|
||||||
await query.refresh()
|
await query.refresh()
|
||||||
@@ -120,47 +126,48 @@ function removeImage(image: VisualStyleImage) {
|
|||||||
description="调用文本模型生成整体及分类风格。重新生成会覆盖已保存的文本与硬约束;旧身份、旧图片和已有提示词不会自动更新。"
|
description="调用文本模型生成整体及分类风格。重新生成会覆盖已保存的文本与硬约束;旧身份、旧图片和已有提示词不会自动更新。"
|
||||||
@confirm="generate"
|
@confirm="generate"
|
||||||
/>
|
/>
|
||||||
<NButton
|
|
||||||
:loading="query.loading.value"
|
|
||||||
@click="query.refresh"
|
|
||||||
quaternary
|
|
||||||
class="icon-button"
|
|
||||||
aria-label="刷新风格"
|
|
||||||
title="刷新风格"
|
|
||||||
><template #icon><RefreshCw :size="16" /></template
|
|
||||||
></NButton>
|
|
||||||
<RouterLink :to="`/projects/${projectId}/subject-identity`" class="text-button"
|
|
||||||
>下一步:主体身份 →</RouterLink
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<NAlert v-if="query.error.value" role="alert" type="error" :show-icon="false" class="mb-4"
|
<template #notice>
|
||||||
>{{ query.error.value }} 请确认后端 dev 已更新并重启;查询失败不等同于尚未创建。
|
<NAlert v-if="nextReady" type="success" :show-icon="false">
|
||||||
</NAlert>
|
视觉风格已准备好,可以继续确认人物、场景和道具的主体身份。
|
||||||
<p v-if="dirty" class="mb-4 text-xs text-muted">
|
<RouterLink :to="`/projects/${projectId}/subject-identity`" class="text-button ml-2"
|
||||||
有未保存修改,AI 重生成暂不可用。刷新不会覆盖编辑内容;离开页面不会自动保存。
|
>继续主体身份 →</RouterLink
|
||||||
</p>
|
>
|
||||||
<DetailDisclosure title="风格生成规则" class="mb-5">
|
</NAlert>
|
||||||
AI
|
</template>
|
||||||
生成时,若项目和世界观没有明确其它人物背景,人物风格默认采用中国人物选角基线;人工填写的人物背景和角色事实优先。修改风格只影响之后的生成,旧资产不会自动更新。 </DetailDisclosure
|
<div class="workspace-section-stack">
|
||||||
><StyleEditor
|
<NAlert v-if="query.error.value" role="alert" type="error" :show-icon="false"
|
||||||
v-if="query.data.value"
|
>{{ query.error.value }} 当前内容读取失败;已有内容不会被覆盖。
|
||||||
:key="editorRevision"
|
<NButton text class="ml-3" :loading="query.loading.value" @click="query.refresh">重试读取</NButton>
|
||||||
:visual-style="style"
|
</NAlert>
|
||||||
:disabled="disabled"
|
<p v-if="dirty" class="mb-4 text-xs text-muted">
|
||||||
@save="save"
|
有未保存修改,AI 重生成暂不可用。刷新不会覆盖编辑内容;离开页面不会自动保存。
|
||||||
@dirty="dirty = $event" />
|
</p>
|
||||||
<p v-else-if="query.loading.value" class="py-8 text-sm text-muted" role="status">正在读取视觉风格…</p>
|
<DetailDisclosure title="风格生成规则">
|
||||||
<StyleImages
|
AI
|
||||||
:key="imageRevision"
|
生成时,若项目和世界观没有明确其它人物背景,人物风格默认采用中国人物选角基线;人工填写的人物背景和角色事实优先。修改风格只影响之后的生成,旧资产不会自动更新。 </DetailDisclosure
|
||||||
:project-id="projectId"
|
><StyleEditor
|
||||||
:images="style?.images ?? []"
|
v-if="query.data.value"
|
||||||
:disabled="disabled || !style"
|
:key="editorRevision"
|
||||||
@add="addImage"
|
:visual-style="style"
|
||||||
@toggle="toggleImage"
|
:disabled="disabled"
|
||||||
@remove="removeImage"
|
@save="save"
|
||||||
/></WorkspacePage>
|
@dirty="dirty = $event"
|
||||||
|
/>
|
||||||
|
<p v-else-if="query.loading.value" class="py-8 text-sm text-muted" role="status">正在读取视觉风格…</p>
|
||||||
|
<StyleImages
|
||||||
|
:key="imageRevision"
|
||||||
|
:project-id="projectId"
|
||||||
|
:images="style?.images ?? []"
|
||||||
|
:disabled="disabled || !style"
|
||||||
|
@add="addImage"
|
||||||
|
@toggle="toggleImage"
|
||||||
|
@remove="removeImage"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</WorkspacePage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ const constraintsDetails = ref<InstanceType<typeof DetailDisclosure> | null>(nul
|
|||||||
:model="form"
|
:model="form"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
class="panel p-5 sm:p-6"
|
class="panel workspace-panel"
|
||||||
@invalid="constraintsDetails?.expand()"
|
@invalid="constraintsDetails?.expand()"
|
||||||
@submit="save"
|
@submit="save"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { NAlert, NButton, NCollapse, NCollapseItem, NInput, NSelect, NTab, NTabs } from 'naive-ui'
|
import { NAlert, NButton, NCollapse, NCollapseItem, NInput, NSelect, NTab, NTabs } from 'naive-ui'
|
||||||
import { Download, RefreshCw, Search } from '@lucide/vue'
|
import { Download, Search } from '@lucide/vue'
|
||||||
import { AppDialog, EmptyState } from '../../components/ui'
|
import { AppDialog, EmptyState } from '../../components/ui'
|
||||||
import { usePolling } from '../../composables/usePolling'
|
import { usePolling } from '../../composables/usePolling'
|
||||||
import { downloadText, formatDate, nodeLabel } from '../../lib/format'
|
import { downloadText, formatDate, nodeLabel } from '../../lib/format'
|
||||||
@@ -96,13 +96,7 @@ function exportReport() {
|
|||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<NButton :disabled="!query.data.value" @click="exportReport"
|
<NButton :disabled="!query.data.value" @click="exportReport"
|
||||||
><template #icon><Download :size="14" /></template>导出诊断</NButton
|
><template #icon><Download :size="14" /></template>导出诊断</NButton
|
||||||
><NButton
|
>
|
||||||
class="icon-button"
|
|
||||||
:loading="query.loading.value"
|
|
||||||
aria-label="刷新运行诊断"
|
|
||||||
@click="query.refresh"
|
|
||||||
><template #icon><RefreshCw :size="16" /></template
|
|
||||||
></NButton>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="diagnostics-filters mt-5">
|
<div class="diagnostics-filters mt-5">
|
||||||
|
|||||||
@@ -0,0 +1,171 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { NAlert, NButton, NProgress, NTag } from 'naive-ui'
|
||||||
|
import { X } from '@lucide/vue'
|
||||||
|
import { formatDate } from '../../lib/format'
|
||||||
|
import { executionPercentage, executionStageLabel } from './execution'
|
||||||
|
import type { WorkflowExecution } from './execution.types'
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{ title?: string; execution: WorkflowExecution | null; loading: boolean; error: string }>(),
|
||||||
|
{ title: '制作任务' }
|
||||||
|
)
|
||||||
|
const emit = defineEmits<{ refresh: []; dismiss: [] }>()
|
||||||
|
const percentage = computed(() => executionPercentage(props.execution?.current ?? 0, props.execution?.total ?? 0))
|
||||||
|
const result = computed(() => props.execution?.result ?? {})
|
||||||
|
const statusLabel = computed(() => {
|
||||||
|
const labels = { pending: '等待开始', running: '执行中', completed: '已完成', failed: '失败' }
|
||||||
|
return props.execution ? labels[props.execution.status] : ''
|
||||||
|
})
|
||||||
|
const statusType = computed(() =>
|
||||||
|
props.execution?.status === 'completed' ? 'success' : props.execution?.status === 'failed' ? 'error' : 'warning'
|
||||||
|
)
|
||||||
|
const finished = computed(() => ['completed', 'failed'].includes(props.execution?.status ?? ''))
|
||||||
|
const videoQuality = computed(() => props.execution?.workflowName === 'video-quality')
|
||||||
|
/** 首帧质量后台任务使用独立的通过与修复失败统计,不套用普通生图字段。 */
|
||||||
|
const keyframeQuality = computed(() => props.execution?.workflowName === 'keyframe-quality')
|
||||||
|
/** 只接受后端完整的质量计数,畸形或缺失结果不显示全成功。 */
|
||||||
|
const keyframeCounts = computed(() => {
|
||||||
|
const fields = ['targetCount', 'passed', 'repairFailed', 'failed'] as const
|
||||||
|
if (
|
||||||
|
!fields.every(
|
||||||
|
field =>
|
||||||
|
typeof result.value[field] === 'number' &&
|
||||||
|
Number.isSafeInteger(result.value[field]) &&
|
||||||
|
Number(result.value[field]) >= 0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return null
|
||||||
|
const counts = {
|
||||||
|
targetCount: Number(result.value.targetCount),
|
||||||
|
passed: Number(result.value.passed),
|
||||||
|
repairFailed: Number(result.value.repairFailed),
|
||||||
|
failed: Number(result.value.failed)
|
||||||
|
}
|
||||||
|
return counts.passed + counts.repairFailed + counts.failed === counts.targetCount ? counts : null
|
||||||
|
})
|
||||||
|
/** 范围描述保留指定镜头或剧集,不把小批量误显示为全项目。 */
|
||||||
|
const scopeLabel = computed(() => {
|
||||||
|
const metadata = props.execution?.metadata
|
||||||
|
if (!metadata) return ''
|
||||||
|
const episode = typeof metadata.episodeNo === 'number' ? `第 ${metadata.episodeNo} 集` : '全项目'
|
||||||
|
const mode =
|
||||||
|
metadata.inputModeFilter === 'first_frame'
|
||||||
|
? '首帧模式'
|
||||||
|
: metadata.inputModeFilter === 'omni_reference'
|
||||||
|
? '全模态参考'
|
||||||
|
: '全部推荐模式'
|
||||||
|
if (keyframeQuality.value && typeof metadata.shotId === 'string') return `${episode} · 单镜头`
|
||||||
|
return videoQuality.value ? `${episode} · ${mode}` : episode
|
||||||
|
})
|
||||||
|
const inputPlanCounts = computed(() => {
|
||||||
|
const plans = result.value.inputPlans
|
||||||
|
if (!Array.isArray(plans)) return null
|
||||||
|
return {
|
||||||
|
firstFrame: plans.filter(plan => isInputMode(plan, 'first_frame')).length,
|
||||||
|
omniReference: plans.filter(plan => isInputMode(plan, 'omni_reference')).length
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 对持久化 JSON 做最小结构校验,避免模板依赖不可信结果字段。 */
|
||||||
|
function isInputMode(value: unknown, inputMode: string): boolean {
|
||||||
|
return !!value && typeof value === 'object' && 'inputMode' in value && value.inputMode === inputMode
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<section v-if="execution || error" class="panel mt-4 p-5" :aria-label="title">
|
||||||
|
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||||
|
<div>
|
||||||
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
|
<h3 class="text-sm font-semibold">{{ title }}</h3>
|
||||||
|
<NTag v-if="execution" size="small" :type="statusType" :bordered="false">{{ statusLabel }}</NTag>
|
||||||
|
</div>
|
||||||
|
<p v-if="execution" class="mt-2 text-xs text-muted">
|
||||||
|
{{ executionStageLabel(execution.stage) }} · 更新于 {{ formatDate(execution.updatedAt) }}
|
||||||
|
</p>
|
||||||
|
<p v-if="scopeLabel" class="mt-1 text-xs text-muted">范围:{{ scopeLabel }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<NButton
|
||||||
|
v-if="finished || error"
|
||||||
|
class="icon-button"
|
||||||
|
quaternary
|
||||||
|
aria-label="隐藏制作任务记录"
|
||||||
|
title="隐藏制作任务记录"
|
||||||
|
@click="emit('dismiss')"
|
||||||
|
><X :size="15"
|
||||||
|
/></NButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-if="execution">
|
||||||
|
<NProgress
|
||||||
|
v-if="execution.total > 0"
|
||||||
|
type="line"
|
||||||
|
:percentage="percentage"
|
||||||
|
:height="5"
|
||||||
|
:show-indicator="false"
|
||||||
|
class="mt-4"
|
||||||
|
/>
|
||||||
|
<p class="mt-3 text-xs">
|
||||||
|
<template v-if="execution.total > 0">已处理 {{ execution.current }} / {{ execution.total }}</template>
|
||||||
|
<template v-else>正在准备本次任务</template>
|
||||||
|
<template v-if="execution.currentResourceId">
|
||||||
|
· 当前镜头 <code>{{ execution.currentResourceId }}</code></template
|
||||||
|
>
|
||||||
|
</p>
|
||||||
|
<NAlert v-if="execution.status === 'running'" type="info" :show-icon="false" class="mt-3">
|
||||||
|
{{
|
||||||
|
videoQuality ? '系统会继续生成、检查并按需修复。' : '系统会继续处理剩余内容并保存已完成结果。'
|
||||||
|
}}可以离开或刷新页面,返回后会继续显示本次任务进度,请勿重复提交。
|
||||||
|
</NAlert>
|
||||||
|
<NAlert
|
||||||
|
v-else-if="execution.status === 'completed'"
|
||||||
|
:type="
|
||||||
|
keyframeQuality && (!keyframeCounts || keyframeCounts.repairFailed + keyframeCounts.failed > 0)
|
||||||
|
? 'warning'
|
||||||
|
: 'success'
|
||||||
|
"
|
||||||
|
:show-icon="false"
|
||||||
|
class="mt-3"
|
||||||
|
>
|
||||||
|
<p>本轮任务已结束,页面正在重新读取镜头资产状态。</p>
|
||||||
|
<p v-if="videoQuality" class="mt-2 text-xs">
|
||||||
|
目标 {{ result.targetCount ?? execution.total }} · 通过 {{ result.passed ?? 0 }} · 修复耗尽
|
||||||
|
{{ result.exhausted ?? 0 }} · 模型失败 {{ result.providerFailed ?? 0 }} · 提交失败
|
||||||
|
{{ result.submissionFailed ?? 0 }}
|
||||||
|
</p>
|
||||||
|
<p v-if="videoQuality && inputPlanCounts" class="mt-2 text-xs">
|
||||||
|
输入规划:首帧模式 {{ inputPlanCounts.firstFrame }} · 全模态参考
|
||||||
|
{{ inputPlanCounts.omniReference }}
|
||||||
|
</p>
|
||||||
|
<p v-else-if="keyframeQuality" class="mt-2 text-xs">
|
||||||
|
<template v-if="keyframeCounts"
|
||||||
|
>目标 {{ keyframeCounts.targetCount }} · 通过 {{ keyframeCounts.passed }} · 修复未通过
|
||||||
|
{{ keyframeCounts.repairFailed }} · 调用失败 {{ keyframeCounts.failed }}</template
|
||||||
|
>
|
||||||
|
<template v-else>后端首帧质量统计不完整,请查看任务详情并刷新核对。</template>
|
||||||
|
</p>
|
||||||
|
<p v-else-if="!videoQuality" class="mt-2 text-xs">
|
||||||
|
共 {{ result.total ?? execution.total }} · 生成 {{ result.generated ?? execution.current }} · 跳过
|
||||||
|
{{ result.skipped ?? 0 }} · 阻塞 {{ result.blocked ?? 0 }} · 失败 {{ result.failed ?? 0 }}
|
||||||
|
</p>
|
||||||
|
</NAlert>
|
||||||
|
<NAlert v-else-if="execution.status === 'failed'" type="error" :show-icon="false" class="mt-3">
|
||||||
|
<p>{{ execution.error || '制作任务执行失败。' }}</p>
|
||||||
|
<p class="mt-2 text-xs">
|
||||||
|
请先刷新相关资产状态,确认已成功的镜头;处理报错原因后,只对仍处于“可执行”的镜头重新提交。
|
||||||
|
</p>
|
||||||
|
</NAlert>
|
||||||
|
<details class="mt-3 text-[10px] text-muted">
|
||||||
|
<summary class="cursor-pointer">任务详情</summary>
|
||||||
|
<p class="mt-2 break-all font-mono">任务编号 · {{ execution.id }}</p>
|
||||||
|
</details>
|
||||||
|
</template>
|
||||||
|
<NAlert v-if="error" type="error" :show-icon="false" class="mt-3">
|
||||||
|
{{ error }}。任务可能仍在运行,请先重新读取状态;不要直接重复提交。
|
||||||
|
<NButton text class="ml-3" :loading="loading" @click="emit('refresh')">重试读取</NButton>
|
||||||
|
</NAlert>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { request } from '../../lib/http'
|
||||||
|
import type { WorkflowExecution } from './execution.types'
|
||||||
|
|
||||||
|
/** WorkflowExecution 查询接口;数据库状态是任务进度的权威来源。 */
|
||||||
|
export const workflowExecutionApi = {
|
||||||
|
get: (executionId: string, signal?: AbortSignal) =>
|
||||||
|
request<WorkflowExecution>(`/workflow-executions/${encodeURIComponent(executionId)}`, { signal })
|
||||||
|
}
|
||||||
@@ -0,0 +1,199 @@
|
|||||||
|
import { computed, onScopeDispose, reactive, ref, watch, type Ref } from 'vue'
|
||||||
|
import { usePolling } from '../../composables/usePolling'
|
||||||
|
import { workflowExecutionApi } from './execution-api'
|
||||||
|
|
||||||
|
const storagePrefix = 'short-drama:workflow-execution'
|
||||||
|
|
||||||
|
/** 同项目观察器共享真实后台句柄与活动状态,防止绕过弹窗重复付费启动。 */
|
||||||
|
interface ExecutionActivity {
|
||||||
|
/** 任务所属项目。 */
|
||||||
|
projectId: string
|
||||||
|
/** 后端实际任务编号。 */
|
||||||
|
id: string
|
||||||
|
/** 尚未取得终态时保持活动锁。 */
|
||||||
|
active: boolean
|
||||||
|
/** 同一任务取得终态后,任何迟到记录都不能使它重新活动。 */
|
||||||
|
terminal: boolean
|
||||||
|
}
|
||||||
|
/** 活动状态按项目和工作流共同隔离。 */
|
||||||
|
const executionActivity = reactive<Record<string, ExecutionActivity>>({})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查项目是否仍有已跟踪且未结束的后台任务。
|
||||||
|
* @param projectId 正式项目 ID
|
||||||
|
* @returns 是否存在活动后台任务
|
||||||
|
*/
|
||||||
|
export function hasActiveWorkflowExecution(projectId: string) {
|
||||||
|
return Object.values(executionActivity).some(record => record.projectId === projectId && record.active)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 任务阶段短标签;未知后端阶段保留原值,避免静默隐藏新能力。 */
|
||||||
|
export function executionStageLabel(stage: string | null) {
|
||||||
|
if (!stage) return '等待后端开始'
|
||||||
|
const labels: Record<string, string> = {
|
||||||
|
createProject: '初始化项目',
|
||||||
|
generateCharacter: '生成角色设定',
|
||||||
|
generateWorld: '生成世界观',
|
||||||
|
generateEpisode: '生成分集剧本',
|
||||||
|
reviewDrama: '审核剧本',
|
||||||
|
generateRewriteSuggestion: '生成改写建议',
|
||||||
|
rewrite: '改写剧本',
|
||||||
|
finishProject: '完成剧本创作',
|
||||||
|
resumeGeneration: '恢复分集剧本生成',
|
||||||
|
resumeRewrite: '恢复剧本改写',
|
||||||
|
breakdown: '拆解剧本',
|
||||||
|
storyboardRegenerate: '重生成单集镜头',
|
||||||
|
storyboardDirection: '生成导演设计',
|
||||||
|
storyboardVisualState: '生成即时状态',
|
||||||
|
keyframe_generation: '生成普通首帧',
|
||||||
|
videoPrompt: '生成视频提示词',
|
||||||
|
breakdownRetry: '重试失败拆解任务',
|
||||||
|
breakdownResumeShots: '补齐分镜镜头',
|
||||||
|
breakdownResumeStoryboard: '修复分镜绑定',
|
||||||
|
production: '准备串联生产',
|
||||||
|
prepare: '检查生产参数',
|
||||||
|
checkCharacterIdentity: '检查角色身份',
|
||||||
|
generateVisualPrompts: '补齐形态提示词',
|
||||||
|
generateStableIdentityAnchors: '补齐稳定身份锚点',
|
||||||
|
generateSubjectImages: '补齐主体参考图',
|
||||||
|
generateKeyframes: '生成并校验首帧',
|
||||||
|
generateVideoPrompts: '生成视频提示词',
|
||||||
|
generateVideos: '提交视频生成任务',
|
||||||
|
finalize: '收尾生产状态',
|
||||||
|
manualReview: '等待人工处理',
|
||||||
|
video_prompt: '生成视频提示词',
|
||||||
|
keyframe_quality: '首帧质量生成',
|
||||||
|
submitting: '提交视频候选',
|
||||||
|
generating: '生成视频',
|
||||||
|
validating: '质量校验',
|
||||||
|
repairing: '自动修复',
|
||||||
|
passed: '校验通过',
|
||||||
|
exhausted: '修复次数已用完',
|
||||||
|
provider_failed: '模型生成失败',
|
||||||
|
submission_failed: '任务提交失败',
|
||||||
|
completed: '执行完成',
|
||||||
|
failed: '执行失败'
|
||||||
|
}
|
||||||
|
return labels[stage] ?? stage
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 有总量时按真实计数展示进度;未知总量保持不确定进度。 */
|
||||||
|
export function executionPercentage(current: number, total: number) {
|
||||||
|
return total > 0 ? Math.min(100, Math.max(0, Math.round((current / total) * 100))) : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function storageKey(projectId: string, workflowName: string) {
|
||||||
|
return `${storagePrefix}:${projectId}:${workflowName}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function savedExecutionId(projectId: string, workflowName: string) {
|
||||||
|
if (!projectId || typeof localStorage === 'undefined') return ''
|
||||||
|
return localStorage.getItem(storageKey(projectId, workflowName)) ?? ''
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 跟踪一个项目最近的持久化任务;刷新页面后从本地句柄恢复,状态仍从后端读取。 */
|
||||||
|
export function useWorkflowExecution(projectId: Ref<string>, workflowName: string) {
|
||||||
|
/** 卸载后仍保存原项目返回的句柄,但不再更新已销毁的观察器。 */
|
||||||
|
let disposed = false
|
||||||
|
onScopeDispose(() => {
|
||||||
|
disposed = true
|
||||||
|
})
|
||||||
|
const executionId = ref('')
|
||||||
|
const terminal = ref(false)
|
||||||
|
watch(
|
||||||
|
projectId,
|
||||||
|
value => {
|
||||||
|
executionId.value = savedExecutionId(value, workflowName)
|
||||||
|
terminal.value = false
|
||||||
|
if (executionId.value && executionActivity[storageKey(value, workflowName)]?.id !== executionId.value)
|
||||||
|
executionActivity[storageKey(value, workflowName)] = {
|
||||||
|
projectId: value,
|
||||||
|
id: executionId.value,
|
||||||
|
active: true,
|
||||||
|
terminal: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
/** 同页面其它入口跟踪了任务时,同步句柄并读取同一后台状态。 */
|
||||||
|
watch(
|
||||||
|
() => executionActivity[storageKey(projectId.value, workflowName)]?.id,
|
||||||
|
id => {
|
||||||
|
if (id && id !== executionId.value) {
|
||||||
|
terminal.value = false
|
||||||
|
executionId.value = id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
const key = computed(() => executionId.value)
|
||||||
|
const query = usePolling(
|
||||||
|
key,
|
||||||
|
async (id, signal) => {
|
||||||
|
if (!id) return null
|
||||||
|
const targetProjectId = projectId.value
|
||||||
|
const record = await workflowExecutionApi.get(id, signal)
|
||||||
|
if (record.projectId !== targetProjectId || record.workflowName !== workflowName || record.id !== id)
|
||||||
|
throw new Error('后台任务与当前项目或工作流不匹配,请刷新核对。')
|
||||||
|
const activity = executionActivity[storageKey(targetProjectId, workflowName)]
|
||||||
|
if (
|
||||||
|
!signal.aborted &&
|
||||||
|
!disposed &&
|
||||||
|
projectId.value === targetProjectId &&
|
||||||
|
activity?.id === id &&
|
||||||
|
!activity.terminal
|
||||||
|
) {
|
||||||
|
activity.terminal = ['completed', 'failed'].includes(record.status)
|
||||||
|
activity.active = !activity.terminal
|
||||||
|
}
|
||||||
|
return record
|
||||||
|
},
|
||||||
|
computed(() => (executionId.value && !terminal.value ? 1_500 : false))
|
||||||
|
)
|
||||||
|
watch(
|
||||||
|
() => query.data.value?.status,
|
||||||
|
status => {
|
||||||
|
terminal.value = status === 'completed' || status === 'failed'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
const active = computed(() => {
|
||||||
|
const activity = executionActivity[storageKey(projectId.value, workflowName)]
|
||||||
|
return activity?.id === executionId.value
|
||||||
|
? activity.active
|
||||||
|
: !!executionId.value && (!query.data.value || ['pending', 'running'].includes(query.data.value.status))
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存任务原项目的真实句柄,只有仍查看该项目时才读取权威状态。
|
||||||
|
* @param id 后端任务编号
|
||||||
|
* @param targetProjectId 启动请求时固定的原项目 ID
|
||||||
|
* @returns 保存句柄与可用观察器刷新完成
|
||||||
|
*/
|
||||||
|
async function track(id: string, targetProjectId = projectId.value) {
|
||||||
|
if (typeof id !== 'string' || !id.trim()) throw new Error('后端未返回有效任务编号,请刷新状态,勿重复提交。')
|
||||||
|
if (!targetProjectId) return
|
||||||
|
if (typeof localStorage !== 'undefined') localStorage.setItem(storageKey(targetProjectId, workflowName), id)
|
||||||
|
if (executionActivity[storageKey(targetProjectId, workflowName)]?.id !== id)
|
||||||
|
executionActivity[storageKey(targetProjectId, workflowName)] = {
|
||||||
|
projectId: targetProjectId,
|
||||||
|
id,
|
||||||
|
active: true,
|
||||||
|
terminal: false
|
||||||
|
}
|
||||||
|
if (disposed || projectId.value !== targetProjectId) return
|
||||||
|
terminal.value = false
|
||||||
|
executionId.value = id
|
||||||
|
await query.refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 只隐藏当前观察记录,不取消后端任务。 */
|
||||||
|
function dismiss() {
|
||||||
|
if (active.value) return
|
||||||
|
delete executionActivity[storageKey(projectId.value, workflowName)]
|
||||||
|
if (projectId.value && typeof localStorage !== 'undefined')
|
||||||
|
localStorage.removeItem(storageKey(projectId.value, workflowName))
|
||||||
|
executionId.value = ''
|
||||||
|
terminal.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
return { executionId, query, active, track, dismiss }
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/** 后端持久化长任务状态;字段以 WorkflowExecution 查询接口为准。 */
|
||||||
|
export type WorkflowExecutionStatus = 'pending' | 'running' | 'completed' | 'failed'
|
||||||
|
|
||||||
|
/** 可持久化、可在刷新页面后继续观察的工作流执行记录。 */
|
||||||
|
export interface WorkflowExecution {
|
||||||
|
id: string
|
||||||
|
projectId: string
|
||||||
|
workflowName: string
|
||||||
|
status: WorkflowExecutionStatus
|
||||||
|
stage: string | null
|
||||||
|
current: number
|
||||||
|
total: number
|
||||||
|
currentResourceId: string | null
|
||||||
|
metadata: Record<string, unknown> | null
|
||||||
|
result: Record<string, unknown> | null
|
||||||
|
error: string | null
|
||||||
|
startedAt: string | null
|
||||||
|
completedAt: string | null
|
||||||
|
createdAt: string
|
||||||
|
updatedAt: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 后台任务启动接口只返回观察句柄,不把它误认为最终生产结果。 */
|
||||||
|
export interface WorkflowExecutionStart {
|
||||||
|
executionId: string
|
||||||
|
status: 'pending' | 'running'
|
||||||
|
total?: number
|
||||||
|
}
|
||||||
Loaded 100 of 136 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user