Compare commits

...
133 Commits
Author SHA1 Message Date
GJ d68f03471c feat(short-drama-agent-front): 优化分镜界面并新增弹窗手势 2026-11-18 18:50:15 +08:00
GJ b15a6011ce feat(short-drama-agent-front): 接入有限图片授权与候选修订 2026-11-18 11:52:36 +08:00
GJ f6edc4eb70 feat(short-drama-agent-front): 接入联合修订与图片费用审计 2026-11-16 17:20:18 +08:00
GJ 87427d9d43 feat(short-drama-agent-front): 接入分阶段镜头生产与摄影修订 2026-11-15 20:55:51 +08:00
GJ 1e9ef33d1d feat(short-drama-agent-front): 接入图片持续授权与视频费用审计 2026-11-13 17:59:50 +08:00
GJ 3915566994 fix(short-drama-agent-front): 优化首帧布局与来源复核 2026-11-09 16:38:47 +08:00
GJ 10e008ca10 feat(short-drama-agent-front): 接入连续性状态签收与联合审核 2026-11-09 14:40:12 +08:00
GJ 0d58dd8c53 feat(short-drama-agent-front): 补齐首帧审核与视线修订 2026-11-09 10:34:25 +08:00
GJ c7a6b12261 feat(short-drama-agent-front): 新增路由淡入淡出过渡 2026-11-08 18:15:24 +08:00
GJ 8674ba0c83 fix(short-drama-agent-front): 修复首帧当前质量展示 2026-11-07 21:58:23 +08:00
GJ 13efe5b786 feat(short-drama-agent-front): 接入独立来源复核闭环 2026-11-07 21:19:41 +08:00
GJ 7e149a10c0 feat(short-drama-agent-front): 接入空间母版恢复与修订 2026-11-07 16:38:26 +08:00
GJ c808a58a3f feat(short-drama-agent-front): 接入正式审核执行历史 2026-11-07 14:03:38 +08:00
GJ 518b630a46 feat(short-drama-agent-front): 接入首帧授权与连续性审核 2026-11-07 12:23:19 +08:00
GJ dbf97e6f98 fix(short-drama-agent-front): 优化项目操作与形态图库 2026-11-06 23:02:33 +08:00
GJ 27ee9fd4ff feat(short-drama-agent-front): 新增全局主题和左右布局切换 2026-11-06 22:07:42 +08:00
GJ db9aea1694 perf(short-drama-agent-front): 优化记录加载与工作区体验 2026-11-06 20:56:25 +08:00
GJ d0264c08ce feat(short-drama-agent-front): 接入草案、首帧证据与审核继续 2026-11-06 18:21:31 +08:00
GJ 751106985e feat(short-drama-agent-front): 接入摄影审核与首帧制作 2026-11-06 17:10:52 +08:00
GJ 3503926d62 fix(short-drama-agent-front): 完善素材准入与选角审核读取 2026-11-04 19:09:46 +08:00
GJ 75e86f7486 fix(short-drama-agent-front): 修复B01分镜与历史失败状态 2026-11-04 17:22:22 +08:00
GJ ecb0423153 fix(short-drama-agent-front): 修复图片重复提交与首帧恢复 2026-11-04 15:10:20 +08:00
GJ b88ad8770f feat(short-drama-agent-front): 完善视觉资产审核流程 2026-11-04 14:09:21 +08:00
GJ dc8bb17a23 feat(short-drama-agent-front): 接入素材预览审核并完善创作流程 2026-11-02 10:16:10 +08:00
GJ f8b0fbb8ca fix(short-drama-agent-front): 修复资产库请求与管理流程 2026-11-01 22:17:59 +08:00
GJ 41d1cfe3ed feat(short-drama-agent-front): 接入关系修复并优化配置与弹窗 2026-10-31 22:37:22 +08:00
GJ 2db8549818 fix(short-drama-agent-front): 优化拆解引导与质量规则配置 2026-10-28 19:57:02 +08:00
GJ c6ef595a8e feat(short-drama-agent-front): 接入审核人工确认与延期验证 2026-10-28 16:32:47 +08:00
GJ 5836b90934 feat(short-drama-agent-front): 适配故事规划并优化任务弹窗 2026-10-28 11:47:05 +08:00
GJ 48fce3975f fix(short-drama-agent-front): 修复代码格式检查问题 2026-10-21 17:04:02 +08:00
GJ 81d6a85260 fix(short-drama-agent-front): 优化选角抽屉与操作文案 2026-10-21 16:34:25 +08:00
GJ a8ecf37e78 fix(short-drama-agent-front): 统一剧本内容背景与角色通栏样式 2026-10-20 22:07:23 +08:00
GJ cbba366874 fix(short-drama-agent-front): 修复移动端剧集标题顶部间距 2026-10-20 19:18:07 +08:00
GJ b34dc02e39 fix(short-drama-agent-front): 修正分镜诊断状态与响应式布局 2026-10-20 13:41:37 +08:00
GJ 1da56e0d46 feat(short-drama-agent-front): 完善分镜审核与制作准备流程 2026-10-19 21:59:22 +08:00
GJ c4b43b9725 feat(short-drama-agent-front): 完善质量规则确认与中文交互 2026-10-17 22:09:28 +08:00
GJ 190333d4f9 feat(short-drama-agent-front): 同步拆解候选审核与安全提交 2026-10-17 20:18:20 +08:00
GJ cc27d463e0 fix(short-drama-agent-front): 统一全屏布局与问题处理交互 2026-10-17 17:40:39 +08:00
GJ db91a4b871 fix(short-drama-agent-front): 修复拆解进度展示与问题交互 2026-10-17 10:21:44 +08:00
GJ 3414cc8232 feat(short-drama-agent-front): 新增拆解候选与质量修订 2026-10-17 08:25:16 +08:00
GJ 49ad08a63e feat(short-drama-agent-front): 新增诊断抽屉并优化项目弹窗 2026-10-16 13:58:01 +08:00
GouJ 97dc784c8b refactor: 分镜质量诊断移至分镜 Tab 并与拆解设置解耦 2026-10-16 13:07:05 +08:00
GouJ 9254d2a789 feat: 分镜卡片单独诊断定位复用 WorkflowExecution 与确认流程 2026-10-16 13:02:22 +08:00
GouJ 82dbeda453 feat: Beat 和 Shot 增加悬停显示的独立 AI 诊断入口 2026-10-16 13:02:10 +08:00
GouJ 179be28552 fix: 历史诊断结果请求切换剧集或关闭设置后隔离迟到响应 2026-10-16 12:57:30 +08:00
GouJ c55ca5cb90 feat: 拆解设置按需展示历史镜头诊断统计与异常镜头定位 2026-10-16 12:52:57 +08:00
GouJ 4745c564ce feat: 前端接入历史动作诊断结果汇总查询 2026-10-16 12:52:46 +08:00
GouJ c95ad37427 feat: 增加历史镜头动作诊断结果汇总类型 2026-10-16 12:52:39 +08:00
GouJ 141e5fbe3c feat: 历史镜头 AI 诊断增加确认弹窗与范围预览约束 2026-10-16 12:47:44 +08:00
GouJ 98c32cd729 fix: 修复历史动作诊断启动变量 no-shadow 警告 2026-10-16 12:42:49 +08:00
GouJ 2c8487a7b2 feat: 拆解设置接入历史动作 AI 批量诊断及持久化任务进度 2026-10-16 12:36:21 +08:00
GouJ b00b3c4e77 feat: 前端接入历史动作诊断预览和批量异步执行接口 2026-10-16 12:36:08 +08:00
GouJ de616c66cf feat: 定义历史动作诊断范围预览与异步任务回执类型 2026-10-16 12:35:59 +08:00
GouJ 10ea44d26f feat: 拆解质量面板按需展示手部冲突修复候选和资产阻断原因 2026-10-16 11:03:50 +08:00
GouJ 74cc0d467f feat: 前端接入手部修复候选及版本历史查询 2026-10-16 11:03:39 +08:00
GouJ 17956316ef feat: 补充手部修复候选预览及历史类型 2026-10-16 11:03:33 +08:00
GouJ cde5322cab test: 覆盖手部诊断关闭弹窗后的迟到响应隔离 2026-10-16 10:08:23 +08:00
GouJ beb39479f2 test: 验证手部诊断按需查询与证据不足展示 2026-10-15 19:42:08 +08:00
GouJ 620b4b1aea fix: 手部诊断关闭弹窗或切换项目后忽略过期响应 2026-10-15 19:42:00 +08:00
GouJ 5d9cbe1ba0 fix: 手部质量诊断改为显式点击查询避免设置弹窗产生额外请求 2026-10-15 19:40:55 +08:00
GouJ c17c7533b4 feat: 拆解设置面板按需展示手部动作证据覆盖与冲突定位 2026-10-15 19:38:35 +08:00
GouJ 4db23d2288 feat: Breakdown API 接入手部占用质量诊断只读查询 2026-10-15 19:38:22 +08:00
GouJ 0b789dbb85 feat: 定义 Breakdown 手部动作质量诊断类型 2026-10-15 19:38:15 +08:00
GouJ 496cdbfd35 style: 精简新建剧本表单移除冗余常驻提示 2026-10-15 18:39:58 +08:00
GouJ 1c8ff7428f feat: 优化分镜时长状态区响应式布局与局部加载反馈 2026-10-15 18:24:24 +08:00
GouJ 5794906870 test: 验证重生成后预算与审计重新读取 2026-10-15 18:22:36 +08:00
GouJ 587685fab3 feat: 分镜重生成后刷新时长预算并隔离过期响应 2026-10-15 18:22:28 +08:00
GouJ 1b189228ce test: 更新分镜页面时长预算新增 GET 后的请求计数断言 2026-10-15 18:21:14 +08:00
GouJ c456bf6865 test: 为分镜页面新增的时长预算请求补充明确 Mock 2026-10-15 18:19:29 +08:00
GouJ 58337382b9 fix: 分镜时长预算响应缺少 episodes 时避免运行时异常 2026-10-15 18:19:23 +08:00
GouJ 5bed0ad9fe fix: 创建剧本表单将主题与风格相邻并整理时长配置顺序 2026-10-15 18:19:16 +08:00
GouJ 7e1ad74716 feat: 分镜设计工具栏展示单集目标 Beat Shot 时长与容差 2026-10-15 18:16:12 +08:00
GouJ aadcc59d60 fix: 修复项目列表新建剧本按钮在页面右侧被裁切 2026-10-15 18:14:35 +08:00
GouJ 081b493b43 fix: 修复剧本时长展示的 ESLint 严格相等检查 2026-10-15 18:14:32 +08:00
GouJ 399ce83d67 feat: 剧集目录与正文标题展示单集目标时长 2026-10-15 18:11:09 +08:00
GouJ bf09e44dd5 feat: 剧本创作页面展示整剧时长模式与目标 2026-10-15 18:11:03 +08:00
GJ a9370cdf50 fix(short-drama-agent-front): 修复测试警告与请求模拟 2026-10-15 18:10:19 +08:00
GJ 46f54548c7 fix(short-drama-agent-front): 修复页面测试路由警告 2026-10-15 18:04:08 +08:00
GouJ ddc9468bc4 feat: 创建剧本时长表单增加固定集数预览及输入边界校验 2026-10-15 17:54:55 +08:00
GouJ ae6b6cb399 test: 修复工作台 ProjectDetail fixture 缺少时长预算字段 2026-10-15 17:51:36 +08:00
GouJ 15f3556cb2 test: 更新新建剧本请求断言为 Duration Budget Auto 结构 2026-10-15 17:49:37 +08:00
GouJ bda836dbed fix: 新建剧本弹窗移除强制 MessageProvider 依赖并恢复独立挂载测试 2026-10-15 17:46:48 +08:00
GouJ 38d88152c1 test: 补齐 ProjectDetail 测试对象的时长预算字段 2026-10-15 17:43:53 +08:00
GouJ 477b6226b9 test: 补齐 ProjectDetail 测试对象的时长预算字段 2026-10-15 17:43:51 +08:00
GouJ f0a2e56fd7 test: 补齐 ProjectDetail 测试对象的时长预算字段 2026-10-15 17:43:48 +08:00
GouJ 7ed9c6467a test: 补齐 ProjectDetail 测试对象的时长预算字段 2026-10-15 17:43:45 +08:00
GouJ 62d8465d0e test: 补齐 Duration Budget 新增字段的前端测试数据 2026-10-15 17:42:02 +08:00
GouJ ecbe8c2676 test: 补齐 Duration Budget 新增字段的前端测试数据 2026-10-15 17:42:00 +08:00
GouJ 27605760e2 test: 补齐 Duration Budget 新增字段的前端测试数据 2026-10-15 17:41:57 +08:00
GouJ a5025b4975 test: 补齐 Duration Budget 新增字段的前端测试数据 2026-10-15 17:41:53 +08:00
GouJ 575b585179 test: 补齐 Duration Budget 新增字段的前端测试数据 2026-10-15 17:41:50 +08:00
GouJ f93e4bf41a test: 补齐 Duration Budget 新增字段的前端测试数据 2026-10-15 17:41:47 +08:00
GouJ f10f9d8dce fix: 修正时长表单动态校验与数字输入类型 2026-10-15 17:39:53 +08:00
GouJ 6f9dfd9e8b feat: 新建剧本弹窗接入 Auto 固定与弹性时长规划 2026-10-15 17:39:45 +08:00
GouJ 644e50e76d feat: 定义前端 Duration Budget 汇总与时长偏差类型 2026-10-15 17:39:28 +08:00
GouJ 622fe8ddf9 feat: 前端项目 API 接入 Duration Budget 汇总查询 2026-10-15 17:39:20 +08:00
GouJ 6cac865e99 feat: 前端项目类型支持三种 Duration Budget 模式及后端预算字段 2026-10-15 17:39:14 +08:00
GJ fa76165960 feat(short-drama-agent-front): 接入人工动作修订与视频版本权限 2026-10-14 13:44:02 +08:00
GouJ 7a60db3ced feat: 同步动作与首帧编辑能力并统一工作区反馈
接入动作时间轴、密度审计、人工视线目标和后台首帧编辑;独立读取已保存提示词,并在首帧晋升前重新核对持久化质量状态。
统一 NMessage 结果反馈、局部 loading 和业务说明间距,保留真实长任务进度与部分失败语义。
验证:pnpm check(49 个文件、393 项测试)、pnpm build;当前环境无法完成 localhost 浏览器验收及真实后端联调。
2026-10-12 20:05:03 +08:00
GJ 83482a70c5 fix(short-drama-agent-front): 显示首帧警告镜头并支持定位刷新 2026-10-12 19:02:29 +08:00
GouJ 383c4f2308 feat: 分镜页面展示当前剧集的非阻断时长预警 2026-10-12 18:57:15 +08:00
GouJ 7997c4aa1b feat: 前端增加分镜时长审计只读接口类型 2026-10-12 18:57:02 +08:00
GJ ee5e49957a feat(short-drama-agent-front): 支持母版复用并优化生成交互 2026-10-12 15:22:03 +08:00
GouJ 49fb9c7a27 fix: 主体图片预览防止形态提示词和模型参数切换后显示旧结果 2026-10-12 11:13:00 +08:00
GouJ 8c14efcfe4 fix: 主体图片预览使用当前自定义提示词与模型参数 2026-10-12 11:07:58 +08:00
GouJ b216a11f23 fix: 主体图片预览接口传入当前生成参数 2026-10-12 11:07:50 +08:00
GJ 1fba14da5d fix(short-drama-agent-front): 修复视频素材布局与展示顺序 2026-10-12 11:04:32 +08:00
GJ 3d2c198e52 feat(short-drama-agent-front): 优化身份管理与镜头素材布局 2026-10-11 21:41:56 +08:00
GJ dd0bd79a35 feat(short-drama-agent-front): 完善主体身份骨架屏与交互反馈 2026-10-11 17:23:14 +08:00
GouJ 5fa1c251a9 fix: 首帧预览防止镜头和模型切换后展示过期审计结果 2026-10-11 17:18:17 +08:00
GJ 519b956808 feat(short-drama-agent-front): 新增视觉风格骨架屏并优化参考图添加 2026-10-11 00:01:24 +08:00
GJ 3cc65aa056 feat(short-drama-agent-front): 新增剧本骨架屏并优化阅读导出 2026-10-10 23:12:59 +08:00
GJ 54a381ebd3 perf(short-drama-agent-front): 优化制作工作台交互与移动端布局 2026-10-10 19:28:47 +08:00
GouJ b5eaed3981 feat: 首帧生成预览展示非阻断规格预警及建议 2026-10-10 19:13:39 +08:00
GouJ f3d8aee311 feat: 首帧生成预览补齐规格一致性审计类型 2026-10-10 19:13:30 +08:00
GouJ f0374c7e9b fix: 修复首帧卡片多余闭合标签导致 Vue 编译失败 2026-10-10 14:00:28 +08:00
GouJ c5853b9d4c feat: 候选校验历史改为独立弹窗查看 2026-10-10 13:59:03 +08:00
GouJ 769299df02 feat: 首帧校验历史支持弹窗打开后直接读取 2026-10-10 13:58:54 +08:00
GouJ fd42d30bfe feat: 首帧卡片增加查看校验历史入口并移除内嵌区域 2026-10-10 13:58:48 +08:00
GouJ 43161afaa6 fix: 首帧校验历史直接嵌入候选卡片内部 2026-10-10 13:53:03 +08:00
GouJ 9b5767c023 feat: 首帧卡片支持内嵌质量复核区域 2026-10-10 13:52:49 +08:00
GouJ 1dd9007d97 fix: 补齐主首帧持久化质量查询依赖导入 2026-10-10 13:42:08 +08:00
GouJ 0b5cc9c7ef feat: 视频生成按钮使用主首帧持久化质量状态门禁 2026-10-10 13:41:58 +08:00
GouJ c00898017d fix: 视频生成按钮不再依赖易过期的会话质量结果 2026-10-10 13:39:50 +08:00
GouJ 4db6463329 feat: 首帧审核完成同步刷新候选卡片质量状态 2026-10-10 13:35:45 +08:00
GouJ 6b845924cf feat: 首帧卡片读取持久化质量状态并区分人工接受 2026-10-10 13:35:37 +08:00
GouJ e032dac0fd feat: 首帧候选与人工复核按卡片分组展示 2026-10-10 13:32:59 +08:00
GouJ 81a8c7af71 feat: 首帧候选弹窗接入人工复核与资产刷新 2026-10-10 13:13:15 +08:00
GouJ 105e461a5c feat: 首帧校验历史支持人工接受拒绝与安全预检查 2026-10-10 13:10:06 +08:00
GouJ 7a82a62242 feat: 前端接入首帧人工接受预检查及审核提交接口 2026-10-10 13:09:53 +08:00
GJ 112ff719ce fix: 同步串联生产视频参数与数量限制 2026-10-10 13:08:11 +08:00
GouJ a85a740cd5 feat: 首帧校验历史展示视线证据分歧与人工审核状态 2026-10-10 13:04:46 +08:00
GouJ a8165fce3c feat: 前端增加首帧人工复核状态只读接口与类型 2026-10-10 13:04:36 +08:00
462 changed files with 70469 additions and 4880 deletions

No files matched your search

+158
View File
@@ -0,0 +1,158 @@
# 项目协作规范
## 默认分支与工作目录
- 新增功能、新增文件、修复问题和重构,默认全部在本项目根目录的 `dev` 分支进行。
- 开始修改前先确认当前分支。若不在 `dev`,应保留现有修改并安全切换到 `dev`,不得丢弃或覆盖用户已有工作。
- 不创建新的 Git worktree,不在 `worktree`、`worktrees`、`.worktree` 或 `.worktrees` 目录中新增或修改文件。
- 不因技能、模板或默认隔离流程而创建工作树;本规则覆盖此前“新功能在 worktree 中开发”的项目约定。
- 已有工作树仅在用户要求迁回改动时作为只读来源;迁回后在项目根目录的 `dev` 分支继续修改和验证。
- 未经用户明确要求,不提交代码、不推送、不切换或合并到其他发布分支。
## 开发与验证
- 尽量使用中文沟通,沿用项目现有的 Vue 3、TypeScript、Tailwind CSS 和 pnpm 约定。
- 新增或修改的函数、类型、响应式状态及页面模块需要中文注释;函数有参数或返回值时补充 `@param`、`@returns`。
- 无参数、无返回值的函数使用 `/** 描述 */`;类型及其字段分别注释,`ref`、`computed`、`defineProps`、`defineEmits` 等也要说明用途;Vue 模板中的功能模块之间换行并添加中文模块注释。
- 超过两个位置使用的相同功能或组件,应抽成公共方法或组件。
- 页面和交互验证使用本地 Chrome,地址使用 `localhost`,禁止使用 Playwright;已有对应测试标签页时复用它。
- 以真实接口和后端契约为准,不用占位数据或其他功能代替缺失能力。
- 根据后端新增或重构前端功能前,先核对真实路由、请求参数、返回结果、服务逻辑和接口文档;不能只补类型而遗漏页面流程。缺少契约且无法确认时明确说明,不猜测或用其他功能代替。
- 提交代码时遵循项目的 Conventional Commits 规范,使用中文描述;提交前先检查实际差异。
## 全局页面与交互规范
以下规则是用户长期确认的项目要求,适用于后续所有新增、修改和重构的页面、弹窗及抽屉。换窗口后也应直接沿用,不等待用户再次指出同类问题。
### 整体协调与公共实现
- 修改前先查看所在完整页面、相邻模块及已有公共组件,同时考虑整体协调、元素间距和功能一致性,不能只修改截图中的一个局部而忽略其他状态。
- 同类布局、按钮、状态色、关闭入口和交互流程保持一致;发现本次改动涉及的同类问题时,一并修正相关公共组件或当前功能中的使用位置。
- 优先复用 `src/components/ui` 中的公共组件、`src/styles/admin.css` 中的设计变量和现有主题配置;公共问题在公共层解决,避免各页面重复覆盖或硬编码颜色、尺寸。
- 所有折叠、展开和历史详情区域统一使用 Naive UI 的 `NCollapse`、`NCollapseItem` 等组件,不再使用原生 `details`、`summary` 或自制折叠控件;修改同类区域时同步统一现有实现。
- 维持项目现有简洁、扁平的视觉风格。用标题、简短说明、留白和对齐区分普通功能区域,避免无意义的底色、边框和装饰线。
- 页面文案保持精简,说明应帮助用户理解当前操作;不把大量错误、技术细节和重复提示堆在设置页面。
### 面向普通用户的文案
- 默认使用者不了解软件开发。页面、弹窗、按钮、说明、校验、空状态和错误提示不得直接描述“前端做什么”“后端做什么”,应说明当前结果、影响和下一步操作。
- 英文技术术语优先改成易懂的中文,例如 `Checkpoint` 用“保存记录”、`Storyboard` 用“分镜”、`Prompt` 用“画面描述”或“提示词”、`Thinking` 用“深度思考”。不要把内部字段名、错误码、任务标识直接作为主要说明。
- 接口返回的系统提示也需要在展示层转换为可读中文;错误详情只提取有助于操作的业务原因,不把调试对象、堆栈或整段原始数据直接输出给用户。原始错误和错误码保留在数据层,不改动业务判断依据。
- 只调整展示文案,不翻译或改写请求字段、枚举值、接口地址、用户创作的剧本与提示词正文、文件名、自定义名称或模型品牌。分类等内部值使用中文选项展示,提交仍保留真实取值。
- 用短句直说结果和下一步。同一个意思只写一次;标题和按钮已说明用途时,删掉重复说明。提示一行能说清就不写成段落,必需的限制和费用信息要保留。
- 导航只显示名称。禁用原因放到可通过悬停和键盘聚焦查看的提示里,菜单行高保持一致。
- 问题提示放在能直接处理它的页面。素材图库不常驻展示下游镜头的生产警告和列表;从镜头主动定位素材时,只保留定位所需的信息与返回入口。普通浏览不发仅供该定位使用的全项目检查请求。
- 费用、覆盖、删除、适用范围与待审核限制必须保留并说清楚,不能为了简化文字改变功能含义。无法确认的能力不要用容易误解的描述代替。
- 日常操作先展示中文业务摘要;排查用的原始技术数据保留在数据层、专用排查入口或显式导出中,不能仅以“高级详情”为名把整段接口响应搬进普通弹窗。同一弹窗的操作统一放入公共 `footer`,避免正文操作与默认关闭按钮重复。
- 所有页面、弹窗和抽屉首屏优先显示当前结果、待处理事项、主要输入和操作;流程解释与历史长说明放到 info、二级详情或默认收起的区域。普通详情也只展示明确需要的中文业务字段,不展示无助于决策的接口对象、整段 JSON、内部字段、任务编号或指纹;不能因为接口返回某个字段就把它加入界面。费用、来源冲突、覆盖和正式采用限制仍须在操作处清楚显示。
- 重要内容较多时复用主题中的中性背景分组,区分当前事实、规划和操作风险;背景不能暗示尚未取得的审核通过。
### 全屏抽屉与关闭入口
- 新建剧本、项目全局配置、拆解设置、拆解问题等已确认使用全屏的界面统一复用 `AppDrawer`。后续同类复杂表单、设置和问题处理界面默认沿用全屏抽屉;简短确认或轻量提示仍可使用 `AppDialog`。
- 全屏必须同时覆盖容器与正文:内容使用可用的完整宽度,不能只把外壳放大而保留原弹窗的固定宽度或居中最大宽度。
- 标题区和底部操作区固定,只有正文独立滚动。长内容不能把关闭或提交按钮挤出视口,也不能产生页面与抽屉重复滚动。
- PC和移动端弹窗、抽屉的头部与底部均不使用border分隔正文;footer不使用box-shadow,header默认也不显示阴影,仅当正文向下滚动、顶部有内容被遮挡时显示更淡的主题阴影,回到顶部即隐藏。监听实际正文滚动容器,重新打开时清除旧状态;保持固定区域的背景和堆叠顺序,阴影不能遮挡正文或交互入口。
- 手机端公共弹窗与全屏抽屉统一复用底部浮动面板,顶部横条支持按住向下拖动关闭,仅手柄区域接收关闭手势,正文正常滚动。轻触、短拖及取消手势保持展开;保留关闭按钮和键盘入口,提交期间包括拖动在内的关闭方式均须锁定,切换布局或重新打开时清除旧手势状态。
- 底部浮动面板沿用项目直角样式,顶部不增加border-radius;只有正文滚动后的header使用淡阴影,footer保持无阴影、无分隔边框。
- 移动端弹窗和抽屉的footer按钮需占满内容宽度:单个按钮铺满整行,多个按钮等宽分配并铺满每一行,中间仅保留统一的小间隙;长标签宽度不足时允许按钮换行。复用公共底栏样式,保留按钮文字及提交锁;PC端保持原底栏布局。
- PC和移动端公共弹层footer按钮高度统一为组件原始 `--n-height` 的1.2倍,字号保持原样;复用公共CSS,不在业务页面再次叠加放大。
- 抽屉标题、说明、正文和底栏左右边界统一。复用公共抽屉的桌面、移动端内边距;正文 `padding-top` 保持为 `0`,不要额外叠加顶部空白。
- PC和移动端弹窗、抽屉的header标题最多显示一行,超出可用宽度以省略号显示;复用 `app-panel-title`,完整标题保留在原文、可访问名称及title提示中。标题可收缩,状态图标、说明入口和关闭按钮保持可见;副标题与正文继续按各自规则展示。
- 所有弹窗和抽屉底部至少保留一个可见的“关闭”或“取消”按钮,不能只有右上角叉号。底部操作使用公共组件的 `footer` 插槽,避免正文末尾再放一套底栏或重复关闭按钮。
- 关闭、取消统一为灰色底面和中性文字的普通按钮,不使用绿色主按钮;右上角关闭图标的尺寸、底色与交互反馈也统一复用公共样式。
- 提交期间按真实业务状态防止重复操作及意外关闭;普通只读加载不能无故阻止用户关闭。关闭、切换或定位后,不回填已失效的异步结果。
### 布局、说明与间距
- 页面外边距、模块间距优先复用 `--app-content-padding`、`--app-content-gap`;表单与抽屉内部复用对应公共组件的间距,不在各页面随意添加不同数值。
- 区分功能组间距与组内间距:未使用交替底面的独立功能组可复用 `workspace-section-stack-spacious`(两倍模块间距),组内复用普通模块间距;字段之间使用 `workspace-form-stack` 的16px,标签到控件为8px。同类区域只能使用同一套间距,不叠加默认 margin、padding 和 gap,也不把每个按钮都当成独立大分区。
- 同级折叠列表复用 `workspace-collapse`,收起时统一44px行高;首项、后续项及相邻折叠组不能因组件默认样式出现忽大忽小的空白。展开正文统一内边距,仍保留完整内容和输入状态。
- **表单字段间距为强制要求**:页面、弹窗、抽屉中的标签不能紧贴输入框、下拉框或选择组;自定义字段默认使用 `--app-field-label-gap`(8px),相邻字段默认使用 `--app-field-gap`(16px)。紧凑布局和移动端也不得取消这些必要间距,除非用户明确要求调整。
- 自定义的“标签 + 控件”优先复用 `src/styles/admin.css` 中的 `workspace-form-field`,使用真实的纵向 Flex/Grid `gap`;成熟表单继续复用 `AppForm` / `NFormItem` 的公共排版。禁止仅给行内 `span` 套 `space-y-*` 或垂直 margin 后,就认定标签间距已经生效。
- 修改表单布局时必须核对同模块的全部同类字段,保证同排标签、控件分别对齐;图片与表单并排时,图片标题和字段标签必须复用同一纵向间距值,图片与首排控件的上沿必须对齐;在本地 Chrome 检查桌面、窄屏及必要的加载/校验状态,确认实际留白生效后才算完成。
- 同级模块使用一致的标题、说明、字段间距和上下留白。需要说明时采用“模块标题 + 一句简短说明”,例如画布设置、图片配置、视频配置、动作与物理规则;优先复用 `WorkspaceSectionHeading`。
- 页面、弹窗和抽屉中的同级模块共用左右边界。普通分区直接对齐;需要突出一组内容时,优先用已有的中性背景包住整组内容。背景外沿与相邻模块对齐,组内使用统一内边距,避免透明容器单独缩进。
- 新建剧本等长表单默认每个字段单独占一行并铺满内容宽度;不因改成全屏就自动把原来的字段挤成两列。
- 图片、视频等已有明确分组的并列模块可以保留协调的分栏,窄屏改为单列;同一行的标签、控件及操作必须分别对齐,不能因说明或校验消息出现而上下错位。
- 行内按钮按输入控件本身的基线对齐,不能按包含标签的整块区域垂直居中。动态例外行中的移除按钮与输入框底部对齐,使用 `Trash2` 等现有图标,不再显示“移除”文字,并提供可访问名称。
- 项目生成配置等普通表单分区不铺大块背景色,使用标题、说明和统一间距组织;常规错误沿用中性底色,只有明确的严重错误或通过检查的成功状态才使用对应状态底色。
### 长文本与多功能块布局(默认模板)
- **适用范围**:后续新增或优化页面、弹窗、抽屉时,遇到多段长文本与状态、历史、编辑、预览或确认操作混排,默认沿用当前摄影草案审核的布局;适用于全项目同类界面,不限于分镜或摄影功能。简单提示、短表单及单一剧本正文继续使用适合其内容的简洁布局。
- **先按功能分组**:将概况、正式内容与历史、编辑、差异、预览和确认等实际存在的功能分别组织成块。首屏突出主要信息与操作,历史和次要说明按需展开;相关按钮、状态和说明归入对应功能块。
- **统一序标标题**:独立功能块使用“罗马数字 I、II、III… + 标题”,复用 `WorkspaceSectionHeading` 的 `marker`。按可见块依次编号,条件区域隐藏时不跳号;字段、普通说明及嵌套详情不重复编号。序标仅表示阅读顺序,执行进度、质量与费用状态仍分别表达。
- **统一交替底色**:外层复用 `workspace-section-stack workspace-numbered-sections`,每块复用 `workspace-numbered-section`。两种中性底色均须与页面或弹窗背景区分,同时保持输入控件清晰可辨。功能块连续排列,块间不留额外 gap、margin 或装饰线,以底色表达边界。
- **同级严格对齐**:所有功能块使用相同内边距,序标、标题和同类正文各自共用左边线。标题与正文放在同一个功能块内,不因某块另套卡片而单独缩进。桌面块内边距20px,手机复用 `--app-content-padding`;正文避免再嵌套一层同色背景和重复内边距。
- **块内保持阅读间距**:去掉的是功能块之间的额外空白。组内说明与操作沿用公共模块间距;字段复用 `workspace-form-stack` 的16px,标签到控件保留8px。折叠列表复用 `workspace-collapse`,统一44px收起行高及展开正文间距。普通辅助按钮保持就地宽度,避免拉伸为整条灰色区域。
- **控制长文行宽与高度**:关联的长文编辑字段可在宽屏分栏、窄屏单列,标签和控件上沿对齐;列内字段间距不受另一列内容高度影响。复用 `workspace-prose-input` 的字号和行距、有界自动高度及必要的内部滚动,完整原文保持可查看、可编辑,不裁剪或改写创作内容。
- **复用与验收**:优先参考 `ShotDerivedReview.vue`、`JointDraftReviewPanel.vue` 及公共样式增量实现。保留原有历史、来源、费用和确认条件;在本地 Chrome 核对桌面、手机、长内容、折叠展开、序号变化、标题对齐、交替底色、内容滚动和固定底栏后交付。
### 图片列表与详情浮层
- 图片列表使用可用内容宽度,复用公共网格;不能因固定最大宽度在大屏右侧留下整片可利用的空白。图片以紧凑缩略图展示,少量图片不无限拉伸成巨图;窄屏按可用宽度调整列数。
- 同一图片列表的卡片高度一致,操作区对齐。长名称、模型名、历史错误和说明不能撑高某一项;完整信息仍可通过详情查看,不能为了等高截掉必要内容。
- 图片卡片的信息顺序统一为“图片 → 状态标签 → 图片名称 → 日期时间 → 操作”。名称必须可识别,不能只显示日期;无独立名称时可使用镜头名称和稳定展示序号,不覆盖用户名称或写回资产。
- 标签放在名称上方,标签、名称和操作之间保持紧凑且一致的间距;不要为未出现的第二行标签预留空白。卡片等高依靠网格与操作区对齐,不依靠给短内容增加大块空白。
- 列表先展示主要状态与名称;尺寸、型号、完整历史、可修复错误和技术说明放在 info 或二级详情。影响当前执行的费用风险、来源冲突和采用限制仍在对应操作处显示,不能全部藏进图标。
- 弹窗、抽屉和滚动区域中的提示及详情浮层必须避开容器裁切:优先复用公共组件,Naive UI `NPopover` 明确使用 `:to="true"` 挂到页面浮层,并启用边缘自动翻转;不能只提高 `z-index` 掩盖父容器的 `overflow` 问题。
- 浮层宽度不得超出当前视口,计入内边距并保留屏幕边距。长模型名、连续字符和长说明必须换行;长详情限制高度并允许内部滚动,不能横向裁切正文或遮住必要操作。
- 同一按钮的详情打开后,停用重复的悬浮操作说明,避免提示覆盖详情标题或正文;保留按钮的可访问名称与键盘操作。信息浮层不能触发生成、保存、审核或采用。
### 按钮、图标与状态颜色
- 绿色背景、白色文字用于保存、提交、开始生成等主要执行操作;关闭、取消和普通辅助操作使用中性样式。
- 普通请求失败、表单校验、审核未通过和可修复问题默认使用中性底面,配合短文字、图标或细线提示。红色底面只用于明确需要立即关注的严重错误,例如任务中断且可能重复计费。保留深浅主题对应的柔和状态色。
- 普通镜头定位使用中性提示。从明确问题定位时,可加细线标记;正文刷新后清除旧标记。
- 错误入口按钮使用中性底面,文字、图标和焦点保留错误语义。默认、悬停、按下和聚焦时保持清晰的键盘焦点与状态反馈。
- 只有执行完成且结果明确通过校验时,成功任务区域才使用柔和浅绿背景。执行结束但校验失败、质量待审或结果未确认时,不能显示成绿色成功状态,也不能用满格绿色进度条暗示业务成功。
- 卡片内的定位、复查、修订和历史入口使用带图标、独立中性底面的按钮,不添加边框,不能与说明文字混在一起;复用 `workspace-action-button` / `workspace-action-group`,不把辅助操作改成绿色主按钮。
- 工具栏中相邻按钮保持一致的高度、内边距、图标大小和间距。问题入口使用图标加文字;分镜结构校验失败时文案为“分镜校验未通过”,其他问题按真实类型命名。
- 移动端的工具栏操作优先只显示图标,保留完整的 `aria-label`、提示文本和足够点击区域;普通表单的底部关闭、取消、提交按钮仍保留文字。
- 仅显示单个图标的操作按钮统一使用正方形,图标居中,并使用 Naive UI `NPopover` 展示完整操作名称;优先复用 `WorkspaceActionTooltip`,保留对应 `aria-label`,相邻按钮尺寸和间距一致。
- 按钮已显示完整文字时,不再重复添加同名悬浮提示;桌面有文字、移动端仅图标的响应式按钮,仅在隐藏文字的屏幕尺寸下启用 `NPopover`。桌面仍为纯图标的按钮继续保留提示。
- 诊断结果卡片的定位、可选 AI 复查、修订及历史按钮在移动端也保留图标和完整文字,宽度不足时自动换行,不套用顶部工具栏仅显示图标的规则。
- 页面左侧汇总状态在运行、成功、失败等状态下均有意义,应保留;右侧操作入口负责打开对应处理界面,避免把状态展示和操作混成重复文案。
### 设置、问题处理与任务进度
- 拆解设置与问题处理分开:设置界面负责模块选择、分组预览、启动拆解、候选确认与提交;问题界面负责错误查看、分镜定位、人工修订、读取修复清单及阶段恢复。
- 普通目录浏览不增加无必要的勾选框;多选只在用户主动进入的批量操作中提供。进入页面或刷新时不自动弹出生成配置,不自动提交生成;配置由明确的操作入口打开。
- 质量规则确认以服务端 revision、fingerprint、confirmed 和独立 confirm 接口为准,不能用 LocalStorage 或格式版本 policy.version 代替。规则保存携带 expectedRevision,拆解启动携带本次已确认修订;候选提交预检查必须包含 qualityPolicyMatches。
- 首次拆解前只确认表现方式、动作许可和自定义规则,不显示精确动作例外的空白编辑行。已有例外可只读核对,隐藏输入不能清空已有规则或在保存时覆盖后来新增的例外。
- 新增精确动作例外统一放在拆解后的问题修订中,从当前版本的真实冲突证据自动带入角色、部位或物品及动作,用户填写允许原因。证据缺失时不能猜测或用其他镜头代替;按后端实际范围说明影响,保存例外不能直接标记质量通过。
- 不在拆解设置中重复堆放详细错误列表和修复说明;问题按剧集、节拍、镜头分组并去重,保留后端原始问题及可定位位置。
- 从问题界面定位正文时,先关闭抽屉,等离场和焦点约束释放后再定位,不能同时叠加两个主界面。
- 后端从其他入口启动或重新执行任务时,前端也应发现任务并显示真实运行阶段、进度、作用范围及更新时间;重新进入页面后能够恢复观察,不能只依赖前端本次点击形成的加载状态。
- 执行状态与质量校验结果分别表达,不能把“执行完成”直接等同于“校验通过”;没有真实进度或结果时明确显示待确认,不伪造百分比。
- 已修订且当前审核通过的镜头,不因未运行或过期的独立 AI 诊断再次列为“需处理”。AI 复查单独作为可选项,只有当前明确冲突或实时结构化问题才提示修复;复查入口受限不能直接解释为正式分镜需要重拆。
- 默认收起的“高级检查详情”只保留必要的检查记录和当前复查范围,不再单独展示旧手部覆盖率或未填写手部记录;缺少记录使用中性说明,不作为错误,实际检出的动作冲突仍在普通问题区域展示。
- 拆解执行中暂不显示“查看诊断”等需要稳定结果的入口。问题可以只读查看,但人工修改、候选提交、修复和恢复操作应遵守真实活动任务锁,避免冲突。
- 拆解任务卡片与相邻模块采用统一边距和状态底色,必要的阶段、范围、进度和时间直接简洁展示;不要把重要信息只藏在“任务详情”折叠中,也不默认展示无助于操作的内部编号或原始数据。
### 表单校验与交互时机
- 打开表单、加载已有配置或添加一条空白例外时,不立即展示红色校验错误。
- 点击保存、提交时再执行完整校验,阻止不完整请求;需要字段交互校验时,只在用户已操作该字段或已尝试提交后显示。
- 用户修改相关内容后及时清除或更新旧错误,不能让已经失效的提示长期挂在表单上。
- 必填标记、字段提示和错误信息保持统一位置与间距;删除行、增添行和错误出现时,操作按钮仍应与对应控件对齐。
### 页面验收
- 涉及页面或交互的改动,必须在已有本地 Chrome 标签页使用 `localhost` 验证后才算完成,不能只根据代码、构建或 DOM 测试声称布局通过。
- 验证本次改动涉及的桌面、移动端、长内容滚动、固定底栏及必要的加载、错误、成功状态;检查普通、悬停和键盘聚焦时的颜色、对齐与可访问名称。
- 页面模块之间复用公共间距;按钮、标题和辅助说明须有清晰留白。已有相邻页面使用骨架屏时,同类入口也应在项目加载和正文加载阶段预留相同结构。
- 骨架与图片占位默认静态显示,避免闪动。图库按真实卡片结构分别预留图片、文字和操作位置。
- 图片卡片在请求图片前就预留画面区域,优先用已有宽高,缺少宽高时使用稳定比例。检查慢速、加载失败和无图时卡片都不会塌陷。
- 图片列表及浮层验收需覆盖最左、最右和底部卡片、少量与多行图片、长名称和模型名、长错误、桌面与手机窄屏;确认详情不会被弹窗或滚动容器裁切,边缘避让、换行、滚动和提示互斥实际生效。
- 界面验收不得为了制造状态而触发真实付费生成、覆盖正式结果或提交用户数据;使用现有状态、只读操作和合适的自动化测试验证。
- 测试与检查按改动范围执行;纯文档变更无需启动页面或重复完整构建。报告时区分自动化检查与真实浏览器验证,并明确未完成项,不把尝试操作当作验收通过。
## 提交规范补充
- 仅用户明确要求“提交”时才提交,“提交并 push”才同时授权推送;不因界面修改完成而自动提交或推送。
- 提交前必须查看 `git diff --stat` 和 `git diff`,按实际文件与所属包确定提交类型及作用域;不根据用户描述猜测,也不覆盖已有无关改动。
- 提交类型仅使用 `feat`、`perf`、`fix`;中文描述用动词开头,简洁明确,提交信息不超过 50 个字符。
- 单包修改优先以 `package.json` 的 `name` 作为 scope;多个项目或公共基础设施改动可省略 scope,不用目录名代替包名。
- 不使用 `update`、`fix bug`、`修改代码`、`提交代码`、`test`、`wip`、`temp` 等含糊信息。
+8 -2
View File
@@ -236,7 +236,7 @@ API 层也提供 `state` 与 `breakdown/latest` 方法。页面通过共享 chec
1. 入口为 `/projects/:projectId/subject-images`;项目导航、拆解主体列表和分镜参考图缺失提示均可进入。图库自动读取后端已生成图片,不需要重新生图才能显示。 1. 入口为 `/projects/:projectId/subject-images`;项目导航、拆解主体列表和分镜参考图缺失提示均可进入。图库自动读取后端已生成图片,不需要重新生图才能显示。
2. 生图使用正式数据库 `SubjectForm.id`。Checkpoint 的领域 `formId` 不是数据库 ID,不能直接调用图片接口。图库通过 `identity.anchorImageId` 返回当前母版,不再返回图片 `rawJson` 或实际生成 Prompt;不能据此推断形态图历史母版是否过期。正式可编辑提示词保留在形态上。 2. 生图使用正式数据库 `SubjectForm.id`。Checkpoint 的领域 `formId` 不是数据库 ID,不能直接调用图片接口。图库通过 `identity.anchorImageId` 返回当前母版,不再返回图片 `rawJson` 或实际生成 Prompt;不能据此推断形态图历史母版是否过期。正式可编辑提示词保留在形态上。
3. 单图明确发送 `provider: 'seedream'`,避免后端单图入口默认使用 mock。模型和凭证仅配置在后端,前端不保存 API Key。自定义 Prompt 优先,其次正式 `generationPrompt`;缺少时后端先调用文本模型生成并保存。`appearancePrompt` 仅为原始素材,不能直接充当最终 Prompt。可在形态卡片“提示词与生成”先生成、检查与导出正式提示词;后端尚无手工编辑保存接口。 3. 单图使用已确认的项目模型和本次可选覆盖配置,不固定写死供应方。模型和凭证仅配置在后端,前端不保存 API Key。自定义 Prompt 优先,其次正式 `generationPrompt`;缺少时后端先调用文本模型生成并保存。`appearancePrompt` 仅为原始素材,不能直接充当最终 Prompt。可在形态卡片“提示词与生成”先生成、检查与导出正式提示词;后端尚无手工编辑保存接口。
4. 单图宽高同时留空使用后端默认 2K,自定义时必须同时提供正整数,具体尺寸限制仍由模型校验。当前 后端图片模型 Provider 没有使用 negativePrompt,所以页面不提供无效的负向提示词输入。 4. 单图宽高同时留空使用后端默认 2K,自定义时必须同时提供正整数,具体尺寸限制仍由模型校验。当前 后端图片模型 Provider 没有使用 negativePrompt,所以页面不提供无效的负向提示词输入。
5. 单图生成新增历史记录,不删除旧图。无主图时默认勾选“生成成功后设为主图”;已有主图时默认不替换。候选图可以在历史弹窗二次确认后通过 PUT 设为主图,只允许已完成图片。 5. 单图生成新增历史记录,不删除旧图。无主图时默认勾选“生成成功后设为主图”;已有主图时默认不替换。候选图可以在历史弹窗二次确认后通过 PUT 设为主图,只允许已完成图片。
6. 批量默认跳过已有主图的形态;勾选“已有主图也新增候选图”发送 `force: true`。后端批量 force 只生成新图,**不会替换已有主图**。批量作用于整个项目,不受类型/文字/缺图筛选影响,也不接收单图的尺寸与自定义 Prompt。 6. 批量默认跳过已有主图的形态;勾选“已有主图也新增候选图”发送 `force: true`。后端批量 force 只生成新图,**不会替换已有主图**。批量作用于整个项目,不受类型/文字/缺图筛选影响,也不接收单图的尺寸与自定义 Prompt。
@@ -269,7 +269,7 @@ API 层也提供 `state` 与 `breakdown/latest` 方法。页面通过共享 chec
6. 普通身份生图不传 `referenceImageId` 时,由后端自动选择当前母版;无母版时按文本生成。指定时只能选择当前身份已完成的图片;候选图即使停用也可作为显式参考。Character Casting Candidate 是独立选角入口,即使已有 Anchor 也不会复用旧母版,避免旧演员身份污染新候选。尺寸成对留空或提供正整数。自定义 Prompt 会替换后端编译的完整文本,建议保留默认。 6. 普通身份生图不传 `referenceImageId` 时,由后端自动选择当前母版;无母版时按文本生成。指定时只能选择当前身份已完成的图片;候选图即使停用也可作为显式参考。Character Casting Candidate 是独立选角入口,即使已有 Anchor 也不会复用旧母版,避免旧演员身份污染新候选。尺寸成对留空或提供正整数。自定义 Prompt 会替换后端编译的完整文本,建议保留默认。
7. 目前**人物与场景形态生图**会自动注入当前身份母版,分别固定人物身份和空间骨架;道具暂不自动引用。没有身份或母版时,原形态生图流程仍可使用。已有母版但缺少 Provider 可访问远程地址时,后端会报错;本地 `/storage/` 能显示并不证明原始 Provider URL 仍可访问。前端显示后端错误,不自动重试消耗额度。 7. 目前**人物与场景形态生图**会自动注入当前身份母版,分别固定人物身份和空间骨架;道具暂不自动引用。没有身份或母版时,原形态生图流程仍可使用。已有母版但缺少 Provider 可访问远程地址时,后端会报错;本地 `/storage/` 能显示并不证明原始 Provider URL 仍可访问。前端显示后端错误,不自动重试消耗额度。
8. 修改风格或身份文本不会自动重生成旧图。更换已锁定母版后,形态图库会根据 `identityAnchorImageId` 标记旧主图过期;主动生成候选、验图并切换主图,再更新下游首帧。Keyframe 就绪检查也会比对母版与形态主图引用,不应绕过过期提示继续生产。旧记录无追溯字段时不推断它已匹配当前母版。 8. 修改风格或身份文本不会自动重生成旧图。更换已锁定母版后,形态图库会根据 `identityAnchorImageId` 标记旧主图过期;主动生成候选、验图并切换主图,再更新下游首帧。Keyframe 就绪检查也会比对母版与形态主图引用,不应绕过过期提示继续生产。旧记录无追溯字段时不推断它已匹配当前母版。
9. 风格参考图支持登记已有 HTTP(S)/`/storage/` 地址、分类、排序、启停和删除记录;**没有文件上传接口,也没有风格图 AI 生成接口**。当前身份图/形态图 Provider 调用不会自动消费风格参考图片,页面不暗示登记后已生效。 9. 风格参考图支持登记已有 HTTP(S)/`/storage/` 地址、分类、排序、启停和删除记录;项目资产库支持图片上传,并可将正式资产登记为风格参考图。启用的风格参考图会进入后端参考规划;已有图片不会自动更新。
10. 编辑草稿与轮询分离。保存成功才清空草稿,失败保留;主体切换会提示放弃未保存修改。离开页面不会自动保存。所有新写操作沿用项目级会话互斥,生成前需要费用与后台任务确认,无法替代后端跨浏览器锁。 10. 编辑草稿与轮询分离。保存成功才清空草稿,失败保留;主体切换会提示放弃未保存修改。离开页面不会自动保存。所有新写操作沿用项目级会话互斥,生成前需要费用与后台任务确认,无法替代后端跨浏览器锁。
11. AI 生成 VisualStyle 与 Character Identity 时,若项目、世界观和角色事实都未指定人物背景,默认采用自然真实的中国人物选角基线。项目明确配置和角色事实优先于系统默认值,不限制后续使用其它国家、地区、族裔或肤色人物。 11. AI 生成 VisualStyle 与 Character Identity 时,若项目、世界观和角色事实都未指定人物背景,默认采用自然真实的中国人物选角基线。项目明确配置和角色事实优先于系统默认值,不限制后续使用其它国家、地区、族裔或肤色人物。
@@ -340,3 +340,9 @@ server {
自动测试使用模拟 API,覆盖既有流程、分镜接口与竞态,以及形态图片自动读取、正式 ID 生图、主图 PUT、费用确认、尺寸校验、候选图选择、批量部分失败和图片加载错误。不等同于真实模型、MySQL 或浏览器视觉联调。请勿用正式项目随意制造失败以测试恢复。 自动测试使用模拟 API,覆盖既有流程、分镜接口与竞态,以及形态图片自动读取、正式 ID 生图、主图 PUT、费用确认、尺寸校验、候选图选择、批量部分失败和图片加载错误。不等同于真实模型、MySQL 或浏览器视觉联调。请勿用正式项目随意制造失败以测试恢复。
### 2026-10-12 工作区同步
分镜新增“动作与视线”,展示已保存动作时间轴、非阻断密度预警和人工空间目标绑定;镜头生产可从提示词区查看同一信息,从首帧卡片编辑指定主图或历史候选。操作结果统一使用 NMessage,长请求与后台任务在对应按钮或记录处显示加载状态。首帧主图切换重新核对持久化质量结论。详细范围与验证边界见 [接口同步说明](docs/api-contract-sync.md#2026-10-12-工作区与长任务反馈同步)。
+205
View File
@@ -1,5 +1,167 @@
# 接口数据同步说明 # 接口数据同步说明
## 2026-11-18 V8-10.2~V8-10.12
按后端 `fd0ab65` 正式 Schema/Router 增量接入 bounded、失败 Motion 候选人工子版本、Provider 容量阻断、sceneTransition 规划状态、已有失败图片摄影修订及机器/有效质量分离。复用原授权设置、摄影与 Motion 编辑器、首帧候选/历史及 Workflow,不新建业务页面。
bounded 使用原 standing 预算及精确逐镜计划,保留旧 unknown/预留;单镜主动选用且一次成功后停止。Motion 保存、独立起点视觉、正式采用分别操作,起点启动携带精确计划指纹。摄影普通修订仅构图/机位,采用后只读刷新正式源/Preview/质量,不自动生图。旧图来源与费用在原历史按候选读取,实际账单未知不显示为0。
真实项目仅只读;Mock 写入及本地 Chrome 桌面/390px 验收,未执行真实收费模型。用户已在验收后授权将本轮全部 37 个文件提交并推送到 dev,保留正常提交钩子;开发交接中的未提交状态为验收时点记录,最终交付以 Git 记录为准。完整文件、API、测试/浏览器证据和边界见 [本轮接入交接](audits/v8-10-frontend-integration-2026-11-18.md)。
## 2026-11-16 集中 Git 交付
按用户明确授权,将本轮全部52个文件(新增26、修改26、删除0)集中提交并推送到dev,主题为 `feat(short-drama-agent-front): 接入联合修订与图片费用审计`。范围包括环境原文依据、人工图片追加/费用审计、时间语义及分镜界面修复,保留正常提交钩子。以下“未提交/未推送”属于各功能验收时点;实际提交号、全量钩子结果和远端同步状态以本次Git记录为准。
## 2026-11-16 Beat6 有据环境修订
已按后端 `dev@cde30f09464c152447bb0adcee8c670b6ba917a4` 的环境修订 Prompt、正式 Schema/路由/事务接入原联合审核。环境四字段完整差异可编辑、保存和免费预览;存在环境差异才读取现有项目详情的正式本集 ID、projectId 与完整 content,原字节计算 SHA256,用户逐字引用后携带 jointRevision.environmentSource 免费预检和明确采用。
缺证、正文/归属缺失、版本冲突不放行;409保留输入并读取当前原文,不自动重提。原文/版本匹配不代表机器语义通过;原摄影、主体、场景模式和图片费用门禁保持独立。真实仅核对公开 GET,采用和冲突在全请求隔离的 Mock/Chrome 验证,没有正式项目写入或收费。
文件、契约、验证及边界见 [环境修订接入交接](audits/beat6-environment-frontend-2026-11-16.md)。本次增量覆盖下文旧基线“环境不可联合修改”的历史边界;既有页面精简、目录避让和工具栏优化保持。
## 2026-11-16 V8-9.4~V8-9.9 联合采用与图片费用
按指定后端 `dev@2d3abdab5f2656223ab98161dff6388200db281c` 的正式 Schema、路由与服务核对,前端从 `87427d9` 在根目录 `dev` 增量接入。复用原摄影审核抽屉、项目图片授权设置、首帧预览及 Workflow/SSE,不新增业务页面。
- 原保存草案增加联合模式:完整字段前后差异、当前摄影/开拍状态、邻镜版本、免费预检、人工确认和冻结请求采用。保存不表示采用;409 重读正式来源并保留输入,不自动重提;采用后刷新正式 Direction、VisualState 和首帧 Preview。
- 原图片授权 POST 支持人工 `mode=additional`;不预选许可、不增加预算。原首帧入口主动选择许可并重新核对精确计划,只能发送一次明确操作;完整同计划结果优先只读查看。撤销/用尽/来源或范围变化继续阻断,原未知请求和预留保留。
- 原授权设置内增加图片原请求费用审计,三个正式 API 分别读取、登记和独立复核。完整原身份及三项并发指纹来自 GET;登记不解锁,复核不改变原执行、质量和主图。未知账单保持未知;409 刷新正式 GET、保留表单并撤销确认。
- VisualState 只按后端四种显式时间标记排版,原主体/环境显示当前开拍状态;规划末态、连续要求与真实视频末态分开。三种时间问题保留 code/severity/field 和镜头位置,待审不表示通过。
完整已有能力/缺口、文件职责、API 与 Mock/Chrome 验收、费用边界、未完成项及 Git 状态见 [本轮交接](audits/v8-9-4-9-frontend-integration-2026-11-16.md)。未执行真实收费模型或正式采用/证据登记/核清;未提交或推送。后端工作区另有并行未提交的环境修订,本轮按用户指定已提交基线实施,不修改后端或自动采用该后续扩展。
## 2026-11-15 V8-9.1 / V8-9.2 分阶段镜头生产
已在根目录 dev 增量接入正式 shotIds 定向摄影/画面状态、逐镜复用、派生批次停止、原 executionId 刷新恢复观察、独立摄影免费预检与版本绑定采用、原失败及零模型请求恢复展示,以及所选范围的参考素材/计划/资产缺口。默认 force=false、concurrency=1、maxRepairAttempts=0,不自动开始下一阶段或重发未知请求。
继续使用原分镜目录、摄影抽屉、工作流观察、统一 HTTP 错误和首帧授权/Preview 流程。正式四镜已完成摄影和画面状态,默认不重复生成。当前项目级生产仍受真实 needs_review 门禁限制,局部完成不改写全项目结论。
逐文件职责、真实免费 API 结果、Mock/Chrome 验收、正式使用条件与接口局限见 [本轮完整交接](audits/v8-9-staged-production-2026-11-15.md)。只修改前端,未执行真实付费或正式业务写入;实现验收后用户已授权提交并推送 dev,Git 结果以仓库记录为准。
## 2026-11-01 图片预览、质量门禁与派生任务
本次只接入后端根目录 `dev` 的正式 `/api` 路由,依据 `subject-form.routes.ts`、`subject-identity.routes.ts`、`production.routes.ts`、`storyboard.routes.ts` 及相应 Service 核对。未接入 3413 隔离验收服务、脚本、测试专用路由或测试页面;测试夹具只用于 Vitest。
- 身份图、独立选角候选和形态图共用只读预览确认。提交携带 `expectedPreviewFingerprint`;选角预览固定 `viewType=primary,useAnchorReference=false`,实际候选请求沿用正式选角接口。修改目标、参数或重新打开会清除确认,迟到响应不回填。只有 `409 + IMAGE_PREVIEW_STALE` 自动重读预览,之后仍须人工重新确认;不会自动重复生图。保留 Identity 的 `{executionId,image}` 与 Form/Casting 的直接图片回执区别。
- 图库区分生成完成、最近审核与已采纳状态。新增正式 Form `POST images/:imageId/validate` 与显式有限预算 `POST images/generate-quality`,默认额外生成次数为 0。主图和母版确认披露可能发生的视觉审核费用,成功后只读刷新;质量失败、证据过期或请求冲突不乐观替换旧图。GET 图库仅查询,不触发模型或主图变更。
- 身份与形态共用质量证据展示,按 `requirementId/quantityId` 关联原文、明确数量与实际观察;缺失、重复、不可观察及数量冲突不显示通过。原文与请求字段保持不变,内部编号收在高级详情。当前会话审核结果不冒充服务端长期有效的 Readiness。
- 图片页新增 `POST production/plan {stage:'subjectImages'}` 只读检查,展示道具规格、已确认母版依赖顺序及质量问题入口。需准备资料时,经费用确认分别调用既有 `generation-prompt` 或 `prop-structure-spec/generate` 正式文字入口,不自动串联后续生图。未添加诊断脚本、测试路由或批量历史恢复入口。
- 导演设计与画面状态任务增加服务端发现;刷新后恢复观察。`failed` 终态保留逐集部分成功、失败及 `manualReviewRequired`,不显示全部成功。订阅断线只重连/查询,离开页面关闭连接,不重提交生成。正式分镜审核和派生资产覆盖分别展示。
- 复杂生图和图库处理复用 `AppDrawer`,固定标题与底栏,正文独立滚动,深浅主题复用现有变量。未提交或推送代码。
验证:类型检查、改动范围 Oxlint / Vue ESLint、全量 Vitest 和 Vite 构建;Chrome 复用 `localhost:4312` 标签,核对真实预览、参数变更清除确认、缺规格阻断、图库只读与费用确认入口、桌面和手机布局、深浅主题及固定底栏。没有执行真实付费生成/视觉审核、候选采纳或正式结果覆盖;这些写操作的成功/失败边界通过无费用自动化替身验证。
## 2026-10-28 剧本审核人工确认、延期验证与改写预检
按同级后端 `dev@b26aa94e` 的正式审核路由、人工确认事务、质量问题 Schema 和改写预检接入,前端仅修改根目录 `dev`。
- “审核记录”按需读取 `GET /projects/:id/reviews/latest`、`reviews/confirm-issues/preview` 与现有 `resume-rewrite/preview`。最新审核和预检必须属于同项目、同审核编号;预检失败保留只读审核,异常结构、来源过期、活动任务及剩余列表缺失均不开放确认。只读查询可关闭、取消,切项目或卸载后的旧响应不回填。
- 待审核项目首次进入直接定位“审核记录”;失败项目保留当前未通过审核时也定位此处。仅引导阅读,不自动弹出写入确认或启动改写;用户切换内容后,刷新不抢回标签。当前有效改写预检存在剧集、角色或世界观改写范围时提示先检查改写,否则引导人工核对。推荐延期仅在对应单选旁标注“建议”,仍默认保留待处理,不能把人工核对自动转换为接受。
- 两种处理入口独立按实际内容显示:剩余待确认问题或不确定项为空时隐藏“人工确认”;真实改写预检的剧集、角色、世界观均不需改写时隐藏“改写预检”。两种操作并存时都保留;审核通过或预检缺失时不保留空入口。“刷新审核”始终保留。不能只按 confirmedRewriteEpisodes 判断改写是否存在;角色或世界观单独改写也必须正常显示。改写读取沿用公共校验方法,保存记录与当前审核预检不一致时隐藏旧范围并提示刷新。
- 当前有效预检只强调一个主按钮:改写已就绪时突出“改写预检”,否则待人工处理时突出“人工确认”;刷新、读取失败、来源失效、活动任务及审核通过时均不强调处理入口。配色和入口显示不代替服务端操作权限或确认流程。
- “人工确认”复用全屏 `AppDrawer`,按集分组核对错误、警告及不确定项,并提供当前正式正文和人工补充证据。人工补充仅提交已明确核对的 Error、逐字原文、真实集号及说明;首次打开和增加空行不立即报错。处理建议展示推荐原因、全部候选剧集及置信度;默认全部保留待处理,用户明确选择后才展开延期字段。低置信度或要求人工选集时集号留空,候选优先但可选择其它正式剧集;阶段和预填验证标准可编辑,延期不等于后续核验通过。
- 完整原文桌面默认展开,手机按需展开;从问题点击原文入口会选择该集并定位核对区。窄屏操作保留完整名称并自然换行,长内容仅正文滚动,底栏保持可见。
- POST `reviews/confirm-issues` 始终发送 `confirmed: true`、当前 `reviewId` 和 `issueIndexes` 数组;三种选择分别使用原始待确认列表或原始 uncertainty 数组索引,过滤、排序和多轮处理不重编号。提交前重新 GET 核对审核、保存记录、剩余项和正式正文;建议按当前剩余项生成,按完整原文映射回原始审核索引。接受与延期互斥,延期必须填写真实集号、拆解/分镜阶段与非空标准;请求使用 deferredUncertainties。来源变化后旧选择保留为只读草稿,禁止套用旧索引;同来源提交失败保留当前输入,409 只重读,不自动重试写入。
- 确认成功后读取项目详情、当前保存记录、阶段状态和最新审核。尚未生成新 Review 时,已保存裁决优先读取本次预检绑定的保存记录;剩余问题仍可继续处理。只按服务端 `finalized` 表达本次审核是否完成,不按 `remainingBlockers` 推断通过,不自动调用改写模型。审核结果更新时清除旧人工回执;已完成审核仍能只读核对正式正文,旧任务的失败或待修订回执标为历史执行记录。
- 审核页和创作任务弹窗共用改写范围确认入口。GET `/projects/:id/resume-rewrite/preview` 展示真实集数及角色/世界观范围;未就绪只读说明原因。明确确认费用后再次预检,保存记录或范围变化即撤销旧确认;只有同一有效范围才 POST `resume-rewrite`,请求体包含 `confirmed: true`。保留项目活动锁与真实任务句柄,网络不确定不自动重复提交。
- 人工处理后可主动查看改写范围,先等待抽屉离场和焦点释放再打开预检。普通读取不锁定关闭,实际写入期间防止重复操作。运行、失败、完成和未知状态分别展示,不把历史通过或执行结束当作当前制作许可。
接口及页面测试隔离模型与数据库写入。Chrome 使用 `localhost` 验证,确认及改写启动的浏览器验收使用 `/tmp` 内存样例服务,不对正式审核发送裁决,不触发真实付费改写。未修改后端;Git 交付按用户明确要求提交并推送至 `dev`。
验证:82 个测试文件、626 项测试通过;静态检查、格式检查、类型检查及生产构建通过。复用本地 Chrome,桌面只读核对 `cmvrk799a0000k6nd3udc1wow` 的三项真实建议及原文,均保持待处理;隔离样例验证部分延期保存、原始索引请求、提交后重新读取审核与项目阶段、未选剧集阻止提交,以及 390×600 视口的长内容滚动与固定底栏。另验证首次刷新自动进入审核记录、切换世界观后只读刷新仍保留当前标签、手机端引导与入口换行,以及建议标签不默认接受任何问题。入口显隐覆盖仅人工确认、仅改写、两者并存、无可处理事项、审核通过及预检读取失败;额外验证世界观单独改写无集号仍保留入口,保存记录不一致时隐藏旧范围。旧 Review、活动任务、失败保留草稿及改写二次预检由自动化回归覆盖。开发验收日志出现两次 ResizeObserver 布局提示,来源尚未定位,可见交互正常;未为此修改无关公共布局。验收后恢复真实项目审核记录并停止隔离服务。
## 2026-10-28 Story Plan 创作流程适配
核对同级后端 `dev@c6ad973c` 的项目创建路由、创作 Graph、节点保存中间件、恢复服务和任务订阅;只修改前端根目录 `dev`。
- 正式顺序为故事规划 → 分集剧本 → 角色设定 → 世界观 → 动作记录整理 → 审核/改写。页面复用原阶段条与任务面板,动作记录整理显示在任务当前阶段,不新增独立业务步骤。
- `POST /projects` 请求和 202 回执未变。继续发送标题、主题、风格及原有时长预算,复用全部创建输入组件与默认值,只更新顺序说明。
- 不存在 Story Plan 独立查询接口。读取现有项目详情、`GET /projects/:id/checkpoints`、项目级 `workflow-executions/latest|events` 和按任务编号查询接口;规划是否已保存仅来自最新创作记录的 `state.storyPlan`,不从后续节点顺序推断、不回退历史规划、不在页面复制规划校验。
- 项目布局开启创作任务发现;页面在任务编号、节点或执行状态变化后重读项目与保存记录。SSE 使用完整持久化任务,不按旧节点序号过滤。刷新、直接进入及服务端另行启动均复用原发现能力。
- 新执行开始前的旧审核、角色和世界观不用于完成当前节点。`resume-generation` 仍可沿用最新保存规划,但派生设定与审核等待本次保存记录确认。完整剧集的派生阶段失败也可恢复生成;有当前审核结论时停止生成恢复,明确未通过且有审核来源才开放原有改写恢复。连续剧集前缀、费用确认及项目活动锁保留。
- 任务执行完成和审核通过分别展示。任务 `result.projectStatus=need_review` 使用待修订样式,缺少结论保持待确认;不会仅因 HTTP 成功或任务结束标绿。
- 创作页只保留阶段、摘要与入口,详细状态和恢复操作放入公共 `AppDialog`。弹窗按任务状态、剧集进度与恢复提示分组,编号放在默认收起的高级详情;固定底栏集中关闭、只读刷新及原有费用确认。关闭弹窗不停止任务观察,状态读取失败也可以关闭并重读。
- 注意事项复用 `ContextNotice` 的按需强调样式:项目主题的中性底面、图标与短标题突出待处理和恢复受限说明;普通信息继续以留白分组。明确失败或成功仅复用项目既有状态色,并进一步降低底面强度;深浅主题自动同步,不把待审或结果未知标为绿色成功。
- 当前后端失败回执把 `stage` 统一改成 `failed`,恢复生成也只有整体 `resumeGeneration` 阶段,未持久化逐节点失败状态。页面显示任务失败与明确保存的结果,无法确认的具体节点保持待确认;缺少规划时没有独立规划恢复入口,提示新建重试,不虚构 API 或猜测失败节点。
浏览器验收使用已有本地 Chrome 标签页与 `localhost:4312` 隔离样例接口;样例与临时服务位于 `/tmp`,不进入产品代码,不连接真实生成服务。真实模型、正式数据写入及付费端到端生成不在本次验收范围。
## 2026-10-19 导航修复复核与配置冲突同步
后端基线 `dev@6a6fd52d`,前端根目录 dev;保留已有未提交工作,不修改后端、不提交或推送。
- Chrome 真实读取“掩耳盗铃”:导航 `script/breakdown/storyboard.ready=true`,`visualStyle/identity/subjectAssets.ready=false`;制作入口 `ready=true`、`storyboardValid=true`,正式镜头/镜头设计/画面状态均为 61。视觉风格入口已解锁,后续入口按实际准备情况受限;原导航不一致已解决,不需要前端覆盖阶段接口。
- 计划继续 POST,只发送后端解析的 `imageProvider/imageGenerationOptions/videoProvider`。执行范围及视频生成参数保留在最终启动快照和 POST start 中,不能把未解析的参数描述成已通过计划预检。
- 沿用已有配置阻断联合类型与空阶段保护;补充明确的缺配置状态及“前往项目配置”,复用项目标题栏已有全屏抽屉,保存后仍需重新检查,不自动创建配置或启动生成。
- 配置 409 同时识别顶层 code 和真实 details.code。画幅需重新核对、活动任务、模型参数变更受限使用易懂中文和统一 NMessage,保留草稿、原始错误和已保存配置,不自动重试、清理素材或重新生成;成功保存也不再留下重复常驻提示。
- 制作计划人工阻断数按独立准备问题说明,各阶段影响数量不能直接相加。模型目录、智能时长 specialValues、项目画布与参考图尺寸的独立关系保持既有实现,不按模型品牌硬编码或覆盖正式镜头时长。
本轮 70 个测试文件、541 项测试通过;静态检查、类型检查、生产构建及差异检查通过。沿用本会话既有约定,未执行格式化或格式检查。真实接口只读验证;缺配置、正常计划和配置冲突在本地 Chrome 临时隔离页面验证,所有请求在页面内模拟,不回退到真实网络。440×956 窄屏核对恢复入口换行和固定底栏;临时页面已删除,恢复真实项目桌面页面。
接口核对范围、改动文件及仍需后端处理的既有诊断列表问题见 `frontend-contract-audit-2026-10-19.md`。
## 2026-10-19 正式分镜审核与制作前准备
以同级后端 `dev@82756627` 的实际路由、Schema、事务及服务回执为准;先接功能,再调整诊断卡片布局;项目配置同步补图标。本轮保留此前未提交更新,只修改前端根目录 dev。
- 项目顶部统一新增“制作前检查”,在后续页面尚未开放时也可操作:当前项目质量规则确认 → 历史正式分镜规则来源确认 → 正式问题修订 → 整体人工审核 → 镜头设计/画面状态补齐或更新 → 制作入口复检。
- 对接正式质量复检 `storyboard-quality-recheck`、历史规则来源 `storyboard-review-baseline/preview|confirm`、整体审核 `storyboard/quality-confirmation` GET/POST 以及 `production/entry-readiness`。只读复检的 canConfirm=false 不代替显式审核;preflightEligible 也不独立放行。实际审核同时绑定项目、Checkpoint、规则修订/指纹及正式 Shot 数量/内容;确认前重读,变化后要求重新核对,不自动替用户确认新版本。
- 正式动作读取、确定性关联建议、付费语义候选及保存使用 `storyboard-shot-repair/preview/:shotId|candidate` 与 `storyboard-shot-repair`。保存真实指纹、完整动作与阶段;已有手部和通用资源证据、持续对象及释放/交接字段保留。模型建议不等同于已保存;保存成功后仍需重新复检和整体审核。
- 主体遗漏通过正式坐标 locate 定位;剧情段落主体与镜头主体分别使用其预览/确认接口及各自内容版本。段落写入不自动继续镜头写入,不用候选 Checkpoint 修复替代正式数据修订。
- 旧手部诊断、建议与修订历史路径迁移到 action-resource 与 storyboard-shot-revision-history。列表优先展示 resourceAudit,同时保留旧 handAudit 的含义边界;正式修订历史与诊断历史均按需读取。诊断关闭动画完成后才打开正式修订抽屉。
- 制作计划读取前先核对 entry-readiness,未满足时不再发 production/plan。覆盖率完整仍需逐集核对 staleCount;过期、缺失或未明确返回新旧版本状态都暂停进入计划。计划启动时沿用原有再次预检、参数变化撤销确认及任务互斥。
- 制作计划区分 `configuration.status=ready` 与 `blocked / CREATIVE_PROFILE_REQUIRED`。配置缺失时显示保存项目配置的中文提示,既不读取空阶段/明细,也不允许启动;独立配置查询后发生变化的情况同样阻断。模型时长选项继续读取真实模型元数据,不硬编码智能时长默认值。
- 镜头设计与画面状态页面接入当前整体审核,不能只凭已有数量启用生成;费用确认后再次核对审核来源。真实后台任务继续使用既有 WorkflowExecution,不自动重跑 Breakdown、不自动调用模型。
- 诊断卡片定位、复查、修订与历史入口改为图标加中性独立底面的无边框按钮。窄屏只显示图标,保留完整名称与提示;保存和生成才使用绿色主操作。长表单固定底栏、移除操作使用图标,规则/原因校验不在打开时立即显示。
验证:69 个测试文件、529 项测试、静态检查、类型检查、生产构建及差异检查通过。按既有约定未执行格式化或格式检查。本地 Chrome 复用 `localhost:4312`,验证真实制作前检查与有效审核、只读正式动作编辑、桌面及 440×956 窄屏操作图标、无边框入口与固定底栏;最终恢复桌面页面。人工确认、修订写入及收费模型分支仅在隔离测试中验证,未改写真实项目或调用收费模型。
历史记录:本节验收时导航尚存在旧待审标记问题;后续已由后端 `6a6fd52d` 修复并重新核对,见本文件顶部记录及 `backend-production-navigation-follow-up.md`。
## 2026-10-18 质量规则确认与诊断更新
核对同级后端 `dev@2b079bd1` 的公开文档、正式路由、质量规则事务、诊断预检查、结果汇总、修订资格及恢复服务。本次只修改前端根目录 `dev`。
- 质量规则 GET 保留服务端 `revision/fingerprint/confirmed/confirmedRevision/confirmedAt`;PUT 使用 `{ policy, expectedRevision }`;用户明确勾选后调用独立 Confirm。删除本地浏览器确认依据,跨浏览器已确认且规则未变时跳过规则表单,仍保留每次模型调用的费用确认。
- 确认前及最终启动前重新读取同项目规则;实际启动携带 `expectedRevision`,零版本有效。取消、切换项目或预览、活动锁与迟到响应不能生成启动许可;真正保存或确认期间锁定关闭。服务返回版本冲突时不自动重试写入。
- 全局规则保存与问题中的动作例外追加均重读最新规则,并携带其真实 revision;例外完整保留。普通保存不伪造明确确认。候选提交安全检查新增 `qualityPolicyMatches`,缺失或 false 均不放行。
- 单镜头诊断预览接入正式 `diagnosis-preflight/:shotId`;费用确认后再次核对预检查和镜头摘要,来源、规则或内容改变时撤销启动。可复用的有效历史诊断不重复调用模型。
- 动作诊断使用全屏 AppDrawer,正文独立滚动、固定灰色关闭按钮;版本过期、手部免费检查、证据覆盖率、全身动作疑点和 AI 待复查分别展示,不将“已修订”或局部无冲突描述为全部通过。未诊断长列表仍按需查看。
- 指定镜头的诊断历史与修订资格按需读取,返回项目/镜头/诊断归属不一致时不展示为有效资格。没有提供当前完整动作规划时不从模型建议或旧保存记录构造可写表单;补充接口需求见 `backend-diagnosis-follow-up.md`。
- 诊断任务的服务中断摘要直接展示可复用/待核查数量及费用未知提示,不自动重新提交;诊断执行结束不再使用素材生成成功文案或满格绿色进度条。
验证:66 个测试文件、516 项测试通过;类型检查、静态检查、生产构建及差异检查通过。沿用既有约定未运行格式化或格式检查。Chrome 复用已有 `localhost:4312` 标签页,对真实本地服务验证首次规则确认、取消保留预览、单镜头规则记录不完整时禁用启动、按需历史读取,以及 440×956 窄屏固定底栏;模型执行、规则保存/确认及修订写入只使用测试隔离验证,未对真实用户数据执行写请求或收费模型调用。界面恢复到桌面视口。
## 2026-10-17 拆解任务发现与过程展示
- 项目布局通过 `GET /projects/:projectId/workflow-executions/latest?workflowName=breakdown` 发现服务端最新拆解任务,并通过同项目 `workflow-executions/events` 订阅任务变化。后端发起的新任务不再依赖当前浏览器保存过启动回执;没有任务时明确返回 null。
- 拆解页页头、设置弹窗和活动锁共用实际任务记录。运行期间隐藏“查看诊断”和节拍/镜头诊断按钮,禁用恢复、候选提交与质量修订。结束后读取最新结果,按真实终态恢复入口;切换项目和迟到消息不覆盖当前项目,终态不会被旧 running 消息重新激活。
- 后端只读观察视图使用同次运行时间窗口内的阶段快照补充阶段和进度。`metadata.progressUnit` 明确区分抽取任务与分镜剧集;状态仍以持久化任务为准,不把抽取 3/3 当作整个拆解完成。新任务尚无快照时标注“上次结果”,未知总量保持未知。
- 任务执行结束但 `storyboardShotValidation.valid=false` 时显示校验未通过,保留候选提交限制。发现失败提供重读入口,页面不定时刷新全量项目或完整 Checkpoint;只观察任务状态,终态时刷新业务结果。
- 本地 Chrome 读取“掩耳盗铃”的真实任务与校验结果;在临时隔离页面验证后台启动事件到达后诊断消失、进度显示“分镜剧集 1/3”、恢复操作禁用,以及结束事件后恢复诊断。隔离页禁止写请求,验证后已删除并恢复真实项目页面;没有重新拆解或调用模型。
- 详细执行异常与分镜校验问题移到独立“拆解问题”弹窗,按剧集/节拍/镜头分组,保留后端原始描述并合并重复消息。设置页仅展示问题数量和查看入口,移除重复快照统计、进度及长错误清单;问题弹窗关闭后可定位分镜或返回设置,弹窗之间不叠加焦点陷阱。候选、修订与恢复说明同步精简。
- 问题定位、错误详情卡片及问题摘要统一使用 `--app-danger-soft` 柔和红色背景,移除定位区域的绿色轮廓线;深浅主题分别使用适配底色,内部按钮的键盘焦点提示保留。Chrome 已验证深浅主题的真实问题镜头定位,验证后恢复原跟随系统主题。
本轮验证:前端全量 58 个文件/435 项测试及构建通过,颜色变更另通过 43 项针对性回归;后端只读观察、阶段归属和状态转换 16 项专项测试、类型检查、本次文件格式及静态检查通过。后端全量检查在格式阶段报告 8 个既有文件问题,均不属于本次改动,未修改这些文件。
## 2026-10-17 候选拆解、质量规则与阶段续跑
依据同级后端 `dev@dc884f0f` 的正式路由、候选提交服务、质量策略 schema、人工修订服务与 Production Prepare 节点核对。本轮在前端项目根目录 `dev` 适配,保留工作区原有页面改动。
- 拆解启动默认显式传 `candidateOnly: true`;已有结果时使用候选模式。分组、模块、项目、剧本正文或生成模式变化都会撤销旧预览,启动与正式替换分开确认。
- 新增 `commit-candidate` 入口,只发送 `{ confirmed: true }`。资格读取最新原始 Checkpoint,不从历史回退结果拼接;确认后再读取当前版本,变化时停止提交。后端继续在事务内校验最新候选、剧本正文指纹、审核状态和下游资产,不接受客户端上传主体或分镜数据。
- 项目配置新增“质量规则”分类,对接 `quality-policy` GET/PUT。完整保留物理模式、三项动作许可、自定义规则和针对主体/资源的精确例外;切换表现方式不会自动放宽动作权限。保存与生成模型配置使用各自的接口和按钮。
- 拆解设置新增 `storyboard-quality-repair-plan`、`storyboard-quality-repair-candidates` 与 `storyboard-quality-repair`。人工编辑完整必需动作、阶段时长、手部证据及身体/道具资源证据;候选来源发送真实镜头指纹和 Checkpoint ID。修改草稿撤销旧确认,版本变化要求重新读取。保存仅产生新快照,之后仍需恢复拆解及候选正式提交,不显示为已入库。
- 指定 Production 续跑阶段的预检同步后端门禁:所有续跑均要求角色身份确认;首帧及视频提示词续跑要求主体参考图全部有效;视频提示词续跑额外要求全部已有有效首帧。`planned`/可生成不等同于已有有效资产,不影响默认从头运行时补齐上游的行为。
- 页面沿用现有公共弹窗、模块留白和固定底栏,动作与资源编辑字段提供可见标签;393px 窄屏按单列显示。
验证:本地 Chrome 使用 `localhost:4312` 读取真实后端 `localhost:3412`,完成候选分组预览、费用确认取消、真实修复清单空结果、多行质量规则和精确例外必填验证;在 393px 视口检查表单、正文滚动和底栏。已有项目没有待提交候选或质量阻断镜头,候选版本变化拦截、完整证据编辑、无效动作引用阻断和人工修订提交使用临时隔离验收页验证;该页面已删除,不向真实后端写入,不触发模型生成。
代码校验:lint、format:check、typecheck、56 个测试文件/429 项测试、生产构建和差异检查均通过。使用本机已安装 pnpm 的 `--pm-on-fail=ignore` 参数执行脚本,避免自动下载项目声明的另一版包管理器;没有修改依赖或锁文件。
核对日期:2026-09-10。依据同级后端仓库 `short-drama-agent` 的 `HEAD=f0321c2`、`src/api/routes` 及实际资产 DTO/service 实现。本轮仅修改前端,沿用已完成页面和正式路由。 核对日期:2026-09-10。依据同级后端仓库 `short-drama-agent` 的 `HEAD=f0321c2`、`src/api/routes` 及实际资产 DTO/service 实现。本轮仅修改前端,沿用已完成页面和正式路由。
| 接口范围 | 精简后的公开数据 | 前端处理 | | 接口范围 | 精简后的公开数据 | 前端处理 |
@@ -59,3 +221,46 @@
- 首帧预览按 `referencePlan.selected`/`omitted` 展示 Provider 上限后的真实输入;不再从通用 `keyframe-spec` 推断最终选图。 - 首帧预览按 `referencePlan.selected`/`omitted` 展示 Provider 上限后的真实输入;不再从通用 `keyframe-spec` 推断最终选图。
- 形态提示词、形态图片及主体身份文本批处理均可发送可选 `module`;省略时保持全项目行为。 - 形态提示词、形态图片及主体身份文本批处理均可发送可选 `module`;省略时保持全项目行为。
- 场景/道具身份母版使用 `/projects/:projectId/subject-identities/anchors/generate`,请求包含 `module`、`limit`、`concurrency`;成功项已由后端设为 Anchor 并锁定,不再由前端逐项补 PUT。 - 场景/道具身份母版使用 `/projects/:projectId/subject-identities/anchors/generate`,请求包含 `module`、`limit`、`concurrency`;成功项已由后端设为 Anchor 并锁定,不再由前端逐项补 PUT。
## 2026-10-10 串联生产增量同步
核对后端本地与远端 `dev@8acc22db66605b2094098eb3f25b4d1de0ef4a69`。本轮调整已有生产流程:
- `POST /projects/:projectId/production/start` 新增 `videoLimit` 和 `videoGenerationOptions`。高级串联生产默认视频候选最多一镜,限制值必须为正整数;默认安全模式仍在视频提示词阶段停止。
- 项目 `creative-profile.videoOptions` 被复制到本轮启动快照。确认后重新读取配置,视频参数变化也会撤销旧预检与确认,避免启动未经确认的参数。计划接口仍仅解析图片参数及图片/视频供应方,视频参数和数量上限由启动接口实际消费,不将计划表中的全项目计数描述为本批上限。
- 补齐首帧就绪项 `primaryQualityStatus` 和视频就绪汇总 `failedKeyframeQuality`。缺省状态不推断通过;已有 `failed_keyframe_quality` 问题显示沿用后端真实原因。
- 新增首帧编辑、候选质量恢复和人工空间目标绑定属于独立操作入口,本轮未新增这些页面功能。已有通用 JSON 规格展示和导出保留后端新增数据,不人工编造空间目标。
验证:`pnpm check`(45 个测试文件、357 项测试)及 `pnpm build` 通过;本地 Chrome 的 `localhost:4312` 读取真实后端 `localhost:3412`,生产预检成功,视频候选上限可编辑,修改后旧预检失效且启动禁用。真实生产状态返回 passed/failed 主首帧质量标记;当前项目视频参数来自实际配置。未启动图片、视频或视觉校验模型任务。测试输出存在 localhost:3000 连接拒绝日志,但全部测试通过;不据此宣称付费生产端到端验证。
## 2026-10-12 工作区与长任务反馈同步
后端契约基线:`dev@45c8678971f71210764ef816c4a712b1b302f429`;前端起点:`dev@83482a70c50d85d6481f41e69f4b53dfaa3f986a`。以路由与实际服务返回为准。
- 分镜和生产工作区接入单镜头 `motion-plan/preview`;项目级 `storyboard/motion-plan-duration-audit` 按需读取,并按正式镜头 ID 定位。时间轴结构预警与动作密度预警独立计数;实时审计、历史生成预警和人工建议分别展示,缺失历史记录不推断通过。预警不阻断生产,不自动调整时长。
- 接入 `spatial-target-bindings` GET/PUT 和 `gaze-readability/preview`,人工编辑支持方向性注视/精确目标、画内外、景深、区域及唯一性。完整替换写入仅包含允许的业务字段,不提交后端 evidence;空列表撤销人工覆盖需确认。
- 首帧主图和历史候选增加 `edit/preview` 与 `edit` 入口。参数变化撤销预览和费用确认;提交前重新核对源图及主图状态。主图编辑自动校验并在通过后尝试晋升;历史候选仅生成下一代候选,不能显示质量通过。编辑的 202 句柄复用 `keyframe-quality` 持久化观察,完成回执与批量质量统计分开。
- 分镜工具通过 GET `video-prompt` 自动读取已保存正文,只有用户明确生成才 POST。首帧手动晋升前重新读取 `quality-review`,认可当前持久化 passed/manual_accepted,移除只认可本会话结果的过期限制。视频手动晋升仍保留已有独立守卫。
- 临时成功、失败、警告使用同一 NMessage;同一时间的重复查询错误去重。项目操作过程由按钮 loading、操作入口旋转图标、资产状态及真实后台阶段反馈,不再显示固定全局 loading 消息。后台终态只通知一次,旧完成记录不重放。
- 常驻彩色提示框改为紧凑业务状态与恢复入口;重复阶段成功说明移除。批量部分失败根据后端真实统计显示 warning,成功的只读刷新不再额外提示成功。
- 页面模块和提示说明沿用全局间距;新时间轴、目标表单与编辑面板在窄屏自动单列。历史错误、业务预警和操作错误分别保留正确的查看或恢复入口。
验证不启动真实生图、视频或视觉校验。当前浏览器无法访问本地 localhost 服务,浏览器视觉验收与真实后端联调仍待在可访问的开发环境完成。
本轮校验:`pnpm check`(49 个文件、393 项测试)、`pnpm build` 和差异检查通过。新增回归覆盖切镜迟到响应、历史审计缺失、编辑预览失效、主图身份变化及后台候选编辑句柄。测试输出仍有已有 localhost:3000 连接拒绝日志;不据此宣称真实后端或付费模型联调完成。
## 2026-10-14 动作修订与候选权限同步
依据同级后端当前未提交 dev 的 `docs/api/public/motion-plan-revisions.md` 及正式路由、服务返回;不依赖旧建议文档推断契约。
- 视频 DTO 和质量链共用八个版本与权限字段。候选独立控制校验、修复与设主;过期终态优先于历史通过,两个空版本 ID 不自行判为过期。主视频优先显示 readiness 的具体原因。运行任务的过期计数与逐镜终态读取 metadata,完成后读取 result。
- 分镜动作面板和生产动作弹窗共用完整修订编辑器。编辑、免费预检查、保存、确认模型费用、启动视觉任务、读取任务、激活均为独立步骤;阶段、整体约束、主体引用和收尾等字段完整传递。
- 保存显式提交父版本(首次可为 null);校验提交当前主首帧 ID 和当前生效指针,使用服务端视觉模型,不传请求级模型选择参数;激活提交真实视觉任务 ID 和预期生效指针。
- 激活资格要求任务完成、通过且未失效,并核对镜头、修订、内容指纹、主首帧 ID 与图片地址、生效指针。修改草稿、保存新修订、主首帧或生效指针变化后撤销旧资格和费用确认。刷新后可恢复同镜头持久化任务;关闭弹窗或切换标签不重复启动任务。
- 激活后刷新版本、动作预览、视频资产、质量记录和项目 readiness,提示重新生成视频提示词,不自动发起生成。同步 409 保留顶层 code 与独立 details,撤销候选会话资格并刷新权限;后台 failed 任务独立展示 error 和 result.issues。
浏览器验收使用本地 Chrome 和 localhost。真实后端读取及免费预检查不调用模型;保存、收费视觉校验、激活、版本冲突、首帧换图和草稿修改的流程使用隔离模拟场景验证,不写入业务数据或触发真实付费任务。
@@ -0,0 +1,82 @@
# B04-18 / B04-22 / B04-25 前端接入记录
日期:2026-11-09。仅修改前端根目录 dev,未提交、未推送、未创建工作树。
前端基线 c7a6b1226114d3889e353dc4b0fa733c8ace958d,与本次 fetch 的 origin/dev 一致;后端基线 e7035e68c2bd4239947bef764354819f0f15daac。
## 1. 已补齐功能
- 普通 Vision:QualityDialog 免费读取计划,展示 ready/blocked/reusable、模型、步骤、真实请求次数、原图/参考和摘要、未知费用、在途及未结任务、失败结果复用。点击提交前再次免费核对计划,POST 携带 expectedValidationFingerprint;任何变化撤销确认,409 不自动重试。原图片读取接口的 /api 路径按当前服务源转换为绝对图片地址。
- 来源复核:结构/空间 unknown 可单独声明适用范围,保留原观察;主体从实际绑定选择,全部 RequiredActions 逐项填依赖及原因,状态/构图/无反证/其它证据均不预填。缺动作、非静态机位不提供非阻断选项,其它必要依赖或声明不完整时禁止保存。明确 failed 不开放适用范围。
- 非阻断来源按服务端 validationEligible 准备独立免费计划,明确 false 不被 passed 文案覆盖。保存后回读记录与历史,由现有 changed 通知刷新当前质量和外层资产;409 撤销独立计划和批准。
- 主体 gaze:复用单镜摄影抽屉,从新鲜正式 Direction、VisualState、sceneSources 构建完整 draft,同步声明原值/新值/理由与对应 gaze,保留其它字段。保存、预览、采用继续使用原接口和版本保护。采用前展示变更范围,版本冲突刷新正式依据并等待重新确认。
- 连续性:非阻断未知在最新诊断和历史签收中单列,签收状态与当前性分开;三镜签收不表示项目视频就绪。当前质量继续由 effective-keyframe-quality.ts 消费正式服务端结论,历史 failed 不改写为通过。
## 2. 复用模块
复用 QualityDialog、SourceReviewDrawer、ShotDerivedReview、AppDrawer、AppDialog、NCollapse、AssetImage、消息层、useQuery 取消机制、useEffectiveKeyframeQuality、useKeyframeVision、原 WorkflowExecution GET/SSE、原来源批准接口与独立 Primary 确认入口。没有新增审核或质量状态计算系统。
## 3. 新增文件与职责
| 文件 | 职责 |
| --- | --- |
| src/features/production/validation-preview.ts | 普通免费审核计划类型、GET、正式参考图片路径转换 |
| src/features/production/components/ValidationPreviewPanel.vue | 当前计划和实际图像核对 |
| src/features/production/source-applicability.ts | 人工范围类型、完整性与必要条件校验 |
| src/features/production/components/SourceApplicabilityFields.vue | 未知维度的明确人工声明表单 |
| tests/fixtures/validation-preview.ts | 免费计划隔离数据 |
| tests/features/production/b04-applicability.test.ts | 非阻断范围边界、正式图片地址回归 |
| tests/browser/b04-review.html / b04-review.ts | Chrome 真实组件隔离页,API 写请求全部拒绝 |
| 本记录 | 交付与限制说明 |
## 4. 修改文件与职责
- production/components/QualityDialog.vue、useQuality.ts、keyframe-vision.ts、quality.types.ts:计划展示、确认撤销、提交版本核对和原任务观察。
- production/components/SourceReviewDrawer.vue、useSourceReview.ts、source-review.ts:适用性上下文、表单、保存、服务端准入和独立免费计划。
- production/components/ContinuityReviewDrawer.vue、continuity.types.ts:非阻断未知和签收当前性。
- storyboard/components/ShotDerivedReview.vue、derived-review.ts、derived-review.types.ts:有界视线编辑、完整草案、原值与采用范围。
- lib/user-facing-text.ts:正式主体修订、来源适用性错误的中文说明。
- tests/features/production/quality.test.ts、source-review.test.ts、tests/features/storyboard/derived-review.test.ts:补充计划、非阻断准入与视线回归。
## 5. 重复实现处理
未删除原审核系统或历史记录。普通计划模式不再展示与计划不一致的旧“最多一次审核”提示或可变文字白名单输入;其它既有审核/修复入口保留。没有创建第二套质量计算器。
## 6. 自动化验证
- 全量 Vitest:107 文件、811 用例通过;随后增加图片路径与服务端非阻断资格两个用例,均定向通过。
- 最后相关回归:计划/适用性/来源/视线共 4 文件、48 用例全部通过。
- TypeScript vue-tsc --noEmit、全仓 Oxlint、相关 Vue ESLint 通过;格式化及 git diff --check 通过。
- 使用本地已安装工具运行,未安装依赖。所有模型请求测试使用隔离响应。
## 7. Chrome 验收
使用本地 Google Chrome、localhost:4312,复用本任务标签页;未使用 Playwright。
- 真实项目:正式摄影抽屉、旧草案 stale、从正式状态进入 gaze、正式主体选择、原视线展示、空表单禁用提交;桌面暗色和 iPhone SE 375×667 布局、正文滚动及固定底栏。
- 隔离页:普通 ready/blocked/reusable、未知费用、失败历史与当前 stale 分离、来源 unknown 和空白依赖声明、静态原图与参考、桌面/375px 单列布局和固定关闭/保存栏。
- 真实生产页保留原有整项目门禁,当前仍提示主体形态图片待准备,因此未在该页完成真实保存/付费操作闭环。隔离页面明确拒绝 API 写入。
- 未提交真实用户数据、采用正式修订、发起审核、生图、生视频或改 Primary。真实保存、采用后失效和收费任务完成等场景由现有/补充自动化回归覆盖,不能当作真实生产写入验收。
## 8. 真实只读接口核验与未完成项
项目 cmw02vpwi000005axrdtus3pa:60 镜,首组三镜 skipped=已有可用 Primary,当前 primaryQualityStatus 均 passed 且来源非 stale;其余 57 镜阻断,57 个规格问题、40 个缺参考问题(分类可能重叠)。
逐镜 quality-review:1.1、2.1、2.2 的 effectiveQualityStatus 与历史 qualityDecision 均 passed。
普通免费计划:1.1 reusable、qwen3.8-max、最多 2 请求、每步 5 图,amount=null;2.1/2.2 返回 409 IMAGE_INPUT_STALE。这与“旧像素对照新来源使用独立来源审核,不能普通审核重盖来源”的契约一致,不据此改写当前 passed。
已存三镜签收 cmw7y6sqt0008rono7bv2lopl GET:status=passed、invalidation=null;diagnosis.nonBlockingUnknowns 保留 2.2 的 fixed-door-frame-connection,明确局部不可辨、不能确认轴侧,未核实为通过。
仍未完成:真实数据保存/采用/收费执行的端到端人工验收,本次禁止借验收改正式结果或触发付费;其余 57 镜资产与规格准备也不属于本轮自动补齐范围。
## 9. B04-25 契约一致性与后端问题
已核对后端正式路由、ShotKeyframeReviewDraftSchema、SubjectStateRevisionSchema、SaveShotKeyframeReviewDraftSchema、StoryboardDerivedReviewConfirmationSchema 和服务实现。
提交完整 draft,field 固定 gaze,before 来自最新正式记录,after 和理由由用户填写;正式来源指纹与草案预览指纹分别携带,沿用用户核对的模型参数;不发送 sceneStateCarryForward 或 sceneSourceRecovery,不混入未采用机位稿。400/409 由原 HTTP 层处理并映射中文,版本冲突不重发。
目前没有确认的后端缺陷或必须新增的接口,暂不需要后端修改 prompt。2.1/2.2 普通预检 409、项目入口阻断均属于当前正式来源/准备门禁,不要求后端放宽。
## 10. V02-06
可以继续 V02-06 剩余有序组审核功能的开发与只读准备;首组三镜已核验的通过不能扩展为全部项目准入。正式生成仍须消除相应范围门禁、逐次取得明确费用批准。本轮不宣称 V02-06 整体完成或项目可以直接生成视频。
@@ -0,0 +1,68 @@
# Beat6 有据环境修订前端交接
Git交付补充:用户已授权本轮全部前端改动集中提交并推送dev,本环境增量随 `feat(short-drama-agent-front): 接入联合修订与图片费用审计` 交付。下文未Commit/Push为功能验收时点,实际SHA和远端同步以本次仓库记录为准。
2026-11-16,前端根目录 dev,保留前几轮未提交改动,只增量修改前端,不新建 worktree。后端只读基线为已提交的 `cde30f09464c152447bb0adcee8c670b6ba917a4`,依据 `docs/audits/v02-beat6-environment-review-frontend-prompt.md`、公开 storyboard 契约及真实 Schema/路由/项目事务核对。
## 已有实现与新增范围
原摄影/开拍状态联合流程已经具备完整草案读取/保存、字段差异、本镜/邻镜版本、免费预检、冻结请求采用、幂等、409保护及固定底栏。此次只补环境四字段和本集原文依据,不创建新编辑器、API服务、任务/SSE、费用或质量流程。此前环境差异被白名单阻止属于旧基线,本轮扩展后不再作为越界;身份、Form、主体集合与正式动作仍不开放。
## 正式来源与接口
- 环境可变字段为 timeOfDay、weather、atmosphere、transientState,changes[] 使用 target=environment,before/after 均完整保留;天气未知保持空,不补晴天。
- 沿原 GET/PUT keyframe-review-draft 保存完整原稿及 expectedRevision、expectedCurrentFormalSourceFingerprint。保存不采用,不额外往草案中塞入无契约字段,原 current/stale 与 staleReason 保留。
- 沿原 POST keyframe/preview 免费取得草案、本镜派生和完整邻镜版本;草案指纹不提交生图。
- 存在环境差异时,原 confirm 的 jointRevision 另带 environmentSource:episodeId、expectedContentFingerprint、quote。预检与正式采用冻结同一原稿/差异/原文/版本,仅切换 preview;依旧必须分别执行和人工确认。
- 已核对现有 GET `/api/projects/:projectId` 的正式 ProjectEpisodeDto 及实际响应,确实公开本集 id/projectId/episode/content。按当前项目和集号取唯一正式集,校验 ID、归属、完整字符串正文,再用 TextEncoder + Web Crypto SHA-256 计算完整 content 的原字节版本;不使用 summary、截断正文、换行归一化或人工输入的哈希。
- Keyframe Spec 同时核对 projectId、shotId、episodeNo;最终 Storyboard 外键与源集、正文版本和引用存在性继续由原采用事务核验,前端不把项目集号匹配冒充外键已通过。
- 没有环境变化时不额外查询本集正文、不附 environmentSource,原请求形状保持。
- 新错误前缀 JOINT_REVISION_ENVIRONMENT_SOURCE_STALE 使用中文提示。409读取当前正式 D/VS/草案和本集原文,保留草案、原文片段及审核输入,清除旧预检/确认,不自动重复提交或绑定新版本采用。
## UI
在原“摄影草案与审核 → 联合修订摄影与开拍状态”内,以 NCollapse 默认收起四项环境字段。环境变化后才出现“本集原文依据”;完整正文及技术版本按需展开,引用字段不预填。缺证、片段不匹配或读取失败时禁用联合预检与采用,仍允许单独保存草案。
提示明确“原文及版本匹配不等于机器语义审核通过”。原确认勾选复用,不再增加另一套确认或费用授权;任何字段、片段或源读取变化撤销旧确认。长内容只滚动正文,固定关闭/保存/采用底栏,沿用现有主题与表单间距。既有分镜浏览精简、无默认多选/弹窗、目录避让和工具栏布局未改。
## 本轮文件职责
| 文件 | 变更 |
| --- | --- |
| src/features/storyboard/derived-review.types.ts | 扩展 environment 差异联合类型和有据采用的 environmentSource |
| src/features/storyboard/joint-review.ts | 四环境字段加入完整差异声明,保留其它越界显示/阻断 |
| src/features/storyboard/components/JointDraftFields.vue | 原编辑区内的可选四环境字段,不填默认天气 |
| src/features/storyboard/components/JointDraftReviewPanel.vue | 按需读取源集全文/身份/原字节SHA、逐字片段、预检冻结、冲突刷新和原状态原因 |
| src/features/projects/types.ts | 补充公开 Episode.projectId 可选类型及正式集ID说明,不改变其它项目流程 |
| src/lib/user-facing-text.ts | 环境源版本冲突中文提示,保留原错误码判断 |
| tests/features/storyboard/joint-review.test.ts | 环境字段、精确正文SHA、缺证、源缺失/409、重复点击和旧模式回归 |
| tests/browser/review-billing.ts | 原全请求隔离页增加 environment 场景,模拟原文变更及严格环境证据核对 |
| docs/api-contract-sync.md | 最新环境来源契约索引,说明旧环境边界已扩展 |
| docs/audits/beat6-environment-frontend-2026-11-16.md | 本交接 |
本轮没有删除文件、没有修改依赖/锁文件、没有修改后端。前几轮文件仍保留为未提交状态,本表只统计本次环境增量职责。
## 验证
真实只读 GET 项目详情为200:项目 cmw02vpwi000005axrdtus3pa,第1集正式ID cmw02yfyb000505axhlvcp135,所属项目一致,完整content为656字符,UTF-8 SHA256为 `08b58106a9c29cd1dbc5cf42f5cb95c0f0bfd6b4c15f01f5de2f1d4c10bd8f7f`。这只证明读取能力,没有重新采用后端已确认的Beat6草案。
自动化:环境联合专项9项通过,原字节SHA用 Node createHash 独立核对 CRLF/换行和中文输入;缺证/他集片段不允许预检、缺正式全文不猜哈希、旧模式不带environmentSource、409保留输入重读、重复点击只发送一次正式采用均覆盖。
最终验证:相关5套38项Vitest通过;Vue TypeScript、8个实现/验收文件的Oxlint/Oxfmt、两处Vue组件的ESLint及生产构建通过,git diff --check通过。沿用前几轮其它已通过证据,没有重新执行无关全仓检查。后端工作区仍干净。
Chrome复用本地已有标签页,通过 `localhost:4312/tests/browser/review-billing.html?environment=1` 验收,全fetch拦截,未声明路由403且无正式服务回退:
1. 打开原联合模式显示8项完整差异,四环境字段 before/after 全部保留,天气为空。
2. 保存第7→8版后明确仍未采用;错误片段即使已免费预览,仍无法联合预检。
3. 手填本集原样片段/审核人/理由后免费预检,正式采用仍需人工确认。
4. 模拟预检后源正文变化:正式采用409,草案和片段保留,旧确认与预检失效;源全文刷新显示新增原文,没有自动第二次采用。
5. 用户明确重读、重新预览/预检及确认后,Mock采用成功,正式D/VS/Preview刷新,完整差异归0,原草案stale和历史保留。
6. 390×844检查完整原文、原文字段、长内容独立滚动、固定底栏、关闭与按钮禁用状态;验收后恢复桌面和原正式只读页面。全程模拟图片0、真实模型0。
截图在 `/Users/goujun/.codex/visualizations/2026/11/15/01a1df1f-2851-7ff2-b840-d1a0f3154f74/environment-review/` 的 mobile.jpg、adopted-desktop.jpg。未使用Playwright。
## 交付边界
环境接入没有解除原项目图片 billingBlocked,也不改变 unknown、预留、授权余额、质量结果或Primary。未执行真实文字/图片/Vision/Repair/视频,未在正式项目保存草案或采用。没有未接入的必要公开接口,Storyboard外键和最终版本保护仍由服务端权威事务决定。
前端保持dev,未Commit、未Push;后端只读且工作区未改动。本轮功能验收不构成后续正式采用或付费生产授权。
@@ -0,0 +1,86 @@
# OpenAI 图片持续授权与视频外部费用审计前端交付
2026-11-13。前端根目录 `dev`,基线 `3915566`。后端契约核对 `dev@3cbff50e749cde36212053800757b8eafb729a3c` 的两份公开 API、两份前端 Prompt、正式路由、Schema 与服务。
1. 文件与职责
新增 18 个文件,修改 21 个文件,删除 0 个文件。所有改动均在前端仓库。
| 状态 | 文件 | 职责 |
| --- | --- | --- |
| 新增 | [src/features/image-authorization/ImageAuthorizationSettings.vue](../../src/features/image-authorization/ImageAuthorizationSettings.vue) | 有限授权创建、余额、原请求、未知费用和撤销表单 |
| 新增 | [src/features/image-authorization/api.ts](../../src/features/image-authorization/api.ts) | 四个正式图片授权接口及既有请求封装 |
| 新增 | [src/features/image-authorization/model.ts](../../src/features/image-authorization/model.ts) | 美元精确换算、范围匹配、免费复用及具体阻断原因 |
| 新增 | [src/features/image-authorization/types.ts](../../src/features/image-authorization/types.ts) | 授权、原图片请求和免费精确计划的正式类型 |
| 新增 | [src/features/production/components/VideoAuditPanel.vue](../../src/features/production/components/VideoAuditPanel.vue) | 原任务只读身份、外部原件、独立复核和完整审计历史 |
| 新增 | [src/features/production/useVideoAudit.ts](../../src/features/production/useVideoAudit.ts) | 原任务发现、归属检查、版本冲突和独立同步提交 |
| 新增 | [src/features/production/video-audit-api.ts](../../src/features/production/video-audit-api.ts) | 三个正式审计接口与已有历史预检、原任务 GET |
| 新增 | [src/features/production/video-audit.ts](../../src/features/production/video-audit.ts) | 原件及复核门禁校验,区分供应方、SDK 与本地身份 |
| 新增 | [src/features/production/video-audit.types.ts](../../src/features/production/video-audit.types.ts) | 原身份、原件、复核版本和历史事件类型 |
| 新增 | [src/lib/billing-errors.ts](../../src/lib/billing-errors.ts) | 图片错误类型与审计冲突的中文展示映射 |
| 新增 | [tests/browser/billing.html](../../tests/browser/billing.html) | 本地 Chrome 隔离验收入口 |
| 新增 | [tests/browser/billing.ts](../../tests/browser/billing.ts) | 复用真实组件、主题与全量请求拦截的浏览器场景 |
| 新增 | [tests/features/image-authorization/authorization.test.ts](../../tests/features/image-authorization/authorization.test.ts) | 范围、额度、免费复用、供应方切换、未知及原预览提交回归 |
| 新增 | [tests/features/image-authorization/defaults.test.ts](../../tests/features/image-authorization/defaults.test.ts) | 推荐与既有选择优先级、主体覆盖、目标切换及迟到响应回归 |
| 新增 | [tests/features/image-authorization/settings.test.ts](../../tests/features/image-authorization/settings.test.ts) | 无预填批准、微美元转换、幂等重试和撤销回归 |
| 新增 | [tests/features/production/video-audit.test.ts](../../tests/features/production/video-audit.test.ts) | 独立登记、复核、并发冲突、证据不足及费用与质量分离回归 |
| 新增 | [tests/fixtures/billing.ts](../../tests/fixtures/billing.ts) | 无真实账户和收费的图片、视频费用夹具 |
| 新增 | [docs/audits/image-authorization-video-audit-2026-11-13.md](../../docs/audits/image-authorization-video-audit-2026-11-13.md) | 本轮逐文件职责、接口、验收、边界和 Git 状态交接 |
| 修改 | [src/features/generation-config/api.ts](../../src/features/generation-config/api.ts) | 配置解析增加取消信号,沿用服务端覆盖优先级 |
| 修改 | [src/features/generation-config/components/ProjectSettingsDialog.vue](../../src/features/generation-config/components/ProjectSettingsDialog.vue) | 原项目全屏配置中增加图片授权标签和固定底栏操作 |
| 修改 | [src/features/generation-config/context.ts](../../src/features/generation-config/context.ts) | 共享图片授权入口和配置修订,兼容独立作用域 |
| 修改 | [src/features/generation-config/image-defaults.ts](../../src/features/generation-config/image-defaults.ts) | 后端推荐仅用于未填写配置,解析主体覆盖并保护手动选择与迟到响应 |
| 修改 | [src/features/production/components/KeyframeDialog.vue](../../src/features/production/components/KeyframeDialog.vue) | 原首帧预览接入授权资格,保留镜头覆盖与候选门禁 |
| 修改 | [src/features/production/components/ShotProductionAssets.vue](../../src/features/production/components/ShotProductionAssets.vue) | 视频详情复用全屏抽屉,分开质量与费用审计并刷新原资源 |
| 修改 | [src/features/production/components/VideoCard.vue](../../src/features/production/components/VideoCard.vue) | 主视频和候选卡片增加费用审计入口 |
| 修改 | [src/features/spatial-layouts/components/MasterGenerationForm.vue](../../src/features/spatial-layouts/components/MasterGenerationForm.vue) | 原布局生成表单展示授权状态和独立费用确认资格 |
| 修改 | [src/features/spatial-layouts/components/SceneMasterManager.vue](../../src/features/spatial-layouts/components/SceneMasterManager.vue) | 布局授权范围内省略逐次图片收费确认,独立视觉审核保留原确认 |
| 修改 | [src/features/spatial-layouts/useMasterGeneration.ts](../../src/features/spatial-layouts/useMasterGeneration.ts) | 原母版免费预检接入布局范围授权、未知费用阻断和修订失效 |
| 修改 | [src/features/subject-identity/components/IdentityImageDialog.vue](../../src/features/subject-identity/components/IdentityImageDialog.vue) | 原身份图入口接入范围授权、原预览和主体覆盖配置 |
| 修改 | [src/features/subject-images/components/GenerateImageDialog.vue](../../src/features/subject-images/components/GenerateImageDialog.vue) | 原形态入口接入范围授权,同主体切换形态仍重新读取配置 |
| 修改 | [src/features/subject-images/generation-preview.ts](../../src/features/subject-images/generation-preview.ts) | 共用原预览、费用资格、精确免费复用和防重复提交 |
| 修改 | [src/lib/http.ts](../../src/lib/http.ts) | 费用错误展示为业务中文,保留原始错误码及细节 |
| 修改 | [tests/features/production/production.test.ts](../../tests/features/production/production.test.ts) | 首帧旧回归补充正式配置解析响应 |
| 修改 | [tests/features/production/public-assets.test.ts](../../tests/features/production/public-assets.test.ts) | 下载恢复旧回归补充镜头覆盖解析响应 |
| 修改 | [tests/features/subject-identity/identity.test.ts](../../tests/features/subject-identity/identity.test.ts) | 身份图片旧回归补充主体配置解析响应 |
| 修改 | [tests/features/subject-images/images.test.ts](../../tests/features/subject-images/images.test.ts) | 形态图片旧回归补充主体配置解析响应 |
| 修改 | [tests/features/subject-images/prompts.test.ts](../../tests/features/subject-images/prompts.test.ts) | 提示词旧回归补充主体配置解析响应 |
| 修改 | [tests/components/ui/form.test.ts](../../tests/components/ui/form.test.ts) | 公共图片表单回归补充正式主体配置解析 Mock |
| 修改 | [tests/features/workflows/pages.test.ts](../../tests/features/workflows/pages.test.ts) | 工作台端到端组件回归补充正式模型解析 Mock |
2. API 对接
- 图片授权完整接入 GET 列表、POST 免费计划、POST 登记、POST 撤销。请求使用现有 `/api` 代理和 `{ data }` 解包。USD 编辑值精确换为整数微美元,空白、非正数及超过 6 位小数均拒绝提交。
- 原身份图、形态图、首帧及布局母版继续使用原预览与生成接口。图片预览指纹与费用计划指纹分别保存和使用,正式生成保留 `setPrimary=false` 或原布局版本及 `confirmPaidGeneration=true`。
- 视频完整接入 GET audit、POST evidence、POST reviews。已有免费质检预检、原任务 GET 和项目最新执行记录负责任务发现与回读,没有新增收费、恢复或事件流接口。
- 正式后端只读核对两项均为 HTTP 200。项目图片授权及原图片请求均为空。原视频任务仍为 failed、billingBlocked=true,三个原步骤均 unreviewed,无外部证据和人工复核。
3. UI 与状态
- 授权在原项目配置抽屉独立管理。预算、单次预留、次数、有效期、批准人和接受浮动计费均由用户填写。展示累计准入预算、已记账及未结预留、余额、次数、到期、原请求和具体阻断原因。公开用量价与实际账单分别显示,未知不显示零。
- 单次预留不构成供应方账单硬上限,创建前明确说明。有效范围内用户主动生图省略逐图收费批准,其它供应方重新预览并独立确认。原 Creative Profile、主体和镜头覆盖及手动选择保留。
- 视频详情的质量和费用分开。原 Task、Workflow、本地请求、供应方请求与 SDK 回执分别显示。登记后不自动复核,核清后只刷新原审计、原任务、质量和列表及免费预检。旧视频过期、failed、needs_review 和晋升门禁沿原状态。
- 外部原件只保存引用和 SHA256。表单不生成供应方请求号,不用本地 UUID 或观测编号代替。未知金额保持 null,原件缺失、模糊关联、未知费用及原 SDK 事实冲突时禁用核清。
- 409 后刷新服务端版本、保留表单和原件选择、取消当前确认,等待人工重新核对,不自动重提。写入就地加载并使用 NMessage,正文独立滚动,底栏固定,窄屏单列,图标按钮复用正方形公共样式。
4. 验证结果
- Git 复核补齐公共表单与工作台页面两处旧配置解析 Mock,69 项定向复验通过。本次正常提交钩子将再次执行完整 pnpm check 和 Commitlint,结果以提交日志为准。
- 48 个相关 Vitest 文件、358 项用例通过。补充原请求阻断摘要断言后,图片授权 13 项再次通过。旧测试的配置解析 Mock 已按正式新增读取补齐。
- pnpm 启动时尝试拉取包管理器版本失败,本轮改用 node_modules/.bin 下已安装的 vue-tsc、vite、vitest、oxlint、eslint 和 oxfmt 完成等价范围检查。
- Vue TypeScript 检查、Vite 生产构建通过。改动范围 Oxlint、Vue ESLint、Oxfmt 检查和 git diff --check 通过。
- 本地 Chrome 使用 localhost 隔离页,全部 fetch 均由本页 Mock 拦截。授权与图片入口 10 项、视频审计 10 项核心交互断言通过,覆盖创建、撤销、到期、预算不足、未知阻断、免费复用、供应方重新确认、双击防重复、证据登记、重复登记、独立复核、并发冲突、核清不改质量、新证据使旧复核失效。
- Chrome 实际检查桌面和 400×706、500×883 窄屏。字段标签与控件间距为 8px,无水平溢出,长内容滚动前后底栏位置一致,取消保留可见键盘焦点。删除原件图标最终为 34×34。
- Chrome 刷新隔离页后请求记录为空,没有自动重发生成、授权或审计写入。
- Chrome 原控制连接超时,实际浏览器验证使用本机 Chrome AppleScript 与 DOM 事件完成。未使用 Playwright。
5. 契约边界与未执行项
- 真实收费图片、视频、独立视觉审核、修复及主资产变更均未执行。正式历史任务没有登记模拟材料或提交人工核清。原视频仍需真实供应方执行与账单材料才能处置。
- 后端普通精确授权预览只开放 identity/form/keyframe 的普通输入。自定义提示词、身份辅助视角和布局高级输入继续使用原预览及持续范围授权;精确免费复用提示仅在正式授权预览能够覆盖该输入时显示。
- 已过期候选准备新质检会被原预检拒绝,前端保留最新原任务发现,并提供按原任务编号只读查询。历史身份始终使用服务端原版本。
6. Git 状态
开发轮结束时未提交或推送。本 Git 轮用户已明确授权复核后提交并推送到 dev,实际提交和远端同步以 Git 记录为准。全程使用前端根目录 dev,未创建工作树,未修改后端代码。
@@ -0,0 +1,116 @@
# 分镜页面信息层级优化交接
## 范围与边界
- 在前端根目录 `dev` 完成,起点为 `b15a6011ce28dd58156ac3c5c06e84c8796fe39c`。保留同轮此前未提交的图片卡片改动。
- 本次只调整展示与按需展开,不修改后端、接口字段、收费参数、质量结论、来源校验及正式采用条件。
- 普通用户首屏先看到当前结果、主要输入和操作。流程介绍放信息图标,完整创作正文和业务历史按需展开。
- 普通详情不再直接输出整段响应、任务编号、SHA 或指纹。需要核对的历史改为明确的中文字段。原始对象仍用于请求、来源和并发保护;已有显式导出保留。
- 费用、未知请求、来源变化、覆盖、保存与正式采用的区别仍在操作处展示。信息背景只用于分组,不暗示质量通过。
- 未执行真实图片、文本、Vision 或视频模型,未向正式项目保存草案、采用、批准或核清费用。本轮完整改动已获用户明确提交及推送授权,交付目标为 `origin/dev`。
## 已有问题与本次结果
1. 图片列表原有最大宽度导致大屏右侧空白,长错误和模型名令卡片高度不齐。现在网格使用可用全宽,按缩略图列宽自动排布、统一等高;少量图片保留列位,不无限放大。手机单列。
2. 卡片依次显示图片、标签、图片名称、日期、操作。标签最小高度从 44px 收紧到单行 22px;名称前不再预留未使用的第二行。模型、尺寸、画幅问题、失败原因与来源说明放 info 浮层。
3. 没有独立名称的历史图片,使用镜头名及按创建时间生成的展示编号;不写回资产,不因主图切换而重编号。
4. 分镜摄影规划与开拍事实使用两块中性主题底面。构图机位、天气环境、主体和连续依据按需展开,完整原文保持可查看。
5. 摄影、联合草案、动作修订、首帧、质量和连续性相关弹窗收起流程介绍及高级参数;保存、预检和采用仍是独立操作。
6. 原来整段输出的摄影历史、动作版本、人工来源观察、布局约束、生成方案和许可记录改为中文业务记录。历史摄影保留修改前后构图、机位、审核人和时间;联合模式也可查看。
7. 普通有效图片授权不再误显示“原请求和费用仍未知”。只有实际阻断、可选许可、已选许可或读取问题时才显示有限许可区域;实际费用阻断保持可见。
8. 原候选校验、Workflow、来源复核去掉内部请求与执行编号、原始 JSON;执行状态、业务问题、独立质量结论、恢复与历史入口保留。
9. 布局完整约束改为要求、来源、画面要求、构图要求和验收依据;不再展示版本哈希。保存仍原样发送正式确认参数及期望版本。
## 文件职责
新增:
- `src/components/ui/RecordDetails.vue`:只接收显式选择的中文业务字段,不序列化接口对象;支持已在折叠区中的直接显示。
- `tests/components/ui/progressive-info.test.ts`:公共标题说明、动态费用状态、创作原文和长提示词按需展开。
- `tests/features/production/keyframe-dialog-density.test.ts`:普通有效授权与真实阻断分别显示,不自动生成。
修改:
- `AGENTS.md`:补充本次用户确认的信息层级与普通用户详情规范。
- `AppDialog.vue`、`AppDrawer.vue`、`WorkspaceSectionHeading.vue`、`FieldLabel.vue`:复用说明入口;动态说明插槽直接显示,创作内容可原样展示。
- `admin.css`:全宽等高候选网格、参考缩略图网格、开拍事实主题背景。
- `production/model.ts`、`KeyframeCard.vue`、`ShotProductionAssets.vue`:稳定图片展示名、紧凑标签、info 详情、对齐操作和候选/记录标题。
- `StoryboardPage.vue`、`ShotDesign.vue`、`ShotTools.vue`:分镜标题说明、摄影/状态分组和可读生成内容。
- `ShotDerivedReview.vue`、`JointDraftReviewPanel.vue`、`JointDraftFields.vue`、`DirectionStageReview.vue`、`derived-review.ts`:摄影审核、联合表单、完整差异和可读历史;原模式、保存、预览、采用保留。
- `MotionRevisionEditor.vue`:版本和失败候选摘要、历史按需展开,指定历史任务编号收起;保存、Vision、采用仍分别控制。
- `ImageGenerationPreview.vue`、`KeyframeDialog.vue`、`QualityDialog.vue`、`ValidationPreviewPanel.vue`:预览层级、长提示词、按需许可、费用背景和中文参考职责。
- `ContinuityReviewDrawer.vue`、`ContinuityJointReview.vue`、`ContinuityStateEditor.vue`、`SceneTransitionEvidence.vue`:连续性业务摘要、有限高度图片、中文正式依据、规划与视频末态区别。
- `SourceReviewDrawer.vue`、`LayoutSupplementPanel.vue`:原图来源记录、逐项人工观察、布局完整约束与来源影响,去除普通响应对象展示。
- `KeyframeValidationHistory.vue`、`KeyframeValidationSteps.vue`、`KeyframeExecutionStatus.vue`、`QualityResult.vue`、`WorkflowExecutionPanel.vue`:历史质量、执行与费用保持分离,去掉普通诊断数据 dump。
- `src/testing/naive.ts` 和相关 UI 测试:通过用户主动展开读取详情;按中文业务结果验证,不依赖内部编号显示。
- `tests/browser/v02-continuity.ts`:隔离页额外允许已拦截的免费布局输入预览,批准、签收、保存、执行和恢复仍返回拒绝;没有真实请求回退。
无删除文件,无依赖变更。
## 自动化验证
- 全量 Vitest:124 套、949 项通过。
- 之后补充中文来源/布局记录及历史保留检查,按受影响范围复验:摄影联合与动作修订 4 套 24 项通过;来源、连续性和质量等 6 套 90 项通过;新增展示断言所在 2 套 19 项通过。以上计数有重叠,不累加为全量数。
- 最后源码的 TypeScript 与 Vite build 通过。变量重命名消除作用域遮蔽警告后复验相关 Lint。
- 修改范围 Oxfmt、Oxlint、Vue ESLint 通过;`git diff --check` 通过。
## 本地 Chrome 验收
使用已有 localhost Chrome 标签页及原生辅助功能/截图/键鼠,没有使用 Playwright。
- 正式分镜只读:摄影与开拍状态背景分组、视觉重点 info、构图/主体/连续依据折叠;刷新没有自动打开生成配置。
- 图片卡片此前已验证桌面多列、移动单列、紧凑标签与名称、info 长内容和等高;本次保留这些布局及原质量/主图门禁。
- `v8-10.html` 隔离页:首帧流程说明进入 info、真实费用阻断仍显示;免费预览后长提示词默认收起且可展开;未点击生成。
- 同一隔离页:动作失败候选只读加载,指定历史任务收起;保存/采用/Vision 未触发。390×844 验证正文滚动、固定底栏和表单边界。
- `review-billing.html`:联合模式初始草案、全部差异、主体与衔接折叠、说明浮层;390×844 无横向溢出,固定保存/采用底栏可见。
- `b04-review.html`:来源复核免费预检,中文正式动作、原图记录、逐图未知观察;桌面和390×844均可浏览,底栏固定。隔离页拒绝全部写请求。
- `v02-continuity.html`:免费布局输入预览,展开中文完整约束,保存影响和独立确认仍清楚;未确认正式布局。
- 最后关闭设备模拟与开发工具,恢复正式分镜只读页面。
## 仍保留的专用能力
本次没有全局删除原始数据组件。独立账单审计里的原件与签署材料、显式导出、以及高级人工物理交互编辑仍按原契约保留;这些不作为普通分镜首屏的默认内容。后续新增界面继续遵守当前 AGENTS 的信息层级规范。
## 图片详情浮层裁切补充
- 本地 Chrome 复现:候选管理最右列的详情挂在弹窗内部,超过弹窗正文边界的文字被裁掉。
- `KeyframeCard.vue` 的详情、主图切换确认,以及公共 `WorkspaceActionTooltip.vue` 明确挂载至页面浮层,启用边缘自动翻转;长说明限制宽度并换行。
- 详情打开时停用同一按钮的悬浮说明,避免“查看首帧详情”提示叠在正文上。
- Chrome 只读验证桌面最右列详情完整显示;390×844 下摄影抽屉内同类详情保持在屏幕范围内,模型长名完整可读。恢复桌面并关闭开发工具。
- 相关 Vitest 3 套29项、TypeScript、两文件 Oxlint/ESLint/格式检查通过,未触发生成、审核或采用。
## 摄影编辑间距与长文阅读补充
- 原不一致来自独立折叠组的模块 gap 与 Naive UI 后续项默认 margin、header padding 叠加。新增公共 `workspace-collapse` 统一44px折叠行、首项与后续项留白、展开正文间距;已用于摄影审核、联合草案与设计状态的同类区域。
- 独立功能组使用现有两倍模块间距,来源读取与保存状态归为一组;完整草案单独用中性主题底面组织。表单字段统一16px,标签到控件仍为8px。
- 共用 `DirectionCameraFields` 增量支持摄影意图插槽,宽屏构图在左,机位与意图在右;列内保持固定字段间距,窄屏恢复单列。长文输入统一字号、行距和有界自动高度,未修改原文或提交结构。
- 已同步写入 AGENTS,后续同类界面按公共样式复用。
- 相关 Vitest 4套33项、TypeScript、修改组件 Oxlint/ESLint、格式及差异检查通过。Chrome 使用正式项目只读核对桌面分栏、等距折叠、390×844单列、长文内部滚动、正文滚动与固定底栏;未保存、预检采用或执行收费操作。
## 功能块罗马序标补充
- 公共 `WorkspaceSectionHeading` 增加可选 `marker`,默认不改变已有标题;以中性底面的罗马序标加强功能区边界。
- 联合修订面板按可见功能块依次编号:来源与草案状态、正式内容与历史、完整草案、字段差异、可选原文依据、画面与相邻镜头预览、审核与采用,以及可选采用后预览。条件区域隐藏时无跳号,嵌套字段和说明不重复编号。
- 只调整阅读分组,不改变保存、预检、采用、来源保护及任何收费动作。规则已补入 AGENTS。
- 根据后续反馈,编号功能块改用交替中性底面并去掉块间额外间距。每个同级功能区使用相同内边距,序标、标题保持一条左边线;草案及差异不再嵌套额外卡片缩进。块内表单仍保留必要间距。
- 最终相关 Vitest 4套34项、TypeScript、Oxlint/ESLint和差异检查通过。Chrome 桌面与390×844已确认序标及同级标题对齐、交替底面连续展示、正文和固定底栏正常;只读验收,未生成或保存正式结果。
## 原摄影修订模式同步
- `ShotDerivedReview.vue` 原模式也使用公共编号与斑马纹布局:正式分镜审核、正式摄影/图片/历史、可选差异及采用结果、已保存草案、可选视线范围和编辑、预览确认。按实际可见块连续编号,标题统一左对齐,块间无额外空白。
- 将来源刷新、历史与原图片归为一个功能区;保留原摄影修订、主体视线、前镜场景沿用、导入、草案保存、免费预览和正式采用全部入口。预览按钮改为就地宽度,避免被拉伸成整条灰色区域。
- Mock 摄影修订测试补充可见块连续编号与差异出现后的编号核对,原保存/采用/冲突保护继续通过。相关4套78项、TypeScript、Oxlint/ESLint、格式及差异检查通过。
- 本地 Chrome 桌面及390×844只读验证正式历史与过期草案、预览禁用、内容滚动和固定底栏;未点击保存、生成、审核或采用。
## 手机底部面板与弹窗头尾
- `AppDialog.vue` 和 `AppDrawer.vue` 在639px及以下统一使用直角底部面板。普通弹窗按内容自然高度,长表单及原全屏抽屉保留独立正文滚动和固定底栏。桌面继续使用原居中/全屏布局;没有新增Vant依赖或重复业务页面。
- 新增 `MobilePanelHandle.vue`:仅顶部44px手柄区域捕获指针,支持跟随下拉、短拖回位、距离/速度关闭、上拉阻尼、系统取消和多触点保护。提交锁在拖动中或离场过程中生效时均取消关闭;关闭、重新打开和切换桌面布局清理旧手势。保留关闭按钮、键盘和读屏入口,尊重减少动效偏好。
- 新增 `useMobileViewport.ts` 同步公共手机断点;新增 `usePanelScrollState.ts` 监听实际正文滚动。header默认无阴影,正文离开顶部后显示更淡的主题阴影,回顶和重新打开时清除;footer始终无阴影。PC和移动端头尾均不增加border,面板顶部不增加圆角。
- `admin.css` 统一手机底栏:单按钮整行铺满,多个按钮等宽填满可用行宽,只保留统一间隙;长标签按实际内容换行。PC底栏排版保留。
- 新增 `tests/components/ui/mobile-panel.test.ts`,覆盖轻触/短拖、明确下拉/甩动、兼容click误关闭防护、取消/丢失捕获、多触点、提交中和离场中加锁、公共组件键盘关闭、切回桌面、正文阴影和重新打开状态。
- 新增 `tests/browser/mobile-panels.html`、`mobile-panels.ts`,仅内存模拟,所有fetch均拒绝。Chrome原生操作已验证440×956手机模拟视口中的两类面板、横条关闭与回位、提交锁、长正文滚动、单/多按钮底栏、直角及淡header阴影;同时核对PC原布局与无分隔线。没有使用Playwright或执行任何真实业务请求。
- 前一次全量959项检查只有新增圆角违反既有扁平主题约束,已将面板及横条改为直角;相关主题、公共布局和手势回归56项通过。未放宽原主题检查规则。
- 最终全量Vitest:125套961项通过;TypeScript、Vite build、修改范围Oxlint/ESLint、格式及差异检查通过。
- 最新移动交互、头尾阴影和底栏要求已写入AGENTS。代码在前端根目录dev交付,实际提交号及远端状态以Git记录为准。
- 公共header标题在PC及手机端统一单行省略,完整名称保留在原文、可访问名称和title提示中,关闭与说明入口保持可见;公共footer按钮高度按原组件尺寸统一增加20%。Chrome已核对两类弹层和两种视口,相关检查通过。
@@ -0,0 +1,34 @@
# V02-06 前端接入记录
2026-11-09,前端根目录 dev,基线 0d58dd8;仅修改前端,未运行真实付费调用或修改受保护三镜。
## 正式契约
已对照后端四份 frontend-prompt:state-review、consumer-gates、joint-preview、joint-execution,并核对 storyboard.routes.ts、连续性 schema/state/vision/execution 服务。C2 的执行能力覆盖早期 C1 的 executionAvailable=false 限制,资格继续以免费计划当前返回值为准。
## 功能
- 原连续性抽屉默认固定几何;显式切换 geometry_and_state 后重新读取指纹和 stateContext。边界只取正式紧邻两镜,主体和 sourceIds 只从正式依据选择;before/after 不可辨认时保持 null,意见不默认通过。支持全部十三种维度、证据说明及可选非阻断用途理由。保存仍为用户主动签收,不替代单镜或所有连续性通过。
- 消费 continuity_review_required,保留原 readiness 门禁及服务端原因;HTTP409 CONTINUITY_REVIEW_REQUIRED 显示具体组问题并可回到 Storyboard 原连续性入口。已有 Primary、Prompt、force 均不清除服务端问题;没有自动重试。
- 原保存组详情加入联合免费计划,展示真实模型、图片顺序、全部绑定、合并空间图用途、未知执行费用、容量核验;完整脱敏请求与摘要放高级详情。只能读取原签收公开图像地址,不猜测路径。
- 独立登记真实批准人、操作人、批准材料 SHA 和单次估算范围;maxRequests 固定 1。登记前再次核对总计划 fingerprint,登记不执行,执行必须单独勾选。写入出错即撤销页面批准,断线未知只允许观察,不自动重新批准或重发。
- 通过免费计划 latestTask/reusableTaskId 找回原任务,沿现有 useWorkflowExecution GET/SSE 与 latest 发现;终态回读业务任务。completed 不推出 passed,原机器解析、当前评估、原人工未知分别追溯。恢复只依据 resumeAvailable/current,明确区分免费解析原回执与原批准下此前未发送的一次请求。
- 首帧卡片来源复核与画幅、操作组之间增加留白,辅助按钮复用中性底面;质量弹窗免费计划刷新按钮使用块级留白,操作和历史模块间距分明。
## 文件与复用
新增 continuity-state.ts、ContinuityStateEditor.vue:人工范围类型、输入校验和表单。
新增 continuity-joint.ts、ContinuityJointReview.vue:正式联合路由、计划、批准、执行和恢复;固定操作复用原抽屉 footer。
扩展 continuity.types.ts、ContinuityReviewDrawer.vue,复用原诊断、签收、历史接口,不新建质量计算或 SSE 系统。
扩展 production issue 类型/文案、HTTP 业务错误、项目阻断页和单镜工作区定位入口。
新增 tests/fixtures/continuity-joint.ts、continuity-joint.test.ts 与 tests/browser/v02-continuity.html/ts。隔离浏览器页只模拟免费诊断,批准、执行、恢复、保存写请求全部拒绝,不连接真实收费模型。
## 验证与边界
- 定向 Vitest:连续性人工、联合批准/业务失败/恢复/过期、原质量、消息共 5 文件 47 用例通过;更广的 production/projects/storyboard 回归曾为 40 文件 253 用例通过,随后补充两项联合恢复/过期测试也通过。提交钩子将运行最终全量 pnpm check,结果以提交日志为准。
- TypeScript、Oxlint、ESLint 已执行;最终格式及全量检查随提交钩子复核。
- 本地 Chrome 复用 localhost:4312 标签页,未使用 Playwright。隔离页面检查默认几何与人工状态范围、空白意见/未知、正式依据选择、长表单滚动、联合图片/合并绑定/未知费用、390×844 窄屏及固定关闭底栏。真实项目检查首帧卡片与质量弹窗的暗色布局、刷新计划和历史模块间距;未点击真实执行或签收。
- 真实 GET 联合免费预检(原签收 cmw7y6sqt0008rono7bv2lopl):ready、executionAvailable=true、qwen3.8-max、paidCalls=0、最多拟请求 1 次、amount=null;图片序号 1–4,绑定数依次 1/1/1/3。它不代表已获批准或联合审核已通过。
- 真实授权、联合执行、恢复、状态签收写入没有实测,本次保护正式首组三镜与原签收,自动化使用隔离响应。未生成视频、未修改 Primary、未创造新签收规避缓存。
未发现必须新增的后端接口。后续真实联合执行仍需按对象、精确计划、次数及费用获得用户独立明确批准。
@@ -0,0 +1,126 @@
# V8-10.2~V8-10.12 前端接入交接
## 范围与基线
- 前端根目录 `dev`,起点 `f6edc4eb708b0f69b078b6c74b5d1ca3d6eb8e30`,起始干净;只修改前端,没有创建 worktree。
- 后端契约基线 `fd0ab65c3c2d78032cdf8c243621df2941315e40`。收尾只读核对时为 `1f9ceace`,相对基线仅增加第三张图片执行审计等文档,没有修改本轮接口。后端另有并行质量审计文档未提交,本轮没有改动它们。
- 已核对用户指定四份公开 API、四份前端 Prompt,以及实际授权 Schema/Repository、图片 Provider/Storyboard/Video Router 和相应服务。
- 所有写入验收使用隔离 Mock。正式项目仅 GET;没有启动图片、文本、Vision、Repair、视频、Primary 或历史 unknown 重试。
- 开发验收时未提交、未推送;验收后用户已明确授权将本轮全部改动提交并推送到 `dev`。本次集中交付包含新增 9、修改 28、删除 0,共 37 个文件;保留正常提交钩子,最终提交号与远端同步状态以 Git 记录及交付回复为准。
## 已有能力与真实缺口
| 原有实现 | 本轮真实增量 |
| --- | --- |
| standing、additional、精确费用 Preview、撤销、图片费用审计 | bounded 创建、逐镜计划与次数、总次数、原预算、逐项接受 unknown、首帧主动选用 |
| Motion Plan 人工版本、保存、Workflow 起点校验、正式采用 | failed_candidate 根与 manual 子、null 原指针、原 Task/Workflow/公开回执、完整来源预检、精确起点计划指纹 |
| Provider 按需能力检查、实际生成 Preview | 容量 409 撤销旧成功状态、保留实际阻断和公开上限 |
| 原普通摄影草案、联合采用、视线与场景沿用、草案历史 | 已有失败图片下的 composition/cameraPosition 修订、完整差异/历史/相邻版本、采用后正式预览与质量刷新 |
| 机器审核与有效质量、候选管理、历史生成输入原件 | failed/stale 组合摘要、原图片费用按候选读取、来源变化后重新读取质量、候选与历史弹窗交接 |
| 时间语义、正式连续性问题与门禁 | sceneTransition 人工规划确认与真实视频末态分开展示 |
没有新增业务路由、第二套摄影编辑器、时间轴、费用或 Workflow 页面。继续保留 V8-9 的 additional、独立证据/复核、联合环境依据、原历史和来源保护。普通镜头目录无默认勾选,进入分镜页不弹生成配置。
## API 与交互
| 正式 API | 接入结果与边界 |
| --- | --- |
| GET /projects/:id/image-authorizations | 沿原投影读取 standing、additional/bounded、逐镜 usedRequests、inputFingerprint、原 unknown/预留及审计状态 |
| POST /projects/:id/image-authorizations | mode=bounded 严格发送正式 Schema:原 standing、接受的未知请求及 SHA、固定 OpenAI/型号、逐镜 source/plan/options/maxRequests、总次数、期限、两项风险确认、人及说明;不发送新预算 |
| POST /projects/:id/image-authorizations/preview | 用户主动逐镜免费编译,取得真实 Source/费用计划;不是图片生成、质量通过或费用核清 |
| POST /projects/:id/image-authorizations/:authorizationId/revoke | 继续原撤销,显示已用/剩余;撤销、过期、用尽不再允许领取,历史及旧预留不删 |
| POST /storyboard-shots/:id/keyframe | 单镜明确选择许可并再次核对精确预览;bounded 仍使用 additionalAuthorizationId。一次成功停止;同计划完整结果可只读查看 |
| GET /storyboard-shots/:id/keyframe-provider-capability、GET /image-providers/capabilities | 按需检查,409 清旧 capability 和实际生成预检。实际需要数量沿后端业务错误展示,Provider 上限来自公开能力;不丢必需参考或换模型 |
| GET /storyboard-shots/:id/video-prompt/preview、GET /video-prompt/executions/:taskId | 免费发现/只读核对原失败候选;原 SDK 未公开全文不伪造,展示公开 observations、steps、usage、Task/Workflow/质量 |
| GET /motion-plan/revisions、POST /revisions/preview、POST /revisions | failed_candidate 根与 manual 子保持区分,originalRevisionId=null 合法。先免费预检再明确保存;保存不启动起点模型或正式采用 |
| POST /revisions/:id/start-state-validation/start、PUT /revisions/:id/active | 起点前再次免费核对完整计划,发送 expectedPlanFingerprint;只有当前保存版本、主首帧和来源匹配的有效证据才可独立采用。复用旧 Workflow/SSE,不自动生成 Video Prompt/视频 |
| POST /projects/:id/storyboard-derived-reviews/confirm | 下游摄影沿原普通模式,仅 composition/cameraPosition;不发送 jointRevision 或 direction-only phase,其他正式字段原样保留。保存和正式采用独立 |
| GET keyframes、quality-review、validations、generation-input | 资产列表只来自真实 keyframes;未执行计划不变成候选。旧图可查看原输入、机器结论、当前有效质量;费用在原历史中按 project/Shot/candidateId 精确过滤授权账本 |
- bounded 只使用原预算,当前 blocker 必须逐项明确接受且 inputFingerprint 一致;新的未知请求或在途请求继续停止领取。
- 授权期限进入预览快照;页面停留期间到期也撤销旧成功预检,提交时再检查,不用旧许可继续生成。
- 任何能力 valid 仅说明对应输入。费用、规划、起点像素、图片质量、Primary 和正式采用独立。
- `basis=confirmed_plan` 且 `verifiedVideoEndState=false` 展示“人工规划衔接已确认,视频末态尚未验证”,使用中性状态;不推断前镜真实视频尾态。
- `SCENE_CONTINUITY_REVIEW_STALE` 清旧成功预览、保留输入、重新只读来源并等待人工确认;不自动重提。摄影/Motion 409 同样保留人工稿并刷新来源。
- 摄影采用后读取正式 D/VS、草案 Current/Stale、正式 Keyframe Preview 和免费费用计划,并强制刷新原图有效质量。原机器失败与旧图片不被删除或改写。
- 旧 `qualityDecision=failed`、当前 `effectiveQualityStatus=stale` 显示“历史审核未通过,当前来源已变化”。completed 不等于质量 passed,passed 不等于 Primary。
- 长原文、来源/计划/回执与历史使用已有公共折叠。沿用 NMessage、主题变量、就地 loading、固定底栏;候选管理完全关闭后再进入原图历史,避免双重焦点约束。
## 实际文件与职责
新增 9 个文件:
- `src/features/image-authorization/BoundedAuthorizationFields.vue`:原设置中的逐镜有限风险表单,复用原抽屉 footer。
- `src/features/storyboard/components/SceneTransitionEvidence.vue`:分镜与首帧共用的正式人工规划依据展示。
- `tests/features/image-authorization/bounded.test.ts`:范围/期限/次数/原预算/未知集合和显式登记。
- `tests/features/storyboard/failed-motion-candidate.test.ts`:原失败根、人工保存、精确起点及独立采用。
- `tests/features/storyboard/camera-candidate.test.ts`:已有图片的普通摄影保存/采用、质量刷新、409 保留。
- `tests/features/production/v8-10-contract.test.ts`:容量、连续性、failed/stale/Primary、旧图费用和范围隔离。
- `tests/browser/v8-10.html`、`tests/browser/v8-10.ts`:复用真实组件的 Chrome 隔离入口,fetch 全拦截,未知请求 403,绝无真实网络 fallback。
- 本交接文档。
修改 28 个文件:
- `src/features/image-authorization/{ImageAuthorizationSettings.vue,api.ts,model.ts,types.ts}`:登记模式、许可历史、原撤销、正式契约与实际准入。
- `src/features/production/api.ts`:免费正式预览支持已有项目 scope。
- `src/features/production/components/{KeyframeDialog.vue,ModelCapabilities.vue,KeyframePreviewChecks.vue}`:单镜主动选许可、能力阻断、正式规划说明。
- `src/features/production/components/{KeyframeCard.vue,KeyframeValidationHistory.vue,ShotProductionAssets.vue}`:有效质量、只读图片、按候选费用、来源更新与历史弹窗交接。
- `src/features/production/effective-keyframe-quality.ts`:机器历史与当前过期状态的组合摘要。
- `src/features/storyboard/components/{MotionRevisionEditor.vue,ShotDerivedReview.vue,ShotTools.vue}`:复用现有动作、摄影和详情交互。
- `src/features/storyboard/{generation-spec.types.ts,motion-api.ts,motion-revision.ts,motion.types.ts,useMotionRevision.ts}`:正式连续性/失败候选/精确起点计划契约与编排。
- `src/features/subject-images/generation-preview.ts`:旧费用准入清除、衔接冲突及授权到期保护,原 unknown guard 保留。
- `src/lib/{billing-errors.ts,user-facing-text.ts}`:bounded、来源/活动锁的中文反馈,原码保留。
- `tests/features/image-authorization/settings.test.ts`:原 standing 用例按语义标签定位,保留原幂等验证。
- `tests/features/production/quality.test.ts`:公开能力“默认推荐”文案断言。
- `tests/features/storyboard/motion-revision.test.ts`:起点启动正式精确计划指纹。
- `tests/features/subject-images/generation-preview.test.ts`:规划来源冲突与停留到期不收费回归。
- `docs/api-contract-sync.md`:本轮契约同步索引。
删除 0 文件;没有改依赖、锁文件或后端文件。
## 正式 API 只读观察
2026-11-18 本轮 GET 及 Chrome 时点,不是本轮生产或质量结论:
- V02 授权投影 `billingBlocked=true`,unknown 1 条。原 standing 已请求 5 次、剩余 495 次、余额 98,719,355 微美元;一个 additional 已撤销、已用 1、剩余 1;三个 bounded 各已用 1、剩余 0,全部不可再次使用。
- 3.1:originalRevisionId=null、activeRevisionId=null,包含一个 failed_candidate 根和一个 manual 子,均未正式采用;失败根有原 Task/Workflow/回执来源。
- 3.2:三张 completed 候选均非 Primary。最新机器 unknown/有效 blocked;第二张 unknown/unknown;第一张 failed/stale。第三张已由其它任务生成,不能继续写成“只有计划、尚未生成”。
- Chrome 旧图原请求详情:原预留 USD 1、公开用量价 USD 0.076537、实际账单未知;与旧机器失败、当前过期分别展示。
- 后端另一个任务持续更新正式质量审计。最后复验历史交接时服务短暂不可达,页面显示连接失败,不沿用旧成功数据;此前上述 GET/历史读取成功。没有为制造成功状态写入正式数据。
## 自动化与 Chrome 验收
2026-11-18 最终自动化检查:
- `node_modules/.bin/vitest run`:122 个文件、941 项全部通过,77.35 秒。首轮发现两项旧断言(下拉框位置、能力文案)并按真实语义修正;最终重新全量通过,不将首轮结果记为全绿。
- `node_modules/.bin/vue-tsc --noEmit`:通过。
- `node_modules/.bin/vite build`:通过,1.15 秒。
- 修改范围 Oxlint、Vue ESLint、Oxfmt 及 `git diff --check`:通过。
- 新增 28 项测试;覆盖 bounded 范围/预算/旧 unknown/期限/撤销/用尽、Motion 根/子/保存/精确起点/采用/并发、普通摄影兼容/409/完整字段/质量刷新、Provider 容量、规划非视频末态、候选质量/Primary、项目切换与旧图费用隔离、停留授权到期及来源冲突不重发。
测试过程未调用真实模型,未模拟路由一律拒绝。
Chrome 使用已有本地 Google Chrome 与 `localhost:4312`,原生 AX、截图、键鼠和 DevTools Responsive,未使用 Playwright。
- 桌面人工填写 bounded:选择原 standing/Shot,逐镜费用计划,次数 2/总 2、期限/人/理由、逐项 unknown 接受和浮动风险确认;登记前按钮禁用,登记后已用 0/剩余 2、无生图。
- 单镜不默认选许可;显式选择、重新 Preview 后主动模拟生成一次,已用 1/剩余 1,原 standing 预算同步扣减;随后只读查看同计划结果不增加模型请求。
- 撤销剩余许可后显示不可领取,原 unknown、预留及未知实际账单保留。
- failed 候选读取/载入/修改/免费预检/保存分开;创建 failed 根/manual 子,active 仍为空,Vision 0。切换 failed 根后不能直接起点审核或采用。
- Provider 容量阻断实际显示必需 17、上限 16;原成功输入不再展示,确认生成禁用;不删参考、不换模型。
- sceneTransition 仅显示人工规划已确认、视频末态未验证,未显示质量 Passed。
- 摄影构图在原模式保存、免费预览和明确采用,显示完整差异、当前及邻镜版本、摄影历史与原图片/质量;采用不自动生图。
- 390×844 核对首帧、摄影、Motion、bounded 长表单,正文可滚动,标题与底部关闭/提交保持可见,单列字段无横向溢出;恢复桌面响应式设置。
- 正式分镜页进入时没有生成弹窗和目录复选框;真实 3.2 三候选质量区别可见,旧图费用/来源历史可读。候选关闭后原图历史独立接管焦点。
截图(本地验收产物,不进入源码):
- `/Users/goujun/.codex/visualizations/2026/11/15/01a1df1f-2851-7ff2-b840-d1a0f3154f74/v8-10-motion-mobile.png`
- `/Users/goujun/.codex/visualizations/2026/11/15/01a1df1f-2851-7ff2-b840-d1a0f3154f74/v8-10-bounded-mobile.png`
- `/Users/goujun/.codex/visualizations/2026/11/15/01a1df1f-2851-7ff2-b840-d1a0f3154f74/v8-10-real-candidates.png`
## 未接入与验收边界
- 本轮要求的前端能力已接入;真实收费端到端生成、起点 Vision、正式摄影/Motion 采用、真实费用核清均按用户限制未执行。
- 原模型公开接口没有提供 SDK 原始全文时,仅展示正式公开的观察、用量及回执元数据,不补造原件。
- 容量 409 未提供结构化实际数量时保留后端含实际数量的业务原因;不根据前端关键词计算参考数量。
- 完整旧输入沿已有 generation-input 原件展示,缺少记录或 OpenAI 账本匹配不推断为零费用,也不重编译历史输入。
@@ -0,0 +1,158 @@
# V8-9.4~V8-9.9 前端接入交接
Git交付补充:用户已授权本轮全部52个前端文件集中提交并推送dev,主题为 `feat(short-drama-agent-front): 接入联合修订与图片费用审计`。下文未提交/未Push和旧文件统计保留各验收时点;最新范围含后续环境增量,实际SHA及远端状态以本次仓库记录为准。
集中提交检查补充:首次正常钩子已通过全量Lint、488文件格式及类型检查,118套/913项测试中有3项暴露当前新回执被错误归入历史。已在原页面标记本页明确发起的操作,让新回执直接显示,恢复历史仍默认收起且不弹窗;未放宽原生成、费用或校验判断。3项原失败回归及2项浏览回归定向通过(其余59项未选中),本地Chrome原全请求隔离页验证新回执无需展开历史即可查看,截图在同级 `storyboard-cleanup/current-receipt.jpg`。提交钩子保留并重新执行全量,最终结果以此次提交终端为准。
日期:2026-11-16。前端根目录 `dev`,起始 `87427d9d4347fcc5535cbe74728ab00bf53ae796`;后端契约基线 `2d3abdab5f2656223ab98161dff6388200db281c`。只修改前端,没有新建工作树,没有提交或推送。
## 已有实现与本轮缺口
| 范围 | 已有能力 | 本轮补齐 |
| --- | --- | --- |
| 摄影审核 | 原独立摄影、组合草案、视线修订、场景沿用、草案保存/历史、版本保护 | 原抽屉内联合模式、完整字段差异、本镜/邻镜版本、免费预检及冻结请求采用 |
| 图片授权 | OpenAI 有限持续授权、原请求费用/余额、撤销、普通首帧 Preview、未知请求保护 | 人工有限追加登记/显示/撤销、原首帧主动选用、精确计划资格核对与成功后免费复用 |
| 费用审计 | 视频原件登记与独立复核 | 提取共用字段/校验,增加图片域三个正式接口及独立费用投影 |
| VisualState | 原主体/环境/continuityNote、原问题及定位、任务回执 | 正式时间标记分段与开拍说明、三种时间问题中文标题 |
| Workflow | 持久化 WorkflowExecution、GET/SSE、活动任务锁、恢复观察 | 继续复用;联合采用与费用审计为免费同步操作,不新增任务系统 |
没有第二套摄影编辑器、时间轴、授权服务或业务页面。后端接口缺失没有用其它功能代替。
## 联合采用交互及保护
1. 从原“摄影草案与审核”切入联合模式,读取正式 Direction、VisualState、质量确认、Keyframe Spec 和原保存草案。项目、剧集、镜头归属不一致时不开放写入。
2. 展示完整原稿与正式前后差异;身份、Form、环境、主体集合及其它不允许字段也显示,不悄悄过滤后提交。仅开放 composition、cameraPosition、visualIntent、continuityNote 及主体 expression/pose/gaze/position/transientState。
3. 保存完整原草案使用 expectedRevision 及当前正式来源。保存成功只提示“尚未正式采用”,不变更正式 D/VS。
4. 免费画面预览读取 draftFingerprint、currentDerivedFingerprint、adjacentDerivedVersions;邻镜必须完整对应同集正式顺序,不可缺漏、重复或伪造。
5. 原 confirm 路由 `preview:true` 发送 jointRevision 的保存版号、本镜版本、完整邻镜、原因和全部 1~40 项差异。人工勾选后,正式采用提交完全相同快照,仅改 `preview:false`。
6. 接受 changed 或 reused 的正式回执。409 或未知回执废弃旧预检,重读正式 GET,保留人工输入,等待明确重读/重新预检;不自动覆盖、保存或再次采用。
7. 采用后读取正式 D/VS 及正式 Keyframe Preview,草案显示 stale 时保留原文与历史。草案指纹不提交生图。没有自动生图、Vision、Repair 或 Primary。
原摄影、组合草案、视线修订、场景沿用和草案历史的分支保留。超出40项、字段超过4000字、越界或混入其它修订模式时有简短原因并禁止联合采用。
## 追加许可与费用审计
- 追加许可表单只接受原 unknown OpenAI 首帧请求,次数、署名和风险确认不预填;POST 只发送正式 additional Schema,不构造新型号、范围、预算或供应方。
- 显示原请求、原型号/镜头、计划及来源、原预留/未知账单、批准/已用/剩余次数和状态。撤销走原 revoke;撤销后剩余次数不可领取。没有自动创建许可。
- 首帧入口必须主动选择已有许可并重新读取图片 Preview 与精确费用计划。项目/镜头/型号/来源/计划、原批准预算/有效期、追加剩余及其它在途请求逐项核对,最终领取仍由后端事务裁决。
- 原 unknown 本地保护不清除;追加使用包含项目、许可和已用次数的独立提交标识。一次提交后停止,不自动用完剩余次数;存在同计划完整结果时,只读核对候选,不再生成或设主图。
- 追加界面仅适用 OpenAI,其它供应方保留原保护。授权响应结构不完整时显示读取错误,不将其当成空授权或允许重试。
- 图片审计复用项目设置的同一 AppDrawer/固定 footer。原 project/request/identity 和 taskFingerprint、evidenceSetFingerprint、reviewFingerprint 全部来自正式 GET。
- 证据登记默认执行/费用未知、金额 null、无供应方编号和空材料;独立复核默认保留阻断。用户另行选择正式材料、填写署名/理由/真实摘要、切换决定并确认后才能提交。
- 校验 USD 整数微美元精度;零金额必须显式填写,null 不显示为0。本地请求、候选、授权、镜头、项目及材料中的 LangSmith 编号不能冒充供应方请求号。
- 登记不解除阻断,核清不覆盖原 unknown/账单/预留,也不代表生图成功、质量 Passed 或 Primary 可采用。核清后刷新原授权余额,原同计划没有结果的 unknown 仍不能普通重发。
- 编辑、GET刷新或409撤销确认;409保留全部表单并重读正式版本,无自动第二次 POST。切项目/请求清空材料、签署和选择,迟到响应不回填。
## 正式 API 对接
下表的写入流程均由隔离 Mock 验证;正式服务仅进行免费只读核对,没有为验收在真实项目登记证据或采用草案。
| API | 用途及结果 |
| --- | --- |
| GET/PUT 原 keyframe-review-draft | 复用原草案保存及 expectedRevision,保留完整原稿与显式 providerInput |
| POST 原 keyframe/preview | 草案与正式模式分离;联合使用本镜/邻镜派生版本,采用后重读正式 Preview |
| POST projects/:projectId/storyboard-derived-reviews/confirm | 原接口新增 jointRevision,免费预检/正式采用/幂等/冲突走同一契约 |
| GET/POST projects/:projectId/image-authorizations | 保留原授权,新增 additional 分支、已用/剩余投影,首帧显式选择使用 |
| POST image-authorizations/:authorizationId/revoke | 原接口撤销持续授权或追加许可,保留历史 |
| GET projects/:projectId/image-requests/:requestId/audit | 原身份、原费用、阻断及证据/复核历史读取 |
| POST 原 audit/evidence | 原完整身份/版本绑定,登记与解除分开 |
| POST 原 audit/reviews | 独立复核携带三项并发版本,409读取正式GET,不自动重提 |
| POST 原 storyboard-shots/:shotId/keyframe | 仅用户操作时附 additionalAuthorizationId 和原项目 scope,Preview 不携带许可字段 |
| GET/SSE 原 WorkflowExecution | 沿用原观察链;刷新、重进或订阅重连不生成 POST |
真实只读核对的时点结果:
- `localhost:3412/api` 的保存草案 5.2 返回 revision1/stale,主体 formId 与正式 subjectFormId 相同,未做猜测映射或重存。
- 项目 `cmw02vpwi000005axrdtus3pa` 的授权 GET 为200:持续授权1、追加许可1、billingBlocked=true、unknown1。原阻断请求 `cmwhxdc0i0003rocjcz80n31v` 保留。
- 上述原请求 audit GET 为200:unknown、预留 USD1、原实际账单 null、Provider Request ID null、无原成功回执、unreviewed、billingBlocked=true,证据及复核历史均0。没有声称该正式请求已核清。
- 正式质量确认 GET 为200,valid=true、60镜。本轮观察期间另有后端任务继续生产,正式页面 D/VS 覆盖随之变化,不能把该变化计为本轮执行成果。
## 时间语义
当前主体/环境显示为本镜0秒开拍状态,允许已经开始的持续动作。continuityNote 仅按后端明确的【输入事实】【规划末态】【连续要求】【视频末态】四种标记排版,旧无标记原文完整保留,不靠动作关键词判定有效性。视频末态明确仍需真实视频证据。
VISUAL_STATE_START_CONFLICT 显示开拍状态冲突;VISUAL_STATE_TIME_NEEDS_REVIEW 显示人工待核对;VISUAL_STATE_VIDEO_END_UNSUPPORTED 显示真实视频末态缺证。原 code/severity/field、原回执导出及集/段落/镜头位置保留,不把 needs_review 转为通过。
## 文件职责
以下路径相对前端根目录。含后续浏览精简及目录/按钮补充,新增25个文件、修改25个文件、删除0个文件;没有修改依赖或锁文件。
| 状态 | 文件 | 职责 |
| --- | --- | --- |
| 新增 | src/features/storyboard/joint-review.ts | 完整稳定比较与允许/越界差异声明 |
| 新增 | src/features/storyboard/components/JointDraftFields.vue | 原摄影字段组件复用及有界开拍字段 |
| 新增 | src/features/storyboard/components/JointDraftReviewPanel.vue | 草案读取/保存、版本、邻镜、预检、采用和冲突处理 |
| 新增 | src/features/storyboard/visual-state-time.ts、components/VisualStateContinuity.vue | 统一时间标记及问题标题、共享原文展示 |
| 新增 | src/features/billing-audit/types.ts、labels.ts、evidence.ts、BillingEvidenceFields.vue | 图片/视频共享原件类型、文案、校验、表单 |
| 新增 | src/features/image-authorization/billing-audit.types.ts、billing-audit-api.ts、billing-audit.ts | 图片原身份、正式审计API、金额与核清条件 |
| 新增 | src/features/image-authorization/useImageBillingAudit.ts、ImageBillingAuditPanel.vue | 同一授权抽屉的图片登记/独立复核/历史/409 |
| 新增 | tests/features/storyboard/joint-review.test.ts、tests/fixtures/joint-review.ts | 联合保存/预检/采用/幂等/冲突/时间与完整差异 |
| 新增 | tests/features/storyboard/page-browsing.test.ts | 历史回执恢复不弹窗、目录浏览与生成范围勾选分离 |
| 新增 | tests/features/storyboard/directory-position.test.ts | 真实目录包装结构中的段落吸顶高度避让回归 |
| 新增 | tests/features/image-authorization/additional.test.ts、tests/fixtures/image-additional.ts | 许可范围/次数/撤销/预算、原guard保留及一次主动生成 |
| 新增 | tests/features/image-authorization/billing-audit.test.ts、tests/fixtures/image-billing-audit.ts | 登记/独立复核、精度/null、409、范围隔离与历史 |
| 新增 | tests/browser/review-billing.html、review-billing.ts | 真实组件的内存隔离验收页,全fetch拦截,未知路由403,无真实回退 |
| 新增 | docs/audits/v8-9-4-9-frontend-integration-2026-11-16.md | 本轮交接、验证和边界 |
| 修改 | src/features/storyboard/components/ShotDerivedReview.vue | 原摄影抽屉内的联合模式与固定底栏 |
| 修改 | src/features/storyboard/StoryboardPage.vue、components/StagedShotPreparation.vue | 配置只由用户打开、普通目录无多选、历史按需展开与精简说明 |
| 修改 | src/composables/useDirectorySelection.ts、src/components/ui/ActionMenu.vue | 语义分组定位标题、更多按钮统一默认中性底色 |
| 修改 | src/features/storyboard/derived-review.types.ts、derived-review-api.ts | 联合正式字段、预览/采用回执及原路由 |
| 修改 | src/features/storyboard/components/ShotDesign.vue、GenerationReceipt.vue | 开拍/衔接及时间问题展示 |
| 修改 | src/features/storyboard/types.ts、src/features/workflows/WorkflowExecutionPanel.vue | 保留时间问题码/级别/位置与原逐集回执 |
| 修改 | src/features/image-authorization/types.ts、api.ts、model.ts、ImageAuthorizationSettings.vue | 追加许可、精确资格、原余额/未知、同抽屉图片审计 |
| 修改 | src/features/production/components/KeyframeDialog.vue、ShotProductionAssets.vue | 原首帧选择许可/重新预览/一次提交/免费只读复用 |
| 修改 | src/features/production/types.ts、api.ts | 可选追加许可及原项目请求范围 |
| 修改 | src/features/subject-images/generation-preview.ts | 共用精确费用核对及只读复用回调,原收费保护保留 |
| 修改 | src/features/production/components/VideoAuditPanel.vue、video-audit.ts | 视频原证据字段/校验复用共享实现,保留原视频操作与导出 |
| 修改 | src/lib/billing-errors.ts、user-facing-text.ts | 追加/审计/联合/时间中文原因、网络与Provider配额区别 |
| 修改 | docs/api-contract-sync.md | 本轮契约同步索引 |
## 自动化与本地 Chrome
本轮新增3套34项测试;专项测试覆盖完整差异、保存/采用分离、冻结请求、幂等、邻镜409、旧模式、许可次数/撤销/预算/跨项目镜头型号来源计划、原guard、未知历史/null金额、登记与独立复核分离、证据版本409和项目隔离。共享视频原能力及原图片预览/候选恢复由现有回归覆盖。
首次全量发现其它图片供应方失败候选也尝试读取追加许可,已收紧到 OpenAI,补正式响应结构核对。原下载恢复和新增追加相关2套25项已通过;最终全量结果见下方验证记录。
本地 Chrome 复用原标签页及 `localhost:4312`;所有写入在 `/tests/browser/review-billing.html` 全拦截隔离页面,只用原生AX/键鼠/截图,没有 Playwright。已验证:
1. 原摄影模式切联合、编辑完整草案、保存7→8版、完整前后差异、邻镜2.1、免费预检、人工勾选后采用;正式 D/VS/Preview 刷新、原草案stale与历史保留,没有生图。
2. 预检后模拟邻镜变化:正式采用409,输入保留、预检和确认撤销;用户明确重读、再次预检/确认后才采用。
3. 原 unknown 下手填追加次数2、批准材料与风险确认,登记后未生成;首帧默认不选许可,主动选择并重新预览后仅1次模拟图片请求;再次同计划查看完整候选不增加请求。
4. 已用1/2、剩余1;撤销后不可领取,原 unknown、预留/null账单及新 completed 两笔均保留。
5. 手填仅供Mock的执行/账单原件登记后仍阻断;另切独立复核,默认保留,主动选证据/核清/署名/理由/SHA/确认后核清。原 unknown、原预留及未知实际账单仍保留;历史展示登记与第1次独立复核。
6. 390×844 窄屏检查完整差异、四类时间说明、长表单和审计历史,正文滚动、标题及底栏固定、字段有留白,关闭按钮可见。恢复临时视口到原桌面尺寸。
7. 刷新隔离页为0模拟同步操作/0模拟图片请求/0真实模型请求;没有刷新触发写入。费用409保留表单与跨项目隔离由自动化覆盖。
截图保存在 `/Users/goujun/.codex/visualizations/2026/11/15/01a1df1f-2851-7ff2-b840-d1a0f3154f74/v8-9-4-9/`:joint-adopted-desktop.jpg、joint-diff-mobile.jpg、image-audit-mobile.jpg。
最终验证记录:
- Vitest 全量116个文件、907项通过,0失败/0未处理错误;其中本轮新增34项。
- Vue TypeScript `vue-tsc --noEmit` 通过。
- 改动范围 Oxlint、全部修改/新增 Vue 的 ESLint、Oxfmt 检查通过,无警告;文档补齐后只重新检查对应文档和差异。
- Vite生产构建通过,4964个模块,未把隔离测试页面作为生产构建入口。
- `git diff --check` 通过;初轮涉及前端44个文件,后续浏览精简共47个文件,没有依赖或锁文件变动。
## 分镜浏览精简补充
用户反馈普通目录多选、进入页面自动弹出配置和说明过多后,定位并修复以下原因:
- 目录多选来自页面固定传入 selectable,且生成抽屉已有重复选择器。普通目录改为单纯浏览;完整按段落/镜头勾选保留在“生成与恢复 → 选择镜头”。切换到当前集/全项目范围不再显示不适用的勾选区。
- 自动弹出来自 useStoryboard 在恢复历史 Workflow 终态后设置 session.receipt,页面 watcher 把任何回执变化都当成打开指令。移除 watcher 中的打开动作,保留回执、状态观察和镜头重生成后的时长刷新;只有主动点击入口打开配置。
- 默认保留摄影参数/意图与0秒环境摘要,完整构图/机位、连续性和主体状态使用 NCollapse 按需展开,原创作正文完整保留。全项目进度归入生成配置,删去重复介绍;覆盖风险、费用及作用范围继续在原确认流程展示。
- 已完成任务及原回执默认收起;正在执行、待读取和失败记录仍直接显示,不隐藏费用未知或失败处理入口。
先复现两项失败回归,再修复;定向5套35项通过,TypeScript、修改范围 Oxlint/Vue ESLint/格式及生产构建通过。本地 Chrome 复用正式 localhost 页面,只读刷新后不弹窗且无目录多选;验证点击切镜、展开完整摄影原文、生成范围勾选/取消、历史回执保留、390px长内容滚动和固定关闭底栏,未执行生成或正式写入。桌面及移动截图在本轮截图目录的同级 `storyboard-cleanup/`。
用户指定的 Leonxlnx/taste-skill 当前为 tasteskill 2.5.1,主要面向公司官网。可借用 references/copy.md 的短文案/一事实一处/按钮动作命名,copy-voice.md 的用户用语与精简确认,SKILL.md 的单一设计系统和实际浏览器验收。营销页的单屏节奏、随机配色、动效和图库模板不适用当前工作台;继续采用项目 Vue/Naive UI/主题变量及本地 Chrome 规则,不复制官网资产或执行其自动浏览器脚本。
已通过官方 skill-installer 将固定版本 `f6b76575f949707b4e3c37cd86cb44b0b98643e8` 安装到 `/Users/goujun/.codex/skills/taste-skill`,原有其它技能保留;安装后的1631个文件逐一校验 Git blob SHA 全部一致。初始浮动分支下载受网络影响,最终改用固定版本归档完成,未执行下载 skill 内的代码或修改项目依赖。新安装技能从下一条消息可用。
后续目录/工具栏修复:镜头条目新增包装后,原自动定位依赖两层父节点,未找到实际段落标题,导致首行镜号进入吸顶标题下方;现改按最近语义分组查标题并保留真实高度。连续性按钮使用正式 icon 插槽,桌面和手机都显示;更多按钮采用公共默认中性底面并移到三项操作最左侧。新增定位回归先失败(实际滚动160,预期122),修复后相关4套12项通过,类型/Lint/格式及构建检查通过。Chrome复用正式localhost页面,验证段落首镜完整露出、更多菜单保留导出、本组三按钮底色/图标/顺序、390px布局与键盘焦点,未执行生成。截图在同级 `toolbar-directory/desktop.jpg`、`toolbar-directory/mobile.jpg`。当前前端总计50个变动文件,仍未提交或推送。
## 未完成项及交付边界
- 指定基线内没有已知未接入的前端目标。真实生成、正式采用/追加批准/证据登记/核清及真实质量/Primary没有执行,这是本轮明确禁止或保护正式数据的边界;写入成功/失败由隔离 Mock 验证,不称作正式业务验收。
- 后端工作区另有并行未提交的 Beat6 当前集正文与环境联合修订扩展。它超出本轮指定已提交基线;当前前端继续将环境视为不可联合修改,不猜测 environmentSource 或自动新增环境编辑,未改动后端文件。
- 本轮所有真实收费模型调用为0,没有改变正式请求状态或伪造 Provider ID/费用证据。没有自动执行任何图片/文字/Vision/Repair/视频/Primary,也没有历史 unknown 自动重试。
- 前端保持 `dev@87427d9`,改动未提交、未push;没有切换或合并发布分支。
@@ -0,0 +1,109 @@
# V8-9.1 / V8-9.2 前端接入交接
## 范围与基线
- 前端根目录 `dev`,基线 `1e9ef33d1d3a78766c08933a97f1b2f7c1faecd0`。开始时工作区干净。本轮只修改前端,未创建工作树。实现验收时未提交;随后用户明确授权检查完整 Diff、提交并推送 dev,Git 结果以仓库记录为准,不合并发布分支。
- 已核对后端根目录 `dev@c6f03454ed98e843a6f4ce3548bb1fbd9154bc18` 的 AGENTS、活跃计划、交接、Storyboard / Workflow 公开文档、两份前端 Prompt,以及正式路由、摄影 Schema、采用服务、派生新鲜度和生产准备服务。
- 正式项目 `cmw02vpwi000005axrdtus3pa`。所有收费生成、摄影采用、停止和并发写入测试均使用 Mock;正式项目只做免费读取、生产计划和首帧 Preview。没有覆盖正式结果、修改主体绑定或调用文本、图片、Vision、视频、Repair、Primary。
## 已交付行为
1. 复用分镜工作台的 Episode / Beat / Shot 目录,增加单镜及段落勾选。默认“所选镜头”、`concurrency=1`、`force=false`、`maxRepairAttempts=0`。当前集及全项目仍保留原批量语义,省略 `shotIds`。
2. 显示正式摄影、画面状态、任务运行/停止/失败及未知请求。有效结果全部具备时不重复 POST;混合范围完整传递正式镜头,后端逐镜复用。空、重复、跨集范围不能提交。HTTP 错误、空响应、字段缺失和合法空目录分别处理。
3. 画面状态必须等本次范围摄影有效后由用户单独发起,提交前重新读取正式确认、摄影和准备情况。`force=true` 明示下游失效及独立文本费用;同数量不同镜头、参数和范围变化会撤销原确认。
4. 沿用项目级发现、原 executionId、免费 GET / SSE 和活动任务锁。增加两类派生任务停止入口。停止后使用“已停止”,保留费用和在途结果。相同终态允许接受更晚的回执,拒绝重新激活和重复相同记录;未知领取即使 force 也不能重发。提交连接中断时持久保留待核对范围,只提供免费核对原提交。
5. 在原“摄影草案与审核”全屏抽屉内,已有摄影且无画面状态时使用独立摄影阶段。复用构图/机位编辑字段,保留其余真实摄影枚举及意图。免费预检携带原 id、ISO 时间、rawJson(含 null)和正式 shotFingerprint;采用冻结同一请求并加入 sourceFingerprint。`changed=false` 的预检仍可采用;幂等回执可接受。409 保留输入、撤销预检并要求显式重读,不自动覆盖。已有下游仍由原组合草案与服务端即时保护处理。
6. 画面状态免费恢复显示原执行、新执行、零模型请求和原失败历史。`received` 仅表示收到模型结果,不能证明可信回执或业务通过。普通页面没有 trace / 请求指纹输入,没有自动恢复或重试按钮;管理核查与原收费失败保持独立。
7. 免费核对所选镜头参考素材、正式项目入口、分阶段门禁和逐镜首帧/视频描述/视频缺口。先显示参考,再顺序读取完整计划与资产状态,避免重查询争抢;计划及状态可取消,读取上限为 120 秒。局部就绪不改变全项目生产门禁。
8. 完整项目上游复检受限时,可凭真实正式确认归属和非零镜头数进入分镜核对;完整生产和素材入口仍保留原门禁。图片授权、OpenAI 选择、原首帧 Preview 指纹、独立 Vision 与 Primary 流程沿用。首帧摄影摘要只展示摄影字段,不混入原文和内部版本。
## 复用组件及链路
保留 `StoryboardPage`、`BeatShotDirectory`、`DirectoryItem`、`ShotDerivedReview`、`ShotDesign`、`WorkspacePage`、`WorkspaceTools`、`AppDrawer`、`AppDialog`、`AppForm`、`WorkspaceSectionHeading`、`WorkspaceActionTooltip`、`ConfirmAction`、`WorkflowExecutionPanel`、`useWorkflowExecution`、`useQuery`、`runOperation`、`useActionMessage` 与统一 HTTP 错误处理。没有另建分镜页面、任务中心、API 服务或第二套主体归属规则。
构图和机位字段抽为 `DirectionCameraFields`,独立阶段与原组合修订共用。原组合草案、场景沿用、视线修订、保存草案及正式首帧候选流程保留。
## 真实 API 核对结果
以下均在 2026-11-15 本地正式 `localhost:3412/api` 核对,未做正式写入:
| 接口 | 结果 |
| --- | --- |
| GET Storyboard quality-confirmation(原别名及 `/storyboard/quality-confirmation`) | 200,valid=true,正式 60 镜,确认与证据指纹一致 |
| GET storyboard-directions / storyboard-visual-states,episodeNo=1 | 各 200,本集 7/17,staleCount=0;全项目各 7/60 |
| GET production/entry-readiness | 200,ready=false;当前原因为正式分镜复检 needs_review,不能当作全项目可生产 |
| POST production/plan `{}` | 200,约 19.25 秒,canStart=false,分阶段门禁保持真实阻断 |
| GET production/status | 200,约 16.27 秒,completed=false,stage=subject_images |
| GET image-authorizations | 200,有 1 条授权,billingBlocked=false;未修改授权额度和范围 |
| GET 四镜 references | 200,缺失引用为空;普通引用数量为 3/3/4/5,不等同最终模型参考职责数 |
| POST 四镜 keyframe/preview `{provider:'openai-image'}` | 均 200,返回正式指纹,blocking=false;最终实际参考数量 3/4/5/6 |
| GET 最新画面状态 Workflow 及其 recoveryOf 原任务 | 新任务 completed、recovered=true、actualModelRequests=0;原任务仍 failed,历史保留 |
生成、停止和采用的正式路由/Schema已核对,写操作成功、失败与并发边界由隔离 Mock 验证。本轮未为验收在正式项目执行任何此类写操作。普通 UI 不开放管理用 SDK 回执恢复参数。
## 素材导航禁用原因补充核查
用户截图中的“视觉风格、主体身份、形态图片”禁用来自正式 `stage-readiness.preparation.ready=false`,不是这三项自身数据丢失。实际 `visualStyle.ready=true`、`identity.ready=true`;正式质量确认 valid=true,结构检查、来源审计和动作审计均通过。
免费质量预检具体返回第 1 集 Beat 3 的 3.1~3.4 共 4 项 `missing_subject_reference`:VisualState 出现“金属搭扣”,但没有绑定独立 `@PR0003`。当前状态为 needs_review、preflightEligible=false,再经 checkCurrent → stage-readiness → 前端三个素材入口共同禁用。
已只读定位后端不一致:`storyboard-visual-state.service.ts` 的生成/恢复校验使用 `isBoundAttachedPropPartMention` 判定已绑定母件的连接部件;`storyboard-subject-coverage-audit.service.ts` 在 VisualState 分支直接调用普通 findMissing 并写入问题,没有经过相同归属过滤。因此四镜正式 VS 已免费恢复保存、单镜 Preview 通过,但项目复检仍出现同类误报。此前后端交接所述“覆盖审计共用部件规则”在此分支未完整落实,必须以当前代码与真实接口为准。
建议后端复用正式母件/Form/字段归属规则修复原覆盖审计,并覆盖完整 preflight、checkCurrent、stage-readiness、production/entry-readiness 链路。前端本轮不绕过门禁、不新增独立搭扣、不重生成四镜,不改写已通过数据;后端仓库未修改。
## 自动化与 Chrome 验收
- Vitest 集中回归:30 套、243 项通过,涵盖分镜、制作前审核、工作流、项目访问、原首帧、授权和预览。新增定向用例 19 项,覆盖范围/复用/顺序/force/断线持久保护/停止及在途回执/摄影预检采用/并发/原失败与免费恢复。相关复验 9 套、153 项通过,含免费准备失败/取消及同数量不同范围撤销确认;随后补充原组合摄影完整预览采用回归,新增定向套最终 19 项全部通过。其余未变更用例复用此前通过结果。
- 本次 Git 检查另执行完整 Vitest:113 套、873 项通过,无真实模型调用。
- TypeScript、改动范围 Oxlint、Vue ESLint、定向格式与 `git diff --check` 均通过。Vite production build 通过;测试页面不进入正式构建入口。
- 本机 pnpm 的版本管理拉取返回 fetch failed,因此直接运行项目现有 node_modules/.bin 下同名工具完成上述脚本对应检查,没有安装或升级依赖。
- 复用本地 Chrome 标签页,全部使用 localhost,未使用 Playwright。正式项目核对四镜 4/4 可复用、默认生成禁用、全项目与局部门禁区分、真实逐镜参考和阶段缺口、免费恢复与原失败并存。覆盖确认只打开查看并取消,恢复 force=false,未提交。
- `tests/browser/staged-production.html` 全量拦截请求,未知接口 403,不连接正式服务。桌面完成摄影编辑→免费预检→人工确认→采用并刷新;停止批次→查看“已停止”→免费刷新收到在途结果;均显示真实模型请求 0。
- 手机宽度 390px(约 650 / 905px 高度)检查目录、字段间距、24 行长内容输入、局部滚动、固定标题和底栏、关闭及采用按钮。任务状态和辅助按钮正常换行,不横向挤出。普通、键盘焦点及禁用状态沿用主题中性底面。
- 当前用户主题主色为蓝色,沿用其已有偏好;主操作仍使用统一 primary,默认主题为绿色。
## 文件与职责
| 状态 | 文件 | 职责 |
| --- | --- | --- |
| 新增 | src/features/storyboard/staged-derived.ts | 正式范围、来源状态、任务范围及未知领取保护 |
| 新增 | src/features/storyboard/components/DirectionCameraFields.vue | 独立与组合摄影共享构图、机位编辑及间距 |
| 新增 | src/features/storyboard/components/DirectionStageReview.vue | 独立摄影来源读取、免费预检、版本绑定采用与冲突 |
| 新增 | src/features/storyboard/components/StagedShotPreparation.vue | 所选参考、项目阶段计划和逐镜缺口读取 |
| 新增 | tests/features/storyboard/staged-derived.test.ts | 19 项定向流程、费用和历史边界回归 |
| 新增 | tests/browser/staged-production.html | 本地 Chrome 隔离验收入口 |
| 新增 | tests/browser/staged-production.ts | 全请求 Mock 与真实组件场景 |
| 新增 | docs/audits/v8-9-staged-production-2026-11-15.md | 本轮范围、API、验证、文件职责及交接 |
| 修改 | src/features/storyboard/StoryboardPage.vue | 原目录多选、范围/费用确认、准备摘要与停止入口 |
| 修改 | src/features/storyboard/useStoryboard.ts | 定向生成编排、有效结果复用、原任务及未知提交保护 |
| 修改 | src/features/storyboard/types.ts | 正式摄影原版本和可选 shotIds |
| 修改 | src/features/storyboard/components/BeatShotDirectory.vue | 原目录增加镜头、段落多选和窄屏布局 |
| 修改 | src/features/storyboard/components/ShotDerivedReview.vue | 原抽屉接入独立摄影,保留组合草案,共用字段 |
| 修改 | src/features/storyboard/derived-review-api.ts | 原 confirm 路由的 phase=direction 模式 |
| 修改 | src/features/storyboard/derived-review.types.ts | 独立摄影请求、预检和幂等回执契约 |
| 修改 | src/features/workflows/execution-api.ts | 原任务 stop 请求,绑定 projectId |
| 修改 | src/features/workflows/execution.ts | 停止状态、原回执更新、任务恢复观察及防回退 |
| 修改 | src/features/workflows/WorkflowExecutionPanel.vue | 停止/领取/恢复/原失败、位置问题及高级详情 |
| 修改 | src/features/workflows/ConfirmAction.vue | 同数量不同输入或范围改变时撤销费用确认 |
| 修改 | src/features/storyboard-preparation/types.ts | 正式入口中的阶段与逐镜缺口字段 |
| 修改 | src/features/production/types.ts | 正式项目分阶段准备契约 |
| 修改 | src/features/production/api.ts | 完整计划、状态读取的可取消耗时边界 |
| 修改 | src/features/production/components/KeyframeDialog.vue | 摄影摘要排除内部记录元数据,保留原生图流程 |
| 修改 | src/features/projects/ProjectLayout.vue | 正式镜头只读发现,不修改项目质量或生产结论 |
| 修改 | src/features/projects/useProjectStageAccess.ts | 只读分镜与完整生产入口分离 |
| 修改 | src/lib/user-facing-text.ts | 七类来源、范围及未知请求业务错误中文 |
| 修改 | tests/features/projects/access.test.ts | 正式分镜可读、完整生产仍受限 |
| 修改 | tests/features/workflows/pages.test.ts | 原批量操作明确选择范围,更新默认参数及状态回归 |
| 修改 | docs/api-contract-sync.md | 更新现有前端交接索引 |
删除 0。保留原后端门禁、原组合修订、图片授权、首帧/审核/Primary 与任务发现;强化原范围、版本、停止及请求未知保护。没有重复实现或待迁移的旧主流程。
## 正式使用与边界
可以在现有分镜工作台选择镜头、核对准备情况,默认复用有效成果;满足真实来源和费用条件后,由用户主动分别启动摄影或画面状态。独立摄影仅适用于尚无下游的真实镜头,最终以服务端预检与事务保护为准。正式四镜已有画面状态,因此应沿原组合摄影修订,不走独立阶段。
当前正式项目完整生产仍被服务端 needs_review 阻断。局部首帧 Preview 通过不能解除它,也不代表图片或视觉审核已经完成。后续由用户主动进入原首帧入口选择 openai-image,重新核对来源、参考图、授权额度及未知费用后生成候选;不自动切换供应方或启动后续流程。
接口局限:当服务只返回整集 staleCount 而没有逐镜 derivedAssetShotGaps 时,无法可靠定位具体过期镜头。此时已有记录标记“需核对来源”,不猜测过期位置,也不放行依赖未知摄影的画面状态。普通 UI 不提供缺少可信回执时的自动恢复。
未执行真实收费或正式写入验收,属于本轮明确禁止项;这部分通过 Mock 覆盖。没有其它主动省略的前端目标。
+34
View File
@@ -0,0 +1,34 @@
# B04-12 旧主图独立新来源复核
## 接入范围
依据后端 dev 的 b04-12-primary-source-review-frontend-prompt.md、公开 shot-keyframe-source-review.md、正式 Router、SourceVisionApprovalSchema 和 service 实现。仅修改前端,未调用真实 Provider。
首帧卡片中的“按当前来源人工复核”适用于已完成 Primary,即使原来源过期仍可免费预检。复用 AppDrawer 固定底栏、内容滚动、NMessage、现有项目范围 WorkflowExecution/SSE 和正式分页执行历史。
- 原图、原件 SHA、原始 Provider 输入、旧 Vision、sourceChanges 与当前参考分开显示;新参考保留全部 bindings,不冒充原生成输入。
- 每张物理参考逐项填写身份、结构、空间、动作、连续性;初始全部 unknown,不推断门轴,不将开关门当固定结构变化。
- 人工保存绑定 expectedFingerprint、真实审核人、理由和全部观察;保存后回读原记录,原 status、原观察与当前 reviewStatus/current 分开。
- 只有当前且 passed 的人工记录才读取免费机器计划;原图和计划的所有指纹、模型、全部步骤可审阅。
- 费用批准独立登记。真实批准人、操作人、批准材料 SHA、CNY 范围均由用户填写;maxRequests 严格等于步骤数。更改范围撤销旧授权。
- 执行必须再次明确确认,携带本次 authorizationId;恢复只携带正式历史提供的原 task ID 和 request fingerprint。未知费用不提供恢复。
- 202 复用已有观察器;200 复用完整结果(含失败)。并发和断线沿用同候选提交保护,不自动重试、换模型或生图。
- sourceReviewId 标识独立审核,按原 validationTaskId 展开完整执行历史;旧 Vision 的通过不显示为新来源通过。原 Primary 不被修改,仍需独立三镜/Production 验收。
- 关闭、项目/镜头/候选切换取消免费查询,拒绝旧结果;人工回读先比对当前主图预检指纹,避免引用其他主图记录。
## 浏览器验收
自动化检查通过:105 个测试文件、782 项测试;lint、格式检查、类型检查和生产构建通过。新增 8 项来源审核测试,覆盖默认未知、明确批准、参数变更、范围切换、并发、断线保护、失败复用及真实组件的只读打开行为。
复用 localhost:4312 已有 Chrome 项目标签,真实操作全部为只读:
- 2.1 人工记录显示人工来源观察通过;免费机器计划显示 qwen3.8-max、general/physical 两步。批准人、批准材料和金额无默认值,没有发起授权或 Vision。
- 2.2 保留原 insufficient_evidence,展示 needs_review,机器计划入口禁用。
- 原图与本次参考分区、逐图初始未知、旧 Vision 不冒充新来源、桌面和 375×667 内容滚动/固定底栏已核对。
- 未提交人工观察、未签发真实费用批准、未执行模型、未改原 Primary 或旧 Vision。
## 已知契约边界
- 当前没有按首帧列出人工来源记录的接口,已有人工记录需输入真实 reviewId 回读;新机器任务的 sourceReviewId 可从正式审核历史追溯。不使用本机历史缓存补齐列表。
- 人工记录 GET 未返回 shotId/keyframeId,页面用当前主图免费预检与原 expectedFingerprint 交叉核对,不匹配的原记录仅供追溯。
- 当前计划不提供报价,金额及批准摘要必须来自真实人工批准,不自动估价或生成批准材料。
+7 -1
View File
@@ -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 keyframes/:keyframeId/validations` 历史,查看不会再次调用视觉模型,也不据此自动晋升;视频质量链读取 `quality-status?detail=true`,耗尽时读取 `quality-exhaustion-analysis`。新的首帧质量生成接收 202 `executionId`,按持久化 metadata 恢复原集与镜头的最终回执;校验历史和本次生成结果分别展示。 已接入:首帧 `validate`、`repair`,项目 `keyframes/generate-quality`,视频 `validate`/`repair`,以及单镜头和项目级 `videos/generate-quality`。严格视频候选由后端 Poller 自动执行 Validator,失败时按上限创建 Repair Candidate,只有 PASS 才晋升 Primary;公开视频列表不再提供质量标记;首帧候选入口读取持久化质量状态,提交前重新核对 passed/manual_accepted;视频候选的手动设主入口仍要求本会话收到 PASS。生成请求不再传固定 Provider。质量接口的详细参数、默认一镜范围、费用确认、主图晋升、视频抽样与专项检查和会话回执限制见 [前端简化与质量功能同步](frontend-simplification.md)。首帧已接入真实 `GET keyframes/:keyframeId/validations` 历史,查看不会再次调用视觉模型,也不据此自动晋升;视频质量链读取 `quality-status?detail=true`,耗尽时读取 `quality-exhaustion-analysis`。新的首帧质量生成接收 202 `executionId`,按持久化 metadata 恢复原集与镜头的最终回执;校验历史和本次生成结果分别展示。
## 高级串联生产边界 ## 高级串联生产边界
@@ -109,3 +109,9 @@
页面验收使用本地 Chrome 的隔离服务。未执行真实图片、视频或视觉校验的付费任务;后台参数、恢复和竞态使用受控契约验证。 页面验收使用本地 Chrome 的隔离服务。未执行真实图片、视频或视觉校验的付费任务;后台参数、恢复和竞态使用受控契约验证。
- 已有分镜重生成、导演设计、即时状态和普通首帧入口也对齐 202 后台句柄与终态回执。后端重生成终态仅返回 summary/validation,正式列表尚无新的标题/剧情;前端持久化按项目的旧正文失效集合,刷新或隐藏任务后仍不向新 Shot ID 回填旧标题/时长,明确展示编号与缺省说明。完整重新拆解成功后才恢复新快照辅助信息。 - 已有分镜重生成、导演设计、即时状态和普通首帧入口也对齐 202 后台句柄与终态回执。后端重生成终态仅返回 summary/validation,正式列表尚无新的标题/剧情;前端持久化按项目的旧正文失效集合,刷新或隐藏任务后仍不向新 Shot ID 回填旧标题/时长,明确展示编号与缺省说明。完整重新拆解成功后才恢复新快照辅助信息。
## 2026-10-12 动作、视线与首帧编辑
新增单镜头动作时间轴、项目动作时长/密度审计、人工空间目标绑定、视线约束只读检查,以及指定主图/候选的首帧编辑。入口分别位于分镜“动作与视线”标签、生成与恢复面板、生产提示词区和首帧卡片。具体参数、持久化任务语义及提示策略见 [本轮接口同步](api-contract-sync.md#2026-10-12-工作区与长任务反馈同步)。其他只读诊断与独立视觉观察不因本轮入口自动运行。
+30
View File
@@ -0,0 +1,30 @@
# 分镜诊断修订:对接缺口与处理记录
2026-10-19 更新:下文第 1 项已由正式 `storyboard-shot-repair/preview/:shotId` 补齐当前动作数据,并已在前端接入普通人工修订、确定性候选和收费模型候选;请勿重复开发。主体遗漏也已分别接入剧情段落与镜头的预览/确认。第 2 项仍需核对新格式手部具体问题的列表返回,原始证据可通过历史查看。以下保留当时的需求与验收边界。
请基于当前 `short-drama-agent` 的正式接口完成以下补充。前端已接入质量规则 GET/PUT/Confirm、拆解 expectedRevision、诊断 Preflight、诊断及修订状态、历史、修订资格和中断核查摘要;当前没有开放正式手部修订保存按钮。
## 1. 提供带版本的正式镜头动作编辑数据
现有 `storyboard-legacy-action-repair-readiness/:shotId/:diagnosisId` 只返回候选位置、动作编号、建议和 `expectedFingerprint`,未返回正式 Shot 当前的完整 `requiredActions`、`subjectRefs`、`durationPlanning`。`storyboard-legacy-action-diagnosis-preview` 明确只给摘要;诊断历史也不是正式镜头原始动作。前端不能使用模型建议、旧 Checkpoint 或过期快照猜测可写草稿。
请扩展既有只读资格接口,或提供一个正式只读编辑数据接口,返回同一次读取的:
- projectId、shotId、episodeNo、beatNo、shotNo、title、当前 durationSeconds;
- 与当前正式镜头一致的 requiredActions、subjectRefs、完整 durationPlanning;
- expectedFingerprint,以及诊断与规则修订/指纹绑定信息;
- 真实 eligible、blockingReasons,保留既有生产资产保护、来源链、活动任务和确定性冲突检查。
字段名称及最终路由由你结合现有结构确定并写入公开 API 文档,不要为前端直接开放任意原始数据库对象。GET 不调用模型、不写入或自动修复。
前端随后只编辑现有 POST schema 允许的 durationPlanning,提交 `{ shotId, diagnosisId, expectedFingerprint, confirmed: true, reason, durationPlanning }`,不上传修改后的 requiredActions 或 resourceOccupancy 等未许可字段。POST 继续使用现有事务,保存前重新检查版本、规则、诊断归属、来源链及资产锁,不新增绕过门禁的写入路径。
## 2. 核对诊断列表的手部问题结构
当前 `storyboard-legacy-action-diagnosis-persistence.service.save` 将 issuesJson 保存为 `{ handConflicts, bodyMotionFindings, qualityCodes }`,而 results.list 的 `issues` 只有在 issuesJson 本身是数组时才返回,导致新格式的手部具体问题在列表中成为空数组;bodyMotionFindings 另行返回。
请保留旧数组兼容,明确将新结构的手部问题以稳定字段返回,并记录质量代码、全身疑点各自的公开结构。镜头或规则过期时仍清空当前有效问题,不能把历史证据伪装成当前冲突。
## 验收
补充接口契约、跨项目/跨镜头 404、过期诊断/规则/镜头 409、已有资产或运行任务阻断、读取后到保存前并发变化、修订成功后保留历史及 AI 待复查的回归测试。验证不得调用真实收费模型、覆盖现有用户镜头或伪造质量通过。
+66
View File
@@ -0,0 +1,66 @@
# 动作规划版本与视频质量接口补充建议归档
2026-10-14 更新:后三项已由后端实现。以下保留 2026-10-13 的建议清单;实际接口以同级后端的 `docs/api/public/motion-plan-revisions.md` 为准,前端已按实际契约接入。
前端需要识别视频候选所使用的动作版本、展示当前生效动作规划,并完成安全的人工修订流程。以下内容供后端实施与接口评审使用;标记为“建议新增”的路径和字段尚未开放,最终命名由后端确认。所有路径均以 `/api` 为前缀,成功响应沿用 `{ data: ... }`。
## 视频质量状态与候选版本字段
现有 `GET /storyboard-shots/:shotId/videos/quality-status`(含 `?detail=true`)没有读取持久化的 `qualityTerminalStatus=stale_motion_plan`。旧版本候选停止处理后,查询仍可能返回 `validating` 或 `repairing`。项目任务聚合结果已经提供 `staleMotionPlan` 和 `settled[shotId].status`,但不能替代逐候选状态。
建议在质量查询的每个 `chain` 项补充以下字段,并在视频列表、主视频和刷新接口使用的 `VideoAssetDto` 中提供同一份候选版本摘要,使普通候选也可判断是否过期。
| 建议字段 | 类型 | 用途 |
| --- | --- | --- |
| `motionPlanRevisionId` | `string \| null` | 此视频生成时绑定的动作修订 ID;历史 AI 快照为 `null` |
| `currentMotionPlanRevisionId` | `string \| null` | 此镜头当前生效的人工动作修订 ID |
| `motionPlanStale` | `boolean` | 后端根据绑定与当前版本判断,前端不解析内部快照 |
| `qualityTerminalStatus` | `string \| null` | 暴露已持久化的质量终态,至少支持 `stale_motion_plan`;其余终态以实际持久化能力为准 |
| `staleReason` | `string \| null` | 可直接展示的过期原因 |
| `canValidate`、`canRepair`、`canSetPrimary` | `boolean` | 后端依据版本、资产完成状态和质量证据计算的操作权限 |
顶层 `status` 增加 `stale_motion_plan`;最新候选已终止时优先返回此状态,不继续显示校验或修复中。保留历史 `validationPassed` 和问题证据,同时明确历史通过不能证明版本仍有效。逐候选字段必须覆盖整条链,不能只判断最新视频或当前主视频。
版本字段与终态保持各自含义:即使后来切回同一版本,曾因过期而终止的任务也不能隐式恢复。历史视频的绑定版本与当前版本均为 `null` 时,保持既有兼容规则,不一律判为过期。不要新增 `ShotVideo.status` 的 Provider 状态值来代替质量终态,也不要公开完整 `rawJson`。
建议在现有 readiness 的镜头项增加 `primaryVideoStaleReasons: string[]`,为空数组表示没有原因。前端即可展示首帧、参考图、模型输入变体或动作版本变化的具体原因;当前仅有 `primaryVideoStale` 布尔值,只能展示概括说明。
## 人工动作规划的查询与修订接口
现有 `POST /storyboard-shots/:shotId/motion-plan/revisions/preview` 请求为 `{ motionPlan }`,时长从正式镜头读取。返回结构问题、时间轴与动作密度预警及内容指纹;`requiresStartStateValidation=true`、`canActivate=false`。结构合法不代表可直接激活。当前尚无公开的修订保存、历史查询与激活接口。
现有 `GET /storyboard-shots/:shotId/motion-plan/preview` 仍读取 `rawJson.motionPlan`。建议改为优先解析当前生效修订,沿用既有时间轴字段,同时增加 `source: 'ai_original' | 'manual'`、`activeRevisionId: string | null`、`motionPlanFingerprint: string | null`。仅在没有人工生效版本时读取历史 AI 快照;版本记录损坏或归属错误应明确报错,不静默回退。
| 建议新增接口 | 请求 | 返回核心字段 |
| --- | --- | --- |
| `GET /storyboard-shots/:shotId/motion-plan/revisions` | 无请求体 | `shotId`、`originalRevisionId`、`activeRevisionId`、`revisions`;未初始化的版本 ID 可为 `null` |
| `POST /storyboard-shots/:shotId/motion-plan/revisions` | `motionPlan`、`parentRevisionId`、`reason` | 新建修订;保存不激活,由服务端确定 `source=manual`、镜头时长和指纹 |
| `POST /storyboard-shots/:shotId/motion-plan/revisions/:revisionId/start-state-validation/start` | 目标主首帧 ID及预期生效版本 ID | `executionId`、`status`;复用持久化任务查询,明确此操作调用模型,供前端确认费用 |
| `PUT /storyboard-shots/:shotId/motion-plan/revisions/:revisionId/active` | `expectedRevisionId: string | null`、有效的起点校验任务 ID | `shotId`、`activeRevisionId`、`motionPlanFingerprint`、`changed`、`videoPromptStale` |
修订记录建议包含 `revisionId`、`shotId`、`source`、`parentRevisionId`、`reason`、`motionPlan`、`durationSeconds`、`fingerprint`、`createdAt`、`isActive`。`motionPlan` 沿用 `MotionPlanOutputSchema` 的完整 `beats` 和 `globalMotionConstraints`,不另造简化编辑结构。
起点校验任务路径为建议方案,后端也可采用同等能力的现有任务接口。必须明确返回校验结论及其绑定的 `revisionId`、指纹、主首帧 ID,且激活前检查这些输入仍有效。预检查不调用模型;正式视觉校验的费用、模型参数和结果查询契约需要一并确认。现实性等其他激活门禁应由后端定义,不能由前端用预检查的 `valid` 推断。
保存、校验与激活均检查镜头和版本归属。激活在事务内执行版本并发检查,使旧视频提示词失效,并保留原始 AI 快照与所有历史候选。并发冲突建议返回 HTTP 409 及可识别错误码,附当前生效版本 ID,前端刷新后由用户重新确认。
## 手动设为主视频的版本检查
现有 `PUT /storyboard-shots/:shotId/videos/:videoId/primary` 经 `videoAssetService.setPrimary` 调用旧的 `shotVideoRepository.setPrimary`,尚未复用自动晋升的版本检查。仅禁用前端按钮不能防止页面打开后版本变化。
建议此接口在同一事务内重新读取镜头当前动作版本、候选绑定版本、持久化质量证据及终止事实,确认候选已完成、属于该镜头且允许晋升后再切换主视频。过期候选或已停止的质量候选必须拒绝;失败时不修改现有主视频。
请求可增加 `expectedMotionPlanRevisionId: string | null`,用于发现用户确认期间的版本变化;无论客户端是否提交,服务端都必须比较候选绑定版本和镜头当前版本。成功响应沿用视频 DTO,并包含上文的版本摘要。
建议错误返回 HTTP 409,提供可识别的 `code`(例如 `MOTION_PLAN_STALE`)、`message`、`shotId`、`videoId`、`motionPlanRevisionId`、`currentMotionPlanRevisionId`。错误包装沿用项目约定;前端据此撤销本次会话的通过资格、关闭切换确认并刷新资产。
## 联调验收
- 候选生成期间切换动作版本后,质量任务停止;任务汇总与逐候选状态一致,刷新页面后仍显示版本过期。
- 同一镜头包含新旧版本候选时,各候选独立显示版本与操作权限,历史通过不会使旧候选可晋升。
- 手动设主与动作版本切换并发时,旧候选不能替换当前主视频;拒绝请求不改变主视频。
- 动作预览、提示词生成、视频生成和校验使用同一生效版本,原始 AI 规划始终可追溯。
- 修订保存、起点校验与激活独立;结构合法但未经有效视觉校验的修订不能激活。
- 无人工修订的历史镜头正常读取和生产;旧任务缺少 `staleMotionPlan` 时前端按零展示。
实现核对入口:后端 `video-quality-status.service.ts`、`video-quality-execution.service.ts`、`motion-plan-detail-preview.service.ts`、`motion-plan-revision-preview.service.ts`、`motion-plan-revision.repository.ts`、`video-asset.service.ts`、`shot-video.repository.ts` 和 `storyboard.routes.ts`、`video.routes.ts`。
@@ -0,0 +1,25 @@
# 制作前审核与导航状态同步(已修复)
2026-10-19 复核:后端 `dev@6a6fd52d` 已修复。真实项目的导航 `breakdown.ready=true`,制作入口 `ready=true`、`storyboardValid=true`;视觉风格、身份和主体素材仍分别未就绪,限制符合实际条件。本文件原提示词仅保留为历史记录,不要再次按旧问题开发。
原请求:请在 `short-drama-agent` 当前 dev 中修复下面的状态不一致。前端已接入正式质量复检、规则来源确认、整体人工审核、正式镜头修订、设计补齐及制作入口检查,不需要重复新增这些接口。
## 修复前的真实只读复现(历史)
2026-10-19,本地 Chrome 通过 `localhost:4312` 的 `/api` 代理读取项目 `cmv9eqf6v0000k6idvk1y3256`(掩耳盗铃):
- `GET /projects/:projectId/production/entry-readiness` 返回 `ready=true`、`storyboardValid=true`,正式镜头 61、镜头设计 61、画面状态 61,两项覆盖率均为 1。前端制作前检查也读到当前有效的人工审核记录。
- 同项目 `GET /projects/:projectId/stage-readiness` 的 `breakdown.ready=false`,原因为“Storyboard 结构校验可能已通过,但仍有未完成的人工质量审核;请核对当前审核证据”。因此导航中的视觉风格及后续步骤仍被锁定。
- 该项目视觉风格、身份及主体素材也有各自未完成条件;同步拆解审核状态后,仍须保留这些独立限制,不能一并放行所有制作阶段。
## 原修复要求(已完成)
当前 `project-stage-readiness.service.ts` 调用 `breakdown-storyboard-validation.service.ts`;后者只读取最新拆解保存记录中的 `storyboardShotValidation` 和 `storyboardNeedsManualReview`,未复用当前正式审核的有效性。
请将导航的拆解质量判断与当前正式分镜审核服务统一:核对真实结构、来源、规则修订及内容版本,只有当前有效审核才解除待审核限制。旧保存记录的人工待审标记不应继续盖过已经有效的当前审核;也不能仅因存在一条历史审核记录就放行。规则或正式镜头变化后,导航应与整体审核同步失效。
不要直接把 `production/entry-readiness.ready` 作为导航中拆解完成的唯一条件,因为制作入口还要求镜头设计和画面状态,可能反向锁住完成这些步骤所需的入口。保留剧本、视觉风格、身份、主体图片和镜头生成方案各自的真实条件,不修改历史保存记录来伪造通过,也不要求前端绕过导航接口。
## 验收
补充回归:当前审核有效但旧记录仍待审、无审核、旧审核内容版本不符、规则变化、正式镜头变化、结构失败、来源不一致,以及其他素材尚未就绪。针对同一项目核对导航与制作入口的原因在业务上自洽,并更新公开文档。验证不得启动真实收费模型、覆盖正式数据或替用户作出人工审核。
+36
View File
@@ -0,0 +1,36 @@
# F04 空间母版恢复与修订接入
## 基线与范围
- 前端从 `c808a58` 开始,根目录 `dev` 开发;既有 Vision 完整执行历史已在该基线接入,本轮保留并回归,不再建立本机执行历史缓存。
- 本轮核对后端 `758b07e4` 的正式路由、Schema、服务、响应和 `docs/audits/b04-09-layout-master-recovery-2026-11-07.md`;未修改后端。
- 沿用“形态图片 → 查看图片与记录 → 场景几何与机位参考”,增加空间母版管理入口。先关闭图库并等待离场,再打开母版抽屉。
## 已接入
- 布局及完整母版列表、正式当前全局确认母版、生成任务记录;完成任务不等于质量通过。
- `GET .../masters/recovery-impact`:当前版本/母版、关联镜头、历史 Primary、Anchor、Form,以及独立的图片完整性与来源当前性。原审核通过不等于当前来源通过。
- `POST .../masters/generation-preflight`:明确选择历史确认母版;当前草稿仅在显式修订模式及同版本下可选。展示原图、最终提示词、参数、参考摘要和指纹。
- `POST .../masters/generate`:完整复用同次预检输入,强制传 `expectedPreviewFingerprint` 与独立费用确认。结果仅为草稿,不自动审核、确认或重生下游素材。
- 原有 `review` / `validate` / `confirm`:资产、人工审核、机器审核及来源版本分别呈现;逐项人工证据和真实确认人必须显式填写。AI 审核另行确认费用,不能填成人工通过。
- 原任务记录展示原模型、参数、提示词及 `referenceSnapshot`,不使用当前素材反推原输入。
## 切换与费用保护
- 关闭、项目、布局、母版或预检参数变化取消旧免费请求,并拒绝迟到响应。再次进入同一范围也有请求代次保护。
- 同步母版任务通过正式只读 GET 观察;保留既有 Vision WorkflowExecution / SSE 实现,不为同步接口伪造 SSE 或进度。
- 输入或原件变化撤销旧预检和费用勾选;提交中锁定重复点击、标签切换和关闭。普通查询允许关闭。
- 网络中断、畸形回执、Provider 后保存冲突继续保留未知费用保护;不会自动重发。400/409 只有在正式任务列表证明未创建新任务后才能解除本次保护。
- 不自动恢复 interrupted 任务,不触发 General 重跑,不改历史 Primary。
## 验证
- 新增隔离 Mock 契约、表单与组件测试:历史参考、草稿修订、独立人工/机器结论、来源影响、指纹、参数变更、范围切换、断线、400/409 的付费前后区分和畸形回执。
- 回归既有 Vision 多执行、分页、Physical Retry、复用步骤计量和任务切换测试。
- 全量检查通过:104 个测试文件、774 项测试;lint、格式检查、类型检查与生产构建通过。
- 本地 Chrome 复用已有标签页、`localhost:4312`。隔离页面验收免费预检、Mock 生成及独立审核;深浅主题、375×667 窄屏、长内容滚动、固定底栏均已检查。临时验收文件已移除。
- 真实项目仅只读核对图库到母版抽屉的交接、当前/历史母版、人工确认与机器结论、来源影响、原任务参考摘要。未提交正式数据,真实 Provider 调用为 0。
## 真实后端缺口
母版 generation-preflight 和模型目录目前没有预计金额及货币字段。页面显示“预检接口未提供报价”,保留明确收费确认,不硬编码金额;后端提供正式报价契约后才能展示数值预计费用。
@@ -0,0 +1,78 @@
# 前后端接口复核记录
基线:前端当前 dev(HEAD `c4b43b9`,包含此前未提交工作),只读核对后端 dev `6a6fd52d`。本轮没有提交、push 或修改后端。
## 真实导航与制作入口
本地 Chrome 复用 `localhost:4312`,读取项目“掩耳盗铃”(`cmv9eqf6v0000k6idvk1y3256`):
| 检查 | 当前结果 | 页面含义 |
| --- | --- | --- |
| 导航 script | ready=true | 剧本已完成 |
| 导航 breakdown | ready=true | 当前正式分镜审核有效,视觉风格入口开放 |
| 导航 visualStyle / identity / subjectAssets | ready=false | 分别仍需准备,不会因拆解通过而自动解锁全部步骤 |
| 导航 storyboard | ready=true | 镜头生成方案符合此阶段的条件,不等同于视频已生成 |
| 制作 entry-readiness | ready=true、storyboardValid=true | 分镜准入通过,镜头设计和画面状态覆盖完整 |
| 正式镜头 / 镜头设计 / 画面状态 | 61 / 61 / 61 | 数量覆盖完整;前端仍单独核对 staleCount |
旧导航待审问题已解决。前端继续只使用 stage-readiness 决定导航,不从旧 Checkpoint 或任务 completed 状态推导审核结论。无需为了本次后端修复新增导航接口或重复审核状态。
## 修复的真实问题
1. 计划请求曾夹带启动阶段、生成上限和视频参数。计划只解析三项模型参数,现由 API 层按真实字段构造 POST body;实际启动仍携带完整参数并再次预检。
2. 缺少项目配置已有空值保护,但缺少就地恢复操作。现在保留独立业务状态,在计划位置打开已有项目配置抽屉;配置读取后消失的竞态同样阻断,不读取空统计、不启动。
3. 配置冲突仅显示原始说明且留在正文。现在识别实际 details.code 与顶层 code,将三类 409 转成中文 NMessage 警告,保留草稿、不发布保存成功、不重试写入;普通失败保持错误级别。保存成功不再遗留常驻成功说明。
4. 计划的 manualBlocked 是独立人工根因数量,原说明把它描述成各阶段累加。现明确独立计数及阶段影响数量可能重叠。
## 原本正确并保留的契约
以 API 模块对照后端实际路由及挂载顺序:盘点 162 处 request 调用,153 处直接匹配;其余 9 处为动态 action、媒介类型、资产路径及可选查询,逐一展开核对,未发现新增方法或路径错误。另核对任务发现 SSE 路径。
| 模块 | 核对要点与结论 |
| --- | --- |
| 项目创建、编辑、阶段 | POST /projects、PUT /projects/:id、GET stage-readiness 正确;未完成阶段保持独立限制。未改写用户当前其他编辑页改动 |
| 拆解与正式审核 | candidate 与正式数据分开;规则保存/确认、正式质量复检、人工审核、版本保护沿用当前接口,不用执行完成替代审核 |
| Direction / VisualState | 按集读取、项目生成 start、202 句柄及 staleCount 正确;不只看覆盖数量 |
| Creative Profile | GET 可为 null、PUT 完整配置正确;本轮只补冲突反馈和恢复操作 |
| 模型目录 | GET generation-models、schema/options/defaults/specialValues 驱动;-1 不按品牌补造。项目画布与参考图尺寸独立;不把默认时长写入正式镜头 |
| Production | POST plan、POST start、GET status 正确;已有 blocked 联合类型保留,正常计划组件只接收非空阶段 |
| 主体图片 | 预览、生成、批量 start、切主图及模块范围保持正式接口,不混用素材和任务回执 |
| 首帧 | 预览、质量任务、候选编辑、版本权限沿用现有独立流程,不默认晋升或把旧通过当当前许可 |
| 视频提示词、视频生成 | 读取和生成分开;生成提交参数、异步句柄及任务终态沿用现有实现,不触发真实模型作验收 |
| WorkflowExecution | latest/get/events 的路径、工作流范围和空结果处理正确;202 是观察句柄,不能当资产或审核完成 |
方法/路径盘点不代表对全部收费分支进行了真实执行。请求体、返回空值、变更服务与既有测试重点核对配置、计划、导航、质量审核及长任务;其余接口本轮没有新增差异,不进行无关重构。
## 尚需后端处理的既有问题
诊断列表的新格式手部具体问题仍可能遗漏:`storyboard-legacy-action-diagnosis-persistence.service.ts:78` 保存对象 `{ handConflicts, bodyMotionFindings, qualityCodes }`,`storyboard-legacy-action-diagnosis-results.service.ts:141` 的 issues 仍只接受数组。前端不从其他镜头或历史证据猜测当前冲突。该问题与本次已修复的导航无关;原需求及边界见 `backend-diagnosis-follow-up.md` 第 2 项,正式编辑数据缺口第 1 项此前已解决,不应重复开发。
## 本轮改动文件
| 文件 | 用途 |
| --- | --- |
| src/features/production/api.ts | 计划请求字段限制,保留 POST |
| src/features/production/useAdvancedProduction.ts | 缺少配置的明确业务状态及并发保护 |
| src/features/production/components/AdvancedProduction.vue | 复用配置恢复入口 |
| src/features/production/components/ProductionPlanPanel.vue | 独立人工阻断计数说明 |
| src/features/generation-config/context.ts | 共用现有配置抽屉打开入口 |
| src/features/generation-config/components/CreativeProfileSettings.vue | 保存成功及冲突统一消息,保留草稿 |
| src/features/projects/ProjectLayout.vue | 提供已有抽屉的打开方法 |
| src/lib/http.ts、src/lib/user-facing-text.ts | 保留原始错误,转换配置业务码说明 |
| tests/features/generation-config/profile-settings.test.ts(新增) | 冲突不重试、不成功、不覆盖草稿;成功消息 |
| tests/features/generation-config/options.test.ts、profile-draft.test.ts | 目录智能时长、画布与参考图尺寸独立 |
| tests/features/production/backend-contract.test.ts、capabilities.test.ts | 计划/启动字段边界、缺配置恢复及竞态 |
| tests/features/projects/access.test.ts | 旧待审标记不覆盖当前阶段,下游仍独立受限 |
| tests/lib/user-facing-text.test.ts | 顶层及详情业务码转换 |
| docs/api-contract-sync.md、backend-production-navigation-follow-up.md、本文件 | 当前结果、历史问题关闭和交付记录 |
其余工作区原有修改和新增均保留,未一并提交。
## 验证
- TypeScript、Oxlint/ESLint、生产构建、差异检查通过。
- 全量 70 个文件 / 541 项测试通过。测试阻止未模拟请求连接真实服务。
- 沿用本会话此前约定,未执行格式化或格式检查;未宣称其通过。
- Chrome 真实服务:导航和制作入口当前结果、视觉风格入口解锁;未写配置、审核或触发模型。
- Chrome 临时隔离页面:实际组件的缺配置、正常计划、配置保存成功、配置冲突、440×956 视口换行与固定底栏。所有请求在页面内模拟,禁止回退到真实网络。页面已删除并恢复真实项目桌面。
- 未进行真实收费生成、素材覆盖、审核确认或数据库变更。GitHub 无新增 Commit,本轮只保留在前端 dev 工作区。
@@ -0,0 +1,48 @@
# 基础形态复用身份母版 Implementation Plan
**Goal:** 默认形态在满足锁定与母版条件时直接使用身份图片,形态 API、就绪检查和分镜参考图共享同一真实数据。
**Architecture:** 通过独立 repository 同步复用记录,接入现有形态图库及主图读取入口;用现有 rawJson 记录来源和 anchor 快照,无需数据库迁移。前端展示后端公开的来源字段。
**Tech Stack:** TypeScript / Prisma SQLite / Vue 3 / Naive UI。
## Global Constraints
- 按用户最新要求,功能已迁回前后端项目根目录的 `dev` 分支;后续遵循根目录 `AGENTS.md`,不在工作树中开发,不自动提交。
- 不调用生图模型,不复制图片文件;Chrome + localhost 验证。
- 新增及修改函数、类型、响应式状态需要中文注释。
## Task 1: Repository 数据与回归测试
- [x] 创建隔离 SQLite 回归测试,先通过现有 `subjectFormRepository.listAssetsByProjectId` 验证缺少自动复用,看到预期失败。
- [x] 新建 `src/repositories/identity-anchor-form-image.repository.ts`,提供 `sync({ projectId })` / `sync({ subjectFormId })`,事务内复查身份和主图,使用按 form + anchor 确定的记录 ID,防止重复创建。
- [x] `subjectFormRepository.listAssetsByProjectId` / `listImageGenerationCandidatesByProjectId`,以及 `subjectImageRepository.listBySubjectFormId` / `findPrimaryBySubjectFormId` 接入同步。
- [x] 回归覆盖未锁定不复用、其他形态不复用、人工主图优先、同一请求重复读取无新增、身份母版更换或失效。
## Task 2: 全流程与 DTO
- [x] 移除 `subject-image.service.ts` 中批量生成的旧复用分支,普通批量使用统一主图判定跳过;强制生成始终走生成路径。
- [x] 公开安全来源字段 `source: 'identity-anchor' | 'generated'` 与 `identityAnchorImageId`,图库与单形态图片 API 共用解析。
- [x] 在独立 SQLite 库中验证真实图库 DTO、readiness 跳过、分镜引用与 anchor 快照一致。
## Task 3: 前端与本地验收
- [x] `SubjectImage` 增加兼容的可选来源字段;列表和图片详情标注“复用身份母版”。基础形态缺图时说明确认身份母版即可复用。
- [x] 保留明确的“重新生成”入口及原有人工主图选择,不在 UI 伪造图片记录。
- [x] 类型、定向 lint 与回归测试通过后,以 SQLite 副本启动隔离后端和前端,Chrome 验证已有主图、复用标记及非默认形态仍缺图。
## Review
确认迁回没有覆盖既有修改;在前后端 `dev` 验证实际接口和页面,不调用模型、不提交代码。
## 验证结果
- 后端全量:9 个文件、99 项测试通过;包含 20 项真实隔离 SQLite 复用回归。
- 前端定向:5 个文件、50 项测试通过;类型检查与改动文件静态检查通过。
- Chrome:localhost:4314 当前项目副本显示 8 个复用主图与 7 个待准备形态;历史详情显示复用来源,重新生成默认不替换当前主图。
- 前端 dev 原有 diff 未变化,后端 dev 保持干净;无代码提交或模型生成。
- 验收后端 localhost:3414 只开放 GET,并且不启动任务恢复;使用独立 SQLite 副本。
## 迁回 dev
2026-10-12 按用户要求迁回前后端项目根目录的 `dev` 分支。前端原有 15 个修改文件内容保留,追加 8 个功能及说明文件;后端迁入 8 个功能及测试文件。未复制预览数据库、环境配置或依赖目录。上述 worktree 验收记录保留为历史,今后开发以根目录 `AGENTS.md` 为准。
@@ -0,0 +1,21 @@
# 基础形态复用身份母版
用户已确认:基础形态默认复用已确认并锁定的身份母版,其他形态继续独立生成,保留重新生成入口,后端与分镜必须识别有效主图。
## 数据与选择规则
- 以正式 `SubjectForm.isDefault` 判定基础形态,不根据名称或列表顺序推测。
- 锁定身份 + 启用、完成、有地址的 primary 身份图才可复用,适用于人物、场景和道具。
- 复用落地为正式 `DramaSubjectImage`,复用现有图片地址而不调用模型或复制物理文件。元数据保留来源与身份母版快照。
- 已有独立生成/人工选择的形态主图优先,不自动覆盖。基础形态也可主动生成新候选并选择替换。
- 自动复用主图跟随身份母版切换;失去锁定、有效母版或基础形态身份后不再作为主图。旧记录保留。
- 读取图库、主图或生产就绪状态时幂等同步已有项目;直接进入分镜也能取到真实形态主图。
- `force` 批量生成应真正生成候选,不再被旧的道具复用分支截断。
## UI
主图标注“复用身份母版”,保留“重新生成”与历史记录。缺少身份母版的基础形态说明需要先确认并锁定;其他形态保持原生成流程。
## 验证
后端使用独立临时 SQLite 库:三类主体、非默认形态、未锁定/候选/失败母版、幂等并发、人工主图保护、换母版、解锁、图库 DTO、就绪与分镜取图。Chrome 在隔离端口查看真实接口返回的副本项目,不提交付费模型任务。初次验收使用隔离数据库副本,不提交代码。按用户最新要求,现已将前后端修改迁回项目根目录的 `dev`,后续不再使用工作树开发。
+46
View File
@@ -0,0 +1,46 @@
# 首帧审核与固定几何连续性接入
日期:2026-11-07。前端起点 `dbf97e6f`,只读核对后端 `6721a4df`;完整执行历史增量对接后端 `b254cfca`,本轮不修改后端。
## 已接入
- 单执行 GET 与 SSE 共用可选 `projectId`。项目与执行共同构成查询身份,切项目关闭旧连接,丢弃旧响应和错误;SSE 断线只回到 GET 轮询,历史无参数调用继续兼容。
- 候选历史展示 `legacyTermination` 的原状态、终止时间、审计编号、费用结论和新授权要求。终止不改写原始审核,不解除 Primary 门禁。
- 独立新审核只传 `legacyVisionAuthorizationId`;物理专项补跑同时传原任务、请求指纹和 `physicalRetryAuthorizationId`。均须手动输入已有授权、明确勾选费用并从弹窗底栏提交,不提供签发入口,不自动重试。
- 202 只观察已受理执行。200 按实际质量与来源结果展示;409 刷新历史并保留任务及费用门禁。执行完成、质量通过和正式 Primary 分别表达。
- 多次执行保持原审核任务身份,按需读取正式分页接口;不再读写本机执行历史缓存。当前执行只按服务端指针标记,逐次步骤、复用来源与计量分别展示。已有未结提交的会话保护继续保留。
- 分镜设计与生产页复用一个全屏连续性审核抽屉,当前集正式顺序连续选择两到三镜,并从正式生成规格求共同 Scene Form。展示 Primary、原图、摄影设计、布局母版、场景形态当前性及原始来源依据。
- 人工分别填写观察面、地标顺序、固定结构位置或数量及其证据。未知明确保留;不把开关门即时状态自动投影成固定结构变化。免费诊断支持 passed、failed、needs_review、insufficient_evidence、stale。
- 审核保存绑定本次已诊断观察的来源指纹,编辑后须重新诊断。刷新可恢复本机最近审核编号,也可手动读取其他正式编号。回读分别展示审核人、时间、原始结论和当前失效原因,不修改 Primary。
- 固定结构 `layoutSupplement` 独立免费预览,不混入摄影 draft;展示当前版本、待审提示词、draftFingerprint、完整 layoutConfirmation 及三个确认/生产标志。待审指纹没有进入任何生图请求。
- 正式布局确认原样使用本次返回的完整参数,仅补充真实 `confirmedBy`。保存后重新读取布局、母版、场景形态来源和首帧诊断,并回读原审核失效状态;不生成素材、不变更 Primary。
- 操作反馈沿用应用 Naive Message。正式提交使用 Loading 和关闭锁,免费读取不阻止关闭。手机底栏可换行,图片按实际宽高或稳定比例预留空间,加载骨架静态显示。
## 后端契约限制
### 完整执行历史已接入正式分页接口
后端 `b254cfca` 新增 `GET /storyboard-shots/:shotId/keyframes/:keyframeId/validations/:validationTaskId/executions`。前端按原审核任务展开读取,显式传项目和每页 20 条,原样传回 nextCursor;刷新首屏或切换范围废弃旧游标及迟到响应。不以 total 推断下一页。
本机历史模块已移除。当前执行仅依据正式 currentExecutionId/isCurrent;关联未记录或不可用、旧执行缺步骤快照时明确显示未知,不把第一条当当前执行。General 复用的原用量和来源与本次新调用分开,不重复计量。旧失败不覆盖当前执行,执行完成与质量待复核、失败、通过分别表达。
无法恢复的旧证据仍按后端契约返回 unknown/null/not_recorded。历史 metadata 缺少完整关联的行不会被猜测纳入;这属于历史证据边界,不能依靠当前任务结果补齐。
新页与原候选摘要共用步骤组件;后台摘要刷新不卸载已展开的执行列表。现有 GET/SSE 仅更新相同执行,逐次步骤始终由正式历史接口读取;没有新增列表 SSE 或改变授权、费用和 Primary 门禁。
## 验证边界
自动化全部使用 Mock,测试环境禁止未模拟请求连接真实服务。覆盖项目切换迟到 404、SSE 断线、同任务多执行、独立授权、物理专项三项参数、200 质量展示、终止与 Primary 限制、连续性观察/保存/回读/失效、布局待审及版本冲突。
本地 Chrome 复用已有 `localhost:4312` 标签页:真实项目只读核对三张 Primary、正式设计、当前布局与来源失效;写入交互使用临时隔离页面拦截全部 API,验证布局正式确认与审核失效保留原结论。检查桌面、390 × 844 手机、长内容滚动、固定底栏、深浅主题及授权按钮禁用/确认状态。临时验收文件在提交前移除。
真实付费 Provider 调用为 0,未提交真实授权、连续性审核或布局修改,未改动正式数据。
## 完整执行历史增量验证
本轮使用正式 DTO 的 Mock 补充 API、分页状态和真实 Vue 组件回归,覆盖按需读取、缓存失效、游标原样传回、同时间顺序、翻页取消、资源切换迟到 404、当前指针不在本页、证据缺失、复用计量、终态刷新、400/404/409、人工终止旧任务和摘要刷新保留展开状态。所有读取均为 GET,没有触发新审核、授权消费或 Primary 修改。
Chrome 复用 localhost:4312 标签页,在临时隔离页面检查桌面及 iPhone SE 375×667、长内容滚动、固定关闭入口、分页结束、深浅主题和指针不可用/旧任务空历史/证据冲突状态。临时页面在提交前删除。
常驻本机服务的只读核对:候选原历史可读,但新 executions 路由返回 Cannot GET 的 404,说明该进程尚未加载新路由;未重启服务,未写正式数据。页面新接口成功、翻页和异常状态由隔离 Mock 验收,正式运行需后端服务加载已推送的版本。
+2 -1
View File
@@ -3,7 +3,8 @@ import tsParser from '@typescript-eslint/parser'
/** Oxlint 检查脚本,ESLint 仅补充 Vue 模板语义检查,格式统一交给 Oxfmt。 */ /** Oxlint 检查脚本,ESLint 仅补充 Vue 模板语义检查,格式统一交给 Oxfmt。 */
export default [ export default [
{ ignores: ['dist/**', 'coverage/**', 'node_modules/**'] }, /** 检查仅覆盖当前项目,不递归进入历史隔离工作树。 */
{ ignores: ['dist/**', 'coverage/**', 'node_modules/**', '**/.worktrees/**', '**/.worktree/**'] },
...pluginVue.configs['flat/essential'], ...pluginVue.configs['flat/essential'],
{ {
files: ['**/*.vue'], files: ['**/*.vue'],
+131 -18
View File
@@ -9,6 +9,7 @@ import {
NLayout, NLayout,
NLayoutHeader, NLayoutHeader,
NMenu, NMenu,
NTooltip,
NScrollbar, NScrollbar,
zhCN, zhCN,
dateZhCN, dateZhCN,
@@ -26,13 +27,16 @@ import {
Layers, Layers,
PanelLeftClose, PanelLeftClose,
PanelLeftOpen, PanelLeftOpen,
PanelRightClose,
PanelRightOpen,
Settings2, Settings2,
X X
} from '@lucide/vue' } from '@lucide/vue'
import ActionMessageProvider from './components/ui/ActionMessageProvider.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 { useWorkspaceLayout } from './composables/useWorkspaceLayout'
import ThemeAppearanceControls from './components/ui/ThemeAppearanceControls.vue'
import { projectAccessKey, type ProjectAccess } from './features/projects/access' import { projectAccessKey, type ProjectAccess } from './features/projects/access'
/** 窄屏将侧栏改为全屏覆盖层,关闭后不再占用正文宽度。 */ /** 窄屏将侧栏改为全屏覆盖层,关闭后不再占用正文宽度。 */
@@ -97,7 +101,15 @@ const navToggleLabel = computed(() => {
if (narrow.value) return collapsed.value ? '打开主菜单' : '关闭主菜单' if (narrow.value) return collapsed.value ? '打开主菜单' : '关闭主菜单'
return collapsed.value ? '展开侧栏' : '折叠侧栏' return collapsed.value ? '展开侧栏' : '折叠侧栏'
}) })
const { preference, theme, overrides } = useTheme() /** 工作台顶栏与全局组件共用的外观偏好。 */
const { preference, accent, theme, overrides } = useTheme()
/** 布局切换只移动同一份导航和内容容器,保留当前页面的交互状态。 */
const workspaceLayout = useWorkspaceLayout()
/** 侧栏折叠图标跟随导航所在位置。 */
const navToggleIcon = computed(() => {
if (workspaceLayout.value === 'right') return collapsed.value ? PanelRightOpen : PanelRightClose
return collapsed.value ? PanelLeftOpen : PanelLeftClose
})
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)
@@ -120,6 +132,9 @@ function createMenuIcon(icon: typeof FolderOpen) {
return () => h('span', { class: 'admin-menu-icon' }, [h(icon, { size: NAV_ICON_SIZE })]) return () => h('span', { class: 'admin-menu-icon' }, [h(icon, { size: NAV_ICON_SIZE })])
} }
/** 禁用原因由同一个提示响应鼠标和键盘,菜单不额外占行。 */
const blockedMenuHint = ref<string | null>(null)
/** 菜单链接使用 RouterLink,保留新标签打开和浏览器导航行为。 */ /** 菜单链接使用 RouterLink,保留新标签打开和浏览器导航行为。 */
const menuOptions = computed<MenuOption[]>(() => { const menuOptions = computed<MenuOption[]>(() => {
return [ return [
@@ -140,19 +155,40 @@ const menuOptions = computed<MenuOption[]>(() => {
const sectionAccess = currentProjectAccess.value?.sections[path] const sectionAccess = currentProjectAccess.value?.sections[path]
const disabled = sectionAccess ? !sectionAccess.enabled : path !== 'create-drama' const disabled = sectionAccess ? !sectionAccess.enabled : path !== 'create-drama'
const target = '/projects/' + projectId.value + '/' + path const target = '/projects/' + projectId.value + '/' + path
const reason = sectionAccess?.reason || '正在核对项目制作条件'
return { return {
key: target, key: target,
disabled, disabled,
label: () => label: () =>
disabled disabled
? h( ? h(
'span', NTooltip,
{ {
class: 'admin-menu-label', placement: 'right',
title: sectionAccess?.reason || '请先完成前面的制作步骤', trigger: 'manual',
'aria-disabled': 'true' show: blockedMenuHint.value === target
}, },
label {
trigger: () =>
h(
'span',
{
class: 'admin-menu-label',
tabindex: 0,
onMouseenter: () => (blockedMenuHint.value = target),
onMouseleave: () => (blockedMenuHint.value = null),
onFocus: () => (blockedMenuHint.value = target),
onBlur: () => (blockedMenuHint.value = null),
onKeydown: (event: KeyboardEvent) => {
if (event.key === 'Escape') blockedMenuHint.value = null
},
'aria-label': `${label},${reason}`,
'aria-disabled': 'true'
},
label
),
default: () => reason
}
) )
: h(RouterLink, { to: target }, () => : h(RouterLink, { to: target }, () =>
h('span', { class: 'admin-menu-label' }, label) h('span', { class: 'admin-menu-label' }, label)
@@ -181,6 +217,7 @@ const menuOptions = computed<MenuOption[]>(() => {
<a href="#main-content" class="skip-link">跳到主要内容</a> <a href="#main-content" class="skip-link">跳到主要内容</a>
<div <div
class="admin-layout" class="admin-layout"
:class="{ 'is-nav-right': workspaceLayout === 'right' }"
:style="{ :style="{
'--admin-sider-collapsed': siderCollapsedWidth + 'px', '--admin-sider-collapsed': siderCollapsedWidth + 'px',
'--admin-sider-expanded': siderExpandedWidth + 'px' '--admin-sider-expanded': siderExpandedWidth + 'px'
@@ -250,7 +287,8 @@ const menuOptions = computed<MenuOption[]>(() => {
<!-- 以下是顶栏与主内容 --> <!-- 以下是顶栏与主内容 -->
<NLayout class="admin-main"> <NLayout class="admin-main">
<NLayoutHeader class="admin-topbar"> <NLayoutHeader class="admin-topbar">
<div class="flex min-w-0 items-center gap-3"> <!-- 以下是靠近主导航的折叠按钮与当前页面标题。 -->
<div class="admin-topbar-navigation flex min-w-0 items-center gap-3">
<NButton <NButton
quaternary quaternary
class="icon-button" class="icon-button"
@@ -260,20 +298,33 @@ const menuOptions = computed<MenuOption[]>(() => {
aria-controls="main-navigation" aria-controls="main-navigation"
@click="toggleNav" @click="toggleNav"
> >
<template #icon <template #icon><component :is="navToggleIcon" :size="20" /></template>
><component :is="collapsed ? PanelLeftOpen : PanelLeftClose" :size="20"
/></template>
</NButton> </NButton>
<span class="truncate text-sm">{{ route.meta.title || '工作空间' }}</span> <span class="truncate text-sm">{{ route.meta.title || '工作空间' }}</span>
</div> </div>
<ThemeToggle v-model="preference" /> <!-- 以下是工作台的主色、布局与明暗设置。 -->
<ThemeAppearanceControls
v-model="preference"
v-model:accent="accent"
v-model:layout="workspaceLayout"
:compact="narrow"
/>
</NLayoutHeader> </NLayoutHeader>
<main id="main-content" tabindex="-1" class="admin-content"><RouterView /></main> <!-- 以下是主路由淡入淡出模块,项目内导航保留共享布局与任务状态。 -->
<main id="main-content" tabindex="-1" class="admin-content">
<RouterView v-slot="{ Component, route: viewRoute }">
<Transition name="route-fade" mode="out-in">
<div :key="viewRoute.matched[0]?.path" class="route-view">
<component :is="Component" />
</div>
</Transition>
</RouterView>
</main>
</NLayout> </NLayout>
</div> </div>
<AppDialog v-model:open="settingsOpen" title="连接设置" description="查看当前服务地址。"> <AppDialog v-model:open="settingsOpen" title="连接设置">
<dl class="detail-grid mt-6"> <dl class="detail-grid mt-6">
<dt>API 地址</dt> <dt>服务地址</dt>
<dd> <dd>
<code>{{ apiBase }}</code> <code>{{ apiBase }}</code>
</dd> </dd>
@@ -300,6 +351,9 @@ const menuOptions = computed<MenuOption[]>(() => {
--admin-sider-expanded: 208px; --admin-sider-expanded: 208px;
@apply flex h-dvh overflow-hidden; @apply flex h-dvh overflow-hidden;
} }
.admin-layout.is-nav-right {
flex-direction: row-reverse;
}
.admin-main { .admin-main {
@apply min-w-0 h-full flex-1; @apply min-w-0 h-full flex-1;
} }
@@ -387,7 +441,17 @@ const menuOptions = computed<MenuOption[]>(() => {
@apply block text-[8px] tracking-[1px] font-normal text-muted mt-[3px]; @apply block text-[8px] tracking-[1px] font-normal text-muted mt-[3px];
} }
.admin-topbar { .admin-topbar {
@apply relative z-10 flex items-center justify-between shrink-0 h-11 py-0 px-5 gap-3 bg-(--app-surface); @apply relative z-10 flex items-center justify-between shrink-0 h-11 py-0 pl-5 gap-3 bg-(--app-surface);
/* 外观工具栏与项目操作区共用边距。 */
padding-right: var(--app-content-padding);
}
/* 主导航移到右侧时,两组顶栏内容对调,折叠按钮贴近导航。 */
.is-nav-right .admin-topbar,
.is-nav-right .admin-topbar-navigation {
flex-direction: row-reverse;
}
.is-nav-right .admin-topbar {
padding-left: var(--app-content-padding);
} }
.admin-sider .n-menu-divider { .admin-sider .n-menu-divider {
@apply h-3 bg-transparent; @apply h-3 bg-transparent;
@@ -399,6 +463,7 @@ const menuOptions = computed<MenuOption[]>(() => {
@media (min-width: 801px) { @media (min-width: 801px) {
.admin-sider.is-collapsed { .admin-sider.is-collapsed {
--admin-nav-reveal-width: 160px; --admin-nav-reveal-width: 160px;
--admin-nav-reveal-offset: -6px;
--admin-nav-hover-color: #111111; --admin-nav-hover-color: #111111;
position: relative; position: relative;
z-index: 30; z-index: 30;
@@ -445,7 +510,7 @@ const menuOptions = computed<MenuOption[]>(() => {
} }
.admin-sider.is-collapsed .admin-menu-label, .admin-sider.is-collapsed .admin-menu-label,
.admin-sider.is-collapsed .admin-settings-label { .admin-sider.is-collapsed .admin-settings-label {
transform: translateX(-6px); transform: translateX(var(--admin-nav-reveal-offset));
} }
.admin-sider.is-collapsed:is(:hover, :has(:focus-visible)) .n-menu-item-content-header, .admin-sider.is-collapsed:is(:hover, :has(:focus-visible)) .n-menu-item-content-header,
.admin-sider.is-collapsed:is(:hover, :has(:focus-visible)) .admin-settings-label { .admin-sider.is-collapsed:is(:hover, :has(:focus-visible)) .admin-settings-label {
@@ -501,6 +566,51 @@ const menuOptions = computed<MenuOption[]>(() => {
.admin-sider.is-collapsed .admin-settings-button .n-button__border { .admin-sider.is-collapsed .admin-settings-button .n-button__border {
right: calc(var(--admin-nav-reveal-width) - var(--admin-sider-collapsed)); right: calc(var(--admin-nav-reveal-width) - var(--admin-sider-collapsed));
} }
/* 右侧折叠导航悬停时显示贯穿视口的浮层,并预留完整菜单宽度。 */
.is-nav-right .admin-sider.is-collapsed {
--admin-nav-reveal-width: var(--admin-sider-expanded);
--admin-nav-reveal-offset: 6px;
}
.is-nav-right .admin-sider.is-collapsed::before {
inset: 0 var(--admin-sider-collapsed) 0 auto;
}
.is-nav-right .admin-sider.is-collapsed .admin-nav-scroll.n-scrollbar,
.is-nav-right .admin-sider.is-collapsed .admin-sider-footer {
align-self: flex-end;
clip-path: inset(0 0 0 calc(var(--admin-nav-reveal-width) - var(--admin-sider-collapsed)));
}
.is-nav-right .admin-sider.is-collapsed:is(:hover, :has(:focus-visible)) .admin-nav-scroll.n-scrollbar,
.is-nav-right .admin-sider.is-collapsed:is(:hover, :has(:focus-visible)) .admin-sider-footer {
clip-path: inset(0);
}
.is-nav-right .admin-sider.is-collapsed .n-menu-item-content {
grid-template-areas: 'arrow content icon';
grid-template-columns: auto 1fr auto;
padding-left: var(--app-content-padding) !important;
padding-right: calc((var(--admin-sider-collapsed) - 20px) / 2);
text-align: right;
}
.is-nav-right .admin-sider.is-collapsed .admin-settings-button {
flex-direction: row-reverse;
text-align: right;
}
.is-nav-right .admin-sider.is-collapsed .n-menu-item-content__icon {
margin-right: 0 !important;
margin-left: 34px;
}
.is-nav-right .admin-sider.is-collapsed .admin-settings-button .n-button__icon {
margin-right: 0;
margin-left: 34px;
}
.is-nav-right .admin-sider.is-collapsed .admin-settings-label {
margin-left: 0;
}
.is-nav-right .admin-sider.is-collapsed .n-menu-item-content::before,
.is-nav-right .admin-sider.is-collapsed .admin-settings-button .n-button__state-border,
.is-nav-right .admin-sider.is-collapsed .admin-settings-button .n-button__border {
right: 0;
left: calc(var(--admin-nav-reveal-width) - var(--admin-sider-collapsed));
}
} }
@media (max-width: 800px) { @media (max-width: 800px) {
.admin-sider { .admin-sider {
@@ -520,6 +630,9 @@ const menuOptions = computed<MenuOption[]>(() => {
transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
visibility 0s 0.28s; visibility 0s 0.28s;
} }
.is-nav-right .admin-sider.is-collapsed {
transform: translateX(100%);
}
.admin-layout > .admin-main { .admin-layout > .admin-main {
@apply w-full min-w-0 max-w-full flex-1; @apply w-full min-w-0 max-w-full flex-1;
} }
@@ -542,7 +655,7 @@ const menuOptions = computed<MenuOption[]>(() => {
@apply flex mr-2; @apply flex mr-2;
} }
.admin-topbar { .admin-topbar {
@apply py-0 px-2.5; @apply py-0 pl-2.5;
} }
} }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
+1 -7
View File
@@ -19,13 +19,7 @@ function select(key: string) {
</script> </script>
<template> <template>
<NDropdown trigger="click" placement="bottom-end" :options="items" v-model:show="open" @select="select"> <NDropdown trigger="click" placement="bottom-end" :options="items" v-model:show="open" @select="select">
<NButton <NButton class="icon-button" :aria-label="label" :title="label" aria-haspopup="menu" :aria-expanded="open"
quaternary
class="icon-button"
:aria-label="label"
:title="label"
aria-haspopup="menu"
:aria-expanded="open"
><template #icon><Ellipsis :size="18" /></template ><template #icon><Ellipsis :size="18" /></template
></NButton> ></NButton>
</NDropdown> </NDropdown>
+142 -32
View File
@@ -1,23 +1,42 @@
<script setup lang="ts"> <script setup lang="ts">
import { NModal, NScrollbar } from 'naive-ui' import { NButton, NModal, NScrollbar, useThemeVars } from 'naive-ui'
import { CircleAlert, CircleCheck, CircleX } from '@lucide/vue'
import { onBeforeUnmount, onMounted, ref, watch } from 'vue' import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
import FieldLabel from './FieldLabel.vue'
import MobilePanelHandle from './MobilePanelHandle.vue'
import { useMobileViewport } from '../../composables/useMobileViewport'
import { usePanelScrollState } from '../../composables/usePanelScrollState'
/** 公共弹窗的标题、说明、操作状态和宽度。 */ /** 公共弹窗的标题、说明、操作状态和宽度。 */
withDefaults( withDefaults(
defineProps<{ defineProps<{
/** 弹窗标题,同时作为可访问名称。 */ /** 弹窗标题,同时作为可访问名称。 */
title: string title: string
/** 标题下的默认说明,可使用 description slot 覆盖。 */ /** 可选的简短标题补充,尽量一句话;完整说明与操作影响应放入默认正文插槽。 */
description?: string description?: string
/** 操作流程说明放入信息图标,业务状态说明插槽仍直接显示。 */
descriptionAsInfo?: boolean
/** 展示语义状态;默认保持中性,警告、成功和错误仅在标题旁显示对应图标。 */
status?: 'default' | 'warning' | 'success' | 'error'
/** 提交期间锁定关闭操作。 */ /** 提交期间锁定关闭操作。 */
busy?: boolean busy?: boolean
/** 使用宽弹窗布局。 */ /** 使用宽弹窗布局。 */
wide?: boolean wide?: boolean
/** 指定弹窗宽度,单位为像素;实际宽度仍受视口限制。 */
width?: number
}>(), }>(),
{ description: '', busy: false, wide: false } { description: '', busy: false, wide: false, status: 'default' }
) )
/** 状态图标使用当前 Naive 主题颜色,随深浅主题切换,不改变弹窗和按钮配色。 */
const themeVars = useThemeVars()
/** 关闭动画结束后通知调用方,便于在焦点陷阱释放后定位正文。 */
const emit = defineEmits<{ closed: [] }>()
/** 弹窗显隐状态,关闭行为由 Naive 管理。 */ /** 弹窗显隐状态,关闭行为由 Naive 管理。 */
const open = defineModel<boolean>('open', { default: false }) const open = defineModel<boolean>('open', { default: false })
/** 手机端使用底部面板,桌面继续采用原居中弹窗。 */
const mobile = useMobileViewport()
/** 正文离开顶部时才显示标题区阴影,底栏始终保持平面。 */
const { bodyScrolled, onBodyScroll } = usePanelScrollState(open)
/** 正文容器隔离子元素外边距,保留完整的自然内容高度。 */ /** 正文容器隔离子元素外边距,保留完整的自然内容高度。 */
const bodyContent = ref<HTMLElement | null>(null) const bodyContent = ref<HTMLElement | null>(null)
/** 正文最大可用高度;未挂载时不限制自然高度。 */ /** 正文最大可用高度;未挂载时不限制自然高度。 */
@@ -37,7 +56,7 @@ function updateBodyHeight() {
maxBodyHeight.value = Math.max( maxBodyHeight.value = Math.max(
0, 0,
(window.visualViewport?.height ?? window.innerHeight) - (window.visualViewport?.height ?? window.innerHeight) -
32 - (mobile.value ? 12 : 32) -
(header?.offsetHeight ?? 0) - (header?.offsetHeight ?? 0) -
(footer?.offsetHeight ?? 0) - (footer?.offsetHeight ?? 0) -
(contentStyle ? parseFloat(contentStyle.paddingTop) + parseFloat(contentStyle.paddingBottom) : 0) - (contentStyle ? parseFloat(contentStyle.paddingTop) + parseFloat(contentStyle.paddingBottom) : 0) -
@@ -78,22 +97,69 @@ onBeforeUnmount(() => {
<template> <template>
<slot name="trigger" /> <slot name="trigger" />
<!-- 以下是关闭打开时自动聚焦的公共弹窗模块 -->
<NModal <NModal
v-model:show="open" v-model:show="open"
preset="card" preset="card"
:auto-focus="false"
:closable="!busy" :closable="!busy"
:mask-closable="!busy" :mask-closable="!busy"
:close-on-esc="!busy" :close-on-esc="!busy"
:style="{ width: wide ? '1040px' : '600px' }" :style="{ width: mobile ? '100vw' : `${width ?? (wide ? 1040 : 600)}px` }"
class="app-dialog" class="app-dialog"
:class="{
'app-dialog-title-only': !description && !$slots.description,
'app-mobile-panel': mobile,
'has-body-scroll': bodyScrolled
}"
role="dialog" role="dialog"
:aria-label="title" :aria-label="title"
@after-leave="emit('closed')"
> >
<!-- 以下是固定标题与说明模块,说明位于标题下并可自定义 --> <!-- 以下是固定标题与说明模块,无说明时标题与关闭按钮垂直居中对齐 -->
<template #header> <template #header>
<div class="min-w-0"> <div class="min-w-0 w-full">
<div class="text-lg font-semibold">{{ title }}</div> <MobilePanelHandle v-if="mobile" :active="open" :disabled="busy" @dismiss="open = false" />
<div v-if="description || $slots.description" class="mt-[2px] text-sm leading-6 font-normal text-muted"> <div class="flex min-w-0 items-center gap-2 text-lg font-semibold">
<!-- 以下是可被读屏识别的状态提示,颜色之外保留不同图形 -->
<CircleAlert
v-if="status === 'warning'"
:size="20"
class="shrink-0"
role="img"
aria-label="警告"
:style="{ color: themeVars.warningColor }"
/>
<CircleCheck
v-else-if="status === 'success'"
:size="20"
class="shrink-0"
role="img"
aria-label="成功"
:style="{ color: themeVars.successColor }"
/>
<CircleX
v-else-if="status === 'error'"
:size="20"
class="shrink-0"
role="img"
aria-label="错误"
:style="{ color: themeVars.errorColor }"
/>
<span class="app-panel-title" :title="title">{{ title }}</span>
<FieldLabel
class="shrink-0"
v-if="descriptionAsInfo && description && !$slots.description"
label="操作"
:description="description"
icon-only
icon="info"
/>
</div>
<div
v-if="$slots.description || (description && !descriptionAsInfo)"
class="mt-[2px] text-sm leading-6 font-normal text-muted"
>
<slot name="description">{{ description }}</slot> <slot name="description">{{ description }}</slot>
</div> </div>
</div> </div>
@@ -101,12 +167,16 @@ onBeforeUnmount(() => {
<!-- 以下是自然高度正文模块,仅超过剩余视口高度时滚动 --> <!-- 以下是自然高度正文模块,仅超过剩余视口高度时滚动 -->
<NScrollbar <NScrollbar
class="dialog-body-scroll" class="dialog-body-scroll"
@scroll="onBodyScroll"
:style="{ height: 'auto', maxHeight: maxBodyHeight === undefined ? undefined : maxBodyHeight + 'px' }" :style="{ height: 'auto', maxHeight: maxBodyHeight === undefined ? undefined : maxBodyHeight + 'px' }"
> >
<div ref="bodyContent" class="flow-root"><slot /></div> <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 #footer>
<div class="dialog-footer">
<slot name="footer"><NButton type="default" :disabled="busy" @click="open = false">关闭</NButton></slot>
</div>
</template> </template>
</NModal> </NModal>
</template> </template>
@@ -125,6 +195,21 @@ onBeforeUnmount(() => {
.app-dialog .n-card-header { .app-dialog .n-card-header {
@apply shrink-0 items-start; @apply shrink-0 items-start;
position: relative;
z-index: 1;
border-bottom: 0;
box-shadow: none;
}
.app-dialog .n-card-header__main {
min-width: 0;
}
.app-dialog.has-body-scroll .n-card-header {
box-shadow: 0 4px 12px -8px color-mix(in srgb, var(--app-shadow) 60%, transparent);
}
/* 无描述的标题栏采用同一条中心线,标题下方保持紧凑的正文间距。 */
.app-dialog.app-dialog-title-only .n-card-header {
align-items: center;
padding-bottom: 16px;
} }
/* 正文自然撑开,超过剩余视口高度后由 NScrollbar 内部滚动。 */ /* 正文自然撑开,超过剩余视口高度后由 NScrollbar 内部滚动。 */
.app-dialog .n-card-content { .app-dialog .n-card-content {
@@ -136,31 +221,20 @@ onBeforeUnmount(() => {
@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 { .app-dialog .n-card__footer {
@apply shrink-0 bg-(--app-surface); @apply shrink-0 bg-(--app-surface);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
position: relative;
z-index: 1;
border-top: 0;
box-shadow: none;
} }
.app-dialog .dialog-footer { .app-dialog .dialog-footer {
@apply flex justify-end gap-2; @apply flex justify-end gap-2;
width: 100%;
align-items: center; align-items: center;
padding-top: 0; padding-top: 0;
} }
@@ -175,13 +249,49 @@ onBeforeUnmount(() => {
padding-bottom: 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 { .app-dialog.n-card > .n-card__footer {
padding-top: var(--n-padding-left); padding-top: var(--n-padding-left);
padding-bottom: var(--n-padding-left); padding-bottom: var(--n-padding-left);
} }
/* 手机居中弹窗统一贴底,短内容保持自然高度,长内容只滚动正文。 */
@media (max-width: 639px) {
.app-dialog.app-mobile-panel.n-card {
position: fixed;
inset: auto 0 0;
margin: 0;
max-width: 100vw;
max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
border-radius: 0;
}
.app-dialog.app-mobile-panel.n-card > .n-card-header {
padding: 44px 16px 16px;
}
.app-dialog.app-mobile-panel .n-card-header__close {
align-self: flex-start;
}
.app-dialog.app-mobile-panel.n-card > .n-card-content {
padding-inline: 16px;
}
.app-dialog.app-mobile-panel.n-card > .n-card__footer {
padding: 16px 16px max(16px, env(safe-area-inset-bottom));
}
.app-dialog.app-mobile-panel:is(.fade-in-scale-up-transition-enter-from, .fade-in-scale-up-transition-leave-to) {
transform: translate3d(0, 100%, 0);
opacity: 1;
}
.app-dialog.app-mobile-panel:is(
.fade-in-scale-up-transition-enter-active,
.fade-in-scale-up-transition-leave-active
) {
transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1);
}
}
@media (prefers-reduced-motion: reduce) {
.app-dialog.app-mobile-panel:is(
.fade-in-scale-up-transition-enter-active,
.fade-in-scale-up-transition-leave-active
) {
transition-duration: 0.01ms;
}
}
</style> </style>
+161
View File
@@ -0,0 +1,161 @@
<script setup lang="ts">
import { NButton, NDrawer, NDrawerContent } from 'naive-ui'
import FieldLabel from './FieldLabel.vue'
import MobilePanelHandle from './MobilePanelHandle.vue'
import { useMobileViewport } from '../../composables/useMobileViewport'
import { usePanelScrollState } from '../../composables/usePanelScrollState'
/** 全屏抽屉共用标题、说明和保存期间的关闭锁定。 */
withDefaults(
defineProps<{
/** 抽屉标题,同时作为可访问名称。 */
title: string
/** 标题下的说明,可使用同名插槽覆盖。 */
description?: string
/** 静态操作说明按需查看,定位或动态状态说明仍默认直接显示。 */
descriptionAsInfo?: boolean
/** 提交期间禁止关闭抽屉。 */
busy?: boolean
}>(),
{ description: '', busy: false }
)
/** 全屏抽屉显隐状态,由调用方保留业务草稿。 */
const open = defineModel<boolean>('open', { default: false })
/** 手机端从底部展开,同一份正文、草稿和底栏保持在原抽屉内。 */
const mobile = useMobileViewport()
/** 正文滚动才显示标题阴影,避免静态内容周围常驻分隔。 */
const { bodyScrolled, onBodyScroll } = usePanelScrollState(open)
/** 将同一滚动监听传给抽屉内部的正式Scrollbar。 */
const bodyScrollbarProps = { onScroll: onBodyScroll }
/** 关闭动画结束后通知调用方,便于交接焦点。 */
const emit = defineEmits<{ closed: [] }>()
</script>
<template>
<!-- 以下是桌面全屏抽屉与手机底部面板共用的弹层模块 -->
<NDrawer
v-model:show="open"
:placement="mobile ? 'bottom' : 'right'"
width="100vw"
:height="mobile ? 'calc(100dvh - max(12px, env(safe-area-inset-top)))' : undefined"
:auto-focus="false"
:mask-closable="!busy"
:close-on-esc="!busy"
class="app-drawer"
:class="{ 'app-mobile-panel': mobile, 'has-body-scroll': bodyScrolled }"
:aria-label="title"
@after-leave="emit('closed')"
>
<NDrawerContent :closable="!busy" :native-scrollbar="false" :scrollbar-props="bodyScrollbarProps">
<!-- 以下是固定标题与说明模块,与正文共用左右边界 -->
<template #header>
<div class="app-drawer-heading">
<MobilePanelHandle v-if="mobile" :active="open" :disabled="busy" @dismiss="open = false" />
<div class="flex min-w-0 items-center gap-2 text-lg font-semibold">
<span class="app-panel-title" :title="title">{{ title }}</span>
<FieldLabel
class="shrink-0"
v-if="descriptionAsInfo && description && !$slots.description"
label="操作"
:description="description"
icon-only
icon="info"
/>
</div>
<div
v-if="$slots.description || (description && !descriptionAsInfo)"
class="mt-2 text-sm font-normal leading-6 text-muted"
>
<slot name="description">{{ description }}</slot>
</div>
</div>
</template>
<!-- 以下是独立滚动的正文模块 -->
<slot />
<!-- 以下是固定底部操作模块,未自定义底栏时默认显示关闭按钮 -->
<template #footer>
<div class="app-drawer-footer">
<slot name="footer"
><NButton type="default" :disabled="busy" @click="open = false">关闭</NButton></slot
>
</div>
</template>
</NDrawerContent>
</NDrawer>
</template>
<style>
/* 全屏抽屉沿用项目表面和输入底色,不对正文设置最大宽度。 */
.app-drawer.n-drawer {
--app-field: var(--app-control);
--app-field-hover: var(--app-control-hover);
max-width: 100vw;
background: var(--app-surface);
}
.app-drawer.n-drawer .n-drawer-content .n-drawer-header {
position: relative;
padding: 24px;
z-index: 1;
border-bottom: 0;
box-shadow: none;
}
.app-drawer.n-drawer.has-body-scroll .n-drawer-content .n-drawer-header {
box-shadow: 0 4px 12px -8px color-mix(in srgb, var(--app-shadow) 60%, transparent);
}
/* 关闭入口独立定位,避免占据标题列后造成正文边界错位。 */
.app-drawer .n-drawer-header__close {
position: absolute;
top: 24px;
right: 24px;
}
.app-drawer.n-drawer .n-drawer-content .n-drawer-header__main {
width: 100%;
min-width: 0;
}
.app-drawer-heading {
box-sizing: border-box;
width: 100%;
padding-right: 40px;
}
/* 正文顶部不再叠加留白,保留左右边界和滚动到底部时的间距。 */
.app-drawer.n-drawer .n-drawer-content .n-drawer-body-content-wrapper {
padding: 0 24px 32px;
}
.app-drawer.n-drawer .n-drawer-content .n-drawer-footer {
display: block;
padding: 20px 24px max(20px, env(safe-area-inset-bottom));
position: relative;
z-index: 1;
border-top: 0;
box-shadow: none;
}
.app-drawer-footer {
display: flex;
/* 多项正式操作在窄屏换行,始终保留关闭和提交入口。 */
flex-wrap: wrap;
justify-content: flex-end;
gap: 8px;
width: 100%;
}
/* 窄屏缩小外层留白,正文布局由各业务表单控制。 */
@media (max-width: 639px) {
.app-drawer.app-mobile-panel.n-drawer {
border-radius: 0;
overflow: hidden;
}
.app-drawer.n-drawer .n-drawer-content .n-drawer-header {
padding: 44px 16px 16px;
}
.app-drawer .n-drawer-header__close {
top: 44px;
right: 16px;
}
.app-drawer.n-drawer .n-drawer-content .n-drawer-body-content-wrapper {
padding: 0 16px 24px;
}
.app-drawer.n-drawer .n-drawer-content .n-drawer-footer {
padding-inline: 16px;
}
}
</style>
+41
View File
@@ -0,0 +1,41 @@
<script setup lang="ts">
import { computed } from 'vue'
import { ExternalLink } from '@lucide/vue'
import { mediaAssetUrl } from '../../lib/assets'
/** 图片与视频共用的右上角原文件入口参数。 */
const props = defineProps<{
/** 原始素材地址,为空或不安全时隐藏入口。 */
src: string | null
/** 无障碍名称与悬停说明,界面仅显示图标。 */
label: string
}>()
/** 外链沿用素材地址的协议与存储路径校验。 */
const href = computed(() => (props.src ? mediaAssetUrl(props.src) : null))
</script>
<template>
<!-- 以下是素材画面右上角打开原文件的图标模块,点击不触发图片预览 -->
<a
v-if="href"
:href="href"
target="_blank"
rel="noopener noreferrer"
:aria-label="label"
:title="label"
class="asset-open-link absolute right-2 top-2 z-10 flex size-7 items-center justify-center bg-black/65 text-white hover:bg-black/85 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
@click.stop
>
<ExternalLink :size="14" />
</a>
</template>
<style>
/* 手机端扩大点击区域,桌面继续使用紧凑图标。 */
@reference "../../styles/styles.css";
@media (max-width: 760px) {
.asset-open-link {
@apply size-11;
}
}
</style>
+89
View File
@@ -0,0 +1,89 @@
<script setup lang="ts">
import { Info, CircleAlert, CheckCircle2 } from '@lucide/vue'
/** 可恢复状态和业务说明使用紧凑文字,临时操作结果由消息层处理。 */
withDefaults(
defineProps<{
/** 说明对应的业务级别。 */
type?: 'info' | 'warning' | 'error' | 'success'
/** 保留调用方对图标可见性的控制。 */
showIcon?: boolean
/** 需要始终可见的业务状态名称。 */
title?: string
/** 重要注意事项复用项目主题底面、图标与醒目标题,普通说明保持原有紧凑样式。 */
emphasized?: boolean
/** 仅在明确的严重错误中使用警示底色。 */
critical?: boolean
}>(),
{ type: 'info', showIcon: true, emphasized: false, critical: false }
)
</script>
<template>
<div
class="context-notice"
:class="[
`context-notice-${type}`,
{ 'context-notice-emphasized': emphasized, 'context-notice-critical': critical && type === 'error' }
]"
:role="emphasized && (type === 'error' || type === 'warning') ? 'alert' : undefined"
>
<component
v-if="showIcon"
:is="type === 'success' ? CheckCircle2 : type === 'warning' || type === 'error' ? CircleAlert : Info"
:size="emphasized ? 18 : 14"
aria-hidden="true"
/>
<div class="min-w-0 flex-1">
<strong
v-if="title"
class="mb-1 block"
:class="emphasized ? 'text-sm font-semibold' : 'text-xs font-medium'"
>{{ title }}</strong
><slot />
</div>
</div>
</template>
<style>
@reference "../../styles/styles.css";
.context-notice {
@apply flex items-start gap-2 text-xs leading-6 wrap-anywhere;
}
.context-notice > svg {
@apply shrink-0 mt-1 text-muted;
}
.context-notice-error > svg {
@apply text-danger;
}
.context-notice > div > p:first-child {
@apply mt-0;
}
/* 重要提示沿用项目的中性底面和文字层级,深浅主题自动保持协调。 */
.context-notice-emphasized {
@apply gap-3 text-sm leading-7;
padding: var(--app-content-gap);
color: var(--app-muted);
background: var(--app-subtle);
}
.context-notice-emphasized strong {
color: var(--app-ink);
}
.context-notice-emphasized > svg {
@apply mt-1;
color: var(--app-ink);
}
/* 普通错误使用中性底面,严重错误才使用警示底色。 */
.context-notice-emphasized.context-notice-critical {
background: color-mix(in srgb, var(--app-danger-soft) 45%, var(--app-surface));
}
.context-notice-emphasized.context-notice-error > svg {
color: var(--app-danger);
}
.context-notice-emphasized.context-notice-success {
background: color-mix(in srgb, var(--app-success-soft) 45%, var(--app-surface));
}
.context-notice-emphasized.context-notice-success > svg {
color: var(--app-success);
}
</style>
+11 -5
View File
@@ -2,15 +2,21 @@
import { NEmpty } from 'naive-ui' import { NEmpty } from 'naive-ui'
import { FileText } from '@lucide/vue' import { FileText } from '@lucide/vue'
/** 没有数据时展示真实空态,不创建虚构项目或结果。 */ /** 没有数据时展示真实空态,不创建虚构项目或结果。 */
defineProps<{ title: string; description: string }>() defineProps<{
/** 当前状态。 */
title: string
/** 标题之外确实有必要的补充说明。 */
description?: string
}>()
</script> </script>
<template> <template>
<NEmpty class="empty-state" :description="title"> <NEmpty class="empty-state" :description="title">
<template #icon><FileText :size="30" :stroke-width="1.4" /></template> <template #icon><FileText :size="30" :stroke-width="1.4" /></template>
<template #extra <template #extra>
><p class="max-w-md text-sm leading-6 text-muted">{{ description }}</p> <p v-if="description" class="max-w-md text-sm leading-6 text-muted">{{ description }}</p>
<div class="mt-5"><slot /></div <!-- 以下是统一居中、换行和间距的空态操作模块,加载图标不再影响按钮基线 -->
></template> <div class="empty-state-actions mt-5 flex flex-wrap items-center justify-center gap-3"><slot /></div>
</template>
</NEmpty> </NEmpty>
</template> </template>
+28
View File
@@ -0,0 +1,28 @@
<script setup lang="ts">
import { watch } from 'vue'
import { showActionFeedback, useActionMessage } from './useActionMessage'
/** 临时操作反馈只进入全局消息层,不在页面占用正文空间。 */
const props = withDefaults(
defineProps<{
/** 最新操作结果;清空后可再次提示相同内容。 */
message: string
/** 按实际结果选择消息级别。 */
type?: 'success' | 'error' | 'warning' | 'info'
}>(),
{ type: 'error' }
)
/** 与应用其它操作共用 NMessage。 */
const feedback = useActionMessage()
watch(
() => [props.message, props.type] as const,
([content, type]) => {
showActionFeedback(feedback, content, type)
},
{ immediate: true }
)
</script>
<template>
<span hidden aria-hidden="true"><!-- 临时反馈不生成常驻提示框。 --></span>
</template>
+12 -5
View File
@@ -2,7 +2,8 @@
import { ref } from 'vue' import { ref } from 'vue'
import { NPopover } from 'naive-ui' import { NPopover } from 'naive-ui'
import type { PopoverProps } from 'naive-ui' import type { PopoverProps } from 'naive-ui'
import { CircleHelp } from '@lucide/vue' import { CircleHelp, Info } from '@lucide/vue'
import { userFacingText } from '../../lib/user-facing-text'
/** 字段标签与按需打开的说明,适用于项目配置和各类生成表单。 */ /** 字段标签与按需打开的说明,适用于项目配置和各类生成表单。 */
withDefaults( withDefaults(
@@ -11,6 +12,12 @@ withDefaults(
label: string label: string
/** 原有字段说明,没有说明时不显示提示图标。 */ /** 原有字段说明,没有说明时不显示提示图标。 */
description?: string description?: string
/** 只展示说明图标,主标题由所在模块保留。 */
iconOnly?: boolean
/** 操作与信息说明使用info,字段帮助默认使用问号。 */
icon?: 'help' | 'info'
/** 用户创作的内容保持原样,不执行系统文案转换。 */
verbatim?: boolean
/** 提示位置可按字段单独指定,默认居中显示在图标上方。 */ /** 提示位置可按字段单独指定,默认居中显示在图标上方。 */
placement?: PopoverProps['placement'] placement?: PopoverProps['placement']
}>(), }>(),
@@ -23,22 +30,22 @@ const open = ref(false)
<template> <template>
<!-- 以下是字段标签与说明提示模块 --> <!-- 以下是字段标签与说明提示模块 -->
<span class="inline-flex min-w-0 items-center gap-1.5"> <span class="inline-flex min-w-0 items-center gap-1.5">
<span>{{ label }}</span> <span v-if="!iconOnly">{{ verbatim ? label : userFacingText(label, label) }}</span>
<!-- 浮层挂到视口层,按字段指定位置并自动翻转,避免被弹窗滚动容器裁剪。 --> <!-- 浮层挂到视口层,按字段指定位置并自动翻转,避免被弹窗滚动容器裁剪。 -->
<NPopover v-if="description" v-model:show="open" trigger="click" :placement="placement" :to="true" :flip="true"> <NPopover v-if="description" v-model:show="open" trigger="click" :placement="placement" :to="true" :flip="true">
<template #trigger> <template #trigger>
<button <button
type="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" 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-label="`${userFacingText(label, label)}说明`"
:aria-expanded="open" :aria-expanded="open"
@click.stop @click.stop
> >
<CircleHelp :size="14" aria-hidden="true" /> <component :is="icon === 'info' ? Info : CircleHelp" :size="14" aria-hidden="true" />
</button> </button>
</template> </template>
<div class="max-w-[min(360px,calc(100vw-48px))] whitespace-pre-wrap break-words text-xs leading-5"> <div class="max-w-[min(360px,calc(100vw-48px))] whitespace-pre-wrap break-words text-xs leading-5">
{{ description }} {{ verbatim ? description : userFacingText(description) }}
</div> </div>
</NPopover> </NPopover>
</span> </span>
+5 -2
View File
@@ -2,6 +2,7 @@
import { h } from 'vue' import { h } from 'vue'
import { NButton } from 'naive-ui' import { NButton } from 'naive-ui'
import { useActionMessage } from './useActionMessage' import { useActionMessage } from './useActionMessage'
import { userFacingText } from '../../lib/user-facing-text'
/** 问题说明按需查看,页面不长期堆叠错误段落。 */ /** 问题说明按需查看,页面不长期堆叠错误段落。 */
const props = withDefaults( const props = withDefaults(
@@ -12,6 +13,8 @@ const props = withDefaults(
label?: string label?: string
/** 问题对应的反馈级别。 */ /** 问题对应的反馈级别。 */
type?: 'warning' | 'error' | 'info' type?: 'warning' | 'error' | 'info'
/** 与状态同行展示时移除独立模块的顶部间距。 */
inline?: boolean
}>(), }>(),
{ label: '查看原因', type: 'warning' } { label: '查看原因', type: 'warning' }
) )
@@ -20,7 +23,7 @@ const message = useActionMessage()
/** 点击后展示去重问题,不重新请求或生成内容。 */ /** 点击后展示去重问题,不重新请求或生成内容。 */
function showReasons() { function showReasons() {
const content = [...new Set(props.messages.map(item => item.trim()).filter(Boolean))].join(';') const content = [...new Set(props.messages.map(item => userFacingText(item)).filter(Boolean))].join(';')
if (content) if (content)
message?.[props.type](() => h('div', { class: 'max-w-[min(600px,calc(100vw-48px))] break-words' }, content), { message?.[props.type](() => h('div', { class: 'max-w-[min(600px,calc(100vw-48px))] break-words' }, content), {
duration: 7000, duration: 7000,
@@ -31,7 +34,7 @@ function showReasons() {
<template> <template>
<!-- 以下是按需查看问题说明的操作模块 --> <!-- 以下是按需查看问题说明的操作模块 -->
<div v-if="messages.length" class="mt-3 flex items-center gap-2"> <div v-if="messages.length" class="flex items-center gap-2" :class="{ 'mt-3': !inline }">
<NButton text size="small" @click="showReasons">{{ label }}</NButton> <NButton text size="small" @click="showReasons">{{ label }}</NButton>
</div> </div>
</template> </template>
+223
View File
@@ -0,0 +1,223 @@
<script setup lang="ts">
import { onBeforeUnmount, watch } from 'vue'
/** 手机面板仅通过顶部手柄拖动,正文不接收拖动关闭事件。 */
const props = defineProps<{
/** 弹层是否仍打开,外部关闭时取消旧手势。 */ active: boolean
/** 提交期间禁用关闭,拖动中进入提交也必须撤销手势。 */ disabled?: boolean
}>()
/** 请求原弹层关闭,焦点交接及业务草稿仍由原组件管理。 */
const emit = defineEmits<{ dismiss: [] }>()
/** 当前手势捕获的唯一指针。 */
let pointer: number | null = null
/** 当前指针的捕获元素。 */
let grip: HTMLElement | null = null
/** 当前手势所属的最近弹层,嵌套时只操作本层。 */
let panel: HTMLElement | null = null
/** 手势起始横坐标。 */
let startX = 0
/** 手势起始纵坐标。 */
let startY = 0
/** 最近一段移动的起始纵坐标。 */
let recentY = 0
/** 最近一段移动的起始时刻。 */
let recentTime = 0
/** 最近一次移动时刻。 */
let lastTime = 0
/** 最近一次移动纵坐标。 */
let lastY = 0
/** 当前视觉位移,仅更新实际弹层的transform,不触发整棵正文重排。 */
let offset = 0
/** 拖动后的兼容click不能被误判为键盘关闭。 */
let lastPointerInteraction = -Infinity
/** 回位或离场动画计时,关闭和卸载时释放。 */
let timer: ReturnType<typeof setTimeout> | undefined
/** 释放当前手势的指针捕获。 */
function release() {
const id = pointer
pointer = null
if (id !== null && grip?.hasPointerCapture?.(id)) grip.releasePointerCapture(id)
grip = null
}
/** 清理动画、位移及手势,防止重新打开或切换布局后沿用旧状态。 */
function reset() {
clearTimeout(timer)
release()
panel?.classList.remove('is-panel-dragging', 'is-panel-settling')
panel?.removeAttribute('data-drag-dismissed')
panel?.style.removeProperty('transform')
panel = null
offset = 0
}
/**
* 回到展开状态或沿拖动方向离场,完成后才请求原弹层关闭。
* @param dismiss 是否达到关闭条件
*/
function settle(dismiss: boolean) {
release()
if (!panel) return
clearTimeout(timer)
const target = panel
target.classList.remove('is-panel-dragging')
target.classList.add('is-panel-settling')
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches
target.style.transform = dismiss ? 'translate3d(0, 100%, 0)' : 'translate3d(0, 0, 0)'
timer = setTimeout(
() => {
if (dismiss && props.active && !props.disabled && panel === target) {
target.setAttribute('data-drag-dismissed', '')
emit('dismiss')
} else reset()
},
reduced ? 0 : 180
)
}
/**
* 只从手柄开始拖动,忽略非主指针、额外触点及提交锁。
* @param event 手柄上的指针按下
*/
function start(event: PointerEvent) {
if (!props.active || props.disabled || pointer !== null || !event.isPrimary || event.button !== 0) return
reset()
grip = event.currentTarget as HTMLElement
panel = grip.closest<HTMLElement>('.app-mobile-panel')
if (!panel) return
pointer = event.pointerId
lastPointerInteraction = Date.now()
startX = event.clientX
startY = recentY = lastY = event.clientY
recentTime = lastTime = event.timeStamp
grip.setPointerCapture?.(pointer)
panel.classList.add('is-panel-dragging')
event.preventDefault()
}
/**
* 跟随手指,仅允许向下明显移动;上拉保留轻微阻尼。
* @param event 已捕获指针的移动
*/
function move(event: PointerEvent) {
if (event.pointerId !== pointer || !panel || props.disabled) return
if (event.timeStamp - recentTime > 100) {
recentY = lastY
recentTime = lastTime
}
lastY = event.clientY
lastTime = event.timeStamp
const distance = event.clientY - startY
offset = distance >= 0 ? distance : -Math.min(20, Math.sqrt(-distance) * 1.5)
panel.style.transform = `translate3d(0, ${offset}px, 0)`
event.preventDefault()
}
/**
* 向下拉到阈值或明确向下快速甩动后关闭,横向移动和轻触仍回位。
* @param event 指针释放
*/
function finish(event: PointerEvent) {
if (event.pointerId !== pointer || !panel) return
lastPointerInteraction = Date.now()
const distance = event.clientY - startY
const velocity = (event.clientY - recentY) / Math.max(1, event.timeStamp - recentTime)
const threshold = Math.min(140, Math.max(72, panel.getBoundingClientRect().height * 0.18))
const downward = distance > Math.abs(event.clientX - startX)
settle(!props.disabled && downward && (distance >= threshold || (distance >= 48 && velocity >= 0.65)))
}
/**
* 系统取消或丢失捕获时回位,不把未完成手势解释成关闭。
* @param event 被取消的指针
*/
function cancel(event: PointerEvent) {
if (event.pointerId === pointer) settle(false)
}
/**
* 读屏或键盘激活仍可直接关闭,普通手指轻触手柄不关闭。
* @param event 手柄激活事件
*/
function activate(event: MouseEvent) {
if (event.detail === 0 && Date.now() - lastPointerInteraction > 500 && props.active && !props.disabled)
emit('dismiss')
}
/**
* 键盘直接关闭,不受刚刚发生的指针手势影响。
* @param event 键盘激活事件
*/
function keyboardClose(event: KeyboardEvent) {
if (!event.repeat && props.active && !props.disabled) emit('dismiss')
}
watch(
() => [props.active, props.disabled],
() => {
if (props.disabled && panel) settle(false)
else if (props.active || !panel?.hasAttribute('data-drag-dismissed')) reset()
}
)
onBeforeUnmount(reset)
</script>
<template>
<!-- 以下是仅在手机端挂载的横条,44px触控区与正文滚动分开。 -->
<button
type="button"
class="mobile-panel-handle"
aria-label="向下拖动关闭弹窗"
:disabled="disabled"
@pointerdown="start"
@pointermove="move"
@pointerup="finish"
@pointercancel="cancel"
@lostpointercapture="cancel"
@click="activate"
@keydown.enter.prevent="keyboardClose"
@keydown.space.prevent="keyboardClose"
>
<span aria-hidden="true" />
</button>
</template>
<style>
.mobile-panel-handle {
position: absolute;
inset: 0 0 auto;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 44px;
padding: 0;
border: 0;
background: transparent;
color: var(--app-muted);
cursor: grab;
touch-action: none;
user-select: none;
}
.mobile-panel-handle > span {
width: 40px;
height: 4px;
border-radius: 0;
background: currentColor;
}
.mobile-panel-handle:active {
cursor: grabbing;
}
.mobile-panel-handle:focus-visible {
outline-offset: -4px;
}
.app-mobile-panel.is-panel-dragging {
transition: none !important;
}
.app-mobile-panel.is-panel-settling {
transition: transform 180ms cubic-bezier(0.32, 0.72, 0, 1) !important;
}
/* 交给原弹层完成焦点释放;已拖离视口的面板不重复播放离场动画。 */
.app-mobile-panel[data-drag-dismissed] {
transform: translate3d(0, 100%, 0) !important;
opacity: 0 !important;
transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
.app-mobile-panel.is-panel-settling {
transition-duration: 0.01ms !important;
}
}
</style>
+23
View File
@@ -0,0 +1,23 @@
<script setup lang="ts">
import { NCollapse, NCollapseItem } from 'naive-ui'
/** 原始诊断与生成参数仅供高级核对,默认收起,不替代普通用户的中文摘要。 */
withDefaults(
defineProps<{
/** 原始数据保持不变,便于核对技术问题。 */
value: unknown
/** 中文高级入口名称。 */
title?: string
}>(),
{ title: '高级详情(原始数据)' }
)
</script>
<template>
<!-- 以下是默认收起的高级数据模块,统一使用 Naive 折叠组件 -->
<NCollapse class="mt-3"
><NCollapseItem name="raw-data" :title="title">
<pre class="whitespace-pre-wrap break-words text-xs leading-6">{{ JSON.stringify(value, null, 2) }}</pre>
</NCollapseItem></NCollapse
>
</template>
+19 -7
View File
@@ -1,6 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import ContextNotice from './ContextNotice.vue'
import FieldLabel from './FieldLabel.vue' import FieldLabel from './FieldLabel.vue'
import { NAlert, NButton } from 'naive-ui' import { NButton } from 'naive-ui'
/** 只读诊断模块的展示参数。 */ /** 只读诊断模块的展示参数。 */
interface Props { interface Props {
@@ -12,9 +14,13 @@ interface Props {
loading?: boolean loading?: boolean
/** 当前查询错误。 */ /** 当前查询错误。 */
error?: string error?: string
/** 是否允许折叠;关闭时直接展示内容,适用于独立弹窗。 */
collapsible?: boolean
/** 是否显示标题、说明与操作栏;独立弹窗可隐藏重复标题。 */
showHeader?: boolean
} }
/** 多个历史和诊断入口共用折叠、刷新与错误展示。 */ /** 多个历史和诊断入口共用折叠、刷新与错误展示。 */
defineProps<Props>() withDefaults(defineProps<Props>(), { collapsible: true, showHeader: true })
/** 展开状态由调用方决定,只在展开后读取诊断。 */ /** 展开状态由调用方决定,只在展开后读取诊断。 */
const open = defineModel<boolean>('open', { default: false }) const open = defineModel<boolean>('open', { default: false })
/** 显式刷新只发出读取事件,不产生任何生成或修复操作。 */ /** 显式刷新只发出读取事件,不产生任何生成或修复操作。 */
@@ -24,14 +30,20 @@ const emit = defineEmits<{ refresh: [] }>()
<template> <template>
<!-- 以下是只读诊断的标题、展开与手动刷新模块 --> <!-- 以下是只读诊断的标题、展开与手动刷新模块 -->
<section class="workspace-panel text-xs leading-6" :aria-label="title"> <section class="workspace-panel text-xs leading-6" :aria-label="title">
<div class="flex flex-wrap items-center justify-between gap-3"> <div v-if="showHeader" class="flex flex-wrap items-center justify-between gap-3">
<strong><FieldLabel :label="title" :description="description" /></strong> <strong><FieldLabel :label="title" :description="description" /></strong>
<div class="flex items-center gap-3"> <div class="flex items-center gap-3">
<NButton text size="small" :aria-label="`${open ? '收起' : '查看'}${title}`" @click="open = !open"> <NButton
v-if="collapsible !== false"
text
size="small"
:aria-label="`${open ? '收起' : '查看'}${title}`"
@click="open = !open"
>
{{ open ? '收起' : '查看' }} {{ open ? '收起' : '查看' }}
</NButton> </NButton>
<NButton <NButton
v-if="open" v-if="open || collapsible === false"
text text
size="small" size="small"
:loading="loading" :loading="loading"
@@ -43,8 +55,8 @@ const emit = defineEmits<{ refresh: [] }>()
</div> </div>
</div> </div>
<!-- 以下是读取状态、错误与实际诊断结果模块 --> <!-- 以下是读取状态、错误与实际诊断结果模块 -->
<div v-if="open" class="mt-3"> <div v-if="open || collapsible === false" :class="{ 'mt-3': showHeader }">
<NAlert v-if="error" type="error" :show-icon="false" role="alert">{{ error }}</NAlert> <ContextNotice v-if="error" type="error" :show-icon="false" role="alert">{{ error }}</ContextNotice>
<p v-if="loading" class="text-muted" role="status">正在加载…</p> <p v-if="loading" class="text-muted" role="status">正在加载…</p>
<slot v-else /> <slot v-else />
</div> </div>
+42
View File
@@ -0,0 +1,42 @@
<script setup lang="ts">
import { NCollapse, NCollapseItem } from 'naive-ui'
/** 详情仅展示调用方明确选择的业务字段,不序列化接口对象。 */
defineProps<{
/** 普通用户可理解的详情名称。 */ title: string
/** 外层已折叠时直接显示记录,避免重复展开。 */ inline?: boolean
/** 每条历史记录的标题与业务内容。 */ records: Array<{
/** 可选的时间、版本或记录名称。 */ title?: string
/** 中文字段,不接收原始接口对象。 */ fields: Array<{
/** 字段名称。 */ label: string
/** 仅允许可读文本或数量。 */ value?: string | number | null
}>
}>
}>()
</script>
<template>
<!-- 以下是按需查看的中文记录,没有接口字段、指纹或整段响应。 -->
<component :is="inline ? 'div' : NCollapse" v-if="records.length" class="mt-3">
<component
:is="inline ? 'div' : NCollapseItem"
:name="inline ? undefined : 'records'"
:title="inline ? undefined : title"
>
<article v-for="(record, index) in records" :key="index" class="mb-4 last:mb-0">
<h4 v-if="record.title" class="mb-2 text-sm font-medium">{{ record.title }}</h4>
<dl class="detail-grid text-xs">
<template v-for="(field, fieldIndex) in record.fields" :key="fieldIndex">
<dt>{{ field.label }}</dt>
<dd class="whitespace-pre-wrap wrap-anywhere">
{{
field.value === null || field.value === undefined || field.value === ''
? '未记录'
: field.value
}}
</dd>
</template>
</dl>
</article>
</component>
</component>
</template>
+16 -12
View File
@@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { Image as ImageIcon } from '@lucide/vue'
import { NImage } from 'naive-ui' import { NImage } from 'naive-ui'
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
@@ -36,7 +37,7 @@ function reset() {
loaded.value = false loaded.value = false
} }
/** 图片加载完成后直接切换为淡入状态。 */ /** 图片加载完成后用原图替换静态占位。 */
function reveal() { function reveal() {
loaded.value = true loaded.value = true
} }
@@ -67,8 +68,10 @@ watch(() => props.src, reset)
@load="reveal" @load="reveal"
@error="fail" @error="fail"
/> />
<!-- 以下是 Instagram 风格的图片加载骨架模块 --> <!-- 图片读取时仅让占位图标轻微淡入淡出,保持画幅稳定。 -->
<span v-if="!loaded" class="reveal-image-placeholder" aria-hidden="true" /> <span v-if="!loaded" class="reveal-image-placeholder" aria-hidden="true">
<ImageIcon :size="22" :stroke-width="1.3" />
</span>
</span> </span>
</template> </template>
@@ -82,30 +85,31 @@ watch(() => props.src, reset)
@apply w-full h-full min-w-0 min-h-0; @apply w-full h-full min-w-0 min-h-0;
} }
.reveal-image > .n-image img { .reveal-image > .n-image img {
/* 所有图片从顶部展示,裁切缩略图时优先保留人物头部。 */
object-position: center top;
opacity: 0; opacity: 0;
transition: opacity 220ms cubic-bezier(0.25, 1, 0.5, 1);
} }
.reveal-image.is-loaded > .n-image img { .reveal-image.is-loaded > .n-image img {
opacity: 1; opacity: 1;
} }
.reveal-image-placeholder { .reveal-image-placeholder {
@apply absolute inset-0 pointer-events-none; @apply absolute inset-0 pointer-events-none grid place-items-center text-muted;
background-color: var(--app-control); background-color: var(--app-control);
animation: reveal-image-pulse 1.2s cubic-bezier(0.65, 0, 0.35, 1) infinite alternate;
} }
@keyframes reveal-image-pulse { .reveal-image-placeholder > svg {
animation: reveal-image-loading 1.8s ease-in-out infinite alternate;
}
@keyframes reveal-image-loading {
from { from {
opacity: 0.72; opacity: 0.45;
} }
to { to {
opacity: 1; opacity: 0.85;
} }
} }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
.reveal-image > .n-image img, .reveal-image-placeholder > svg {
.reveal-image-placeholder {
animation: none; animation: none;
transition: none;
} }
} }
</style> </style>
+23 -3
View File
@@ -1,10 +1,29 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue' import { computed } from 'vue'
import { NTag } from 'naive-ui' import { NTag } from 'naive-ui'
import { LoaderCircle } from '@lucide/vue'
import { statusLabels } from '../../lib/format' import { statusLabels } from '../../lib/format'
import type { ProjectStatus } from '../../features/projects/types' import type { ProjectStatus } from '../../features/projects/types'
/** 状态使用 Naive 标签,同时保留文本,避免仅依赖颜色区分。 */ /** 状态使用 Naive 标签,同时保留文本,避免仅依赖颜色区分。 */
const props = defineProps<{ status: string; label?: string }>() const props = defineProps<{ status: string; label?: string }>()
/** 素材和任务的公开状态不参与项目筛选选项。 */
const workflowStatusLabels: Record<string, string> = {
running: '进行中',
pending: '等待中',
queued: '排队中',
processing: '处理中',
submitted: '已提交',
failed: '失败',
cancelled: '已取消',
ready: '已就绪',
blocked: '暂不可用',
unlocked: '未锁定',
candidate_pending: '待确认候选'
}
/** 仅真实执行状态显示旋转图标,锁定或待确认状态不冒充加载。 */
const running = computed(() =>
['running', 'generating', 'pending', 'queued', 'processing', 'submitted'].includes(props.status)
)
const type = computed(() => const type = computed(() =>
['failed', 'blocked', 'cancelled'].includes(props.status) ['failed', 'blocked', 'cancelled'].includes(props.status)
? 'error' ? 'error'
@@ -16,7 +35,8 @@ const type = computed(() =>
) )
</script> </script>
<template> <template>
<NTag :type="type" size="small" :bordered="false" :data-status="status">{{ <NTag :type="type" size="small" :bordered="false" :data-status="status" :aria-busy="running"
label || statusLabels[status as ProjectStatus] || status ><template v-if="running" #icon><LoaderCircle :size="12" class="animate-spin" /></template
}}</NTag> >{{ label || workflowStatusLabels[status] || statusLabels[status as ProjectStatus] || '待确认' }}</NTag
>
</template> </template>
@@ -0,0 +1,270 @@
<script setup lang="ts">
import { computed, h, ref } from 'vue'
import { Check, Palette, PanelLeft, PanelRight } from '@lucide/vue'
import { NButton, NDropdown, NTooltip } from 'naive-ui'
import { themeAccents, type ThemeAccent } from '../../composables/themeAccents'
import type { ThemePreference } from '../../composables/useTheme'
import ThemeToggle from './ThemeToggle.vue'
import type { WorkspaceLayout } from '../../composables/useWorkspaceLayout'
/** 窄屏将色板收进菜单,给页面标题保留空间。 */
defineProps<{
/** 是否使用窄屏色板菜单。 */
compact: boolean
}>()
/** 当前主色预设。 */
const accent = defineModel<ThemeAccent>('accent', { required: true })
/** 当前明暗偏好。 */
const preference = defineModel<ThemePreference>({ required: true })
/** 当前工作台主导航位置。 */
const layout = defineModel<WorkspaceLayout>('layout', { required: true })
/** 布局菜单是否展开。 */
const layoutOpen = ref(false)
const layoutLabels = { left: '居左', right: '居右' } satisfies Record<WorkspaceLayout, string>
const layoutOptions = [
{ key: 'left', label: layoutLabels.left, icon: () => h(PanelLeft, { size: 16 }) },
{ key: 'right', label: layoutLabels.right, icon: () => h(PanelRight, { size: 16 }) }
]
/** 窄屏色板菜单的展开状态。 */
const open = ref(false)
/** 桌面色板的展开状态,同时支持悬停、键盘和触屏。 */
const desktopOpen = ref(false)
const accents = Object.keys(themeAccents) as ThemeAccent[]
/** 窄屏菜单为色板增加文字,并标记当前选中的主色。 */
const options = computed(() =>
accents.map(key => ({
key,
label: themeAccents[key].label,
icon: () =>
h(
'span',
{
class: ['theme-accent-dot', { 'is-bright': key === 'yellow' || key === 'green' }],
style: { backgroundColor: themeAccents[key].swatch },
'aria-hidden': 'true'
},
key === accent.value ? h(Check, { size: 12, strokeWidth: 3 }) : undefined
)
}))
)
/**
* 鼠标移出后收起色板,键盘仍在操作色点时保持展开。
* @param event 色板的指针离开事件
*/
function leavePalette(event: PointerEvent) {
if (event.pointerType === 'touch') return
const picker = event.currentTarget as HTMLElement
if (!picker.querySelector(':focus-visible')) desktopOpen.value = false
}
/**
* 键盘聚焦调色按钮时展开色板,使下一次 Tab 可以进入色点。
* @param event 色板的焦点进入事件
*/
function focusPalette(event: FocusEvent) {
if (event.target instanceof HTMLElement && event.target.matches(':focus-visible')) desktopOpen.value = true
}
/**
* 焦点离开色板且鼠标也不在其中时收起色板。
* @param event 色板的焦点离开事件
*/
function blurPalette(event: FocusEvent) {
const picker = event.currentTarget as HTMLElement
if (event.relatedTarget instanceof Node && picker.contains(event.relatedTarget)) return
if (!window.matchMedia('(hover: hover)').matches || !picker.matches(':hover')) desktopOpen.value = false
}
/**
* 应用窄屏菜单中选择的主色。
* @param key 菜单选项标识
*/
function selectAccent(key: string | number) {
if (Object.hasOwn(themeAccents, key)) accent.value = key as ThemeAccent
}
/**
* 将工作台主导航切换到所选的一侧。
* @param key 布局菜单选项标识
*/
function selectLayout(key: string | number) {
if (key === 'left' || key === 'right') layout.value = key
}
</script>
<template>
<!-- 以下是全局外观工具栏,统一管理主色、工作台布局和明暗模式。 -->
<div class="theme-appearance-controls" role="group" aria-label="外观设置">
<!-- 桌面色板从调色图标向顶栏内侧展开,色点折叠时不接收焦点。 -->
<div
v-if="!compact"
class="theme-accent-picker"
@pointerenter="desktopOpen = $event.pointerType !== 'touch' || desktopOpen"
@pointerleave="leavePalette"
@focusin="focusPalette"
@focusout="blurPalette"
>
<NButton
quaternary
class="theme-accent-toggle icon-button"
:aria-label="`主色:${themeAccents[accent].label}`"
:aria-expanded="desktopOpen"
@click="desktopOpen = true"
>
<template #icon><Palette :size="18" aria-hidden="true" /></template>
</NButton>
<div
class="theme-accent-swatches"
:class="{ 'is-open': desktopOpen }"
:style="{ '--theme-swatch-count': accents.length }"
:inert="!desktopOpen"
>
<div class="theme-accent-swatch-list" role="group" aria-label="主色">
<NTooltip v-for="key in accents" :key="key" placement="bottom">
<template #trigger>
<button
type="button"
class="theme-accent-swatch"
:aria-label="themeAccents[key].label"
:aria-pressed="accent === key"
@click="accent = key"
>
<span
class="theme-accent-dot"
:class="{ 'is-bright': key === 'yellow' || key === 'green' }"
:style="{ backgroundColor: themeAccents[key].swatch }"
aria-hidden="true"
>
<Check v-if="accent === key" :size="12" :stroke-width="3" />
</span>
</button>
</template>
{{ themeAccents[key].label }}
</NTooltip>
</div>
</div>
</div>
<!-- 窄屏使用带色点和名称的菜单,保持顶栏紧凑。 -->
<NDropdown
v-else
v-model:show="open"
trigger="click"
placement="bottom-end"
to="body"
:value="accent"
:options="options"
@select="selectAccent"
>
<NButton
quaternary
class="theme-accent-toggle icon-button"
:aria-label="`主色:${themeAccents[accent].label}`"
aria-haspopup="menu"
:aria-expanded="open"
>
<template #icon><Palette :size="18" aria-hidden="true" /></template>
</NButton>
</NDropdown>
<!-- 以下是工作台主导航位置菜单。 -->
<NDropdown
v-model:show="layoutOpen"
trigger="click"
placement="bottom-end"
to="body"
:value="layout"
:options="layoutOptions"
@select="selectLayout"
>
<NButton
quaternary
class="workspace-layout-toggle icon-button"
:aria-label="`工作台布局:${layoutLabels[layout]}`"
aria-haspopup="menu"
:aria-expanded="layoutOpen"
>
<template #icon>
<component :is="layout === 'left' ? PanelLeft : PanelRight" :size="18" aria-hidden="true" />
</template>
</NButton>
</NDropdown>
<!-- 以下是浅色、暗色与跟随系统模式菜单。 -->
<ThemeToggle v-model="preference" />
</div>
</template>
<style>
.theme-appearance-controls {
display: inline-flex;
flex: none;
align-items: center;
gap: 2px;
padding-inline: 3px;
background: var(--app-control);
}
/* 工具栏移到左侧时,明暗与调色入口对调,布局入口仍在中间。 */
.is-nav-right .theme-appearance-controls {
flex-direction: row-reverse;
}
.theme-accent-picker {
display: flex;
flex-direction: row-reverse;
}
/* 工具栏在左侧时向右展开,调色按钮保持在原位。 */
.is-nav-right .theme-accent-picker {
flex-direction: row;
}
.theme-accent-swatches {
--theme-swatch-size: 32px;
inline-size: 0;
overflow: hidden;
opacity: 0;
transition:
inline-size 260ms cubic-bezier(0.22, 1, 0.36, 1),
opacity 180ms ease-out;
}
.theme-accent-swatches.is-open {
inline-size: calc(var(--theme-swatch-count) * var(--theme-swatch-size));
opacity: 1;
}
.theme-accent-swatch-list {
display: flex;
inline-size: max-content;
}
.theme-accent-swatch {
display: grid;
width: var(--theme-swatch-size);
height: 34px;
place-items: center;
}
.theme-accent-swatch:hover {
background: var(--app-control-hover);
}
.theme-accent-swatch:focus-visible {
outline-offset: -4px;
}
.theme-accent-dot {
display: inline-grid;
width: 20px;
height: 20px;
flex: none;
place-items: center;
color: #ffffff;
}
.theme-accent-dot.is-bright {
color: #191919;
}
.theme-appearance-controls .n-button.icon-button {
width: 34px;
height: 34px;
min-width: 34px;
}
.theme-appearance-controls .theme-accent-toggle {
color: var(--app-accent-text);
}
</style>
+80 -3
View File
@@ -1,23 +1,72 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, h, ref } from 'vue' import { computed, h, nextTick, ref, useTemplateRef } from 'vue'
import { NButton, NDropdown } from 'naive-ui' import { NButton, NDropdown } from 'naive-ui'
import { Monitor, Moon, Sun } from '@lucide/vue' import { Monitor, Moon, Sun } from '@lucide/vue'
import type { ThemePreference } from '../../composables/useTheme' import type { ThemePreference } from '../../composables/useTheme'
/** 图标表示用户偏好;保留系统跟随选项,不以简单二态切换覆盖偏好。 */ /** 图标表示用户偏好;保留系统跟随选项,不以简单二态切换覆盖偏好。 */
const preference = defineModel<ThemePreference>({ required: true }) const preference = defineModel<ThemePreference>({ required: true })
/** 明暗模式菜单是否展开。 */
const open = ref(false) const open = ref(false)
/** 动画以这个模式按钮的位置为圆心。 */
const trigger = useTemplateRef<InstanceType<typeof NButton>>('themeTrigger')
/** 当前切换动画,结束前避免重复抓取页面快照。 */
let activeTransition: ViewTransition | undefined
const modes = [ const modes = [
{ key: 'light', label: '浅色模式', icon: Sun }, { key: 'light', label: '浅色模式', icon: Sun },
{ key: 'dark', label: '暗黑模式', icon: Moon }, { key: 'dark', label: '暗黑模式', icon: Moon },
{ key: 'system', label: '跟随系统', icon: Monitor } { key: 'system', label: '跟随系统', icon: Monitor }
] as const ] as const
/** 图标和名称反映当前选中的模式。 */
const current = computed(() => modes.find(mode => mode.key === preference.value) ?? modes[2]) const current = computed(() => modes.find(mode => mode.key === preference.value) ?? modes[2])
const options = modes.map(mode => ({ ...mode, icon: () => h(mode.icon, { size: 16 }) })) const options = modes.map(mode => ({ ...mode, icon: () => h(mode.icon, { size: 16 }) }))
/** Dropdown 的键类型较宽,只接收受支持的主题值。 */ /**
* 选择主题模式,深浅实际变化时从顶栏按钮的位置过渡。
* @param key 菜单选项标识
*/
function selectTheme(key: string | number) { function selectTheme(key: string | number) {
if (key === 'light' || key === 'dark' || key === 'system') preference.value = key if (key !== 'light' && key !== 'dark' && key !== 'system') return
const root = document.documentElement
const dark = key === 'dark' || (key === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches)
const button = trigger.value?.$el
if (
typeof document.startViewTransition !== 'function' ||
!(button instanceof HTMLElement) ||
dark === (root.dataset.theme === 'dark') ||
window.matchMedia('(prefers-reduced-motion: reduce)').matches
) {
activeTransition?.skipTransition()
preference.value = key
return
}
if (activeTransition) return
const { left, top, width, height } = button.getBoundingClientRect()
const x = left + width / 2
const y = top + height / 2
const radius = Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y))
root.style.setProperty('--theme-transition-origin', `${x}px ${y}px`)
root.style.setProperty('--theme-transition-radius', `${radius}px`)
root.classList.add('theme-mode-transition')
const transition = document.startViewTransition(async () => {
preference.value = key
await nextTick()
})
activeTransition = transition
/** 动画结束或被浏览器跳过时清除快照样式。 */
function clearTransition() {
activeTransition = undefined
root.classList.remove('theme-mode-transition')
root.style.removeProperty('--theme-transition-origin')
root.style.removeProperty('--theme-transition-radius')
}
// 页面切换标签等情况可能让浏览器跳过快照,主题更新仍会执行。
void transition.ready.catch(() => {})
void transition.finished.then(clearTransition, clearTransition)
} }
</script> </script>
@@ -33,6 +82,7 @@ function selectTheme(key: string | number) {
@select="selectTheme" @select="selectTheme"
> >
<NButton <NButton
ref="themeTrigger"
quaternary quaternary
class="theme-toggle icon-button" class="theme-toggle icon-button"
:aria-label="`主题模式:${current.label}`" :aria-label="`主题模式:${current.label}`"
@@ -50,4 +100,31 @@ function selectTheme(key: string | number) {
.n-button.theme-toggle { .n-button.theme-toggle {
@apply shrink-0 w-[34px] h-[34px]; @apply shrink-0 w-[34px] h-[34px];
} }
/* 只替换此次主题切换的快照动画,不影响其它页面过渡。 */
.theme-mode-transition::view-transition-group(root),
.theme-mode-transition::view-transition-old(root),
.theme-mode-transition::view-transition-new(root) {
animation: none;
mix-blend-mode: normal;
}
.theme-mode-transition::view-transition-new(root) {
z-index: 1;
animation: theme-mode-reveal 450ms ease-in both;
}
.theme-mode-transition[data-theme='dark']::view-transition-new(root) {
z-index: 0;
animation: none;
}
.theme-mode-transition[data-theme='dark']::view-transition-old(root) {
z-index: 1;
animation: theme-mode-reveal 450ms ease-in reverse both;
}
@keyframes theme-mode-reveal {
from {
clip-path: circle(0 at var(--theme-transition-origin));
}
to {
clip-path: circle(var(--theme-transition-radius) at var(--theme-transition-origin));
}
}
</style> </style>
@@ -0,0 +1,43 @@
<script setup lang="ts">
import { NPopover, type PopoverProps } from 'naive-ui'
import { onScopeDispose, ref } from 'vue'
/** 工作区图标操作共用的悬浮说明。 */
const props = defineProps<{
/** 与按钮无障碍名称一致的操作说明。 */
label: string
/** 提示相对图标的位置;未指定时沿用已有布局。 */
placement?: PopoverProps['placement']
/** 按钮仅在手机端隐藏文字时,只在对应窄屏显示说明。 */
mobileOnly?: boolean
/** 详情已打开时停用重复提示,避免覆盖当前内容。 */
disabled?: boolean
}>()
/** 与项目工具栏隐藏文字的断点保持一致。 */
const compactMedia = props.mobileOnly ? window.matchMedia('(max-width: 639px)') : null
/** 跨屏幕尺寸时同步提示开关,桌面文字按钮不重复提示。 */
const compact = ref(compactMedia?.matches ?? false)
/**
* 同步当前按钮是否处于仅显示图标的窄屏。
* @param event 屏幕断点变化事件
*/
function syncCompact(event: MediaQueryListEvent) {
compact.value = event.matches
}
compactMedia?.addEventListener('change', syncCompact)
onScopeDispose(() => compactMedia?.removeEventListener('change', syncCompact))
</script>
<template>
<!-- 以下是图标操作的统一悬浮说明,不额外增加布局容器 -->
<NPopover
trigger="hover"
:placement="placement ?? 'bottom-end'"
:disabled="disabled || (mobileOnly && !compact)"
:to="true"
:flip="true"
>
<template #trigger><slot /></template>
<span class="block max-w-[min(320px,calc(100vw-48px))] whitespace-normal wrap-anywhere">{{ label }}</span>
</NPopover>
</template>
@@ -0,0 +1,75 @@
<script setup lang="ts">
import { Download } from '@lucide/vue'
import { NButton } from 'naive-ui'
import WorkspaceActionTooltip from './WorkspaceActionTooltip.vue'
import { ref, watch } from 'vue'
/** 工作区标签栏的直接导出入口。 */
interface Props {
/** 悬浮说明与无障碍按钮名称。 */
label: string
/** 当前没有可导出的数据时禁用。 */
disabled?: boolean
}
/** 导出按钮使用页面提供的说明与禁用状态。 */
defineProps<Props>()
/** 点击按钮时通知页面导出当前已读取的数据。 */
const emit = defineEmits<{ export: [] }>()
/** 导出容器跟随父标签栏的实际高度。 */
const container = ref<HTMLElement | null>(null)
/** 按钮边长首次测量前沿用标签栏默认高度。 */
const buttonSize = ref(40)
/** 标签栏尺寸变化时保持按钮为正方形,卸载后释放监听。 */
watch(
container,
(element, _previous, onCleanup) => {
if (!element) return
buttonSize.value = element.getBoundingClientRect().height || 40
if (typeof ResizeObserver === 'undefined') return
const observer = new ResizeObserver(() => {
const height = element.getBoundingClientRect().height
if (height > 0) buttonSize.value = height
})
observer.observe(element)
onCleanup(() => observer.disconnect())
},
{ flush: 'post' }
)
</script>
<template>
<!-- 以下是随标签栏高度保持正方形的导出图标与悬浮说明模块 -->
<div
ref="container"
class="tabs-toolbar-actions workspace-export-action"
:style="{ '--export-button-size': `${buttonSize}px` }"
>
<WorkspaceActionTooltip :label="label">
<NButton
quaternary
size="small"
class="icon-button workspace-export-button"
:aria-label="label"
:disabled="disabled"
@click="emit('export')"
>
<template #icon><Download :size="18" aria-hidden="true" /></template>
</NButton>
</WorkspaceActionTooltip>
</div>
</template>
<style scoped>
@reference "../../styles/styles.css";
.workspace-export-action {
/* 与父标签栏一起拉伸,说明文字由 Popover 展示,不占按钮宽度。 */
@apply items-stretch self-stretch shrink-0 flex-nowrap;
}
.workspace-export-action .n-button.workspace-export-button {
/* 项目手机工具栏统一紧凑尺寸,其余场景继续跟随标签栏高度。 */
width: var(--app-toolbar-icon-size, var(--export-button-size));
min-width: 0;
height: var(--app-toolbar-icon-size, 100%);
align-self: center;
}
</style>
+22 -4
View File
@@ -1,13 +1,31 @@
<script setup lang="ts"> <script setup lang="ts">
import { NScrollbar } from 'naive-ui' import { NScrollbar } from 'naive-ui'
/** 工作区固定标题和操作区;仅内容容器滚动,不向 document 传播滚动。 */ /** 工作区默认固定标题和操作区,可让手机提示、目录与正文在项目内容区一起滚动。 */
defineProps<{ split?: boolean; compact?: boolean }>() withDefaults(
defineProps<{
/** 是否采用目录与详情分栏。 */
split?: boolean
/** 是否使用紧凑内容布局。 */
compact?: boolean
/** 手机是否让提示、工具、目录和正文一起滚动,项目顶栏仍固定。 */
mobileScroll?: boolean
/** 隐藏标题区时保留插槽内已有弹层实例,空状态入口仍能复用它们。 */
headerVisible?: boolean
}>(),
{ headerVisible: true }
)
</script> </script>
<template> <template>
<section class="workspace-page" :class="{ 'content-first-workspace': compact }"> <section
class="workspace-page"
:class="{ 'content-first-workspace': compact, 'mobile-reading-workspace': mobileScroll }"
>
<!-- 以下是统一对齐的页面提示、标题与正文模块 --> <!-- 以下是统一对齐的页面提示、标题与正文模块 -->
<div v-if="$slots.notice" class="workspace-notice"><slot name="notice" /></div> <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"
:style="headerVisible ? undefined : { display: 'none' }"
class="workspace-heading-scroll"
><header class="workspace-heading"><slot name="header" /></header ><header class="workspace-heading"><slot name="header" /></header
></NScrollbar> ></NScrollbar>
<div v-if="split" class="workspace-split"><slot /></div> <div v-if="split" class="workspace-split"><slot /></div>
@@ -0,0 +1,27 @@
<script setup lang="ts">
import { NButton } from 'naive-ui'
import { RefreshCw } from '@lucide/vue'
/** 工作区刷新按钮统一沿用默认按钮尺寸、背景与图标间距。 */
interface Props {
/** 刷新操作名称。 */
label?: string
/** 是否正在读取最新数据。 */
loading?: boolean
/** 是否暂时禁止刷新。 */
disabled?: boolean
}
/** 刷新仅改变读取状态,调用方负责真实接口请求。 */
withDefaults(defineProps<Props>(), { label: '刷新', loading: false, disabled: false })
/** 用户明确点击刷新时通知调用方。 */
const emit = defineEmits<{ refresh: [] }>()
</script>
<template>
<!-- 以下是统一的手动刷新按钮模块 -->
<NButton :loading="loading" :disabled="disabled" @click="emit('refresh')">
<template #icon><RefreshCw :size="13" aria-hidden="true" /></template>
{{ label }}
</NButton>
</template>
@@ -0,0 +1,66 @@
<script setup lang="ts">
import FieldLabel from './FieldLabel.vue'
/** 工作区模块标题、说明及操作位置的统一展示参数。 */
interface Props {
/** 模块标题。 */
title: string
/** 可选功能块序标,只表达阅读顺序,不表示进度或审核结果。 */
marker?: string
/** 操作放右侧同行或说明下方左侧;默认保持已有页面布局。 */
actionsPlacement?: 'right' | 'below'
/** 模块说明,可通过 description 插槽补充状态与提示。 */
description?: string
/** 非必要说明按需查看,动态状态插槽始终保留在正文。 */
descriptionAsInfo?: boolean
}
/** 标题与说明由业务模块提供,操作通过插槽复用统一对齐方式。 */
defineProps<Props>()
</script>
<template>
<!-- 以下是统一的模块标题与可选同行操作模块 -->
<header class="workspace-section-heading">
<div class="workspace-section-heading-row">
<h3 class="flex items-center gap-2 text-sm font-semibold">
<span v-if="marker" class="workspace-section-marker" aria-hidden="true">{{ marker }}</span>
{{ title
}}<FieldLabel
v-if="descriptionAsInfo && description && !$slots.description"
:label="title"
:description="description"
icon-only
icon="info"
/>
</h3>
<div v-if="$slots.actions && actionsPlacement !== 'below'" class="workspace-section-heading-actions">
<slot name="actions" />
</div>
</div>
<!-- 以下是标题下方的说明与状态模块 -->
<div v-if="$slots.description || (description && !descriptionAsInfo)" class="workspace-section-description">
<slot name="description">{{ description }}</slot>
</div>
<!-- 以下是正文左侧的模块操作,与标题及说明共用边界 -->
<div v-if="$slots.actions && actionsPlacement === 'below'" class="workspace-section-heading-actions mt-4">
<slot name="actions" />
</div>
</header>
</template>
<style>
@reference "../../styles/styles.css";
.workspace-section-heading-row {
@apply flex min-w-0 flex-wrap items-center justify-between gap-3;
}
/* 罗马序标提供稳定的视觉锚点,使用中性主题色,不暗示步骤通过。 */
.workspace-section-marker {
@apply inline-flex h-8 min-w-8 shrink-0 items-center justify-center bg-(--app-control) px-2 text-lg font-medium leading-none text-ink;
}
.workspace-section-heading-actions {
@apply flex shrink-0 flex-wrap items-center gap-3;
}
.workspace-section-description {
@apply mt-2 text-xs leading-6 text-muted;
}
</style>
+51 -11
View File
@@ -1,14 +1,39 @@
<script setup lang="ts"> <script setup lang="ts">
import { NButton } from 'naive-ui' import { NButton } from 'naive-ui'
import AppDialog from './AppDialog.vue' import AppDialog from './AppDialog.vue'
import { Settings2 } from '@lucide/vue' import AppDrawer from './AppDrawer.vue'
import { LoaderCircle, Settings2 } from '@lucide/vue'
/** 批量设置与回执属于临时操作,统一使用大尺寸弹窗;完整制作流程继续保留独立页面。 */ /** 工作区设置与回执按需使用宽弹窗或全屏抽屉,正文与任务状态仍由工作区持有。 */
withDefaults(defineProps<{ title: string; label?: string; hasReceipt?: boolean; triggerless?: boolean }>(), { withDefaults(
label: '操作与回执', defineProps<{
triggerless: false /** 设置容器的标题。 */
}) title: string
/** 工作区中的入口文案。 */
label?: string
/** 是否提示存在任务回执。 */
hasReceipt?: boolean
/** 是否由调用方提供入口。 */
triggerless?: boolean
/** 使用内容铺满视口的全屏抽屉。 */
fullscreen?: boolean
/** 当前工作区存在运行中的请求或持久化任务。 */
pending?: boolean
/** 在操作入口原位置展示真实任务名称。 */
pendingLabel?: string
/** 真实提交期间锁定关闭,普通只读加载不锁定。 */
busy?: boolean
}>(),
{
label: '操作与回执',
triggerless: false,
fullscreen: false
}
)
/** 工具区容器显隐状态,关闭时保留调用方的配置草稿。 */
const open = defineModel<boolean>('open', { default: false }) const open = defineModel<boolean>('open', { default: false })
/** 工具容器完全关闭后通知调用方,便于切换独立的问题弹窗。 */
const emit = defineEmits<{ closed: [] }>()
</script> </script>
<template> <template>
@@ -17,17 +42,32 @@ const open = defineModel<boolean>('open', { default: false })
class="workspace-tools-trigger" class="workspace-tools-trigger"
data-workspace-tools data-workspace-tools
:aria-label="label" :aria-label="label"
:title="label"
aria-haspopup="dialog" aria-haspopup="dialog"
:aria-expanded="open" :aria-expanded="open"
:aria-busy="!!pending"
@click="open = true" @click="open = true"
> >
<template #icon><Settings2 :size="15" /></template> <template #icon
<span class="workspace-tools-label">{{ label }}</span ><LoaderCircle v-if="pending" :size="15" class="animate-spin" /><Settings2 v-else :size="15"
><span v-if="hasReceipt" class="text-xs text-muted"> · 有回执</span> /></template>
<span class="workspace-tools-label">{{ pending ? pendingLabel || '任务执行中' : label }}</span
><span v-if="hasReceipt" class="workspace-tools-receipt text-xs text-muted"> · 有回执</span>
</NButton> </NButton>
<AppDialog v-model:open="open" :title="title" description="" wide> <!-- 以下是按工作区要求切换的工具容器模块,共用关闭后的交接事件 -->
<component
:is="fullscreen ? AppDrawer : AppDialog"
v-model:open="open"
:title="title"
:busy="busy"
description=""
v-bind="fullscreen ? {} : { wide: true }"
@closed="emit('closed')"
>
<div class="workspace-tools-body"><slot /></div> <div class="workspace-tools-body"><slot /></div>
</AppDialog> <!-- 以下是业务确认操作底栏;未提供时保留公共容器的灰色关闭按钮 -->
<template v-if="$slots.footer" #footer><slot name="footer" /></template>
</component>
</template> </template>
<style> <style>
+4
View File
@@ -1,10 +1,14 @@
/** 公共 UI 的统一导出入口。 */ /** 公共 UI 的统一导出入口。 */
export { default as FieldLabel } from './FieldLabel.vue' export { default as FieldLabel } from './FieldLabel.vue'
export { default as AppDialog } from './AppDialog.vue' export { default as AppDialog } from './AppDialog.vue'
export { default as AppDrawer } from './AppDrawer.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'
export { default as StudioLogo } from './StudioLogo.vue' export { default as StudioLogo } from './StudioLogo.vue'
export { default as AssetImage } from './AssetImage.vue' export { default as AssetImage } from './AssetImage.vue'
export { default as AssetOpenLink } from './AssetOpenLink.vue'
export { default as RevealImage } from './RevealImage.vue' export { default as RevealImage } from './RevealImage.vue'
export { default as DirectoryItem } from './DirectoryItem.vue' export { default as DirectoryItem } from './DirectoryItem.vue'
export { default as WorkspaceTools } from './WorkspaceTools.vue' export { default as WorkspaceTools } from './WorkspaceTools.vue'
export { default as WorkspaceSectionHeading } from './WorkspaceSectionHeading.vue'
export { default as WorkspaceRefreshButton } from './WorkspaceRefreshButton.vue'
+28 -2
View File
@@ -1,13 +1,39 @@
import { inject, type InjectionKey } from 'vue' import { hasInjectionContext, inject, type InjectionKey } from 'vue'
import type { MessageApi } from 'naive-ui' import type { MessageApi } from 'naive-ui'
import { userFacingText } from '../../lib/user-facing-text'
/** 页面操作结果共用的 Naive Message 实例。 */ /** 页面操作结果共用的 Naive Message 实例。 */
export const actionMessageKey: InjectionKey<MessageApi> = Symbol('action-message') export const actionMessageKey: InjectionKey<MessageApi> = Symbol('action-message')
/** 多个查询同时失败时,同一消息层不重复显示相同错误。 */
const recentMessages = new WeakMap<MessageApi, Map<string, number>>()
/**
* 展示短反馈,对同一时间的重复查询错误去重。
* @param message 应用消息接口
* @param content 当前真实反馈
* @param type 反馈级别
*/
export function showActionFeedback(
message: MessageApi | null,
content: string,
type: 'success' | 'error' | 'warning' | 'info'
) {
if (!message || !content.trim()) return
content = userFacingText(content)
const history = recentMessages.get(message) ?? new Map<string, number>()
const now = Date.now()
const key = `${type}:${content}`
if (now - (history.get(key) ?? -Infinity) < 5000) return
for (const [value, time] of history) if (now - time > 5000) history.delete(value)
history.set(key, now)
recentMessages.set(message, history)
message[type](content, { duration: type === 'error' || type === 'warning' ? 7000 : 3000, closable: true })
}
/** /**
* 读取应用提供的轻量反馈接口,独立使用组件时允许不提供消息层。 * 读取应用提供的轻量反馈接口,独立使用组件时允许不提供消息层。
* @returns 当前应用消息接口,没有消息层时返回 null * @returns 当前应用消息接口,没有消息层时返回 null
*/ */
export function useActionMessage() { export function useActionMessage() {
return inject(actionMessageKey, null) return hasInjectionContext() ? inject(actionMessageKey, null) : null
} }
+78
View File
@@ -0,0 +1,78 @@
/** 主色预设的显示色和深浅背景下的操作色。 */
interface ThemeAccentPreset {
/** 色板中展示的名称。 */
label: string
/** 色板圆点的颜色。 */
swatch: string
/** 带白字的主按钮底色。 */
action: string
/** 暗色表面上的强调文字。 */
darkText: string
}
/** 顶栏提供与 Vben 色板对应的七种主色,保留工作台原有的品牌绿。 */
export const themeAccents = {
blue: { label: '蓝色', swatch: '#0070e6', action: '#005cbd', darkText: '#8ebdff' },
violet: { label: '紫色', swatch: '#7465f0', action: '#6246c9', darkText: '#b8aaff' },
pink: { label: '玫红', swatch: '#e94a6c', action: '#bd3154', darkText: '#ff9db2' },
yellow: { label: '金黄', swatch: '#efbd48', action: '#865b00', darkText: '#f5cf71' },
indigo: { label: '靛蓝', swatch: '#4e66fc', action: '#4053ce', darkText: '#a7b4ff' },
green: { label: '绿色', swatch: '#07c160', action: '#078640', darkText: '#5cd693' },
zinc: { label: '石墨灰', swatch: '#3f3f46', action: '#52525b', darkText: '#d4d4d8' }
} satisfies Record<string, ThemeAccentPreset>
/** 用于保存和恢复主色选择的预设标识。 */
export type ThemeAccent = keyof typeof themeAccents
/**
* 在 sRGB 空间混合两种十六进制颜色,生成可传给 Naive UI 的不透明色值。
* @param base 基础颜色
* @param tint 混入的颜色
* @param weight 混入颜色的比例
* @returns 六位十六进制色值
*/
function mixColor(base: string, tint: string, weight: number) {
const channels = [1, 3, 5].map(index => {
const start = Number.parseInt(base.slice(index, index + 2), 16)
const end = Number.parseInt(tint.slice(index, index + 2), 16)
return Math.round(start + (end - start) * weight)
.toString(16)
.padStart(2, '0')
})
return `#${channels.join('')}`
}
/**
* 生成业务样式和 Naive UI 共用的主色,延续默认绿色的原有色阶。
* @param accent 主色预设
* @param dark 当前是否使用暗色模式
* @returns 主色、强调文字、选中背景和按钮状态颜色
*/
export function resolveThemeAccent(accent: ThemeAccent, dark: boolean) {
const { action, darkText, swatch } = themeAccents[accent]
if (accent === 'green') {
return {
primary: swatch,
hover: '#2dcb79',
pressed: '#06ad56',
text: dark ? darkText : '#087c42',
selected: dark ? '#173527' : '#e4f4e9',
button: action,
buttonHover: '#087c42',
buttonPressed: '#066b36'
}
}
const primary = dark ? darkText : action
const buttonHover = mixColor(action, '#000000', 0.12)
const buttonPressed = mixColor(action, '#000000', 0.24)
return {
primary,
hover: dark ? mixColor(primary, '#ffffff', 0.18) : buttonHover,
pressed: dark ? mixColor(primary, '#000000', 0.12) : buttonPressed,
text: primary,
selected: mixColor(dark ? '#191919' : '#ffffff', primary, dark ? 0.17 : 0.09),
button: action,
buttonHover,
buttonPressed
}
}
+76
View File
@@ -0,0 +1,76 @@
import { nextTick, onScopeDispose, watch, type Ref } from 'vue'
/**
* 为主体、分镜和生产目录共用选中项定位:桌面靠上、手机靠左,末尾遵守自然边界。
* @param root 目录条目的根节点,位于目录自身的滚动容器内
* @param getActiveId 读取当前选中项 ID
* @param getItemIds 读取当前可见目录项 ID
* @param stickyHeadingSelector 桌面粘性分组标题选择器
*/
export function useDirectorySelection(
root: Ref<HTMLElement | null>,
getActiveId: () => string,
getItemIds: () => string[],
stickyHeadingSelector?: string
): void {
/** 观察目录视口变化,兼容首次异步加载、屏幕缩放及手机横竖屏。 */
let observer: ResizeObserver | undefined
/**
* 只滚动目录自身,避免手机定位目录时改变整页阅读位置。
* @param animate 是否为用户切换使用平滑滚动
* @returns 目录渲染和定位完成
*/
async function locate(animate = false): Promise<void> {
const activeId = getActiveId()
await nextTick()
const element = root.value
const selected = element?.querySelector<HTMLElement>('[aria-current="true"]')
const viewport = element?.closest<HTMLElement>('.n-scrollbar-container')
if (!selected || !viewport || activeId !== getActiveId()) return
const mobile = window.matchMedia('(max-width: 760px)').matches
const behavior =
animate && !window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'smooth' : 'instant'
if (mobile) {
viewport.scrollTo({
left:
viewport.scrollLeft + selected.getBoundingClientRect().left - viewport.getBoundingClientRect().left,
behavior
})
return
}
/** 按语义分组寻找所属标题,镜头多选包装层变化不影响吸顶避让。 */
const heading = stickyHeadingSelector
? selected.closest('[role="group"]')?.querySelector<HTMLElement>(stickyHeadingSelector)
: null
viewport.scrollTo({
top:
viewport.scrollTop +
selected.getBoundingClientRect().top -
viewport.getBoundingClientRect().top -
(heading?.offsetHeight ?? 0),
behavior
})
}
/** 初次加载和可见项变化立即定位,切换选中项平滑定位,状态刷新不打断浏览。 */
watch(
[root, getActiveId, () => getItemIds().join(',')],
(targets, previous) => void locate(!!previous?.[1] && previous[0] === targets[0] && previous[1] !== targets[1]),
{ immediate: true, flush: 'post' }
)
/** 根节点可能在接口数据返回后才出现,出现时绑定尺寸监听,移除时释放旧监听。 */
watch(
root,
element => {
observer?.disconnect()
const viewport = element?.closest('.n-scrollbar-container')
if (!viewport) return
observer = new ResizeObserver(() => void locate())
observer.observe(viewport)
},
{ flush: 'post' }
)
/** 页面或目录卸载后释放监听。 */
onScopeDispose(() => observer?.disconnect())
}
+21
View File
@@ -0,0 +1,21 @@
import { watch, type MaybeRefOrGetter, toValue } from 'vue'
import { showActionFeedback, useActionMessage } from '../components/ui/useActionMessage'
/**
* 对新查询失败统一提示;相同轮询错误不反复弹出,成功读取后解除去重。
* @param source 当前查询错误或局部操作反馈
* @param type 消息级别
* @returns 与当前组件生命周期绑定的观察器
*/
export function useFeedbackMessage(
source: MaybeRefOrGetter<string>,
type: 'error' | 'warning' | 'success' | 'info' = 'error'
) {
const message = useActionMessage()
return watch(
() => toValue(source),
content => {
showActionFeedback(message, content, type)
}
)
}
+21
View File
@@ -0,0 +1,21 @@
import { onScopeDispose, ref } from 'vue'
/**
* 与公共弹窗的手机断点同步,旋转或调整窗口时即时更新。
* @returns 当前是否使用手机面板布局
*/
export function useMobileViewport() {
const query = window.matchMedia('(max-width: 639px)')
/** 手机布局只由当前视口决定,不写入用户偏好。 */
const mobile = ref(query.matches)
/**
* 同步视口断点。
* @param event 媒体查询变化
*/
function update(event: MediaQueryListEvent) {
mobile.value = event.matches
}
query.addEventListener('change', update)
onScopeDispose(() => query.removeEventListener('change', update))
return mobile
}
+22
View File
@@ -0,0 +1,22 @@
import { ref, watch, type Ref } from 'vue'
/**
* 公共弹层仅在正文离开顶部后提示遮挡,重新开关时清除旧状态。
* @param open 当前弹层显隐
* @returns 正文滚动状态与滚动事件入口
*/
export function usePanelScrollState(open: Readonly<Ref<boolean>>) {
/** 只表达正文顶部是否有被遮挡内容,不跟随内部输入框滚动。 */
const bodyScrolled = ref(false)
/**
* 读取真实滚动容器的位置,回到顶部即时隐藏阴影。
* @param event 公共正文滚动事件
*/
function onBodyScroll(event: Event) {
bodyScrolled.value = ((event.target as HTMLElement | null)?.scrollTop ?? 0) > 0
}
watch(open, () => {
bodyScrolled.value = false
})
return { bodyScrolled, onBodyScroll }
}
+3
View File
@@ -1,3 +1,4 @@
import { useFeedbackMessage } from './useFeedbackMessage'
import { onScopeDispose, ref, toValue, watch, type MaybeRefOrGetter, type Ref } from 'vue' import { onScopeDispose, ref, toValue, watch, type MaybeRefOrGetter, type Ref } from 'vue'
import { errorMessage } from '../lib/http' import { errorMessage } from '../lib/http'
@@ -10,6 +11,8 @@ export function usePolling<T>(
const data = ref<T | null>(null) as Ref<T | null> const data = ref<T | null>(null) as Ref<T | null>
const loading = ref(false) const loading = ref(false)
const error = ref('') const error = ref('')
/** 查询失败统一进入消息层,保留错误状态用于禁用写操作。 */
useFeedbackMessage(error)
const updatedAt = ref('') const updatedAt = ref('')
let generation = 0 let generation = 0
let controller: AbortController | undefined let controller: AbortController | undefined
+8 -3
View File
@@ -1,3 +1,4 @@
import { useFeedbackMessage } from './useFeedbackMessage'
import { onScopeDispose, ref, watch, type Ref } from 'vue' import { onScopeDispose, ref, watch, type Ref } from 'vue'
import { errorMessage } from '../lib/http' import { errorMessage } from '../lib/http'
@@ -6,6 +7,8 @@ export function useQuery<T>(key: Ref<string>, loader: (key: string, signal: Abor
const data = ref<T | null>(null) as Ref<T | null> const data = ref<T | null>(null) as Ref<T | null>
const loading = ref(false) const loading = ref(false)
const error = ref('') const error = ref('')
/** 查询失败统一进入消息层,保留错误状态用于禁用写操作。 */
useFeedbackMessage(error)
const updatedAt = ref('') const updatedAt = ref('')
let generation = 0 let generation = 0
let controller: AbortController | undefined let controller: AbortController | undefined
@@ -15,18 +18,20 @@ export function useQuery<T>(key: Ref<string>, loader: (key: string, signal: Abor
async function refresh() { async function refresh() {
if (disposed) return if (disposed) return
const current = ++generation const current = ++generation
const target = key.value
controller?.abort() controller?.abort()
controller = new AbortController() controller = new AbortController()
const signal = controller.signal const signal = controller.signal
loading.value = true loading.value = true
try { try {
const result = await loader(key.value, signal) const result = await loader(target, signal)
if (current !== generation || disposed) return if (current !== generation || target !== key.value || disposed) return
data.value = result data.value = result
error.value = '' error.value = ''
updatedAt.value = new Date().toISOString() updatedAt.value = new Date().toISOString()
} catch (cause) { } catch (cause) {
if (current === generation && !signal.aborted && !disposed) error.value = errorMessage(cause) if (current === generation && target === key.value && !signal.aborted && !disposed)
error.value = errorMessage(cause)
} finally { } finally {
if (current === generation && !disposed) loading.value = false if (current === generation && !disposed) loading.value = false
} }
+79 -26
View File
@@ -1,11 +1,16 @@
import { computed, onScopeDispose, ref, watchEffect } from 'vue' import { computed, onScopeDispose, ref, watchEffect } from 'vue'
import { darkTheme, type GlobalThemeOverrides } from 'naive-ui' import { darkTheme, type GlobalThemeOverrides } from 'naive-ui'
import { resolveThemeAccent, themeAccents, type ThemeAccent } from './themeAccents'
/** 用户主题偏好;system 会跟随系统的实时深浅色变化。 */ /** 用户主题偏好;system 会跟随系统的实时深浅色变化。 */
export type ThemePreference = 'light' | 'dark' | 'system' export type ThemePreference = 'light' | 'dark' | 'system'
const storageKey = 'drama-studio-theme' const storageKey = 'drama-studio-theme'
const accentStorageKey = 'drama-studio-accent'
/** 读取主题时兼容隐私模式或禁用存储的浏览器。 */ /**
* 读取明暗偏好,兼容禁用存储的浏览器。
* @returns 已保存的模式或系统模式
*/
function readPreference(): ThemePreference { function readPreference(): ThemePreference {
try { try {
const value = localStorage.getItem(storageKey) const value = localStorage.getItem(storageKey)
@@ -15,33 +20,60 @@ function readPreference(): ThemePreference {
} }
} }
/** 主题只影响展示,不修改项目配置;卸载时移除系统主题监听。 */ /**
* 读取主色偏好,忽略不存在的预设和不可用的存储。
* @returns 已保存的主色或默认绿色
*/
function readAccent(): ThemeAccent {
try {
const value = localStorage.getItem(accentStorageKey)
if (value && Object.hasOwn(themeAccents, value)) return value as ThemeAccent
} catch {
/* 存储不可用时使用默认主色。 */
}
return 'green'
}
/**
* 同步工作台、Naive UI 和浏览器的主题,卸载时释放系统主题监听。
* @returns 明暗与主色偏好、实际明暗状态和 Naive UI 主题配置
*/
export function useTheme() { export function useTheme() {
/** 用户选择的明暗模式。 */
const preference = ref<ThemePreference>(readPreference()) const preference = ref<ThemePreference>(readPreference())
/** 用户独立选择的主色。 */
const accent = ref<ThemeAccent>(readAccent())
const media = window.matchMedia('(prefers-color-scheme: dark)') const media = window.matchMedia('(prefers-color-scheme: dark)')
/** 浏览器报告的当前系统明暗状态。 */
const systemDark = ref(media.matches) const systemDark = ref(media.matches)
/** 当前生效的明暗状态。 */
const isDark = computed(() => preference.value === 'dark' || (preference.value === 'system' && systemDark.value)) const isDark = computed(() => preference.value === 'dark' || (preference.value === 'system' && systemDark.value))
/** 当前生效的全局主色色阶。 */
const palette = computed(() => resolveThemeAccent(accent.value, isDark.value))
/** 当前生效的 Naive UI 基础主题。 */
const theme = computed(() => (isDark.value ? darkTheme : null)) const theme = computed(() => (isDark.value ? darkTheme : null))
/** 与业务颜色共用同一套主色,并独立设置成功、警告与错误状态色。 */
const overrides = computed<GlobalThemeOverrides>(() => { const overrides = computed<GlobalThemeOverrides>(() => {
const dark = isDark.value const dark = isDark.value
// 微信风格灰阶表面与绿色操作态;文字绿独立加深,避免浅底小字对比不足。 const {
const primary = '#07c160' primary,
const hover = '#2dcb79' hover,
const pressed = '#06ad56' pressed,
// 实心绿按钮使用白字;按钮底色独立于品牌绿,兼顾正常、悬停和按下态的可读性。 text: accentText,
selected,
button: buttonPrimary,
buttonHover,
buttonPressed
} = palette.value
const onPrimary = '#ffffff' const onPrimary = '#ffffff'
const buttonPrimary = '#078640'
const buttonHover = '#087c42'
const buttonPressed = '#066b36'
const disabledColor = dark ? '#303030' : '#e4e4e4' const disabledColor = dark ? '#303030' : '#e4e4e4'
const disabledText = dark ? '#808080' : '#8c8c8c' const disabledText = dark ? '#808080' : '#8c8c8c'
const accentText = dark ? '#5cd693' : '#087c42' const success = dark ? '#5cd693' : '#087c42'
const body = dark ? '#111111' : '#ffffff' const body = dark ? '#111111' : '#ffffff'
const surface = dark ? '#191919' : '#ffffff' const surface = dark ? '#191919' : '#ffffff'
const subtle = dark ? '#232323' : '#f7f7f7' const subtle = dark ? '#232323' : '#f7f7f7'
const text = dark ? '#d9d9d9' : '#191919' const text = dark ? '#d9d9d9' : '#191919'
const muted = dark ? '#a3a3a3' : '#707070' const muted = dark ? '#a3a3a3' : '#707070'
const selected = dark ? '#173527' : '#e4f4e9'
const info = dark ? '#91a8d2' : '#576b95' const info = dark ? '#91a8d2' : '#576b95'
const danger = dark ? '#fa7373' : '#a93232' const danger = dark ? '#fa7373' : '#a93232'
const warning = dark ? '#e8b66a' : '#916019' const warning = dark ? '#e8b66a' : '#916019'
@@ -67,10 +99,10 @@ export function useTheme() {
infoColorHover: info, infoColorHover: info,
infoColorPressed: info, infoColorPressed: info,
infoColorSuppl: info, infoColorSuppl: info,
successColor: accentText, successColor: success,
successColorHover: accentText, successColorHover: success,
successColorPressed: accentText, successColorPressed: success,
successColorSuppl: accentText, successColorSuppl: success,
errorColor: danger, errorColor: danger,
errorColorHover: danger, errorColorHover: danger,
errorColorPressed: danger, errorColorPressed: danger,
@@ -130,10 +162,10 @@ export function useTheme() {
textColorDisabledPrimary: disabledText, textColorDisabledPrimary: disabledText,
textColorTextPrimary: accentText, textColorTextPrimary: accentText,
textColorGhostPrimary: accentText, textColorGhostPrimary: accentText,
colorSuccess: buttonPrimary, colorSuccess: '#078640',
colorHoverSuccess: buttonHover, colorHoverSuccess: '#087c42',
colorPressedSuccess: buttonPressed, colorPressedSuccess: '#066b36',
colorFocusSuccess: buttonHover, colorFocusSuccess: '#087c42',
colorDisabledSuccess: disabledColor, colorDisabledSuccess: disabledColor,
borderSuccess: 'none', borderSuccess: 'none',
borderHoverSuccess: 'none', borderHoverSuccess: 'none',
@@ -145,8 +177,8 @@ export function useTheme() {
textColorPressedSuccess: onPrimary, textColorPressedSuccess: onPrimary,
textColorFocusSuccess: onPrimary, textColorFocusSuccess: onPrimary,
textColorDisabledSuccess: disabledText, textColorDisabledSuccess: disabledText,
textColorTextSuccess: accentText, textColorTextSuccess: success,
textColorGhostSuccess: accentText textColorGhostSuccess: success
}, },
Form: { Form: {
labelFontSizeTopMedium: '12px', labelFontSizeTopMedium: '12px',
@@ -226,11 +258,13 @@ export function useTheme() {
tabTextColorActiveLine: accentText, tabTextColorActiveLine: accentText,
tabTextColorHoverLine: accentText, tabTextColorHoverLine: accentText,
barColor: primary, barColor: primary,
// Tabs 保留横向分隔线,明确导航与内容边界;选中下划线仍使用主绿色。 // Tabs 保留横向分隔线,选中下划线使用当前主色。
tabBorderColor: dark ? '#333333' : '#dadada' tabBorderColor: dark ? '#333333' : '#dadada'
}, },
Tag: { Tag: {
textColorPrimary: accentText, textColorPrimary: accentText,
// 错误标签用文字区分状态,底面保持中性。
colorError: subtle,
border: 'none', border: 'none',
borderPrimary: 'none', borderPrimary: 'none',
borderInfo: 'none', borderInfo: 'none',
@@ -238,12 +272,15 @@ export function useTheme() {
borderWarning: 'none', borderWarning: 'none',
borderError: 'none' borderError: 'none'
}, },
Checkbox: { checkMarkColor: '#ffffff' }, Checkbox: { colorChecked: buttonPrimary, checkMarkColor: '#ffffff' },
Switch: { railColorActive: primary }, Switch: { railColorActive: primary },
Progress: { fillColor: primary } Progress: { fillColor: primary }
} satisfies GlobalThemeOverrides } satisfies GlobalThemeOverrides
}) })
/** 系统切换只更新 system 模式下的实际显示。 */ /**
* 接收系统主题变化。
* @param event 系统主题媒体查询事件
*/
function syncSystem(event: MediaQueryListEvent) { function syncSystem(event: MediaQueryListEvent) {
systemDark.value = event.matches systemDark.value = event.matches
} }
@@ -261,5 +298,21 @@ export function useTheme() {
/* 存储不可用时保留当前会话偏好。 */ /* 存储不可用时保留当前会话偏好。 */
} }
}) })
return { preference, isDark, theme, overrides } watchEffect(() => {
const colors = palette.value
const style = document.documentElement.style
style.setProperty('--app-accent', colors.primary)
style.setProperty('--app-accent-hover', colors.hover)
style.setProperty('--app-accent-text', colors.text)
style.setProperty('--app-selected', colors.selected)
style.setProperty('--app-button-primary', colors.button)
style.setProperty('--app-button-hover', colors.buttonHover)
style.setProperty('--app-button-pressed', colors.buttonPressed)
try {
localStorage.setItem(accentStorageKey, accent.value)
} catch {
/* 存储不可用时保留当前会话偏好。 */
}
})
return { preference, accent, isDark, theme, overrides }
} }
+36
View File
@@ -0,0 +1,36 @@
import { ref, watch } from 'vue'
/** 全局工作台主导航所在的一侧。 */
export type WorkspaceLayout = 'left' | 'right'
const storageKey = 'drama-studio-workspace-layout'
/**
* 读取工作台布局,缺少偏好或无法访问存储时使用左侧导航。
* @returns 已保存的主导航位置
*/
function readLayout(): WorkspaceLayout {
try {
if (localStorage.getItem(storageKey) === 'right') return 'right'
} catch {
/* 存储不可用时使用默认布局。 */
}
return 'left'
}
/**
* 保存工作台布局偏好,存储不可用时仍允许在当前页面切换。
* @returns 当前主导航位置
*/
export function useWorkspaceLayout() {
/** 侧栏和外观工具栏共用的布局偏好。 */
const layout = ref<WorkspaceLayout>(readLayout())
watch(layout, value => {
try {
localStorage.setItem(storageKey, value)
} catch {
/* 存储不可用时保留当前会话的选择。 */
}
})
return layout
}
@@ -0,0 +1,183 @@
<script setup lang="ts">
import { computed } from 'vue'
import { NButton, NInput, NInputNumber, NSelect } from 'naive-ui'
import { Trash2 } from '@lucide/vue'
import WorkspaceActionTooltip from '../../components/ui/WorkspaceActionTooltip.vue'
import { auditArtifactLabels, auditFindingLabels, auditOutcomeLabels } from './labels'
import type { BillingFacts } from './types'
/** 图片和视频费用审计共用的证据字段,不替用户确认原件。 */
defineProps<{ /** 正式提交期间锁定编辑。 */ disabled: boolean }>()
/** 实际登记人。 */
const operator = defineModel<string>('operator', { required: true })
/** 完整待登记事实,原请求身份由各域的正式GET注入。 */
const facts = defineModel<BillingFacts>({ required: true })
/** 引用选项仅来自当前包内材料。 */
const options = computed(() =>
facts.value.artifacts
.filter(item => item.id.trim())
.map(item => ({ label: `${item.id} · ${item.recordId || '未填记录编号'}`, value: item.id }))
)
/**
* 每次字段更新发出完整事实,兼容原有ref表单映射。
* @param change 用户本次修改
*/
function update(change: Partial<BillingFacts>) {
facts.value = { ...facts.value, ...change }
}
/** 仅添加空白材料,不预填供应方事实或摘要。 */
function add() {
update({
artifacts: [...facts.value.artifacts, { id: '', kind: 'client-log', recordId: '', sha256: '', reference: '' }]
})
}
/**
* 移除材料时清理悬空引用,不补造其它材料。
* @param index 待移除材料的位置
*/
function remove(index: number) {
const id = facts.value.artifacts[index]?.id
update({
artifacts: facts.value.artifacts.filter((_, current) => current !== index),
execution: {
...facts.value.execution,
evidenceIds: facts.value.execution.evidenceIds.filter(value => value !== id)
},
billing: { ...facts.value.billing, evidenceIds: facts.value.billing.evidenceIds.filter(value => value !== id) }
})
}
</script>
<template>
<!-- 以下是媒体域共用的原件登记模块,未知事实保持未知。 -->
<div class="workspace-section-stack">
<p class="text-sm text-muted">
请保存原件并填写非敏感定位说明。供应方请求号与本地请求、LangSmith 编号不能互相代用。
</p>
<label class="workspace-form-field"
><span>登记人</span
><NInput v-model:value="operator" :maxlength="120" :disabled="disabled" aria-label="费用证据登记人"
/></label>
<div class="workspace-form-field">
<span>与原请求的关联</span
><NSelect
:value="facts.correlation"
@update:value="update({ correlation: $event })"
:disabled="disabled"
aria-label="与原请求的关联"
:options="[
{ label: '尚未核实', value: 'unverified' },
{ label: '关联有歧义', value: 'ambiguous' },
{ label: '已唯一关联', value: 'unique' }
]"
/>
</div>
<label class="workspace-form-field"
><span>真实供应方请求号(未知留空)</span
><NInput
:value="facts.providerRequestId ?? ''"
@update:value="update({ providerRequestId: $event || null })"
:maxlength="200"
:disabled="disabled"
aria-label="真实供应方请求号"
/></label>
<article
v-for="(item, index) in facts.artifacts"
:key="index"
class="surface-inset p-4 workspace-section-stack min-w-0"
>
<div class="flex items-center justify-between gap-3">
<h4 class="text-sm font-medium">原件 {{ index + 1 }}</h4>
<WorkspaceActionTooltip label="删除原件"
><NButton
class="workspace-action-button icon-button"
:disabled="disabled"
aria-label="删除原件"
@click="remove(index)"
><Trash2 :size="16" /></NButton
></WorkspaceActionTooltip>
</div>
<label class="workspace-form-field"
><span>包内引用键</span
><NInput v-model:value="item.id" :maxlength="120" :disabled="disabled" aria-label="原件包内引用键"
/></label>
<div class="workspace-form-field">
<span>原件来源</span
><NSelect
v-model:value="item.kind"
:options="Object.entries(auditArtifactLabels).map(([value, label]) => ({ value, label }))"
:disabled="disabled"
aria-label="原件来源"
/>
</div>
<label class="workspace-form-field"
><span>原件记录编号</span
><NInput v-model:value="item.recordId" :maxlength="200" :disabled="disabled" aria-label="原件记录编号"
/></label>
<label class="workspace-form-field"
><span>原件 SHA256</span
><NInput v-model:value="item.sha256" :maxlength="64" :disabled="disabled" aria-label="原件 SHA256"
/></label>
<label class="workspace-form-field"
><span>非敏感原件定位说明</span
><NInput
v-model:value="item.reference"
type="textarea"
:maxlength="1000"
:disabled="disabled"
aria-label="原件定位说明"
/></label>
</article>
<NButton class="self-start" :disabled="disabled || facts.artifacts.length >= 20" @click="add">添加原件</NButton>
<div class="workspace-form-field">
<span>供应方执行结果</span
><NSelect
:value="facts.execution.outcome"
@update:value="update({ execution: { ...facts.execution, outcome: $event } })"
:options="Object.entries(auditOutcomeLabels).map(([value, label]) => ({ value, label }))"
:disabled="disabled"
aria-label="供应方执行结果"
/>
</div>
<div class="workspace-form-field">
<span>执行依据原件</span
><NSelect
:value="facts.execution.evidenceIds"
@update:value="update({ execution: { ...facts.execution, evidenceIds: $event } })"
multiple
:options="options"
:disabled="disabled"
aria-label="执行依据原件"
/>
</div>
<div class="workspace-form-field">
<span>原始费用结论</span
><NSelect
:value="facts.billing.finding"
@update:value="update({ billing: { ...facts.billing, finding: $event } })"
:options="Object.entries(auditFindingLabels).map(([value, label]) => ({ value, label }))"
:disabled="disabled"
aria-label="原始费用结论"
/>
</div>
<div class="workspace-form-field">
<span>费用依据原件</span
><NSelect
:value="facts.billing.evidenceIds"
@update:value="update({ billing: { ...facts.billing, evidenceIds: $event } })"
multiple
:options="options"
:disabled="disabled"
aria-label="费用依据原件"
/>
</div>
<label class="workspace-form-field"
><span>实际金额({{ facts.billing.currency }},未知留空)</span
><NInputNumber
:value="facts.billing.amount"
@update:value="update({ billing: { ...facts.billing, amount: $event } })"
:min="0"
clearable
:disabled="disabled"
aria-label="原件实际金额"
/></label>
</div>
</template>
+41
View File
@@ -0,0 +1,41 @@
import type { BillingFacts } from './types'
/**
* 校验共用原件及引用格式,未知声明可登记,不证明原件真实。
* @param evidence 当前完整事实
* @param localIds 不能冒充供应方编号的原本地身份
* @returns 字段校验原因
*/
export function billingEvidenceIssues(
evidence: BillingFacts,
localIds: readonly (string | undefined)[] = []
): string[] {
const issues: string[] = []
const ids = evidence.artifacts.map(item => item.id)
if (!ids.length || ids.length > 20 || new Set(ids).size !== ids.length)
issues.push('请提供 1~20 项原件,引用键不能重复。')
if (
evidence.artifacts.some(
item =>
!item.id.trim() ||
item.id.length > 120 ||
!item.recordId.trim() ||
item.recordId.length > 200 ||
!/^[a-f0-9]{64}$/.test(item.sha256) ||
!item.reference.trim() ||
item.reference.length > 1000
)
)
issues.push('请填写每项原件的引用键、记录编号、64 位小写 SHA256 及定位说明。')
if ([...evidence.execution.evidenceIds, ...evidence.billing.evidenceIds].some(id => !ids.includes(id)))
issues.push('执行或费用引用的原件已不存在,请重新选择。')
if (evidence.billing.amount !== null && (!Number.isFinite(evidence.billing.amount) || evidence.billing.amount < 0))
issues.push('实际金额需为非负数,未知请留空。')
if (
evidence.providerRequestId &&
(localIds.includes(evidence.providerRequestId) ||
evidence.artifacts.some(item => item.kind === 'langsmith' && item.recordId === evidence.providerRequestId))
)
issues.push('本地任务、请求或 LangSmith 编号不能作为供应方请求号。')
return issues
}
+17
View File
@@ -0,0 +1,17 @@
/** 原件来源使用中文选项,提交保留原枚举。 */
export const auditArtifactLabels = {
'provider-execution': '供应方执行原件',
'provider-billing': '供应方账单原件',
'provider-support': '供应方官方支持材料',
langsmith: 'LangSmith 观测记录',
'client-log': '客户端日志'
}
/** 原执行结论不替代质量结论。 */
export const auditOutcomeLabels = {
'not-received': '供应方未接收',
succeeded: '供应方执行完成',
failed: '供应方执行失败',
unknown: '执行结果未知'
}
/** 原收费结论不以零 Token 推断。 */
export const auditFindingLabels = { charged: '已收费', 'no-charge': '未收费', unknown: '费用未知' }
+24
View File
@@ -0,0 +1,24 @@
/** 图片与视频共用的外部原件,声明来源不代表已核实。 */
export interface BillingArtifact {
/** 包内唯一引用键。 */ id: string
/** 原件来源。 */ kind: 'provider-execution' | 'provider-billing' | 'provider-support' | 'langsmith' | 'client-log'
/** 外部原记录编号。 */ recordId: string
/** 用户核对的原件摘要。 */ sha256: string
/** 不含凭据的定位说明。 */ reference: string
}
/** 共享执行与费用事实,不包含图片或视频特有身份。 */
export interface BillingFacts {
/** 关联程度。 */ correlation: 'unique' | 'ambiguous' | 'unverified'
/** 真实供应方编号,未知保持null。 */ providerRequestId: string | null
/** 待核查外部材料。 */ artifacts: BillingArtifact[]
/** 执行事实。 */ execution: {
/** 执行结论。 */ outcome: 'not-received' | 'succeeded' | 'failed' | 'unknown'
/** 包内原件引用。 */ evidenceIds: string[]
}
/** 费用事实,不能改写原账单。 */ billing: {
/** 费用结论。 */ finding: 'charged' | 'no-charge' | 'unknown'
/** 实际金额,未知为null。 */ amount: number | null
/** 原币种。 */ currency: string
/** 包内账单引用。 */ evidenceIds: string[]
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,192 @@
<script setup lang="ts">
import { NScrollbar, NSkeleton } from 'naive-ui'
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
</script>
<template>
<WorkspacePage
split
compact
mobile-scroll
class="breakdown-skeleton"
role="status"
aria-label="正在读取剧本拆解内容"
aria-busy="true"
>
<template #header>
<!-- 以下是拆解状态与设置占位模块,不展示未经读取的统计或完成状态 -->
<div class="breakdown-skeleton-summary" aria-hidden="true">
<NSkeleton class="breakdown-skeleton-heading" :width="80" :height="18" />
<NSkeleton :width="108" :height="12" />
<NSkeleton :width="132" :height="12" />
<NSkeleton :width="86" :height="22" />
<NSkeleton class="breakdown-skeleton-settings" :width="34" :height="34" />
</div>
</template>
<div class="breakdown-skeleton-results" aria-hidden="true">
<!-- 来源说明只预留文字位置,不提前显示候选或正式结果的判断。 -->
<div class="breakdown-skeleton-source"><NSkeleton :width="84" :height="12" /></div>
<!-- 以下是分类标签与操作入口占位模块 -->
<div class="breakdown-skeleton-tabs">
<div class="breakdown-skeleton-tab-labels">
<span v-for="tab in 5" :key="tab" class="breakdown-skeleton-tab"
><NSkeleton
:class="{ 'breakdown-skeleton-task-label': tab === 5 }"
:width="tab === 5 ? 56 : 28"
:height="14"
/></span>
</div>
<div class="breakdown-skeleton-tab-actions">
<NSkeleton class="breakdown-skeleton-icon breakdown-skeleton-mobile-settings" />
<NSkeleton class="breakdown-skeleton-icon" />
</div>
</div>
<NScrollbar class="breakdown-skeleton-scroll">
<!-- 搜索或剧集选择控件与统计相邻排列,不使用整行的大色块。 -->
<div class="breakdown-skeleton-search">
<NSkeleton class="breakdown-skeleton-input" :height="34" />
<NSkeleton class="breakdown-skeleton-count" :width="96" :height="12" />
</div>
<!-- 以下是主体名称、描述、关联入口与形态折叠区占位模块 -->
<div class="breakdown-skeleton-records">
<div v-for="record in 3" :key="record" class="breakdown-skeleton-record">
<div class="breakdown-skeleton-record-heading">
<NSkeleton :width="96" :height="16" />
<NSkeleton :width="56" :height="18" />
</div>
<div class="breakdown-skeleton-description">
<NSkeleton :width="'96%'" :height="14" />
<NSkeleton :width="'72%'" :height="14" />
</div>
<div class="breakdown-skeleton-links">
<NSkeleton :width="112" :height="12" />
<NSkeleton :width="100" :height="12" />
</div>
<NSkeleton :width="124" :height="14" />
</div>
</div>
</NScrollbar>
</div>
</WorkspacePage>
</template>
<style scoped>
/* 拆解占位沿用工作区留白和主题配色,手机与真实页面使用同一断点。 */
@reference "../../styles/styles.css";
.breakdown-skeleton-summary {
@apply flex items-center flex-wrap gap-x-4 gap-y-2 min-h-[34px];
}
.breakdown-skeleton-settings {
@apply ml-auto shrink-0;
}
.breakdown-skeleton-mobile-settings {
/* 手机标签栏右侧保留设置和导出两个独立图标位置。 */
@apply hidden shrink-0;
}
.breakdown-skeleton-results {
@apply flex flex-col flex-1 min-h-0 min-w-0;
gap: var(--app-content-gap);
}
.breakdown-skeleton-source {
display: flex;
align-items: center;
min-height: 16px;
}
.breakdown-skeleton-tabs {
@apply flex items-center shrink-0 min-h-10 min-w-0 bg-(--app-surface);
}
.breakdown-skeleton-tab-labels {
@apply flex items-center min-w-0 overflow-hidden;
}
.breakdown-skeleton-tab {
@apply flex items-center justify-center shrink-0 px-4 min-h-10;
}
.breakdown-skeleton-tab-actions {
@apply flex items-center shrink-0 ml-auto;
}
.breakdown-skeleton-icon {
width: 40px;
height: 40px;
}
:root:not([data-theme='dark']) .breakdown-skeleton-tabs {
@apply bg-(--app-subtle);
}
.breakdown-skeleton-scroll {
@apply flex-1 min-h-0 min-w-0;
}
.breakdown-skeleton-search {
@apply flex items-center gap-3;
margin-bottom: var(--app-content-gap);
}
.breakdown-skeleton-input {
@apply basis-[260px] shrink-0 min-w-0;
}
.breakdown-skeleton-count {
@apply shrink-0;
}
.breakdown-skeleton-record {
@apply p-5 min-w-0 bg-(--app-control);
}
.breakdown-skeleton-record:nth-child(even) {
@apply bg-(--app-subtle);
}
.breakdown-skeleton-record :deep(.n-skeleton) {
/* 占位条与斑马纹底色保持层次,避免浅色卡片内的默认骨架颜色融入背景。 */
--n-color-start: var(--app-border) !important;
--n-color-end: var(--app-field-hover) !important;
}
.breakdown-skeleton-record-heading {
@apply flex flex-wrap items-center gap-3 mb-3;
}
.breakdown-skeleton-description {
@apply flex flex-col gap-3 mb-4;
}
.breakdown-skeleton-links {
@apply flex flex-wrap items-center gap-4 mb-4;
}
@media (max-width: 800px) {
.breakdown-skeleton-heading {
@apply hidden;
}
.breakdown-skeleton-summary {
@apply flex-nowrap overflow-hidden;
}
.breakdown-skeleton-input {
@apply flex-1;
}
.breakdown-skeleton-search {
@apply gap-2;
}
}
@media (max-width: 760px) {
/* 与加载完成后的两列工具图标保持相同间距。 */
.breakdown-skeleton-tab-actions {
gap: 8px;
}
.breakdown-skeleton :deep(.workspace-heading-scroll) {
@apply hidden;
}
.breakdown-skeleton-tab {
@apply px-2;
}
.breakdown-skeleton-task-label {
width: 28px !important;
}
.breakdown-skeleton-mobile-settings {
@apply block;
}
.breakdown-skeleton-icon {
width: var(--app-toolbar-icon-size, 44px);
height: var(--app-toolbar-icon-size, 44px);
}
.breakdown-skeleton-results,
.breakdown-skeleton-scroll {
@apply flex-none overflow-visible;
}
}
@media (prefers-reduced-motion: reduce) {
.breakdown-skeleton :deep(.n-skeleton) {
animation: none;
}
}
</style>
@@ -0,0 +1,91 @@
import type { ActionResource } from '../projects/types'
import { actionResourceOptions } from '../projects/quality-policy'
import type { BreakdownState } from './types'
import type { BreakdownQuality } from './quality'
import type { CandidateShotLocation } from './candidate.types'
/** 从当前镜头真实占用证据带入的例外目标,不将自由文本当作角色或动作编号。 */
export interface ActionExceptionTarget extends CandidateShotLocation {
/** 镜头、阶段、主体与部位组成的稳定标识。 */
key: string
/** 实际冲突发生的阶段。 */
phaseNo: number
/** 当前镜头标题。 */
shotTitle: string
/** 后端镜头已有的主体引用。 */
ownerRef: string
/** 已有主体名称,缺失时直接显示真实编号。 */
ownerName: string
/** 同阶段重复占用的资源。 */
resource: ActionResource
/** 实际冲突动作的可读描述。 */
actions: string[]
}
/**
* 仅在当前审核明确指出资源冲突时,从同版本镜头证据提取角色与冲突动作。
* @param state 当前版本的完整镜头与主体
* @param quality 与当前检查点一致的审核
* @returns 可添加精确例外的真实目标;历史、缺失或无效证据不产生目标
*/
export function actionExceptionTargets(state: BreakdownState, quality: BreakdownQuality): ActionExceptionTarget[] {
if (!['candidate', 'formal'].includes(quality.source) || quality.loading || quality.needsRefresh || quality.error)
return []
const targets = new Map<string, ActionExceptionTarget>()
for (const block of quality.actionBlocks) {
if (![...block.blockingCodes, ...block.warningCodes].includes('action_resource_conflict')) continue
const shot = state.storyboardEpisodeShots
?.find(episode => episode.episodeNo === block.episodeNo)
?.beatShots.find(beat => beat.beatNo === block.beatNo)
?.shots.find(item => item.shotNo === block.shotNo)
if (!shot?.requiredActions?.length || !shot.durationPlanning) continue
for (const [index, phase] of shot.durationPlanning.phases.entries()) {
// 与后端审计一致:只接受本阶段、已存在动作及镜头主体的明确占用证据。
const resources = (phase.resourceOccupancy ?? []).filter(
item =>
shot.subjectRefs.includes(item.ownerRef) &&
phase.actionIds?.includes(item.actionId) &&
shot.requiredActions!.some(action => action.id === item.actionId) &&
actionResourceOptions.some(option => option.value === item.resource)
)
for (const [leftIndex, left] of resources.entries()) {
for (const right of resources.slice(leftIndex + 1)) {
if (
left.ownerRef !== right.ownerRef ||
left.resource !== right.resource ||
left.actionId === right.actionId
)
continue
if (
left.shareable &&
right.shareable &&
!['support', 'move'].includes(left.usage) &&
!['support', 'move'].includes(right.usage)
)
continue
const key = `${block.episodeNo}/${block.beatNo}/${block.shotNo}/${index + 1}/${left.ownerRef}/${left.resource}`
const target = targets.get(key) ?? {
key,
episodeNo: block.episodeNo,
beatNo: block.beatNo,
shotNo: block.shotNo,
phaseNo: index + 1,
shotTitle: shot.title,
ownerRef: left.ownerRef,
resource: left.resource,
ownerName:
state.subjectCandidates?.find(subject => subject.ref === left.ownerRef)?.name ||
left.ownerRef,
actions: []
}
for (const actionId of [left.actionId, right.actionId]) {
const description = shot.requiredActions.find(action => action.id === actionId)!.description
if (!target.actions.includes(description)) target.actions.push(description)
}
targets.set(key, target)
}
}
}
}
return [...targets.values()]
}
+210 -2
View File
@@ -1,13 +1,221 @@
import type { DiagnosisPreflight, DiagnosisHistory, DiagnosisRepairReadiness } from './diagnosis.types'
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,
BreakdownCandidateCommit,
StoryboardHandOccupancyDiagnostics,
StoryboardHandRepairPreview,
StoryboardHandRepairHistory,
LegacyActionDiagnosisPreview,
LegacyActionDiagnosisBatchStart,
LegacyActionDiagnosisResults
} from './types'
import type { WorkflowExecutionStart } from '../workflows/execution.types' import type { WorkflowExecutionStart } from '../workflows/execution.types'
import type {
CandidateRevalidation,
CandidateCommitPreview,
CandidateSubjectRepairInput,
CandidateSubjectRepairResult,
CandidateActionRepairInput,
CandidateActionRepairResult,
CandidateRelationRepairInput,
CandidateRelationRepairResult
} from './candidate.types'
import type {
QualityRepairPlan,
QualityRepairCandidates,
QualityRepairInput,
QualityRepairResult
} from './repair.types'
/** Breakdown API;预览为 GET,启动和恢复为等待完成的长 POST。 */ /** Breakdown API;预览为只读查询,启动和恢复返回可持续观察的后台任务。 */
export const breakdownApi = { export const breakdownApi = {
/**
* 只读核对指定正式镜头的诊断来源及可复用记录。
* @param id 项目编号
* @param shotId 正式镜头编号
* @param signal 取消信号
* @returns 不调用模型的检查结果
*/
diagnosisPreflight: (id: string, shotId: string, signal?: AbortSignal) =>
request<DiagnosisPreflight>(
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-legacy-action-diagnosis-preflight/${encodeURIComponent(shotId)}`,
{ signal }
),
/**
* 查看指定镜头的诊断历史及版本失效情况。
* @param id 项目编号
* @param shotId 正式镜头编号
* @param signal 取消信号
* @returns 最近诊断历史
*/
diagnosisHistory: (id: string, shotId: string, signal?: AbortSignal) =>
request<DiagnosisHistory>(
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-legacy-action-diagnoses/${encodeURIComponent(shotId)}`,
{ signal }
),
/**
* 核对指定诊断能否进入人工修订,不自动应用建议。
* @param id 项目编号
* @param shotId 正式镜头编号
* @param diagnosisId 真实诊断编号
* @param signal 取消信号
* @returns 候选及资产、来源和版本限制
*/
diagnosisRepairReadiness: (id: string, shotId: string, diagnosisId: string, signal?: AbortSignal) =>
request<DiagnosisRepairReadiness>(
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-legacy-action-repair-readiness/${encodeURIComponent(shotId)}/${encodeURIComponent(diagnosisId)}`,
{ signal }
),
/**
* 只读重新审核当前候选,不提供正式提交许可。
* @param id 当前项目
* @param signal 取消信号
* @returns 版本化质量审核
*/
revalidateCandidate: (id: string, signal?: AbortSignal) =>
request<CandidateRevalidation>(`/projects/${encodeURIComponent(id)}/breakdown/candidate-revalidation`, {
signal
}),
/**
* 只读检查剧本与下游资产的正式提交安全条件。
* @param id 当前项目
* @param signal 取消信号
* @returns 版本化安全检查
*/
candidateCommitPreview: (id: string, signal?: AbortSignal) =>
request<CandidateCommitPreview>(`/projects/${encodeURIComponent(id)}/breakdown/candidate-commit-preview`, {
signal
}),
/**
* 用户明确确认后移除预检中的单条无来源关系,只创建候选新版本。
* @param id 当前项目
* @param input 用户选定的原始关系、确认与保存记录
* @returns 新候选版本和实际移除数量
*/
repairCandidateRelation: (id: string, input: CandidateRelationRepairInput) =>
request<CandidateRelationRepairResult>(
`/projects/${encodeURIComponent(id)}/breakdown/candidate-relation-repair`,
{
method: 'POST',
body: input
}
),
/**
* 用户确认后补齐候选主体引用与真实形态。
* @param id 当前项目
* @param input 修复目标与候选版本
* @returns 新候选检查点
*/
repairCandidateSubject: (id: string, input: CandidateSubjectRepairInput) =>
request<CandidateSubjectRepairResult>(
`/projects/${encodeURIComponent(id)}/breakdown/candidate-subject-repair`,
{ method: 'POST', body: input }
),
/**
* 用户确认后批量修订候选动作描述,不触发模型。
* @param id 当前项目
* @param input 原始动作目标、人工描述与候选版本
* @returns 新候选检查点及剩余待审剧集
*/
repairCandidateActions: (id: string, input: CandidateActionRepairInput) =>
request<CandidateActionRepairResult>(
`/projects/${encodeURIComponent(id)}/breakdown/candidate-action-batch-repair`,
{ method: 'POST', body: input }
),
/**
* 读取当前仍被质量审核阻断的镜头。
* @param id 当前项目编号
* @param signal 请求取消信号
* @returns 版本化的修复清单
*/
qualityRepairPlan: (id: string, signal?: AbortSignal) =>
request<QualityRepairPlan>(`/projects/${encodeURIComponent(id)}/breakdown/storyboard-quality-repair-plan`, {
signal
}),
/**
* 读取后端确认仍有效的局部修订候选。
* @param id 当前项目编号
* @param signal 请求取消信号
* @returns 含镜头指纹的候选建议
*/
qualityRepairCandidates: (id: string, signal?: AbortSignal) =>
request<QualityRepairCandidates>(
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-quality-repair-candidates`,
{ signal }
),
/**
* 人工修订单镜头动作规划,不触发模型或替换正式资产。
* @param id 当前项目编号
* @param input 完整动作字段与版本约束
* @returns 修订后的检查点和恢复资格
*/
repairQualityShot: (id: string, input: QualityRepairInput) =>
request<QualityRepairResult>(`/projects/${encodeURIComponent(id)}/breakdown/storyboard-quality-repair`, {
method: 'POST',
body: input
}),
/**
* 明确确认后提交服务端最新候选,不上传或拼装正式资产。
* @param id 当前项目编号
* @returns 后端事务保存后的正式资产统计
*/
commitCandidate: (id: string) =>
request<BreakdownCandidateCommit>(`/projects/${encodeURIComponent(id)}/breakdown/commit-candidate`, {
method: 'POST',
body: { confirmed: true }
}),
preview: (id: string, input: BreakdownInput, signal?: AbortSignal) => { preview: (id: string, input: BreakdownInput, signal?: AbortSignal) => {
const query = new URLSearchParams({ groupSize: String(input.groupSize), modules: input.modules.join(',') }) const query = new URLSearchParams({ groupSize: String(input.groupSize), modules: input.modules.join(',') })
return request<BreakdownPreview>(`/projects/${encodeURIComponent(id)}/breakdown-preview?${query}`, { signal }) return request<BreakdownPreview>(`/projects/${encodeURIComponent(id)}/breakdown-preview?${query}`, { signal })
}, },
handOccupancyDiagnostics: (id: string, signal?: AbortSignal) =>
request<StoryboardHandOccupancyDiagnostics>(
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-action-resource-diagnostics`,
{ signal }
),
handRepairPreview: (id: string, signal?: AbortSignal) =>
request<StoryboardHandRepairPreview>(
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-action-resource-repair-preview`,
{ signal }
),
handRepairHistory: (id: string, shotId: string, signal?: AbortSignal) =>
request<StoryboardHandRepairHistory>(
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-shot-revision-history/${encodeURIComponent(shotId)}`,
{ signal }
),
legacyActionDiagnosisPreview: (id: string, episodeNo: number, beatNo?: number, shotNo?: number) => {
const query = new URLSearchParams({ episodeNo: String(episodeNo) })
if (beatNo !== undefined) query.set('beatNo', String(beatNo))
if (shotNo !== undefined) query.set('shotNo', String(shotNo))
return request<LegacyActionDiagnosisPreview>(
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-legacy-action-diagnosis-preview?${query}`
)
},
startLegacyActionDiagnosis: (
id: string,
input: {
episodeNo?: number
beatNo?: number
shotNo?: number
concurrency: number
confirmed: true
}
) =>
request<LegacyActionDiagnosisBatchStart>(
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-legacy-action-diagnose-batch`,
{ method: 'POST', body: input }
),
legacyActionDiagnosisResults: (id: string, episodeNo?: number) => {
const query = episodeNo === undefined ? '' : `?episodeNo=${episodeNo}`
return request<LegacyActionDiagnosisResults>(
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-legacy-action-diagnosis-results${query}`
)
},
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) =>
+85
View File
@@ -0,0 +1,85 @@
import type { BreakdownState } from './types'
import type { CandidateCommitPreview, CandidateCommitCheckPreview } from './candidate.types'
/** 安全检查项与用户可理解的阻断原因共用一份映射。 */
export const candidateCheckLabels: Record<keyof CandidateCommitCheckPreview['checks'], string> = {
durationBudgetCurrent: '候选预算与当前正式时长一致',
qualityPolicyMatches: '质量规则与当前已确认版本一致',
episodeNumbersMatch: '剧集范围与候选一致',
episodeFingerprintsMatch: '剧本正文版本未变化',
noActiveExecutions: '没有正在执行的制作任务',
noActiveVideos: '没有正在生成的视频',
noSubjectIdentities: '没有需要保护的主体身份',
noSubjectImages: '没有需要保护的主体图片',
noProtectedShots: '没有需要保护的镜头资产',
relationEvidenceValid: '场景、道具关系的来源证据有效'
}
/** 必须逐项校验的固定安全门禁,不根据响应动态减少检查项。 */
export const candidateCheckKeys = [
'qualityPolicyMatches',
'durationBudgetCurrent',
'episodeNumbersMatch',
'episodeFingerprintsMatch',
'noActiveExecutions',
'noActiveVideos',
'noSubjectIdentities',
'noSubjectImages',
'noProtectedShots',
'relationEvidenceValid'
] as const
/**
* 安全预检查必须逐项通过且属于当前项目和候选,不能只相信 ready。
* @param preview 安全预检查回执
* @param projectId 当前项目
* @param checkpointId 当前候选版本
* @returns 是否可进入最终确认
*/
export function candidatePreviewReady(
preview: CandidateCommitPreview | null,
projectId: string,
checkpointId?: string
): boolean {
if (
!preview ||
preview.status === 'already_committed' ||
preview.projectId !== projectId ||
preview.checkpointId !== checkpointId ||
!!preview.durationSourceIssue
)
return false
// 外部 JSON 的布尔值必须严格为 true,不接受缺失值或字符串等真值。
const flags: unknown[] = [preview.readOnly, preview.ready, ...candidateCheckKeys.map(key => preview.checks?.[key])]
return flags.every(value => value === true)
}
/**
* 仅用最新原始快照提示提交条件,实际替换权限仍由后端事务判断。
* @param state 最新原始拆解快照,禁止传入历史回退拼接结果
* @returns 完整性阻断原因,空字符串只表示可继续安全预检查,不是提交许可
*/
export function candidateCommitIssue(state: BreakdownState | null | undefined): string {
if (state?.candidateOnly !== true) return '当前最新结果不是候选模式。'
if (state.storyboardPersisted === true || state.candidateCommitted === true) return '这份候选已经提交。'
if (state.workflowExecution?.status === 'running') return '候选拆解仍在执行。'
if (state.storyboardShotValidation?.valid !== true) return '候选分镜尚未通过校验。'
if (state.storyboardPendingQualityEpisodeNos?.length) return '仍有剧集未通过质量审核,请先修订。'
if (!state.expectedEpisodeFingerprints || !state.runConfig?.sourceEpisodes?.length)
return '候选缺少剧本版本信息,请重新生成候选。'
const episodes = state.storyboardEpisodeShots ?? []
const source = state.runConfig.sourceEpisodes
if (
!state.subjectCandidates?.length ||
!Array.isArray(state.subjectForms) ||
episodes.length !== source.length ||
source.some(
item =>
!state.expectedEpisodeFingerprints?.[item.episodeNo] ||
!episodes.some(
episode => episode.episodeNo === item.episodeNo && episode.beatShots.some(beat => beat.shots.length)
)
)
)
return '候选主体或分镜不完整,请先完成拆解。'
return ''
}
+253
View File
@@ -0,0 +1,253 @@
import type { ShotValidation, StoryboardShot, SubjectCandidate, SubjectForm } from './types'
/** 候选整体完整性审核,不代表正式提交许可。 */
export interface CandidateValidation {
/** 是否通过当前确定性校验。 */
valid: boolean
/** 完整性与绑定问题。 */
issues: string[]
}
/** 候选镜头坐标。 */
export interface CandidateShotLocation {
/** 剧集编号。 */
episodeNo: number
/** 节拍编号。 */
beatNo: number
/** 镜头编号。 */
shotNo: number
}
/** 当前动作质量决策,与后端原始状态一致。 */
export interface CandidateActionBlock extends CandidateShotLocation {
/** 审核结果。 */
status: 'passed' | 'needs_review' | 'blocked'
/** 阻断代码。 */
blockingCodes: string[]
/** 警告代码。 */
warningCodes: string[]
/** 对应剧集是否仍待处理。 */
isPendingEpisode: boolean
}
/** 缺失引用的原始诊断及可选真实形态。 */
export interface CandidateMissingSubject {
/** 剧集编号。 */
episodeNo: number
/** 未提供精确位置时不可写入修复。 */
beatNo?: number | null
/** 未提供精确位置时不可写入修复。 */
shotNo?: number | null
/** 后端原始问题。 */
message: string
/** 目标镜头原始引用。 */
shot: Pick<StoryboardShot, 'title' | 'description' | 'visualFocus' | 'subjectRefs' | 'subjectBindings'> | null
/** 节拍允许的主体。 */
beatSubjectRefs: string[]
/** 解析到的候选主体。 */
subject: SubjectCandidate | null
/** 该主体已有形态。 */
availableForms: SubjectForm[]
}
/** 道具引用诊断,全部标志正常时不展示为问题。 */
export interface CandidatePropDiagnostic extends CandidateShotLocation {
/** 道具引用。 */
subjectRef: string
/** 镜头标题。 */
shotTitle: string
/** 镜头正文。 */
shotDescription: string
/** 节拍是否包含道具。 */
beatAllowsSubject: boolean
/** 镜头是否包含道具。 */
shotHasSubject: boolean
/** 镜头是否已有绑定。 */
shotHasBinding: boolean
/** 道具名称。 */
subjectName: string
/** 该道具的真实形态。 */
availableForms: SubjectForm[]
}
/** 当前候选只读重新审核响应,不修改数据库或调用模型。 */
export interface CandidateRevalidation {
/** 当前检查点。 */
checkpointId: string
/** 所属项目。 */
projectId: string
/** 候选剧集数。 */
episodeCount: number
/** 候选镜头数,尚不代表正式资产。 */
shotCount: number
/** 历史问题,仅用于明确标记的历史记录。 */
previousIssues: ShotValidation['issues']
/** 当前结构问题。 */
currentIssues: ShotValidation['issues']
/** 当前缺失引用。 */
missingSubjectRefs: CandidateMissingSubject[]
/** 当前待审核剧集。 */
pendingQualityEpisodeNos: number[]
/** 当前动作阻断或资源冲突。 */
actionQualityBlocks: CandidateActionBlock[]
/** 阻断镜头的原始动作规划。 */
actionRepairTargets: Array<
CandidateActionBlock & {
/** 缺少原始镜头时禁止修复。 */
shot:
| (Pick<StoryboardShot, 'title' | 'description' | 'visualFocus' | 'durationSeconds' | 'subjectRefs'> & {
/** 原始动作,不提供 kind 编辑入口。 */
requiredActions: NonNullable<StoryboardShot['requiredActions']>
/** 原始阶段规划。 */
durationPlanning: StoryboardShot['durationPlanning'] | null
})
| null
}
>
/** 道具引用检查。 */
propReferenceDiagnostics: CandidatePropDiagnostic[]
/** 没有对应动作阻断的残留待审剧集,仍需明确处理。 */
pendingWithoutActionBlocks: number[]
/** 当前候选完整性审核。 */
candidateValidation: CandidateValidation
/** 此接口始终不提供提交许可。 */
canCommit: false
}
/** 预检返回的单条无来源关系,所有定位字段均须原样提交。 */
export interface CandidateRelationTarget {
/** 候选主体引用。 */ subjectRef: string
/** 候选主体名称。 */ subjectName: string
/** 原始关系。 */ relation: string
/** 原始关系目标。 */ target: string
/** 原始来源证据。 */ evidence: string
}
/** 人工明确移除单条关系的版本化请求,不允许删除主体或改写证据。 */
export interface CandidateRelationRepairInput extends Omit<CandidateRelationTarget, 'subjectName'> {
/** 必须由用户明确确认。 */ confirmed: true
/** 本次预检对应的保存记录。 */ expectedCheckpointId: string
}
/** 关系修复只保存新的候选版本,不代表候选已正式采用。 */
export interface CandidateRelationRepairResult {
/** 新保存记录。 */ checkpointId: string
/** 已处理的主体引用。 */ subjectRef: string
/** 本次仅移除一条。 */ removed: 1
}
/** 未提交候选的安全预检查响应,正式提交仍会在事务内复查。 */
export interface CandidateCommitCheckPreview {
/** 所属项目。 */
projectId: string
/** 被检查的候选版本。 */
checkpointId: string
/** 所有检查是否通过。 */
ready: boolean
/** 未提交分支不携带已提交状态。 */ status?: never
/** 关系来源阻断的原始说明。 */ relationIssues: string[]
/** 可供人工核对的原始关系,不代表已经确认删除。 */ relationRepairTargets: CandidateRelationTarget[]
/** 当前正式预算来源冲突说明。 */
durationSourceIssue?: string | null
/** 剧本版本、活动任务及下游资产保护。 */
checks: {
/** 候选与正式预算版本一致。 */
durationBudgetCurrent: boolean
/** 候选使用的质量规则与当前明确确认版本一致。 */
qualityPolicyMatches: boolean
/** 剧集编号一致。 */
episodeNumbersMatch: boolean
/** 剧本正文指纹一致。 */
episodeFingerprintsMatch: boolean
/** 没有活动制作任务。 */
noActiveExecutions: boolean
/** 没有活动视频任务。 */
noActiveVideos: boolean
/** 没有主体身份资产。 */
noSubjectIdentities: boolean
/** 没有主体图片资产。 */
noSubjectImages: boolean
/** 没有受保护镜头资产。 */
noProtectedShots: boolean
/** 场景、道具关系的证据可在正式剧本中找到。 */
relationEvidenceValid: boolean
}
/** 真实数据数量。 */
counts: {
/** 正式剧集。 */
episodes: number
/** 已有分镜剧集。 */
existingStoryboards: number
/** 活动工作流。 */
activeExecutions: number
/** 活动视频。 */
activeVideos: number
/** 主体身份。 */
subjectIdentities: number
/** 主体图片。 */
subjectImages: number
/** 受保护镜头。 */
protectedShots: number
}
/** 此操作只读。 */
readOnly: true
}
/** 已采用的候选没有 checks 和 counts,不能按预检失败处理。 */
export interface CandidateAlreadyCommitted {
/** 所属项目。 */ projectId: string
/** 最新保存记录。 */ checkpointId: string
/** 已提交结果不再提供提交许可。 */ ready: false
/** 后端明确的已提交状态。 */ status: 'already_committed'
/** 原始说明只用于展示转换。 */ reason: string
/** 此操作只读。 */ readOnly: true
}
/** 安全预检按后端真实响应区分未提交和已提交结果。 */
export type CandidateCommitPreview = CandidateCommitCheckPreview | CandidateAlreadyCommitted
/** 人工确认的候选主体补齐请求。 */
export interface CandidateSubjectRepairInput extends CandidateShotLocation {
/** 乐观版本锁。 */
expectedCheckpointId: string
/** 真实候选主体引用。 */
subjectRef: string
/** 属于该主体的已有形态。 */
formId: string
}
/** 只创建候选新版本的主体修复回执。 */
export interface CandidateSubjectRepairResult {
/** 新检查点。 */
checkpointId: string
/** 修复后的结构校验。 */
storyboardShotValidation: ShotValidation
/** 修复后的候选完整性。 */
candidateValidation: CandidateValidation
}
/** 单个动作语义修订,只允许编辑描述。 */
export interface CandidateActionRepair extends CandidateShotLocation {
/** 原始动作编号。 */
actionId: string
/** 用户明确确认的过程描述。 */
description: string
}
/** 批量候选动作修复请求。 */
export interface CandidateActionRepairInput {
/** 乐观版本锁。 */
expectedCheckpointId: string
/** 用户选择的多个动作。 */
repairs: CandidateActionRepair[]
}
/** 批量修复回执,不代表正式资产已写入。 */
export interface CandidateActionRepairResult {
/** 新检查点。 */
checkpointId: string
/** 实际修复镜头数。 */
repairedShotCount: number
/** 仍待审核的剧集。 */
pendingQualityEpisodeNos: number[]
}
@@ -0,0 +1,317 @@
<script setup lang="ts">
import { computed, onScopeDispose, ref, watch } from 'vue'
import { NButton, NFormItem, NInput } from 'naive-ui'
import { Plus } from '@lucide/vue'
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
import QualityPolicyExceptions from '../../generation-config/components/QualityPolicyExceptions.vue'
import { projectsApi } from '../../projects/api'
import { actionResourceOptions, policyDraft } from '../../projects/quality-policy'
import { validateQualityPolicyReceipt, qualityPolicySignature } from '../../projects/quality-policy-confirmation'
import type { ProjectQualityPolicyResult } from '../../projects/types'
import { getOperation, runOperation } from '../../workflows/operations'
import { actionExceptionTargets, type ActionExceptionTarget } from '../action-exceptions'
import type { BreakdownState } from '../types'
import type { BreakdownQuality } from '../quality'
import { errorMessage } from '../../../lib/http'
/** 例外仅从当前版本的具体动作问题添加,不修改镜头、不调用模型。 */
const props = defineProps<{
/** 当前正式项目。 */
projectId: string
/** 当前最新检查点,切换后撤销旧问题草稿。 */
checkpointId: string
/** 同一检查点中的完整主体与镜头。 */
state: BreakdownState
/** 当前审核,不能使用历史通过或历史问题。 */
quality: BreakdownQuality
/** 项目活动任务、读错或未确认状态下禁止写入。 */
disabled: boolean
}>()
/** 真实写入期间锁定父抽屉,保存后重新读取服务端审核。 */
const emit = defineEmits<{ busy: [value: boolean]; refresh: [] }>()
/** 当前后端保存的规则,失败时不使用默认值。 */
const receipt = ref<ProjectQualityPolicyResult | null>(null)
/** 只读加载允许关闭,不把查询当作不可取消提交。 */
const loading = ref(false)
/** 最终保存前的规则合并查询,阻止重复点击。 */
const checking = ref(false)
/** 真正写入规则的状态。 */
const writing = ref(false)
/** 用户当前选中的完整问题目标。 */
const selected = ref<ActionExceptionTarget | null>(null)
/** 用户明确填写的允许原因,不自动代填确认依据。 */
const reason = ref('')
/** 仅在用户点击保存时展示的字段校验。 */
const issue = ref('')
/** 实际接口错误,失败后保留草稿。 */
const error = ref('')
/** 保存成功仅说明规则已保存,不暗示质量已经通过。 */
const notice = ref('')
/** 项目级写操作锁。 */
const operation = computed(() => getOperation(props.projectId))
/** 当前审核与原始数据必须属于同一项目和最新检查点。 */
const current = computed(
() =>
!!props.checkpointId &&
props.quality.checkpointId === props.checkpointId &&
(!props.state.projectId || props.state.projectId === props.projectId) &&
['candidate', 'formal'].includes(props.quality.source)
)
/** 只从真实审核和阶段证据生成目标。 */
const targets = computed(() => (current.value ? actionExceptionTargets(props.state, props.quality) : []))
/** 已有例外原样展示,保存新项不会删除或替换它们。 */
const exceptions = computed(() => receipt.value?.policy.actionExceptions ?? [])
/** 用户可以提交的时机,所有外部活动锁都需要满足。 */
const writable = computed(
() =>
current.value &&
!!receipt.value &&
!props.disabled &&
!operation.value.pending &&
!loading.value &&
!checking.value &&
!writing.value
)
/** 失效代次与可取消的只读请求。 */
let generation = 0
/** 当前规则查询的取消控制器。 */
let controller: AbortController | undefined
/**
* 使用真实项目规则,验证项目及完整性后创建独立副本。
* @param id 目标项目
* @param signal 只读请求的取消信号
* @returns 已验证的完整规则
*/
async function read(id: string, signal: AbortSignal): Promise<ProjectQualityPolicyResult> {
const result = await projectsApi.qualityPolicy(id, signal)
validateQualityPolicyReceipt(result, id)
return { ...result, policy: policyDraft(result.policy) }
}
/** 按需读取已有规则;无真实拆解结果时不创建例外。 */
async function load() {
if (loading.value || !current.value) return
const version = ++generation
const id = props.projectId
controller?.abort()
controller = new AbortController()
loading.value = true
error.value = ''
try {
const result = await read(id, controller.signal)
if (version === generation) receipt.value = result
} catch (cause) {
if (version === generation) error.value = errorMessage(cause)
} finally {
if (version === generation) loading.value = false
}
}
/**
* 同一角色及部位已有例外时禁止重复添加,适用范围遵循后端项目级契约。
* @param target 真实动作冲突目标
* @returns 是否已经保存对应例外
*/
function exists(target: ActionExceptionTarget): boolean {
return exceptions.value.some(
item =>
item.code === 'action_resource_conflict' &&
item.ownerRef === target.ownerRef &&
item.resource === target.resource
)
}
/**
* 带入只读角色、部位及动作,用户只填写允许原因。
* @param target 被用户选中的真实问题
*/
function select(target: ActionExceptionTarget) {
if (!writable.value || exists(target)) return
selected.value = target
reason.value = ''
issue.value = ''
error.value = ''
notice.value = ''
}
/** 取消当前例外草稿,同时撤销尚未完成的只读请求。 */
function cancel() {
if (writing.value) return
generation++
controller?.abort()
checking.value = false
selected.value = null
reason.value = ''
issue.value = ''
}
/** 最终提交前重读并追加到最新完整规则,绝不覆盖已有例外或伪造审核通过。 */
async function save() {
if (!writable.value || !selected.value) return
issue.value = reason.value.trim() ? '' : '请填写允许原因,说明剧本为什么允许这样做。'
if (issue.value) return
const target = selected.value
const targetSignature = JSON.stringify(target)
const id = props.projectId
const version = ++generation
controller?.abort()
controller = new AbortController()
checking.value = true
error.value = ''
try {
const latest = await read(id, controller.signal)
if (
version !== generation ||
props.disabled ||
operation.value.pending ||
!current.value ||
!targets.value.some(item => JSON.stringify(item) === targetSignature)
)
return
receipt.value = latest
if (exists(target)) {
notice.value = '这个角色的对应部位已有例外,已保留现有设置。'
selected.value = null
return
}
if (exceptions.value.length >= 30) throw new Error('动作例外最多 30 项,当前不能继续添加。')
const input = policyDraft(latest.policy)
input.actionExceptions = [
...(input.actionExceptions ?? []),
{
code: 'action_resource_conflict',
ownerRef: target.ownerRef,
resource: target.resource,
reason: reason.value.trim()
}
]
const signature = qualityPolicySignature(input)
writing.value = true
const success = await runOperation(
id,
'正在保存动作例外',
async () => {
const result = await projectsApi.saveQualityPolicy(id, input, latest.revision)
validateQualityPolicyReceipt(result, id)
if (result.projectId !== id || qualityPolicySignature(result.policy) !== signature)
throw new Error('规则保存回执与提交内容不一致,请重新读取确认。')
if (version === generation) receipt.value = { ...result, policy: policyDraft(result.policy) }
},
{ type: 'info', content: '动作例外已保存,当前分镜仍需审核,不会自动放行提交。' }
)
if (version !== generation) return
if (success) {
selected.value = null
reason.value = ''
notice.value = '动作例外已保存。当前分镜仍需审核,不会自动标记通过或修改正式结果。'
emit('refresh')
} else error.value = operation.value.error
} catch (cause) {
if (version === generation) error.value = errorMessage(cause)
} finally {
if (version === generation) {
checking.value = false
writing.value = false
}
}
}
/** 修改原因时清除旧校验,打开空白草稿不提前报错。 */
watch(reason, () => {
issue.value = ''
})
/** 当前问题的动作证据变化后撤销旧草稿,不能把旧动作的确认套到新动作。 */
watch(
targets,
items => {
if (selected.value && !items.some(item => JSON.stringify(item) === JSON.stringify(selected.value))) cancel()
},
{ flush: 'sync' }
)
/** 切换版本后清空旧草稿和读取,迟到响应不得回填或提交。 */
watch(
() => [props.projectId, props.checkpointId],
() => {
generation++
controller?.abort()
receipt.value = null
selected.value = null
reason.value = ''
issue.value = ''
notice.value = ''
error.value = ''
loading.value = false
checking.value = false
writing.value = false
void load()
},
{ immediate: true, flush: 'sync' }
)
/** 父抽屉只在真实写入期间锁定,普通读取仍可关闭。 */
watch(writing, value => emit('busy', value), { flush: 'sync' })
onScopeDispose(() => {
generation++
controller?.abort()
emit('busy', false)
})
</script>
<template>
<!-- 以下是拆解后从具体冲突添加动作例外的模块,角色和动作均不可自由输入 -->
<section class="workspace-panel space-y-4" aria-label="动作例外修订">
<WorkspaceSectionHeading title="动作例外" description="仅为剧本明确允许的动作填写例外原因。" />
<p v-if="loading" role="status" class="text-xs text-muted">正在读取已有动作例外…</p>
<div v-if="error" role="alert" class="space-y-2 text-sm text-danger">
<p>{{ error }}</p>
<NButton v-if="!receipt" :disabled="loading" @click="load">重新读取规则</NButton>
</div>
<QualityPolicyExceptions :exceptions="exceptions" />
<p v-if="!targets.length && !loading" class="text-xs leading-6 text-muted">
缺少可确认的动作冲突,请先人工修订。
</p>
<article v-for="target in targets" :key="target.key" class="space-y-3" :data-exception-target="target.key">
<div class="flex flex-wrap items-center justify-between gap-3">
<p class="text-sm">
第 {{ target.episodeNo }} 集 · 节拍 {{ target.beatNo }} · 镜头 {{ target.shotNo }} · 阶段
{{ target.phaseNo }}
</p>
<NButton
v-if="selected?.key !== target.key"
:disabled="!writable || exists(target)"
@click="select(target)"
><template #icon><Plus :size="15" aria-hidden="true" /></template
>{{ exists(target) ? '已有例外' : '添加例外' }}</NButton
>
</div>
<p class="text-sm">
{{ target.ownerName }}({{ target.ownerRef }}) ·
{{ actionResourceOptions.find(option => option.value === target.resource)?.label }}
</p>
<ul class="space-y-1 pl-5 text-xs leading-6 text-muted list-disc">
<li v-for="action in target.actions" :key="action">{{ action }}</li>
</ul>
<!-- 以下是只填写原因的例外草稿,后端实际范围是同一角色的对应部位 -->
<div v-if="selected?.key === target.key" class="space-y-3">
<p class="text-xs leading-6 text-muted">例外也适用于本项目中同一角色或物品的同类冲突。</p>
<NFormItem label="允许原因"
><NInput
v-model:value="reason"
type="textarea"
aria-label="动作例外允许原因"
placeholder="填写剧本中明确允许这样做的设定"
:autosize="{ minRows: 2, maxRows: 6 }"
:disabled="disabled || checking || writing"
/></NFormItem>
<p v-if="issue" role="alert" class="text-xs text-danger">{{ issue }}</p>
<div class="flex flex-wrap justify-end gap-2">
<NButton :disabled="writing" @click="cancel">取消</NButton
><NButton type="primary" :disabled="!writable" :loading="checking || writing" @click="save"
><template #icon><Plus :size="15" aria-hidden="true" /></template>保存动作例外</NButton
>
</div>
</div>
</article>
<p v-if="notice" role="status" class="text-xs leading-6 text-muted">{{ notice }}</p>
</section>
</template>
@@ -0,0 +1,526 @@
<script setup lang="ts">
import { computed, onScopeDispose, ref, watch } from 'vue'
import { NButton, NCheckbox, NCollapse, NCollapseItem, NRadio, NSelect, NTag } from 'naive-ui'
import { Trash2 } from '@lucide/vue'
import { AppDrawer, WorkspaceRefreshButton, WorkspaceSectionHeading } from '../../../components/ui'
import type { BreakdownState } from '../types'
import type { BreakdownQuality } from '../quality'
import type { CandidateCommitPreview, CandidateRelationTarget } from '../candidate.types'
import type { Episode } from '../../projects/types'
import { candidateCheckKeys, candidateCheckLabels, candidatePreviewReady } from '../candidate'
import { breakdownApi } from '../api'
import { runOperation, getOperation } from '../../workflows/operations'
import { projectsApi } from '../../projects/api'
import { workflowCheckpoints } from '../../workflows/selectors'
import { userFacingText } from '../../../lib/user-facing-text'
import { ApiError, errorMessage } from '../../../lib/http'
import { showActionFeedback, useActionMessage } from '../../../components/ui/useActionMessage'
/** 安全预检与单条关系人工处理复用独立全屏抽屉,不承载拆解启动配置。 */
const props = withDefaults(
defineProps<{
/** 当前项目。 */ projectId: string
/** 最新原始候选。 */ state?: BreakdownState
/** 最新保存记录。 */ checkpointId?: string
/** 集中的候选质量结论。 */ quality: BreakdownQuality
/** 活动任务或读取异常时禁止写入。 */ disabled: boolean
/** 项目详情已读取的正式原文,仅用于人工核对。 */ episodes?: Pick<Episode, 'episode' | 'content'>[]
}>(),
{ episodes: () => [] }
)
/** 抽屉关闭后立即废弃只读请求,不保留提交许可。 */
const open = defineModel<boolean>('open', { default: false })
/** 真实写回、发现旧版本或已提交结果后刷新项目、审核和阶段。 */
const emit = defineEmits<{ refresh: [] }>()
/** 全局消息反馈。 */
const message = useActionMessage()
/** 当前项目的活动任务及短请求锁。 */
const operation = computed(() => getOperation(props.projectId))
/** 当前只读预检原始回执。 */
const preview = ref<CandidateCommitPreview | null>(null)
/** 预检只读加载,允许关闭。 */
const checking = ref(false)
/** 真实写入期间锁定关闭与重复操作。 */
const writing = ref(false)
/** 读取或本次写入失败,保留可操作的中文原因。 */
const actionError = ref('')
/** 默认不选关系,每次只允许人工处理一条。 */
const selectedIndex = ref<number | null>(null)
/** 人工勾选仅针对当前关系或最终提交,切换操作时清空。 */
const acknowledged = ref(false)
/** 写入成功后等待页面拿到新版本,不能再次使用旧预检。 */
const awaitingRefresh = ref(false)
/** 正式原文核对的集号,不推断关系所属剧集。 */
const sourceEpisode = ref<number | null>(null)
/** 只读请求可取消,写操作不做自动重试。 */
let controller: AbortController | undefined
/** 丢弃关闭、换项目、换版本后的异步回填。 */
let version = 0
/** 已提交状态以服务端当前标记为准,不虚构失败检查。 */
const committed = computed(() => props.quality.committed || preview.value?.status === 'already_committed')
/** 质量审核通过只是读取预检的前置条件。 */
const canCheck = computed(
() =>
!props.disabled &&
!operation.value.pending &&
!committed.value &&
!awaitingRefresh.value &&
props.quality.canRequestCommitPreview &&
props.quality.checkpointId === props.checkpointId
)
/** 自身写入期间保留原按钮与加载反馈,其余操作仍遵守项目锁。 */
const actionsVisible = computed(() => canCheck.value || writing.value)
/** 只使用当前项目、当前版本且只读标记有效的未提交预检。 */
const current = computed(() => {
const result = preview.value
return result &&
result.status !== 'already_committed' &&
result.readOnly === true &&
result.projectId === props.projectId &&
result.checkpointId === props.checkpointId
? result
: null
})
/** 全部门禁通过才能显示正式提交操作。 */
const ready = computed(() => candidatePreviewReady(preview.value, props.projectId, props.checkpointId))
/** 固定检查项缺失也视为未通过,不从返回字段动态缩减门禁。 */
const failedChecks = computed(() =>
current.value ? candidateCheckKeys.filter(key => current.value!.checks?.[key] !== true) : []
)
/** 原始关系只能来自本次安全预检,不解析问题字符串构造删除参数。 */
const targets = computed(() => current.value?.relationRepairTargets ?? [])
/** 用户选择的关系仍需校验完整且定位唯一。 */
const selected = computed(() => (selectedIndex.value === null ? null : (targets.value[selectedIndex.value] ?? null)))
/** 非空字段与唯一关系是写入前提,不裁剪原始提交值。 */
const selectionIssue = computed(() => {
const target = selected.value
if (!target) return ''
if (
![target.subjectRef, target.relation, target.target, target.evidence].every(
value => typeof value === 'string' && value.trim()
)
)
return '这条关系缺少完整定位信息,请刷新预检。'
return targets.value.filter(item => sameRelation(item, target)).length === 1
? ''
: '关系定位不唯一,请重新读取并核对。'
})
/** 修复只在当前剧本和规则未变、无活动任务时开放;资产保护仍由最终提交独立检查。 */
const repairSafe = computed(() => !!current.value && repairConditions(current.value))
/** 读取项目详情中的正式正文,不调用模型,也不虚构剧集查询接口。 */
const episodeOptions = computed(() =>
props.episodes.map(item => ({ value: item.episode, label: `第 ${item.episode} 集` }))
)
/** 用户选集后按原样显示完整正文。 */
const sourceContent = computed(() => props.episodes.find(item => item.episode === sourceEpisode.value)?.content ?? '')
/** 候选规模只用于说明替换范围。 */
const counts = computed(() => ({
subjects: props.state?.subjectCandidates?.length ?? 0,
episodes: props.state?.storyboardEpisodeShots?.length ?? 0,
shots:
props.state?.storyboardEpisodeShots?.reduce(
(sum, episode) => sum + episode.beatShots.reduce((n, beat) => n + beat.shots.length, 0),
0
) ?? 0
}))
/**
* 按后端四个精确定位字段比较关系,不改写证据。
* @param left 待检查关系
* @param right 用户核对的关系
* @returns 是否为同一原始关系
*/
function sameRelation(left: CandidateRelationTarget, right: CandidateRelationTarget): boolean {
return (
left.subjectRef === right.subjectRef &&
left.relation === right.relation &&
left.target === right.target &&
left.evidence === right.evidence
)
}
/**
* 关系修复依赖来源一致及无活动任务,不能以资产未生成代替任务锁。
* @param result 最新只读预检
* @returns 是否具备关系修复的来源与任务条件
*/
function repairConditions(result: CandidateCommitPreview): boolean {
return (
result.status !== 'already_committed' &&
result.readOnly === true &&
[
'qualityPolicyMatches',
'episodeNumbersMatch',
'episodeFingerprintsMatch',
'noActiveExecutions',
'noActiveVideos'
].every(key => result.checks?.[key as keyof typeof result.checks] === true)
)
}
/** 撤销旧回执与人工勾选,关闭或版本改变后不能复用。 */
function invalidate() {
version++
controller?.abort()
checking.value = false
preview.value = null
selectedIndex.value = null
acknowledged.value = false
actionError.value = ''
}
/** 打开、换项目、换版本后重新读取;关闭时仅取消只读请求。 */
watch(
[open, () => props.projectId, () => props.checkpointId],
([shown, id, cp], old) => {
invalidate()
if (!old || id !== old[1] || cp !== old[2]) {
awaitingRefresh.value = false
sourceEpisode.value = null
}
if (shown && canCheck.value) void check()
},
{ immediate: true }
)
/** 外部任务或质量变化立即撤销旧许可,自身写入造成的锁不清空人工选择。 */
watch([() => props.disabled, () => props.quality.canRequestCommitPreview, () => props.quality.committed], () => {
if (writing.value) return
if (!canCheck.value) invalidate()
else if (open.value && !preview.value && !checking.value) void check()
})
/** 用户切换关系后必须重新明确勾选。 */
watch(selectedIndex, () => {
acknowledged.value = false
})
onScopeDispose(invalidate)
/** 只读刷新安全预检,不自动删除关系或提交候选。 */
async function check() {
if (!open.value || !canCheck.value || writing.value || checking.value) return
invalidate()
const stamp = version,
id = props.projectId,
cp = props.checkpointId
controller = new AbortController()
checking.value = true
try {
const result = await breakdownApi.candidateCommitPreview(id, controller.signal)
if (stamp !== version) return
if (
result.projectId !== id ||
result.readOnly !== true ||
(result.status !== 'already_committed' && result.checkpointId !== cp)
)
throw new Error('候选安全预检已过期,请刷新项目后重新检查。')
preview.value = result
if (result.status === 'already_committed') emit('refresh')
} catch (cause) {
if (stamp === version) {
actionError.value = errorMessage(cause)
showActionFeedback(message, actionError.value, 'error')
}
} finally {
if (stamp === version) checking.value = false
}
}
/** 刷新按钮同时恢复页面最新质量结论;等待新版本时不再检查旧保存记录。 */
function refreshPreview() {
if (writing.value) return
emit('refresh')
if (!awaitingRefresh.value) void check()
}
/**
* 写入前读取最新原始保存记录,避免历史回退和跨项目写入。
* @param id 当前操作绑定的项目
* @param cp 用户核对过的保存记录
* @returns 当前版本核对完成
*/
async function assertCheckpoint(id: string, cp: string | undefined): Promise<void> {
const records = await projectsApi.checkpoints(id, undefined, 'breakdown')
const latest = workflowCheckpoints(records, 'breakdown').at(-1)
if (
!cp ||
latest?.checkpointId !== cp ||
latest.state.storyboardPersisted ||
latest.state.candidateCommitted ||
props.projectId !== id ||
props.checkpointId !== cp ||
!open.value
)
throw new Error('拆解候选版本已变化或已经提交,请刷新后重新确认。')
}
/** 用户明确确认后只移除一条当前仍无来源的关系,成功后等待新版本重新预检。 */
async function repairRelation() {
if (
!canCheck.value ||
!repairSafe.value ||
!selected.value ||
selectionIssue.value ||
!acknowledged.value ||
writing.value ||
checking.value
)
return
const id = props.projectId,
cp = props.checkpointId,
target = { ...selected.value },
stamp = version
let stale = false
writing.value = true
actionError.value = ''
const ok = await runOperation(
id,
'正在移除无来源关系',
async () => {
try {
await assertCheckpoint(id, cp)
} catch (cause) {
stale = true
throw cause
}
const checked = await breakdownApi.candidateCommitPreview(id)
if (
stamp !== version ||
checked.projectId !== id ||
checked.checkpointId !== cp ||
!props.quality.canRequestCommitPreview ||
!repairConditions(checked) ||
checked.status === 'already_committed' ||
checked.relationRepairTargets?.filter(item => sameRelation(item, target)).length !== 1 ||
props.projectId !== id ||
props.checkpointId !== cp ||
!open.value
) {
stale = true
throw new Error('关系、来源或任务状态已变化,请重新预检后确认。')
}
const result = await breakdownApi.repairCandidateRelation(id, {
confirmed: true,
expectedCheckpointId: cp!,
subjectRef: target.subjectRef,
relation: target.relation,
target: target.target,
evidence: target.evidence
})
if (
result.removed !== 1 ||
result.subjectRef !== target.subjectRef ||
!result.checkpointId ||
result.checkpointId === cp
)
throw new Error('关系处理结果尚未确认,请重新读取最新结果。')
return result
},
{ type: 'info', content: '已移除这条候选关系,正在重新读取预检;正式结果尚未提交。' }
)
writing.value = false
if (props.projectId !== id || stamp !== version) return
const failure = operation.value.error
const conflict = operation.value.cause instanceof ApiError && operation.value.cause.status === 409
acknowledged.value = false
if (ok || stale || conflict) {
invalidate()
awaitingRefresh.value = ok
emit('refresh')
}
actionError.value = failure
}
/** 全部门禁通过且用户单独确认后,再次核对版本与预检,随后正式采用候选。 */
async function commit() {
if (!canCheck.value || !ready.value || selected.value || !acknowledged.value || writing.value || checking.value)
return
const id = props.projectId,
cp = props.checkpointId,
stamp = version
writing.value = true
actionError.value = ''
const ok = await runOperation(
id,
'正在提交拆解候选',
async () => {
await assertCheckpoint(id, cp)
const checked = await breakdownApi.candidateCommitPreview(id)
if (stamp !== version || !props.quality.canRequestCommitPreview || !candidatePreviewReady(checked, id, cp))
throw new Error('提交安全条件已变化,请重新检查候选。')
const receipt = await breakdownApi.commitCandidate(id)
if (receipt.projectId !== id) throw new Error('提交回执所属项目不一致,请刷新确认。')
return receipt
},
receipt => ({
type: 'success',
content: `拆解结果已保存并采用:${receipt.subjectCount} 个主体、${receipt.episodeCount} 集、${receipt.shotCount} 个镜头。`
})
)
writing.value = false
if (props.projectId !== id || stamp !== version) return
const failure = operation.value.error
invalidate()
awaitingRefresh.value = false
actionError.value = failure
if (ok) open.value = false
emit('refresh')
}
</script>
<template>
<!-- 以下是与拆解设置分离的安全预检及关系问题处理全屏抽屉 -->
<AppDrawer
v-model:open="open"
title="候选安全预检"
:busy="writing"
description="逐条核对来源不明的关系,检查通过后再采用。"
>
<div class="space-y-6" :aria-busy="checking">
<p v-if="checking" role="status" class="text-sm text-muted">正在读取安全预检…</p>
<p v-else-if="committed" role="status" class="text-sm">已提交正式结果,请以页面最新结果为准。</p>
<p v-else-if="awaitingRefresh" role="status" class="text-sm text-muted">
正在等待最新保存记录,请刷新状态后继续核对。
</p>
<p v-else-if="!canCheck && !current" role="status" class="text-sm text-muted">
候选暂不能检查,请刷新状态。
</p>
<p v-if="actionError" role="alert" class="text-sm text-danger">{{ actionError }}</p>
<template v-if="current && !committed">
<!-- 以下是当前候选规模与后端逐项预检结果,不把候选审核当作提交许可 -->
<section class="space-y-4" aria-label="候选提交预检">
<WorkspaceSectionHeading
title="提交安全检查"
:description="`候选主体 ${counts.subjects} · ${counts.episodes} 集 · ${counts.shots} 个镜头`"
/>
<NTag :type="ready ? 'success' : 'warning'" :bordered="false">{{
ready ? '安全预检通过,等待人工确认采用' : '安全预检未通过'
}}</NTag>
<section
v-if="failedChecks.length"
class="problem-surface p-4 space-y-3"
aria-label="未通过的提交安全检查"
>
<p class="text-sm">以下条件尚未满足:</p>
<ul class="list-inside list-disc space-y-2 text-sm">
<li v-for="key in failedChecks" :key="key">{{ candidateCheckLabels[key] }}</li>
</ul>
</section>
</section>
<!-- 以下是后端返回的关系问题与正式原文,窄屏自然改为单列 -->
<!-- 以下是正式时长预算的来源冲突 -->
<p v-if="current.durationSourceIssue" class="text-sm text-danger">
{{ userFacingText(current.durationSourceIssue) }}
</p>
<div v-if="targets.length || current.relationIssues?.length" class="grid min-w-0 gap-6 lg:grid-cols-2">
<section class="min-w-0 space-y-4" aria-label="无来源关系">
<WorkspaceSectionHeading
title="核对关系来源"
description="仅移除这条候选关联。主体、镜头和剧本会保留。"
/>
<article
v-for="(item, index) in targets"
:key="index"
class="problem-surface p-4 space-y-3 min-w-0 wrap-anywhere"
>
<h3 class="text-sm font-medium">
{{ item.subjectName }} · {{ item.relation }} → {{ item.target }}
</h3>
<p class="text-xs text-muted">候选引用:{{ item.subjectRef }}</p>
<p class="text-sm text-muted">原始来源证据</p>
<blockquote class="whitespace-pre-wrap text-sm leading-7">{{ item.evidence }}</blockquote>
<NRadio
:checked="selectedIndex === index"
:disabled="writing || checking || !canCheck || !repairSafe"
@update:checked="selectedIndex = index"
>核对后移除这条无来源关系</NRadio
>
</article>
<p v-if="!targets.length" class="text-sm text-muted">当前未提供可定位的关系,请刷新预检。</p>
<NCollapse v-if="current.relationIssues?.length"
><NCollapseItem name="details" title="关系检查详情">
<p
v-for="(issue, index) in current.relationIssues"
:key="index"
class="text-sm leading-7 wrap-anywhere"
>
{{ issue }}
</p>
</NCollapseItem></NCollapse
>
<p v-if="selectionIssue" role="alert" class="text-sm text-danger">{{ selectionIssue }}</p>
<NButton
v-if="selected"
class="workspace-action-button"
:disabled="writing"
@click="selectedIndex = null"
>取消选择</NButton
>
</section>
<!-- 以下是复用项目详情的正式原文,不推断问题所属集数 -->
<section class="min-w-0 space-y-4" aria-label="正式剧本核对">
<NCollapse :default-expanded-names="['source']"
><NCollapseItem name="source" title="正式剧本原文">
<div class="space-y-4">
<NSelect
v-model:value="sourceEpisode"
:options="episodeOptions"
aria-label="选择核对剧集"
placeholder="选择需要核对的剧集"
:disabled="!episodeOptions.length"
/>
<pre
class="max-h-[60dvh] overflow-auto whitespace-pre-wrap wrap-anywhere p-4 text-sm leading-7 bg-(--app-control)"
>{{
sourceContent ||
(episodeOptions.length
? '请选择需要核对的剧集。'
: '当前没有可核对的正式正文。')
}}</pre>
</div>
</NCollapseItem></NCollapse
>
</section>
</div>
<p v-if="ready" class="text-sm leading-7 text-muted">
采用后将替换正式主体、形态和分镜。保存前会检查剧本及已有成果。
</p>
</template>
</div>
<!-- 以下是固定底栏:关系移除与正式采用分别明确确认,禁止重复写入 -->
<template #footer>
<div class="flex w-full flex-wrap items-center justify-between gap-4">
<NCheckbox
v-if="actionsVisible && !checking && ((selected && !selectionIssue && repairSafe) || ready)"
v-model:checked="acknowledged"
:disabled="writing"
class="min-w-0 flex-[1_1_360px]"
>
{{
selected
? '我已核对原文,确认仅移除所选候选关系。'
: '我已核对预检结果,确认替换正式主体、形态与分镜。'
}}
</NCheckbox>
<div class="ml-auto flex flex-wrap items-center justify-end gap-2">
<NButton :disabled="writing" @click="open = false">关闭</NButton>
<WorkspaceRefreshButton
label="刷新预检"
:loading="checking"
:disabled="writing || operation.pending"
@refresh="refreshPreview"
/>
<NButton
v-if="selected && !selectionIssue && repairSafe && actionsVisible"
type="primary"
:loading="writing"
:disabled="!acknowledged || checking || writing"
@click="repairRelation"
>
<template #icon><Trash2 :size="15" aria-hidden="true" /></template>确认移除这条关系
</NButton>
<NButton
v-else-if="ready && actionsVisible"
type="primary"
:loading="writing"
:disabled="!acknowledged || checking || writing"
@click="commit"
>确认提交候选为正式结果</NButton
>
</div>
</div>
</template>
</AppDrawer>
</template>
@@ -0,0 +1,189 @@
<script setup lang="ts">
import { computed } from 'vue'
import { NButton, NCollapse, NCollapseItem } from 'naive-ui'
import RawDataDetails from '../../../components/ui/RawDataDetails.vue'
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
import { useQuery } from '../../../composables/useQuery'
import { userFacingText } from '../../../lib/user-facing-text'
import { projectsApi } from '../../projects/api'
import { breakdownApi } from '../api'
import type { BreakdownDurationFailure, EpisodeShots } from '../types'
/** 时长诊断使用最新候选证据和正式预算的独立只读来源。 */
const props = defineProps<{
/** 当前项目编号。 */ projectId: string
/** 当前保存记录变化时刷新。 */ checkpointId?: string
}>()
/** 查询随保存记录更新,旧候选不会回填当前任务。 */
const key = computed(() => JSON.stringify([props.projectId, props.checkpointId]))
/** 正式结果和候选诊断独立读取,保留某一来源暂不可用时的另一份结果。 */
const query = useQuery(key, async (value, signal) => {
const [projectId] = JSON.parse(value) as [string, string?]
const [formal, latest] = await Promise.allSettled([
projectsApi.durationBudget(projectId, signal),
breakdownApi.latest(projectId, signal)
])
if (formal.status === 'fulfilled' && formal.value.projectId !== projectId)
throw new Error('时长资料与当前项目不匹配。')
if (latest.status === 'fulfilled' && latest.value?.projectId && latest.value.projectId !== projectId)
throw new Error('失败记录与当前项目不匹配。')
return { formal, latest }
})
/** 正式预算来自当前项目服务,包含尚无镜头的正式剧集。 */
const formal = computed(() =>
query.data.value?.formal.status === 'fulfilled' ? query.data.value.formal.value.episodes : []
)
/** 最新失败候选和原始预算快照保留用于诊断。 */
const latest = computed(() => (query.data.value?.latest.status === 'fulfilled' ? query.data.value.latest.value : null))
/** 只选最新记录中实际返回的完整失败候选。 */
const failures = computed(() => {
const entries = latest.value?.failureDetails?.details
return Array.isArray(entries)
? entries.filter(
(item): item is BreakdownDurationFailure =>
item?.kind === 'storyboard-duration-failure' &&
item.candidate?.episodePlan &&
Array.isArray(item.candidate?.beatShots)
)
: []
})
/**
* 失败时可能尚未产出预算审计,按已返回的镜头阶段估算供复盘。
* @param candidate 服务器返回的失败候选
* @returns 只读估算,不用于通过审核或修改正式分镜
*/
function estimateFailedBudget(candidate: EpisodeShots) {
const beatSuggestions = candidate.beatShots.flatMap(beat => {
const budget = candidate.episodePlan.beats.find(item => item.beatNo === beat.beatNo)?.estimatedDurationSeconds
if (!budget || !beat.shots.length) return []
const required = beat.shots.reduce((sum, shot) => {
const planning = shot.durationPlanning
const estimated = planning?.phases.reduce(
(total, phase) => total + phase.estimatedSeconds,
planning.transitionSeconds
)
const supported =
planning && estimated !== undefined && Math.abs(estimated - planning.recommendedDurationSeconds) <= 0.1
return sum + (supported ? Math.max(shot.durationSeconds, estimated) : shot.durationSeconds)
}, 0)
return [
{
beatNo: beat.beatNo,
requiredSeconds: Number(required.toFixed(2)),
deficitSeconds: required > budget + 0.1 ? Number((required - budget).toFixed(2)) : 0
}
]
})
if (!beatSuggestions.length) return undefined
return {
beatSuggestions,
minimumRequiredSeconds: Number(beatSuggestions.reduce((sum, beat) => sum + beat.requiredSeconds, 0).toFixed(2)),
deficitSeconds: Number(beatSuggestions.reduce((sum, beat) => sum + beat.deficitSeconds, 0).toFixed(2)),
estimated: true
}
}
/** 对应候选规划的目标版本、所有段落预算与已知缺口。 */
const plans = computed(() => {
const items = new Map((latest.value?.storyboardPlans ?? []).map(plan => [plan.episodeNo, plan]))
for (const failure of failures.value) items.set(failure.episodeNo, failure.candidate.episodePlan)
return [...items.values()].map(plan => ({
...plan,
report:
latest.value?.storyboardEpisodeDurationBudgets?.find(item => item.episodeNo === plan.episodeNo) ??
failures.value
.filter(item => item.episodeNo === plan.episodeNo)
.map(item => estimateFailedBudget(item.candidate))[0],
formal: formal.value.find(item => item.episodeNo === plan.episodeNo)
}))
})
</script>
<template>
<!-- 以下是正式时长与候选来源的只读诊断 -->
<section class="space-y-4" aria-label="时长预算诊断">
<WorkspaceSectionHeading title="时长预算" description="核对剧集目标时长与拆解预算。" />
<p v-if="query.loading.value" class="text-sm text-muted">正在读取时长预算…</p>
<div v-else-if="query.error.value" class="space-y-2 text-sm">
<p>{{ query.error.value }}</p>
<NButton size="small" @click="query.refresh">重新读取预算</NButton>
</div>
<template v-else>
<p
v-if="query.data.value?.formal.status === 'rejected' || query.data.value?.latest.status === 'rejected'"
class="text-sm text-muted"
>
部分时长来源暂时无法读取。<NButton text size="small" @click="query.refresh">重新读取</NButton>
</p>
<ul v-if="formal.length" class="grid gap-2 sm:grid-cols-2 text-sm">
<li v-for="episode in formal" :key="episode.episodeNo">
第 {{ episode.episodeNo }} 集 · 正式目标
{{ episode.targetDurationSeconds == null ? '自动' : `${episode.targetDurationSeconds} 秒` }} ·
正式镜头
{{ episode.shotCount && episode.shotSeconds != null ? `${episode.shotSeconds} 秒` : '未生成' }}
</li>
</ul>
<NCollapse v-if="plans.length">
<NCollapseItem
v-for="plan in plans"
:key="plan.episodeNo"
:name="plan.episodeNo"
:title="`第 ${plan.episodeNo} 集 · 拆解预算快照`"
>
<div class="space-y-2 text-sm">
<p>
拆解时目标
{{
plan.targetDurationSeconds === undefined
? '历史未记录'
: plan.targetDurationSeconds === null
? '自动'
: `${plan.targetDurationSeconds} 秒`
}}
</p>
<p
v-if="plan.formal && plan.targetDurationSeconds !== plan.formal.targetDurationSeconds"
class="text-danger"
>
{{
plan.targetDurationSeconds === undefined
? '缺少原预算快照,请核对来源。'
: '拆解后的正式目标已变化,请核对来源。'
}}
</p>
<p v-if="plan.report">
<span v-if="'estimated' in plan.report">根据失败候选估算 · </span>动作最低需求
{{ plan.report.minimumRequiredSeconds }} 秒 · 段落缺口合计
{{ plan.report.deficitSeconds }} 秒
</p>
<ul class="space-y-2">
<li v-for="beat in plan.beats" :key="beat.beatNo">
段落 {{ beat.beatNo }} · {{ beat.title }} · 预算 {{ beat.estimatedDurationSeconds }} 秒
<span
v-for="gap in plan.report?.beatSuggestions.filter(
item => item.beatNo === beat.beatNo
)"
:key="gap.beatNo"
:class="{ 'text-danger': gap.deficitSeconds > 0 }"
>
· 最低需求 {{ gap.requiredSeconds }} 秒 · 缺口 {{ gap.deficitSeconds }} 秒
</span>
</li>
</ul>
</div>
</NCollapseItem>
</NCollapse>
<p
v-if="failures.length && latest?.workflowExecution?.errorMessage"
class="text-sm text-danger wrap-anywhere"
>
{{ userFacingText(latest.workflowExecution.errorMessage) }}
</p>
<RawDataDetails
v-for="(failure, index) in failures"
:key="index"
:title="`第 ${failure.episodeNo} 集 · 完整失败候选`"
:value="failure"
/>
</template>
</section>
</template>
@@ -0,0 +1,203 @@
<script setup lang="ts">
import { userFacingText } from '../../../lib/user-facing-text'
import { qualityIssueLabel } from '../repair'
import { computed, ref } from 'vue'
import { NButton, NCollapse, NCollapseItem } from 'naive-ui'
import { AppDrawer } from '../../../components/ui'
import type { ShotValidation } from '../types'
import type { BreakdownQuality } from '../quality'
/** 同一剧集、节拍和镜头的校验问题分组。 */
interface BreakdownIssueGroup {
/** 稳定的位置键。 */
key: string
/** 后端提供的原始位置。 */
location: ShotValidation['issues'][number]
/** 去重后的原始错误描述。 */
messages: string[]
}
/** 拆解问题及调用方提供的修订、恢复操作使用独立全屏抽屉展示。 */
const props = defineProps<{
/** 后端分镜校验问题,保留原始描述和位置。 */
issues: ShotValidation['issues']
/** 工作流执行异常,空值表示没有执行异常。 */
workflowError?: string
/** 当前结果是否允许定位到分镜正文。 */
locatable: boolean
/** 当前版本统一审核,历史问题与当前问题分开。 */
quality?: BreakdownQuality
/** 真实写入例外期间禁止关闭和定位,普通读取不锁定。 */
busy?: boolean
}>()
/** 独立问题抽屉显隐。 */
const open = defineModel<boolean>('open', { default: false })
/** 抽屉关闭后再定位正文,避免焦点陷阱阻止定位。 */
const emit = defineEmits<{ locate: [issue: ShotValidation['issues'][number]]; refresh: [] }>()
/** 问题类型统一分类,缺失精确坐标时只提供剧集查看。 */
const problemGroups = computed(() =>
(
[
['subject', '主体引用缺失'],
['binding', '形态绑定异常'],
['structure', '分镜结构校验'],
['action', '动作质量阻断'],
['pending', '待审核剧集'],
['workflow', '当前执行异常']
] as const
)
.map(([type, label]) => ({
type,
label,
items: props.quality?.problems.filter(item => item.type === type) ?? []
}))
.filter(group => group.items.length)
)
/** 相同镜头的问题合并为一组,重复消息不重复显示。 */
const groups = computed(() => {
const result = new Map<string, BreakdownIssueGroup>()
for (const issue of props.issues) {
const key = `${issue.episodeNo}:${issue.beatNo ?? ''}:${issue.shotNo ?? ''}`
const group = result.get(key) ?? { key, location: issue, messages: [] }
if (!group.messages.includes(issue.message)) group.messages.push(issue.message)
result.set(key, group)
}
return [...result.values()]
})
/** 当前去重后的问题总数,不把多个位置合为一个错误。 */
const count = computed(() => groups.value.reduce((total, group) => total + group.messages.length, 0))
/** 等待离场后执行的定位。 */
const pendingLocation = ref<ShotValidation['issues'][number] | null>(null)
/** 时长资料按需读取,与其它问题查询独立。 */
const diagnosticSections = ref<string[]>([])
/**
* 关闭问题抽屉后定位到对应剧集、节拍或镜头。
* @param issue 后端提供的问题位置
*/
function locate(issue: ShotValidation['issues'][number]) {
if (!props.locatable || props.busy) return
pendingLocation.value = { ...issue }
open.value = false
}
/** 离场动画结束后再交接焦点。 */
function finish() {
if (pendingLocation.value) {
const issue = pendingLocation.value
pendingLocation.value = null
emit('locate', issue)
}
}
</script>
<template>
<!-- 以下是全屏展示的拆解执行错误与分镜校验问题模块 -->
<AppDrawer v-model:open="open" title="拆解问题" :busy="busy" class="breakdown-issues-drawer" @closed="finish">
<template #description
><span v-if="quality"
>{{
quality.isCandidate
? '当前候选'
: quality.source === 'history'
? '历史结果(当前质量未确认)'
: '当前正式结果'
}}
· 结构 {{ quality.structuralCount }} 项 · 动作 {{ quality.actionBlocks.length }} 镜</span
><span v-else-if="count">{{ count }} 项校验问题 · {{ groups.length }} 个位置</span
><span v-else>查看最近保存结果中的问题</span></template
>
<!-- 以下是独立的上游时长诊断 -->
<NCollapse v-if="$slots.duration" v-model:expanded-names="diagnosticSections" class="mb-5">
<NCollapseItem name="duration" title="查看时长预算与失败候选">
<slot v-if="diagnosticSections.includes('duration')" name="duration" />
</NCollapseItem>
</NCollapse>
<!-- 以下是当前版本的分类问题,历史错误不会混入当前问题数量 -->
<div v-if="quality" class="space-y-5" :aria-busy="quality.loading">
<p v-if="quality.loading" class="text-sm text-muted" role="status">正在读取当前候选审核…</p>
<div v-else-if="quality.error" class="problem-surface p-5 space-y-3">
<p class="text-sm break-words">{{ quality.error }}</p>
<NButton @click="emit('refresh')">重新读取审核</NButton>
</div>
<template v-else>
<section v-for="group in problemGroups" :key="group.type" class="space-y-3" :aria-label="group.label">
<h3 class="text-sm font-medium">{{ group.label }} · {{ group.items.length }}</h3>
<article
v-for="item in group.items"
:key="item.key"
class="workspace-panel problem-surface space-y-3 break-words"
:data-problem-type="item.type"
>
<div v-if="item.location" class="flex flex-wrap items-center justify-between gap-3">
<p class="text-sm">
第 {{ item.location.episodeNo }} 集<span v-if="item.location.beatNo">
· 节拍 {{ item.location.beatNo }}</span
><span v-if="item.location.shotNo"> · 镜头 {{ item.location.shotNo }}</span
><span class="ml-3 text-xs text-muted">待处理</span>
</p>
<NButton v-if="locatable" text size="small" @click="locate(item.location)">{{
item.location.beatNo ? '定位分镜' : '查看本集'
}}</NButton>
</div>
<p class="text-sm leading-6">{{ userFacingText(item.message) }}</p>
<p v-if="item.codes.length" class="text-xs text-muted break-all">
需要处理:{{ item.codes.map(qualityIssueLabel).join('、') }}
</p>
</article>
</section>
<p v-if="!quality.issueCount && !workflowError" class="text-sm text-muted">
当前版本没有待处理的质量问题。
</p>
<!-- 以下是使用 Naive 折叠组件的历史记录,默认收起且不计入当前问题 -->
<NCollapse v-if="quality.historyIssues.length" class="text-xs text-muted" data-history-issues
><NCollapseItem
name="history"
:title="`历史审核记录 · ${quality.historyIssues.length} 项(不计入当前问题)`"
><p v-for="(item, index) in quality.historyIssues" :key="index" class="mt-3 break-words">
第 {{ item.episodeNo }} 集 · {{ userFacingText(item.message) }}
</p></NCollapseItem
></NCollapse
>
</template>
</div>
<div class="space-y-4">
<section v-if="workflowError" class="workspace-panel problem-surface space-y-3" aria-label="执行异常">
<h3 class="text-sm font-medium">执行异常</h3>
<p class="whitespace-pre-wrap break-words text-sm leading-6">{{ userFacingText(workflowError) }}</p>
</section>
<article
v-for="group in quality ? [] : groups"
:key="group.key"
class="workspace-panel problem-surface breakdown-issue-group space-y-3"
>
<div class="flex flex-wrap items-center justify-between gap-3">
<h3 class="text-sm font-medium">
第 {{ group.location.episodeNo }} 集<span v-if="group.location.beatNo">
· 节拍 {{ group.location.beatNo }}</span
><span v-if="group.location.shotNo"> · 镜头 {{ group.location.shotNo }}</span>
</h3>
<NButton v-if="locatable" size="small" text @click="locate(group.location)">{{
group.location.beatNo ? '定位分镜' : '查看本集'
}}</NButton>
</div>
<p v-for="message in group.messages" :key="message" class="break-words text-sm leading-6">
{{ userFacingText(message) }}
</p>
</article>
<p v-if="!quality && !groups.length && !workflowError" class="py-5 text-sm text-muted">
请查看修复清单中的待处理镜头。
</p>
</div>
<!-- 以下是独立的问题修订与阶段恢复模块,不承载生成配置或候选提交 -->
<div v-if="$slots.repair" class="mt-6 space-y-5" aria-label="问题修订与恢复"><slot name="repair" /></div>
<!-- 以下是灰底关闭操作,绿色主按钮仅用于提交或执行任务 -->
<template #footer><NButton type="default" :disabled="busy" @click="open = false">关闭</NButton></template>
</AppDrawer>
</template>
<style>
/* 问题正文可滚动,滚动轨道隐藏;公共抽屉继续固定标题与底部关闭操作。 */
.breakdown-issues-drawer .n-scrollbar-rail {
display: none;
}
</style>
@@ -0,0 +1,354 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { NCheckbox, NFormItem, NInput, NSelect } from 'naive-ui'
import { WorkspaceSectionHeading } from '../../../components/ui'
import ConfirmAction from '../../workflows/ConfirmAction.vue'
import { getOperation, isOperationRunning, runOperation } from '../../workflows/operations'
import { breakdownApi } from '../api'
import type { BreakdownState } from '../types'
import type { CandidateActionRepair, CandidateRevalidation, CandidateShotLocation } from '../candidate.types'
/** 人工编辑的动作描述与原始动作对照,禁止编辑 kind。 */
interface ActionDraft extends CandidateActionRepair {
/** 稳定选择键。 */
key: string
/** 用户是否选择此动作。 */
selected: boolean
/** 原始描述,只读保留。 */
original: string
/** 原始镜头标题。 */
title: string
/** 对应阶段是否包含并行动作。 */
parallel: boolean
}
/** 全部修复仅针对尚未提交的当前候选。 */
const props = defineProps<{
/** 当前项目。 */
projectId: string
/** 当前原始检查点。 */
checkpointId: string
/** 当前同版本的主体、形态与镜头。 */
state: BreakdownState
/** 服务端真实审核结果。 */
review: CandidateRevalidation | null
/** 活动任务、读取错误或审核中时禁用。 */
disabled: boolean
}>()
/** 修复成功后要求父级重读检查点与审核,不修改本地候选伪造成功。 */
const emit = defineEmits<{ refresh: [] }>()
/** 项目写锁与统一消息反馈。 */
const operation = computed(() => getOperation(props.projectId))
/** 必须匹配当前检查点与项目的审核。 */
const review = computed(() =>
props.review?.checkpointId === props.checkpointId && props.review.projectId === props.projectId
? props.review
: null
)
/** 只有明确候选且没有活动操作才允许修订。 */
const writable = computed(
() =>
!!review.value &&
props.state.candidateOnly === true &&
!props.state.storyboardPersisted &&
!props.state.candidateCommitted &&
!props.disabled &&
!operation.value.pending
)
/** 已选择的镜头坐标键。 */
const targetKey = ref('')
/** 从真实主体选项中选择的引用。 */
const subjectRef = ref('')
/** 从所选主体已有形态中选择的编号。 */
const formId = ref('')
/** 多镜头动作草稿,失败后保留。 */
const actionDrafts = ref<ActionDraft[]>([])
/** 草稿所属版本,审核同版本刷新不清空人工编辑。 */
let draftVersion = ''
/**
* 为同镜头的缺失引用合并操作目标。
* @param location 原始镜头坐标
* @returns 稳定位置键
*/
function positionKey(location: CandidateShotLocation) {
return `${location.episodeNo}/${location.beatNo}/${location.shotNo}`
}
/** 只展示接口确实支持补齐的缺失引用,已有绑定不会伪装成可修复。 */
const targets = computed(() => {
const values = new Map<string, CandidateShotLocation & { refs: string[] }>()
const add = (location: CandidateShotLocation, subjectReference: string) => {
if (!props.state.subjectCandidates?.some(subject => subject.ref === subjectReference)) return
const shot = props.state.storyboardEpisodeShots
?.find(item => item.episodeNo === location.episodeNo)
?.beatShots.find(item => item.beatNo === location.beatNo)
?.shots.find(item => item.shotNo === location.shotNo)
if (
!shot ||
shot.subjectRefs.includes(subjectReference) ||
shot.subjectBindings?.some(item => item.subjectRef === subjectReference)
)
return
const key = positionKey(location)
const value = values.get(key) ?? { ...location, refs: [] }
if (!value.refs.includes(subjectReference)) value.refs.push(subjectReference)
values.set(key, value)
}
for (const item of review.value?.missingSubjectRefs ?? []) {
if (item.beatNo && item.shotNo && item.subject)
add({ episodeNo: item.episodeNo, beatNo: item.beatNo, shotNo: item.shotNo }, item.subject.ref)
}
for (const item of review.value?.propReferenceDiagnostics ?? []) {
if (!item.shotHasSubject && !item.shotHasBinding) add(item, item.subjectRef)
}
return [...values.values()]
})
/** 当前镜头的可信缺失引用选项。 */
const target = computed(() => targets.value.find(item => positionKey(item) === targetKey.value))
/** 主体只取当前候选,禁止任意输入。 */
const subjectOptions = computed(() =>
(props.state.subjectCandidates ?? [])
.filter(item => target.value?.refs.includes(item.ref))
.map(item => ({ label: `${item.name}(${item.ref})`, value: item.ref }))
)
/** 形态严格按真实主体 profileId 过滤。 */
const formOptions = computed(() => {
const subject = props.state.subjectCandidates?.find(item => item.ref === subjectRef.value)
return (props.state.subjectForms ?? [])
.filter(item => item.profileId === subject?.profileId)
.map(item => ({ label: item.formName || item.name, value: item.formId }))
})
/** 可提交主体目标,切换任何字段后都会撤销先前确认。 */
const subjectReady = computed(
() =>
writable.value &&
!!target.value &&
subjectOptions.value.some(item => item.value === subjectRef.value) &&
formOptions.value.some(item => item.value === formId.value)
)
/** 多镜头修复摘要只取用户选择的真实动作。 */
const repairs = computed(() =>
actionDrafts.value
.filter(item => item.selected)
.map(({ episodeNo, beatNo, shotNo, actionId, description }) => ({
episodeNo,
beatNo,
shotNo,
actionId,
description: description.trim()
}))
)
/** 每个选中动作都必须提供非空的、经过人工改写的过程描述。 */
const actionReady = computed(
() =>
writable.value &&
repairs.value.length > 0 &&
actionDrafts.value
.filter(item => item.selected)
.every(item => !!item.description.trim() && item.description.trim() !== item.original.trim())
)
/** 主体修复的最终确认摘要。 */
const subjectSummary = computed(
() =>
`只更新候选检查点,不修改正式资产。目标:${targetKey.value};主体:${subjectRef.value};形态:${formOptions.value.find(item => item.value === formId.value)?.label ?? ''}。`
)
/** 批量修复的最终确认摘要,描述变化后必须重新确认。 */
const actionSummary = computed(
() =>
`只更新候选,不调用模型。共 ${repairs.value.length} 个动作:${repairs.value.map(item => `${positionKey(item)} · ${item.actionId}:${item.description}`).join(';')}`
)
watch(targetKey, () => {
subjectRef.value = ''
formId.value = ''
})
watch(subjectRef, () => {
formId.value = ''
})
watch(
[() => props.projectId, () => props.checkpointId, review],
() => {
const version = `${props.projectId}:${props.checkpointId}`
if (version !== draftVersion) {
draftVersion = version
targetKey.value = ''
subjectRef.value = ''
formId.value = ''
actionDrafts.value = []
}
if (!review.value || actionDrafts.value.length) return
actionDrafts.value = review.value.actionRepairTargets.flatMap(item => {
if (!item.blockingCodes.includes('state_used_as_action_phase') || !item.shot) return []
const shot = item.shot
return shot.requiredActions
.filter(
action =>
action.kind === 'state' &&
shot.durationPlanning?.phases.some(phase => phase.actionIds?.includes(action.id))
)
.map(action => ({
episodeNo: item.episodeNo,
beatNo: item.beatNo,
shotNo: item.shotNo,
key: `${positionKey(item)}/${action.id}`,
actionId: action.id,
selected: false,
description: '',
original: action.description,
title: shot.title,
parallel:
shot.durationPlanning?.phases.some(
phase => phase.actionIds?.includes(action.id) && phase.actionIds.length > 1
) ?? false
}))
})
},
{ immediate: true }
)
/** 用户确认后提交单镜头主体补齐,成功后重读真实新版本。 */
async function repairSubject() {
if (!subjectReady.value || !target.value) return
const id = props.projectId
const checkpointId = props.checkpointId
const input = {
expectedCheckpointId: checkpointId,
episodeNo: target.value.episodeNo,
beatNo: target.value.beatNo,
shotNo: target.value.shotNo,
subjectRef: subjectRef.value,
formId: formId.value
}
const ok = await runOperation(
id,
'修复候选主体引用',
async () => {
const receipt = await breakdownApi.repairCandidateSubject(id, input)
if (!receipt.checkpointId || receipt.checkpointId === checkpointId)
throw new Error('未确认候选新版本,请刷新审核后核对。')
return receipt
},
{ type: 'success', content: '候选引用已修订,正在重新读取审核结果。' }
)
if (ok && props.projectId === id) emit('refresh')
}
/** 用户确认所选动作的真实过程描述后批量写入,失败保留草稿。 */
async function repairActions() {
if (!actionReady.value) return
const id = props.projectId
const checkpointId = props.checkpointId
const input = { expectedCheckpointId: checkpointId, repairs: structuredClone(repairs.value) }
const ok = await runOperation(
id,
'批量修复候选动作',
async () => {
const receipt = await breakdownApi.repairCandidateActions(id, input)
if (!receipt.checkpointId || receipt.checkpointId === checkpointId)
throw new Error('未确认候选新版本,请刷新审核后核对。')
return receipt
},
{ type: 'success', content: '候选动作已修订,正在重新读取审核结果。' }
)
if (ok && props.projectId === id) emit('refresh')
}
</script>
<template>
<!-- 以下是仅针对候选的主体与形态补齐模块 -->
<section v-if="targets.length" class="workspace-panel space-y-4" aria-label="候选主体修复">
<WorkspaceSectionHeading title="补齐候选主体引用" description="选择缺失的主体关联和形态,保存为新候选。" />
<div class="grid grid-cols-1 gap-4 lg:grid-cols-3">
<NFormItem label="目标镜头"
><NSelect
v-model:value="targetKey"
aria-label="主体修复目标镜头"
:disabled="!writable"
:options="
targets.map(item => ({
label: `第 ${item.episodeNo} 集 · 节拍 ${item.beatNo} · 镜头 ${item.shotNo}`,
value: positionKey(item)
}))
"
/></NFormItem>
<NFormItem label="候选主体"
><NSelect
v-model:value="subjectRef"
aria-label="待补齐候选主体"
:disabled="!writable || !target"
:options="subjectOptions"
/></NFormItem>
<NFormItem label="已有形态"
><NSelect
v-model:value="formId"
aria-label="候选主体已有形态"
:disabled="!writable || !subjectRef"
:options="formOptions"
/></NFormItem>
</div>
<ConfirmAction
:key="`${checkpointId}:${subjectSummary}`"
label="修复候选主体引用"
:description="subjectSummary"
:disabled="!subjectReady"
:loading="isOperationRunning(operation, '修复候选主体引用')"
@confirm="repairSubject"
/>
</section>
<!-- 以下是动作质量阻断的批量语义修订模块,不提供 kind 修改或自动修复 -->
<section v-if="review?.actionQualityBlocks.length" class="workspace-panel space-y-4" aria-label="候选批量动作修复">
<WorkspaceSectionHeading title="批量修订候选动作" description="填写镜头中能看到的动作,提交前核对修订。" />
<p v-if="!actionDrafts.length" class="text-xs text-muted">
此处仅补写动作过程。其他问题可用“继续整理镜头”检查。
</p>
<article
v-for="draft in actionDrafts"
:key="draft.key"
class="candidate-action-draft space-y-3 p-4"
:data-action-id="draft.actionId"
>
<NCheckbox v-model:checked="draft.selected" :disabled="!writable"
>第 {{ draft.episodeNo }} 集 · 节拍 {{ draft.beatNo }} · 镜头 {{ draft.shotNo }} · {{ draft.title }} ·
{{ draft.actionId }}</NCheckbox
>
<p class="text-xs leading-6 text-muted">原始状态:{{ draft.original }}</p>
<p v-if="draft.parallel" class="text-xs text-danger">此动作与其他动作同时发生,请核对是否冲突。</p>
<NInput
v-model:value="draft.description"
type="textarea"
:disabled="!writable || !draft.selected"
:input-props="{ 'aria-label': `动作 ${draft.key} 修订描述` }"
placeholder="请人工填写动作如何发生,不能只把结果状态改名"
:autosize="{ minRows: 3, maxRows: 8 }"
/>
</article>
<p v-if="repairs.length" class="text-xs leading-6 text-muted break-words" aria-label="批量修复摘要">
{{ actionSummary }}
</p>
<ConfirmAction
v-if="actionDrafts.length"
:key="`${checkpointId}:${actionSummary}`"
label="批量修复候选动作"
:description="actionSummary"
:disabled="!actionReady"
:loading="isOperationRunning(operation, '批量修复候选动作')"
@confirm="repairActions"
/>
</section>
<p
v-if="operation.error && ['修复候选主体引用', '批量修复候选动作'].includes(operation.label)"
role="alert"
class="text-xs text-danger break-words"
>
{{ operation.error }}
</p>
</template>
<style>
/* 修订草稿只作轻量分组,窄屏控件自然换行且不产生横向滚动。 */
.candidate-action-draft {
min-width: 0;
background: var(--app-subtle);
overflow-wrap: anywhere;
}
</style>
@@ -0,0 +1,237 @@
<script setup lang="ts">
import { computed, onScopeDispose, ref, watch } from 'vue'
import { NButton, NCollapse, NCollapseItem } from 'naive-ui'
import { RefreshCw, History } from '@lucide/vue'
import { preparationApi } from '../../storyboard-preparation/api'
import type { StoryboardHandRepairHistory } from '../types'
import { breakdownApi } from '../api'
import { diagnosisReason, diagnosisStatusLabels } from '../diagnosis'
import type { DiagnosisHistory, DiagnosisRepairReadiness } from '../diagnosis.types'
import type { LegacyActionDiagnosisResults } from '../types'
import RawDataDetails from '../../../components/ui/RawDataDetails.vue'
import { errorMessage } from '../../../lib/http'
import { userFacingText } from '../../../lib/user-facing-text'
import { formatDate } from '../../../lib/format'
/** 单镜头按需核对修订条件和历史,不从诊断建议拼装可写草稿。 */
const props = defineProps<{
/** 所属正式项目。 */
projectId: string
/** 当前列表记录,切换版本后旧请求失效。 */
shot: LegacyActionDiagnosisResults['shots'][number]
}>()
/** 默认收起,避免对全项目每个镜头预先发起请求。 */
const expanded = ref<string[]>([])
/** 明确的按钮控制 Naive 折叠,折叠标题不再伪装成卡片操作。 */
const showDetails = computed(() => expanded.value.includes('review'))
/** 当前真实诊断历史。 */
const history = ref<DiagnosisHistory | null>(null)
/** 正式动作和主体修订共用的不可变记录。 */
const revisions = ref<StoryboardHandRepairHistory | null>(null)
/** 当前诊断对应的修订资格。 */
const readiness = ref<DiagnosisRepairReadiness | null>(null)
/** 两类记录均已成功读到空结果时,使用同一条空状态,读取失败不冒充暂无记录。 */
const noRecords = computed(
() =>
!loading.value &&
!error.value &&
!!history.value &&
!!revisions.value &&
history.value.revisions.length === 0 &&
revisions.value.revisions.length === 0
)
/** 当前列表与资格必须同时有效,不能把旧诊断或直接应用标记解释成修订许可。 */
const repairEligible = computed(
() =>
readiness.value?.eligible === true &&
readiness.value.requiresManualReview === true &&
readiness.value.canApplyDirectly === false &&
readiness.value.willCallModel === false &&
readiness.value.willModifyAssets === false &&
props.shot.status === 'conflict_found' &&
props.shot.policyStatus === 'current' &&
props.shot.shotStale === false
)
/** 只读请求加载,始终允许关闭主窗口。 */
const loading = ref(false)
/** 保留可重试的查询错误。 */
const error = ref('')
/** 同镜头诊断和版本状态组成请求身份。 */
const target = computed(() =>
JSON.stringify([
props.projectId,
props.shot.shotId,
props.shot.diagnosisId,
props.shot.policyStatus,
props.shot.shotStale,
props.shot.latestRepairId
])
)
/** 请求代次用于拦截迟到结果。 */
let version = 0
/** 只读请求关闭时取消。 */
let controller: AbortController | undefined
/** 读取指定镜头历史与对应诊断资格,始终验证返回归属。 */
async function load() {
if (loading.value) return
const current = ++version
const id = props.projectId,
shotId = props.shot.shotId,
diagnosisId = props.shot.diagnosisId
controller?.abort()
controller = new AbortController()
loading.value = true
error.value = ''
try {
const [records, checked, changes] = await Promise.all([
breakdownApi.diagnosisHistory(id, shotId, controller.signal),
diagnosisId
? breakdownApi.diagnosisRepairReadiness(id, shotId, diagnosisId, controller.signal)
: Promise.resolve(null),
preparationApi.revisions(id, shotId, controller.signal)
])
if (current !== version) return
if (
changes.projectId !== id ||
changes.shotId !== shotId ||
!Array.isArray(changes.revisions) ||
records.projectId !== id ||
records.shotId !== shotId ||
!Array.isArray(records.revisions) ||
(checked && (checked.projectId !== id || checked.shotId !== shotId || checked.diagnosisId !== diagnosisId))
)
throw new Error('记录与当前镜头不一致,请重新读取。')
history.value = records
readiness.value = checked
revisions.value = changes
} catch (cause) {
if (current === version) error.value = errorMessage(cause)
} finally {
if (current === version) loading.value = false
}
}
/** 收起或切换上下文时废弃旧请求,不把旧资格沿用到新版本。 */
function reset() {
version++
controller?.abort()
loading.value = false
history.value = null
readiness.value = null
revisions.value = null
error.value = ''
}
watch(expanded, value => {
if (value.includes('review')) void load()
else reset()
})
watch(target, () => {
reset()
if (expanded.value.includes('review')) void load()
})
onScopeDispose(reset)
</script>
<template>
<!-- 以下是指定诊断的只读修订条件与历史记录,普通列表不暴露内部编号 -->
<div class="diagnosis-shot-tools">
<NButton
size="small"
:aria-label="showDetails ? '收起修订条件与历史' : '修订条件与诊断历史'"
:title="showDetails ? '收起修订条件与历史' : '修订条件与诊断历史'"
:aria-expanded="showDetails"
@click="expanded = showDetails ? [] : ['review']"
><template #icon><History :size="15" aria-hidden="true" /></template
><span class="diagnosis-action-label">{{
showDetails ? '收起修订条件与历史' : '修订条件与诊断历史'
}}</span></NButton
>
<!-- 以下是与定位、复查和历史入口同排的刷新操作,不在展开正文另起一组工具。 -->
<NButton v-if="showDetails" size="small" :loading="loading" @click="load"
><template #icon><RefreshCw :size="14" aria-hidden="true" /></template>刷新记录</NButton
>
<NCollapse v-show="showDetails" v-model:expanded-names="expanded" class="diagnosis-shot-details">
<NCollapseItem name="review" title="修订条件与诊断历史">
<div class="space-y-3 text-xs leading-6">
<p v-if="error" class="text-danger" role="alert">{{ error }}</p>
<p v-if="loading" role="status" class="text-muted">正在核对当前镜头记录…</p>
<p v-else-if="noRecords" class="text-muted">暂无修订或 AI 诊断记录。</p>
<section v-if="readiness" class="space-y-2" aria-label="当前诊断修订条件">
<p>
{{
repairEligible
? '已满足人工修订的前提,仍需人工核对完整动作。'
: '当前暂不能按这份诊断修订镜头。'
}}
</p>
<p v-for="reason in readiness.blockingReasons" :key="reason" class="text-muted">
{{ diagnosisReason(reason) }}
</p>
<p v-if="repairEligible" class="text-muted">查看并修订动作后,可保存修改。</p>
<article
v-for="(candidate, index) in readiness.repairCandidates"
:key="index"
class="space-y-1"
>
<p>阶段 {{ candidate.phaseNo }} · {{ candidate.characterRef }}</p>
<p>{{ userFacingText(candidate.suggestion) }}</p>
</article>
</section>
<section v-if="revisions?.revisions.length" class="space-y-3" aria-label="正式修订历史">
<p class="font-medium">正式修订 · {{ revisions.count }} 条</p>
<article v-for="record in revisions.revisions" :key="record.id" class="space-y-1">
<p class="text-muted">{{ formatDate(record.createdAt) }}</p>
<p>{{ record.reason }}</p>
</article>
</section>
<section v-if="history?.revisions.length" class="space-y-3" aria-label="诊断历史">
<p class="font-medium">AI 诊断 · {{ history.count }} 条</p>
<article v-for="record in history.revisions" :key="record.id" class="space-y-1">
<p>
{{ formatDate(record.createdAt) }} ·
{{
diagnosisStatusLabels[
record.effectiveStatus as keyof typeof diagnosisStatusLabels
] || '结果待核对'
}}
</p>
<p class="text-muted">
{{ record.shotStale ? '镜头已变化' : '镜头内容一致' }} ·
{{
record.policyStatus === 'current'
? '规则版本一致'
: record.policyStatus === 'stale'
? '规则版本已变化'
: '缺少规则版本'
}}
</p>
<RawDataDetails :value="record" title="完整诊断证据(高级)" />
</article>
</section>
</div>
</NCollapseItem>
</NCollapse>
</div>
</template>
<style scoped>
.diagnosis-shot-tools {
display: contents;
}
.diagnosis-shot-tools > .n-button {
min-height: 34px;
}
/* 展开仍由 Naive 组件管理;入口使用独立可聚焦按钮,避免重复折叠标题。 */
.diagnosis-shot-details {
flex-basis: 100%;
min-width: 0;
}
.diagnosis-shot-details :deep(.n-collapse-item__header) {
display: none;
}
/* 隐藏默认折叠标题后清除两层顶部留白,正文与卡片操作共用间距。 */
.diagnosis-shot-details :deep(.n-collapse-item__content-wrapper),
.diagnosis-shot-details :deep(.n-collapse-item__content-inner) {
padding-top: 0;
}
</style>
@@ -0,0 +1,348 @@
<script setup lang="ts">
import { Trash2 } from '@lucide/vue'
import type { ResourceOccupancy } from '../repair.types'
import { computed } from 'vue'
import { NButton, NCheckbox, NFormItem, NInput, NInputNumber, NSelect } from 'naive-ui'
import { actionResourceOptions } from '../../projects/quality-policy'
import type { ShotActionDraft } from '../repair.types'
/** 单镜头动作及资源证据的结构化编辑器。 */
defineProps<{
/** 保存或后台操作期间只读。 */
disabled: boolean
}>()
/** 调用方持有独立草稿,编辑器不改动原始检查点。 */
const draft = defineModel<ShotActionDraft>({ required: true })
/** 动作引用选项随草稿编号更新,非法旧引用由提交校验提示。 */
const actionOptions = computed(() =>
draft.value.requiredActions
.filter(item => item.id.trim())
.map(item => ({ value: item.id, label: `${item.id} · ${item.description || '待填写描述'}` }))
)
/** 动作种类。 */
const kindOptions = [
{ value: 'action', label: '动作' },
{ value: 'state', label: '状态' }
]
/** 动作复杂度。 */
const complexityOptions = [
{ value: 'low', label: '低' },
{ value: 'medium', label: '中' },
{ value: 'high', label: '高' }
]
/** 手部枚举。 */
const handOptions = [
{ value: 'left', label: '左手' },
{ value: 'right', label: '右手' },
{ value: 'both', label: '双手' }
]
/** 通用资源用途。 */
const usageOptions = [
{ value: 'support', label: '支撑' },
{ value: 'hold', label: '持有' },
{ value: 'move', label: '移动' },
{ value: 'interact', label: '交互' },
{ value: 'other', label: '其他' }
]
/** 添加待人工填写的动作,不自动编造编号或描述。 */
function addAction() {
draft.value.requiredActions.push({ id: '', description: '', kind: 'action', mustPerformInShot: true })
}
/** 添加待人工填写的动作阶段。 */
function addPhase() {
draft.value.durationPlanning.phases.push({ action: '', actionIds: [], estimatedSeconds: 0 })
}
/**
* 添加一项空资源证据,由用户明确选择对应动作和主体。
* @param index 目标阶段序号
* @param kind 手部或通用资源
*/
function addEvidence(index: number, kind: 'hand' | 'resource') {
const phase = draft.value.durationPlanning.phases[index]
if (!phase) return
if (kind === 'hand')
(phase.handOccupancy ??= []).push({ actionId: '', characterRef: '', hands: 'left', shareable: false })
else
(phase.resourceOccupancy ??= []).push({
actionId: '',
ownerRef: '',
resource: 'left_hand',
usage: 'hold',
shareable: false
})
}
/**
* 保留明确的持续对象,清空时删除可选字段,不提交非法空字符串。
* @param resource 当前资源证据
* @param value 用户输入的对象引用
*/
function updateContinuity(resource: ResourceOccupancy, value: string) {
if (value.trim()) resource.continuityRef = value
else delete resource.continuityRef
}
/**
* 只记录明确释放或交接;清空不猜测隐含事件。
* @param resource 当前资源证据
* @param value 用户选择的事件
*/
function updateTransition(resource: ResourceOccupancy, value: 'release' | 'transfer' | null) {
if (value) resource.transition = value
else delete resource.transition
}
</script>
<template>
<!-- 以下是必需动作、阶段时长与完整资源证据编辑模块 -->
<div class="shot-action-editor">
<section class="space-y-4" aria-label="必需动作">
<div class="flex flex-wrap items-center justify-between gap-3">
<h3 class="text-sm font-medium">必需动作</h3>
<NButton size="small" :disabled="disabled" @click="addAction">添加动作</NButton>
</div>
<div v-for="(action, index) in draft.requiredActions" :key="index" class="action-fields">
<NFormItem label="动作编号" :show-feedback="false"
><NInput
v-model:value="action.id"
:aria-label="`动作 ${index + 1} 编号`"
placeholder="动作编号"
:disabled="disabled"
/></NFormItem>
<NFormItem label="动作描述" :show-feedback="false"
><NInput
v-model:value="action.description"
:aria-label="`动作 ${index + 1} 描述`"
placeholder="具体动作描述"
:disabled="disabled"
/></NFormItem>
<NFormItem label="动作类型" :show-feedback="false"
><NSelect
v-model:value="action.kind"
:aria-label="`动作 ${index + 1} 类型`"
:options="kindOptions"
:disabled="disabled"
/></NFormItem>
<NCheckbox v-model:checked="action.mustPerformInShot" :disabled="disabled">本镜必须完成</NCheckbox>
<NButton
class="icon-button"
:aria-label="`移除动作 ${index + 1}`"
:disabled="disabled"
@click="draft.requiredActions.splice(index, 1)"
><template #icon><Trash2 :size="16" /></template
></NButton>
</div>
</section>
<!-- 以下是动作阶段编辑模块,同阶段动作视为同时发生 -->
<section class="space-y-4" aria-label="动作阶段">
<div class="flex flex-wrap items-center justify-between gap-3">
<h3 class="text-sm font-medium">动作阶段</h3>
<NButton size="small" :disabled="disabled" @click="addPhase">添加阶段</NButton>
</div>
<p class="text-xs leading-6 text-muted">同阶段动作同时发生。需要先后完成的动作请分开安排。</p>
<section
v-for="(phase, index) in draft.durationPlanning.phases"
:key="index"
class="action-phase space-y-4"
:aria-label="`动作阶段 ${index + 1}`"
>
<div class="flex flex-wrap items-center justify-between gap-3">
<h4 class="text-sm">阶段 {{ index + 1 }}</h4>
<NButton
class="icon-button"
:aria-label="`移除阶段 ${index + 1}`"
:disabled="disabled"
@click="draft.durationPlanning.phases.splice(index, 1)"
><template #icon><Trash2 :size="16" /></template
></NButton>
</div>
<NFormItem label="阶段描述"
><NInput v-model:value="phase.action" :aria-label="`阶段 ${index + 1} 描述`" :disabled="disabled"
/></NFormItem>
<div class="phase-fields">
<NFormItem label="阶段动作"
><NSelect
v-model:value="phase.actionIds"
multiple
:options="actionOptions"
:aria-label="`阶段 ${index + 1} 动作引用`"
:disabled="disabled"
/></NFormItem>
<NFormItem label="阶段时长(秒)"
><NInputNumber
:value="phase.estimatedSeconds"
@update:value="phase.estimatedSeconds = $event ?? 0"
:min="0.1"
:aria-label="`阶段 ${index + 1} 时长`"
:disabled="disabled"
/></NFormItem>
</div>
<div class="flex flex-wrap gap-3">
<NButton size="small" :disabled="disabled" @click="addEvidence(index, 'hand')">添加手部证据</NButton
><NButton size="small" :disabled="disabled" @click="addEvidence(index, 'resource')"
>添加资源证据</NButton
>
</div>
<div
v-for="(hand, handIndex) in phase.handOccupancy"
:key="`hand-${handIndex}`"
class="evidence-fields"
>
<NFormItem label="关联动作" :show-feedback="false"
><NSelect
v-model:value="hand.actionId"
:options="actionOptions"
aria-label="手部证据动作"
:disabled="disabled"
/></NFormItem>
<NFormItem label="主体引用" :show-feedback="false"
><NInput
v-model:value="hand.characterRef"
placeholder="主体引用"
aria-label="手部证据主体引用"
:disabled="disabled"
/></NFormItem>
<NFormItem label="手部" :show-feedback="false"
><NSelect
v-model:value="hand.hands"
:options="handOptions"
aria-label="使用的手"
:disabled="disabled"
/></NFormItem>
<NCheckbox v-model:checked="hand.shareable" :disabled="disabled">可共享</NCheckbox>
<NButton
class="icon-button"
:aria-label="`移除阶段 ${index + 1} 手部证据 ${handIndex + 1}`"
:disabled="disabled"
@click="phase.handOccupancy?.splice(handIndex, 1)"
><template #icon><Trash2 :size="16" /></template
></NButton>
</div>
<div
v-for="(resource, resourceIndex) in phase.resourceOccupancy"
:key="`resource-${resourceIndex}`"
class="evidence-fields"
>
<NFormItem label="关联动作" :show-feedback="false"
><NSelect
v-model:value="resource.actionId"
:options="actionOptions"
aria-label="资源证据动作"
:disabled="disabled"
/></NFormItem>
<NFormItem label="主体引用" :show-feedback="false"
><NInput
v-model:value="resource.ownerRef"
placeholder="主体引用"
aria-label="资源证据主体引用"
:disabled="disabled"
/></NFormItem>
<NFormItem label="占用资源" :show-feedback="false"
><NSelect
v-model:value="resource.resource"
:options="actionResourceOptions"
aria-label="占用资源"
:disabled="disabled"
/></NFormItem>
<NFormItem label="资源用途" :show-feedback="false"
><NSelect
v-model:value="resource.usage"
:options="usageOptions"
aria-label="资源用途"
:disabled="disabled"
/></NFormItem>
<NCheckbox v-model:checked="resource.shareable" :disabled="disabled">可共享</NCheckbox>
<NFormItem label="持续对象" :show-feedback="false"
><NInput
:value="resource.continuityRef || ''"
placeholder="仅填写已有明确对象引用"
:disabled="disabled"
@update:value="updateContinuity(resource, $event)"
/></NFormItem>
<NFormItem label="释放或交接" :show-feedback="false"
><NSelect
:value="resource.transition ?? null"
clearable
:options="[
{ label: '明确释放', value: 'release' },
{ label: '明确交接', value: 'transfer' }
]"
placeholder="未声明"
:disabled="disabled"
@update:value="updateTransition(resource, $event)"
/></NFormItem>
<NButton
class="icon-button"
:aria-label="`移除阶段 ${index + 1} 资源证据 ${resourceIndex + 1}`"
:disabled="disabled"
@click="phase.resourceOccupancy?.splice(resourceIndex, 1)"
><template #icon><Trash2 :size="16" /></template
></NButton>
</div>
</section>
</section>
<!-- 以下是镜头整体时长依据模块 -->
<section class="phase-fields" aria-label="整体时长规划">
<NFormItem label="动作复杂度"
><NSelect
v-model:value="draft.durationPlanning.complexity"
:options="complexityOptions"
:disabled="disabled"
/></NFormItem>
<NFormItem label="阶段衔接(秒)"
><NInputNumber
:value="draft.durationPlanning.transitionSeconds"
@update:value="draft.durationPlanning.transitionSeconds = $event ?? 0"
:min="0"
:disabled="disabled"
/></NFormItem>
<NFormItem label="建议总时长(秒)"
><NInputNumber
:value="draft.durationPlanning.recommendedDurationSeconds"
@update:value="draft.durationPlanning.recommendedDurationSeconds = $event ?? 0"
:min="0.1"
:disabled="disabled"
/></NFormItem>
</section>
<NFormItem label="时长规划依据"
><NInput
v-model:value="draft.durationPlanning.reason"
type="textarea"
:autosize="{ minRows: 2, maxRows: 6 }"
:disabled="disabled"
/></NFormItem>
</div>
</template>
<style scoped>
.shot-action-editor {
display: grid;
gap: 24px;
}
.action-fields,
.evidence-fields {
display: flex;
flex-wrap: wrap;
align-items: end;
gap: 12px;
}
.action-fields > :deep(.n-form-item),
.evidence-fields > :deep(.n-form-item) {
flex: 1 1 140px;
min-width: 0;
}
.phase-fields {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
gap: 16px;
}
.action-phase {
background: var(--app-subtle);
padding: 20px;
}
@media (max-width: 640px) {
.action-fields > :deep(.n-form-item),
.evidence-fields > :deep(.n-form-item) {
flex-basis: 100%;
}
}
</style>
File diff suppressed because it is too large. Load diff
@@ -1,16 +1,50 @@
<script setup lang="ts"> <script setup lang="ts">
import { NAlert, NSelect, NTag } from 'naive-ui' import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { computed, ref } from 'vue'
import { NButton, NSelect, NTag } from 'naive-ui'
import { computed, nextTick, ref, watch } from 'vue'
import { Clock3 } from '@lucide/vue' import { Clock3 } from '@lucide/vue'
import { EmptyState } from '../../../components/ui' import { EmptyState } from '../../../components/ui'
import type { EpisodePlan, EpisodeShots } from '../types' import type { EpisodePlan, EpisodeShots } from '../types'
import type { DiagnosisLocation } from '../diagnosis'
/** Episode → Beat → Shot 的分层查看,不提前加入下一条 graph 的导演字段。 */ /** Episode → Beat → Shot 的分层查看,不提前加入下一条 graph 的导演字段。 */
const props = defineProps<{ plans: EpisodePlan[]; episodes: EpisodeShots[] }>() const props = defineProps<{
const selected = ref<number>() /** 正式分集节拍规划。 */
plans: EpisodePlan[]
/** 正式分集镜头。 */
episodes: EpisodeShots[]
/** 拆解期间隐藏节拍和镜头诊断入口。 */
diagnosisDisabled?: boolean
}>()
/** 分镜卡片只负责发出诊断定位,确认及模型任务交由页面处理。 */
const emit = defineEmits<{ diagnose: [scope: DiagnosisLocation] }>()
/** 阅读与诊断共用的当前剧集编号。 */
const selected = defineModel<number>('episodeNo')
/** 分镜正文根节点,用于定位问题镜头。 */
const root = ref<HTMLElement | null>(null)
/** 最近定位的镜头或节拍标识,用于保留可见高亮。 */
const locatedPosition = ref('')
/** 定位来自当前明确的问题时才使用错误底色,普通查看不能推断问题。 */
const locatedProblem = ref(false)
/** 正文刷新后清除旧定位,避免已修订镜头继续沿用错误标记。 */
watch(
() => props.episodes,
() => {
locatedPosition.value = ''
locatedProblem.value = false
}
)
/** 定位样式的业务依据,与镜头坐标及诊断请求字段分开。 */
interface LocateOptions {
/** 是否来自当前实际问题,未提供时使用中性定位。 */
problem?: boolean
}
/** 兼容只有正式镜头而没有单独规划的历史结果。 */
const plans = computed(() => (props.plans.length ? props.plans : props.episodes.map(item => item.episodePlan))) const plans = computed(() => (props.plans.length ? props.plans : props.episodes.map(item => item.episodePlan)))
/** 选择器与正文统一使用最终规划编号;初次读取或当前剧集被移除时回退到第一集。 */ /** 选择器与正文统一使用最终规划编号;初次读取或当前剧集被移除时回退到第一集。 */
const plan = computed(() => plans.value.find(item => item.episodeNo === selected.value) ?? plans.value[0]) const plan = computed(() => plans.value.find(item => item.episodeNo === selected.value) ?? plans.value[0])
/** 当前剧集对应的正式镜头。 */
const episode = computed(() => props.episodes.find(item => item.episodeNo === plan.value?.episodeNo)) const episode = computed(() => props.episodes.find(item => item.episodeNo === plan.value?.episodeNo))
const purposeLabels: Record<string, string> = { const purposeLabels: Record<string, string> = {
establish: '建立场景', establish: '建立场景',
@@ -24,14 +58,36 @@ const purposeLabels: Record<string, string> = {
resolution: '收束', resolution: '收束',
hook: '钩子' hook: '钩子'
} }
/**
* 切换剧集并定位镜头,仅明确问题使用错误提示,尊重系统减少动画设置。
* @param location 正式剧集、节拍与镜头坐标
* @param options 当前定位是否确有问题
* @returns 列表更新并完成定位
*/
async function locate(location: DiagnosisLocation, options: LocateOptions = {}) {
selected.value = location.episodeNo
await nextTick()
const position = `${location.episodeNo}-${location.beatNo}${location.shotNo === undefined ? '' : `-${location.shotNo}`}`
const element = root.value?.querySelector<HTMLElement>(`[data-shot-position="${position}"]`)
if (!element) return
locatedPosition.value = position
locatedProblem.value = options.problem === true
element.focus({ preventScroll: true })
element.scrollIntoView({
block: 'center',
behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth'
})
}
/** 仅暴露诊断问题定位能力。 */
defineExpose({ locate })
</script> </script>
<template> <template>
<div class="breakdown-storyboard"> <div ref="root" class="breakdown-storyboard">
<div v-if="plan || $slots.actions" class="breakdown-storyboard-toolbar"> <!-- 以下是当前剧集选择与分镜数量模块 -->
<label v-if="plan" class="breakdown-episode-picker" <div v-if="plan" class="breakdown-storyboard-toolbar">
><span>选择剧集</span <div class="breakdown-episode-picker">
><NSelect <NSelect
aria-label="选择分镜剧集" aria-label="选择分镜剧集"
:value="plan.episodeNo" :value="plan.episodeNo"
@update:value="selected = $event" @update:value="selected = $event"
@@ -41,16 +97,18 @@ const purposeLabels: Record<string, string> = {
value: item.episodeNo value: item.episodeNo
})) }))
" "
></NSelect ></NSelect>
></label> </div>
<div class="breakdown-storyboard-summary"> <div class="breakdown-storyboard-summary">
<span v-if="plan" class="breakdown-storyboard-count" <span v-if="plan" class="breakdown-storyboard-count"
>{{ plan.beats.length }} 个节拍 · >{{ plan.beats.length }} 个节拍 ·
{{ episode?.beatShots.reduce((sum, beat) => sum + beat.shots.length, 0) ?? 0 }} 个镜头</span {{ episode?.beatShots.reduce((sum, beat) => sum + beat.shots.length, 0) ?? 0 }} 个镜头</span
> >
<slot name="actions" />
</div> </div>
</div> </div>
<!-- 以下是当前集诊断摘要插槽,完整结果在居中弹窗展示 -->
<slot name="diagnosis" />
<!-- 以下是当前集节拍与分镜正文模块 -->
<template v-if="plan"> <template v-if="plan">
<div v-if="plan.storyGoal || plan.emotionalArc" class="mb-7 surface-inset p-4"> <div v-if="plan.storyGoal || plan.emotionalArc" class="mb-7 surface-inset p-4">
<p v-if="plan.storyGoal" class="font-medium">{{ plan.storyGoal }}</p> <p v-if="plan.storyGoal" class="font-medium">{{ plan.storyGoal }}</p>
@@ -58,21 +116,48 @@ const purposeLabels: Record<string, string> = {
{{ plan.emotionalArc }} {{ plan.emotionalArc }}
</p> </p>
</div> </div>
<NAlert v-if="!episode" type="info" :show-icon="false" class="mb-5"> <ContextNotice v-if="!episode" type="info" :show-icon="false" class="mb-5">
本集已完成节拍规划,镜头尚未生成。请等待进度更新,或在确认中断后使用“补齐缺失镜头”。 本集镜头尚未生成。若任务已中断,可继续整理镜头。
</NAlert> </ContextNotice>
<section v-for="beat in plan.beats" :key="beat.beatNo" class="beat-section"> <section
v-for="beat in plan.beats"
:key="beat.beatNo"
class="beat-section"
tabindex="-1"
:data-shot-position="`${plan.episodeNo}-${beat.beatNo}`"
:class="{
'diagnosis-located': locatedPosition === `${plan.episodeNo}-${beat.beatNo}`,
'diagnosis-problem-located':
locatedProblem && locatedPosition === `${plan.episodeNo}-${beat.beatNo}`
}"
>
<div class="beat-heading"> <div class="beat-heading">
<span class="beat-number">{{ String(beat.beatNo).padStart(2, '0') }}</span> <span class="beat-number">{{ String(beat.beatNo).padStart(2, '0') }}</span>
<h3 class="text-sm font-semibold">{{ beat.title }}</h3> <h3 class="text-sm font-semibold">{{ beat.title }}</h3>
<NTag size="small" :bordered="false">{{ purposeLabels[beat.purpose] || beat.purpose }}</NTag> <NTag size="small" :bordered="false">{{ purposeLabels[beat.purpose] ?? '用途待确认' }}</NTag>
<NButton
v-if="plan && !diagnosisDisabled"
size="tiny"
text
class="diagnose-hover-action ml-auto"
aria-label="诊断当前节拍"
@click="emit('diagnose', { episodeNo: plan.episodeNo, beatNo: beat.beatNo })"
>AI 诊断</NButton
>
</div> </div>
<p class="mb-4 mt-3 text-sm leading-6 text-muted">{{ beat.description }}</p> <p class="mb-4 mt-3 text-sm leading-6 text-muted">{{ beat.description }}</p>
<div class="space-y-3"> <div class="space-y-3">
<article <article
v-for="shot in episode?.beatShots.find(item => item.beatNo === beat.beatNo)?.shots ?? []" v-for="shot in episode?.beatShots.find(item => item.beatNo === beat.beatNo)?.shots ?? []"
:key="shot.shotNo" :key="shot.shotNo"
class="shot-row" class="shot-row group"
tabindex="-1"
:data-shot-position="`${plan.episodeNo}-${beat.beatNo}-${shot.shotNo}`"
:class="{
'diagnosis-located': locatedPosition === `${plan.episodeNo}-${beat.beatNo}-${shot.shotNo}`,
'diagnosis-problem-located':
locatedProblem && locatedPosition === `${plan.episodeNo}-${beat.beatNo}-${shot.shotNo}`
}"
> >
<div class="shot-label"> <div class="shot-label">
镜头 {{ String(shot.shotNo).padStart(2, '0') 镜头 {{ String(shot.shotNo).padStart(2, '0')
@@ -81,7 +166,24 @@ const purposeLabels: Record<string, string> = {
> >
</div> </div>
<div class="min-w-0 flex-1"> <div class="min-w-0 flex-1">
<h4 class="text-sm font-medium">{{ shot.title }}</h4> <div class="flex items-center justify-between gap-3">
<h4 class="text-sm font-medium">{{ shot.title }}</h4>
<NButton
v-if="plan && !diagnosisDisabled"
size="tiny"
text
class="diagnose-hover-action"
aria-label="诊断当前镜头"
@click="
emit('diagnose', {
episodeNo: plan.episodeNo,
beatNo: beat.beatNo,
shotNo: shot.shotNo
})
"
>AI 诊断</NButton
>
</div>
<p class="mt-2 text-sm leading-7">{{ shot.description }}</p> <p class="mt-2 text-sm leading-7">{{ shot.description }}</p>
<p class="mt-2 text-xs leading-6 text-muted">视觉重点 · {{ shot.visualFocus }}</p> <p class="mt-2 text-xs leading-6 text-muted">视觉重点 · {{ shot.visualFocus }}</p>
<div class="mt-3 flex flex-wrap gap-2"> <div class="mt-3 flex flex-wrap gap-2">
@@ -99,23 +201,46 @@ const purposeLabels: Record<string, string> = {
</div> </div>
</section> </section>
</template> </template>
<EmptyState <EmptyState v-else title="分镜规划尚未生成" description="整理主体后会逐集生成镜头。" />
v-else
title="分镜规划尚未生成"
description="完成主体整理后,工作流会先规划每集的剧情节拍,再逐集生成镜头。"
/>
</div> </div>
</template> </template>
<style> <style>
/* 本组件专属布局与 Naive 内部结构覆盖。 */ /* 本组件专属布局与 Naive 内部结构覆盖。 */
@reference "../../../styles/styles.css"; @reference "../../../styles/styles.css";
/* 普通定位仅使用中性底面,明确的问题另用柔和红色,均不改变行高和间距。 */
.breakdown-storyboard .diagnosis-located {
background: var(--app-control-hover);
outline: none;
}
.breakdown-storyboard .diagnosis-problem-located {
background: var(--app-control-hover);
box-shadow: inset 2px 0 color-mix(in srgb, var(--app-danger) 45%, transparent);
}
.beat-section { .beat-section {
@apply mt-[25px] pt-[23px]; @apply mt-[25px] pt-[23px];
} }
.beat-heading { .beat-heading {
@apply flex items-center gap-2.5; @apply flex items-center gap-2.5;
} }
.diagnose-hover-action {
opacity: 0;
pointer-events: none;
transition: opacity 150ms ease;
}
.beat-heading:hover .diagnose-hover-action,
.beat-heading:focus-within .diagnose-hover-action,
.shot-row:hover .diagnose-hover-action,
.shot-row:focus-within .diagnose-hover-action {
opacity: 1;
pointer-events: auto;
}
@media (hover: none) {
.diagnose-hover-action {
opacity: 1;
pointer-events: auto;
}
}
.beat-number { .beat-number {
@apply text-muted font-mono text-[11px]; @apply text-muted font-mono text-[11px];
} }
@@ -134,19 +259,19 @@ const purposeLabels: Record<string, string> = {
@apply min-w-0; @apply min-w-0;
} }
.breakdown-storyboard-toolbar { .breakdown-storyboard-toolbar {
@apply flex items-center justify-between flex-wrap gap-y-3 gap-x-6 mb-4; /* 与主体列表保持一致:选择控件和统计文字靠左相邻排列。 */
@apply flex items-center justify-start flex-wrap gap-y-2.5 gap-x-3;
margin-bottom: var(--app-content-gap);
} }
.breakdown-episode-picker { .breakdown-episode-picker {
@apply flex items-center gap-3 flex-[0_1_420px] min-w-0 text-sm; /* 下拉框直接展示剧集名称,不再额外占用可见标签的宽度。 */
} @apply flex flex-[0_1_260px] min-w-0;
.breakdown-episode-picker > span {
@apply shrink-0 whitespace-nowrap;
} }
.breakdown-episode-picker .n-select { .breakdown-episode-picker .n-select {
@apply flex-1 min-w-0; @apply flex-1 min-w-0;
} }
.breakdown-storyboard-summary { .breakdown-storyboard-summary {
@apply flex items-center flex-wrap gap-y-2 gap-x-5 min-h-[34px] ml-auto; @apply flex shrink-0 items-center min-h-[34px];
} }
.breakdown-storyboard-count { .breakdown-storyboard-count {
@apply text-muted text-xs whitespace-nowrap; @apply text-muted text-xs whitespace-nowrap;
@@ -154,4 +279,13 @@ const purposeLabels: Record<string, string> = {
.breakdown-storyboard-summary .text-button { .breakdown-storyboard-summary .text-button {
@apply min-h-[34px] whitespace-nowrap; @apply min-h-[34px] whitespace-nowrap;
} }
@media (max-width: 800px) {
/* 手机端与道具搜索行一致,控件自适应剩余宽度,统计文字紧邻显示。 */
.breakdown-storyboard-toolbar {
@apply flex-nowrap gap-2;
}
.breakdown-episode-picker {
@apply flex-1;
}
}
</style> </style>
@@ -0,0 +1,253 @@
<script setup lang="ts">
import { computed, onScopeDispose, ref, watch } from 'vue'
import { NButton } from 'naive-ui'
import { AppDialog } from '../../../components/ui'
import { breakdownApi } from '../api'
import type { Checkpoint } from '../../workflows/types'
import type { QualityRepairCandidates, QualityRepairPlan, QualityRepairTarget, ShotActionDraft } from '../repair.types'
import { actionDraft, actionDraftIssue, qualityIssueLabel } from '../repair'
import { errorMessage } from '../../../lib/http'
import { getOperation, runOperation } from '../../workflows/operations'
import ShotActionEditor from './ShotActionEditor.vue'
import ConfirmAction from '../../workflows/ConfirmAction.vue'
/** 未入库镜头的质量门禁修订面板,正式资产仍使用独立接口保护。 */
const props = defineProps<{
/** 当前项目编号。 */
projectId: string
/** 当前最新原始检查点。 */
checkpoint?: Checkpoint
/** 活动任务、读取错误等外部禁用条件。 */
disabled: boolean
}>()
/** 保存后读取新检查点,不能直接宣称已正式入库。 */
const emit = defineEmits<{ refresh: [] }>()
/** 实际修复计划。 */
const plan = ref<QualityRepairPlan | null>(null)
/** 实际局部修复候选。 */
const candidates = ref<QualityRepairCandidates | null>(null)
/** 只读查询状态。 */
const loading = ref(false)
/** 查询或版本错误。 */
const error = ref('')
/** 当前人工选择的修订目标。 */
const target = ref<QualityRepairTarget | null>(null)
/** 用户编辑的独立草稿。 */
const draft = ref<ShotActionDraft | null>(null)
/** 编辑弹窗可见性。 */
const open = ref(false)
/** 草稿修订号,任何修改均撤销先前确认。 */
const draftVersion = ref(0)
/** 项目级活动操作锁。 */
const operation = computed(() => getOperation(props.projectId))
/** 计划必须与当前原始检查点完全一致。 */
const current = computed(() => !!plan.value?.checkpointId && plan.value.checkpointId === props.checkpoint?.checkpointId)
/** 当前镜头的有效候选指纹与建议。 */
const candidate = computed(() =>
target.value && candidates.value && candidates.value.checkpointId === plan.value?.checkpointId
? candidates.value.candidates.find(
item =>
item.shotId ===
`episode:${target.value!.episodeNo}/beat:${target.value!.beatNo}/shot:${target.value!.shotNo}`
)
: undefined
)
/** 草稿字段校验问题。 */
const issue = computed(() => (draft.value ? actionDraftIssue(draft.value) : '请先选择待修订镜头。'))
/** 当前编辑目标的可读名称。 */
const targetLabel = computed(() =>
target.value
? `第 ${target.value.episodeNo} 集 · 节拍 ${target.value.beatNo} · 镜头 ${target.value.shotNo}`
: '镜头修订'
)
/** 请求版本控制,关闭或切换项目后不回填旧结果。 */
let version = 0
/** 当前查询取消控制器。 */
let controller: AbortController | undefined
/** 按需读取真实修复计划与有效候选,不触发模型。 */
async function load() {
if (loading.value || props.disabled) return
const currentVersion = ++version
const id = props.projectId
controller?.abort()
controller = new AbortController()
loading.value = true
error.value = ''
plan.value = null
candidates.value = null
try {
const [nextPlan, nextCandidates] = await Promise.all([
breakdownApi.qualityRepairPlan(id, controller.signal),
breakdownApi.qualityRepairCandidates(id, controller.signal)
])
if (version !== currentVersion) return
if (nextPlan.projectId !== id || nextCandidates.projectId !== id)
throw new Error('修复清单所属项目不一致,请刷新。')
plan.value = nextPlan
candidates.value = nextCandidates
if (nextPlan.repairPlan.length && nextPlan.checkpointId !== props.checkpoint?.checkpointId)
throw new Error('拆解结果已更新,请先刷新候选状态,再重新读取修复清单。')
} catch (cause) {
if (version === currentVersion) error.value = errorMessage(cause)
} finally {
if (version === currentVersion) loading.value = false
}
}
/**
* 从对应版本的原始镜头创建完整草稿,不用历史诊断重建动作证据。
* @param item 当前修复计划中的镜头坐标
*/
function edit(item: QualityRepairTarget) {
if (!current.value || props.disabled) return
const shot = props.checkpoint?.state.storyboardEpisodeShots
?.find(episode => episode.episodeNo === item.episodeNo)
?.beatShots.find(beat => beat.beatNo === item.beatNo)
?.shots.find(value => value.shotNo === item.shotNo)
if (!shot) {
error.value = '当前版本缺少镜头原始数据,请刷新拆解结果。'
return
}
target.value = { ...item }
draft.value = actionDraft(shot)
open.value = true
}
/** 人工确认后只写入新的检查点,恢复资格采用服务端结果。 */
async function save() {
if (
!current.value ||
props.disabled ||
operation.value.pending ||
issue.value ||
!target.value ||
!draft.value ||
!plan.value?.checkpointId
)
return
const id = props.projectId
const input = {
...actionDraft(draft.value),
episodeNo: target.value.episodeNo,
beatNo: target.value.beatNo,
shotNo: target.value.shotNo,
expectedCheckpointId: plan.value.checkpointId,
...(candidate.value
? { expectedFingerprint: candidate.value.expectedFingerprint, source: 'candidate' as const }
: { source: 'manual' as const })
}
const success = await runOperation(
id,
'正在保存镜头人工修订',
async () => {
const result = await breakdownApi.repairQualityShot(id, input)
if (result.projectId !== id || !result.checkpointId || result.checkpointId === input.expectedCheckpointId)
throw new Error('未取得新的修订版本,请刷新确认。')
return result
},
result => ({
type: result.canResumeBreakdown ? 'success' : 'warning',
content: result.canResumeBreakdown
? '人工修订已保存,可继续恢复拆解。正式数据尚未提交。'
: '人工修订已保存,仍有待处理质量问题。'
})
)
if (props.projectId !== id) return
if (success) {
open.value = false
plan.value = null
candidates.value = null
} else {
plan.value = null
error.value = '保存未成功,请刷新拆解结果并重新读取修复清单。'
}
emit('refresh')
}
watch(
draft,
() => {
draftVersion.value++
},
{ deep: true, flush: 'sync' }
)
watch(
() => [props.projectId, props.checkpoint?.checkpointId],
() => {
version++
controller?.abort()
loading.value = false
plan.value = null
candidates.value = null
target.value = null
draft.value = null
open.value = false
error.value = ''
}
)
onScopeDispose(() => {
version++
controller?.abort()
})
</script>
<template>
<!-- 以下是未入库分镜质量门禁的按需修订入口 -->
<section class="workspace-panel space-y-4" aria-label="分镜质量修订">
<div class="flex flex-wrap items-center justify-between gap-3">
<h3 class="text-sm font-medium">分镜质量修订</h3>
<NButton :loading="loading" :disabled="disabled || loading" @click="load">读取修复清单</NButton>
</div>
<p class="text-xs leading-6 text-muted">仅修订尚未入库的镜头,保存后再恢复拆解。</p>
<p v-if="error" role="alert" class="text-xs leading-6 text-danger">{{ error }}</p>
<p v-if="plan && !plan.repairPlan.length && !error" role="status" class="text-xs text-muted">
暂无可人工修订的镜头。未检查的镜头仍待确认。
</p>
<article
v-for="item in plan?.repairPlan"
:key="`${item.episodeNo}-${item.beatNo}-${item.shotNo}`"
class="flex flex-wrap items-center justify-between gap-3"
>
<div class="min-w-0">
<p class="text-sm">第 {{ item.episodeNo }} 集 · 节拍 {{ item.beatNo }} · 镜头 {{ item.shotNo }}</p>
<p class="mt-2 break-words text-xs text-muted">
{{ item.blockingCodes.map(qualityIssueLabel).join('、') }}
</p>
</div>
<NButton :disabled="disabled || !current" @click="edit(item)">人工修订</NButton>
</article>
</section>
<!-- 以下是版本化镜头人工修订模块,沿用公共弹窗底栏与间距 -->
<AppDialog
v-model:open="open"
:title="targetLabel"
description="可免费修订动作顺序,保存时会检查本镜。"
:busy="operation.pending"
wide
>
<div v-if="draft" class="space-y-5">
<p v-if="candidate" class="text-xs leading-6 text-muted">
{{ candidate.suggestion }} {{ candidate.blockingReasons.join(';') }}
</p>
<ShotActionEditor v-model="draft" :disabled="disabled || operation.pending || !current" />
<p v-if="issue" role="status" class="text-xs leading-6 text-danger">{{ issue }}</p>
<p
v-if="operation.error && operation.label === '正在保存镜头人工修订'"
role="alert"
class="text-xs leading-6 text-danger"
>
{{ operation.error }}
</p>
</div>
<template #footer
><NButton :disabled="operation.pending" @click="open = false">取消</NButton
><ConfirmAction
:key="draftVersion"
label="保存人工修订"
description="保存动作后,请继续拆解并提交结果。若版本已变或检查未通过,请先处理。"
:disabled="disabled || operation.pending || !current || !!issue"
@confirm="save"
/></template>
</AppDialog>
</template>
@@ -25,8 +25,8 @@ const filtered = computed(() =>
<template> <template>
<div class="subject-list"> <div class="subject-list">
<!-- 以下是主体搜索 --> <!-- 以下是有主体数据时的搜索与统计,搜索无匹配结果时仍保留操作入口 -->
<div class="subject-list-toolbar"> <div v-if="subjects.length" class="subject-list-toolbar">
<NInput <NInput
class="subject-list-search" class="subject-list-search"
placeholder="搜索名称或引用" placeholder="搜索名称或引用"
@@ -80,7 +80,8 @@ const filtered = computed(() =>
>查看形态图片/生图</RouterLink >查看形态图片/生图</RouterLink
> >
</div> </div>
<NCollapse class="subject-details mt-4" :default-expanded-names="['details']" <!-- 以下是默认收起的外观描述与形态模块,点击后展开详情 -->
<NCollapse class="subject-details mt-4"
><NCollapseItem name="details" ><NCollapseItem name="details"
><template #header ><template #header
>外观描述与形态 >外观描述与形态
@@ -115,7 +116,7 @@ const filtered = computed(() =>
<EmptyState <EmptyState
v-else v-else
:title="subjects.length ? '没有匹配的主体' : '尚无主体结果'" :title="subjects.length ? '没有匹配的主体' : '尚无主体结果'"
description="主体会在抽取、合并与档案整理完成后出现在这里。若未启用该模块,则不会生成此类主体。" description="启用此模块并完成拆解后,即可查看主体。"
/> />
</div> </div>
</template> </template>
+216
View File
@@ -0,0 +1,216 @@
import { userFacingText } from '../../lib/user-facing-text'
import type { DiagnosisPreflight, DiagnosisHandAudit } from './diagnosis.types'
import type { LegacyActionDiagnosisResults } from './types'
/** 诊断及定位共用的镜头坐标。 */
export interface DiagnosisLocation {
/** 正式剧集编号。 */
episodeNo: number
/** 集内节拍编号。 */
beatNo: number
/** 节拍内镜头编号;省略时表示整个节拍。 */
shotNo?: number
}
/** 诊断范围按层级约束,避免全项目请求遗留镜头条件。 */
export type DiagnosisScope =
| { /** 全项目范围。 */ kind: 'project' }
| { /** 单集范围。 */ kind: 'episode'; /** 正式集号。 */ episodeNo: number }
| ({ /** 单节拍范围。 */ kind: 'beat' } & Omit<DiagnosisLocation, 'shotNo'>)
| ({ /** 单镜头范围,必须包含镜头编号。 */ kind: 'shot' } & Required<DiagnosisLocation>)
/**
* 从后端整集或全项目结果中取得当前诊断范围。
* @param shots 后端镜头诊断记录
* @param scope 当前诊断范围
* @returns 当前范围内的镜头记录
*/
export function scopeDiagnosisShots(shots: LegacyActionDiagnosisResults['shots'], scope: DiagnosisScope) {
return shots.filter(
shot =>
scope.kind === 'project' ||
(shot.episodeNo === scope.episodeNo &&
(scope.kind === 'episode' ||
(shot.beatNo === scope.beatNo && (scope.kind === 'beat' || shot.shotNo === scope.shotNo))))
)
}
/**
* 按镜头真实诊断状态重新统计,缺少证据不能算作检查通过。
* @param shots 当前范围镜头记录
* @returns 各状态镜头数量
*/
export function summarizeDiagnosis(shots: LegacyActionDiagnosisResults['shots']) {
const counts = { total: shots.length, conflict: 0, clear: 0, insufficient: 0, invalid: 0, stale: 0, pending: 0 }
for (const shot of shots) counts[diagnosisCountKeys[shot.status]]++
return counts
}
/**
* 生成与已确认范围一致的批量诊断请求。
* @param scope 已预览的诊断范围
* @param concurrency 模型任务并发数
* @returns 后端批量诊断请求参数
*/
export function diagnosisInput(scope: DiagnosisScope, concurrency: number) {
return {
confirmed: true as const,
concurrency,
...(scope.kind !== 'project' ? { episodeNo: scope.episodeNo } : {}),
...(scope.kind === 'beat' || scope.kind === 'shot' ? { beatNo: scope.beatNo } : {}),
...(scope.kind === 'shot' ? { shotNo: scope.shotNo } : {})
}
}
/** 后端诊断状态对应的统计字段。 */
const diagnosisCountKeys = {
conflict_found: 'conflict',
no_conflict_found: 'clear',
insufficient_evidence: 'insufficient',
invalid_evidence: 'invalid',
stale: 'stale',
not_diagnosed: 'pending'
} as const
/** 状态始终保留文字,避免仅通过颜色区分问题。 */
export const diagnosisStatusLabels = {
conflict_found: '动作冲突',
no_conflict_found: '未发现冲突',
insufficient_evidence: '证据不足',
invalid_evidence: '证据无效',
stale: '诊断过期',
not_diagnosed: '暂无 AI 复查记录'
} as const
/**
* 来源或规则检查的内部代码使用中文指引,未知原因也不直接展示内部标识。
* @param code 服务返回的阻断原因
* @returns 可操作的中文说明
*/
export function diagnosisReason(code: string): string {
const labels: Record<string, string> = {
QUALITY_POLICY_NOT_CONFIRMED: '请先确认项目质量规则。',
QUALITY_POLICY_VERSION_CONFLICT: '质量规则已更新,请重新核对。',
QUALITY_POLICY_SNAPSHOT_UNKNOWN: '本次 AI 复查缺少可信的质量规则记录,暂时不能启动。请在制作前检查中核对来源。',
QUALITY_POLICY_SNAPSHOT_INVALID:
'本次 AI 复查无法使用现有质量规则记录,暂时不能启动。请在制作前检查中核对来源。',
QUALITY_POLICY_SNAPSHOT_STALE: '分镜与质量规则版本不一致,请核对最新拆解结果。',
STORYBOARD_SOURCE_MISMATCH: '镜头与已提交分镜不一致,请刷新最新结果后核对。'
}
return labels[code.split(':')[0]!] ?? userFacingText(code, '当前镜头暂不满足检查条件,请刷新后核对。')
}
/**
* 单镜头预检查只能提供当前范围的执行前提,不替代实际执行中的再次检查。
* @param value 只读预检查
* @param projectId 当前项目
* @param shotId 当前正式镜头
* @returns 是否可以进入费用确认
*/
export function diagnosisCanStart(value: DiagnosisPreflight | null, projectId: string, shotId: string): boolean {
return (
!!value &&
value.projectId === projectId &&
value.shotId === shotId &&
value.eligibleForFurtherValidation === true &&
value.shouldDiagnose === true &&
value.existingValid === false &&
Array.isArray(value.errors) &&
value.errors.length === 0 &&
value.requiresExecutionValidation === true &&
Number.isSafeInteger(value.policyRevision) &&
value.policyRevision! >= 0 &&
typeof value.policyFingerprint === 'string' &&
/^[a-f\d]{64}$/.test(value.policyFingerprint) &&
value.willCallModel === false &&
value.willModifyAssets === false
)
}
/**
* 仅将当前明确冲突或实时结构化证据问题列为需要修复,过期诊断与未复查不构成修复结论。
* @param shot 当前镜头诊断
* @returns 当前镜头是否有明确需要处理的问题
*/
export function diagnosisHasAttention(shot: LegacyActionDiagnosisResults['shots'][number]): boolean {
const audit = shot.resourceAudit ?? shot.handAudit
if (diagnosisAuditHasProblem(audit)) return true
const current =
shot.status !== 'stale' &&
shot.shotStale !== true &&
shot.policyStatus !== 'stale' &&
shot.policyStatus !== 'unknown'
return (
current &&
(shot.status === 'conflict_found' || !!shot.bodyMotionFindings?.some(item => item.status === 'conflict'))
)
}
/**
* 区分实时检查中明确的问题和单纯未填写记录,未覆盖不作为错误。
* @param audit 当前动作占用检查摘要
* @returns 是否存在明确冲突或不可用的结构化信息
*/
export function diagnosisAuditHasProblem(audit: DiagnosisHandAudit | undefined): boolean {
return (
!!audit &&
(audit.issueCount > 0 || ['conflict_found', 'invalid_evidence', 'invalid_snapshot'].includes(audit.status))
)
}
/**
* 缺少 AI 记录、旧诊断或不确定建议归为可选复查,不与当前修复问题混在一起。
* @param shot 当前镜头诊断及实时证据摘要
* @returns 是否可在独立的可选复查列表中查看
*/
export function diagnosisOptionalReview(shot: LegacyActionDiagnosisResults['shots'][number]): boolean {
const audit = shot.resourceAudit ?? shot.handAudit
return (
!diagnosisHasAttention(shot) &&
(shot.status !== 'no_conflict_found' ||
shot.requiresPostRepairDiagnosis === true ||
!!shot.bodyMotionFindings?.length ||
(!!audit && ['partial_evidence', 'insufficient_evidence'].includes(audit.status)))
)
}
/**
* 没有可计算的覆盖范围时只说明尚无结论,不将零动作数描述成新问题。
* @param audit 实时动作占用摘要
* @param handOnly 是否为旧手部检查
* @returns 当前可展示的覆盖结论
*/
export function diagnosisAuditLabel(audit: DiagnosisHandAudit, handOnly = false): string {
if (audit.expectedActionCount === 0 && audit.issueCount === 0 && audit.status === 'insufficient_evidence')
return handOnly ? '手部占用检查尚无覆盖结论' : '动作占用检查尚无覆盖结论'
return (handOnly ? handAuditLabels : resourceAuditLabels)[audit.status]
}
/** 免费手部检查的结论,不能据此标记 AI 已通过。 */
export const handAuditLabels: Record<DiagnosisHandAudit['status'], string> = {
insufficient_evidence: '手部记录尚未覆盖',
invalid_snapshot: '镜头记录不完整',
invalid_evidence: '手部证据无效',
conflict_found: '手部仍有冲突',
partial_evidence: '部分动作尚未覆盖手部检查',
no_conflict_found: '现有手部证据未发现冲突'
}
/** 全身动作维度的中文说明。 */
export const bodyDimensionLabels: Record<string, string> = {
feet: '脚部动作',
balance: '身体平衡',
gaze: '视线方向',
prop_interaction: '道具交互',
physical_continuity: '动作衔接',
cross_shot_continuity: '镜头间衔接'
}
/** 通用动作资源结论不冒充覆盖全部剧情语义。 */
export const resourceAuditLabels: typeof handAuditLabels = {
insufficient_evidence: '动作记录尚未覆盖',
invalid_snapshot: '镜头记录不完整',
invalid_evidence: '动作占用证据无效',
conflict_found: '动作占用仍有冲突',
partial_evidence: '部分动作占用记录尚未覆盖',
no_conflict_found: '现有动作占用证据未发现冲突'
}
+128
View File
@@ -0,0 +1,128 @@
import type { StoryboardHandRepairPreview } from './types'
/** 单镜头只读检查,实际诊断仍需再次核对来源。 */
export interface DiagnosisPreflight {
/** 所属项目。 */
projectId: string
/** 正式镜头编号。 */
shotId: string
/** 剧集编号。 */
episodeNo: number
/** 剧情段落编号。 */
beatNo: number
/** 段落内镜头编号。 */
shotNo: number
/** 已提交分镜采用的规则修订。 */
policyRevision: number | null
/** 已提交规则内容版本。 */
policyFingerprint: string | null
/** 当前可复用的历史诊断。 */
existingDiagnosisId: string | null
/** 是否已有同规则及镜头版本的有效诊断。 */
existingValid: boolean
/** 是否可以继续执行检查。 */
eligibleForFurtherValidation: boolean
/** 阻断原因,展示时映射中文。 */
errors: string[]
/** 执行时必须再次检查。 */
requiresExecutionValidation: true
/** 是否确实需要新诊断。 */
shouldDiagnose: boolean
/** 当前查询不调用模型。 */
willCallModel: false
/** 当前查询不修改资产。 */
willModifyAssets: false
}
/** 全身动作疑点,不确定结论保持待复核。 */
export interface BodyMotionFinding {
/** 检查维度,兼容未来新增维度。 */
dimension: string
/** 模型建议的结论。 */
status: 'conflict' | 'needs_review' | 'insufficient_evidence'
/** 问题说明。 */
description: string
/** 当前镜头的原文证据。 */
quote: string
/** 可选的关联镜头编号。 */
relatedShotNo?: number
}
/** 不调用模型的手部证据复检,与 AI 诊断独立。 */
export interface DiagnosisHandAudit {
/** 证据完整性或冲突结论。 */
status:
| 'insufficient_evidence'
| 'invalid_snapshot'
| 'invalid_evidence'
| 'conflict_found'
| 'partial_evidence'
| 'no_conflict_found'
/** 检出的冲突数。 */
issueCount: number
/** 有效证据数量。 */
evidenceCount: number
/** 需要覆盖的必需动作数。 */
expectedActionCount: number
/** 已有证据覆盖的必需动作数。 */
coveredActionCount: number
/** 覆盖率,无法计算时为空。 */
coverage: number | null
}
/** 诊断历史保留原始结果,分别标注镜头与规则是否过期。 */
export interface DiagnosisHistory {
/** 所属项目。 */
projectId: string
/** 正式镜头编号。 */
shotId: string
/** 本次返回条数。 */
count: number
/** 不可变诊断记录。 */
revisions: Array<{
/** 诊断编号。 */
id: string
/** 原始诊断结论。 */
status: string
/** 当前有效结论。 */
effectiveStatus: string
/** 镜头是否变化。 */
shotStale: boolean
/** 规则对应情况。 */
policyStatus: 'unknown' | 'current' | 'stale'
/** 任一版本过期均不可作为当前结果。 */
stale: boolean
/** 诊断使用的规则修订。 */
qualityPolicyRevision: number | null
/** 诊断模型品牌。 */
modelName: string
/** 完整问题证据仅供核对,不用于生成修订草稿。 */
issuesJson: unknown
/** 生成时间。 */
createdAt: string
}>
}
/** 指定诊断进入人工修订前的只读条件,不代表可直接覆盖镜头。 */
export interface DiagnosisRepairReadiness {
/** 所属项目。 */
projectId: string
/** 正式镜头编号。 */
shotId: string
/** 本次核对的诊断编号。 */
diagnosisId: string
/** 已通过服务检查的具体修复候选。 */
repairCandidates: StoryboardHandRepairPreview['candidates']
/** 具备人工修订前提。 */
eligible: boolean
/** 未满足的安全条件。 */
blockingReasons: string[]
/** 必须由用户复核。 */
requiresManualReview: true
/** 不允许一键直接应用。 */
canApplyDirectly: false
/** 查询不调用模型。 */
willCallModel: false
/** 查询不修改资产。 */
willModifyAssets: false
}
+328
View File
@@ -0,0 +1,328 @@
import type { BreakdownResult, BreakdownState, ShotValidation } from './types'
import type { CandidateActionBlock, CandidateRevalidation } from './candidate.types'
import type { Checkpoint } from '../workflows/types'
import { candidateCommitIssue } from './candidate'
/** 明确区分当前候选、已提交正式结果和仅供回看的历史快照。 */
export interface BreakdownSource {
/** 当前数据来源。 */
kind: 'candidate' | 'formal' | 'history' | 'empty'
/** 当前原始检查点。 */
checkpoint?: Checkpoint
/** 同一检查点归一化后的结果,禁止跨版本拼装资产。 */
state: BreakdownState | null
/** 另外保存的正式结果,绝不拿候选冒充正式数据。 */
formal?: Checkpoint
}
/** 带类型、位置和状态的问题行。 */
export interface BreakdownProblem {
/** 去重标识。 */
key: string
/** 问题分类。 */
type: 'structure' | 'subject' | 'binding' | 'action' | 'pending' | 'workflow'
/** 后端位置,缺失时不提供镜头定位。 */
location?: ShotValidation['issues'][number]
/** 原始描述。 */
message: string
/** 原始阻断代码。 */
codes: string[]
}
/** 全页面共用的质量状态,审核通过不代表允许提交。 */
export interface BreakdownQuality {
/** 当前数据来源。 */
source: BreakdownSource['kind']
/** 当前版本。 */
checkpointId?: string
/** 是否仍为未提交候选。 */
isCandidate: boolean
/** 是否有明确提交标记。 */
committed: boolean
/** 结构校验,null 表示尚未确认。 */
structureValid: boolean | null
/** 动作审核结果。 */
actionStatus: 'passed' | 'blocked' | 'unknown'
/** 当前结构问题。 */
structuralIssues: ShotValidation['issues']
/** 含完整性与形态绑定的结构问题总数。 */
structuralCount: number
/** 当前动作阻断,不计入结构问题数量。 */
actionBlocks: CandidateActionBlock[]
/** 当前待处理剧集。 */
pendingEpisodeNos: number[]
/** 统一的问题行。 */
problems: BreakdownProblem[]
/** 历史结构问题,默认不参与当前提示。 */
historyIssues: ShotValidation['issues']
/** 当前可见问题数。 */
issueCount: number
/** 只允许进入安全预检查,不能据此提交。 */
canRequestCommitPreview: boolean
/** 需要重新读取审核,失败和过期均不判为通过。 */
needsRefresh: boolean
/** 审核正在读取。 */
loading: boolean
/** 当前读取失败或版本不符原因。 */
error: string
}
/**
* 同一版本的顶层修复字段优先,兼容早期仅存于 breakdownResult 的结果。
* @param state 服务端原始检查点
* @returns 不修改原对象的统一成果快照
*/
export function normalizeBreakdownState(state: BreakdownState): BreakdownState {
// 新版候选只信任顶层;旧版无候选标记的快照才兼容嵌套成果。
const result: BreakdownResult = state.candidateOnly === true ? {} : { ...state.breakdownResult }
for (const key of [
'subjectCandidates',
'subjectForms',
'storyboardPlans',
'storyboardEpisodeShots',
'storyboardShotValidation',
'storyboardNeedsManualReview'
] as const) {
if (state[key] !== undefined) Object.assign(result, { [key]: state[key] })
}
if (result.storyboardEpisodeShots?.length) {
// 主体修复可能只更新镜头内的 episodePlan,保留未完成剧集并替换已更新规划。
const plans = new Map(result.storyboardPlans?.map(plan => [plan.episodeNo, plan]))
for (const episode of result.storyboardEpisodeShots) plans.set(episode.episodeNo, episode.episodePlan)
result.storyboardPlans = [...plans.values()].toSorted((a, b) => a.episodeNo - b.episodeNo)
}
return { ...state, ...result, breakdownResult: result }
}
/**
* 判断检查点是否含真实成果,而不是只有失败执行信息。
* @param record 原始检查点
* @returns 是否含可回看的资产内容
*/
function hasBreakdownData(record: Checkpoint): boolean {
return Boolean(
record.state.breakdownResult ||
record.state.subjectCandidates ||
record.state.storyboardEpisodeShots ||
record.state.storyboardPlans
)
}
/**
* 按检查点生命周期选择当前来源,失败空快照只能回看历史,不继承历史质量。
* @param records 已按创建时间排列的拆解检查点
* @returns 当前与正式快照分别存放的数据来源
*/
export function selectBreakdownSource(records: Checkpoint[]): BreakdownSource {
const latest = records.at(-1)
if (!latest) return { kind: 'empty', state: null }
const formal = records
.toReversed()
.find(
record =>
hasBreakdownData(record) &&
(record.state.storyboardPersisted === true ||
record.state.candidateCommitted === true ||
record.state.candidateOnly !== true)
)
if (latest.state.candidateOnly === true || hasBreakdownData(latest) || latest.state.runConfig) {
const state = normalizeBreakdownState(latest.state)
return {
checkpoint: latest,
state,
formal,
kind:
state.storyboardPersisted === true || state.candidateCommitted === true || state.candidateOnly !== true
? 'formal'
: 'candidate'
}
}
const previous = records.toReversed().find(hasBreakdownData)
return {
kind: previous ? 'history' : 'empty',
checkpoint: previous,
state: previous ? normalizeBreakdownState(previous.state) : null,
formal
}
}
/**
* 验证审核结果的项目和检查点归属,拒绝过期响应。
* @param review 后端只读审核响应
* @param projectId 当前项目
* @param checkpointId 当前候选版本
* @returns 原始有效审核结果
*/
export function assertCandidateReview(
review: CandidateRevalidation,
projectId: string,
checkpointId: string
): CandidateRevalidation {
if (!review || review.projectId !== projectId || review.checkpointId !== checkpointId)
throw new Error('候选审核版本已过期,请刷新候选状态。')
const arrayKeys = [
'previousIssues',
'currentIssues',
'missingSubjectRefs',
'actionQualityBlocks',
'actionRepairTargets',
'pendingQualityEpisodeNos',
'propReferenceDiagnostics',
'pendingWithoutActionBlocks'
] as const
if (
!review.candidateValidation ||
typeof review.candidateValidation.valid !== 'boolean' ||
!Array.isArray(review.candidateValidation.issues) ||
!arrayKeys.every(key => Array.isArray(review[key]))
)
throw new Error('候选审核响应不完整,请刷新候选状态。')
return review
}
/**
* 汇总当前版本的结构、动作与待审状态,不把历史错误当作当前问题。
* @param source 当前数据来源
* @param review 与当前版本匹配的候选审核
* @param loading 是否正在读取候选审核
* @param error 读取失败或版本过期原因
* @returns 页面、问题抽屉与提交面板共享的质量状态
*/
export function breakdownQuality(
source: BreakdownSource,
review: CandidateRevalidation | null,
loading = false,
error = ''
): BreakdownQuality {
const candidate = source.kind === 'candidate'
const current = candidate && review?.checkpointId === source.checkpoint?.checkpointId ? review : null
const known = candidate ? !!current && !loading && !error : source.kind === 'formal'
const structuralIssues = known
? candidate
? current!.currentIssues
: (source.state?.storyboardShotValidation?.issues ?? [])
: []
const validation = known
? candidate
? current!.currentIssues.length === 0
: (source.state?.storyboardShotValidation?.valid ?? null)
: null
const actionBlocks = known
? candidate
? current!.actionQualityBlocks
: (source.state?.storyboardActionQualityDecisions ?? [])
.filter(item => item.status === 'blocked' || item.warningCodes.includes('action_resource_conflict'))
.map(item => ({ ...item, isPendingEpisode: true }))
: []
const pendingEpisodeNos = known
? candidate
? current!.pendingQualityEpisodeNos
: (source.state?.storyboardPendingQualityEpisodeNos ?? [])
: []
const problems: BreakdownProblem[] = structuralIssues.map((item, index) => ({
key: `structure-${item.episodeNo}-${item.beatNo}-${item.shotNo}-${index}`,
type: item.message.includes('主体引用缺失')
? 'subject'
: /绑定|形态|Form/.test(item.message)
? 'binding'
: 'structure',
location: item,
message: item.message,
codes: []
}))
for (const block of actionBlocks)
problems.push({
key: `action-${block.episodeNo}-${block.beatNo}-${block.shotNo}`,
type: 'action',
location: { ...block, message: '动作质量待修订' },
message: '当前动作规划仍有阻断或资源冲突。',
codes: [...new Set([...block.blockingCodes, ...block.warningCodes])]
})
for (const episodeNo of pendingEpisodeNos.filter(no => !actionBlocks.some(item => item.episodeNo === no)))
problems.push({
key: `pending-${episodeNo}`,
type: 'pending',
location: { episodeNo, message: '剧集仍标记为待审核' },
message: '该集仍标记为待审核,当前没有动作阻断明细,请重新核对审核状态。',
codes: []
})
if (current && known) {
for (const diagnostic of current.propReferenceDiagnostics) {
if (diagnostic.beatAllowsSubject && diagnostic.shotHasSubject && diagnostic.shotHasBinding) continue
if (
problems.some(
item =>
item.location?.episodeNo === diagnostic.episodeNo &&
item.location.beatNo === diagnostic.beatNo &&
item.location.shotNo === diagnostic.shotNo &&
item.message.includes(diagnostic.subjectRef)
)
)
continue
problems.push({
key: `prop-${diagnostic.episodeNo}-${diagnostic.beatNo}-${diagnostic.shotNo}-${diagnostic.subjectRef}`,
type: 'subject',
location: { ...diagnostic, message: '道具引用或形态绑定缺失' },
message: `道具 ${diagnostic.subjectName}(${diagnostic.subjectRef})的节拍引用、镜头引用或形态绑定不完整。`,
codes: []
})
}
for (const [index, message] of current.candidateValidation.issues.entries()) {
if (
(message === 'Storyboard 质量审核未通过' && structuralIssues.length) ||
(message === '仍存在待处理的分镜质量问题' && pendingEpisodeNos.length)
)
continue
problems.push({
key: `candidate-${index}`,
type: /Form|形态|绑定/.test(message) ? 'binding' : 'structure',
message,
codes: []
})
}
}
if (
known &&
((validation === false && !problems.some(item => ['structure', 'subject', 'binding'].includes(item.type))) ||
(current?.candidateValidation.valid === false && !problems.length))
) {
problems.push({
key: 'validation-unknown',
type: 'structure',
message: '当前版本校验未通过,服务端未提供具体结构问题,请重新读取审核。',
codes: []
})
}
const structuralCount = problems.filter(item => ['structure', 'subject', 'binding'].includes(item.type)).length
const structureValid = validation === null ? null : validation && structuralCount === 0
return {
source: source.kind,
checkpointId: source.checkpoint?.checkpointId,
isCandidate: candidate,
committed: source.state?.storyboardPersisted === true || source.state?.candidateCommitted === true,
structureValid,
actionStatus: known ? (actionBlocks.length || pendingEpisodeNos.length ? 'blocked' : 'passed') : 'unknown',
structuralIssues,
structuralCount,
actionBlocks,
pendingEpisodeNos,
problems,
historyIssues: current?.previousIssues ?? [],
issueCount: problems.length,
canRequestCommitPreview:
candidate &&
known &&
current!.candidateValidation.valid &&
structureValid === true &&
!problems.length &&
!candidateCommitIssue({
...source.state,
workflowExecution: undefined,
storyboardShotValidation: { valid: true, issues: [] },
storyboardPendingQualityEpisodeNos: pendingEpisodeNos
}),
needsRefresh: candidate && (!known || !!error),
loading: candidate && loading,
error: candidate ? error : ''
}
}
+104
View File
@@ -0,0 +1,104 @@
import type { ShotActionDraft } from './repair.types'
import { actionResourceOptions } from '../projects/quality-policy'
/**
* 将后端质量代码转为页面可理解的问题描述。
* @param code 后端质量原因码
* @returns 中文原因,未知问题保留代码便于定位
*/
export function qualityIssueLabel(code: string): string {
const labels: Record<string, string> = {
duplicate_action_id: '动作编号重复',
invalid_state_execution: '静态状态被要求执行',
invalid_duration_phase: '动作阶段无效',
missing_action_phase: '动作缺少对应阶段',
unknown_phase_action_id: '阶段引用了未知动作',
state_used_as_action_phase: '静态状态被用作动作阶段',
duration_phase_sum_mismatch: '阶段时长合计不一致',
unknown_resource_action_id: '资源引用了未知动作',
resource_action_not_in_phase: '资源动作不属于当前阶段',
invalid_resource_owner_ref: '资源主体引用无效',
action_resource_conflict: '动作资源占用冲突',
hand_occupancy_conflict: '手部占用冲突',
missing_required_actions: '缺少必需动作',
missing_duration_planning: '缺少时长规划',
insufficient_action_duration: '动作执行时间不足',
unknown_hand_action_id: '手部证据引用了未知动作',
hand_action_not_in_phase: '手部动作不属于当前阶段',
invalid_hand_character_ref: '手部主体引用无效'
}
return labels[code] ?? '其他待复核问题'
}
/**
* 深复制实际动作与全部证据,缺失字段保留待人工填写。
* @param shot 原始镜头中的可编辑字段
* @returns 独立的完整修订草稿
*/
export function actionDraft(shot: Partial<ShotActionDraft>): ShotActionDraft {
return JSON.parse(
JSON.stringify({
requiredActions: shot.requiredActions ?? [],
durationPlanning: shot.durationPlanning ?? {
complexity: 'low',
phases: [],
transitionSeconds: 0,
recommendedDurationSeconds: 0,
reason: ''
}
})
) as ShotActionDraft
}
/**
* 校验动作编号、阶段时长与证据引用,不替代后端质量审核。
* @param draft 当前人工编辑草稿
* @returns 首项问题,空字符串表示可以提交审核
*/
export function actionDraftIssue(draft: ShotActionDraft): string {
const ids = draft.requiredActions.map(item => item.id.trim())
if (!ids.length || ids.some(item => !item) || new Set(ids).size !== ids.length) return '请填写不重复的动作编号。'
if (draft.requiredActions.some(item => !item.description.trim() || !['action', 'state'].includes(item.kind)))
return '请补齐动作描述与类型。'
const planning = draft.durationPlanning
if (!planning.phases.length) return '请至少添加一个动作阶段。'
if (!['low', 'medium', 'high'].includes(planning.complexity) || !planning.reason.trim())
return '请补齐复杂度与时长依据。'
if (
!Number.isFinite(planning.transitionSeconds) ||
planning.transitionSeconds < 0 ||
!Number.isFinite(planning.recommendedDurationSeconds) ||
planning.recommendedDurationSeconds <= 0
)
return '阶段衔接与建议时长需填写有效秒数。'
for (const phase of planning.phases) {
if (phase.resourceOccupancy?.some(item => item.transition && !item.continuityRef?.trim()))
return '释放或交接需要填写明确的持续对象。'
if (phase.resourceOccupancy?.some(item => item.transition === 'release' && item.usage !== 'other'))
return '明确释放不能同时声明持有或支撑,请核对资源用途。'
if (!phase.action.trim()) return '请填写每个阶段的动作描述。'
if (!Number.isFinite(phase.estimatedSeconds) || phase.estimatedSeconds <= 0) return '阶段时长必须大于 0 秒。'
const references = [
...(phase.actionIds ?? []),
...(phase.handOccupancy?.map(item => item.actionId) ?? []),
...(phase.resourceOccupancy?.map(item => item.actionId) ?? [])
]
if (references.some(id => !ids.includes(id))) return '阶段证据引用了不存在的动作编号,请重新选择。'
if (
phase.handOccupancy?.some(
item => !item.characterRef.trim() || !['left', 'right', 'both'].includes(item.hands)
)
)
return '手部证据需填写主体引用和使用的手。'
if (
phase.resourceOccupancy?.some(
item =>
!item.ownerRef.trim() ||
!actionResourceOptions.some(option => option.value === item.resource) ||
!['support', 'hold', 'move', 'interact', 'other'].includes(item.usage)
)
)
return '资源证据需填写主体引用、资源和用途。'
}
return ''
}
+163
View File
@@ -0,0 +1,163 @@
import type { ActionResource } from '../projects/types'
/** 单镜头中必须执行或保持的动作。 */
export interface RequiredAction {
/** 动作唯一编号。 */
id: string
/** 具体动作描述。 */
description: string
/** 动作或静态状态。 */
kind: 'action' | 'state'
/** 是否必须在本镜头完成。 */
mustPerformInShot: boolean
}
/** 同一阶段的手部占用证据。 */
export interface HandOccupancy {
/** 被引用的动作编号。 */
actionId: string
/** 主体引用。 */
characterRef: string
/** 使用的手。 */
hands: 'left' | 'right' | 'both'
/** 是否允许共享。 */
shareable?: boolean
}
/** 通用身体或道具资源占用证据。 */
export interface ResourceOccupancy {
/** 主体引用。 */
ownerRef: string
/** 动作资源。 */
resource: ActionResource
/** 被引用的动作编号。 */
actionId: string
/** 具体用途。 */
usage: 'support' | 'hold' | 'move' | 'interact' | 'other'
/** 是否允许共享。 */
shareable: boolean
/** 明确持续持有或支撑的对象。 */
continuityRef?: string
/** 明确释放或交接,不根据文本猜测。 */
transition?: 'release' | 'transfer'
}
/** 镜头完整动作时长规划,保留手部及通用资源证据。 */
export interface ShotDurationPlanning {
/** 动作复杂度。 */
complexity: 'low' | 'medium' | 'high'
/** 按先后执行的动作阶段。 */
phases: Array<{
/** 阶段描述。 */
action: string
/** 阶段覆盖的动作编号。 */
actionIds?: string[]
/** 阶段预估秒数。 */
estimatedSeconds: number
/** 手部占用明细。 */
handOccupancy?: HandOccupancy[]
/** 身体与道具占用明细。 */
resourceOccupancy?: ResourceOccupancy[]
}>
/** 阶段切换所需秒数。 */
transitionSeconds: number
/** 建议镜头总时长。 */
recommendedDurationSeconds: number
/** 时长规划依据。 */
reason: string
}
/** 镜头人工修订草稿,仅包含后端允许编辑的动作字段。 */
export interface ShotActionDraft {
/** 全部必需动作。 */
requiredActions: RequiredAction[]
/** 完整阶段规划。 */
durationPlanning: ShotDurationPlanning
}
/** 只读质量修复目标。 */
export interface QualityRepairTarget {
/** 剧集编号。 */
episodeNo: number
/** 节拍编号。 */
beatNo: number
/** 镜头编号。 */
shotNo: number
/** 后端质量阻断原因码。 */
blockingCodes: string[]
}
/** 当前可恢复版本的修复计划。 */
export interface QualityRepairPlan {
/** 所属项目。 */
projectId: string
/** 被审核的检查点版本。 */
checkpointId: string | null
/** 待修订数量。 */
repairCount: number
/** 真实阻断镜头清单。 */
repairPlan: QualityRepairTarget[]
}
/** 当前有效的局部修复候选。 */
export interface QualityRepairCandidates {
/** 所属项目。 */
projectId: string
/** 当前检查点版本。 */
checkpointId: string | null
/** 已验证指纹的候选清单。 */
candidates: Array<{
/** 所属项目。 */
projectId: string
/** 检查点镜头位置标识。 */
shotId: string
/** 质量分类。 */
category: string
/** 问题原因码。 */
issueCodes: string[]
/** 当前目标镜头内容指纹。 */
expectedFingerprint: string
/** 后端修复建议。 */
suggestion: string
/** 限制与注意事项。 */
blockingReasons: string[]
/** 必须人工确认。 */
requiresManualConfirmation: true
/** 候选建议本身是否需要模型。 */
willCallModel: boolean
/** 查询不修改资产。 */
willModifyAssets: false
}>
}
/** 版本约束下的人工修订请求。 */
export interface QualityRepairInput extends ShotActionDraft {
/** 被编辑的检查点版本。 */
expectedCheckpointId: string
/** 从候选发起时必须提供镜头指纹。 */
expectedFingerprint?: string
/** 修订来源。 */
source: 'manual' | 'candidate'
/** 剧集编号。 */
episodeNo: number
/** 节拍编号。 */
beatNo: number
/** 镜头编号。 */
shotNo: number
}
/** 人工修订成功后仍需按后端就绪状态恢复拆解。 */
export interface QualityRepairResult {
/** 所属项目。 */
projectId: string
/** 新检查点版本。 */
checkpointId: string
/** 后端判断是否可恢复拆解。 */
canResumeBreakdown: boolean
/** 检查点是否可恢复。 */
checkpointRecoverable: boolean
/** 尚未验收的剧集编号。 */
pendingEpisodeNos: number[]
/** 尚存的质量问题,原样保留。 */
remainingQualityIssues: unknown[]
}
+229 -1
View File
@@ -1,3 +1,4 @@
import type { BodyMotionFinding, DiagnosisHandAudit } from './diagnosis.types'
/** 三种可配置的抽取模块,分镜并不是第四个模块。 */ /** 三种可配置的抽取模块,分镜并不是第四个模块。 */
export type BreakdownModule = 'character' | 'scene' | 'prop' export type BreakdownModule = 'character' | 'scene' | 'prop'
@@ -34,6 +35,10 @@ export interface BreakdownTask {
/** 传给预览与启动接口的相同配置。 */ /** 传给预览与启动接口的相同配置。 */
export interface BreakdownInput { export interface BreakdownInput {
/** 启动时携带已确认的服务端修订,预览无需此字段。 */
expectedRevision?: number
/** 仅生成候选,正式资产由独立确认入口提交。 */
candidateOnly?: boolean
groupSize: number groupSize: number
modules: BreakdownModule[] modules: BreakdownModule[]
} }
@@ -88,6 +93,8 @@ export interface StoryboardBeat {
/** 单集分镜规划。 */ /** 单集分镜规划。 */
export interface EpisodePlan { export interface EpisodePlan {
/** 正式时长目标快照,空值为自动,缺失为历史未记录。 */
targetDurationSeconds?: number | null
episodeNo: number episodeNo: number
episodeTitle: string episodeTitle: string
storyGoal: string storyGoal: string
@@ -100,6 +107,10 @@ export interface EpisodePlan {
/** 最小连续镜头及其主体形态绑定。 */ /** 最小连续镜头及其主体形态绑定。 */
export interface StoryboardShot { export interface StoryboardShot {
/** 完整必需动作,缺失时不自动补造历史证据。 */
requiredActions?: import('./repair.types').RequiredAction[]
/** 阶段时长与资源占用证据。 */
durationPlanning?: import('./repair.types').ShotDurationPlanning
shotNo: number shotNo: number
title: string title: string
description: string description: string
@@ -122,6 +133,30 @@ export interface ShotValidation {
issues: { episodeNo: number; beatNo?: number | null; shotNo?: number | null; message: string }[] issues: { episodeNo: number; beatNo?: number | null; shotNo?: number | null; message: string }[]
} }
/** 当前拆解候选的只读时长审计。 */
export interface BreakdownDurationBudget {
/** 正式集数。 */ episodeNo: number
/** 已规划的段落预算之和。 */ plannedSeconds: number
/** 当前镜头及动作所需最低总时长。 */ minimumRequiredSeconds: number
/** 局部段落缺口之和。 */ deficitSeconds: number
/** 局部段落的预算及缺口。 */
beatSuggestions: Array<{
/** 段落号。 */ beatNo: number
/** 原段落预算。 */ budgetSeconds: number
/** 最低需求。 */ requiredSeconds: number
/** 当前缺口。 */ deficitSeconds: number
}>
/** 当前需要人工核对。 */ needsReview: boolean
}
/** 最新失败保存记录中的完整实际候选。 */
export interface BreakdownDurationFailure {
/** 正式候选诊断类型。 */ kind: 'storyboard-duration-failure'
/** 失败集数。 */ episodeNo: number
/** 完整候选保留供诊断。 */ candidate: EpisodeShots
/** 此失败不自动恢复。 */ retryAutomatically: false
}
/** Breakdown 的最终成果及阶段 checkpoint 共有的可展示字段。 */ /** Breakdown 的最终成果及阶段 checkpoint 共有的可展示字段。 */
export interface BreakdownResult { export interface BreakdownResult {
subjectCandidates?: SubjectCandidate[] subjectCandidates?: SubjectCandidate[]
@@ -143,8 +178,33 @@ export interface WorkflowExecution {
/** latest 和 checkpoint 的恢复状态;失败 checkpoint 可能只有 execution。 */ /** latest 和 checkpoint 的恢复状态;失败 checkpoint 可能只有 execution。 */
export interface BreakdownState extends BreakdownResult { export interface BreakdownState extends BreakdownResult {
/** 最新保存记录编号。 */
checkpointId?: string
/** 当前服务端时长审计。 */
storyboardEpisodeDurationBudgets?: BreakdownDurationBudget[]
/** 失败详情仅用于诊断,不作为恢复请求参数。 */
failureDetails?: { /** 实际失败的结构化证据。 */ details?: unknown }
/** 快照所属项目;旧版观测响应可能缺省。 */
projectId?: string
/** 当前镜头动作质量决策,不从嵌套历史成果继承。 */
storyboardActionQualityDecisions?: Omit<import('./candidate.types').CandidateActionBlock, 'isPendingEpisode'>[]
/** 后端候选模式标记,缺省时不推断为候选。 */
candidateOnly?: boolean
/** 最新快照是否已经写入正式主体与分镜。 */
storyboardPersisted?: boolean
/** 候选是否已经通过安全提交入口保存。 */
candidateCommitted?: boolean
/** 候选生成时固定的剧本正文版本。 */
expectedEpisodeFingerprints?: Record<number, string>
/** 尚未完成质量审核的剧集。 */
storyboardPendingQualityEpisodeNos?: number[]
workflowExecution?: WorkflowExecution workflowExecution?: WorkflowExecution
runConfig?: BreakdownInput & { episodeGroups: EpisodeGroup[] } runConfig?: BreakdownInput & {
/** 抽取任务使用的剧集分组。 */
episodeGroups: EpisodeGroup[]
/** 候选固定的源剧集编号,仅用于完整性提示。 */
sourceEpisodes?: { episodeNo: number }[]
}
taskSummary?: TaskSummary taskSummary?: TaskSummary
tasks?: BreakdownTask[] tasks?: BreakdownTask[]
breakdownResult?: BreakdownResult breakdownResult?: BreakdownResult
@@ -152,3 +212,171 @@ export interface BreakdownState extends BreakdownResult {
/** 不同失败阶段的恢复端点,不能用 retry 替代所有恢复。 */ /** 不同失败阶段的恢复端点,不能用 retry 替代所有恢复。 */
export type BreakdownAction = 'start' | 'retry' | 'resume-shots' | 'resume-storyboard' export type BreakdownAction = 'start' | 'retry' | 'resume-shots' | 'resume-storyboard'
/** 安全提交候选的正式资产统计。 */
export interface BreakdownCandidateCommit {
/** 所属项目编号。 */
projectId: string
/** 正式主体数量。 */
subjectCount: number
/** 正式形态数量。 */
subjectFormCount: number
/** 正式剧集数量。 */
episodeCount: number
/** 正式节拍数量。 */
beatCount: number
/** 正式镜头数量。 */
shotCount: number
/** 镜头主体绑定数量。 */
shotSubjectCount: number
}
/** 已持久化分镜的手部动作诊断;无证据不代表无冲突。 */
export interface StoryboardHandOccupancyDiagnostics {
projectId: string
episodeCount: number
shotCount: number
validSnapshotCount: number
evidenceShotCount: number
invalidEvidenceShotCount: number
missingEvidenceShotCount: number
evidenceCoverage: number | null
assessment: 'no_shots' | 'insufficient_evidence' | 'partial_evidence' | 'complete_evidence'
warningCount: number
diagnostics: Array<{
episodeNo: number
beatNo: number
shotNo: number
phaseNo: number
characterRef: string
actionIds: [string, string]
code: 'hand_occupancy_conflict'
severity: 'warning'
suggestion: string
}>
willCallModel: false
willModifyAssets: false
}
/** 人工修复候选只读预览,写入必须经过单独的确认和版本校验。 */
export interface StoryboardHandRepairPreview {
projectId: string
assessment: StoryboardHandOccupancyDiagnostics['assessment']
evidenceCoverage: number | null
candidateCount: number
candidates: Array<{
episodeNo: number
beatNo: number
shotNo: number
phaseNo: number
characterRef: string
actionIds: [string, string]
suggestion: string
canApplyDirectly: false
blockingReasons: string[]
expectedFingerprint: string | null
}>
requiresManualConfirmation: true
willCallModel: false
willModifyAssets: false
}
/** 单镜头修订历史只返回元数据,不包含完整快照。 */
export interface StoryboardHandRepairHistory {
projectId: string
shotId: string
count: number
revisions: Array<{
id: string
sourceFingerprint: string
resultFingerprint: string
reason: string
createdAt: string
}>
}
/** 历史镜头动作证据的只读预览,不触发模型。 */
export interface LegacyActionDiagnosisPreview {
projectId: string
episodeNo: number
candidateCount: number
needsEvidenceCount: number
invalidSnapshotCount: number
candidates: Array<{
shotId: string
episodeNo: number
beatNo: number
shotNo: number
title: string
description: string
durationSeconds: number
requiredActionCount: number
hasDurationPlanning: boolean
hasHandOccupancy: boolean
status: 'needs_evidence' | 'has_evidence' | 'invalid_snapshot'
}>
willCallModel: false
willModifyAssets: false
}
/** 批量 AI 诊断启动回执,真实状态由 WorkflowExecution 查询。 */
export interface LegacyActionDiagnosisBatchStart {
executionId: string
status: 'pending' | 'running'
created: boolean
action?: unknown
}
/** 独立诊断记录的镜头级汇总;不将缺少诊断误判为无冲突。 */
export interface LegacyActionDiagnosisResults {
projectId: string
episodeNo: number | null
counts: {
total: number
conflict: number
clear: number
insufficient: number
invalid: number
stale: number
pending: number
}
shots: Array<{
shotId: string
episodeNo: number
beatNo: number
shotNo: number
title: string
diagnosisId: string | null
/** 规则是否与当前版本一致,旧回执缺省时不推断有效。 */
policyStatus?: 'not_diagnosed' | 'unknown' | 'current' | 'stale'
/** 镜头内容是否已经变化。 */
shotStale?: boolean
/** 最近手部修订的有效性。 */
repairStatus?: 'not_repaired' | 'repaired' | 'repair_history_stale'
/** 当前版本缺少 AI 复查。 */
requiresPostRepairDiagnosis?: boolean
/** 当前镜头手部证据的免费检查。 */
handAudit?: DiagnosisHandAudit
/** 通用手、脚、身体、支撑与道具证据摘要,优先于旧手部摘要。 */
resourceAudit?: DiagnosisHandAudit
/** 全身动作疑点,不与手部确定性结果合并。 */
bodyMotionFindings?: BodyMotionFinding[]
/** 原诊断使用的规则修订。 */
qualityPolicyRevision?: number | null
/** 规则内容版本。 */
qualityPolicyFingerprint?: string | null
/** 最近手部修订编号。 */
latestRepairId?: string | null
/** 最近手部修订时间。 */
latestRepairAt?: string | null
status:
| 'not_diagnosed'
| 'stale'
| 'conflict_found'
| 'no_conflict_found'
| 'insufficient_evidence'
| 'invalid_evidence'
issues: unknown[]
createdAt: string | null
}>
}
@@ -0,0 +1,90 @@
import { computed, onScopeDispose, ref, watch, type Ref } from 'vue'
import { workflowCheckpoints } from '../workflows/selectors'
import type { Checkpoint } from '../workflows/types'
import type { CandidateRevalidation } from './candidate.types'
import { breakdownApi } from './api'
import { assertCandidateReview, breakdownQuality, selectBreakdownSource } from './quality'
import { errorMessage } from '../../lib/http'
import { showActionFeedback, useActionMessage } from '../../components/ui/useActionMessage'
/**
* 观察候选版本并去重读取只读审核,不设置任何轮询。
* @param projectId 当前项目
* @param checkpoints 服务端检查点列表
* @returns 统一数据源、审核状态及显式刷新入口
*/
export function useBreakdownQuality(projectId: Ref<string>, checkpoints: Ref<Checkpoint[]>) {
/** 当前生命周期与正式数据分别选择。 */
const source = computed(() => selectBreakdownSource(workflowCheckpoints(checkpoints.value, 'breakdown')))
/** 审核请求只绑定尚未提交的候选及其项目。 */
const key = computed(() =>
source.value.kind === 'candidate' ? `${projectId.value}:${source.value.checkpoint?.checkpointId}` : ''
)
/** 仅存放当前版本已验证的审核。 */
const review = ref<CandidateRevalidation | null>(null)
/** 审核区域的独立加载状态。 */
const loading = ref(false)
/** 审核读取错误,失败不回退为历史通过状态。 */
const error = ref('')
/** 应用统一消息层。 */
const message = useActionMessage()
/** 取消或版本变化时废弃旧请求。 */
let controller: AbortController | undefined
/** 当前请求序号。 */
let generation = 0
/** 相同版本的并发读取共用一个 Promise。 */
let pending: Promise<void> | null = null
/** 显式重新审核当前候选,同一版本进行中的请求不重复发送。 */
function refresh(): Promise<void> {
if (!key.value) return Promise.resolve()
if (pending) return pending
const id = projectId.value
const checkpointId = source.value.checkpoint!.checkpointId
const version = ++generation
controller = new AbortController()
const signal = controller.signal
review.value = null
error.value = ''
loading.value = true
pending = (async () => {
try {
const result = await breakdownApi.revalidateCandidate(id, signal)
if (version !== generation || signal.aborted) return
review.value = assertCandidateReview(result, id, checkpointId)
} catch (cause) {
if (version === generation && !signal.aborted) {
error.value = errorMessage(cause)
showActionFeedback(message, error.value, 'error')
}
} finally {
if (version === generation) {
loading.value = false
pending = null
}
}
})()
return pending
}
/** 撤销旧版本,切换项目、提交完成和卸载都不得回填旧审核。 */
function invalidate() {
generation++
controller?.abort()
pending = null
review.value = null
loading.value = false
error.value = ''
}
watch(
key,
() => {
invalidate()
void refresh()
},
{ immediate: true, flush: 'sync' }
)
onScopeDispose(invalidate)
/** 页面、问题与提交面板共用一个结论。 */
const quality = computed(() => breakdownQuality(source.value, review.value, loading.value, error.value))
return { source, key, review, loading, error, quality, refresh }
}
@@ -0,0 +1,303 @@
import { computed, onScopeDispose, ref, watch, type Ref } from 'vue'
import { projectsApi } from '../projects/api'
import { policyDraft } from '../projects/quality-policy'
import type { ProjectQualityPolicy, ProjectQualityPolicyResult } from '../projects/types'
import {
qualityPolicyConfirmed,
qualityPolicySignature,
validateQualityPolicyReceipt
} from '../projects/quality-policy-confirmation'
import { errorMessage } from '../../lib/http'
import { showActionFeedback, useActionMessage } from '../../components/ui/useActionMessage'
/** 一次性启动许可只在前端内使用,不作为后端权限或提交参数。 */
interface StartPermit {
/** 当前项目。 */
projectId: string
/** 当前拆解输入。 */
scope: string
/** 本次重新读取并确认的质量规则。 */
signature: string
/** 服务端已确认的规则修订。 */
revision: number
/** 同修订的服务端内容版本。 */
fingerprint: string
}
/**
* 读取真实规则并验证所属项目和内容完整性。
* @param id 请求项目
* @param signal 只读请求取消信号
* @returns 已验证的真实规则回执
*/
async function read(id: string, signal: AbortSignal): Promise<ProjectQualityPolicyResult> {
const result = await projectsApi.qualityPolicy(id, signal)
validateQualityPolicyReceipt(result, id)
return { ...result, policy: policyDraft(result.policy) }
}
/**
* 启动拆解前读取并确认规则,内容未变时跳过规则弹窗,保留每次模型启动确认。
* @param projectId 当前项目
* @param scope 当前预览对应的拆解配置
* @param allowed 当前是否允许启动
* @returns 规则确认、普通启动确认及一次性启动许可
*/
export function useBreakdownStartPolicy(projectId: Ref<string>, scope: Ref<string>, allowed: Ref<boolean>) {
/** 已读取的服务端规则,编辑器不能自行使用本地默认值代替。 */
const policy = ref<ProjectQualityPolicyResult | null>(null)
/** 在现有拆解抽屉中切换到规则确认,不叠加第二个全屏抽屉。 */
const reviewOpen = ref(false)
/** 普通模型启动确认,规则已确认时直接进入此步骤。 */
const startOpen = ref(false)
/** 只读请求加载状态,允许用户取消。 */
const reading = ref(false)
/** 真实保存期间禁止重复操作和意外关闭。 */
const saving = ref(false)
/** 当前按钮请求是否正在执行。 */
const busy = computed(() => reading.value || saving.value)
/** 用户可重试的错误反馈。 */
const error = ref('')
/** 编辑器只在服务端版本变化时重建,失败保留草稿。 */
const editorKey = computed(() =>
policy.value
? `${policy.value.projectId}:${policy.value.revision}:${policy.value.fingerprint}:${qualityPolicySignature(policy.value.policy)}`
: ''
)
/** 应用统一消息层。 */
const message = useActionMessage()
/** 取消项目或配置变更前的旧请求。 */
let controller: AbortController | undefined
/** 旧响应隔离代次。 */
let generation = 0
/** 普通启动弹窗对应的规则内容。 */
let preparedSignature = ''
/** 成功重读同修订确认后才能消费的一次性启动许可。 */
let permit: StartPermit | null = null
/** 撤销未完成请求和启动许可,不撤销用户已经完成的规则确认。 */
function reset() {
generation++
controller?.abort()
reading.value = false
saving.value = false
reviewOpen.value = false
startOpen.value = false
policy.value = null
preparedSignature = ''
permit = null
error.value = ''
}
/** 用户点击生成时读取规则,不在页面进入或定时器中请求。 */
async function prepare() {
if (!allowed.value || busy.value) return
reset()
const current = generation
const id = projectId.value
controller = new AbortController()
reading.value = true
try {
const result = await read(id, controller.signal)
if (current !== generation || !allowed.value) return
policy.value = result
const signature = qualityPolicySignature(result.policy)
if (qualityPolicyConfirmed(result)) {
preparedSignature = signature
startOpen.value = true
} else reviewOpen.value = true
} catch (cause) {
if (current === generation) {
error.value = errorMessage(cause)
showActionFeedback(message, error.value, 'error')
}
} finally {
if (current === generation) reading.value = false
}
}
/**
* 明确确认完整规则,修改过的草稿先保存并核对;无变化时不重复写入。
* @param draft 表单完整校验后的用户草稿
* @returns 是否已进入普通启动确认,不会自动执行模型任务
*/
async function confirmRules(draft: ProjectQualityPolicy): Promise<boolean> {
if (!allowed.value || busy.value || !reviewOpen.value || !policy.value) return false
const id = projectId.value
const current = ++generation
const reviewed = policy.value
const expected = qualityPolicySignature(reviewed.policy)
controller?.abort()
controller = new AbortController()
const signal = controller.signal
reading.value = true
error.value = ''
try {
const draftSignature = qualityPolicySignature(draft)
let result = await read(id, signal)
if (current !== generation || !allowed.value) return false
if (
result.revision !== reviewed.revision ||
result.fingerprint !== reviewed.fingerprint ||
qualityPolicySignature(result.policy) !== expected
) {
policy.value = result
showActionFeedback(message, '质量规则已在其他位置更新,请重新核对后确认。', 'warning')
return false
}
if (draftSignature !== expected) {
reading.value = false
saving.value = true
const saved = await projectsApi.saveQualityPolicy(id, policyDraft(draft), result.revision)
if (current !== generation || !allowed.value) return false
validateQualityPolicyReceipt(saved, id)
if (qualityPolicySignature(saved.policy) !== draftSignature)
throw new Error('质量规则保存结果与草稿不一致,请重新读取。')
result = saved
}
// 确认是独立写入;确认按钮只在用户明确核对后才调用此接口。
reading.value = false
saving.value = true
const confirmed = validateQualityPolicyReceipt(
await projectsApi.confirmQualityPolicy(id, result.revision),
id
)
if (current !== generation || !allowed.value) return false
if (
!qualityPolicyConfirmed(confirmed) ||
confirmed.revision !== result.revision ||
confirmed.fingerprint !== result.fingerprint ||
qualityPolicySignature(confirmed.policy) !== draftSignature
)
throw new Error('质量规则确认结果不一致,请重新核对。')
saving.value = false
reading.value = true
result = await read(id, signal)
if (current !== generation || !allowed.value) return false
if (
!qualityPolicyConfirmed(result) ||
result.revision !== confirmed.revision ||
result.fingerprint !== confirmed.fingerprint
) {
policy.value = result
showActionFeedback(message, '质量规则已变化,请重新核对后确认。', 'warning')
return false
}
const signature = qualityPolicySignature(result.policy)
policy.value = result
preparedSignature = signature
reviewOpen.value = false
startOpen.value = true
return true
} catch (cause) {
if (current === generation) {
error.value = errorMessage(cause)
showActionFeedback(message, error.value, 'error')
}
return false
} finally {
if (current === generation) {
reading.value = false
saving.value = false
}
}
}
/**
* 最终启动前再次读取,弹窗期间规则变化时返回确认,绝不直接调用模型。
* @returns 是否取得本次启动许可
*/
async function verifyStart(): Promise<boolean> {
if (!allowed.value || busy.value || !startOpen.value || !preparedSignature) return false
const id = projectId.value
const current = ++generation
const currentScope = scope.value
controller?.abort()
controller = new AbortController()
reading.value = true
error.value = ''
try {
const result = await read(id, controller.signal)
if (current !== generation || !allowed.value) return false
const signature = qualityPolicySignature(result.policy)
if (
signature !== preparedSignature ||
!qualityPolicyConfirmed(result) ||
result.revision !== policy.value?.revision ||
result.fingerprint !== policy.value?.fingerprint
) {
policy.value = result
preparedSignature = ''
startOpen.value = false
reviewOpen.value = true
showActionFeedback(message, '质量规则已变化,请重新确认后再启动拆解。', 'warning')
return false
}
permit = {
projectId: id,
scope: currentScope,
signature,
revision: result.revision,
fingerprint: result.fingerprint
}
startOpen.value = false
return true
} catch (cause) {
if (current === generation) {
error.value = errorMessage(cause)
showActionFeedback(message, error.value, 'error')
}
return false
} finally {
if (current === generation) reading.value = false
}
}
/**
* 消费同项目、同预览范围的本地一次性启动许可,真实写入仍由服务事务复查。
* @returns 本次确认的服务修订,缺少许可时为空
*/
function consumePermit(): { expectedRevision: number } | null {
const current = permit
permit = null
return current &&
allowed.value &&
current.projectId === projectId.value &&
current.scope === scope.value &&
policy.value &&
qualityPolicyConfirmed(policy.value) &&
current.revision === policy.value.revision &&
current.fingerprint === policy.value.fingerprint
? { expectedRevision: current.revision }
: null
}
/** 用户取消只读确认时撤销未完成请求,保存请求进行中禁止重复取消。 */
function cancel() {
if (!saving.value) reset()
}
watch([projectId, scope], reset, { flush: 'sync' })
watch(
allowed,
value => {
if (!value) reset()
},
{ flush: 'sync' }
)
onScopeDispose(reset)
return {
policy,
reviewOpen,
startOpen,
reading,
saving,
busy,
error,
editorKey,
prepare,
confirmRules,
verifyStart,
consumePermit,
cancel
}
}
+387 -158
View File
@@ -1,79 +1,189 @@
<script setup lang="ts"> <script setup lang="ts">
import WorkspacePage from '../../components/ui/WorkspacePage.vue' import WorkspacePage from '../../components/ui/WorkspacePage.vue'
import ActionMenu from '../../components/ui/ActionMenu.vue' import { NScrollbar, NCollapse, NCollapseItem, NTab, NTabs, NTag, NButton } from 'naive-ui'
import { NScrollbar, NCollapse, NCollapseItem, NProgress, NTab, NTabs, NTag } from 'naive-ui'
import { computed, ref, watch } from 'vue' import { computed, ref, watch } from 'vue'
import { ArrowRight, Check, Circle } from '@lucide/vue' import { ArrowRight, Check, Circle, CircleAlert, ClipboardList, LoaderCircle } from '@lucide/vue'
import { EmptyState } from '../../components/ui' import WorkspaceExportButton from '../../components/ui/WorkspaceExportButton.vue'
import { AppDialog, EmptyState, WorkspaceRefreshButton, WorkspaceSectionHeading } from '../../components/ui'
import WorkspaceActionTooltip from '../../components/ui/WorkspaceActionTooltip.vue'
import ContextNotice from '../../components/ui/ContextNotice.vue'
import { useProjectContext } from '../projects/context' import { useProjectContext } from '../projects/context'
import { projectsApi } from '../projects/api' import { projectsApi } from '../projects/api'
import { workflowCheckpoints } from '../workflows/selectors' import { workflowCheckpoints } from '../workflows/selectors'
import { getOperation, runOperation } from '../workflows/operations' import { getOperation, isOperationRunning, runOperation } from '../workflows/operations'
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 { executionStageLabel, useWorkflowExecution } from '../workflows/execution'
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue' import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
import { dramaStages } from './progress'
import DramaReviewPanel from './review/DramaReviewPanel.vue'
import DramaRewriteAction from './review/DramaRewriteAction.vue'
/** 剧本创作工作区,正式数据库内容为准,checkpoint 只补充计划与恢复信息。 */ /** 剧本创作工作区,正式数据库内容为准,checkpoint 只补充计划与恢复信息。 */
const { project, checkpoints, refresh, refreshStageReadiness, error } = useProjectContext() const context = useProjectContext()
const { project, refreshStageReadiness, error } = context
/** 规划和审核仅来自创作工作流正文。 */
const dramaCheckpoints = context.useWorkflowCheckpoints('create-drama')
/** 当前阅读的正式内容标签。 */
const tab = ref('episodes') const tab = ref('episodes')
const showHistory = ref(false) /** 任务详情按需查看;关闭弹窗不会停止任务观察。 */
const dramaRecords = computed(() => workflowCheckpoints(checkpoints.value, 'create-drama')) const taskOpen = ref(false)
/** 仅使用创作工作流记录,避免混入拆解或改写候选。 */
const dramaRecords = computed(() => workflowCheckpoints(dramaCheckpoints.data.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(() => project.value?.episodeCount ?? state.value?.episodeCount)
/** 整剧目标时长仅作展示,不影响生成状态。 */
const targetMinutes = computed(() =>
project.value?.targetDurationSeconds === null || project.value?.targetDurationSeconds === undefined
? null
: Math.round(project.value.targetDurationSeconds / 60)
)
/** 当前任务与操作的项目归属。 */
const projectId = computed(() => project.value?.id ?? '') const projectId = computed(() => project.value?.id ?? '')
const operation = computed(() => getOperation(projectId.value)) /** 仅记住本次进入已定位的项目,后续刷新不抢走用户正在阅读的标签。 */
const backgroundExecution = useWorkflowExecution(projectId, 'create-drama') const initialTabProject = ref('')
/** 首次进入按正式项目和当前审核记录定位;这里只引导阅读,不决定审核或改写权限。 */
watch( watch(
() => backgroundExecution.query.data.value?.status, [projectId, () => project.value?.status, () => state.value?.reviewPassed, dramaCheckpoints.data],
(status, previous) => { () => {
if ((status === 'completed' || status === 'failed') && status !== previous) const current = project.value
void Promise.all([refresh(), refreshStageReadiness()]) if (
!current ||
initialTabProject.value === current.id ||
(current.status === 'failed' && dramaCheckpoints.data.value === null)
)
return
initialTabProject.value = current.id
const needsReview =
current.status === 'need_review' ||
(current.status === 'failed' && state.value?.reviewPassed === false && !!state.value.review)
tab.value = needsReview ? 'review' : 'episodes'
},
{ immediate: true }
)
/** 复用项目级操作互斥。 */
const operation = computed(() => getOperation(projectId.value))
/** 项目布局发现任务,页面共享同一持久化记录。 */
const backgroundExecution = useWorkflowExecution(projectId, 'create-drama')
/** 任务读取异常统一交给弹窗展示,页面只保留摘要。 */
const taskError = computed(() => backgroundExecution.discoveryError.value || backgroundExecution.query.error.value)
/** 页面摘要采用明确的任务阶段与项目结果,不从进度比例推断成功。 */
const taskSummary = computed(() => {
const record = backgroundExecution.query.data.value
if (taskError.value) return '任务状态读取异常'
if (record?.status === 'failed') return '创作任务失败'
if (record?.status === 'pending') return '等待开始创作'
if (record?.status === 'running') return executionStageLabel(record.stage)
if (project.value?.status === 'completed') return '剧本创作完成'
if (project.value?.status === 'need_review') return '审核待处理'
return record?.status === 'completed' ? '任务已结束,结果待确认' : '等待状态更新'
})
/** 切换项目时关闭旧项目弹层,不将上个项目的任务界面带入新项目。 */
watch(projectId, () => {
taskOpen.value = false
})
/** 节点事件只触发权威数据重读,不按节点先后次序补造完成状态。 */
watch(
() => {
const record = backgroundExecution.query.data.value
return record ? ([record.id, record.stage, record.status] as const) : null
},
(record, previous) => {
if (!record || !previous || record.every((value, index) => value === previous[index])) return
const current = backgroundExecution.query.data.value
if (current?.projectId !== projectId.value) return
const terminal = record[2] === 'completed' || record[2] === 'failed'
void refreshDrama(current.projectId, terminal ? record[0] + ':' + record[2] : undefined)
if (terminal) void refreshStageReadiness()
} }
) )
/** 正式项目完成状态独立于任务结束与审核执行状态。 */
const complete = computed(() => project.value?.status === 'completed') const complete = computed(() => project.value?.status === 'completed')
const hasCheckpoint = computed(() => dramaRecords.value.length > 0) /** 人工处理已完成项目时,旧失败或待修订任务不能覆盖当前正式结果。 */
const canGenerate = computed( const historicalTask = computed(() => {
const record = backgroundExecution.query.data.value
return (
complete.value &&
!!record &&
['completed', 'failed'].includes(record.status) &&
record.result?.projectStatus !== 'completed'
)
})
/** 当前记录是否包含服务端保存的规划,不在页面验证或重建规划。 */
const hasStoryPlan = computed(() => !!state.value?.storyPlan)
/** 恢复生成只接受连续的正式剧集前缀,允许进入尚未完成的派生设定阶段。 */
const hasEpisodePrefix = computed(
() => () =>
!complete.value && !!total.value &&
hasCheckpoint.value && episodes.value.length <= total.value &&
!!project.value?.characters.length && episodes.value
!!project.value?.world && .toSorted((a, b) => a.episode - b.episode)
(!total.value || episodes.value.length < total.value) .every((episode, index) => episode.episode === index + 1)
) )
const canRewrite = computed( /** 有明确审核结论后,应走审核或改写恢复,避免重复生成。 */
const hasReview = computed(() => typeof state.value?.reviewPassed === 'boolean')
/** 生成恢复不再以 Character 或 World 为前置条件,最终仍由服务端复核。 */
const canGenerate = computed(() => !complete.value && hasStoryPlan.value && hasEpisodePrefix.value && !hasReview.value)
/** 任务发现或状态读取异常时,先核对真实状态,禁止重复恢复。 */
const recoveryBlocked = computed(
() => () =>
!complete.value && operation.value.pending ||
hasCheckpoint.value && backgroundExecution.active.value ||
!!episodes.value.length && backgroundExecution.discovering.value ||
(!total.value || episodes.value.length >= total.value) !!backgroundExecution.discoveryError.value ||
!!backgroundExecution.query.error.value ||
!!error.value ||
context.summaryBlocked.value ||
dramaCheckpoints.loading.value ||
!!dramaCheckpoints.error.value ||
dramaCheckpoints.data.value === null
)
/** 用后端最新保存输出及当前节点呈现六个阶段。 */
const stages = computed(() =>
dramaStages(project.value, dramaRecords.value.at(-1), backgroundExecution.query.data.value)
) )
const stages = computed(() => [
{ label: '角色设定', done: !!project.value?.characters.length },
{ label: '世界观', done: !!project.value?.world },
{ label: '编写剧集', done: !!total.value && episodes.value.length >= total.value },
{ label: '审核与改写', done: state.value?.reviewPassed === true },
{ label: '完成', done: complete.value }
])
/** 恢复操作不能以“查看状态”的名义发送,始终在确认后调用。 */ /**
async function resume(action: 'resume-generation' | 'resume-rewrite') { * 更新正式剧本、摘要及创作记录。
if (!project.value || operation.value.pending || error.value) return * @param id 操作归属项目
* @param executionKey 同一个任务终态的共享标识
* @returns 数据刷新结束
*/
async function refreshDrama(id = projectId.value, executionKey?: string) {
if (!id || projectId.value !== id) return
await Promise.all([context.refreshProject(), context.refreshWorkflow('create-drama', id, executionKey)])
}
/** 用户明确确认后恢复未完成的生成,改写单独执行范围预检。 */
async function resumeGeneration() {
if (!project.value || recoveryBlocked.value || !canGenerate.value) return
const id = project.value.id const id = project.value.id
await runOperation(id, action === 'resume-generation' ? '恢复剧集生成' : '恢复剧本改写', async () => { await runOperation(id, '恢复剧集生成', async () => {
const started = await projectsApi.resume(id, action) const started = await projectsApi.resume(id, 'resume-generation')
await backgroundExecution.track(started.executionId) await backgroundExecution.track(started.executionId, id)
return started return started
}) })
await refresh() await refreshDrama(id)
} }
/** 导出当前数据库中的完整正文,方便本地校对。 */ /** 重读项目、保存记录与任务状态,不启动或恢复生成。 */
async function refreshTask() {
await Promise.all([
refreshDrama(),
backgroundExecution.discoveryError.value || !backgroundExecution.executionId.value
? backgroundExecution.discover()
: Promise.resolve(),
backgroundExecution.executionId.value ? backgroundExecution.query.refresh() : Promise.resolve()
])
}
/** 导出已读取的完整剧集正文;没有剧集时不生成空文件。 */
function exportScript() { function exportScript() {
if (!project.value) return if (!project.value || !episodes.value.length) return
const content = episodes.value const content = episodes.value
.map(item => `第 ${item.episode} 集 ${item.title}\n\n${item.content}`) .map(item => `第 ${item.episode} 集 ${item.title}\n\n${item.content}`)
.join('\n\n————————————\n\n') .join('\n\n————————————\n\n')
@@ -82,8 +192,21 @@ function exportScript() {
</script> </script>
<template> <template>
<WorkspacePage split compact class="script-workspace-page" <WorkspacePage split compact class="script-workspace-page" :class="{ 'script-creation-complete': complete }"
><template #header ><template #notice>
<ContextNotice v-if="dramaCheckpoints.error.value" type="error" role="alert">
{{ dramaCheckpoints.error.value }}
<NButton text size="small" @click="dramaCheckpoints.refresh">重试读取</NButton>
</ContextNotice>
<p
v-else-if="!dramaCheckpoints.data.value && dramaCheckpoints.loading.value"
class="text-xs text-muted"
role="status"
>
正在读取创作记录…
</p>
</template>
<template #header
><div class="stage-strip"> ><div class="stage-strip">
<!-- 以下是创作阶段进度 --> <!-- 以下是创作阶段进度 -->
<div class="stage-strip-track"> <div class="stage-strip-track">
@@ -91,90 +214,84 @@ function exportScript() {
v-for="(stage, index) in stages" v-for="(stage, index) in stages"
:key="stage.label" :key="stage.label"
class="stage-item" class="stage-item"
:class="{ done: stage.done }" :class="{ done: stage.done, 'stage-error': stage.error }"
:data-stage="stage.node"
:data-status="stage.status"
:aria-label="`${stage.label}:${stage.statusLabel}`"
:aria-current="stage.status === 'running' ? 'step' : undefined"
> >
<Check v-if="stage.done" :size="15" /><Circle v-else :size="13" /><span>{{ stage.label }}</span <LoaderCircle v-if="stage.status === 'running'" :size="15" class="animate-spin" />
<CircleAlert v-else-if="stage.error" :size="15" />
<Check v-else-if="stage.done" :size="15" /><Circle v-else :size="13" /><span
>{{ stage.label }} · {{ stage.statusLabel }}</span
><ArrowRight v-if="index < stages.length - 1" :size="13" class="stage-arrow" /> ><ArrowRight v-if="index < stages.length - 1" :size="13" class="stage-arrow" />
</div> </div>
</div></div </div>
></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">
<p class="text-sm text-muted">
已写入 {{ episodes.length }}<span v-if="total"> / {{ total }}</span> 集<span v-if="!total">
· 等待计划集数</span
>。{{
project?.status === 'generating'
? '剧本仍在生成,请等待状态更新。'
: '如中途停止,可从当前阶段继续。'
}}
</p>
<div class="flex flex-wrap gap-2">
<ConfirmAction
label="恢复生成"
description="用于剧集尚未写完的情况。系统会从已保存的角色、世界观和剧集进度继续生成。"
acknowledgement
:disabled="!canGenerate || operation.pending || backgroundExecution.active.value || !!error"
@confirm="resume('resume-generation')"
/><ConfirmAction
label="恢复改写"
description="用于剧集已齐全但审核未通过的情况。系统会从已保存的改写进度继续审核和调整。"
acknowledgement
:disabled="!canRewrite || operation.pending || backgroundExecution.active.value || !!error"
@confirm="resume('resume-rewrite')"
/>
</div> </div>
</div> <!-- 以下是紧凑任务摘要与入口,详细记录及恢复操作放入弹窗 -->
<NProgress <div v-if="project" class="script-task-toolbar">
v-if="total && !complete" <div
aria-label="已写入剧集数量" class="script-task-summary flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-muted"
type="line" role="status"
:show-indicator="false" >
:height="4" <span
:percentage="Math.min(100, Math.max(0, (Math.min(episodes.length, total) / Math.max(1, total)) * 100))" :class="{
class="mt-4" 'text-danger': taskError || backgroundExecution.query.data.value?.status === 'failed'
></NProgress> }"
>{{ taskSummary }}</span
>
<span
>已写入 {{ episodes.length }}<template v-if="total"> / {{ total }}</template> 集</span
>
<span
>时长规划:{{
project.durationMode === 'auto'
? '自动'
: project.durationMode === 'fixed_episode_count'
? '固定集数'
: '弹性集数'
}}</span
>
<span v-if="targetMinutes !== null">整剧目标约 {{ targetMinutes }} 分钟</span>
</div>
<WorkspaceActionTooltip label="查看创作任务" mobile-only>
<NButton
class="workspace-action-button script-task-button"
size="small"
aria-label="查看创作任务"
aria-haspopup="dialog"
:aria-expanded="taskOpen"
@click="taskOpen = true"
>
<template #icon><ClipboardList :size="15" aria-hidden="true" /></template>
<span class="script-task-button-label">创作任务</span>
</NButton>
</WorkspaceActionTooltip>
</div>
</template>
<div class="script-section"> <div class="script-section">
<!-- 以下是剧本内容标签与直接导出模块 -->
<div class="tabs-toolbar"> <div class="tabs-toolbar">
<NTabs v-model:value="tab" class="workspace-tabs" type="line" size="small" aria-label="剧本内容" <NTabs v-model:value="tab" class="workspace-tabs" type="line" size="small" aria-label="剧本内容"
><NTab name="episodes" ><NTab name="episodes">剧集正文</NTab><NTab name="characters">角色设定</NTab
>剧集正文 <span>{{ episodes.length }}</span></NTab ><NTab name="world">世界观</NTab><NTab name="review">审核记录</NTab>
><NTab name="characters">角色设定</NTab><NTab name="world">世界观</NTab
><NTab name="review">审核记录</NTab>
<template #suffix> <template #suffix>
<div class="tabs-toolbar-actions"> <!-- 以下是剧本正文直接导出模块 -->
<ActionMenu <WorkspaceExportButton label="导出剧本" :disabled="!episodes.length" @export="exportScript" />
label="剧本更多操作"
:items="[
{ key: 'history', label: showHistory ? '收起执行记录' : '执行记录' },
{ key: 'export', label: '导出剧本', disabled: !episodes.length }
]"
@select="$event === 'history' ? (showHistory = !showHistory) : exportScript()"
/>
</div>
</template> </template>
</NTabs> </NTabs>
</div> </div>
<div class="content-with-history panel mt-2" :class="{ 'history-hidden': !showHistory }"> <!-- 以下是剧本正文、角色设定、世界观与审核内容模块 -->
<main class="min-w-0"> <div class="script-content panel">
<main class="h-full min-h-0 min-w-0">
<div v-show="tab === 'episodes'" class="h-full"> <div v-show="tab === 'episodes'" class="h-full">
<EpisodeReader v-if="episodes.length" :episodes="episodes" /> <EpisodeReader v-if="episodes.length" :episodes="episodes" />
<EmptyState <EmptyState v-else title="剧本正在酝酿" description="先规划故事,再编写分集剧本。" />
v-else
title="剧本正在酝酿"
description="剧集写入数据库后会自动出现在这里。角色与世界观生成期间,可展开执行记录查看进度。"
/>
</div> </div>
<NScrollbar v-if="tab !== 'episodes'" class="panel-scroll" <NScrollbar v-if="tab !== 'episodes'" class="panel-scroll"
><div v-if="tab === 'characters'" class="p-6 lg:p-8"> ><div v-if="tab === 'characters'" class="p-6 lg:p-8">
<div v-if="project?.characters.length" class="record-list"> <!-- 角色背景通栏铺满,文字边界仍与世界观一致,上下间距保持不变。 -->
<div v-if="project?.characters.length" class="record-list script-character-list -my-5">
<article v-for="character in project.characters" :key="character.id"> <article v-for="character in project.characters" :key="character.id">
<div class="mb-3 flex items-center gap-3"> <div class="mb-3 flex items-center gap-3">
<h3 class="text-lg font-semibold">{{ character.name }}</h3> <h3 class="text-lg font-semibold">{{ character.name }}</h3>
@@ -231,44 +348,117 @@ function exportScript() {
</div> </div>
<EmptyState v-else title="尚无世界观" description="世界观会在角色设定之后生成。" /> <EmptyState v-else title="尚无世界观" description="世界观会在角色设定之后生成。" />
</div> </div>
<!-- 以下是按需读取的正式审核、人工确认与改写预检模块 -->
<div v-if="tab === 'review'" class="p-6 lg:p-8"> <div v-if="tab === 'review'" class="p-6 lg:p-8">
<p v-if="typeof state?.reviewPassed === 'boolean'" class="text-sm"> <DramaReviewPanel :project-id="projectId" :disabled="!!error" />
{{ state.reviewPassed ? '最近工作流审核通过' : '最近工作流审核未通过' }}
</p>
<EmptyState
v-else
title="暂无可用审核结果"
description="项目详情不再提供审核记录;可在执行记录中查看工作流状态。"
/><NCollapse
v-if="state?.rewriteSuggestion"
class="mt-5 text-sm"
:default-expanded-names="['details']"
><NCollapseItem name="details"
><template #header>查看改写建议原文</template>
<NScrollbar class="code-scroll mt-3" x-scrollable>
<pre class="json-view">{{
JSON.stringify(state.rewriteSuggestion, null, 2)
}}</pre>
</NScrollbar>
</NCollapseItem></NCollapse
>
</div> </div>
</NScrollbar> </NScrollbar>
</main> </main>
<HistoryPanel
v-if="showHistory"
:project-id="project?.id"
:checkpoints="checkpoints"
workflow="create-drama"
@close="showHistory = false"
/>
</div></div </div></div
></WorkspacePage> ></WorkspacePage>
<!-- 以下是创作任务弹窗,后台观察独立于弹窗显隐,正文可滚动、底栏固定 -->
<AppDialog v-model:open="taskOpen" title="创作任务" :width="800">
<div v-if="taskOpen" class="script-task-sections">
<ContextNotice v-if="historicalTask" type="info" title="当前剧本已完成审核" emphasized
>当前结果已更新;下方保留的是最近一次任务的执行记录。</ContextNotice
>
<WorkflowExecutionPanel
title="剧本创作任务"
:execution="backgroundExecution.query.data.value"
:loading="backgroundExecution.query.loading.value"
:error="taskError"
:result-is-historical="historicalTask"
embedded
@refresh="refreshTask"
/>
<p v-if="!backgroundExecution.query.data.value && !taskError" class="text-sm text-muted">
{{
backgroundExecution.query.loading.value || backgroundExecution.discovering.value
? '正在读取创作任务…'
: '暂无创作任务记录,当前展示已保存的剧本内容。'
}}
</p>
<!-- 以下是独立的剧集保存进度,数量不代表审核通过 -->
<section aria-label="剧集进度">
<WorkspaceSectionHeading title="剧集进度">
<template #actions>
<span class="text-sm text-muted"
>已写入 {{ episodes.length }}<span v-if="total"> / {{ total }}</span> 集</span
>
</template>
</WorkspaceSectionHeading>
</section>
<!-- 以下是缺少规划时的恢复限制,保留真实能力边界 -->
<section
v-if="!complete && !hasStoryPlan && !recoveryBlocked && project?.status !== 'generating'"
aria-label="恢复提示"
>
<ContextNotice type="warning" title="暂不能恢复生成" emphasized>
暂无故事规划,请新建剧本。
</ContextNotice>
</section>
<!-- 以下是默认收起的技术详情,不与日常进度和恢复提示混排 -->
<NCollapse v-if="backgroundExecution.query.data.value" class="text-sm text-muted">
<NCollapseItem name="task-details" title="高级详情">
<dl class="grid gap-2 pt-2">
<dt class="text-xs text-muted">任务编号</dt>
<dd class="break-all font-mono text-xs leading-6">
{{ backgroundExecution.query.data.value.id }}
</dd>
</dl>
</NCollapseItem>
</NCollapse>
</div>
<!-- 以下是固定底栏,恢复操作继续使用原有费用与任务停止确认 -->
<template #footer>
<div class="script-task-footer">
<NButton @click="taskOpen = false">关闭</NButton>
<WorkspaceRefreshButton
label="刷新状态"
:loading="backgroundExecution.query.loading.value || backgroundExecution.discovering.value"
@refresh="refreshTask"
/>
<template v-if="!complete">
<ConfirmAction
:loading="isOperationRunning(operation, '恢复剧集生成')"
label="恢复生成"
description="从已有规划继续编写剧集、补齐设定并审核。可能产生费用。"
acknowledgement
:disabled="!canGenerate || recoveryBlocked"
@confirm="resumeGeneration"
/>
<DramaRewriteAction
:project-id="projectId"
label="恢复改写"
:disabled="recoveryBlocked"
@started="refreshDrama()"
/>
</template>
</div>
</template>
</AppDialog>
</template> </template>
<style> <style>
/* 本组件专属布局与 Naive 内部结构覆盖。 */ /* 本组件专属布局与 Naive 内部结构覆盖。 */
@reference "../../styles/styles.css"; @reference "../../styles/styles.css";
/* 仅将角色背景扩展到内容区两侧,条目内文字补回原有的响应式留白。 */
.script-character-list {
@apply -mx-6 lg:-mx-8;
}
.script-character-list > article {
@apply px-6 lg:px-8;
}
/* 亮色正文底面与白色页面区分,角色、世界观和审核记录共用同一背景层级。 */
:root:not([data-theme='dark']) .script-workspace-page .script-content {
background: var(--app-subtle);
}
/* 保留角色斑马纹和展开详情的层次,不让它们与浅灰内容底面融为一体。 */
:root:not([data-theme='dark']) .script-workspace-page .script-content .record-list > article:nth-child(even),
:root:not([data-theme='dark']) .script-workspace-page .script-content .json-view {
background: var(--app-control);
}
.stage-strip { .stage-strip {
@apply flex items-center gap-3; @apply flex items-center gap-3;
} }
@@ -281,9 +471,18 @@ function exportScript() {
.stage-item.done { .stage-item.done {
@apply text-ink; @apply text-ink;
} }
.stage-item.stage-error {
color: var(--app-danger);
}
.stage-arrow { .stage-arrow {
@apply ml-3 text-muted; @apply ml-3 text-muted;
} }
@media (max-width: 760px) {
/* 生成期间手机仍可查看规划和节点状态;完成后保留正文阅读空间。 */
.script-workspace-page.script-creation-complete .stage-strip {
display: none;
}
}
.json-view { .json-view {
@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];
} }
@@ -318,14 +517,6 @@ function exportScript() {
.script-section .tabs-toolbar-actions { .script-section .tabs-toolbar-actions {
@apply min-h-0 flex-nowrap; @apply min-h-0 flex-nowrap;
} }
.script-section .content-with-history:not(.history-hidden) {
@apply relative;
grid-template-columns: minmax(0, 1fr);
grid-template-rows: minmax(0, 1fr);
}
.script-section .content-with-history:not(.history-hidden) .history-panel {
@apply absolute inset-0 z-30;
}
} }
.script-section { .script-section {
@apply flex-1 flex flex-col min-h-0; @apply flex-1 flex flex-col min-h-0;
@@ -333,16 +524,54 @@ function exportScript() {
.script-section > :first-child { .script-section > :first-child {
@apply shrink-0; @apply shrink-0;
} }
.script-section .content-with-history { /* 导出操作铺满标签栏高度,按钮宽度同步容器实测高度。 */
@apply flex-1 h-auto min-h-0; .script-section .workspace-tabs .n-tabs-nav__suffix,
.script-section .tabs-toolbar-actions {
align-items: stretch;
} }
.script-workspace-page .workspace-split > :not(.script-section) { .script-content {
@apply shrink-0; /* 内容独占剩余高度,目录和正文继续在各自的容器内滚动。 */
@apply flex-1 min-h-0 overflow-hidden;
/* 标签栏下方使用与页面上方相同的模块间距。 */
margin-top: var(--app-content-gap);
} }
.script-section .n-tabs-tab__label { .script-workspace-page .workspace-heading {
@apply inline-flex items-center gap-2; display: flex;
flex-direction: column;
gap: var(--app-content-gap);
} }
.script-section .content-with-history.history-hidden { .script-workspace-page .workspace-heading > * {
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[minmax(0,_1fr)]; margin-block: 0;
flex-shrink: 0;
}
/* 页面只保留一行任务摘要,窄屏自然换行,不挤占剧本阅读区域。 */
.script-task-toolbar {
@apply flex items-center justify-between gap-3;
}
.script-task-summary {
@apply min-w-0 flex-1;
}
/* 弹窗操作按可用宽度换行,所有关闭、刷新和恢复入口始终可见。 */
.script-task-footer {
@apply flex w-full flex-wrap items-center justify-end gap-2;
}
/* 按信息层级分组,状态、保存进度和恢复提示之间使用统一的双倍模块间距。 */
.script-task-sections {
display: grid;
gap: calc(var(--app-content-gap) * 2);
}
@media (max-width: 639px) {
.script-task-button-label {
display: none;
}
.n-button.script-task-button {
width: 40px;
height: 40px;
min-width: 40px;
padding: 0;
}
.script-task-button .n-button__icon {
margin: 0;
}
} }
</style> </style>
@@ -0,0 +1,195 @@
<script setup lang="ts">
import { NSkeleton } from 'naive-ui'
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
/** 正文段落占位宽度;只描述排版,不推测实际剧集数量和内容。 */
const paragraphs = [
['100%', '96%', '100%', '92%', '62%'],
['100%', '94%', '100%', '72%'],
['96%', '100%', '92%', '100%', '56%']
]
</script>
<template>
<WorkspacePage
split
compact
class="create-drama-skeleton"
role="status"
aria-label="正在读取剧本内容"
aria-busy="true"
>
<template #header>
<!-- 以下是创作阶段进度占位模块 -->
<div class="drama-skeleton-stages" aria-hidden="true">
<div v-for="stage in 5" :key="stage" class="drama-skeleton-stage">
<NSkeleton circle :width="14" :height="14" />
<NSkeleton :width="60" :height="11" />
</div>
</div>
</template>
<div class="drama-skeleton-section" aria-hidden="true">
<!-- 以下是剧本内容标签与导出按钮占位模块 -->
<div class="drama-skeleton-tabs">
<NSkeleton v-for="(width, tab) in [56, 56, 48, 56]" :key="tab" :width="width" :height="14" />
<NSkeleton class="drama-skeleton-action" />
</div>
<div class="drama-skeleton-reader panel">
<!-- 以下是剧集目录占位模块 -->
<div class="drama-skeleton-directory">
<div class="drama-skeleton-directory-heading">
<NSkeleton :width="64" :height="14" />
<NSkeleton :width="28" :height="11" />
</div>
<div v-for="episode in 5" :key="episode" class="drama-skeleton-episode">
<NSkeleton class="drama-skeleton-episode-number" :height="13" />
<NSkeleton
class="drama-skeleton-episode-title"
:width="episode % 2 ? '80%' : '64%'"
:height="12"
/>
</div>
</div>
<!-- 以下是剧集标题、摘要与正文占位模块 -->
<div class="drama-skeleton-page">
<div class="drama-skeleton-content">
<div class="drama-skeleton-chapter-heading">
<NSkeleton :width="60" :height="13" />
<NSkeleton :width="'46%'" :height="28" />
</div>
<div class="drama-skeleton-summary">
<NSkeleton :width="'94%'" :height="12" />
<NSkeleton :width="'72%'" :height="12" />
</div>
<div v-for="(lines, paragraph) in paragraphs" :key="paragraph" class="drama-skeleton-paragraph">
<NSkeleton v-for="(width, line) in lines" :key="line" :width="width" :height="14" />
</div>
</div>
</div>
<!-- 以下是手机底部章节导航占位模块 -->
<div class="drama-skeleton-mobile-navigation">
<NSkeleton :width="44" :height="14" />
<NSkeleton :width="80" :height="12" />
<NSkeleton :width="64" :height="18" />
</div>
</div>
</div>
</WorkspacePage>
</template>
<style scoped>
/* 骨架布局与剧本阅读器保持一致,颜色由 Naive UI 跟随当前主题。 */
@reference "../../styles/styles.css";
.drama-skeleton-stages {
@apply flex items-center gap-7;
}
.drama-skeleton-stage {
@apply flex shrink-0 items-center gap-[7px];
}
.drama-skeleton-section {
@apply flex flex-col flex-1 min-h-0;
}
.drama-skeleton-tabs {
@apply flex shrink-0 items-center gap-6 min-h-10;
/* 骨架屏与真实标签栏共用上下模块间距。 */
margin-bottom: var(--app-content-gap);
}
.drama-skeleton-action {
/* 对齐方形导出图标按钮,右侧不添加额外留白。 */
@apply ml-auto shrink-0;
width: var(--app-toolbar-icon-size, 40px);
height: var(--app-toolbar-icon-size, 40px);
}
.drama-skeleton-reader {
@apply grid grid-cols-[clamp(190px,_22%,_240px)_minmax(0,_1fr)] flex-1 min-h-0 overflow-hidden;
}
.drama-skeleton-directory {
@apply min-w-0 overflow-hidden bg-(--app-subtle);
}
:root:not([data-theme='dark']) .drama-skeleton-directory {
/* 占位目录沿用正式导航的浅色底色,保留左右分栏层次。 */
@apply bg-(--app-control);
}
:root:not([data-theme='dark']) .drama-skeleton-directory :deep(.n-skeleton) {
/* 导航底色加深后,浅色占位条仍需清晰可见。 */
--n-color-start: var(--app-border) !important;
--n-color-end: var(--app-field-hover) !important;
}
.drama-skeleton-directory-heading {
/* 占位标题与剧集条目使用同一左侧对齐线。 */
@apply flex items-center justify-between gap-2 pt-6 lg:pt-8 px-3.5 pb-3.5;
}
.drama-skeleton-episode {
@apply flex flex-col justify-center gap-2 min-h-16 py-3 px-3.5 mb-1.5;
}
.drama-skeleton-episode-number {
@apply w-12;
}
.drama-skeleton-page {
@apply min-w-0 overflow-hidden;
}
:root:not([data-theme='dark']) .drama-skeleton-page {
/* 浅色占位区域沿用正文底色,加载完成时保持背景一致。 */
@apply bg-(--app-subtle);
}
.drama-skeleton-mobile-navigation {
display: none;
}
.drama-skeleton-content {
@apply p-8 max-w-[900px];
}
.drama-skeleton-chapter-heading {
@apply flex flex-col gap-3 pb-[18px] mb-6;
}
.drama-skeleton-summary {
@apply flex flex-col gap-3 pt-[17px] pb-[22px] mb-[23px];
}
.drama-skeleton-paragraph {
@apply flex flex-col gap-4 mb-7;
}
@media (max-width: 1023px) {
/* 与刚统一的正文、角色设定和世界观使用相同内容留白。 */
.drama-skeleton-content {
@apply p-6;
}
}
@media (max-width: 1000px) {
.drama-skeleton-reader {
@apply grid-cols-[180px_minmax(0,_1fr)];
}
}
@media (max-width: 800px) {
.drama-skeleton-reader {
@apply flex flex-col;
}
.drama-skeleton-directory {
@apply hidden;
}
.drama-skeleton-page {
@apply flex-1 min-h-0;
}
.drama-skeleton-mobile-navigation {
@apply flex items-center justify-between min-h-11 shrink-0 px-3 bg-(--app-subtle);
padding-bottom: env(safe-area-inset-bottom);
}
.drama-skeleton-chapter-heading {
@apply gap-1 pb-2 mb-3;
}
.drama-skeleton-summary {
@apply pt-0 pb-4 mb-4;
}
.drama-skeleton-tabs {
@apply gap-3;
}
}
@media (max-width: 760px) {
.create-drama-skeleton :deep(.workspace-heading-scroll) {
@apply hidden;
}
}
@media (prefers-reduced-motion: reduce) {
.create-drama-skeleton :deep(.n-skeleton) {
animation: none;
}
}
</style>
+228 -32
View File
@@ -1,9 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { NButton, NScrollbar, type ScrollbarInst } from 'naive-ui' import { NButton, NDrawer, NDrawerContent, NScrollbar, type ScrollbarInst } from 'naive-ui'
import { ChevronLeft, ChevronRight, List } from '@lucide/vue'
import { computed, onBeforeUnmount, onMounted, ref, useId, watch } from 'vue' import { computed, onBeforeUnmount, onMounted, ref, useId, watch } from 'vue'
import type { Episode } from '../projects/types' import type { Episode } from '../projects/types'
/** 连续剧本阅读器:目录与正文独立滚动,导航仅影响本阅读器。 */ /** 连续剧本阅读器:宽屏目录与正文独立滚动,手机采用全宽正文与底部目录。 */
const props = defineProps<{ episodes: Episode[] }>() const props = defineProps<{ episodes: Episode[] }>()
const orderedEpisodes = computed(() => props.episodes.toSorted((a, b) => a.episode - b.episode)) const orderedEpisodes = computed(() => props.episodes.toSorted((a, b) => a.episode - b.episode))
const active = ref(orderedEpisodes.value[0]?.episode) const active = ref(orderedEpisodes.value[0]?.episode)
@@ -13,7 +14,14 @@ const directoryContent = ref<HTMLElement>()
const readerContent = ref<HTMLElement>() const readerContent = ref<HTMLElement>()
const viewportHeight = ref(400) const viewportHeight = ref(400)
const readerId = useId() const readerId = useId()
const readingInset = 32 /** 手机目录抽屉仅在用户点击目录时打开,不占用正文宽度。 */
const directoryOpen = ref(false)
/** 抽屉目录根节点,用于打开时定位到当前集。 */
const sheetContent = ref<HTMLElement>()
/** 当前集在有序目录中的位置,支持不连续的剧集编号。 */
const activeIndex = computed(() => orderedEpisodes.value.findIndex(item => item.episode === active.value))
/** 缓存正文顶部留白,目录跳转与当前集判断使用同一阅读线。 */
let readingInset = 32
let viewport: HTMLElement | null = null let viewport: HTMLElement | null = null
let directoryViewport: HTMLElement | null = null let directoryViewport: HTMLElement | null = null
let observer: ResizeObserver | undefined let observer: ResizeObserver | undefined
@@ -51,28 +59,56 @@ function syncActive() {
active.value = current active.value = current
} }
/** 内容或面板尺寸变化时重测;隐藏标签不覆盖缓存和已有阅读位置。 */ /** 内容或尺寸变化时同步章节位置并对齐滚动像素,避免首集与跳转后的标题出现小数偏差。 */
function measure() { function measure() {
if (!viewport?.clientHeight || !readerContent.value) return if (!viewport?.clientHeight || !readerContent.value) return
viewportHeight.value = viewport.clientHeight viewportHeight.value = viewport.clientHeight
readingInset = parseFloat(getComputedStyle(readerContent.value).paddingTop) || 32
const origin = viewport.getBoundingClientRect().top - viewport.scrollTop const origin = viewport.getBoundingClientRect().top - viewport.scrollTop
positions = [...readerContent.value.querySelectorAll<HTMLElement>('[data-episode]')].map(item => ({ positions = [...readerContent.value.querySelectorAll<HTMLElement>('[data-episode]')].map(item => {
episode: Number(item.dataset.episode), // 先扣除上次微调,再按滚动距离取整,反复测量时不会累积偏移。
top: item.getBoundingClientRect().top - origin const previousOffset = parseFloat(item.style.getPropertyValue('--reader-chapter-offset')) || 0
})) const top = item.getBoundingClientRect().top - origin - previousOffset
const alignedTop = readingInset + Math.round(top - readingInset)
item.style.setProperty('--reader-chapter-offset', `${alignedTop - top}px`)
return { episode: Number(item.dataset.episode), top: alignedTop }
})
syncActive() syncActive()
} }
/** 点击目录使用组件公开方法即时定位,避免长距离平滑滚动经过多集时高亮闪烁。 */ /**
* 即时定位所选剧集并关闭手机目录,避免长距离平滑滚动造成高亮闪烁。
* @param episode 需要定位的剧集编号
*/
function selectEpisode(episode: number) { function selectEpisode(episode: number) {
measure() measure()
const position = positions.find(item => item.episode === episode) const position = positions.find(item => item.episode === episode)
if (!position) return if (!position) return
reader.value?.scrollTo({ top: Math.max(0, position.top - readingInset), behavior: 'auto' }) reader.value?.scrollTo({ top: Math.max(0, position.top - readingInset), behavior: 'auto' })
active.value = episode active.value = episode
directoryOpen.value = false
revealActive() revealActive()
} }
/**
* 按目录顺序切换相邻剧集,首集和末集不越界。
* @param offset 上一集或下一集的相对位置
*/
function selectRelativeEpisode(offset: -1 | 1) {
const episode = orderedEpisodes.value[activeIndex.value + offset]
if (episode) selectEpisode(episode.episode)
}
/** 目录抽屉展开后露出当前集,只滚动抽屉内部列表。 */
function revealSheetActive() {
const item = sheetContent.value?.querySelector<HTMLElement>('[aria-current="location"]')
const scroll = scrollContainer(sheetContent.value)
if (!item || !scroll) return
scroll.scrollTo({
top: scroll.scrollTop + item.getBoundingClientRect().top - scroll.getBoundingClientRect().top - 8
})
}
watch(active, revealActive, { flush: 'post' }) watch(active, revealActive, { flush: 'post' })
watch( watch(
orderedEpisodes, orderedEpisodes,
@@ -83,6 +119,7 @@ watch(
{ flush: 'post', deep: true } { flush: 'post', deep: true }
) )
/** 挂载后测量阅读区域,尺寸变化时更新章节位置并关闭宽屏下的手机目录。 */
onMounted(() => { onMounted(() => {
viewport = scrollContainer(readerContent.value) viewport = scrollContainer(readerContent.value)
directoryViewport = scrollContainer(directoryContent.value) directoryViewport = scrollContainer(directoryContent.value)
@@ -96,6 +133,8 @@ onMounted(() => {
observer = new ResizeObserver(() => { observer = new ResizeObserver(() => {
measure() measure()
revealActive() revealActive()
// 恢复宽屏布局时关闭手机目录,避免遮罩继续覆盖正文。
if (window.innerWidth > 800) directoryOpen.value = false
}) })
if (viewport) observer.observe(viewport) if (viewport) observer.observe(viewport)
if (readerContent.value) observer.observe(readerContent.value) if (readerContent.value) observer.observe(readerContent.value)
@@ -107,6 +146,7 @@ onBeforeUnmount(() => observer?.disconnect())
<template> <template>
<div class="episode-reader"> <div class="episode-reader">
<!-- 以下是宽屏分集目录模块 -->
<nav class="reader-directory" aria-label="剧集目录"> <nav class="reader-directory" aria-label="剧集目录">
<div class="reader-directory-heading"> <div class="reader-directory-heading">
<h3>分集剧本</h3> <h3>分集剧本</h3>
@@ -128,6 +168,9 @@ onBeforeUnmount(() => observer?.disconnect())
> >
<span class="reader-episode-label">第 {{ item.episode }} 集</span> <span class="reader-episode-label">第 {{ item.episode }} 集</span>
<span class="reader-episode-title">{{ item.title || '未命名剧集' }}</span> <span class="reader-episode-title">{{ item.title || '未命名剧集' }}</span>
<span v-if="item.targetDurationSeconds !== null" class="text-xs text-muted"
>{{ item.targetDurationSeconds }}秒</span
>
</NButton> </NButton>
</div> </div>
</NScrollbar> </NScrollbar>
@@ -144,7 +187,13 @@ onBeforeUnmount(() => observer?.disconnect())
class="reader-chapter" class="reader-chapter"
> >
<header class="reader-chapter-heading"> <header class="reader-chapter-heading">
<p>第 {{ item.episode }} 集</p> <p>
第 {{ item.episode }} 集<span
v-if="item.targetDurationSeconds !== null"
class="ml-3 text-xs text-muted"
>目标 {{ item.targetDurationSeconds }} 秒</span
>
</p>
<h2 :id="`${readerId}-heading-${item.episode}`">{{ item.title || '未命名剧集' }}</h2> <h2 :id="`${readerId}-heading-${item.episode}`">{{ item.title || '未命名剧集' }}</h2>
</header> </header>
<p v-if="item.summary" class="script-summary">{{ item.summary }}</p> <p v-if="item.summary" class="script-summary">{{ item.summary }}</p>
@@ -164,6 +213,79 @@ onBeforeUnmount(() => observer?.disconnect())
</div> </div>
</NScrollbar> </NScrollbar>
</div> </div>
<!-- 以下是手机底部章节导航模块,正文与导航分别占用独立空间 -->
<nav class="reader-mobile-navigation" aria-label="章节导航">
<NButton
quaternary
class="reader-directory-trigger"
aria-label="打开剧集目录"
aria-haspopup="dialog"
:aria-expanded="directoryOpen"
@click="directoryOpen = true"
>
<template #icon><List :size="18" aria-hidden="true" /></template>
目录
</NButton>
<span class="reader-mobile-position">第 {{ active }} 集 / 共 {{ orderedEpisodes.length }} 集</span>
<NButton
quaternary
class="icon-button reader-chapter-control"
aria-label="上一集"
:disabled="activeIndex <= 0"
@click="selectRelativeEpisode(-1)"
>
<template #icon><ChevronLeft :size="20" aria-hidden="true" /></template>
</NButton>
<NButton
quaternary
class="icon-button reader-chapter-control"
aria-label="下一集"
:disabled="activeIndex < 0 || activeIndex >= orderedEpisodes.length - 1"
@click="selectRelativeEpisode(1)"
>
<template #icon><ChevronRight :size="20" aria-hidden="true" /></template>
</NButton>
</nav>
<!-- 以下是手机分集目录抽屉模块,保留完整标题方便查找和跳转 -->
<NDrawer
v-model:show="directoryOpen"
placement="bottom"
height="min(70dvh, 560px)"
class="reader-directory-sheet"
@after-enter="revealSheetActive"
>
<!-- 列表正文取消左右内边距,让目录项背景铺满抽屉宽度 -->
<NDrawerContent
title="分集剧本"
closable
:native-scrollbar="false"
:body-content-style="{ padding: '0 0 max(12px, env(safe-area-inset-bottom))' }"
>
<!-- 以下是垂直居中的目录标题与总集数模块 -->
<template #header>
<div class="reader-sheet-heading">
<span class="reader-sheet-title">分集剧本</span>
<span class="reader-sheet-count">/ 共 {{ orderedEpisodes.length }} 集</span>
</div>
</template>
<div ref="sheetContent" class="reader-sheet-directory" role="navigation" aria-label="手机剧集目录">
<NButton
v-for="item in orderedEpisodes"
:key="item.episode"
quaternary
block
class="reader-episode-link reader-sheet-episode-link"
:class="{ active: active === item.episode }"
:aria-current="active === item.episode ? 'location' : undefined"
:aria-controls="`${readerId}-episode-${item.episode}`"
@click="selectEpisode(item.episode)"
>
<span class="reader-episode-label">第 {{ item.episode }} 集</span>
<span class="reader-episode-title">{{ item.title || '未命名剧集' }}</span>
</NButton>
</div>
</NDrawerContent>
</NDrawer>
</div> </div>
</template> </template>
@@ -186,14 +308,25 @@ onBeforeUnmount(() => observer?.disconnect())
@apply text-muted leading-[1.8] mb-[15px]; @apply text-muted leading-[1.8] mb-[15px];
} }
.episode-reader { .episode-reader {
/* 正文与吸顶标题共用底色,切换主题后保持连续的阅读背景。 */
--reader-background: var(--app-surface);
@apply grid grid-cols-[clamp(190px,_22%,_240px)_minmax(0,_1fr)] h-full min-h-0 min-w-0 overflow-hidden; @apply grid grid-cols-[clamp(190px,_22%,_240px)_minmax(0,_1fr)] h-full min-h-0 min-w-0 overflow-hidden;
container-type: inline-size; container-type: inline-size;
} }
:root:not([data-theme='dark']) .episode-reader {
/* 浅色正文增加浅灰底色,与白色页面区分。 */
--reader-background: var(--app-subtle);
}
.reader-directory { .reader-directory {
@apply flex flex-col min-h-0 min-w-0 bg-(--app-subtle); @apply flex flex-col min-h-0 min-w-0 bg-(--app-subtle);
} }
:root:not([data-theme='dark']) .reader-directory {
/* 浅色目录比正文深一级,明确区分章节导航和阅读区域。 */
@apply bg-(--app-control);
}
.reader-directory-heading { .reader-directory-heading {
@apply flex justify-between items-center shrink-0 gap-2 pt-[22px] px-5 pb-3.5 text-[13px]; /* 目录标题与剧集条目统一左侧留白。 */
@apply flex justify-between items-center shrink-0 gap-2 pt-6 lg:pt-8 px-3.5 pb-3.5 text-[13px];
} }
.reader-directory-heading h3 { .reader-directory-heading h3 {
@apply font-semibold; @apply font-semibold;
@@ -223,7 +356,28 @@ onBeforeUnmount(() => observer?.disconnect())
@apply bg-(--app-selected) text-accent shadow-[inset_3px_0_var(--app-accent)]; @apply bg-(--app-selected) text-accent shadow-[inset_3px_0_var(--app-accent)];
} }
.reader-page { .reader-page {
@apply min-w-0 min-h-0 overflow-hidden bg-(--app-surface); @apply min-w-0 min-h-0 overflow-hidden bg-(--reader-background);
}
/* 手机导航只在窄屏显示,抽屉内容复用同一目录条目样式。 */
.reader-mobile-navigation {
display: none;
}
.reader-sheet-heading {
/* 标题与总集数共用一条垂直居中线,避免不同字号按基线错位。 */
@apply flex items-center gap-2 min-w-0;
}
.reader-sheet-title {
@apply text-sm leading-5;
}
.reader-sheet-count {
@apply text-xs leading-5 text-muted font-normal;
}
.reader-sheet-directory {
@apply flex flex-col gap-1.5 py-2;
}
.n-button.reader-sheet-episode-link {
/* 条目背景铺满整行,文字与抽屉标题保持同一左侧对齐线。 */
padding-inline: 24px;
} }
.reader-scroll .n-scrollbar-container:focus-visible { .reader-scroll .n-scrollbar-container:focus-visible {
@apply outline-[2px_solid_var(--app-accent)] outline-offset-[-3px]; @apply outline-[2px_solid_var(--app-accent)] outline-offset-[-3px];
@@ -234,17 +388,23 @@ onBeforeUnmount(() => observer?.disconnect())
/* 正文紧邻目录左对齐,保留阅读行宽,不在宽屏内容区居中。 */ /* 正文紧邻目录左对齐,保留阅读行宽,不在宽屏内容区居中。 */
max-width: 900px; max-width: 900px;
} }
.reader-chapter {
/* 浏览器会取整滚动距离;整章最多微调半像素,让标题、摘要与正文使用相同起点。 */
translate: 0 var(--reader-chapter-offset, 0px);
}
.reader-chapter + .reader-chapter { .reader-chapter + .reader-chapter {
@apply mt-12 pt-9; /* 章节间隔全部放在外部,目录定位到章节顶部时不再额外带入 36px 内边距。 */
@apply mt-21;
} }
.reader-chapter:last-child { .reader-chapter:last-child {
/* 末集较短时仍可定位到阅读线,不必把倒数第二集误认为当前集。 */ /* 末集较短时仍可定位到阅读线,不必把倒数第二集误认为当前集。 */
min-height: max(160px, calc(var(--reader-height) - 64px)); min-height: max(160px, calc(var(--reader-height) - var(--reader-gutter) - var(--reader-gutter)));
} }
.reader-chapter-heading { .reader-chapter-heading {
@apply sticky top-0 z-[2] mb-6 bg-(--app-surface); @apply sticky top-0 z-[2] mb-6 bg-(--reader-background);
margin-inline: calc(var(--reader-gutter) * -1); margin-inline: calc(var(--reader-gutter) * -1);
padding: 14px var(--reader-gutter) 18px; /* 顶部留白由正文容器统一提供,避免与世界观、角色设定相比重复叠加。 */
padding: 0 var(--reader-gutter) 18px;
} }
.reader-chapter-heading p { .reader-chapter-heading p {
@apply text-muted text-[13px] font-medium mb-2.5; @apply text-muted text-[13px] font-medium mb-2.5;
@@ -252,6 +412,26 @@ onBeforeUnmount(() => observer?.disconnect())
.reader-chapter-heading h2 { .reader-chapter-heading h2 {
@apply text-[clamp(18px,2cqw,24px)] font-semibold leading-[1.6] wrap-anywhere; @apply text-[clamp(18px,2cqw,24px)] font-semibold leading-[1.6] wrap-anywhere;
} }
/* 各屏幕吸顶时均保留正文顶部留白,滚动文字由同色遮挡层覆盖,避免手机标题贴边。 */
.reader-chapter-heading {
top: var(--reader-gutter);
}
.reader-chapter-heading::before {
content: '';
position: absolute;
inset-inline: 0;
top: calc(var(--reader-gutter) * -1);
height: var(--reader-gutter);
background: var(--reader-background);
pointer-events: none;
}
@media (max-width: 1023px) {
/* 与角色设定、世界观的 p-6 / lg:p-8 使用相同的响应式内容边界。 */
.reader-content {
--reader-gutter: 24px;
@apply p-6;
}
}
@media (max-width: 1000px) { @media (max-width: 1000px) {
.episode-reader { .episode-reader {
@apply grid-cols-[180px_minmax(0,_1fr)]; @apply grid-cols-[180px_minmax(0,_1fr)];
@@ -259,29 +439,45 @@ onBeforeUnmount(() => observer?.disconnect())
} }
@media (max-width: 800px) { @media (max-width: 800px) {
.episode-reader { .episode-reader {
@apply grid-cols-[72px_minmax(0,_1fr)]; @apply flex flex-col;
} }
.reader-directory-heading { .reader-directory {
@apply flex-col items-start gap-0 pt-2.5 px-1.5 pb-2;
}
.reader-directory-heading h3 {
@apply hidden; @apply hidden;
} }
.n-button.reader-episode-link { .reader-page {
@apply min-h-11 py-2 px-1; @apply flex-1;
} }
.n-button.reader-episode-link .n-button__content { .reader-mobile-navigation {
@apply items-center text-center; @apply flex items-center shrink-0 min-w-0 bg-(--app-subtle);
padding-bottom: env(safe-area-inset-bottom);
} }
.reader-episode-title { .reader-mobile-position {
@apply hidden; @apply flex-1 min-w-0 truncate text-center text-xs text-muted px-1;
} }
.reader-episode-label { .n-button.reader-directory-trigger {
@apply text-[11px]; @apply h-11 px-3 text-xs;
} }
.reader-content { .n-button.reader-chapter-control {
--reader-gutter: 18px; @apply w-11 min-w-11 h-11;
@apply px-[18px]; }
.n-button.reader-chapter-control:disabled,
.n-button.reader-chapter-control:disabled svg {
/* 首集与末集的边界按钮保留禁用行为,并明确以灰色图标显示。 */
color: var(--app-disabled-text);
}
.reader-chapter + .reader-chapter {
@apply mt-8 pt-0;
}
.reader-chapter-heading {
@apply mb-3;
padding-block: 0 8px;
}
.reader-chapter-heading p {
@apply mb-1;
}
.episode-reader .script-summary {
/* 标题后立即进入摘要,减少摘要与正文之间的空白。 */
@apply pt-0 pb-4 mb-4;
} }
} }
</style> </style>
+102
View File
@@ -0,0 +1,102 @@
import type { ProjectDetail } from '../projects/types'
import type { WorkflowExecution, WorkflowExecutionStatus } from '../workflows/execution.types'
import type { Checkpoint } from '../workflows/types'
/** 创作阶段的只读展示,状态沿用服务端执行枚举,未知时保留空值。 */
export interface DramaStage {
/** 正式工作流节点。 */
node: string
/** 中文阶段名称。 */
label: string
/** 来自执行记录或已保存输出的状态。 */
status: WorkflowExecutionStatus | null
/** 面向用户的阶段说明。 */
statusLabel: string
/** 当前阶段是否明确审核通过或保存完成。 */
done: boolean
/** 节点失败或审核未通过,需要使用错误样式。 */
error: boolean
}
/** 创作流程展示顺序只用于排版,不能按位置补齐前序节点的成功状态。 */
const nodes = [
['generateStoryPlan', '故事规划'],
['generateEpisode', '编写剧集'],
['generateCharacter', '角色设定'],
['generateWorld', '世界观'],
['reviewDrama', '审核与改写'],
['finishProject', '完成']
] as const
/** 改写相关节点归入已有审核阶段,不影响其它节点的状态。 */
const reviewNodes = [
'reviewDrama',
'generateRewriteSuggestion',
'rewrite',
'resumeRewrite',
'resumeReview',
'resolveDramaQuality'
]
/**
* 合并当前执行与最新保存记录,既不由节点顺序推断成功,也不复用新任务之前的旧审核结果。
* @param project 正式项目详情
* @param checkpoint 当前创作工作流的最新保存记录
* @param execution 当前持久化任务
* @returns 各阶段的只读展示
*/
export function dramaStages(
project: ProjectDetail | null,
checkpoint: Checkpoint | undefined,
execution: WorkflowExecution | null
): DramaStage[] {
const state = checkpoint?.state
const currentSnapshot =
!execution ||
(!!checkpoint && Date.parse(checkpoint.createdAt) >= Date.parse(execution.startedAt ?? execution.createdAt))
const saved = currentSnapshot ? state : undefined
// 仅恢复审核时,服务端预检已绑定具体保存记录,前序产物继续有效;旧审核不能当成本轮结论。
const reusesReviewSource =
execution?.metadata?.action === 'resume-review' && execution.metadata.checkpointId === checkpoint?.checkpointId
const savedContent = currentSnapshot || reusesReviewSource ? state : undefined
const count = project?.episodeCount ?? saved?.episodeCount
const completed: Record<string, boolean> = {
// 恢复服务明确复用最新保存记录中的规划;不从 Episode、Character 或执行顺序反推规划成功。
generateStoryPlan:
!!state?.storyPlan &&
(currentSnapshot ||
execution?.metadata?.action === 'resume-generation' ||
execution?.metadata?.action === 'resume-rewrite' ||
reusesReviewSource),
generateEpisode: !!count && (savedContent?.episodes?.length ?? 0) >= count,
generateCharacter: !!savedContent?.characters,
generateWorld: !!savedContent?.world,
reviewDrama: typeof saved?.reviewPassed === 'boolean',
finishProject: project?.status === 'completed'
}
return nodes.map(([node, label]) => {
const current =
execution?.stage === node || (node === 'reviewDrama' && reviewNodes.includes(execution?.stage ?? ''))
const status: WorkflowExecutionStatus | null =
current && execution?.status !== 'completed'
? (execution?.status ?? null)
: completed[node]
? 'completed'
: execution && ['pending', 'running'].includes(execution.status)
? 'pending'
: null
const rejected = node === 'reviewDrama' && status === 'completed' && saved?.reviewPassed === false
return {
node,
label,
status,
statusLabel: rejected
? '未通过'
: status === null
? '待确认'
: { pending: '等待更新', running: '进行中', completed: '已完成', failed: '失败' }[status],
done: status === 'completed' && !rejected,
error: status === 'failed' || rejected
}
})
}
@@ -0,0 +1,877 @@
<script setup lang="ts">
import { computed, nextTick, onScopeDispose, ref, watch } from 'vue'
import { NButton, NCheckbox, NCollapse, NCollapseItem, NForm, NScrollbar, NSelect, NTag } from 'naive-ui'
import { FileCheck2, FileSearch, Plus } from '@lucide/vue'
import { AppDrawer, EmptyState, WorkspaceRefreshButton, WorkspaceSectionHeading } from '../../../components/ui'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { formatDate } from '../../../lib/format'
import { userFacingText } from '../../../lib/user-facing-text'
import { useQuery } from '../../../composables/useQuery'
import { useProjectContext } from '../../projects/context'
import { workflowCheckpoints } from '../../workflows/selectors'
import DramaRewriteAction from './DramaRewriteAction.vue'
import DramaSystemReviewAction from './DramaSystemReviewAction.vue'
import ManualReviewIssueEditor from './ManualReviewIssueEditor.vue'
import ReviewUncertaintyCard from './ReviewUncertaintyCard.vue'
import { reviewCategoryOptions, suggestionForUncertainty, savedReviewDecisions } from './model'
import { useDramaReview } from './useDramaReview'
import { loadDramaRewritePreview } from './api'
import type { DramaReviewIssue, DramaReviewPreview, DeferredUncertaintyDraft } from './types'
/** 审核记录只在用户切到当前标签时挂载,不为其它页面额外查询。 */
const props = withDefaults(
defineProps<{
/** 当前正式项目。 */ projectId: string
/** 项目查询失败等外部限制。 */ disabled?: boolean
}>(),
{ disabled: false }
)
/** 正式项目、保存记录与导航状态共用同一个数据源。 */
const context = useProjectContext()
/** 审核需要完整创作保存记录中的原始结论和裁决。 */
const dramaCheckpoints = context.useWorkflowCheckpoints('create-drama')
/** 当前入口绑定的项目,异步响应必须核对归属。 */
const projectId = computed(() => props.projectId)
/** 外部项目错误只限制写入,仍可只读查看。 */
const disabled = computed(
() =>
props.disabled ||
!!context.error.value ||
context.summaryBlocked.value ||
dramaCheckpoints.loading.value ||
!!dramaCheckpoints.error.value ||
dramaCheckpoints.data.value === null
)
/** 人工确认与稳定原始索引选择。 */
/** 审核、改写及人工裁决只刷新创作记录和项目详情。 */
async function refreshReview() {
const id = projectId.value
if (!id) return
await Promise.all([context.refreshWorkflow('create-drama', id), context.refreshProject()])
}
const flow = useDramaReview(projectId, refreshReview, disabled)
/** 最新正式审核。 */
const latest = computed(() => flow.query.data.value?.latest ?? null)
/** 当前已核对的处理预检。 */
const preview = computed(() => flow.query.data.value?.preview ?? null)
/** 当前审核每次重读后同步查询改写范围,不从集号数量推断角色或世界观能否改写。 */
const rewriteKey = computed(() =>
latest.value?.passed === false
? JSON.stringify([projectId.value, latest.value.id, preview.value?.checkpointId, flow.query.updatedAt.value])
: ''
)
/**
* 查询当前真实改写范围,并拒绝与人工确认来源不同的保存记录。
* @param key 当前审核查询版本,空值时不发送请求
* @param signal 取消过期查询
* @returns 当前改写预检或空值
*/
async function readRewriteAvailability(key: string, signal: AbortSignal) {
if (!key) return null
const id = projectId.value
const checkpointId = preview.value?.checkpointId
const result = await loadDramaRewritePreview(id, signal)
if (checkpointId && result.checkpointId !== checkpointId)
throw new Error('审核与改写范围的保存记录已变化,请刷新审核后重新核对。')
return result
}
/** 改写预检只读查询,项目和保存记录变化时自动取消旧结果。 */
const rewriteQuery = useQuery(rewriteKey, readRewriteAvailability)
/** 只展示与当前项目及当前保存记录一致的真实改写范围。 */
const currentRewrite = computed(() => {
const result = rewriteQuery.data.value
return result?.projectId === projectId.value &&
(!preview.value || result.checkpointId === preview.value.checkpointId)
? result
: null
})
/** 只在预检确有剩余待处理项时显示人工确认入口,不为已处理完的审核保留空操作。 */
const hasManualIssues = computed(
() =>
latest.value?.passed === false &&
!!preview.value &&
!!(flow.pendingRows.value.length || flow.uncertaintyRows.value.length)
)
/** 任一真实改写模块存在时保留入口,支持没有集号的角色或世界观单独改写。 */
const hasRewriteTargets = computed(
() =>
latest.value?.passed === false &&
!rewriteQuery.error.value &&
!!(
currentRewrite.value?.rewriteEpisodes ||
currentRewrite.value?.rewriteCharacters ||
currentRewrite.value?.rewriteWorld
)
)
/** 当前有效预检只强调一个下一步入口,配色不代替服务端操作权限。 */
const primaryAction = computed<'review' | 'rewrite' | null>(() => {
if (flow.locked.value || rewriteQuery.loading.value || rewriteQuery.error.value || latest.value?.passed !== false)
return null
if (currentRewrite.value?.status === 'blocked' || currentRewrite.value?.status === 'stale') return null
if (hasRewriteTargets.value) return currentRewrite.value?.ready === true ? 'rewrite' : null
return hasManualIssues.value ? 'review' : null
})
/** 剧集范围同样读取真实改写预检,设定单独改写不伪造成剧集任务。 */
const rewriteEpisodeSummary = computed(() => {
const result = currentRewrite.value
if (rewriteQuery.loading.value || rewriteQuery.error.value || !result) return '待确认'
if (result.rewriteEpisodes && result.episodeNumbers.length) return `第 ${result.episodeNumbers.join('、')} 集`
return result.rewriteCharacters || result.rewriteWorld ? '仅涉及设定' : '暂无剧集改写'
})
/** 下一步说明只读取服务端已有的改写依据,不预先接受问题或启动模型。 */
const nextStep = computed(() => {
const result = currentRewrite.value
const scope = [
result?.rewriteEpisodes ? `第 ${result.episodeNumbers.join('、')} 集` : '',
result?.rewriteCharacters ? '角色设定' : '',
result?.rewriteWorld ? '世界观' : ''
]
.filter(Boolean)
.join('、')
return hasRewriteTargets.value
? {
title: '已有改写依据,请检查改写范围',
description: `${scope}已有改写依据。点击“改写预检”核对范围${hasManualIssues.value ? ';待确认问题仍可继续人工处理' : ''}。开始改写前会再次确认费用。`
}
: {
title: '可由系统继续核查',
description:
'点击“系统重新核查”检查已保存正文,系统会优先复核疑点。只有仍无法确认的关键问题才需要人工处理。'
}
})
/** 正式正文的当前阅读集号。 */
const sourceEpisode = ref<number | null>(null)
/** 原文容器用于抽屉内定位,不切换到另一个主界面。 */
const sourceElement = ref<HTMLElement | null>(null)
/** 人工补充证据区用于用户主动操作后的抽屉内定位。 */
const manualElement = ref<HTMLElement | null>(null)
/** 完整正文桌面展开、手机按需展开,避免短屏首次进入被原文占满。 */
const sourceMedia = window.matchMedia('(min-width: 1024px)')
/** 当前只读正文折叠状态,不影响任何审核选择。 */
const sourceExpanded = ref<string[]>(sourceMedia.matches ? ['source'] : [])
/**
* 屏幕断点变化时同步适合当前尺寸的正文展示方式。
* @param event 当前桌面断点
*/
function syncSourceMedia(event: MediaQueryListEvent) {
sourceExpanded.value = event.matches ? ['source'] : []
}
sourceMedia.addEventListener('change', syncSourceMedia)
onScopeDispose(() => sourceMedia.removeEventListener('change', syncSourceMedia))
/** 改写预检复用页面上的唯一入口。 */
const rewriteAction = ref<InstanceType<typeof DramaRewriteAction> | null>(null)
/** 仅记录用户主动的界面交接意图,避免同时叠加抽屉和预检弹窗。 */
const queuedRewriteProject = ref('')
/** 读取中或失败时不把上次通过结果显示为当前成功。 */
const reviewUncertain = computed(() => flow.query.loading.value || !!flow.query.error.value)
/** 服务端回执说明下一步,不根据分类计数推断已经通过。 */
const receiptSummary = computed(() => {
const result = flow.receipt.value
if (!result) return ''
if (result.finalized) return '本次人工处理已由系统确认完成,请以最新审核与阶段状态为准。'
return result.confirmedEpisodes.length
? `本次已记录第 ${result.confirmedEpisodes.join('、')} 集的改写依据。请核对改写范围后再决定是否继续。`
: '本次人工处理已保存,请继续核对剩余问题和改写范围。'
})
watch(projectId, () => {
queuedRewriteProject.value = ''
})
/** 待处理正文来自预检,通过后仍可只读查看当前项目已保存的正式正文。 */
const sourceEpisodes = computed<DramaReviewPreview['episodes']>(
() =>
preview.value?.episodes ??
(latest.value?.passed && context.project.value?.id === projectId.value
? context.project.value.episodes.map(({ episode, content }) => ({ episode, content }))
: [])
)
/** 正文选项来自实际保存的剧集,不根据计划数量补造内容。 */
const episodeOptions = computed(() =>
sourceEpisodes.value.map(item => ({ label: `第 ${item.episode} 集`, value: item.episode }))
)
/** 当前完整正文以纯文本展示。 */
const sourceContent = computed(
() => sourceEpisodes.value.find(item => item.episode === sourceEpisode.value)?.content ?? ''
)
/** 角色选项沿用正式项目数据,用户不能填写猜测的角色名。 */
const characters = computed(() => context.project.value?.characters.map(item => item.name) ?? [])
/** 仍待处理的问题按正式集号分组,原始索引不变。 */
const groups = computed(() =>
[...new Set(flow.pendingRows.value.map(row => row.issue.episode))]
.toSorted((a, b) => a - b)
.map(episode => ({ episode, rows: flow.pendingRows.value.filter(row => row.issue.episode === episode) }))
)
/** 原始已记录问题只读展示,不用它覆盖当前剩余裁决。 */
const recordedIssues = computed(() => latest.value?.qualityReview?.issues ?? [])
/** 现有延期等裁决只作追溯,不能把接受视为已完成后续核验。 */
const decisions = computed(() => {
const checkpoint = workflowCheckpoints(dramaCheckpoints.data.value ?? [], 'create-drama').at(-1)
return preview.value && checkpoint?.checkpointId === preview.value.checkpointId
? (savedReviewDecisions(checkpoint.state.review, preview.value.reviewId) ??
latest.value?.manualUncertaintyDecisions ??
[])
: (latest.value?.manualUncertaintyDecisions ?? [])
})
watch(sourceEpisodes, value => {
if (!value.some(item => item.episode === sourceEpisode.value)) sourceEpisode.value = value[0]?.episode ?? null
})
/** 其它入口改写结束时,保存记录变化会触发一次重读,不定时查询。 */
watch(
() => {
const record = workflowCheckpoints(dramaCheckpoints.data.value ?? [], 'create-drama').at(-1)
return record ? record.checkpointId + ':' + (record.updatedAt ?? '') : ''
},
(version, previous) => {
if (previous && version && version !== previous && !flow.writing.value) void flow.query.refresh()
}
)
/**
* 仅切换当前抽屉中的正式正文,不发送写入请求。
* @param episode 用户核对的集号
*/
async function viewEpisode(episode: number | null) {
sourceEpisode.value = episode
sourceExpanded.value = ['source']
await nextTick()
sourceElement.value?.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
}
/**
* 更新用户已创建的延期表单,建议读取不会触发此操作。
* @param draft 本次人工编辑的延期草稿
*/
function updateDeferred(draft: DeferredUncertaintyDraft) {
flow.deferredDrafts.value[draft.index] = draft
}
/**
* 带入待核对的说明后定位证据表单,仍由用户填写真实原文。
* @param index 原始不确定项索引
*/
async function addUncertaintyEvidence(index: number) {
flow.addUncertaintyEvidence(index)
await nextTick()
manualElement.value?.scrollIntoView({ behavior: 'smooth', block: 'start' })
}
/**
* 中文分类只用于展示,原始枚举保留在请求中。
* @param issue 当前审核问题
* @returns 中文分类名称
*/
function categoryLabel(issue: DramaReviewIssue) {
return reviewCategoryOptions.find(option => option.value === issue.category)?.label ?? '待核对问题'
}
/**
* 多种处理方式共用原始索引选择,不使用分组后的页面位置。
* @param kind 当前处理方式
* @param index 原始审核数组索引
* @param checked 用户是否选择
*/
function toggleChoice(kind: 'error' | 'warning' | 'uncertainty', index: number, checked: boolean) {
const target =
kind === 'error' ? flow.selectedErrors : kind === 'warning' ? flow.selectedWarnings : flow.selectedUncertainty
target.value = checked ? [...new Set([...target.value, index])] : target.value.filter(value => value !== index)
}
/** 用户明确请求下一步时,先关闭核对抽屉。 */
function requestRewritePreview() {
if (flow.writing.value || disabled.value || !hasRewriteTargets.value) return
queuedRewriteProject.value = projectId.value
flow.editorOpen.value = false
}
/** 抽屉离场和焦点约束释放后,再打开预检;不自动启动改写。 */
function editorClosed() {
const id = queuedRewriteProject.value
queuedRewriteProject.value = ''
if (id && id === projectId.value) rewriteAction.value?.openPreview()
}
</script>
<template>
<div class="drama-review-panel grid gap-6">
<!-- 以下是最新审核摘要与只读刷新、处理及改写预检入口 -->
<WorkspaceSectionHeading
title="审核记录"
:description="latest ? `最近审核 · ${formatDate(latest.createdAt)}` : '查看当前正式审核与可处理的问题。'"
>
<template #actions>
<WorkspaceRefreshButton
label="刷新审核"
:loading="flow.query.loading.value"
:disabled="flow.writing.value"
@refresh="flow.query.refresh"
/>
<DramaSystemReviewAction
v-if="latest?.passed === false"
:project-id="projectId"
:primary="primaryAction === 'review'"
:disabled="disabled || flow.locked.value"
@started="refreshReview"
/>
<NButton
v-if="hasManualIssues"
class="workspace-action-button"
aria-label="人工确认"
:disabled="!latest || latest.passed || flow.writing.value"
@click="flow.openEditor"
>
<template #icon><FileCheck2 :size="15" aria-hidden="true" /></template>人工确认
</NButton>
<DramaRewriteAction
v-if="hasRewriteTargets"
ref="rewriteAction"
:project-id="projectId"
:primary="primaryAction === 'rewrite'"
:disabled="disabled || flow.writing.value || latest?.passed === true"
@started="refreshReview"
/>
</template>
</WorkspaceSectionHeading>
<ContextNotice v-if="flow.query.error.value" type="error" title="审核读取失败" emphasized>{{
flow.query.error.value
}}</ContextNotice>
<ContextNotice v-if="rewriteQuery.error.value" type="error" title="改写范围读取失败" emphasized>{{
rewriteQuery.error.value
}}</ContextNotice>
<p v-if="flow.query.loading.value && !latest" class="text-sm text-muted">正在读取最新审核…</p>
<EmptyState
v-else-if="!latest && !flow.query.error.value"
title="暂无审核记录"
description="审核完成后可查看结果。"
/>
<template v-if="latest">
<div class="flex flex-wrap items-center gap-3">
<NTag :type="reviewUncertain ? 'default' : latest.passed ? 'success' : 'warning'" :bordered="false">{{
reviewUncertain ? '审核状态待核对' : latest.passed ? '当前审核已通过' : '当前审核尚未通过'
}}</NTag>
</div>
<!-- 以下是系统已完成的逐项复核摘要,保留关键待核对数 -->
<p v-if="latest.automaticQualityResolution" class="text-sm text-muted">
<template v-if="latest.automaticQualityResolution.status === 'completed'">
系统复核了 {{ latest.automaticQualityResolution.candidateCount }} 项初审疑点, 其中
{{ latest.automaticQualityResolution.resolvedCount }} 项已有依据,
{{ latest.automaticQualityResolution.remainingCount }} 项仍需核对。
</template>
<template v-else>系统复核未完成,原审核疑点已保留。</template>
</p>
<!-- 以下是当前审核的下一步引导,仅在来源有效且读取完成后显示 -->
<ContextNotice
v-if="
(hasManualIssues || hasRewriteTargets) &&
!flow.blockedReason.value &&
!reviewUncertain &&
!rewriteQuery.loading.value &&
!rewriteQuery.error.value
"
type="info"
:title="nextStep.title"
emphasized
>{{ nextStep.description }}</ContextNotice
>
<ContextNotice
v-if="!latest.passed && flow.blockedReason.value"
type="warning"
title="当前仅可查看"
emphasized
>{{ flow.blockedReason.value }}</ContextNotice
>
<ContextNotice
v-if="flow.receipt.value && !reviewUncertain"
:type="flow.receipt.value.finalized ? 'success' : 'info'"
:title="flow.receipt.value.finalized ? '本次处理已完成审核' : '本次处理已保存'"
emphasized
>{{ receiptSummary }}</ContextNotice
>
<!-- 以下是当前剩余问题与已记录改写范围,统计不合并为总阻断数 -->
<dl v-if="preview && !latest.passed" class="grid gap-5 sm:grid-cols-3">
<div>
<dt class="text-xs text-muted">待确认问题</dt>
<dd class="mt-2 text-sm">
{{ preview.remainingPendingQualityIssues?.length ?? '待核对'
}}<span v-if="preview.remainingPendingQualityIssues"> 项</span>
</dd>
</div>
<div>
<dt class="text-xs text-muted">待核对说明</dt>
<dd class="mt-2 text-sm">
{{ preview.remainingUncertainty?.length ?? '待核对'
}}<span v-if="preview.remainingUncertainty"> 项</span>
</dd>
</div>
<div>
<dt class="text-xs text-muted">待改写剧集</dt>
<dd class="mt-2 text-sm">{{ rewriteEpisodeSummary }}</dd>
</div>
</dl>
<NCollapse>
<NCollapseItem
v-if="recordedIssues.length"
name="recorded-issues"
:title="`已记录的审核问题(${recordedIssues.length})`"
>
<div class="grid gap-5 pt-2">
<article v-for="(issue, index) in recordedIssues" :key="index" class="grid gap-2">
<h4 class="text-sm font-medium">第 {{ issue.episode }} 集 · {{ categoryLabel(issue) }}</h4>
<p class="text-sm leading-7">{{ issue.message }}</p>
<blockquote class="review-source-quote">{{ issue.sourceQuote }}</blockquote>
<p class="text-xs leading-6 text-muted">修改方向:{{ issue.suggestion }}</p>
</article>
</div>
</NCollapseItem>
<NCollapseItem v-if="latest.message" name="review-message" title="审核说明"
><p class="whitespace-pre-wrap text-sm leading-7">
{{ userFacingText(latest.message) }}
</p></NCollapseItem
>
<NCollapseItem v-if="decisions.length" name="decisions" title="已保存的人工判断"
><ul class="space-y-3 text-sm leading-7">
<li v-for="(decision, index) in decisions" :key="index">
{{
decision.disposition === 'accepted'
? '已接受'
: decision.disposition === 'verified'
? '已核验'
: '留待后续核验'
}}
· {{ decision.description }}
<p v-if="decision.verificationCriteria" class="text-xs text-muted">
<span v-if="decision.episode">第 {{ decision.episode }} 集 · </span>
<span v-if="decision.verificationTarget"
>{{ decision.verificationTarget === 'breakdown' ? '拆解' : '分镜' }}阶段 · </span
>核验标准:{{ decision.verificationCriteria }}
</p>
</li>
</ul></NCollapseItem
>
<NCollapseItem name="review-details" title="高级详情"
><dl class="grid gap-2 text-xs">
<dt class="text-muted">审核编号</dt>
<dd class="break-all font-mono">{{ latest.id }}</dd>
<template v-if="preview"
><dt class="mt-2 text-muted">保存记录</dt>
<dd class="break-all font-mono">{{ preview.checkpointId }}</dd></template
>
</dl></NCollapseItem
>
</NCollapse>
</template>
</div>
<!-- 以下是全屏人工核对抽屉,正文与表单独立于固定底栏 -->
<AppDrawer
v-model:open="flow.editorOpen.value"
class="review-confirm-drawer"
title="审核人工确认"
description="对照剧本核对问题。确认免费,改写需另行启动。"
:busy="flow.writing.value"
@closed="editorClosed"
>
<div v-if="flow.editorOpen.value" class="review-editor-content grid gap-6">
<ContextNotice v-if="flow.blockedReason.value" type="warning" title="当前仅可查看" emphasized>{{
flow.blockedReason.value
}}</ContextNotice>
<ContextNotice v-if="flow.actionError.value" type="error" title="请核对本次处理" emphasized>{{
flow.actionError.value
}}</ContextNotice>
<!-- 以下是来源变化时保留的只读草稿,不将旧索引套用到新版本 -->
<NCollapse v-if="flow.preservedDraft.value">
<NCollapseItem name="preserved-draft" title="查看来源变化前的草稿">
<div class="grid gap-4 text-sm leading-7">
<p class="text-muted">以下选择属于旧审核,仅供重新核对,尚未保存为当前判断。</p>
<p
v-for="index in flow.preservedDraft.value.acceptedUncertaintyIndexes"
:key="`accepted-${index}`"
>
原选择接受:{{ flow.preservedDraft.value.descriptions[index] }}
</p>
<div v-for="draft in flow.preservedDraft.value.deferredUncertainties" :key="draft.index">
<p>原选择延期:{{ flow.preservedDraft.value.descriptions[draft.index] }}</p>
<p class="text-muted">
第 {{ draft.episode ?? '未选' }} 集 ·
{{
draft.verificationTarget === 'breakdown'
? '拆解'
: draft.verificationTarget === 'storyboard'
? '分镜'
: '未选阶段'
}}
· {{ draft.verificationCriteria }}
</p>
</div>
<div v-for="draft in flow.preservedDraft.value.manualIssues" :key="draft.id">
<p>{{ draft.message }}</p>
<blockquote class="review-source-quote">{{ draft.sourceQuote }}</blockquote>
<p>{{ draft.suggestion }}</p>
</div>
<p
v-if="
flow.preservedDraft.value.issueIndexes.length ||
flow.preservedDraft.value.acceptedWarningIndexes.length
"
class="text-muted"
>
问题已更新,请重新选择。
</p>
</div>
</NCollapseItem>
</NCollapse>
<ContextNotice
v-if="flow.receipt.value && !reviewUncertain"
:type="flow.receipt.value.finalized ? 'success' : 'info'"
:title="flow.receipt.value.finalized ? '本次处理已完成审核' : '本次处理已保存'"
emphasized
>{{ receiptSummary }}</ContextNotice
>
<div class="review-editor-layout">
<!-- 以下是桌面独立滚动的问题区,手机沿用抽屉正文滚动 -->
<NScrollbar class="review-issues-scroll">
<div class="grid min-w-0 content-start gap-8">
<!-- 以下是按剧集分组的待确认问题,原始索引与展示位置分离 -->
<section v-if="groups.length || !flow.uncertaintyRows.value.length">
<WorkspaceSectionHeading
title="待确认问题"
description="确认错误供改写使用。接受警告或未选条目会保留原处理。"
/>
<NCollapse
v-if="groups.length"
class="mt-4"
:default-expanded-names="groups.map(group => group.episode)"
>
<NCollapseItem
v-for="group in groups"
:key="group.episode"
:name="group.episode"
:title="`第 ${group.episode} 集 · ${group.rows.length} 项`"
>
<div class="grid gap-4">
<article
v-for="row in group.rows"
:key="row.originalIndex"
:data-review-issue="row.originalIndex"
class="review-issue-card"
:class="{
'problem-surface':
row.issue.severity === 'error' && !row.issue.policyException
}"
>
<div class="flex flex-wrap items-center gap-3">
<h4 class="text-sm font-semibold">{{ categoryLabel(row.issue) }}</h4>
<NTag size="small" :bordered="false">{{
row.issue.policyException
? '策略允许'
: row.issue.severity === 'error'
? '错误待核对'
: '警告待核对'
}}</NTag>
</div>
<p class="mt-3 text-sm leading-7">{{ row.issue.message }}</p>
<blockquote class="review-source-quote mt-3">
{{ row.issue.sourceQuote }}
</blockquote>
<p class="mt-3 text-xs leading-6 text-muted">
修改方向:{{ row.issue.suggestion }}
</p>
<div class="workspace-action-group mt-4 flex flex-wrap items-center gap-3">
<NButton size="small" @click="viewEpisode(row.issue.episode)"
><template #icon
><FileSearch :size="14" aria-hidden="true" /></template
>查看本集原文</NButton
>
<NButton
v-if="!row.issue.policyException"
size="small"
:disabled="flow.locked.value"
@click="flow.addManual(row.issue)"
><template #icon><Plus :size="14" aria-hidden="true" /></template
>补充原文证据</NButton
>
</div>
<NCheckbox
v-if="row.issue.severity === 'error'"
class="mt-4"
:checked="flow.selectedErrors.value.includes(row.originalIndex)"
:disabled="flow.locked.value || flow.issueAction(row) !== 'error'"
:aria-disabled="flow.locked.value || flow.issueAction(row) !== 'error'"
@update:checked="toggleChoice('error', row.originalIndex, $event)"
>已核实错误,记录为改写依据</NCheckbox
>
<NCheckbox
v-else
class="mt-4"
:checked="flow.selectedWarnings.value.includes(row.originalIndex)"
:disabled="flow.locked.value || flow.issueAction(row) !== 'warning'"
:aria-disabled="
flow.locked.value || flow.issueAction(row) !== 'warning'
"
@update:checked="toggleChoice('warning', row.originalIndex, $event)"
>已核对原文,接受保留此警告</NCheckbox
>
<p
v-if="flow.issueAction(row) === null"
class="mt-2 text-xs leading-6 text-muted"
>
{{
row.issue.policyException
? '该项属于已允许的表现方式,不能强制确认改写。'
: '当前证据尚不能直接确认,可补充经核对的真实原文。'
}}
</p>
</article>
</div>
</NCollapseItem>
</NCollapse>
<p v-else class="mt-4 text-sm text-muted">
{{
latest?.passed
? '当前审核已通过,无需再次确认问题。'
: '当前没有待人工确认的结构化问题。已有审核问题仍需以改写预检为准。'
}}
</p>
</section>
<!-- 以下是不确定项,禁止将无效原文或模型格式问题直接接受 -->
<section>
<WorkspaceSectionHeading
title="待核对说明"
description="可采纳建议,也可核对原文后决定。保存后生效。"
/>
<div v-if="flow.uncertaintyRows.value.length" class="mt-4 grid gap-4">
<ReviewUncertaintyCard
v-for="row in flow.uncertaintyRows.value"
:key="row.originalIndex"
:row="row"
:suggestion="suggestionForUncertainty(preview, row.originalIndex)"
:episodes="preview?.episodes ?? []"
:accepted="flow.selectedUncertainty.value.includes(row.originalIndex)"
:deferred="flow.deferredDrafts.value[row.originalIndex]"
:error="flow.deferredErrors.value[row.originalIndex]"
:locked="flow.locked.value"
@action="flow.setUncertaintyAction(row.originalIndex, $event)"
@update:deferred="updateDeferred"
@view="viewEpisode"
@evidence="addUncertaintyEvidence(row.originalIndex)"
/>
</div>
<p v-else class="mt-4 text-sm text-muted">当前没有待核对说明。</p>
</section>
<!-- 以下是人工补充表单,首次打开和新增空行不立即报错 -->
<section v-if="!latest?.passed" ref="manualElement">
<WorkspaceSectionHeading title="人工补充证据" description="只补充已核实的错误。">
<template #actions
><NButton
:disabled="flow.locked.value || !preview?.episodes.length"
@click="flow.addManual()"
><template #icon><Plus :size="15" aria-hidden="true" /></template
>补充原文证据</NButton
></template
>
</WorkspaceSectionHeading>
<NForm
v-if="flow.manualDrafts.value.length"
label-placement="top"
class="mt-5 grid gap-8"
@submit.prevent
>
<ManualReviewIssueEditor
v-for="(draft, index) in flow.manualDrafts.value"
:key="draft.id"
:model-value="draft"
:order="index + 1"
:episodes="preview?.episodes ?? []"
:characters="characters"
:disabled="flow.locked.value"
:error="flow.manualErrors.value[index]"
@update:model-value="flow.manualDrafts.value[index] = $event"
@remove="flow.removeManual(draft.id)"
/>
</NForm>
</section>
</div>
</NScrollbar>
<!-- 以下是当前正式剧本的纯文本核对区,窄屏先显示原文 -->
<section ref="sourceElement" class="review-source-pane">
<NCollapse v-model:expanded-names="sourceExpanded">
<NCollapseItem name="source" title="正式剧本原文">
<div class="review-source-fields grid gap-4">
<p class="text-xs leading-6 text-muted">请引用所选剧集的原句。</p>
<NSelect
v-model:value="sourceEpisode"
:options="episodeOptions"
aria-label="选择核对剧集"
:disabled="!episodeOptions.length"
/>
<NScrollbar class="review-source-scroll">
<pre class="review-source-content">{{
sourceContent ||
(sourceEpisodes.length
? '请选择需要核对的剧集。'
: '当前没有可核对的正式正文。')
}}</pre>
</NScrollbar>
</div>
</NCollapseItem>
</NCollapse>
</section>
</div>
</div>
<!-- 以下是固定的关闭、只读刷新与明确确认操作,不自动启动改写 -->
<template #footer>
<div class="review-editor-footer">
<NCheckbox
v-if="!latest?.passed"
v-model:checked="flow.acknowledged.value"
:disabled="flow.locked.value || !flow.selectionCount.value"
:aria-disabled="flow.locked.value || !flow.selectionCount.value"
class="review-confirm-ack"
>我已逐项核对所选问题、引用原文和本次处理方式,确认保存人工判断。</NCheckbox
>
<div class="review-editor-actions">
<NButton :disabled="flow.writing.value" @click="flow.editorOpen.value = false">关闭</NButton>
<NButton
v-if="
hasRewriteTargets &&
flow.receipt.value?.confirmedEpisodes.length &&
!flow.receipt.value.finalized
"
:disabled="flow.writing.value || disabled"
@click="requestRewritePreview"
><template #icon><FileSearch :size="15" aria-hidden="true" /></template>查看改写范围</NButton
>
<WorkspaceRefreshButton
label="重新读取"
:loading="flow.query.loading.value"
:disabled="flow.writing.value"
@refresh="flow.query.refresh"
/>
<NButton
v-if="!latest?.passed"
type="primary"
:loading="flow.writing.value"
:disabled="!flow.canConfirm.value"
@click="flow.confirm"
>确认本次处理</NButton
>
</div>
</div>
</template>
</AppDrawer>
</template>
<style>
@reference "../../../styles/styles.css";
.drama-review-panel {
min-width: 0;
}
/* 审核入口文字在手机保留,限制操作组宽度后自动换行,避免按钮被裁切。 */
.drama-review-panel > .workspace-section-heading .workspace-section-heading-actions {
max-width: 100%;
}
/* 此抽屉由固定底栏提供上下留白,正文不再叠加底部内边距。 */
.review-confirm-drawer.app-drawer.n-drawer .n-drawer-content .n-drawer-body-content-wrapper {
padding-bottom: 0;
}
.review-editor-layout {
@apply grid min-w-0 items-start gap-8 lg:grid-cols-[minmax(0,1.2fr)_minmax(300px,1fr)];
}
.review-issues-scroll {
height: auto;
}
.review-issue-card {
@apply min-w-0;
padding: var(--app-content-gap);
background: var(--app-subtle);
}
.review-source-quote {
@apply whitespace-pre-wrap wrap-anywhere text-sm leading-7;
padding: var(--app-content-gap);
background: var(--app-control);
}
.review-source-pane {
@apply order-first grid min-w-0 gap-4 lg:sticky lg:top-0 lg:order-last;
}
.review-source-scroll {
height: min(42dvh, 380px);
background: var(--app-subtle);
}
.review-source-content {
@apply whitespace-pre-wrap wrap-anywhere text-sm leading-8;
padding: var(--app-content-gap);
}
.review-editor-footer {
@apply flex w-full flex-wrap items-center justify-between gap-4;
}
.review-confirm-ack {
@apply min-w-0 text-sm leading-6;
flex: 1 1 360px;
}
.review-editor-actions {
@apply ml-auto flex flex-wrap items-center justify-end gap-2;
}
@media (max-width: 1023px) {
/* 窄屏取消内层滚动,桌面继续使用 Naive 滚动容器自身的默认行为。 */
.review-issues-scroll,
.review-issues-scroll > .n-scrollbar-container {
height: auto;
overflow: visible;
}
}
@media (min-width: 1024px) {
/* 正文按抽屉实际剩余高度分配,两列各自滚动,不以视口比例截断原文。 */
.review-confirm-drawer.app-drawer.n-drawer .n-drawer-content .n-drawer-body-content-wrapper {
height: 100%;
}
.review-editor-content {
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
}
.review-editor-content > :not(.review-editor-layout) {
flex-shrink: 0;
}
.review-editor-layout {
flex: 1;
min-height: 0;
align-items: stretch;
overflow: hidden;
}
.review-issues-scroll {
height: 100%;
min-height: 0;
}
.review-source-pane {
position: static;
height: 100%;
min-height: 0;
}
.review-source-pane > .n-collapse,
.review-source-pane > .n-collapse > .n-collapse-item {
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
}
.review-source-pane .n-collapse-item__header {
flex-shrink: 0;
}
.review-source-pane .n-collapse-item__content-wrapper {
flex: 1;
min-height: 0;
}
.review-source-pane .n-collapse-item__content-inner {
box-sizing: border-box;
height: 100%;
min-height: 0;
}
.review-source-fields {
height: 100%;
min-height: 0;
grid-template-rows: auto auto minmax(0, 1fr);
}
.review-source-scroll {
height: 100%;
min-height: 0;
}
}
</style>
@@ -0,0 +1,221 @@
<script setup lang="ts">
import { computed, onScopeDispose, ref, watch } from 'vue'
import { NButton, NCheckbox } from 'naive-ui'
import { FilePenLine } from '@lucide/vue'
import { AppDialog, WorkspaceRefreshButton, WorkspaceSectionHeading } from '../../../components/ui'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { useQuery } from '../../../composables/useQuery'
import { errorMessage } from '../../../lib/http'
import { projectsApi } from '../../projects/api'
import { getOperation, runOperation } from '../../workflows/operations'
import { useWorkflowExecution } from '../../workflows/execution'
import { loadDramaRewritePreview } from './api'
import { sameRewriteScope } from './model'
/** 复用同一个范围预检与费用确认流程的入口参数。 */
const props = withDefaults(
defineProps<{
/** 当前正式项目。 */ projectId: string
/** 外部读取失败或操作锁。 */ disabled?: boolean
/** 页面与任务弹窗可使用不同入口文案。 */ label?: string
/** 当前明确以改写预检为下一步时,入口使用主题主按钮。 */ primary?: boolean
}>(),
{ disabled: false, label: '改写预检', primary: false }
)
/** 后台已接受改写时通知上层刷新,不能将受理视为审核通过。 */
const emit = defineEmits<{ started: [executionId: string, projectId: string] }>()
/** 预检弹窗开关。 */
const open = ref(false)
/** 本次实际启动请求进行中,普通读取不锁定关闭。 */
const writing = ref(false)
/** 用户确认本次范围、费用及活动任务情况。 */
const acknowledged = ref(false)
/** 本次提交或来源变化的可读提示。 */
const actionError = ref('')
/** 项目级互斥与其它生成入口共享。 */
const operation = computed(() => getOperation(props.projectId))
/** 只在弹窗打开时读取预检。 */
const queryKey = computed(() => (open.value ? props.projectId : ''))
/** 项目布局负责观察任务,本入口只保存真实句柄,不额外轮询。 */
const trackerProject = ref('')
/** 复用原持久化句柄与活动锁写入能力。 */
const tracker = useWorkflowExecution(trackerProject, 'create-drama')
/** 切项目或离开后取消尚未提交的二次预检。 */
let revision = 0
/** 二次预检取消控制器,不取消已经受理的后台任务。 */
let controller: AbortController | undefined
onScopeDispose(() => {
revision++
controller?.abort()
})
/** 关闭、切换项目时取消预检,不能沿用旧费用确认。 */
const query = useQuery(queryKey, (id, signal) => (id ? loadDramaRewritePreview(id, signal) : Promise.resolve(null)))
watch([open, () => props.projectId], () => {
revision++
controller?.abort()
acknowledged.value = false
actionError.value = ''
})
watch(
() => query.data.value,
() => {
acknowledged.value = false
}
)
/** 只有服务端明确就绪且无读取错误时才允许开始。 */
const ready = computed(
() =>
query.data.value?.ready === true &&
query.data.value.status === 'ready' &&
!query.error.value &&
!query.loading.value
)
/** 服务端预检状态转换为可操作中文,保留真实状态作为判断来源。 */
const blockedReason = computed(() => {
if (query.error.value) return query.error.value
if (!query.data.value || ready.value) return ''
return query.data.value.status === 'stale'
? '审核与当前正文来源不一致,请先刷新审核记录。'
: query.data.value.status === 'blocked'
? '当前仍有剧本任务运行,请结束后再改写。'
: '当前审核没有可执行的改写目标,请先核对并处理审核问题。'
})
/** 从服务端范围生成说明,不自行扩展到整剧。 */
const scope = computed(() => {
const preview = query.data.value
if (!preview) return []
return [
preview.rewriteEpisodes ? `第 ${preview.episodeNumbers.join('、')} 集剧本` : '',
preview.rewriteCharacters ? '角色设定' : '',
preview.rewriteWorld ? '世界观' : ''
].filter(Boolean)
})
/** 当前确认操作是否允许提交。 */
const canSubmit = computed(
() => ready.value && acknowledged.value && !props.disabled && !operation.value.pending && !writing.value
)
/** 二次预检后才启动改写;范围变化或网络不确定时不自动重试。 */
async function confirm() {
if (!canSubmit.value || !query.data.value) return
const expected = query.data.value
const id = props.projectId
const version = revision
writing.value = true
actionError.value = ''
controller = new AbortController()
try {
await runOperation(
id,
'恢复剧本改写',
async () => {
const current = await loadDramaRewritePreview(id, controller!.signal)
if (version !== revision || props.projectId !== id) throw new Error('查看的项目已变化,请重新核对。')
if (!current.ready || current.status !== 'ready' || !sameRewriteScope(expected, current)) {
query.data.value = current
acknowledged.value = false
throw new Error('改写范围或保存记录已变化,请重新核对并确认。')
}
const started = await projectsApi.resume(id, 'resume-rewrite')
await tracker.track(started.executionId, id)
if (version === revision && props.projectId === id) {
emit('started', started.executionId, id)
open.value = false
}
return started
},
{ type: 'info', content: '改写任务已提交,请查看真实任务进度。' }
)
if (version === revision && props.projectId === id && getOperation(id).error)
actionError.value = getOperation(id).error
} catch (cause) {
if (version === revision && props.projectId === id) actionError.value = errorMessage(cause)
} finally {
writing.value = false
}
}
/** 用户主动打开范围预检,供审核抽屉离场后交接焦点。 */
function openPreview() {
if (!props.disabled && !operation.value.pending && !writing.value) open.value = true
}
/** 外层可在抽屉关闭动画结束后打开同一个只读预检。 */
defineExpose({ openPreview })
</script>
<template>
<span class="drama-rewrite-action">
<!-- 以下是只读预检入口,打开不会提交改写 -->
<NButton
:type="primary ? 'primary' : 'default'"
:disabled="disabled || operation.pending || writing"
:aria-label="label"
aria-haspopup="dialog"
:aria-expanded="open"
@click="openPreview"
>
<template #icon><FilePenLine :size="15" aria-hidden="true" /></template>{{ label }}
</NButton>
<AppDialog
v-model:open="open"
title="恢复改写"
description="先核对本次改写范围,确认费用后才会开始生成。"
:busy="writing"
:width="720"
>
<div class="grid gap-6">
<p v-if="query.loading.value" class="text-sm text-muted">正在检查改写范围…</p>
<ContextNotice v-if="blockedReason" type="warning" title="暂不能开始改写" emphasized>{{
blockedReason
}}</ContextNotice>
<!-- 以下是服务端明确返回的剧集与设定范围 -->
<section v-if="query.data.value">
<WorkspaceSectionHeading title="本次改写范围" />
<ul v-if="scope.length" class="mt-3 space-y-2 text-sm">
<li v-for="item in scope" :key="item">{{ item }}</li>
</ul>
<p v-else class="mt-3 text-sm text-muted">当前没有可执行的改写范围。</p>
</section>
<ContextNotice v-if="ready" type="info" title="本次操作会调用模型" emphasized
>只读检查不会产生生成费用。确认后将改写上述内容并重新审核,请勿重复提交。</ContextNotice
>
<NCheckbox
v-if="ready"
v-model:checked="acknowledged"
:disabled="writing || disabled || operation.pending"
:aria-disabled="writing || disabled || operation.pending"
aria-label="确认改写范围与费用"
>我已核对本次范围,确认当前没有同项目任务运行,并同意本次模型调用费用。</NCheckbox
>
<ContextNotice v-if="actionError" type="error" title="请核对操作状态" emphasized>{{
actionError
}}</ContextNotice>
</div>
<!-- 以下是固定取消、重读与明确确认操作 -->
<template #footer>
<div class="drama-rewrite-footer">
<NButton :disabled="writing" @click="open = false">取消</NButton>
<WorkspaceRefreshButton
label="重新检查"
:loading="query.loading.value"
:disabled="writing"
@refresh="query.refresh"
/>
<NButton type="primary" :loading="writing" :disabled="!canSubmit" @click="confirm"
>确认恢复改写</NButton
>
</div>
</template>
</AppDialog>
</span>
</template>
<style scoped>
@reference "../../../styles/styles.css";
.drama-rewrite-action {
@apply inline-flex;
}
.drama-rewrite-footer {
@apply flex w-full flex-wrap items-center justify-end gap-2;
}
</style>
@@ -0,0 +1,155 @@
<script setup lang="ts">
import { computed, onScopeDispose, ref, watch } from 'vue'
import { NButton } from 'naive-ui'
import { FileSearch } from '@lucide/vue'
import { AppDialog, WorkspaceRefreshButton } from '../../../components/ui'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { useQuery } from '../../../composables/useQuery'
import { errorMessage } from '../../../lib/http'
import { getOperation, runOperation } from '../../workflows/operations'
import { useWorkflowExecution } from '../../workflows/execution'
import { dramaReviewApi, loadDramaReviewResumePreview } from './api'
/** 已保存剧本的系统核查入口,沿用项目级活动任务锁。 */
const props = withDefaults(
defineProps<{
/** 当前正式项目。 */ projectId: string
/** 当前外部操作锁。 */ disabled?: boolean
/** 无明确改写目标时强调系统核查。 */ primary?: boolean
}>(),
{ disabled: false, primary: false }
)
/** 后台实际受理后才通知页面刷新。 */
const emit = defineEmits<{ started: [executionId: string, projectId: string] }>()
/** 费用与范围确认弹窗。 */
const open = ref(false)
/** 正在提交,防止重复收费请求。 */
const writing = ref(false)
/** 只展示当前项目的操作错误。 */
const actionError = ref('')
/** 当前项目的公共操作状态。 */
const operation = computed(() => getOperation(props.projectId))
/** 弹窗打开后才查询来源。 */
const queryKey = computed(() => (open.value ? props.projectId : ''))
/** 只读查询可取消,关闭弹窗不启动模型。 */
const query = useQuery(queryKey, (id, signal) =>
id ? loadDramaReviewResumePreview(id, signal) : Promise.resolve(null)
)
/** 页面布局观察后台任务,本入口仅保存真实句柄。 */
const trackerProject = ref('')
/** 与其他创作入口共用持久化任务句柄。 */
const tracker = useWorkflowExecution(trackerProject, 'create-drama')
/** 当前确认来源版本。 */
let revision = 0
/** 二次预检的取消控制器。 */
let controller: AbortController | undefined
watch([open, () => props.projectId], () => {
revision++
controller?.abort()
actionError.value = ''
})
onScopeDispose(() => {
revision++
controller?.abort()
})
/** 仅使用当前预检与真实活动状态开放提交。 */
const ready = computed(
() =>
query.data.value?.ready === true &&
!query.loading.value &&
!query.error.value &&
!props.disabled &&
!operation.value.pending &&
!writing.value
)
/** 二次核对保存记录后提交一次核查;来源变化或网络不确定时不自动重试。 */
async function confirm() {
if (!ready.value || !query.data.value) return
const expected = query.data.value
const id = props.projectId
const version = revision
writing.value = true
actionError.value = ''
controller = new AbortController()
try {
await runOperation(
id,
'系统核查剧本',
async () => {
const current = await loadDramaReviewResumePreview(id, controller!.signal)
if (version !== revision || props.projectId !== id) throw new Error('当前项目已变化,请重新核对。')
if (
!current.ready ||
current.checkpointId !== expected.checkpointId ||
current.episodeCount !== expected.episodeCount
) {
query.data.value = current
throw new Error('保存记录已变化,请重新核对本次范围。')
}
const started = await dramaReviewApi.resumeReview(id, expected.checkpointId)
await tracker.track(started.executionId, id)
if (version === revision && props.projectId === id) {
emit('started', started.executionId, id)
open.value = false
}
return started
},
{ type: 'info', content: '系统核查已开始,请查看创作任务进度。' }
)
if (version === revision && props.projectId === id && getOperation(id).error)
actionError.value = getOperation(id).error
} catch (cause) {
if (version === revision && props.projectId === id) actionError.value = errorMessage(cause)
} finally {
writing.value = false
}
}
</script>
<template>
<span class="inline-flex">
<!-- 以下是系统核查入口,打开仅执行只读预检 -->
<NButton
:type="primary ? 'primary' : 'default'"
:disabled="disabled || operation.pending || writing"
aria-label="系统重新核查"
aria-haspopup="dialog"
:aria-expanded="open"
@click="open = true"
>
<template #icon><FileSearch :size="15" aria-hidden="true" /></template>系统重新核查
</NButton>
<AppDialog
v-model:open="open"
title="系统重新核查"
description="核查已保存的剧本,先由系统处理可确认的问题。"
:busy="writing"
>
<!-- 以下是范围、模型费用与错误反馈模块 -->
<div class="grid gap-5">
<p v-if="query.loading.value" class="text-sm text-muted">正在核对保存记录…</p>
<p v-if="query.data.value" class="text-sm">
本次核查已保存的 {{ query.data.value.episodeCount }} 集,不会重写正文、角色设定或世界观。
</p>
<ContextNotice type="info" title="本次操作会调用模型"
>检查完整剧本,记录改写依据和待确认问题。请勿重复提交。</ContextNotice
>
<ContextNotice v-if="query.error.value || actionError" type="error" title="暂不能开始核查">{{
actionError || query.error.value
}}</ContextNotice>
</div>
<!-- 以下是固定取消、重新读取与明确开始操作模块 -->
<template #footer>
<NButton :disabled="writing" @click="open = false">取消</NButton>
<WorkspaceRefreshButton
label="重新检查"
:loading="query.loading.value"
:disabled="writing"
@refresh="query.refresh"
/>
<NButton type="primary" :loading="writing" :disabled="!ready" @click="confirm">开始系统核查</NButton>
</template>
</AppDialog>
</span>
</template>
@@ -0,0 +1,115 @@
<script setup lang="ts">
import { computed } from 'vue'
import { NButton, NFormItem, NInput, NSelect } from 'naive-ui'
import { Trash2 } from '@lucide/vue'
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
import WorkspaceActionTooltip from '../../../components/ui/WorkspaceActionTooltip.vue'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { reviewCategoryOptions } from './model'
import type { DramaReviewPreview, ManualReviewDraft } from './types'
/** 人工补充表单只使用正式剧集和当前角色选项。 */
const props = defineProps<{
/** 表单行显示序号。 */ order: number
/** 当前正式正文。 */ episodes: DramaReviewPreview['episodes']
/** 当前正式角色名称。 */ characters: string[]
/** 读取或写入期间只读。 */ disabled: boolean
/** 用户尝试提交后才提供的错误。 */ error?: string
}>()
/** 尚未保存的证据草稿,确认前不转换为审核事实。 */
const draft = defineModel<ManualReviewDraft>({ required: true })
/** 删除只影响当前草稿。 */
const emit = defineEmits<{ remove: [] }>()
/** 集数选项直接来自预检,不伪造缺少的集号。 */
const episodeOptions = computed(() =>
props.episodes.map(episode => ({ label: `第 ${episode.episode} 集`, value: episode.episode }))
)
/** 角色名称来自正式项目,提交保留原值。 */
const characterOptions = computed(() => props.characters.map(name => ({ label: name, value: name })))
</script>
<template>
<!-- 以下是单条人工补充的标题与删除入口 -->
<section class="manual-review-editor">
<WorkspaceSectionHeading :title="`补充证据 ${order}`">
<template #actions>
<WorkspaceActionTooltip :label="`删除第 ${order} 条补充证据`">
<NButton
class="workspace-action-button icon-button"
:disabled="disabled"
:aria-label="`删除第 ${order} 条补充证据`"
@click="emit('remove')"
>
<template #icon><Trash2 :size="16" aria-hidden="true" /></template>
</NButton>
</WorkspaceActionTooltip>
</template>
</WorkspaceSectionHeading>
<!-- 以下是逐行填写的真实原文与错误说明,不自动把模型推断升级为事实 -->
<div class="mt-4 grid gap-4">
<NFormItem label="所属剧集" required
><NSelect
v-model:value="draft.episode"
:options="episodeOptions"
:disabled="disabled"
:aria-label="`补充证据 ${order} 所属剧集`"
/></NFormItem>
<NFormItem label="问题分类" required
><NSelect
v-model:value="draft.category"
:options="reviewCategoryOptions"
:disabled="disabled"
:aria-label="`补充证据 ${order} 问题分类`"
/></NFormItem>
<NFormItem label="问题名称" required
><NInput
v-model:value="draft.code"
:disabled="disabled"
placeholder="例如:坠落前缺少支撑变化"
:input-props="{ 'aria-label': `补充证据 ${order} 问题名称` }"
/></NFormItem>
<NFormItem label="引用原文" required
><NInput
v-model:value="draft.sourceQuote"
type="textarea"
:autosize="{ minRows: 3, maxRows: 8 }"
:disabled="disabled"
placeholder="粘贴所选剧集中的逐字原文,不能填写事件编号或自行改写的内容"
:input-props="{ 'aria-label': `补充证据 ${order} 引用原文` }"
/></NFormItem>
<NFormItem label="问题说明" required
><NInput
v-model:value="draft.message"
type="textarea"
:autosize="{ minRows: 2, maxRows: 6 }"
:disabled="disabled"
:input-props="{ 'aria-label': `补充证据 ${order} 问题说明` }"
/></NFormItem>
<NFormItem label="修改建议" required
><NInput
v-model:value="draft.suggestion"
type="textarea"
:autosize="{ minRows: 2, maxRows: 6 }"
:disabled="disabled"
:input-props="{ 'aria-label': `补充证据 ${order} 修改建议` }"
/></NFormItem>
<NFormItem label="涉及角色(可选)"
><NSelect
:value="draft.subjectRef || null"
:options="characterOptions"
clearable
:disabled="disabled"
:aria-label="`补充证据 ${order} 涉及角色`"
@update:value="draft.subjectRef = $event ?? ''"
/></NFormItem>
</div>
<ContextNotice v-if="error" type="error" title="请核对这条补充证据" emphasized>{{ error }}</ContextNotice>
</section>
</template>
<style scoped>
@reference "../../../styles/styles.css";
.manual-review-editor {
@apply min-w-0;
}
</style>
@@ -0,0 +1,186 @@
<script setup lang="ts">
import { computed } from 'vue'
import { NButton, NForm, NFormItem, NInput, NRadio, NRadioGroup, NSelect, NTag } from 'naive-ui'
import { FileSearch, PencilLine } from '@lucide/vue'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { uncertaintyAcceptable, type IndexedReviewUncertainty } from './model'
import type {
DeferredUncertaintyDraft,
DramaReviewPreview,
ReviewResolutionSuggestion,
UncertaintyDisposition
} from './types'
/** 每项人工处理始终绑定原审核索引,推荐内容仅供用户核对。 */
const props = defineProps<{
/** 原始不确定项。 */ row: IndexedReviewUncertainty
/** 当前版本的建议,缺失时不补造。 */ suggestion: ReviewResolutionSuggestion | null
/** 正式剧集列表。 */ episodes: DramaReviewPreview['episodes']
/** 用户已明确选择接受。 */ accepted: boolean
/** 用户已明确选择延期后创建的表单。 */ deferred?: DeferredUncertaintyDraft
/** 当前禁止编辑。 */ locked: boolean
/** 提交后才显示的字段错误。 */ error?: string
}>()
/** 显式处理选择、只读定位与补充证据交给统一流程。 */
const emit = defineEmits<{
/** 用户选择处理方式。 */ action: [action: UncertaintyDisposition]
/** 用户修改延期字段。 */ 'update:deferred': [draft: DeferredUncertaintyDraft]
/** 查看单集或主动选择多集原文。 */ view: [episode: number | null]
/** 补充经原文核实的改写证据。 */ evidence: []
}>()
/** 选择来源仅为用户操作,不由推荐方式推断。 */
const disposition = computed<UncertaintyDisposition>(() =>
props.deferred ? 'defer' : props.accepted ? 'accept' : 'pending'
)
/** 无法核实的原文或格式异常不能直接接受或延期。 */
const unavailable = computed(() => props.locked || !uncertaintyAcceptable(props.row.text))
/** 候选剧集优先排列,其余真实剧集仍可选择。 */
const episodeOptions = computed(() => {
const candidates = props.suggestion?.episodeCandidates ?? []
return props.episodes
.toSorted(
(a, b) =>
Number(candidates.includes(b.episode)) - Number(candidates.includes(a.episode)) || a.episode - b.episode
)
.map(item => ({
label: `第 ${item.episode} 集${candidates.includes(item.episode) ? '(建议)' : ''}`,
value: item.episode
}))
})
/** 建议涉及多集时展示全部候选,不擅自绑定其中一集。 */
const candidateLabel = computed(() =>
props.suggestion?.episodeCandidates.length
? `第 ${props.suggestion.episodeCandidates.join('、')} 集`
: '需对照正式正文确认'
)
/** 后端置信度只展示为中性说明,不代表核对通过。 */
const confidenceLabel = computed(() =>
props.suggestion?.confidence === 'high'
? '依据较明确'
: props.suggestion?.confidence === 'low'
? '依据有限,需人工核对'
: '尚无明确对应,需人工核对'
)
/** 只提交真实验证阶段枚举。 */
const targetOptions = [
{ label: '拆解阶段', value: 'breakdown' },
{ label: '分镜阶段', value: 'storyboard' }
]
/**
* 修改已有延期草稿,不通过渲染建议创建处理决定。
* @param patch 用户修改的字段
*/
function updateDeferred(patch: Partial<DeferredUncertaintyDraft>) {
if (props.deferred && !props.locked) emit('update:deferred', { ...props.deferred, ...patch })
}
/** 原文定位只使用已选择的集号或唯一明确建议,多集时留给用户选择。 */
function viewSource() {
const episode =
props.deferred?.episode ??
(props.suggestion?.confidence === 'high' && !props.suggestion.requiresEpisodeSelection
? props.suggestion.episode
: null)
emit('view', episode ?? null)
}
</script>
<template>
<article class="review-issue-card grid gap-5" :data-review-uncertainty="row.originalIndex">
<!-- 以下是问题、推荐原因及来源范围,推荐不等于已确认 -->
<div class="grid gap-3">
<div class="flex flex-wrap items-center gap-3">
<h4 class="text-sm font-semibold">问题 {{ row.originalIndex + 1 }}</h4>
<NTag :bordered="false" size="small">{{
suggestion
? suggestion.suggestedAction === 'defer'
? '建议延期验证'
: '建议人工核对'
: '尚无处理建议'
}}</NTag>
</div>
<p class="text-sm leading-7">{{ row.text }}</p>
<p v-if="suggestion?.reason" class="text-xs leading-6 text-muted">推荐原因:{{ suggestion.reason }}</p>
<div class="grid gap-2 text-xs leading-6 text-muted">
<div>涉及剧集:{{ candidateLabel }}</div>
<div v-if="suggestion">建议依据:{{ confidenceLabel }}</div>
<div v-if="suggestion?.verificationTarget">
验证阶段:{{ suggestion.verificationTarget === 'breakdown' ? '拆解' : '分镜' }}
</div>
<div v-if="suggestion?.verificationCriteria">验证标准:{{ suggestion.verificationCriteria }}</div>
</div>
<div class="workspace-action-group flex-wrap">
<NButton class="workspace-action-button" @click="viewSource"
><template #icon><FileSearch :size="15" aria-hidden="true" /></template>查看相关原文</NButton
>
<NButton class="workspace-action-button" :disabled="locked" @click="emit('evidence')"
><template #icon><PencilLine :size="15" aria-hidden="true" /></template>补充改写证据</NButton
>
</div>
</div>
<!-- 以下是人工选择,所有项目初始均为保留待处理 -->
<NRadioGroup
:value="disposition"
:disabled="locked"
:name="`uncertainty-${row.originalIndex}`"
:aria-label="`问题 ${row.originalIndex + 1} 处理方式`"
@update:value="emit('action', $event as UncertaintyDisposition)"
>
<div class="grid gap-3">
<NRadio value="pending" data-resolution-action="pending">保留待处理</NRadio>
<NRadio value="accept" data-resolution-action="accept" :disabled="unavailable"
>接受为合理创作安排</NRadio
>
<NRadio value="defer" data-resolution-action="defer" :disabled="unavailable"
>延期验证<span v-if="suggestion?.suggestedAction === 'defer'" class="ml-2 text-xs text-muted"
>(建议)</span
></NRadio
>
</div>
</NRadioGroup>
<p v-if="!uncertaintyAcceptable(row.text)" class="text-xs text-muted">
此项需要补充真实原文证据,不能直接接受或延期。
</p>
<!-- 以下是用户选择延期后展开的可编辑验证要求 -->
<NForm v-if="deferred" label-placement="top" :show-feedback="false" class="grid gap-5" @submit.prevent>
<p
v-if="suggestion?.requiresEpisodeSelection || suggestion?.confidence !== 'high'"
class="text-xs leading-6 text-muted"
>
请选择用于验证的剧集,也可选建议之外的剧集。
</p>
<NFormItem label="负责验证的剧集" required>
<NSelect
:value="deferred.episode"
:options="episodeOptions"
:disabled="locked"
placeholder="请选择正式剧集"
:aria-label="`问题 ${row.originalIndex + 1} 负责验证的剧集`"
@update:value="updateDeferred({ episode: $event })"
/>
</NFormItem>
<NFormItem label="验证阶段" required>
<NSelect
:value="deferred.verificationTarget"
:options="targetOptions"
:disabled="locked"
:aria-label="`问题 ${row.originalIndex + 1} 验证阶段`"
@update:value="updateDeferred({ verificationTarget: $event })"
/>
</NFormItem>
<NFormItem label="验证标准" required>
<NInput
:value="deferred.verificationCriteria"
type="textarea"
:maxlength="2000"
:autosize="{ minRows: 3, maxRows: 8 }"
:disabled="locked"
:input-props="{ 'aria-label': `问题 ${row.originalIndex + 1} 验证标准` }"
@update:value="updateDeferred({ verificationCriteria: $event })"
/>
</NFormItem>
<ContextNotice v-if="error" type="error" title="请完善延期验证">{{ error }}</ContextNotice>
</NForm>
</article>
</template>
+246
View File
@@ -0,0 +1,246 @@
import { errorMessage, optionalResource, request } from '../../../lib/http'
import type {
ConfirmDramaIssuesInput,
ConfirmDramaIssuesResult,
DramaReviewPreview,
DramaReviewResumePreview,
DramaReviewSnapshot,
DramaRewritePreview,
LatestDramaReview
} from './types'
/**
* 校验需要展示和定位的最小问题结构,不在页面重新判断业务质量。
* @param value 接口原始问题列表
* @returns 是否具备完整可展示字段
*/
function validIssues(value: unknown): boolean {
return (
Array.isArray(value) &&
value.every(
item =>
item &&
typeof item === 'object' &&
Number.isSafeInteger(item.episode) &&
item.episode > 0 &&
['warning', 'error'].includes(item.severity) &&
['category', 'code', 'sourceQuote', 'message', 'suggestion'].every(
key => typeof item[key] === 'string'
) &&
(item.subjectRef === undefined || typeof item.subjectRef === 'string') &&
(item.policyException === undefined || typeof item.policyException === 'boolean') &&
(item.evidenceConfidence === undefined ||
['explicit', 'inferred', 'unknown'].includes(item.evidenceConfidence))
)
)
}
/**
* 历史回执或格式异常只能只读提示,不伪造成空问题列表并开放提交。
* @param preview 原始确认预检
* @returns 是否具备完整的来源与正文结构
*/
function validPreview(preview: DramaReviewPreview): boolean {
return (
preview.readOnly === true &&
!!preview.checkpointId &&
[preview.ready, preview.sourceValid, preview.reviewSourceValid, preview.hasActiveExecution].every(
value => typeof value === 'boolean'
) &&
validIssues(preview.pendingQualityIssues) &&
validTextList(preview.uncertainty) &&
(preview.remainingPendingQualityIssues === undefined || validIssues(preview.remainingPendingQualityIssues)) &&
(preview.remainingUncertainty === undefined || validTextList(preview.remainingUncertainty)) &&
(preview.resolutionSuggestions === undefined || validSuggestions(preview.resolutionSuggestions)) &&
Array.isArray(preview.episodes) &&
preview.episodes.every(
item => item && Number.isSafeInteger(item.episode) && item.episode > 0 && typeof item.content === 'string'
)
)
}
/**
* 校验原始不确定项列表。
* @param value 原始字段
* @returns 是否为完整的文字数组
*/
function validTextList(value: unknown): boolean {
return Array.isArray(value) && value.every(item => typeof item === 'string')
}
/**
* 校验建议的展示字段,不据建议置信度推导审核是否通过。
* @param value 原始建议列表
* @returns 是否具备完整的建议结构
*/
function validSuggestions(value: unknown): boolean {
return (
Array.isArray(value) &&
value.every(
item =>
item &&
typeof item === 'object' &&
Number.isSafeInteger(item.index) &&
item.index >= 0 &&
typeof item.description === 'string' &&
['defer', 'manual_review'].includes(item.suggestedAction) &&
typeof item.requiresEpisodeSelection === 'boolean' &&
typeof item.requiresManualConfirmation === 'boolean' &&
(item.episode === null || (Number.isSafeInteger(item.episode) && item.episode > 0)) &&
Array.isArray(item.episodeCandidates) &&
item.episodeCandidates.every(
(episode: unknown) => typeof episode === 'number' && Number.isSafeInteger(episode) && episode > 0
) &&
['high', 'low', 'none'].includes(item.confidence) &&
[null, 'breakdown', 'storyboard'].includes(item.verificationTarget) &&
(item.verificationCriteria === null || typeof item.verificationCriteria === 'string') &&
typeof item.reason === 'string'
)
)
}
/** 真实剧本审核接口;只读预检和人工确认均不调用模型。 */
export const dramaReviewApi = {
/**
* 读取重新核查已保存剧本的来源,不调用模型。
* @param id 正式项目
* @param signal 取消过期查询
* @returns 可核查的正文版本与集数
*/
resumePreview: (id: string, signal?: AbortSignal) =>
request<DramaReviewResumePreview>(`/projects/${encodeURIComponent(id)}/resume-review/preview`, { signal }),
/**
* 明确启动当前保存版本的系统核查,不重写正文。
* @param id 正式项目
* @param expectedCheckpointId 用户核对的来源版本
* @returns 持久化任务句柄
*/
resumeReview: (id: string, expectedCheckpointId: string) =>
request<{ executionId: string; projectId: string; status: string }>(
`/projects/${encodeURIComponent(id)}/resume-review`,
{
method: 'POST',
body: { confirmed: true, expectedCheckpointId }
}
),
/**
* 读取最新正式审核,尚无审核时返回空值。
* @param id 正式项目编号
* @param signal 取消旧查询
* @returns 最新审核或空值
*/
latest: (id: string, signal?: AbortSignal) =>
optionalResource(request<LatestDramaReview>(`/projects/${encodeURIComponent(id)}/reviews/latest`, { signal })),
/**
* 读取人工确认来源、稳定索引、当前剩余项与正式正文。
* @param id 正式项目编号
* @param signal 取消旧查询
* @returns 只读确认预检
*/
preview: (id: string, signal?: AbortSignal) =>
request<DramaReviewPreview>(`/projects/${encodeURIComponent(id)}/reviews/confirm-issues/preview`, { signal }),
/**
* 保存明确确认的人工裁决,不能以请求成功代替审核通过。
* @param id 正式项目编号
* @param input 用户核对的裁决
* @returns 本次裁决回执
*/
confirm: (id: string, input: ConfirmDramaIssuesInput) =>
request<ConfirmDramaIssuesResult>(`/projects/${encodeURIComponent(id)}/reviews/confirm-issues`, {
method: 'POST',
body: input
}),
/**
* 只读查询当前改写范围,不创建任务。
* @param id 正式项目编号
* @param signal 取消旧查询
* @returns 真实改写预检
*/
rewritePreview: (id: string, signal?: AbortSignal) =>
request<DramaRewritePreview>(`/projects/${encodeURIComponent(id)}/resume-rewrite/preview`, { signal })
}
/**
* 读取并校验真实改写预检,角色、世界观和剧集范围均由服务端提供。
* @param id 正式项目编号
* @param signal 取消旧读取
* @returns 已核对归属与结构的改写预检
*/
export async function loadDramaRewritePreview(id: string, signal?: AbortSignal): Promise<DramaRewritePreview> {
const preview = await dramaReviewApi.rewritePreview(id, signal)
if (
preview.projectId !== id ||
!preview.checkpointId ||
preview.readOnly !== true ||
preview.requiresConfirmation !== true ||
typeof preview.ready !== 'boolean' ||
!['stale', 'blocked', 'needs_review', 'ready'].includes(preview.status) ||
!Array.isArray(preview.episodeNumbers) ||
!preview.episodeNumbers.every(number => Number.isSafeInteger(number) && number > 0) ||
![preview.rewriteCharacters, preview.rewriteWorld, preview.rewriteEpisodes].every(
value => typeof value === 'boolean'
)
)
throw new Error('改写预检返回的数据不完整或不属于当前项目,请重新读取。')
return preview
}
/**
* 最新审核与处理预检分别核对身份,预检失败仍保留正式审核供只读查看。
* @param id 正式项目编号
* @param signal 取消旧查询
* @returns 当前审核及其对应预检
*/
export async function loadDramaReview(id: string, signal?: AbortSignal): Promise<DramaReviewSnapshot> {
if (!id) return { latest: null, preview: null }
const latest = await dramaReviewApi.latest(id, signal)
if (!latest) return { latest: null, preview: null }
if (latest.projectId !== id || !latest.id || typeof latest.passed !== 'boolean')
throw new Error('审核记录与当前项目不一致,请重新读取。')
if (
!validIssues(latest.pendingQualityIssues) ||
!Array.isArray(latest.affectedEpisodes) ||
!validTextList(latest.hitWords) ||
!Array.isArray(latest.manualUncertaintyDecisions) ||
latest.manualUncertaintyDecisions.some(item => !item || typeof item.description !== 'string') ||
(latest.qualityReview !== null &&
(!latest.qualityReview ||
!validIssues(latest.qualityReview.issues) ||
!validTextList(latest.qualityReview.uncertainty)))
)
throw new Error('正式审核数据不完整,请重新读取后核对。')
if (latest.passed) return { latest, preview: null }
try {
const preview = await dramaReviewApi.preview(id, signal)
if (preview.projectId !== id || preview.reviewId !== latest.id)
throw new Error('审核版本已变化,请重新读取后核对。')
if (!validPreview(preview)) throw new Error('审核预检的数据不完整,请重新读取后核对。')
return { latest, preview }
} catch (cause) {
if (signal?.aborted) throw cause
return { latest, preview: null, previewError: errorMessage(cause) }
}
}
/**
* 核对系统核查预检的归属与完整字段,不能据本地状态补造就绪结果。
* @param id 正式项目
* @param signal 取消过期查询
* @returns 当前可信核查预检
*/
export async function loadDramaReviewResumePreview(
id: string,
signal?: AbortSignal
): Promise<DramaReviewResumePreview> {
const value = await dramaReviewApi.resumePreview(id, signal)
if (
value.projectId !== id ||
!value.checkpointId ||
value.readOnly !== true ||
typeof value.ready !== 'boolean' ||
!Number.isSafeInteger(value.episodeCount) ||
value.episodeCount < 1
)
throw new Error('系统核查的保存记录不完整,请重新读取。')
return value
}
+248
View File
@@ -0,0 +1,248 @@
import type {
DramaReviewIssue,
DramaReviewPreview,
DramaReviewSnapshot,
DramaRewritePreview,
ManualReviewDraft,
DeferredUncertaintyDraft,
ReviewResolutionSuggestion,
ManualReviewDecision
} from './types'
/**
* 读取当前预检绑定保存记录中的裁决,兼容人工处理尚未生成新 Review 的情况。
* @param review 保存记录中的原始审核字段
* @param reviewId 本次预检对应的正式审核编号
* @returns 结构完整且属于本次审核的裁决,字段缺失时回退正式审核记录
*/
export function savedReviewDecisions(review: unknown, reviewId: string): ManualReviewDecision[] | null {
if (!review || typeof review !== 'object' || !('manualUncertaintyDecisions' in review)) return null
const decisions = review.manualUncertaintyDecisions
if (!Array.isArray(decisions)) return null
return decisions.filter(
(item): item is ManualReviewDecision =>
!!item &&
typeof item === 'object' &&
item.reviewId === reviewId &&
Number.isSafeInteger(item.originalIndex) &&
typeof item.description === 'string' &&
['accepted', 'deferred', 'verified'].includes(item.disposition) &&
(item.episode === undefined || (Number.isSafeInteger(item.episode) && item.episode > 0)) &&
(item.verificationTarget === undefined || ['breakdown', 'storyboard'].includes(item.verificationTarget)) &&
(item.verificationCriteria === undefined || typeof item.verificationCriteria === 'string')
)
}
/** 原始审核中的问题位置,不能用排序后的页面位置替代。 */
export interface IndexedReviewIssue {
/** 原始待确认数组索引。 */ originalIndex: number
/** 真实问题内容。 */ issue: DramaReviewIssue
}
/** 原始审核中的不确定项位置。 */
export interface IndexedReviewUncertainty {
/** 原始不确定项数组索引。 */ originalIndex: number
/** 原始文字。 */ text: string
}
/** 质量维度只翻译展示名称,提交仍使用原始枚举。 */
export const reviewCategoryOptions = [
{ label: '动作衔接', value: 'action_continuity' },
{ label: '手部占用', value: 'hand_occupancy' },
{ label: '姿态', value: 'pose' },
{ label: '视线', value: 'gaze' },
{ label: '道具交互', value: 'prop_interaction' },
{ label: '时长', value: 'duration' },
{ label: '主体一致性', value: 'subject_consistency' },
{ label: '空间衔接', value: 'spatial_continuity' }
]
/**
* 沿用服务端识别当前待处理问题的字段,不把同集不同问题合并。
* @param left 原始问题
* @param right 当前问题
* @returns 是否为同一原始条目
*/
function sameIssue(left: DramaReviewIssue, right: DramaReviewIssue) {
return left.episode === right.episode && left.code === right.code && left.sourceQuote === right.sourceQuote
}
/**
* 展示当前剩余问题,始终保留原数组索引。
* @param preview 当前预检
* @returns 可按剧集展示的原始条目
*/
export function indexedPendingIssues(preview: DramaReviewPreview | null): IndexedReviewIssue[] {
if (!preview) return []
return preview.pendingQualityIssues
.map((issue, originalIndex) => ({ issue, originalIndex }))
.filter(
row =>
!preview.remainingPendingQualityIssues ||
preview.remainingPendingQualityIssues.some(issue => sameIssue(row.issue, issue))
)
.toSorted((left, right) => left.issue.episode - right.issue.episode || left.originalIndex - right.originalIndex)
}
/**
* 原始索引独立于页面过滤,并与后端的文字匹配规则保持一致。
* @param preview 当前预检
* @returns 尚未裁决的不确定项
*/
export function indexedUncertainties(preview: DramaReviewPreview | null): IndexedReviewUncertainty[] {
if (!preview) return []
return preview.uncertainty
.map((text, originalIndex) => ({ text, originalIndex }))
.filter(row => !preview.remainingUncertainty || preview.remainingUncertainty.includes(row.text))
}
/**
* 只比较用户已核对的服务端来源,任何变更都要求重新选择。
* @param previous 用户已核对的版本
* @param current 提交前重新读取的版本
* @returns 审核、保存记录与正文是否完全相同
*/
export function sameReviewSource(previous: DramaReviewPreview, current: DramaReviewPreview): boolean {
return (
previous.projectId === current.projectId &&
previous.reviewId === current.reviewId &&
previous.checkpointId === current.checkpointId &&
JSON.stringify(previous.episodes) === JSON.stringify(current.episodes) &&
JSON.stringify(previous.pendingQualityIssues) === JSON.stringify(current.pendingQualityIssues) &&
JSON.stringify(previous.uncertainty) === JSON.stringify(current.uncertainty) &&
JSON.stringify(previous.remainingPendingQualityIssues) ===
JSON.stringify(current.remainingPendingQualityIssues) &&
JSON.stringify(previous.remainingUncertainty) === JSON.stringify(current.remainingUncertainty) &&
JSON.stringify(previous.resolutionSuggestions) === JSON.stringify(current.resolutionSuggestions)
)
}
/**
* 改写范围或来源变化后撤销旧费用确认。
* @param previous 已展示的改写预检
* @param current 提交前的新预检
* @returns 是否仍是用户核对的同一范围
*/
export function sameRewriteScope(previous: DramaRewritePreview, current: DramaRewritePreview): boolean {
return (
previous.projectId === current.projectId &&
previous.checkpointId === current.checkpointId &&
previous.rewriteCharacters === current.rewriteCharacters &&
previous.rewriteWorld === current.rewriteWorld &&
previous.rewriteEpisodes === current.rewriteEpisodes &&
JSON.stringify(previous.episodeNumbers.toSorted((a, b) => a - b)) ===
JSON.stringify(current.episodeNumbers.toSorted((a, b) => a - b))
)
}
/**
* 只有正式预检明确允许,且当前剩余数据完整时,才开放人工确认。
* @param snapshot 已读取的审核及预检
* @returns 不可提交的可读原因,空字符串表示可继续核对
*/
export function reviewBlockReason(snapshot: DramaReviewSnapshot | null): string {
if (!snapshot?.latest) return '当前尚无审核记录。'
if (snapshot.latest.passed) return '当前审核已通过,无需再次确认。'
if (snapshot.previewError) return snapshot.previewError
const preview = snapshot.preview
if (!preview) return '尚未取得问题处理预检,请重新读取。'
if (preview.hasActiveExecution) return '剧本任务仍在运行,请结束后再处理审核问题。'
if (!preview.sourceValid || !preview.reviewSourceValid || preview.reviewId !== snapshot.latest.id)
return '审核与当前剧本来源不一致,请刷新并核对保存记录。'
if (
!preview.ready ||
preview.readOnly !== true ||
!Array.isArray(preview.remainingPendingQualityIssues) ||
!Array.isArray(preview.remainingUncertainty)
)
return '当前预检尚不允许确认,请刷新后核对。'
return ''
}
/**
* 表单提交前检查必填项与逐字引用;最终事实仍由服务端核验。
* @param draft 人工补充的草稿
* @param episodes 当前预检返回的正式正文
* @returns 可读字段问题,空字符串表示表单完整
*/
export function manualIssueError(draft: ManualReviewDraft, episodes: DramaReviewPreview['episodes']): string {
const episode = episodes.find(item => item.episode === draft.episode)
if (!episode) return '请选择当前正式剧集。'
if (![draft.code, draft.sourceQuote, draft.message, draft.suggestion].every(value => value.trim()))
return '请填写问题名称、原文片段、问题说明和修改建议。'
if (!episode.content.includes(draft.sourceQuote.trim())) return '引用片段必须逐字出现在所选剧集原文中。'
if (draft.subjectRef.trim() && !episode.content.includes(draft.subjectRef.trim()))
return '所选角色必须出现在引用所属的剧集原文中。'
return ''
}
/**
* 无效模型结构或无法核实的证据不能通过接受不确定项绕过。
* @param text 原始不确定项
* @returns 是否允许请求人工接受
*/
export function uncertaintyAcceptable(text: string): boolean {
return !/引用原文或主体无法核实|模型返回不符合审核结构/.test(text)
}
/**
* 建议位置可能来自剩余项列表;按完整原文对应,提交仍使用原始审核索引。
* @param preview 当前预检
* @param originalIndex 原始不确定项索引
* @returns 唯一对应的建议,无法对应时为空
*/
export function suggestionForUncertainty(
preview: DramaReviewPreview | null,
originalIndex: number
): ReviewResolutionSuggestion | null {
const text = preview?.uncertainty[originalIndex]
if (
!preview ||
typeof text !== 'string' ||
(preview.remainingUncertainty && !preview.remainingUncertainty.includes(text))
)
return null
const matches = preview.resolutionSuggestions?.filter(item => item.description === text) ?? []
return matches.length === 1 ? matches[0]! : null
}
/**
* 只有用户主动选择延期时创建草稿;低置信度或要求选集的建议不绑定默认集号。
* @param index 原始不确定项索引
* @param suggestion 当前原文对应的建议
* @param episodes 正式剧集列表
* @returns 尚未确认的延期表单
*/
export function newDeferredDraft(
index: number,
suggestion: ReviewResolutionSuggestion | null,
episodes: DramaReviewPreview['episodes']
): DeferredUncertaintyDraft {
const episode =
suggestion?.confidence === 'high' &&
!suggestion.requiresEpisodeSelection &&
episodes.some(item => item.episode === suggestion.episode)
? suggestion.episode
: null
return {
index,
episode,
verificationTarget: suggestion?.verificationTarget ?? null,
verificationCriteria: suggestion?.verificationCriteria ?? ''
}
}
/**
* 校验用户编辑后的延期要求,不限制为候选集,也不把建议当作已确认。
* @param draft 当前延期草稿
* @param episodes 当前正式剧集
* @returns 需要用户修正的字段问题
*/
export function deferredDraftError(draft: DeferredUncertaintyDraft, episodes: DramaReviewPreview['episodes']): string {
if (!Number.isSafeInteger(draft.episode) || !episodes.some(item => item.episode === draft.episode))
return '请明确选择负责核验的正式剧集。'
if (!['breakdown', 'storyboard'].includes(draft.verificationTarget ?? '')) return '请选择核验阶段。'
if (!draft.verificationCriteria.trim()) return '请填写核验标准。'
if (draft.verificationCriteria.trim().length > 2000) return '核验标准不能超过 2000 个字符。'
return ''
}
+205
View File
@@ -0,0 +1,205 @@
/** 剧本审核使用的真实质量维度。 */
export type DramaReviewCategory =
| 'hand_occupancy'
| 'pose'
| 'gaze'
| 'prop_interaction'
| 'action_continuity'
| 'duration'
| 'subject_consistency'
| 'spatial_continuity'
/** 剧本审核问题,引用与事件标识保持服务端原值。 */
export interface DramaReviewIssue {
/** 正式集号。 */ episode: number
/** 质量维度。 */ category: DramaReviewCategory
/** 原始问题代码。 */ code: string
/** 服务端严重程度。 */ severity: 'warning' | 'error'
/** 逐字原文引用。 */ sourceQuote: string
/** 问题说明。 */ message: string
/** 局部修改建议。 */ suggestion: string
/** 是否属于已允许的策略例外。 */ policyException?: boolean
/** 原文证据的确定程度。 */ evidenceConfidence?: 'explicit' | 'inferred' | 'unknown'
/** 正文明确出现的主体名称。 */ subjectRef?: string
/** 事件追踪标识,并非原文引用。 */ eventKey?: string
}
/** 已保存的人工不确定性裁决,延期记录仅供追溯。 */
export interface ManualReviewDecision {
/** 原审核编号。 */ reviewId: string
/** 原始不确定项索引。 */ originalIndex: number
/** 原始问题说明。 */ description: string
/** 服务端记录的处理方式。 */ disposition: 'accepted' | 'deferred' | 'verified'
/** 涉及的正式集号。 */ episode?: number
/** 后续核验阶段。 */ verificationTarget?: 'breakdown' | 'storyboard'
/** 已保存的后续核验标准。 */ verificationCriteria?: string
}
/** 系统核查已保存正文前的只读来源预检。 */
export interface DramaReviewResumePreview {
/** 正式项目。 */ projectId: string
/** 当前完整正文对应的保存记录。 */ checkpointId: string
/** 实际保存的剧集数。 */ episodeCount: number
/** 后端已确认可核查。 */ ready: boolean
/** 预检不调用模型。 */ readOnly: true
}
/** 最新正式审核,不从保存记录的布尔值虚构明细。 */
export interface LatestDramaReview {
/** 正式审核编号。 */ id: string
/** 所属项目。 */ projectId: string
/** 审核是否明确通过。 */ passed: boolean
/** 审核摘要。 */ message: string | null
/** 审核时间。 */ createdAt: string
/** 原始结构化质量审核。 */ qualityReview: {
/** 原审核结构化问题。 */ issues: DramaReviewIssue[]
/** 原审核不确定项,保留稳定索引。 */ uncertainty: string[]
} | null
/** 原始待人工确认的问题。 */ pendingQualityIssues: DramaReviewIssue[]
/** 已保存的人工裁决。 */ manualUncertaintyDecisions: ManualReviewDecision[]
/** 系统逐项复核摘要;不等同于人工确认。 */ automaticQualityResolution?: {
/** 本次复核候选数。 */ candidateCount: number
/** 已有有效依据的项数。 */ resolvedCount: number
/** 仍需核对的项数。 */ remainingCount: number
/** 系统复核实际状态。 */ status: 'completed' | 'failed'
/** 实际判断依据,仅供追溯。 */ decisions: Array<{
/** 本轮候选索引。 */ candidateIndex: number
/** 判断原因。 */ reason: string
}>
} | null
/** 已有改写目标集数。 */ affectedEpisodes: number[]
/** 敏感词审核结果。 */ hitWords: string[]
}
/** 人工确认前的真实只读预检,兼容来源过期时的精简回执。 */
export interface DramaReviewPreview {
/** 所属项目。 */ projectId: string
/** 当前最新正式审核。 */ reviewId: string
/** 当前创作保存记录。 */ checkpointId: string
/** 只读操作。 */ readOnly: true
/** 服务端是否允许处理。 */ ready: boolean
/** 保存记录与正式正文一致。 */ sourceValid: boolean
/** 最新审核与正式正文一致。 */ reviewSourceValid: boolean
/** 是否存在活动创作任务。 */ hasActiveExecution: boolean
/** 原始待确认问题,索引来源。 */ pendingQualityIssues: DramaReviewIssue[]
/** 原始不确定项,索引来源。 */ uncertainty: string[]
/** 当前仍待处理的问题;缺失时仅展示原列表,不开放提交。 */ remainingPendingQualityIssues?: DramaReviewIssue[]
/** 当前仍待处理的不确定项。 */ remainingUncertainty?: string[]
/** 当前剩余项的只读处理建议,不等同于已确认的决定。 */ resolutionSuggestions?: ReviewResolutionSuggestion[]
/** 当前保存的改写目标集数。 */ confirmedRewriteEpisodes?: number[]
/** 供逐字核对的正式正文。 */ episodes: Array<{
/** 正式集号。 */ episode: number
/** 完整正文。 */ content: string
}>
/** 服务端附加的来源状态。 */ status?: string
/** 来源失效原因。 */ reason?: string
}
/** 用户逐项核对后的人工确认请求,不包含任何模型生成参数。 */
export interface ConfirmDramaIssuesInput {
/** 必须明确确认。 */ confirmed: true
/** 已核对的最新审核编号。 */ reviewId: string
/** 原始待确认列表中的错误索引,始终发送数组。 */ issueIndexes: number[]
/** 接受保留的警告原始索引。 */ acceptedWarningIndexes?: number[]
/** 接受保留的不确定项原始索引。 */ acceptedUncertaintyIndexes?: number[]
/** 用户补充、具有真实原文的错误证据。 */ manualIssues?: DramaReviewIssue[]
/** 用户明确选择并编辑的延期核验要求。 */ deferredUncertainties?: DeferredReviewUncertainty[]
}
/** 人工确认回执,只有 finalized 才代表服务端已完成审核收敛。 */
export interface ConfirmDramaIssuesResult {
/** 所属项目。 */ projectId: string
/** 本次生成的保存记录。 */ checkpointId: string
/** 本次处理的原审核编号。 */ reviewId: string
/** 本次确认的改写集数。 */ confirmedEpisodes: number[]
/** 本次接受的不确定项。 */ acceptedUncertaintyIndexes: number[]
/** 本次接受的警告。 */ acceptedWarningIndexes: number[]
/** 诊断合计,不能作为审核通过依据。 */ remainingBlockers: number
/** 分类统计可能重叠,不相加作为独立问题数。 */ blockers: {
/** 待确认问题。 */ pendingIssues: number
/** 不确定项。 */ uncertainty: number
/** 确认错误。 */ confirmedErrors: number
/** 改写剧集。 */ affectedEpisodes: number
/** 安全问题。 */ contentSafety: number
}
/** 服务端是否已原子完成审核与项目状态。 */ finalized: boolean
}
/** 恢复改写前的只读范围预检。 */
export interface DramaRewritePreview {
/** 所属项目。 */ projectId: string
/** 本次核对的保存记录。 */ checkpointId: string
/** 不启动任务。 */ readOnly: true
/** 服务端是否允许启动改写。 */ ready: boolean
/** 服务端原始预检状态。 */ status: 'stale' | 'blocked' | 'needs_review' | 'ready'
/** 本次改写的正式集号。 */ episodeNumbers: number[]
/** 是否改写角色设定。 */ rewriteCharacters: boolean
/** 是否改写世界观。 */ rewriteWorld: boolean
/** 是否改写剧集。 */ rewriteEpisodes: boolean
/** 必须由用户明确确认。 */ requiresConfirmation: true
}
/** 一次审核读取,正式审核与预检必须属于同一版本。 */
export interface DramaReviewSnapshot {
/** 最新审核,没有审核时为空。 */ latest: LatestDramaReview | null
/** 待处理审核的只读预检。 */ preview: DramaReviewPreview | null
/** 预检单独失败时仍保留正式审核供只读查看。 */ previewError?: string
}
/** 待人工补充的表单草稿,不等同于已保存的审核事实。 */
export interface ManualReviewDraft {
/** 当前表单行标识。 */ id: string
/** 从正式剧集选择的集号。 */ episode: number | null
/** 后端支持的质量维度。 */ category: DramaReviewCategory
/** 用户填写的问题名称,作为自由格式问题标识提交。 */ code: string
/** 用户核对的逐字原文。 */ sourceQuote: string
/** 用户核对的问题说明。 */ message: string
/** 用户提出的修改方向。 */ suggestion: string
/** 用户明确指定的角色,未指定时留空。 */ subjectRef: string
}
/** 后端根据当前审核原文提供的建议,只用于辅助人工判断。 */
export interface ReviewResolutionSuggestion {
/** 当前建议列表中的位置,提交仍对应原始审核索引。 */ index: number
/** 对应不确定项的原始描述。 */ description: string
/** 推荐处理方式,不能据此自动提交。 */ suggestedAction: 'defer' | 'manual_review'
/** 是否必须由用户明确选择负责核验的剧集。 */ requiresEpisodeSelection: boolean
/** 建议是否要求人工确认。 */ requiresManualConfirmation: boolean
/** 推荐的唯一集号,没有明确归属时为空。 */ episode: number | null
/** 推荐候选集号,不限制选择其它正式剧集。 */ episodeCandidates: number[]
/** 建议置信度,低置信度不能自动绑定集号。 */ confidence: 'high' | 'low' | 'none'
/** 建议的后续核验阶段。 */ verificationTarget: 'breakdown' | 'storyboard' | null
/** 建议的核验标准,用户可编辑。 */ verificationCriteria: string | null
/** 推荐原因。 */ reason: string
}
/** 尚未提交的延期核验表单,允许保留未填写字段。 */
export interface DeferredUncertaintyDraft {
/** 原始审核中的不确定项索引。 */ index: number
/** 由用户核对的正式集号。 */ episode: number | null
/** 用户核对的验证阶段。 */ verificationTarget: 'breakdown' | 'storyboard' | null
/** 用户核对或编辑后的核验标准。 */ verificationCriteria: string
}
/** 人工明确确认后提交的延期核验请求。 */
export interface DeferredReviewUncertainty {
/** 原始审核索引。 */ index: number
/** 正式存在的集号。 */ episode: number
/** 真实支持的核验阶段。 */ verificationTarget: 'breakdown' | 'storyboard'
/** 非空且不超过后端限制的核验标准。 */ verificationCriteria: string
}
/** 未提交的人工选择,保留并不代表已接受问题。 */
export type UncertaintyDisposition = 'pending' | 'accept' | 'defer'
/** 来源变化后保留的只读草稿,不能直接提交到新版本。 */
export interface ReviewDraftBackup {
/** 草稿对应的正式审核。 */ reviewId: string
/** 草稿对应的保存记录。 */ checkpointId: string
/** 原始错误索引。 */ issueIndexes: number[]
/** 原始警告索引。 */ acceptedWarningIndexes: number[]
/** 原始不确定项索引。 */ acceptedUncertaintyIndexes: number[]
/** 当时的问题描述,方便重新核对。 */ descriptions: string[]
/** 用户填写的延期核验草稿。 */ deferredUncertainties: DeferredUncertaintyDraft[]
/** 用户填写的人工原文证据。 */ manualIssues: ManualReviewDraft[]
}
@@ -0,0 +1,447 @@
import { computed, onScopeDispose, ref, watch, type Ref } from 'vue'
import { useQuery } from '../../../composables/useQuery'
import { ApiError, errorMessage } from '../../../lib/http'
import { useActionMessage } from '../../../components/ui/useActionMessage'
import { getOperation, runOperation } from '../../workflows/operations'
import { dramaReviewApi, loadDramaReview } from './api'
import {
deferredDraftError,
newDeferredDraft,
suggestionForUncertainty,
indexedPendingIssues,
indexedUncertainties,
manualIssueError,
reviewBlockReason,
sameReviewSource,
uncertaintyAcceptable,
type IndexedReviewIssue
} from './model'
import type {
ConfirmDramaIssuesInput,
ConfirmDramaIssuesResult,
DramaReviewIssue,
ManualReviewDraft,
DeferredUncertaintyDraft,
ReviewDraftBackup,
UncertaintyDisposition
} from './types'
/**
* 审核问题处理只保存人工裁决;当前权限与终态始终读取服务端。
* @param projectId 正式项目编号
* @param changed 写入后刷新项目、保存记录及阶段状态
* @param disabled 外部项目读取或操作限制
* @returns 查询、原始索引选择与明确提交入口
*/
export function useDramaReview(
projectId: Ref<string>,
changed: () => Promise<void>,
disabled: Ref<boolean> = ref(false)
) {
/** 正式审核与当前预检,不自动轮询。 */
const query = useQuery(projectId, (id, signal) => loadDramaReview(id, signal))
/** 复杂原文核对与人工补充使用同一个全屏抽屉。 */
const editorOpen = ref(false)
/** 本次人工确认请求状态,普通读取不锁定关闭。 */
const writing = ref(false)
/** 用户对本次处理的明确确认。 */
const acknowledged = ref(false)
/** 当前已尝试提交表单,首次打开不显示字段错误。 */
const attempted = ref(false)
/** 当前操作的可读错误,不改变原始业务错误。 */
const actionError = ref('')
/** 服务端本次真实回执,不在页面推算 finalized。 */
const receipt = ref<ConfirmDramaIssuesResult | null>(null)
/** 原始待确认列表中的错误索引。 */
const selectedErrors = ref<number[]>([])
/** 原始待确认列表中的警告索引。 */
const selectedWarnings = ref<number[]>([])
/** 原始不确定项数组索引。 */
const selectedUncertainty = ref<number[]>([])
/** 用户主动选择的延期草稿;读取建议不会新增任何条目。 */
const deferredDrafts = ref<Record<number, DeferredUncertaintyDraft>>({})
/** 来源变化后保留的只读草稿,不能直接套用到新审核。 */
const preservedDraft = ref<ReviewDraftBackup | null>(null)
/** 字段验证反馈复用应用 NMessage,不重复发送后台错误通知。 */
const message = useActionMessage()
/** 用户补充的原文证据草稿。 */
const manualDrafts = ref<ManualReviewDraft[]>([])
/** 项目级活动锁与其它生成入口保持一致。 */
const operation = computed(() => getOperation(projectId.value))
/** 剩余问题保留原始索引,分组不会影响请求。 */
const pendingRows = computed(() => indexedPendingIssues(query.data.value?.preview ?? null))
/** 剩余不确定项保留原始索引。 */
const uncertaintyRows = computed(() => indexedUncertainties(query.data.value?.preview ?? null))
/** 服务端明确给出的不可处理原因。 */
const blockedReason = computed(() => query.error.value || reviewBlockReason(query.data.value))
/** 普通读取、来源不完整或后台运行时只读查看。 */
const locked = computed(
() => disabled.value || writing.value || query.loading.value || !!blockedReason.value || operation.value.pending
)
/** 用户实际选择的处理数量,不混算服务端阻断分类。 */
const selectionCount = computed(
() =>
selectedErrors.value.length +
selectedWarnings.value.length +
selectedUncertainty.value.length +
Object.keys(deferredDrafts.value).length +
manualDrafts.value.length
)
/** 只有用户明确勾选后才允许执行表单提交。 */
const canConfirm = computed(
() => editorOpen.value && acknowledged.value && selectionCount.value > 0 && !locked.value
)
/** 提交后才逐行展示人工补充表单错误。 */
const manualErrors = computed(() =>
attempted.value
? manualDrafts.value.map(draft => manualIssueError(draft, query.data.value?.preview?.episodes ?? []))
: []
)
/** 用户尝试提交后才显示延期字段错误。 */
const deferredErrors = computed<Record<number, string>>(() =>
attempted.value
? Object.fromEntries(
Object.entries(deferredDrafts.value).map(([key, draft]) => [
Number(key),
draft.index !== Number(key) ||
!uncertaintyRows.value.some(row => row.originalIndex === draft.index)
? '原审核项已变化,请重新读取。'
: deferredDraftError(draft, query.data.value?.preview?.episodes ?? [])
])
)
: {}
)
/** 草稿行编号只用于界面,不作为业务标识提交。 */
let nextDraftId = 0
/** 项目版本,防止旧项目预检或回执回填。 */
let revision = 0
/** 提交前只读核对的取消控制器。 */
let controller: AbortController | undefined
onScopeDispose(() => {
revision++
controller?.abort()
})
/** 清除当前选择与证据草稿,来源变化时要求重新核对。 */
function resetChoices() {
selectedErrors.value = []
selectedWarnings.value = []
selectedUncertainty.value = []
deferredDrafts.value = {}
manualDrafts.value = []
acknowledged.value = false
attempted.value = false
}
watch(projectId, () => {
revision++
controller?.abort()
editorOpen.value = false
resetChoices()
receipt.value = null
preservedDraft.value = null
actionError.value = ''
})
watch(editorOpen, () => {
acknowledged.value = false
attempted.value = false
})
watch(
[selectedErrors, selectedWarnings, selectedUncertainty, deferredDrafts, manualDrafts],
() => {
acknowledged.value = false
attempted.value = false
if (!writing.value && selectionCount.value > 0) actionError.value = ''
},
{ deep: true }
)
watch(
() => query.data.value,
(current, previous) => {
const before = previous?.preview
const after = current?.preview
const sourceChanged =
(before && (!after || !sameReviewSource(before, after))) ||
(!!previous?.latest && previous.latest.id !== current?.latest?.id)
if (sourceChanged) {
const hadChoices = selectionCount.value > 0
if (!writing.value) receipt.value = null
if (before && hadChoices) preserveChoices(before)
resetChoices()
if (hadChoices && !writing.value)
actionError.value = '审核来源或建议已变化,旧选择已保留为草稿,请按当前版本重新核对。'
}
},
{ flush: 'sync' }
)
/** 打开处理界面时重新核对当前版本,不自动提交。 */
async function openEditor() {
editorOpen.value = true
actionError.value = ''
await query.refresh()
}
/**
* 已有结构化问题可带入补充表单,纯文本疑点不能自动升级为错误。
* @param issue 用户选择补充证据的原问题
*/
function addManual(issue?: DramaReviewIssue) {
if (locked.value || issue?.policyException) return
manualDrafts.value.push({
id: `manual-${++nextDraftId}`,
episode: issue?.episode ?? query.data.value?.preview?.episodes[0]?.episode ?? null,
category: issue?.category ?? 'action_continuity',
code: issue?.code ?? '',
sourceQuote: issue?.sourceQuote ?? '',
message: issue?.message ?? '',
suggestion: issue?.suggestion ?? '',
subjectRef: issue?.subjectRef ?? ''
})
}
/**
* 移除尚未保存的证据行,不修改正式审核。
* @param id 草稿行编号
*/
function removeManual(id: string) {
manualDrafts.value = manualDrafts.value.filter(draft => draft.id !== id)
actionError.value = ''
attempted.value = false
}
/**
* 界面仅开放接口明确支持的操作,最终证据与权限仍由服务端复核。
* @param row 原始问题及索引
* @returns 可选择的确认或接受方式,无法核实时为空
*/
function issueAction(row: IndexedReviewIssue): 'error' | 'warning' | null {
const issue = row.issue
const content = query.data.value?.preview?.episodes.find(item => item.episode === issue.episode)?.content
if (issue.policyException || !content?.includes(issue.sourceQuote)) return null
if (issue.severity === 'warning') return 'warning'
return issue.evidenceConfidence === 'explicit' ? 'error' : null
}
/**
* 来源变化时保留用户输入供核对,不自动复用旧索引。
* @param source 原草稿绑定的预检
*/
function preserveChoices(source: NonNullable<typeof query.data.value>['preview']) {
if (!source || selectionCount.value === 0) return
preservedDraft.value = JSON.parse(
JSON.stringify({
reviewId: source.reviewId,
checkpointId: source.checkpointId,
issueIndexes: selectedErrors.value,
acceptedWarningIndexes: selectedWarnings.value,
acceptedUncertaintyIndexes: selectedUncertainty.value,
descriptions: source.uncertainty,
deferredUncertainties: Object.values(deferredDrafts.value),
manualIssues: manualDrafts.value
})
) as ReviewDraftBackup
}
/**
* 人工选择是唯一创建延期草稿的入口,接受与延期始终互斥。
* @param index 原始不确定项索引
* @param action 用户明确选择的处理方式
*/
function setUncertaintyAction(index: number, action: UncertaintyDisposition) {
if (locked.value) return
const row = uncertaintyRows.value.find(item => item.originalIndex === index)
if (!row || (action !== 'pending' && !uncertaintyAcceptable(row.text))) return
selectedUncertainty.value = selectedUncertainty.value.filter(value => value !== index)
if (action === 'accept') {
delete deferredDrafts.value[index]
selectedUncertainty.value.push(index)
} else if (action === 'defer') {
if (!deferredDrafts.value[index])
deferredDrafts.value[index] = newDeferredDraft(
index,
suggestionForUncertainty(query.data.value?.preview ?? null, index),
query.data.value?.preview?.episodes ?? []
)
} else delete deferredDrafts.value[index]
acknowledged.value = false
attempted.value = false
actionError.value = ''
}
/**
* 不确定说明只能带入尚未核实的表单草稿,原文与建议仍需人工填写。
* @param index 原始不确定项索引
*/
function addUncertaintyEvidence(index: number) {
const row = uncertaintyRows.value.find(item => item.originalIndex === index)
if (locked.value || !row) return
addManual()
const draft = manualDrafts.value.at(-1)
const suggestion = suggestionForUncertainty(query.data.value?.preview ?? null, index)
if (draft) {
draft.episode =
suggestion?.confidence === 'high' && !suggestion.requiresEpisodeSelection ? suggestion.episode : null
draft.message = row.text
}
}
/** 在明确确认后重新预检并保存裁决,成功或冲突后重读真实结果,不自动改写。 */
async function confirm() {
if (!canConfirm.value || !query.data.value?.preview) return
attempted.value = true
const overlap = Object.values(deferredDrafts.value).some(draft =>
selectedUncertainty.value.includes(draft.index)
)
if (overlap) {
actionError.value = '同一问题不能同时接受和延期验证。'
message?.warning(actionError.value)
return
}
const unresolved = [
...selectedUncertainty.value,
...Object.values(deferredDrafts.value).map(draft => draft.index)
].some(index => {
const row = uncertaintyRows.value.find(item => item.originalIndex === index)
return !row || !uncertaintyAcceptable(row.text)
})
if (unresolved) {
actionError.value = '所选问题已变化或需要补充原文证据,请重新核对。'
message?.warning(actionError.value)
return
}
if (Object.values(deferredErrors.value).some(Boolean)) {
actionError.value = '请先完善延期验证的剧集、阶段和验证标准。'
message?.warning(actionError.value)
return
}
if (manualErrors.value.some(Boolean)) {
actionError.value = '请先修正人工补充中的原文与必填内容。'
message?.warning(actionError.value)
return
}
const expected = query.data.value.preview
const id = projectId.value
const version = revision
const input: ConfirmDramaIssuesInput = {
confirmed: true,
reviewId: expected.reviewId,
issueIndexes: [...selectedErrors.value],
acceptedWarningIndexes: [...selectedWarnings.value],
acceptedUncertaintyIndexes: [...selectedUncertainty.value],
...(Object.keys(deferredDrafts.value).length
? {
deferredUncertainties: Object.values(deferredDrafts.value)
.toSorted((a, b) => a.index - b.index)
.map(draft => ({
index: draft.index,
episode: draft.episode!,
verificationTarget: draft.verificationTarget!,
verificationCriteria: draft.verificationCriteria.trim()
}))
}
: {}),
...(manualDrafts.value.length
? {
manualIssues: manualDrafts.value.map(draft => ({
episode: draft.episode!,
category: draft.category,
code: draft.code.trim(),
severity: 'error' as const,
sourceQuote: draft.sourceQuote.trim(),
message: draft.message.trim(),
suggestion: draft.suggestion.trim(),
evidenceConfidence: 'explicit' as const,
policyException: false,
...(draft.subjectRef.trim() ? { subjectRef: draft.subjectRef.trim() } : {})
}))
}
: {})
}
writing.value = true
actionError.value = ''
controller = new AbortController()
try {
const succeeded = await runOperation(
id,
'确认审核问题',
async () => {
const current = await loadDramaReview(id, controller!.signal)
if (disabled.value || version !== revision || projectId.value !== id)
throw new Error('查看的项目已变化,请重新核对。')
if (!current.preview || !sameReviewSource(expected, current.preview)) {
preserveChoices(expected)
query.data.value = current
resetChoices()
throw new Error('审核记录或建议来源已变化,旧选择已保留为草稿,请重新核对并选择问题。')
}
const block = reviewBlockReason(current)
if (block) {
query.data.value = current
throw new Error(block)
}
const result = await dramaReviewApi.confirm(id, input)
if (
result.projectId !== id ||
result.reviewId !== expected.reviewId ||
!result.checkpointId ||
typeof result.finalized !== 'boolean' ||
!Array.isArray(result.confirmedEpisodes)
)
throw new Error('处理回执来源尚未确认,请刷新审核记录,不要重复提交。')
if (version === revision && projectId.value === id) receipt.value = result
return result
},
result => ({
type: result.finalized ? 'success' : 'info',
content: result.finalized
? '人工处理已完成,当前审核已通过。'
: '本次处理已保存,请继续核对剩余问题与改写范围。'
})
)
if (version !== revision || projectId.value !== id) return
acknowledged.value = false
if (succeeded) {
resetChoices()
await Promise.all([query.refresh(), changed()])
} else {
actionError.value = getOperation(id).error
if (getOperation(id).cause instanceof ApiError && (getOperation(id).cause as ApiError).status === 409)
await query.refresh()
}
} catch (cause) {
if (version === revision && projectId.value === id) actionError.value = errorMessage(cause)
} finally {
writing.value = false
}
}
return {
query,
editorOpen,
writing,
acknowledged,
actionError,
receipt,
selectedErrors,
selectedWarnings,
selectedUncertainty,
deferredDrafts,
deferredErrors,
preservedDraft,
setUncertaintyAction,
addUncertaintyEvidence,
manualDrafts,
manualErrors,
pendingRows,
uncertaintyRows,
blockedReason,
locked,
selectionCount,
canConfirm,
openEditor,
addManual,
removeManual,
issueAction,
uncertaintyAcceptable,
confirm
}
}
+12 -2
View File
@@ -29,6 +29,14 @@ export const generationConfigApi = {
request<CreativeProfile | null>(`${projectPath(projectId)}/creative-profile`, { signal }), request<CreativeProfile | null>(`${projectPath(projectId)}/creative-profile`, { signal }),
saveProfile: (projectId: string, input: CreativeProfileInput) => saveProfile: (projectId: string, input: CreativeProfileInput) =>
request<CreativeProfile>(`${projectPath(projectId)}/creative-profile`, { method: 'PUT', body: input }), request<CreativeProfile>(`${projectPath(projectId)}/creative-profile`, { method: 'PUT', body: input }),
/**
* 解析实际项目及目标覆盖配置,显式选择时沿原优先级处理。
* @param projectId 当前项目
* @param mediaType 图片或视频
* @param input 显式参数与正式目标
* @param signal 取消旧表单读取
* @returns 最终供应方、型号及参数
*/
resolve: ( resolve: (
projectId: string, projectId: string,
mediaType: GenerationMediaType, mediaType: GenerationMediaType,
@@ -37,11 +45,13 @@ export const generationConfigApi = {
model?: string model?: string
options?: Record<string, unknown> options?: Record<string, unknown>
target?: { targetType: GenerationOverrideTargetType; targetId: string } target?: { targetType: GenerationOverrideTargetType; targetId: string }
} },
signal?: AbortSignal
) => ) =>
request<ResolvedGenerationConfig>(`${projectPath(projectId)}/generation-config/${mediaType}/resolve`, { request<ResolvedGenerationConfig>(`${projectPath(projectId)}/generation-config/${mediaType}/resolve`, {
method: 'POST', method: 'POST',
body: input body: input,
signal
}), }),
override: ( override: (
projectId: string, projectId: string,
Loaded 100 of 462 files, more files were not shown because too many files have changed in this diff. Show more