feat(short-drama-agent-front): 接入联合修订与图片费用审计
This commit is contained in:
1 parent
87427d9d43
commit
f6edc4eb70
52 files changed
+4878
-334
No files matched your search
@@ -1,5 +1,28 @@
|
|||||||
# 接口数据同步说明
|
# 接口数据同步说明
|
||||||
|
|
||||||
|
## 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 分阶段镜头生产
|
## 2026-11-15 V8-9.1 / V8-9.2 分阶段镜头生产
|
||||||
|
|
||||||
已在根目录 dev 增量接入正式 shotIds 定向摄影/画面状态、逐镜复用、派生批次停止、原 executionId 刷新恢复观察、独立摄影免费预检与版本绑定采用、原失败及零模型请求恢复展示,以及所选范围的参考素材/计划/资产缺口。默认 force=false、concurrency=1、maxRepairAttempts=0,不自动开始下一阶段或重发未知请求。
|
已在根目录 dev 增量接入正式 shotIds 定向摄影/画面状态、逐镜复用、派生批次停止、原 executionId 刷新恢复观察、独立摄影免费预检与版本绑定采用、原失败及零模型请求恢复展示,以及所选范围的参考素材/计划/资产缺口。默认 force=false、concurrency=1、maxRepairAttempts=0,不自动开始下一阶段或重发未知请求。
|
||||||
|
|||||||
@@ -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,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;没有切换或合并发布分支。
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -39,8 +39,9 @@ export function useDirectorySelection(
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
/** 按语义分组寻找所属标题,镜头多选包装层变化不影响吸顶避让。 */
|
||||||
const heading = stickyHeadingSelector
|
const heading = stickyHeadingSelector
|
||||||
? selected.parentElement?.parentElement?.querySelector<HTMLElement>(stickyHeadingSelector)
|
? selected.closest('[role="group"]')?.querySelector<HTMLElement>(stickyHeadingSelector)
|
||||||
: null
|
: null
|
||||||
viewport.scrollTo({
|
viewport.scrollTo({
|
||||||
top:
|
top:
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -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: '费用未知' }
|
||||||
@@ -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[]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import ImageBillingAuditPanel from './ImageBillingAuditPanel.vue'
|
||||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||||
import { NButton, NCheckbox, NDatePicker, NInput, NInputNumber, NSelect, NCollapse, NCollapseItem } from 'naive-ui'
|
import { NButton, NCheckbox, NDatePicker, NInput, NInputNumber, NSelect, NCollapse, NCollapseItem } from 'naive-ui'
|
||||||
import { useQuery } from '../../composables/useQuery'
|
import { useQuery } from '../../composables/useQuery'
|
||||||
@@ -31,7 +32,12 @@ const query = useQuery(key, (id, signal) => imageAuthorizationApi.list(id, signa
|
|||||||
/** 授权型号来自真实目录。 */
|
/** 授权型号来自真实目录。 */
|
||||||
const catalog = useQuery(key, (_, signal) => generationConfigApi.catalog(signal))
|
const catalog = useQuery(key, (_, signal) => generationConfigApi.catalog(signal))
|
||||||
/** 当前用户明确填写的授权草稿,金额、次数及时间均不预填。 */
|
/** 当前用户明确填写的授权草稿,金额、次数及时间均不预填。 */
|
||||||
const draft = ref({
|
/**
|
||||||
|
* 新项目和成功登记后都使用空草稿,不继承其它项目的批准。
|
||||||
|
* @returns 未填写金额、次数、范围与确认的表单
|
||||||
|
*/
|
||||||
|
function emptyAuthorizationDraft() {
|
||||||
|
return {
|
||||||
models: [] as string[],
|
models: [] as string[],
|
||||||
scopes: [] as ImageAuthorizationScope[],
|
scopes: [] as ImageAuthorizationScope[],
|
||||||
targets: '',
|
targets: '',
|
||||||
@@ -42,13 +48,28 @@ const draft = ref({
|
|||||||
approvedBy: '',
|
approvedBy: '',
|
||||||
note: '',
|
note: '',
|
||||||
accepted: false
|
accepted: false
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
/** 用户明确填写的持续授权草稿。 */
|
||||||
|
const draft = ref(emptyAuthorizationDraft())
|
||||||
|
/** 原设置抽屉内的费用审计模式,不叠加新主界面。 */
|
||||||
|
const auditRequestId = ref('')
|
||||||
|
/** 同一固定底栏提交当前图片审计。 */
|
||||||
|
const auditPanel = ref<InstanceType<typeof ImageBillingAuditPanel> | null>(null)
|
||||||
|
/** 用户主动选择追加的原unknown请求。 */
|
||||||
|
const additionalRequestId = ref('')
|
||||||
|
/** 追加次数和接受风险均不预填。 */
|
||||||
|
const additionalDraft = ref({ count: null as number | null, approvedBy: '', note: '', accepted: false })
|
||||||
|
/** 当前真实原请求,镜头、型号、来源及计划不能由表单改写。 */
|
||||||
|
const additionalRequest = computed(() => query.data.value?.requests.find(row => row.id === additionalRequestId.value))
|
||||||
/** 原批准撤销目标。 */
|
/** 原批准撤销目标。 */
|
||||||
const revokeId = ref('')
|
const revokeId = ref('')
|
||||||
/** 实际撤销操作者及理由。 */
|
/** 实际撤销操作者及理由。 */
|
||||||
const revocation = ref({ revokedBy: '', reason: '' })
|
const revocation = ref({ revokedBy: '', reason: '' })
|
||||||
/** 同步写入的就地加载。 */
|
/** 同步写入的就地加载。 */
|
||||||
const saving = ref(false)
|
const saving = ref(false)
|
||||||
|
/** 写入后刷新期间保持本次操作名称,不误显示其它授权动作。 */
|
||||||
|
const pendingSubmitLabel = ref('')
|
||||||
/** 同草稿失败后仍使用原幂等键,不能自动另开授权。 */
|
/** 同草稿失败后仍使用原幂等键,不能自动另开授权。 */
|
||||||
const idempotencyKey = ref(crypto.randomUUID())
|
const idempotencyKey = ref(crypto.randomUUID())
|
||||||
/** 只在主动提交时显示校验消息。 */
|
/** 只在主动提交时显示校验消息。 */
|
||||||
@@ -67,20 +88,31 @@ const modelOptions = computed(
|
|||||||
/** 所有范围名称与真实枚举共用。 */
|
/** 所有范围名称与真实枚举共用。 */
|
||||||
const scopeOptions = Object.entries(imageScopeLabels).map(([value, label]) => ({ label, value }))
|
const scopeOptions = Object.entries(imageScopeLabels).map(([value, label]) => ({ label, value }))
|
||||||
/** 撤销与创建各有独立提交名称。 */
|
/** 撤销与创建各有独立提交名称。 */
|
||||||
const submitLabel = computed(() => (revokeId.value ? '确认撤销授权' : '登记有限持续授权'))
|
const submitLabel = computed(
|
||||||
/** 读取失败时保守禁止写入,空表单允许主动校验。 */
|
|
||||||
const canSave = computed(
|
|
||||||
() =>
|
() =>
|
||||||
!props.disabled &&
|
pendingSubmitLabel.value ||
|
||||||
|
(auditRequestId.value
|
||||||
|
? (auditPanel.value?.submitLabel ?? '读取图片费用审计')
|
||||||
|
: revokeId.value
|
||||||
|
? '确认撤销授权'
|
||||||
|
: additionalRequestId.value
|
||||||
|
? '登记人工有限追加许可'
|
||||||
|
: '登记有限持续授权')
|
||||||
|
)
|
||||||
|
/** 读取失败时保守禁止写入,空表单允许主动校验。 */
|
||||||
|
const canSave = computed(() =>
|
||||||
|
auditRequestId.value
|
||||||
|
? !!auditPanel.value?.canSubmit
|
||||||
|
: !props.disabled &&
|
||||||
!saving.value &&
|
!saving.value &&
|
||||||
!!query.data.value &&
|
!!query.data.value &&
|
||||||
!query.loading.value &&
|
!query.loading.value &&
|
||||||
!query.error.value &&
|
!query.error.value &&
|
||||||
(revokeId.value !== '' || !!modelOptions.value.length)
|
(revokeId.value !== '' || additionalRequestId.value !== '' || !!modelOptions.value.length)
|
||||||
)
|
)
|
||||||
watch(saving, value => emit('busy', value), { flush: 'sync' })
|
watch(saving, value => emit('busy', value), { flush: 'sync' })
|
||||||
watch(
|
watch(
|
||||||
[draft, revocation],
|
[draft, revocation, additionalDraft],
|
||||||
() => {
|
() => {
|
||||||
validation.value = ''
|
validation.value = ''
|
||||||
},
|
},
|
||||||
@@ -90,12 +122,36 @@ watch(
|
|||||||
/** 校验后同步登记或撤销,不触发图片生成。 */
|
/** 校验后同步登记或撤销,不触发图片生成。 */
|
||||||
async function save() {
|
async function save() {
|
||||||
if (!canSave.value) return
|
if (!canSave.value) return
|
||||||
|
if (auditRequestId.value) {
|
||||||
|
await auditPanel.value?.submit()
|
||||||
|
return
|
||||||
|
}
|
||||||
const project = props.projectId
|
const project = props.projectId
|
||||||
if (revokeId.value) {
|
if (revokeId.value) {
|
||||||
if (!revocation.value.revokedBy.trim() || !revocation.value.reason.trim()) {
|
if (!revocation.value.revokedBy.trim() || !revocation.value.reason.trim()) {
|
||||||
validation.value = '请填写撤销操作者和原因。'
|
validation.value = '请填写撤销操作者和原因。'
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
} else if (additionalRequestId.value) {
|
||||||
|
const original = additionalRequest.value,
|
||||||
|
value = additionalDraft.value
|
||||||
|
if (
|
||||||
|
!original ||
|
||||||
|
original.status !== 'unknown' ||
|
||||||
|
original.input.scope !== 'keyframe' ||
|
||||||
|
original.input.provider !== 'openai-image' ||
|
||||||
|
original.output?.result ||
|
||||||
|
!Number.isInteger(value.count) ||
|
||||||
|
!value.count ||
|
||||||
|
value.count < 1 ||
|
||||||
|
value.count > 100 ||
|
||||||
|
!value.approvedBy.trim() ||
|
||||||
|
!value.note.trim() ||
|
||||||
|
!value.accepted
|
||||||
|
) {
|
||||||
|
validation.value = '请核对原未知首帧请求,填写1~100次、批准人和说明,并主动接受原费用未知风险。'
|
||||||
|
return
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const value = draft.value
|
const value = draft.value
|
||||||
const budget = usdToMicros(value.budget),
|
const budget = usdToMicros(value.budget),
|
||||||
@@ -121,6 +177,7 @@ async function save() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pendingSubmitLabel.value = submitLabel.value
|
||||||
saving.value = true
|
saving.value = true
|
||||||
try {
|
try {
|
||||||
if (revokeId.value) {
|
if (revokeId.value) {
|
||||||
@@ -132,6 +189,28 @@ async function save() {
|
|||||||
revokeId.value = ''
|
revokeId.value = ''
|
||||||
revocation.value = { revokedBy: '', reason: '' }
|
revocation.value = { revokedBy: '', reason: '' }
|
||||||
showActionFeedback(message, '已撤销未来领取,原请求和历史费用保留。', 'success')
|
showActionFeedback(message, '已撤销未来领取,原请求和历史费用保留。', 'success')
|
||||||
|
} else if (additionalRequestId.value) {
|
||||||
|
const value = additionalDraft.value
|
||||||
|
const result = await imageAuthorizationApi.create(project, {
|
||||||
|
mode: 'additional',
|
||||||
|
idempotencyKey: idempotencyKey.value,
|
||||||
|
parentRequestId: additionalRequestId.value,
|
||||||
|
maxRequests: value.count!,
|
||||||
|
acknowledgeUnknownPriorBilling: true,
|
||||||
|
approvedBy: value.approvedBy.trim(),
|
||||||
|
approvalNote: value.note.trim()
|
||||||
|
})
|
||||||
|
if (disposed || project !== props.projectId) return
|
||||||
|
idempotencyKey.value = crypto.randomUUID()
|
||||||
|
additionalRequestId.value = ''
|
||||||
|
additionalDraft.value = { count: null, approvedBy: '', note: '', accepted: false }
|
||||||
|
showActionFeedback(
|
||||||
|
message,
|
||||||
|
result.status === 'revoked'
|
||||||
|
? '原追加许可已撤销,不能重新领取。'
|
||||||
|
: '人工追加许可已登记,未发起任何生成;原未知费用保留。',
|
||||||
|
'info'
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
const value = draft.value
|
const value = draft.value
|
||||||
await imageAuthorizationApi.create(project, {
|
await imageAuthorizationApi.create(project, {
|
||||||
@@ -154,18 +233,7 @@ async function save() {
|
|||||||
})
|
})
|
||||||
if (disposed || project !== props.projectId) return
|
if (disposed || project !== props.projectId) return
|
||||||
idempotencyKey.value = crypto.randomUUID()
|
idempotencyKey.value = crypto.randomUUID()
|
||||||
draft.value = {
|
draft.value = emptyAuthorizationDraft()
|
||||||
models: [],
|
|
||||||
scopes: [],
|
|
||||||
targets: '',
|
|
||||||
budget: '',
|
|
||||||
reserve: '',
|
|
||||||
count: null,
|
|
||||||
expires: null,
|
|
||||||
approvedBy: '',
|
|
||||||
note: '',
|
|
||||||
accepted: false
|
|
||||||
}
|
|
||||||
showActionFeedback(message, '有限持续授权已登记。', 'success')
|
showActionFeedback(message, '有限持续授权已登记。', 'success')
|
||||||
}
|
}
|
||||||
revision.value++
|
revision.value++
|
||||||
@@ -176,8 +244,40 @@ async function save() {
|
|||||||
await query.refresh()
|
await query.refresh()
|
||||||
} finally {
|
} finally {
|
||||||
saving.value = false
|
saving.value = false
|
||||||
|
pendingSubmitLabel.value = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** 审计动作后只读刷新余额,不启动任何生成。 */
|
||||||
|
async function auditChanged() {
|
||||||
|
revision.value++
|
||||||
|
await query.refresh()
|
||||||
|
}
|
||||||
|
/** 当前表单编辑不会自动追加、核清或重新领取。 */
|
||||||
|
watch(
|
||||||
|
() => props.projectId,
|
||||||
|
() => {
|
||||||
|
draft.value = emptyAuthorizationDraft()
|
||||||
|
revocation.value = { revokedBy: '', reason: '' }
|
||||||
|
validation.value = ''
|
||||||
|
auditRequestId.value = ''
|
||||||
|
additionalRequestId.value = ''
|
||||||
|
revokeId.value = ''
|
||||||
|
idempotencyKey.value = crypto.randomUUID()
|
||||||
|
additionalDraft.value = { count: null, approvedBy: '', note: '', accepted: false }
|
||||||
|
},
|
||||||
|
{ flush: 'sync' }
|
||||||
|
)
|
||||||
|
/**
|
||||||
|
* 显式选择原unknown请求后展示独立追加表单。
|
||||||
|
* @param requestId 原应用费用请求
|
||||||
|
*/
|
||||||
|
function startAdditional(requestId: string) {
|
||||||
|
additionalRequestId.value = requestId
|
||||||
|
revokeId.value = ''
|
||||||
|
additionalDraft.value = { count: null, approvedBy: '', note: '', accepted: false }
|
||||||
|
idempotencyKey.value = crypto.randomUUID()
|
||||||
|
validation.value = ''
|
||||||
|
}
|
||||||
/** 公共固定底栏调用当前操作。 */
|
/** 公共固定底栏调用当前操作。 */
|
||||||
defineExpose({ save, canSave, submitLabel })
|
defineExpose({ save, canSave, submitLabel })
|
||||||
</script>
|
</script>
|
||||||
@@ -185,6 +285,17 @@ defineExpose({ save, canSave, submitLabel })
|
|||||||
<template>
|
<template>
|
||||||
<!-- 以下是授权余额、原请求与有限批准模块 -->
|
<!-- 以下是授权余额、原请求与有限批准模块 -->
|
||||||
<div class="workspace-section-stack">
|
<div class="workspace-section-stack">
|
||||||
|
<ImageBillingAuditPanel
|
||||||
|
v-if="auditRequestId"
|
||||||
|
ref="auditPanel"
|
||||||
|
:project-id="projectId"
|
||||||
|
:request-id="auditRequestId"
|
||||||
|
:disabled="disabled"
|
||||||
|
@busy="saving = $event"
|
||||||
|
@back="auditRequestId = ''"
|
||||||
|
@changed="auditChanged"
|
||||||
|
/>
|
||||||
|
<template v-else>
|
||||||
<WorkspaceSectionHeading
|
<WorkspaceSectionHeading
|
||||||
title="OpenAI 图片授权"
|
title="OpenAI 图片授权"
|
||||||
description="授权仅覆盖明确选择的图片范围。其他图片供应方需单独确认;视频、独立视觉审核、修复及主资产确认继续单独操作。"
|
description="授权仅覆盖明确选择的图片范围。其他图片供应方需单独确认;视频、独立视觉审核、修复及主资产确认继续单独操作。"
|
||||||
@@ -195,7 +306,8 @@ defineExpose({ save, canSave, submitLabel })
|
|||||||
<p v-if="query.loading.value && !query.data.value" role="status">正在读取授权…</p>
|
<p v-if="query.loading.value && !query.data.value" role="status">正在读取授权…</p>
|
||||||
<p v-if="query.error.value" role="alert" class="text-sm text-muted">{{ query.error.value }}</p>
|
<p v-if="query.error.value" role="alert" class="text-sm text-muted">{{ query.error.value }}</p>
|
||||||
<p v-if="query.data.value?.billingBlocked" class="surface-inset p-4 text-sm" role="status">
|
<p v-if="query.data.value?.billingBlocked" class="surface-inset p-4 text-sm" role="status">
|
||||||
原请求在途、缺少回执或用量,或用量价超过预留,已停止后续 OpenAI 收费。新增授权无法绕过,请核对下方原请求。
|
原请求在途、缺少回执或用量,或用量价超过预留,已停止后续 OpenAI
|
||||||
|
收费。原未知请求和预留会保留。普通授权不能绕过;同一精确计划的人工有限追加须单独批准。请核对下方原请求。
|
||||||
</p>
|
</p>
|
||||||
<p v-if="query.data.value && !query.data.value.authorizations.length" class="text-sm text-muted">
|
<p v-if="query.data.value && !query.data.value.authorizations.length" class="text-sm text-muted">
|
||||||
暂无图片授权。
|
暂无图片授权。
|
||||||
@@ -214,8 +326,8 @@ defineExpose({ save, canSave, submitLabel })
|
|||||||
{{ formatMicros(item.accountedMicros) }} · 剩余 {{ formatMicros(item.remainingMicros) }}
|
{{ formatMicros(item.accountedMicros) }} · 剩余 {{ formatMicros(item.remainingMicros) }}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm">
|
<p class="text-sm">
|
||||||
已请求 {{ item.usedRequests }} / {{ item.input.maxRequests }} 次 · 剩余 {{ item.remainingRequests }} 次
|
已请求 {{ item.usedRequests }} / {{ item.input.maxRequests }} 次 · 剩余
|
||||||
· 单次预留 {{ formatMicros(item.input.perRequestMicros) }}
|
{{ item.remainingRequests }} 次 · 单次预留 {{ formatMicros(item.input.perRequestMicros) }}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm">
|
<p class="text-sm">
|
||||||
{{ item.input.scopes.map(scope => imageScopeLabels[scope]).join('、') }} · 有效期至
|
{{ item.input.scopes.map(scope => imageScopeLabels[scope]).join('、') }} · 有效期至
|
||||||
@@ -259,10 +371,72 @@ defineExpose({ save, canSave, submitLabel })
|
|||||||
<p v-if="query.data.value.blockingRequestIds.includes(item.id)" class="text-sm">
|
<p v-if="query.data.value.blockingRequestIds.includes(item.id)" class="text-sm">
|
||||||
{{ imageRequestBlockReason(item) }} 完整同计划回执仍可免费复用。
|
{{ imageRequestBlockReason(item) }} 完整同计划回执仍可免费复用。
|
||||||
</p>
|
</p>
|
||||||
|
<p class="text-sm">原型号 {{ item.input.model }} · 原镜头 / 目标 {{ item.input.targetId }}</p>
|
||||||
|
<p v-if="item.billingAudit" class="text-sm">
|
||||||
|
费用审计:{{
|
||||||
|
item.billingAudit.released
|
||||||
|
? '已核清,原执行和预留保留'
|
||||||
|
: item.billingAudit.status === 'blocked'
|
||||||
|
? '保留阻断'
|
||||||
|
: '尚未独立复核'
|
||||||
|
}}
|
||||||
|
· 核实金额 {{ formatMicros(item.billingAudit.reviewedAmountMicros) }}
|
||||||
|
</p>
|
||||||
|
<div class="workspace-action-group">
|
||||||
|
<NButton
|
||||||
|
class="workspace-action-button"
|
||||||
|
:disabled="saving || disabled"
|
||||||
|
@click="auditRequestId = item.id"
|
||||||
|
>原请求费用审计</NButton
|
||||||
|
><NButton
|
||||||
|
v-if="
|
||||||
|
item.status === 'unknown' &&
|
||||||
|
item.input.scope === 'keyframe' &&
|
||||||
|
item.input.provider === 'openai-image' &&
|
||||||
|
!item.output?.result
|
||||||
|
"
|
||||||
|
class="workspace-action-button"
|
||||||
|
:disabled="saving || disabled"
|
||||||
|
@click="startAdditional(item.id)"
|
||||||
|
>人工有限追加</NButton
|
||||||
|
>
|
||||||
|
</div>
|
||||||
<RawDataDetails :value="item" title="原请求、来源及回执详情" />
|
<RawDataDetails :value="item" title="原请求、来源及回执详情" />
|
||||||
</article>
|
</article>
|
||||||
</NCollapseItem>
|
</NCollapseItem>
|
||||||
</NCollapse>
|
</NCollapse>
|
||||||
|
<!-- 以下是原精确计划的人工追加次数和撤销,原unknown仍保留。 -->
|
||||||
|
<section v-if="query.data.value?.additionalAuthorizations?.length" class="workspace-section-stack">
|
||||||
|
<WorkspaceSectionHeading
|
||||||
|
title="人工有限追加许可"
|
||||||
|
description="只适用原精确计划,不增加预算;一次成功后停止,不自动消费剩余次数。"
|
||||||
|
/>
|
||||||
|
<article
|
||||||
|
v-for="permit in query.data.value.additionalAuthorizations"
|
||||||
|
:key="permit.id"
|
||||||
|
class="surface-inset p-4 space-y-3 text-sm"
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
{{
|
||||||
|
permit.status === 'approved'
|
||||||
|
? '已批准'
|
||||||
|
: permit.status === 'revoked'
|
||||||
|
? '已撤销'
|
||||||
|
: '状态待核对'
|
||||||
|
}}
|
||||||
|
· 已用 {{ permit.usedRequests }} / {{ permit.input.maxRequests }} 次 · 剩余
|
||||||
|
{{ permit.remainingRequests }} 次
|
||||||
|
</p>
|
||||||
|
<p v-if="permit.status === 'revoked'">剩余次数不可领取。</p>
|
||||||
|
<p>原请求 {{ permit.input.parentRequestId }} · 批准人 {{ permit.input.approvedBy }}</p>
|
||||||
|
<RawDataDetails :value="permit" title="追加许可与原计划详情" /><NButton
|
||||||
|
v-if="permit.status === 'approved'"
|
||||||
|
:disabled="saving || disabled"
|
||||||
|
@click="revokeId = permit.id"
|
||||||
|
>撤销此追加许可</NButton
|
||||||
|
>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
<!-- 以下是独立撤销表单,底栏明确提交 -->
|
<!-- 以下是独立撤销表单,底栏明确提交 -->
|
||||||
<section v-if="revokeId" class="workspace-section-stack">
|
<section v-if="revokeId" class="workspace-section-stack">
|
||||||
<WorkspaceSectionHeading
|
<WorkspaceSectionHeading
|
||||||
@@ -280,6 +454,60 @@ defineExpose({ save, canSave, submitLabel })
|
|||||||
/></label>
|
/></label>
|
||||||
<NButton :disabled="saving" @click="revokeId = ''">返回创建授权</NButton>
|
<NButton :disabled="saving" @click="revokeId = ''">返回创建授权</NButton>
|
||||||
</section>
|
</section>
|
||||||
|
<section v-else-if="additionalRequestId && additionalRequest" class="workspace-section-stack">
|
||||||
|
<WorkspaceSectionHeading
|
||||||
|
title="原精确计划人工有限追加"
|
||||||
|
description="原请求的结果和费用仍未知。本许可只允许用户另行主动发起有限次数,不自动生成或核清旧费用。"
|
||||||
|
/>
|
||||||
|
<p class="text-sm">
|
||||||
|
原请求 {{ additionalRequest.id }} · 原型号 {{ additionalRequest.input.model }} · 原镜头
|
||||||
|
{{ additionalRequest.input.targetId }} · 原预留
|
||||||
|
{{ formatMicros(additionalRequest.input.reservedMicros) }} · 原实际账单
|
||||||
|
{{ formatMicros(additionalRequest.output?.actualBilledMicros) }}
|
||||||
|
</p>
|
||||||
|
<RawDataDetails
|
||||||
|
:value="{
|
||||||
|
原请求: additionalRequest.id,
|
||||||
|
原镜头: additionalRequest.input.targetId,
|
||||||
|
原计划: additionalRequest.input.planFingerprint,
|
||||||
|
原来源: additionalRequest.input.sourceFingerprint,
|
||||||
|
原批准: additionalRequest.input.authorizationId
|
||||||
|
}"
|
||||||
|
title="原精确范围详情(只读)"
|
||||||
|
/>
|
||||||
|
<label class="workspace-form-field"
|
||||||
|
><span>用户批准的追加次数(1~100)</span
|
||||||
|
><NInputNumber
|
||||||
|
v-model:value="additionalDraft.count"
|
||||||
|
:min="1"
|
||||||
|
:max="100"
|
||||||
|
:disabled="saving"
|
||||||
|
aria-label="人工追加次数"
|
||||||
|
/></label>
|
||||||
|
<label class="workspace-form-field"
|
||||||
|
><span>追加批准人</span
|
||||||
|
><NInput
|
||||||
|
v-model:value="additionalDraft.approvedBy"
|
||||||
|
:maxlength="200"
|
||||||
|
:disabled="saving"
|
||||||
|
aria-label="追加批准人"
|
||||||
|
/></label>
|
||||||
|
<label class="workspace-form-field"
|
||||||
|
><span>追加批准说明</span
|
||||||
|
><NInput
|
||||||
|
v-model:value="additionalDraft.note"
|
||||||
|
type="textarea"
|
||||||
|
:maxlength="2000"
|
||||||
|
:disabled="saving"
|
||||||
|
aria-label="追加批准说明"
|
||||||
|
/></label>
|
||||||
|
<NCheckbox v-model:checked="additionalDraft.accepted" :disabled="saving"
|
||||||
|
>我接受原请求及其费用仍未知,明确批准上述有限次数;新旧请求共用原预算,范围、型号、来源或计划变化时不能使用。</NCheckbox
|
||||||
|
>
|
||||||
|
<NButton class="self-start" :disabled="saving" @click="additionalRequestId = ''"
|
||||||
|
>取消追加许可登记</NButton
|
||||||
|
>
|
||||||
|
</section>
|
||||||
<!-- 以下是用户明确填写的有限持续授权,不预填金额、次数及日期 -->
|
<!-- 以下是用户明确填写的有限持续授权,不预填金额、次数及日期 -->
|
||||||
<section v-else class="workspace-section-stack">
|
<section v-else class="workspace-section-stack">
|
||||||
<WorkspaceSectionHeading
|
<WorkspaceSectionHeading
|
||||||
@@ -319,7 +547,12 @@ defineExpose({ save, canSave, submitLabel })
|
|||||||
/></label>
|
/></label>
|
||||||
<label class="workspace-form-field"
|
<label class="workspace-form-field"
|
||||||
><span>累计请求次数</span
|
><span>累计请求次数</span
|
||||||
><NInputNumber v-model:value="draft.count" :min="1" :max="10000" :precision="0" :disabled="saving"
|
><NInputNumber
|
||||||
|
v-model:value="draft.count"
|
||||||
|
:min="1"
|
||||||
|
:max="10000"
|
||||||
|
:precision="0"
|
||||||
|
:disabled="saving"
|
||||||
/></label>
|
/></label>
|
||||||
<label class="workspace-form-field"
|
<label class="workspace-form-field"
|
||||||
><span>到期时间</span
|
><span>到期时间</span
|
||||||
@@ -346,5 +579,6 @@ defineExpose({ save, canSave, submitLabel })
|
|||||||
>
|
>
|
||||||
</section>
|
</section>
|
||||||
<p v-if="validation" role="alert" class="text-sm">{{ validation }}</p>
|
<p v-if="validation" role="alert" class="text-sm">{{ validation }}</p>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -0,0 +1,207 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, watch } from 'vue'
|
||||||
|
import { NButton, NCheckbox, NCollapse, NCollapseItem, NInput, NSelect } from 'naive-ui'
|
||||||
|
import WorkspaceSectionHeading from '../../components/ui/WorkspaceSectionHeading.vue'
|
||||||
|
import RawDataDetails from '../../components/ui/RawDataDetails.vue'
|
||||||
|
import BillingEvidenceFields from '../billing-audit/BillingEvidenceFields.vue'
|
||||||
|
import { useImageBillingAudit } from './useImageBillingAudit'
|
||||||
|
import { formatMicros, imageScopeLabels } from './model'
|
||||||
|
import { userFacingText } from '../../lib/user-facing-text'
|
||||||
|
/** 原图片授权抽屉内的审计模式,底栏由同一抽屉提供。 */
|
||||||
|
const props = defineProps<{
|
||||||
|
/** 原项目。 */ projectId: string
|
||||||
|
/** 原应用费用请求。 */ requestId: string
|
||||||
|
/** 正式活动锁。 */ disabled: boolean
|
||||||
|
}>()
|
||||||
|
/** 审计后刷新原授权余额和请求;返回时不产生写入。 */
|
||||||
|
const emit = defineEmits<{ changed: []; back: []; busy: [value: boolean] }>()
|
||||||
|
/** 图片域复用同步查询和独立复核。 */
|
||||||
|
const form = useImageBillingAudit(props, () => emit('changed'))
|
||||||
|
/** 原请求与审计结论分别展示。 */
|
||||||
|
const view = computed(() => form.query.data.value)
|
||||||
|
/** 仅当前版本的真实材料可以参与复核。 */
|
||||||
|
const evidenceOptions = computed(() =>
|
||||||
|
form.currentEvidence.value.map((row, index) => ({
|
||||||
|
label: `材料 ${index + 1} · ${row.body.operator}`,
|
||||||
|
value: row.id
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
watch(form.saving, value => emit('busy', value), { flush: 'sync' })
|
||||||
|
/** 原设置固定底栏调用当前审计操作。 */
|
||||||
|
defineExpose({ canSubmit: form.canSubmit, saving: form.saving, submit: form.submit, submitLabel: form.submitLabel })
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<!-- 以下是原请求身份、原预留和独立审计结论。 -->
|
||||||
|
<div class="workspace-section-stack">
|
||||||
|
<WorkspaceSectionHeading
|
||||||
|
title="图片原请求费用审计"
|
||||||
|
description="登记原件后仍需独立复核。核清费用不代表生图成功、质量通过或可以设为主图。"
|
||||||
|
/>
|
||||||
|
<div class="flex flex-wrap gap-3">
|
||||||
|
<NButton :disabled="form.saving.value" @click="emit('back')">返回授权与原请求</NButton
|
||||||
|
><NButton :disabled="form.saving.value" :loading="form.query.loading.value" @click="form.refresh"
|
||||||
|
>刷新原请求与审计</NButton
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<p v-if="form.query.loading.value" role="status">正在读取原图片请求费用…</p>
|
||||||
|
<p v-if="form.query.error.value" role="alert">{{ form.query.error.value }}</p>
|
||||||
|
<template v-if="view">
|
||||||
|
<section class="surface-inset p-4 workspace-section-stack text-sm min-w-0">
|
||||||
|
<h4 class="font-medium">{{ view.billingBlocked ? '本原请求费用仍阻断' : '本原请求当前无费用阻断' }}</h4>
|
||||||
|
<p>
|
||||||
|
原执行:{{
|
||||||
|
view.originalRequestStatus === 'unknown'
|
||||||
|
? '结果或费用未知'
|
||||||
|
: view.originalRequestStatus === 'completed'
|
||||||
|
? '原图片回执完整,质量另行审核'
|
||||||
|
: '原执行尚待核对'
|
||||||
|
}}
|
||||||
|
· 费用审计:{{
|
||||||
|
view.status === 'released' ? '已核清' : view.status === 'blocked' ? '保留阻断' : '等待人工复核'
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{{ imageScopeLabels[view.identity.scope] }} · {{ view.identity.provider }} /
|
||||||
|
{{ view.identity.model }}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
原预留 {{ formatMicros(view.reservedMicros) }} · 原公开用量价
|
||||||
|
{{ formatMicros(view.originalUsageCostMicros) }} · 原实际账单
|
||||||
|
{{ formatMicros(view.originalActualBilledMicros) }}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
审计核实金额
|
||||||
|
{{ formatMicros(view.reviewedAmountMicros) }}。此值不覆盖原账单,原预留和已用次数不退回。
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
原供应方请求号:{{ view.originalProviderRequestId ?? '未取得真实供应方编号' }} ·
|
||||||
|
{{ view.hasOriginalReceipt ? '存在原成功回执' : '尚无原成功回执' }}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
原始费用阻断:{{ view.originalBillingBlocked ? '有' : '无' }} · 当前有效费用阻断:{{
|
||||||
|
view.billingBlocked ? '有' : '无'
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
<RawDataDetails
|
||||||
|
:value="{
|
||||||
|
identity: view.identity,
|
||||||
|
taskFingerprint: view.taskFingerprint,
|
||||||
|
evidenceSetFingerprint: view.evidenceSetFingerprint,
|
||||||
|
reviewFingerprint: view.reviewFingerprint
|
||||||
|
}"
|
||||||
|
title="原请求、镜头、计划及版本详情"
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
<div class="workspace-form-field">
|
||||||
|
<span>本次独立操作</span
|
||||||
|
><NSelect
|
||||||
|
v-model:value="form.action.value"
|
||||||
|
:disabled="form.saving.value"
|
||||||
|
aria-label="图片费用本次操作"
|
||||||
|
:options="[
|
||||||
|
{ label: '登记外部证据', value: 'evidence' },
|
||||||
|
{ label: '独立人工复核', value: 'review' }
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<!-- 以下是共享媒体证据编辑,图片身份由原GET原样绑定。 -->
|
||||||
|
<BillingEvidenceFields
|
||||||
|
v-if="form.action.value === 'evidence'"
|
||||||
|
v-model="form.facts.value"
|
||||||
|
v-model:operator="form.operator.value"
|
||||||
|
:disabled="form.saving.value"
|
||||||
|
/>
|
||||||
|
<section v-else class="workspace-section-stack">
|
||||||
|
<div class="workspace-form-field">
|
||||||
|
<span>已登记的当前版本材料</span
|
||||||
|
><NSelect
|
||||||
|
v-model:value="form.evidenceId.value"
|
||||||
|
:options="evidenceOptions"
|
||||||
|
:disabled="form.saving.value"
|
||||||
|
placeholder="主动选择已核对的证据包"
|
||||||
|
aria-label="图片费用复核材料"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<RawDataDetails
|
||||||
|
v-if="form.selectedEvidence.value"
|
||||||
|
:value="form.selectedEvidence.value"
|
||||||
|
title="待复核原件完整内容"
|
||||||
|
/>
|
||||||
|
<div class="workspace-form-field">
|
||||||
|
<span>复核决定</span
|
||||||
|
><NSelect
|
||||||
|
v-model:value="form.decision.value"
|
||||||
|
:disabled="form.saving.value"
|
||||||
|
aria-label="图片费用复核决定"
|
||||||
|
:options="[
|
||||||
|
{ label: '保留费用阻断', value: 'keep_blocked' },
|
||||||
|
{ label: '核清费用,仅影响未来收费门禁', value: 'release_future_charges' }
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<ul
|
||||||
|
v-if="form.decision.value === 'release_future_charges' && form.releaseIssues.value.length"
|
||||||
|
class="space-y-2 text-sm"
|
||||||
|
>
|
||||||
|
<li v-for="issue in form.releaseIssues.value" :key="issue">{{ issue }}</li>
|
||||||
|
</ul>
|
||||||
|
<label class="workspace-form-field"
|
||||||
|
><span>独立复核人</span
|
||||||
|
><NInput
|
||||||
|
v-model:value="form.reviewer.value"
|
||||||
|
:maxlength="120"
|
||||||
|
:disabled="form.saving.value"
|
||||||
|
aria-label="图片费用复核人"
|
||||||
|
/></label>
|
||||||
|
<label class="workspace-form-field"
|
||||||
|
><span>复核理由</span
|
||||||
|
><NInput
|
||||||
|
v-model:value="form.reason.value"
|
||||||
|
type="textarea"
|
||||||
|
:maxlength="2000"
|
||||||
|
:disabled="form.saving.value"
|
||||||
|
aria-label="图片费用复核理由"
|
||||||
|
/></label>
|
||||||
|
<label class="workspace-form-field"
|
||||||
|
><span>已核对材料的 SHA256</span
|
||||||
|
><NInput
|
||||||
|
v-model:value="form.confirmationSha256.value"
|
||||||
|
:maxlength="64"
|
||||||
|
:disabled="form.saving.value"
|
||||||
|
aria-label="图片费用确认材料 SHA256"
|
||||||
|
/></label>
|
||||||
|
<p class="text-sm text-muted">
|
||||||
|
请实际核验原件的账户、项目与Key标识、UTC范围、型号和唯一请求归属;不要填写秘密Key。费用核清不会重发原未知计划。
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
<NCheckbox v-model:checked="form.confirmed.value" :disabled="form.saving.value"
|
||||||
|
>我已核对当前原请求、完整材料及本次操作;登记不解锁,复核不批准生成、质量或主图。</NCheckbox
|
||||||
|
>
|
||||||
|
<p v-if="form.validation.value" role="alert" class="text-sm">{{ form.validation.value }}</p>
|
||||||
|
<!-- 以下是原始证据和单调复核历史,未完成材料不显示为新增阻断。 -->
|
||||||
|
<NCollapse
|
||||||
|
><NCollapseItem name="history" title="证据与独立复核历史"
|
||||||
|
><p v-if="!view.history.evidence.length && !view.history.reviews.length" class="text-sm">
|
||||||
|
暂无审计历史。正常已结算请求的未复核状态不新增费用阻断。
|
||||||
|
</p>
|
||||||
|
<RawDataDetails
|
||||||
|
v-for="record in view.history.evidence"
|
||||||
|
:key="record.id"
|
||||||
|
:value="record"
|
||||||
|
:title="`原件登记 · ${record.body.operator}`" /><RawDataDetails
|
||||||
|
v-for="record in [...view.history.reviews].sort(
|
||||||
|
(a, b) => (a.revision ?? 0) - (b.revision ?? 0)
|
||||||
|
)"
|
||||||
|
:key="record.id"
|
||||||
|
:value="record"
|
||||||
|
:title="`第 ${record.revision ?? '待确认'} 次复核 · ${record.body.reviewer}`"
|
||||||
|
/></NCollapseItem>
|
||||||
|
<NCollapseItem v-if="view.releaseIssues.length" name="issues" title="正式费用核查详情"
|
||||||
|
><p v-for="issue in view.releaseIssues" :key="issue" class="text-sm">
|
||||||
|
{{ userFacingText(issue) }}
|
||||||
|
</p></NCollapseItem
|
||||||
|
></NCollapse
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { request } from '../../lib/http'
|
import { request } from '../../lib/http'
|
||||||
import type {
|
import type {
|
||||||
|
ImageAdditionalAuthorizationInput,
|
||||||
ImageAuthorizationInput,
|
ImageAuthorizationInput,
|
||||||
ImageAuthorizationList,
|
ImageAuthorizationList,
|
||||||
ImageAuthorizationPreview,
|
ImageAuthorizationPreview,
|
||||||
@@ -39,7 +40,7 @@ export const imageAuthorizationApi = {
|
|||||||
* @param input 本次不可变批准
|
* @param input 本次不可变批准
|
||||||
* @returns 原授权标识及状态
|
* @returns 原授权标识及状态
|
||||||
*/
|
*/
|
||||||
create: (projectId: string, input: ImageAuthorizationInput) =>
|
create: (projectId: string, input: ImageAuthorizationInput | ImageAdditionalAuthorizationInput) =>
|
||||||
request<{ authorizationId: string; status: string }>(root(projectId), { method: 'POST', body: input }),
|
request<{ authorizationId: string; status: string }>(root(projectId), { method: 'POST', body: input }),
|
||||||
/**
|
/**
|
||||||
* 撤销未来领取并保留原件。
|
* 撤销未来领取并保留原件。
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import { request } from '../../lib/http'
|
||||||
|
import type { ImageBillingAuditView, ImageBillingEvidenceInput, ImageBillingReviewInput } from './billing-audit.types'
|
||||||
|
/**
|
||||||
|
* 精确绑定原项目和原应用请求,不复用视频任务路径。
|
||||||
|
* @param projectId 原项目
|
||||||
|
* @param requestId 原应用费用请求
|
||||||
|
* @returns 正式图片费用审计路径
|
||||||
|
*/
|
||||||
|
function path(projectId: string, requestId: string) {
|
||||||
|
return `/projects/${encodeURIComponent(projectId)}/image-requests/${encodeURIComponent(requestId)}/audit`
|
||||||
|
}
|
||||||
|
/** 同步、免费图片费用审计;任何动作都不启动生产。 */
|
||||||
|
export const imageBillingAuditApi = {
|
||||||
|
/**
|
||||||
|
* 读取原身份和并发版本。
|
||||||
|
* @param projectId 原项目
|
||||||
|
* @param requestId 原应用费用请求
|
||||||
|
* @param signal 取消旧范围读取
|
||||||
|
* @returns 原请求审计视图
|
||||||
|
*/
|
||||||
|
get: (projectId: string, requestId: string, signal?: AbortSignal) =>
|
||||||
|
request<ImageBillingAuditView>(path(projectId, requestId), { signal }),
|
||||||
|
/**
|
||||||
|
* 幂等登记外部原件,不解除阻断。
|
||||||
|
* @param projectId 原项目
|
||||||
|
* @param requestId 原应用费用请求
|
||||||
|
* @param body 正式身份及登记人
|
||||||
|
* @returns 新审计视图和登记回执
|
||||||
|
*/
|
||||||
|
evidence: (projectId: string, requestId: string, body: ImageBillingEvidenceInput) =>
|
||||||
|
request<ImageBillingAuditView & { evidenceId: string; reused: boolean }>(
|
||||||
|
path(projectId, requestId) + '/evidence',
|
||||||
|
{ method: 'POST', body }
|
||||||
|
),
|
||||||
|
/**
|
||||||
|
* 独立复核当前完整证据版本,不改变原执行、质量或主图。
|
||||||
|
* @param projectId 原项目
|
||||||
|
* @param requestId 原应用费用请求
|
||||||
|
* @param body 用户明确核对的复核材料
|
||||||
|
* @returns 当前正式审计和幂等回执
|
||||||
|
*/
|
||||||
|
review: (projectId: string, requestId: string, body: ImageBillingReviewInput) =>
|
||||||
|
request<ImageBillingAuditView & { reused: boolean }>(path(projectId, requestId) + '/reviews', {
|
||||||
|
method: 'POST',
|
||||||
|
body
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
import { billingEvidenceIssues } from '../billing-audit/evidence'
|
||||||
|
import type { BillingFacts } from '../billing-audit/types'
|
||||||
|
import type { ImageBillingAuditView, ImageBillingEvidenceInput } from './billing-audit.types'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 核对USD金额是否可精确表示为整数微美元,零金额必须显式填写。
|
||||||
|
* @param amount 原金额或未知
|
||||||
|
* @returns 精确整数微美元或null
|
||||||
|
*/
|
||||||
|
export function imageBillingAmountMicros(amount: number | null): number | null {
|
||||||
|
if (amount === null || !Number.isFinite(amount) || amount < 0 || !/^\d+(\.\d{1,6})?$/.test(String(amount)))
|
||||||
|
return null
|
||||||
|
const [whole = '0', fraction = ''] = String(amount).split('.')
|
||||||
|
const micros = Number(whole) * 1_000_000 + Number(fraction.padEnd(6, '0'))
|
||||||
|
return Number.isSafeInteger(micros) ? micros : null
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 校验图片证据格式和本地身份,不把未知材料当成核实结论。
|
||||||
|
* @param facts 用户填写的事实
|
||||||
|
* @param view 原正式审计身份
|
||||||
|
* @returns 可操作校验原因
|
||||||
|
*/
|
||||||
|
export function imageBillingEvidenceIssues(facts: BillingFacts, view: ImageBillingAuditView): string[] {
|
||||||
|
const identity = view.identity
|
||||||
|
const issues = billingEvidenceIssues(facts, [
|
||||||
|
identity.requestId,
|
||||||
|
identity.candidateId,
|
||||||
|
identity.authorizationId,
|
||||||
|
identity.targetId,
|
||||||
|
identity.projectId
|
||||||
|
])
|
||||||
|
if (
|
||||||
|
facts.billing.currency !== 'USD' ||
|
||||||
|
(facts.billing.amount !== null && imageBillingAmountMicros(facts.billing.amount) === null)
|
||||||
|
)
|
||||||
|
issues.push('图片账单金额需为可精确表示的USD非负数,最多6位小数;未知请留空。')
|
||||||
|
return issues
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 核清前检查材料是否具备正式条件,最终真实性、唯一认领仍由人工和服务端核验。
|
||||||
|
* @param evidence 用户明确选中的已登记证据
|
||||||
|
* @param view 原图片费用审计
|
||||||
|
* @returns 不能核清的原因
|
||||||
|
*/
|
||||||
|
export function imageBillingReleaseIssues(
|
||||||
|
evidence: ImageBillingEvidenceInput['evidence'] | undefined,
|
||||||
|
view: ImageBillingAuditView
|
||||||
|
): string[] {
|
||||||
|
if (!evidence) return ['请先选择已登记的证据包。']
|
||||||
|
const issues = imageBillingEvidenceIssues(evidence, view)
|
||||||
|
if (
|
||||||
|
Object.entries(view.identity).some(
|
||||||
|
([key, value]) => evidence.identity[key as keyof typeof evidence.identity] !== value
|
||||||
|
)
|
||||||
|
)
|
||||||
|
issues.push('证据身份与原请求不一致。')
|
||||||
|
if (!['unknown', 'completed'].includes(view.originalRequestStatus)) issues.push('原请求尚未形成可复核的结束状态。')
|
||||||
|
if (
|
||||||
|
evidence.correlation !== 'unique' ||
|
||||||
|
evidence.execution.outcome === 'unknown' ||
|
||||||
|
evidence.billing.finding === 'unknown' ||
|
||||||
|
evidence.billing.amount === null
|
||||||
|
)
|
||||||
|
issues.push('唯一关联、执行终态或实际费用仍未确认。')
|
||||||
|
const execution = evidence.artifacts.filter(item => evidence.execution.evidenceIds.includes(item.id)),
|
||||||
|
billing = evidence.artifacts.filter(item => evidence.billing.evidenceIds.includes(item.id))
|
||||||
|
if (
|
||||||
|
!execution.some(item => ['provider-execution', 'provider-support'].includes(item.kind)) ||
|
||||||
|
!billing.some(item => ['provider-billing', 'provider-support'].includes(item.kind))
|
||||||
|
)
|
||||||
|
issues.push('执行与费用分别需要供应方原件,观测记录不能替代。')
|
||||||
|
if (evidence.billing.finding === 'no-charge' && evidence.billing.amount !== 0)
|
||||||
|
issues.push('未收费必须有明确零金额依据。')
|
||||||
|
if (evidence.execution.outcome === 'not-received') {
|
||||||
|
if (
|
||||||
|
evidence.billing.finding !== 'no-charge' ||
|
||||||
|
evidence.billing.amount !== 0 ||
|
||||||
|
!execution.some(item => item.kind === 'provider-support')
|
||||||
|
)
|
||||||
|
issues.push('未接收需要官方支持原件及未收费说明。')
|
||||||
|
} else if (!evidence.providerRequestId) issues.push('缺少真实供应方请求号。')
|
||||||
|
if (view.hasOriginalReceipt && evidence.execution.outcome !== 'succeeded') issues.push('外部声明与原成功回执冲突。')
|
||||||
|
if (view.originalProviderRequestId && view.originalProviderRequestId !== evidence.providerRequestId)
|
||||||
|
issues.push('供应方编号与原回执不一致。')
|
||||||
|
return issues
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import type { BillingFacts } from '../billing-audit/types'
|
||||||
|
import type { ImageAuthorizationScope } from './types'
|
||||||
|
|
||||||
|
/** 原图片费用请求身份,完整复制GET,不由当前新资产推导。 */
|
||||||
|
export interface ImageBillingIdentity {
|
||||||
|
/** 原项目。 */ projectId: string
|
||||||
|
/** 原应用费用请求。 */ requestId: string
|
||||||
|
/** 原批准。 */ authorizationId: string
|
||||||
|
/** 原业务范围。 */ scope: ImageAuthorizationScope
|
||||||
|
/** 原主体、形态、镜头或布局。 */ targetId: string
|
||||||
|
/** 原候选。 */ candidateId: string
|
||||||
|
/** 原来源版本。 */ sourceFingerprint: string
|
||||||
|
/** 原精确费用计划。 */ planFingerprint: string
|
||||||
|
/** 原完整请求版本。 */ requestFingerprint: string
|
||||||
|
/** 固定供应方。 */ provider: 'openai-image'
|
||||||
|
/** 原型号。 */ model: string
|
||||||
|
}
|
||||||
|
/** 只登记外部事实,不修改原unknown和账单字段。 */
|
||||||
|
export interface ImageBillingEvidenceInput {
|
||||||
|
/** 原请求及原授权完整版本。 */ expectedTaskFingerprint: string
|
||||||
|
/** 实际登记人。 */ operator: string
|
||||||
|
/** 身份及待人工核验的材料。 */ evidence: BillingFacts & { /** 原完整身份。 */ identity: ImageBillingIdentity }
|
||||||
|
}
|
||||||
|
/** 图片费用的独立人工复核,不改写像素、质量或主图。 */
|
||||||
|
export interface ImageBillingReviewInput {
|
||||||
|
/** 用户选中的正式证据包。 */ evidenceId: string
|
||||||
|
/** 原请求版本。 */ expectedTaskFingerprint: string
|
||||||
|
/** 完整证据集合。 */ expectedEvidenceSetFingerprint: string
|
||||||
|
/** 上一次复核版本。 */ expectedReviewFingerprint: string
|
||||||
|
/** 用户明确选择的决定。 */ decision: 'keep_blocked' | 'release_future_charges'
|
||||||
|
/** 实际复核人。 */ reviewer: string
|
||||||
|
/** 复核原因。 */ reason: string
|
||||||
|
/** 用户核对材料的真实摘要。 */ confirmationSha256: string
|
||||||
|
}
|
||||||
|
/** 不可变审计事件,复核先后以revision为准。 */
|
||||||
|
export interface ImageBillingEvent<T> {
|
||||||
|
/** 正式事件身份。 */ id: string
|
||||||
|
/** 原请求身份。 */ requestId: string
|
||||||
|
/** 原请求版本。 */ taskFingerprint: string
|
||||||
|
/** 原事件正文。 */ body: T
|
||||||
|
/** 稳定事件摘要。 */ digest: string
|
||||||
|
/** 服务端可能提供的记录时间。 */ createdAt?: string
|
||||||
|
/** 复核单调序号。 */ revision?: number
|
||||||
|
}
|
||||||
|
/** 图片原请求的权威审计视图。 */
|
||||||
|
export interface ImageBillingAuditView {
|
||||||
|
/** 原项目。 */ projectId: string
|
||||||
|
/** 原应用费用请求。 */ requestId: string
|
||||||
|
/** 完整原身份。 */ identity: ImageBillingIdentity
|
||||||
|
/** 原请求和授权完整版本。 */ taskFingerprint: string
|
||||||
|
/** 当前证据集合版本。 */ evidenceSetFingerprint: string
|
||||||
|
/** 当前复核版本。 */ reviewFingerprint: string
|
||||||
|
/** 原请求执行状态。 */ originalRequestStatus: string
|
||||||
|
/** 原预留,核清不退回。 */ reservedMicros: number
|
||||||
|
/** 原用量价,未知为null。 */ originalUsageCostMicros: number | null
|
||||||
|
/** 原实际账单,未知为null。 */ originalActualBilledMicros: number | null
|
||||||
|
/** 真实供应方编号,缺失不能补造。 */ originalProviderRequestId: string | null
|
||||||
|
/** 原成功回执是否存在。 */ hasOriginalReceipt: boolean
|
||||||
|
/** 原请求的原始阻断。 */ originalBillingBlocked: boolean
|
||||||
|
/** 有效复核之后的当前阻断。 */ billingBlocked: boolean
|
||||||
|
/** 当前有效解除。 */ released: boolean
|
||||||
|
/** 当前审计结论,不是执行结论。 */ status: 'unreviewed' | 'blocked' | 'released'
|
||||||
|
/** 有效解除的复核。 */ reviewId: string | null
|
||||||
|
/** 审计核实金额,不覆盖原账单。 */ reviewedAmountMicros: number | null
|
||||||
|
/** 当前不能解除的正式原因。 */ releaseIssues: string[]
|
||||||
|
/** 完整不可变历史。 */ history: {
|
||||||
|
/** 全部登记原件。 */ evidence: ImageBillingEvent<ImageBillingEvidenceInput>[]
|
||||||
|
/** 全部独立复核。 */ reviews: ImageBillingEvent<ImageBillingReviewInput>[]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,6 +40,7 @@ export function formatMicros(value: number | null | undefined): string {
|
|||||||
* @param targetId 实际目标
|
* @param targetId 实际目标
|
||||||
* @param model 实际预览型号
|
* @param model 实际预览型号
|
||||||
* @param planFingerprint 免费计划返回的指纹,仅普通计划可提供
|
* @param planFingerprint 免费计划返回的指纹,仅普通计划可提供
|
||||||
|
* @param additional 用户主动选择且需要核对精确来源的有限许可
|
||||||
* @returns 可复用、已授权或阻断说明
|
* @returns 可复用、已授权或阻断说明
|
||||||
*/
|
*/
|
||||||
export function imageChargeEligibility(
|
export function imageChargeEligibility(
|
||||||
@@ -47,7 +48,12 @@ export function imageChargeEligibility(
|
|||||||
scope: ImageAuthorizationScope,
|
scope: ImageAuthorizationScope,
|
||||||
targetId: string,
|
targetId: string,
|
||||||
model: string,
|
model: string,
|
||||||
planFingerprint?: string
|
planFingerprint?: string,
|
||||||
|
additional?: {
|
||||||
|
/** 用户明确选中的许可。 */ id: string
|
||||||
|
/** 当前正式来源。 */ sourceFingerprint: string
|
||||||
|
/** 当前原项目。 */ projectId: string
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
const reusable = list.requests.find(
|
const reusable = list.requests.find(
|
||||||
row =>
|
row =>
|
||||||
@@ -65,6 +71,35 @@ export function imageChargeEligibility(
|
|||||||
reusable: true,
|
reusable: true,
|
||||||
message: '同计划完整回执可免费复用,不新增请求次数;图片质量仍按原审核结果。'
|
message: '同计划完整回执可免费复用,不新增请求次数;图片质量仍按原审核结果。'
|
||||||
}
|
}
|
||||||
|
if (additional)
|
||||||
|
return scope === 'keyframe' && planFingerprint
|
||||||
|
? additionalImageEligibility(
|
||||||
|
list,
|
||||||
|
additional.id,
|
||||||
|
additional.projectId,
|
||||||
|
targetId,
|
||||||
|
model,
|
||||||
|
additional.sourceFingerprint,
|
||||||
|
planFingerprint
|
||||||
|
)
|
||||||
|
: { allowed: false, reusable: false, message: '追加许可只适用于已重新核对的原精确首帧计划。' }
|
||||||
|
if (
|
||||||
|
planFingerprint &&
|
||||||
|
list.requests.some(
|
||||||
|
row =>
|
||||||
|
row.status === 'unknown' &&
|
||||||
|
row.input.scope === scope &&
|
||||||
|
row.input.targetId === targetId &&
|
||||||
|
row.input.model === model &&
|
||||||
|
row.input.planFingerprint === planFingerprint &&
|
||||||
|
!row.output?.result
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
allowed: false,
|
||||||
|
reusable: false,
|
||||||
|
message: '原精确计划仍有结果或费用未知的请求。即使费用已核清,也不能普通重发;需主动核对人工有限追加许可。'
|
||||||
|
}
|
||||||
if (list.billingBlocked)
|
if (list.billingBlocked)
|
||||||
return {
|
return {
|
||||||
allowed: false,
|
allowed: false,
|
||||||
@@ -116,3 +151,76 @@ export function imageRequestBlockReason(request: ImageChargeRequest): string {
|
|||||||
if (usageCost > request.input.reservedMicros) return '公开用量价超过单次预留,后续收费暂停。'
|
if (usageCost > request.input.reservedMicros) return '公开用量价超过单次预留,后续收费暂停。'
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅提示原精确首帧计划的追加准入,最终费用领取仍由服务端事务核对。
|
||||||
|
* @param list 原项目正式费用投影
|
||||||
|
* @param permitId 用户主动选中的许可
|
||||||
|
* @param projectId 当前原项目
|
||||||
|
* @param targetId 当前镜头
|
||||||
|
* @param model 当前预览型号
|
||||||
|
* @param sourceFingerprint 当前正式来源
|
||||||
|
* @param planFingerprint 当前精确费用计划
|
||||||
|
* @returns 当前是否满足追加条件及原因
|
||||||
|
*/
|
||||||
|
export function additionalImageEligibility(
|
||||||
|
list: ImageAuthorizationList,
|
||||||
|
permitId: string,
|
||||||
|
projectId: string,
|
||||||
|
targetId: string,
|
||||||
|
model: string,
|
||||||
|
sourceFingerprint: string,
|
||||||
|
planFingerprint: string
|
||||||
|
) {
|
||||||
|
const permit = list.additionalAuthorizations?.find(row => row.id === permitId)
|
||||||
|
const parent = list.requests.find(row => row.id === permit?.input.parentRequestId)
|
||||||
|
const grant = list.authorizations.find(row => row.id === parent?.input.authorizationId)
|
||||||
|
if (
|
||||||
|
!permit ||
|
||||||
|
permit.status !== 'approved' ||
|
||||||
|
!Number.isSafeInteger(permit.remainingRequests) ||
|
||||||
|
permit.remainingRequests < 1 ||
|
||||||
|
!Number.isSafeInteger(permit.usedRequests) ||
|
||||||
|
permit.usedRequests < 0 ||
|
||||||
|
!parent ||
|
||||||
|
parent.status !== 'unknown' ||
|
||||||
|
parent.output?.result ||
|
||||||
|
parent.input.projectId !== projectId ||
|
||||||
|
parent.input.scope !== 'keyframe' ||
|
||||||
|
parent.input.provider !== 'openai-image' ||
|
||||||
|
parent.input.targetId !== targetId ||
|
||||||
|
parent.input.model !== model ||
|
||||||
|
parent.input.sourceFingerprint !== sourceFingerprint ||
|
||||||
|
parent.input.planFingerprint !== planFingerprint ||
|
||||||
|
!grant ||
|
||||||
|
grant.status !== 'approved' ||
|
||||||
|
grant.expired ||
|
||||||
|
!(Date.parse(grant.input.expiresAt) > Date.now()) ||
|
||||||
|
!Number.isSafeInteger(grant.remainingRequests) ||
|
||||||
|
grant.remainingRequests < 1 ||
|
||||||
|
!Number.isSafeInteger(grant.remainingMicros) ||
|
||||||
|
!Number.isSafeInteger(grant.input.perRequestMicros) ||
|
||||||
|
grant.input.perRequestMicros < 1 ||
|
||||||
|
grant.remainingMicros < grant.input.perRequestMicros
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
allowed: false,
|
||||||
|
reusable: false,
|
||||||
|
message: '所选追加许可已撤销、用尽,或原镜头、型号、来源、计划及预算不匹配。请重新核对原请求。'
|
||||||
|
}
|
||||||
|
const blockers = list.requests.filter(row => list.blockingRequestIds.includes(row.id))
|
||||||
|
if (
|
||||||
|
blockers.some(
|
||||||
|
row =>
|
||||||
|
row.status !== 'unknown' ||
|
||||||
|
row.input.planFingerprint !== planFingerprint ||
|
||||||
|
(row.id !== parent.id && row.input.additionalAuthorizationId !== permit.id)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return { allowed: false, reusable: false, message: '仍有在途或未被本次许可覆盖的原请求,不能追加。' }
|
||||||
|
return {
|
||||||
|
allowed: true,
|
||||||
|
reusable: false,
|
||||||
|
message: `人工追加许可:已用 ${permit.usedRequests} 次,剩余 ${permit.remainingRequests} 次。原未知请求和预留保持;仅本次主动生成,不会自动用完剩余次数。`
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,8 +24,15 @@ export interface ImageAuthorizationInput {
|
|||||||
export interface ImageChargeRequest {
|
export interface ImageChargeRequest {
|
||||||
/** 原请求标识。 */ id: string
|
/** 原请求标识。 */ id: string
|
||||||
/** 原执行状态。 */ status: string
|
/** 原执行状态。 */ status: string
|
||||||
|
/** 当前有效审计,不覆盖原状态、用量或账单。 */ billingAudit?: {
|
||||||
|
/** 审计状态。 */ status: 'unreviewed' | 'blocked' | 'released'
|
||||||
|
/** 有效解除。 */ released: boolean
|
||||||
|
/** 独立复核。 */ reviewId: string | null
|
||||||
|
/** 核实金额。 */ reviewedAmountMicros: number | null
|
||||||
|
}
|
||||||
/** 不可变原输入。 */ input: {
|
/** 不可变原输入。 */ input: {
|
||||||
/** 原项目。 */ projectId: string
|
/** 原项目。 */ projectId: string
|
||||||
|
/** 用户主动选用的人工追加许可。 */ additionalAuthorizationId?: string
|
||||||
/** 原范围。 */ scope: ImageAuthorizationScope
|
/** 原范围。 */ scope: ImageAuthorizationScope
|
||||||
/** 原目标。 */ targetId: string
|
/** 原目标。 */ targetId: string
|
||||||
/** 原候选。 */ candidateId: string
|
/** 原候选。 */ candidateId: string
|
||||||
@@ -47,6 +54,16 @@ export interface ImageChargeRequest {
|
|||||||
|
|
||||||
/** 项目授权余额与原请求。 */
|
/** 项目授权余额与原请求。 */
|
||||||
export interface ImageAuthorizationList {
|
export interface ImageAuthorizationList {
|
||||||
|
/** 原始在途或未知记录仍完整保留。 */ originalBlockingRequestIds?: string[]
|
||||||
|
/** 人工有限追加许可,不增加原预算。 */ additionalAuthorizations?: Array<{
|
||||||
|
/** 正式追加许可。 */ id: string
|
||||||
|
/** approved或revoked等真实状态。 */ status: string
|
||||||
|
/** 原不可变批准及服务端父输入摘要。 */ input: ImageAdditionalAuthorizationInput & {
|
||||||
|
/** 原完整输入摘要。 */ parentInputFingerprint: string
|
||||||
|
}
|
||||||
|
/** 已领取的模型请求次数。 */ usedRequests: number
|
||||||
|
/** 尚可人工领取次数。 */ remainingRequests: number
|
||||||
|
}>
|
||||||
/** 服务端计算的授权投影。 */ authorizations: Array<{
|
/** 服务端计算的授权投影。 */ authorizations: Array<{
|
||||||
/** 原批准记录。 */ id: string
|
/** 原批准记录。 */ id: string
|
||||||
/** 原批准状态。 */ status: string
|
/** 原批准状态。 */ status: string
|
||||||
@@ -90,3 +107,14 @@ export interface ImageAuthorizationPreview {
|
|||||||
/** 不承诺实际账单硬上限。 */ hardProviderCostCap: false
|
/** 不承诺实际账单硬上限。 */ hardProviderCostCap: false
|
||||||
/** 当前授权与费用状态。 */ authorization: ImageAuthorizationList
|
/** 当前授权与费用状态。 */ authorization: ImageAuthorizationList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 接受原费用未知风险后的有限人工追加,只允许服务端继承原精确计划。 */
|
||||||
|
export interface ImageAdditionalAuthorizationInput {
|
||||||
|
/** 明确追加模式。 */ mode: 'additional'
|
||||||
|
/** 本次批准唯一键,同内容重放保持。 */ idempotencyKey: string
|
||||||
|
/** 原应用费用请求,不能使用候选或Provider编号。 */ parentRequestId: string
|
||||||
|
/** 明确批准1~100次,不自动用完。 */ maxRequests: number
|
||||||
|
/** 用户主动接受原费用仍未知。 */ acknowledgeUnknownPriorBilling: true
|
||||||
|
/** 实际批准人。 */ approvedBy: string
|
||||||
|
/** 批准说明。 */ approvalNote: string
|
||||||
|
}
|
||||||
@@ -0,0 +1,250 @@
|
|||||||
|
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||||
|
import { useQuery } from '../../composables/useQuery'
|
||||||
|
import { ApiError, errorMessage } from '../../lib/http'
|
||||||
|
import { useActionMessage } from '../../components/ui/useActionMessage'
|
||||||
|
import type { BillingFacts } from '../billing-audit/types'
|
||||||
|
import { imageBillingAuditApi } from './billing-audit-api'
|
||||||
|
import { imageBillingEvidenceIssues, imageBillingReleaseIssues } from './billing-audit'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在原图片授权入口处理原请求的登记和独立复核,不执行生成或质量动作。
|
||||||
|
* @param props 原项目与应用费用请求
|
||||||
|
* @param changed 写入后刷新原授权余额和请求
|
||||||
|
* @returns 当前权威审计、独立表单和固定底栏操作
|
||||||
|
*/
|
||||||
|
export function useImageBillingAudit(
|
||||||
|
props: { projectId: string; requestId: string; disabled?: boolean },
|
||||||
|
changed: () => Promise<void> | void
|
||||||
|
) {
|
||||||
|
/** 当前原范围与提交回执隔离。 */
|
||||||
|
const key = computed(() => JSON.stringify([props.projectId, props.requestId]))
|
||||||
|
/** 组件离开后不应用旧提交结果。 */
|
||||||
|
let disposed = false
|
||||||
|
onScopeDispose(() => {
|
||||||
|
disposed = true
|
||||||
|
})
|
||||||
|
/** 原身份、版本和完整历史只来自正式GET。 */
|
||||||
|
const query = useQuery(key, async (value, signal) => {
|
||||||
|
const [projectId, requestId] = JSON.parse(value) as [string, string]
|
||||||
|
const result = await imageBillingAuditApi.get(projectId, requestId, signal)
|
||||||
|
if (
|
||||||
|
!result ||
|
||||||
|
result.projectId !== projectId ||
|
||||||
|
result.requestId !== requestId ||
|
||||||
|
result.identity?.projectId !== projectId ||
|
||||||
|
result.identity.requestId !== requestId ||
|
||||||
|
result.identity.provider !== 'openai-image' ||
|
||||||
|
![result.taskFingerprint, result.evidenceSetFingerprint, result.reviewFingerprint].every(hash =>
|
||||||
|
/^[a-f0-9]{64}$/.test(hash)
|
||||||
|
) ||
|
||||||
|
!Array.isArray(result.history?.evidence) ||
|
||||||
|
!Array.isArray(result.history?.reviews)
|
||||||
|
)
|
||||||
|
throw new Error('原图片请求身份或审计版本无法核对,请重新读取。')
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
/** 登记和复核始终是两个独立用户动作。 */
|
||||||
|
const action = ref<'evidence' | 'review'>('evidence')
|
||||||
|
/** 实际登记署名。 */
|
||||||
|
const operator = ref('')
|
||||||
|
/** 外部事实默认未知,不预填真实Provider号或账单。 */
|
||||||
|
const facts = ref<BillingFacts>({
|
||||||
|
correlation: 'unverified',
|
||||||
|
providerRequestId: null,
|
||||||
|
artifacts: [],
|
||||||
|
execution: { outcome: 'unknown', evidenceIds: [] },
|
||||||
|
billing: { finding: 'unknown', amount: null, currency: 'USD', evidenceIds: [] }
|
||||||
|
})
|
||||||
|
/** 用户主动选择当前正式证据。 */
|
||||||
|
const evidenceId = ref('')
|
||||||
|
/** 独立复核实际署名。 */
|
||||||
|
const reviewer = ref('')
|
||||||
|
/** 独立复核理由。 */
|
||||||
|
const reason = ref('')
|
||||||
|
/** 人工核对材料的真实摘要,不从本地身份伪造。 */
|
||||||
|
const confirmationSha256 = ref('')
|
||||||
|
/** 默认保留原阻断,解除需用户主动切换。 */
|
||||||
|
const decision = ref<'keep_blocked' | 'release_future_charges'>('keep_blocked')
|
||||||
|
/** 用户确认的是本次当前版本,刷新和编辑均撤销。 */
|
||||||
|
const confirmed = ref(false)
|
||||||
|
/** 同步写入过程防重复操作。 */
|
||||||
|
const saving = ref(false)
|
||||||
|
/** 完整校验只在提交时显示。 */
|
||||||
|
const validation = ref('')
|
||||||
|
/** 当前原请求的有效版本证据,旧历史仍保留展示。 */
|
||||||
|
const currentEvidence = computed(
|
||||||
|
() =>
|
||||||
|
query.data.value?.history.evidence.filter(
|
||||||
|
row =>
|
||||||
|
row.taskFingerprint === query.data.value?.taskFingerprint &&
|
||||||
|
row.body.expectedTaskFingerprint === query.data.value?.taskFingerprint
|
||||||
|
) ?? []
|
||||||
|
)
|
||||||
|
/** 复核只能使用用户选中的当前正式材料。 */
|
||||||
|
const selectedEvidence = computed(() => currentEvidence.value.find(row => row.id === evidenceId.value))
|
||||||
|
/** 核清不依据零token、unknown、观测记录或本地编号推断。 */
|
||||||
|
const releaseIssues = computed(() =>
|
||||||
|
query.data.value
|
||||||
|
? imageBillingReleaseIssues(selectedEvidence.value?.body.evidence, query.data.value)
|
||||||
|
: ['请先读取原请求审计。']
|
||||||
|
)
|
||||||
|
/** 固定底栏区分登记、保留和核清。 */
|
||||||
|
const submitLabel = computed(() =>
|
||||||
|
action.value === 'evidence'
|
||||||
|
? '登记图片费用证据'
|
||||||
|
: decision.value === 'keep_blocked'
|
||||||
|
? '确认保留费用阻断'
|
||||||
|
: '确认核清原请求费用'
|
||||||
|
)
|
||||||
|
/** 真实版本已读且用户明确确认后才允许提交。 */
|
||||||
|
const canSubmit = computed(
|
||||||
|
() =>
|
||||||
|
!!query.data.value &&
|
||||||
|
!query.loading.value &&
|
||||||
|
!query.error.value &&
|
||||||
|
!saving.value &&
|
||||||
|
!props.disabled &&
|
||||||
|
confirmed.value &&
|
||||||
|
(action.value !== 'review' ||
|
||||||
|
(!!selectedEvidence.value &&
|
||||||
|
(decision.value !== 'release_future_charges' || !releaseIssues.value.length)))
|
||||||
|
)
|
||||||
|
/** 使用原NMessage反馈。 */
|
||||||
|
const message = useActionMessage()
|
||||||
|
watch(
|
||||||
|
[action, facts, operator, evidenceId, reviewer, reason, confirmationSha256, decision],
|
||||||
|
() => {
|
||||||
|
confirmed.value = false
|
||||||
|
validation.value = ''
|
||||||
|
},
|
||||||
|
{ deep: true, flush: 'sync' }
|
||||||
|
)
|
||||||
|
watch(
|
||||||
|
query.data,
|
||||||
|
() => {
|
||||||
|
confirmed.value = false
|
||||||
|
},
|
||||||
|
{ flush: 'sync' }
|
||||||
|
)
|
||||||
|
/** 项目或原请求切换不继承证据、签署或人工确认。 */
|
||||||
|
watch(
|
||||||
|
key,
|
||||||
|
() => {
|
||||||
|
action.value = 'evidence'
|
||||||
|
operator.value = ''
|
||||||
|
facts.value = {
|
||||||
|
correlation: 'unverified',
|
||||||
|
providerRequestId: null,
|
||||||
|
artifacts: [],
|
||||||
|
execution: { outcome: 'unknown', evidenceIds: [] },
|
||||||
|
billing: { finding: 'unknown', amount: null, currency: 'USD', evidenceIds: [] }
|
||||||
|
}
|
||||||
|
evidenceId.value = ''
|
||||||
|
reviewer.value = ''
|
||||||
|
reason.value = ''
|
||||||
|
confirmationSha256.value = ''
|
||||||
|
decision.value = 'keep_blocked'
|
||||||
|
confirmed.value = false
|
||||||
|
validation.value = ''
|
||||||
|
},
|
||||||
|
{ flush: 'sync' }
|
||||||
|
)
|
||||||
|
/** 免费读取当前GET,保留本次用户表单并要求重新确认。 */
|
||||||
|
async function refresh() {
|
||||||
|
confirmed.value = false
|
||||||
|
await query.refresh()
|
||||||
|
}
|
||||||
|
/** 登记与复核分开提交,409刷新正式GET,保留输入并等待重新确认。 */
|
||||||
|
async function submit() {
|
||||||
|
const view = query.data.value
|
||||||
|
if (!view || !canSubmit.value) return
|
||||||
|
const errors =
|
||||||
|
action.value === 'evidence'
|
||||||
|
? [
|
||||||
|
...imageBillingEvidenceIssues(facts.value, view),
|
||||||
|
...(!operator.value.trim() || operator.value.trim().length > 120
|
||||||
|
? ['请填写1~120字的实际登记人。']
|
||||||
|
: [])
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
...(!selectedEvidence.value ? ['请重新选择当前版本的正式证据。'] : []),
|
||||||
|
...(decision.value === 'release_future_charges' ? releaseIssues.value : []),
|
||||||
|
...(!reviewer.value.trim() ||
|
||||||
|
reviewer.value.trim().length > 120 ||
|
||||||
|
reason.value.trim().length < 4 ||
|
||||||
|
reason.value.trim().length > 2000 ||
|
||||||
|
!/^[a-f0-9]{64}$/.test(confirmationSha256.value)
|
||||||
|
? ['请填写实际复核人、4~2000字理由及真实材料SHA256。']
|
||||||
|
: [])
|
||||||
|
]
|
||||||
|
if (errors.length) {
|
||||||
|
validation.value = [...new Set(errors)].join(' ')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const target = key.value
|
||||||
|
const operation = action.value
|
||||||
|
saving.value = true
|
||||||
|
confirmed.value = false
|
||||||
|
try {
|
||||||
|
const result =
|
||||||
|
operation === 'evidence'
|
||||||
|
? await imageBillingAuditApi.evidence(view.projectId, view.requestId, {
|
||||||
|
expectedTaskFingerprint: view.taskFingerprint,
|
||||||
|
operator: operator.value.trim(),
|
||||||
|
evidence: {
|
||||||
|
...JSON.parse(JSON.stringify(facts.value)),
|
||||||
|
identity: JSON.parse(JSON.stringify(view.identity))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
: await imageBillingAuditApi.review(view.projectId, view.requestId, {
|
||||||
|
evidenceId: evidenceId.value,
|
||||||
|
expectedTaskFingerprint: view.taskFingerprint,
|
||||||
|
expectedEvidenceSetFingerprint: view.evidenceSetFingerprint,
|
||||||
|
expectedReviewFingerprint: view.reviewFingerprint,
|
||||||
|
decision: decision.value,
|
||||||
|
reviewer: reviewer.value.trim(),
|
||||||
|
reason: reason.value.trim(),
|
||||||
|
confirmationSha256: confirmationSha256.value
|
||||||
|
})
|
||||||
|
if (disposed || target !== key.value) return
|
||||||
|
if (result?.projectId !== view.projectId || result.requestId !== view.requestId)
|
||||||
|
throw new Error('费用回执与原请求不一致,请重新读取。')
|
||||||
|
message?.info(
|
||||||
|
operation === 'evidence'
|
||||||
|
? '证据已登记,仍需独立人工复核。'
|
||||||
|
: result.billingBlocked
|
||||||
|
? '复核已记录,原请求费用仍阻断。'
|
||||||
|
: '原请求费用已核清;原执行状态、图片质量与主图资格保持独立。'
|
||||||
|
)
|
||||||
|
await refresh()
|
||||||
|
if (!disposed && target === key.value) await changed()
|
||||||
|
} catch (cause) {
|
||||||
|
if (disposed || target !== key.value) return
|
||||||
|
message?.error(errorMessage(cause))
|
||||||
|
if (cause instanceof ApiError && cause.status === 409) await refresh()
|
||||||
|
} finally {
|
||||||
|
saving.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
query,
|
||||||
|
action,
|
||||||
|
operator,
|
||||||
|
facts,
|
||||||
|
evidenceId,
|
||||||
|
reviewer,
|
||||||
|
reason,
|
||||||
|
confirmationSha256,
|
||||||
|
decision,
|
||||||
|
confirmed,
|
||||||
|
saving,
|
||||||
|
validation,
|
||||||
|
currentEvidence,
|
||||||
|
selectedEvidence,
|
||||||
|
releaseIssues,
|
||||||
|
submitLabel,
|
||||||
|
canSubmit,
|
||||||
|
refresh,
|
||||||
|
submit
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -171,7 +171,9 @@ export const productionApi = {
|
|||||||
/** 按本次请求选择的图片模型与参数预览最终输入,不创建首帧任务。 */
|
/** 按本次请求选择的图片模型与参数预览最终输入,不创建首帧任务。 */
|
||||||
previewKeyframe: (
|
previewKeyframe: (
|
||||||
shotId: string,
|
shotId: string,
|
||||||
input: Pick<GenerateKeyframeInput, 'provider' | 'generationOptions' | 'width' | 'height'>,
|
input: Pick<GenerateKeyframeInput, 'provider' | 'width' | 'height'> & {
|
||||||
|
/** 已保存草案中的原模型参数。 */ generationOptions?: Record<string, unknown>
|
||||||
|
},
|
||||||
signal?: AbortSignal
|
signal?: AbortSignal
|
||||||
) =>
|
) =>
|
||||||
request<KeyframeGenerationPreview>(`${shotPath(shotId)}/keyframe/preview`, {
|
request<KeyframeGenerationPreview>(`${shotPath(shotId)}/keyframe/preview`, {
|
||||||
@@ -179,8 +181,15 @@ export const productionApi = {
|
|||||||
signal,
|
signal,
|
||||||
body: input
|
body: input
|
||||||
}),
|
}),
|
||||||
generateKeyframe: (shotId: string, input: GenerateKeyframeInput) =>
|
/**
|
||||||
request<ShotKeyframe | null>(`${shotPath(shotId)}/keyframe`, {
|
* 提交用户确认的单镜首帧,追加许可显式绑定原项目。
|
||||||
|
* @param shotId 正式镜头
|
||||||
|
* @param input 已核对的模型参数及可选人工许可
|
||||||
|
* @param projectId 原项目范围
|
||||||
|
* @returns 原候选回执
|
||||||
|
*/
|
||||||
|
generateKeyframe: (shotId: string, input: GenerateKeyframeInput, projectId?: string) =>
|
||||||
|
request<ShotKeyframe | null>(keyframeScope(`${shotPath(shotId)}/keyframe`, projectId), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: input,
|
body: input,
|
||||||
timeoutMs: 0
|
timeoutMs: 0
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { useQuery } from '../../../composables/useQuery'
|
||||||
|
import { imageAuthorizationApi } from '../../image-authorization/api'
|
||||||
|
import { formatMicros } from '../../image-authorization/model'
|
||||||
|
import { NSelect } from 'naive-ui'
|
||||||
import KeyframePreviewChecks from './KeyframePreviewChecks.vue'
|
import KeyframePreviewChecks from './KeyframePreviewChecks.vue'
|
||||||
import ImageGenerationPreview from '../../subject-images/components/ImageGenerationPreview.vue'
|
import ImageGenerationPreview from '../../subject-images/components/ImageGenerationPreview.vue'
|
||||||
import { useImageGenerationPreview, type ImageGenerationSubmission } from '../../subject-images/generation-preview'
|
import { useImageGenerationPreview, type ImageGenerationSubmission } from '../../subject-images/generation-preview'
|
||||||
@@ -28,6 +32,8 @@ const props = defineProps<{
|
|||||||
shotTitle: string
|
shotTitle: string
|
||||||
projectId: string
|
projectId: string
|
||||||
disabled: boolean
|
disabled: boolean
|
||||||
|
/** 原镜头条件仍有效时允许免费核对追加许可,不放开普通未知重发。 */
|
||||||
|
additionalAllowed?: boolean
|
||||||
replacePrimary?: boolean
|
replacePrimary?: boolean
|
||||||
/** 当前镜头的正式摄影设计。 */
|
/** 当前镜头的正式摄影设计。 */
|
||||||
direction?: ShotDirection | null
|
direction?: ShotDirection | null
|
||||||
@@ -35,6 +41,8 @@ const props = defineProps<{
|
|||||||
visualState?: ShotVisualState | null
|
visualState?: ShotVisualState | null
|
||||||
/** 提交前已有候选,用于区分下载恢复与历史候选。 */
|
/** 提交前已有候选,用于区分下载恢复与历史候选。 */
|
||||||
previousCandidateIds?: readonly string[]
|
previousCandidateIds?: readonly string[]
|
||||||
|
/** 免费查看经当前预览核实的已有完整候选,不产生POST。 */
|
||||||
|
reuseExisting?: (fingerprint: string) => Promise<boolean>
|
||||||
/** 仅发送已经确认的当前快照。 */
|
/** 仅发送已经确认的当前快照。 */
|
||||||
submitGeneration: (input: GenerateKeyframeInput) => Promise<ImageGenerationSubmission>
|
submitGeneration: (input: GenerateKeyframeInput) => Promise<ImageGenerationSubmission>
|
||||||
}>()
|
}>()
|
||||||
@@ -69,6 +77,58 @@ const generationCatalog = ref<GenerationModelCatalog | null>(null)
|
|||||||
const generationCatalogError = ref('')
|
const generationCatalogError = ref('')
|
||||||
/** 实际项目及镜头配置解析后的模型。 */
|
/** 实际项目及镜头配置解析后的模型。 */
|
||||||
const imageProvider = ref('')
|
const imageProvider = ref('')
|
||||||
|
/** 当前用户主动选择的许可,重新打开或切换范围后不保留默认选择。 */
|
||||||
|
const additionalId = ref<string | null>(null)
|
||||||
|
/** 人工追加只属于OpenAI,不改变其它供应方的未知请求保护。 */
|
||||||
|
const canInspectAdditional = computed(() => !!props.additionalAllowed && imageProvider.value === 'openai-image')
|
||||||
|
/** 仅需要核对原失败请求时读取已有许可,不自动创建。 */
|
||||||
|
const additionalKey = computed(() =>
|
||||||
|
open.value && canInspectAdditional.value ? JSON.stringify([props.projectId, props.shotId]) : ''
|
||||||
|
)
|
||||||
|
/** 当前原项目的有限许可和原unknown历史。 */
|
||||||
|
const additionalQuery = useQuery(additionalKey, async (value, signal) => {
|
||||||
|
if (!value) return null
|
||||||
|
const [projectId] = JSON.parse(value) as [string, string]
|
||||||
|
const result = await imageAuthorizationApi.list(projectId, signal)
|
||||||
|
if (!result || !Array.isArray(result.requests) || !Array.isArray(result.authorizations))
|
||||||
|
throw new Error('原请求与授权记录读取不完整,请重新核对。')
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
/** 只列原镜头已有且未撤销、尚有次数的许可,不自动选中。 */
|
||||||
|
const additionalOptions = computed(() =>
|
||||||
|
(additionalQuery.data.value?.additionalAuthorizations ?? [])
|
||||||
|
.filter(
|
||||||
|
permit =>
|
||||||
|
permit.status === 'approved' &&
|
||||||
|
permit.remainingRequests > 0 &&
|
||||||
|
additionalQuery.data.value?.requests.some(
|
||||||
|
row =>
|
||||||
|
row.id === permit.input.parentRequestId &&
|
||||||
|
row.input.projectId === props.projectId &&
|
||||||
|
row.input.targetId === props.shotId &&
|
||||||
|
row.input.scope === 'keyframe'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.map(permit => ({
|
||||||
|
label: `${permit.input.approvedBy} · 已用 ${permit.usedRequests} / 剩余 ${permit.remainingRequests} 次`,
|
||||||
|
value: permit.id
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
/** 已选许可及其原unknown,不改写原范围或金额。 */
|
||||||
|
const additionalPermit = computed(() =>
|
||||||
|
additionalQuery.data.value?.additionalAuthorizations?.find(permit => permit.id === additionalId.value)
|
||||||
|
)
|
||||||
|
/** 原未知费用与预留保持显示。 */
|
||||||
|
const additionalParent = computed(() =>
|
||||||
|
additionalQuery.data.value?.requests.find(row => row.id === additionalPermit.value?.input.parentRequestId)
|
||||||
|
)
|
||||||
|
watch(
|
||||||
|
[() => props.projectId, () => props.shotId, open],
|
||||||
|
() => {
|
||||||
|
additionalId.value = null
|
||||||
|
},
|
||||||
|
{ flush: 'sync' }
|
||||||
|
)
|
||||||
/** 本次明确参数。 */
|
/** 本次明确参数。 */
|
||||||
const imageGenerationOptions = ref<GenerationOptions>({})
|
const imageGenerationOptions = ref<GenerationOptions>({})
|
||||||
/** 项目画幅。 */
|
/** 项目画幅。 */
|
||||||
@@ -76,7 +136,8 @@ const projectAspectRatio = ref<CreativeProfileAspectRatio>('9:16')
|
|||||||
/** 预览和生成复用当前请求字段,生成时再附加版本及候选标记。 */
|
/** 预览和生成复用当前请求字段,生成时再附加版本及候选标记。 */
|
||||||
const generationInput = computed(() => ({
|
const generationInput = computed(() => ({
|
||||||
provider: imageProvider.value || undefined,
|
provider: imageProvider.value || undefined,
|
||||||
generationOptions: imageGenerationOptions.value
|
generationOptions: imageGenerationOptions.value,
|
||||||
|
...(additionalId.value ? { additionalAuthorizationId: additionalId.value } : {})
|
||||||
}))
|
}))
|
||||||
/** 首帧与主体图片使用同一套预览确认与未知费用保护。 */
|
/** 首帧与主体图片使用同一套预览确认与未知费用保护。 */
|
||||||
const {
|
const {
|
||||||
@@ -84,6 +145,7 @@ const {
|
|||||||
acknowledged,
|
acknowledged,
|
||||||
requiresCostConfirmation,
|
requiresCostConfirmation,
|
||||||
chargeNotice,
|
chargeNotice,
|
||||||
|
reusableResult,
|
||||||
loading,
|
loading,
|
||||||
submitting,
|
submitting,
|
||||||
error,
|
error,
|
||||||
@@ -100,17 +162,32 @@ const {
|
|||||||
targetId: props.shotId,
|
targetId: props.shotId,
|
||||||
exactPreview: true
|
exactPreview: true
|
||||||
}),
|
}),
|
||||||
recoveryTarget: () => (props.shotId ? 'keyframe:' + props.shotId : ''),
|
additionalAuthorizationId: () => additionalId.value ?? undefined,
|
||||||
|
recoveryTarget: () =>
|
||||||
|
props.shotId
|
||||||
|
? additionalId.value && additionalPermit.value
|
||||||
|
? `keyframe:${props.projectId}:${props.shotId}:additional:${additionalId.value}:used:${additionalPermit.value.usedRequests}`
|
||||||
|
: 'keyframe:' + props.shotId
|
||||||
|
: '',
|
||||||
previousCandidateIds: () => props.previousCandidateIds,
|
previousCandidateIds: () => props.previousCandidateIds,
|
||||||
target: () => JSON.stringify([props.shotId, props.direction, props.visualState]),
|
target: () => JSON.stringify([props.projectId, props.shotId, props.direction, props.visualState]),
|
||||||
input: () => generationInput.value,
|
input: () => generationInput.value,
|
||||||
disabled: () => props.disabled || !imageProvider.value,
|
disabled: () =>
|
||||||
|
(props.disabled && !canInspectAdditional.value) ||
|
||||||
|
!imageProvider.value ||
|
||||||
|
(!!additionalId.value &&
|
||||||
|
(imageProvider.value !== 'openai-image' || additionalQuery.loading.value || !!additionalQuery.error.value)),
|
||||||
load: async (input, signal) => {
|
load: async (input, signal) => {
|
||||||
const shotId = props.shotId
|
const shotId = props.shotId
|
||||||
const result = await productionApi.previewKeyframe(shotId, input, signal)
|
const result = await productionApi.previewKeyframe(
|
||||||
|
shotId,
|
||||||
|
{ provider: input.provider, generationOptions: input.generationOptions },
|
||||||
|
signal
|
||||||
|
)
|
||||||
if (result?.shotId !== shotId) throw new Error('预览结果与当前镜头不匹配。')
|
if (result?.shotId !== shotId) throw new Error('预览结果与当前镜头不匹配。')
|
||||||
return result
|
return result
|
||||||
},
|
},
|
||||||
|
reuseResult: props.reuseExisting ? result => props.reuseExisting!(result.previewFingerprint) : undefined,
|
||||||
generate: input => props.submitGeneration({ ...input, setPrimary: false })
|
generate: input => props.submitGeneration({ ...input, setPrimary: false })
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -169,7 +246,7 @@ watch(
|
|||||||
<AppForm
|
<AppForm
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
:model="imageGenerationOptions"
|
:model="imageGenerationOptions"
|
||||||
:disabled="disabled || submitting"
|
:disabled="(disabled && !canInspectAdditional) || submitting"
|
||||||
:reset-key="`${open}:${shotId}`"
|
:reset-key="`${open}:${shotId}`"
|
||||||
validate-on-change
|
validate-on-change
|
||||||
@submit="submit"
|
@submit="submit"
|
||||||
@@ -196,6 +273,31 @@ watch(
|
|||||||
<ContextNotice v-else-if="generationCatalogError" type="warning" :show-icon="false" class="mt-5 text-xs">
|
<ContextNotice v-else-if="generationCatalogError" type="warning" :show-icon="false" class="mt-5 text-xs">
|
||||||
生成模型目录读取失败:{{ generationCatalogError }}
|
生成模型目录读取失败:{{ generationCatalogError }}
|
||||||
</ContextNotice>
|
</ContextNotice>
|
||||||
|
<!-- 以下是用户主动选择的原精确计划追加许可,普通unknown不放行。 -->
|
||||||
|
<section v-if="canInspectAdditional" class="workspace-section-stack mt-5">
|
||||||
|
<p class="text-sm">
|
||||||
|
原请求和费用仍未知。只可使用已单独批准的有限许可,重新预览核对精确计划;不会自动追加或消费剩余次数。
|
||||||
|
</p>
|
||||||
|
<NSelect
|
||||||
|
v-model:value="additionalId"
|
||||||
|
clearable
|
||||||
|
:options="additionalOptions"
|
||||||
|
:disabled="submitting || additionalQuery.loading.value"
|
||||||
|
placeholder="主动选择已有人工追加许可(可不选,仅免费预览)"
|
||||||
|
aria-label="本次人工追加许可"
|
||||||
|
/><NButton
|
||||||
|
:loading="additionalQuery.loading.value"
|
||||||
|
:disabled="submitting"
|
||||||
|
@click="additionalQuery.refresh"
|
||||||
|
>刷新追加许可与原请求</NButton
|
||||||
|
>
|
||||||
|
<p v-if="additionalQuery.error.value" role="alert">{{ additionalQuery.error.value }}</p>
|
||||||
|
<p v-if="additionalParent" class="text-sm">
|
||||||
|
原镜头 {{ additionalParent.input.targetId }} · 原型号 {{ additionalParent.input.model }} · 原预留
|
||||||
|
{{ formatMicros(additionalParent.input.reservedMicros) }} · 原账单
|
||||||
|
{{ formatMicros(additionalParent.output?.actualBilledMicros) }}
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
<!-- 以下是正式摄影设计与画面状态 -->
|
<!-- 以下是正式摄影设计与画面状态 -->
|
||||||
<NCollapse v-if="direction || visualState" class="mt-5">
|
<NCollapse v-if="direction || visualState" class="mt-5">
|
||||||
<NCollapseItem v-if="direction" name="direction" title="当前镜头设计">
|
<NCollapseItem v-if="direction" name="direction" title="当前镜头设计">
|
||||||
@@ -261,7 +363,7 @@ watch(
|
|||||||
:loading="submitting"
|
:loading="submitting"
|
||||||
@click="formRef?.validate(submit)"
|
@click="formRef?.validate(submit)"
|
||||||
type="primary"
|
type="primary"
|
||||||
>确认生成首帧</NButton
|
>{{ reusableResult ? '查看已有同计划候选' : '确认生成首帧' }}</NButton
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</AppDialog>
|
</AppDialog>
|
||||||
|
|||||||
@@ -403,6 +403,17 @@ const canGenerateKeyframe = computed(
|
|||||||
!!props.keyframeReadiness &&
|
!!props.keyframeReadiness &&
|
||||||
props.keyframeReadiness.issues.length === 0
|
props.keyframeReadiness.issues.length === 0
|
||||||
)
|
)
|
||||||
|
/** 原镜头、来源和活动任务条件仍满足时,只允许重新免费预览及受控追加,不放行普通重发。 */
|
||||||
|
const canUseAdditional = computed(
|
||||||
|
() =>
|
||||||
|
!assetBlocked.value &&
|
||||||
|
!query.loading.value &&
|
||||||
|
!!query.data.value &&
|
||||||
|
!keyframes.value.some(item => ['pending', 'generating'].includes(item.status)) &&
|
||||||
|
!!props.keyframeReadiness &&
|
||||||
|
props.keyframeReadiness.issues.length === 0 &&
|
||||||
|
keyframes.value.some(item => item.recoveryRequired)
|
||||||
|
)
|
||||||
const canGenerateVideo = computed(
|
const canGenerateVideo = computed(
|
||||||
() =>
|
() =>
|
||||||
!assetBlocked.value &&
|
!assetBlocked.value &&
|
||||||
@@ -513,17 +524,54 @@ async function generatePrompt() {
|
|||||||
await refreshAll()
|
await refreshAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从正式GET候选中查看精确预览对应的完整结果,不重新POST或修改主图。
|
||||||
|
* @param fingerprint 当前正式首帧预览指纹
|
||||||
|
* @returns 是否已经定位到完整同计划候选
|
||||||
|
*/
|
||||||
|
async function reuseExistingKeyframe(fingerprint: string) {
|
||||||
|
const projectId = props.projectId,
|
||||||
|
shotId = props.shot.shotId
|
||||||
|
await query.refresh()
|
||||||
|
if (disposed || props.projectId !== projectId || props.shot.shotId !== shotId || query.error.value) return false
|
||||||
|
const candidate = keyframes.value.find(
|
||||||
|
item =>
|
||||||
|
item.shotId === props.shot.shotId &&
|
||||||
|
item.status === 'completed' &&
|
||||||
|
!!item.imageUrl &&
|
||||||
|
item.recoveryRequired === false &&
|
||||||
|
item.providerInputFingerprint === fingerprint
|
||||||
|
)
|
||||||
|
if (!candidate) return false
|
||||||
|
actionMessage?.info('已读取已有同计划候选,没有新增模型请求;质量与主图资格仍需分别核对。')
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交已确认的首帧输入,并刷新该镜头候选。
|
* 提交已确认的首帧输入,并刷新该镜头候选。
|
||||||
* @param input 预览绑定的生成参数
|
* @param input 预览绑定的生成参数
|
||||||
* @returns 真实提交结果与可能的冲突
|
* @returns 真实提交结果与可能的冲突
|
||||||
*/
|
*/
|
||||||
async function generateKeyframe(input: GenerateKeyframeInput) {
|
async function generateKeyframe(input: GenerateKeyframeInput) {
|
||||||
if (!canGenerateKeyframe.value || !input.expectedPreviewFingerprint) return { accepted: false }
|
if (
|
||||||
|
(!canGenerateKeyframe.value &&
|
||||||
|
!(
|
||||||
|
input.additionalAuthorizationId &&
|
||||||
|
input.provider === 'openai-image' &&
|
||||||
|
input.setPrimary === false &&
|
||||||
|
canUseAdditional.value
|
||||||
|
)) ||
|
||||||
|
!input.expectedPreviewFingerprint
|
||||||
|
)
|
||||||
|
return { accepted: false }
|
||||||
const shotId = props.shot.shotId
|
const shotId = props.shot.shotId
|
||||||
const projectId = props.projectId
|
const projectId = props.projectId
|
||||||
const accepted = await runOperation(projectId, `生成镜头 ${props.shot.shotNo} 首帧`, async () => {
|
const accepted = await runOperation(projectId, `生成镜头 ${props.shot.shotNo} 首帧`, async () => {
|
||||||
const result = await productionApi.generateKeyframe(shotId, input)
|
const result = await productionApi.generateKeyframe(
|
||||||
|
shotId,
|
||||||
|
input,
|
||||||
|
input.additionalAuthorizationId ? projectId : undefined
|
||||||
|
)
|
||||||
if (
|
if (
|
||||||
!result?.id ||
|
!result?.id ||
|
||||||
result.shotId !== shotId ||
|
result.shotId !== shotId ||
|
||||||
@@ -1256,8 +1304,10 @@ defineExpose({ inspectSpecs, inspecting })
|
|||||||
:direction="shot.direction"
|
:direction="shot.direction"
|
||||||
:visual-state="shot.visualState"
|
:visual-state="shot.visualState"
|
||||||
:disabled="!canGenerateKeyframe"
|
:disabled="!canGenerateKeyframe"
|
||||||
|
:additional-allowed="canUseAdditional"
|
||||||
:previous-candidate-ids="keyframes.map(item => item.id)"
|
:previous-candidate-ids="keyframes.map(item => item.id)"
|
||||||
:submit-generation="generateKeyframe"
|
:submit-generation="generateKeyframe"
|
||||||
|
:reuse-existing="reuseExistingKeyframe"
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import BillingEvidenceFields from '../../billing-audit/BillingEvidenceFields.vue'
|
||||||
|
import type { BillingFacts } from '../../billing-audit/types'
|
||||||
import { computed, watch } from 'vue'
|
import { computed, watch } from 'vue'
|
||||||
import { NButton, NCheckbox, NCollapse, NCollapseItem, NInput, NInputNumber, NSelect } from 'naive-ui'
|
import { NButton, NCheckbox, NCollapse, NCollapseItem, NInput, NSelect } from 'naive-ui'
|
||||||
import { Trash2 } from '@lucide/vue'
|
|
||||||
import RawDataDetails from '../../../components/ui/RawDataDetails.vue'
|
import RawDataDetails from '../../../components/ui/RawDataDetails.vue'
|
||||||
import WorkspaceActionTooltip from '../../../components/ui/WorkspaceActionTooltip.vue'
|
|
||||||
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
|
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
|
||||||
import { formatDate } from '../../../lib/format'
|
import { formatDate } from '../../../lib/format'
|
||||||
import { useVideoAudit } from '../useVideoAudit'
|
import { useVideoAudit } from '../useVideoAudit'
|
||||||
import {
|
import {
|
||||||
auditArtifactLabels,
|
|
||||||
auditFindingLabels,
|
|
||||||
auditOutcomeLabels,
|
auditOutcomeLabels,
|
||||||
|
auditFindingLabels,
|
||||||
auditStatusLabels,
|
auditStatusLabels,
|
||||||
auditRequestStatusLabels,
|
auditRequestStatusLabels,
|
||||||
auditStepLabels
|
auditStepLabels
|
||||||
@@ -31,6 +30,31 @@ const form = useVideoAudit(props, () => emit('changed'))
|
|||||||
const audit = computed(() => form.query.data.value?.audit)
|
const audit = computed(() => form.query.data.value?.audit)
|
||||||
/** 原任务质量和费用保持原输出。 */
|
/** 原任务质量和费用保持原输出。 */
|
||||||
const original = computed(() => form.query.data.value?.original)
|
const original = computed(() => form.query.data.value?.original)
|
||||||
|
/** 原ref表单映射至共享证据字段,保留已有视频审计状态和接口。 */
|
||||||
|
const evidenceFacts = computed<BillingFacts>({
|
||||||
|
get: () => ({
|
||||||
|
correlation: form.correlation.value,
|
||||||
|
providerRequestId: form.providerRequestId.value || null,
|
||||||
|
artifacts: form.artifacts.value,
|
||||||
|
execution: { outcome: form.outcome.value, evidenceIds: form.executionIds.value },
|
||||||
|
billing: {
|
||||||
|
finding: form.finding.value,
|
||||||
|
amount: form.amount.value,
|
||||||
|
currency: audit.value?.currency ?? '',
|
||||||
|
evidenceIds: form.billingIds.value
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
set: value => {
|
||||||
|
form.correlation.value = value.correlation
|
||||||
|
form.providerRequestId.value = value.providerRequestId ?? ''
|
||||||
|
form.artifacts.value = value.artifacts
|
||||||
|
form.outcome.value = value.execution.outcome
|
||||||
|
form.executionIds.value = value.execution.evidenceIds
|
||||||
|
form.finding.value = value.billing.finding
|
||||||
|
form.amount.value = value.billing.amount
|
||||||
|
form.billingIds.value = value.billing.evidenceIds
|
||||||
|
}
|
||||||
|
})
|
||||||
/** 真实步骤选项。 */
|
/** 真实步骤选项。 */
|
||||||
const stepOptions = computed(
|
const stepOptions = computed(
|
||||||
() =>
|
() =>
|
||||||
@@ -44,12 +68,6 @@ const evidenceOptions = computed(
|
|||||||
value: row.id
|
value: row.id
|
||||||
})) ?? []
|
})) ?? []
|
||||||
)
|
)
|
||||||
/** 下拉选项保留实际枚举值。 */
|
|
||||||
const artifactKinds = Object.entries(auditArtifactLabels).map(([value, label]) => ({ value, label }))
|
|
||||||
/** 执行结果选项。 */
|
|
||||||
const outcomeOptions = Object.entries(auditOutcomeLabels).map(([value, label]) => ({ value, label }))
|
|
||||||
/** 费用结果选项。 */
|
|
||||||
const findingOptions = Object.entries(auditFindingLabels).map(([value, label]) => ({ value, label }))
|
|
||||||
watch(form.saving, value => emit('busy', value), { flush: 'sync' })
|
watch(form.saving, value => emit('busy', value), { flush: 'sync' })
|
||||||
/** 主操作由原抽屉固定 footer 提供。 */
|
/** 主操作由原抽屉固定 footer 提供。 */
|
||||||
defineExpose({ canSubmit: form.canSubmit, saving: form.saving, submit: form.submit, submitLabel: form.submitLabel })
|
defineExpose({ canSubmit: form.canSubmit, saving: form.saving, submit: form.submit, submitLabel: form.submitLabel })
|
||||||
@@ -190,140 +208,12 @@ defineExpose({ canSubmit: form.canSubmit, saving: form.saving, submit: form.subm
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 以下是外部原件登记表单,默认未知,原件引用不执行 URL -->
|
<!-- 以下是外部原件登记表单,默认未知,原件引用不执行 URL -->
|
||||||
<section v-if="form.action.value === 'evidence'" class="workspace-section-stack">
|
<BillingEvidenceFields
|
||||||
<p class="text-sm text-muted">
|
v-if="form.action.value === 'evidence'"
|
||||||
请保存原件并填写非敏感定位说明。真实供应方请求号与本地请求、LangSmith
|
v-model="evidenceFacts"
|
||||||
编号分别记录,不能互相代用。
|
v-model:operator="form.operator.value"
|
||||||
</p>
|
|
||||||
<label class="workspace-form-field"
|
|
||||||
><span>登记人</span
|
|
||||||
><NInput v-model:value="form.operator.value" :maxlength="120" :disabled="form.saving.value"
|
|
||||||
/></label>
|
|
||||||
<div class="grid grid-cols-1 gap-(--app-field-gap) sm:grid-cols-2">
|
|
||||||
<div class="workspace-form-field">
|
|
||||||
<span>与原请求的关联</span
|
|
||||||
><NSelect
|
|
||||||
aria-label="与原请求的关联"
|
|
||||||
v-model:value="form.correlation.value"
|
|
||||||
:disabled="form.saving.value"
|
|
||||||
:options="[
|
|
||||||
{ label: '尚未核实', value: 'unverified' },
|
|
||||||
{ label: '关联有歧义', value: 'ambiguous' },
|
|
||||||
{ label: '已唯一关联', value: 'unique' }
|
|
||||||
]"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<label class="workspace-form-field"
|
|
||||||
><span>真实供应方请求号(未知留空)</span
|
|
||||||
><NInput
|
|
||||||
v-model:value="form.providerRequestId.value"
|
|
||||||
:maxlength="200"
|
|
||||||
:disabled="form.saving.value"
|
|
||||||
/></label>
|
|
||||||
</div>
|
|
||||||
<article
|
|
||||||
v-for="(item, index) in form.artifacts.value"
|
|
||||||
:key="index"
|
|
||||||
class="surface-inset p-4 workspace-section-stack min-w-0"
|
|
||||||
>
|
|
||||||
<div class="flex items-center justify-between gap-3">
|
|
||||||
<h3 class="font-semibold">原件 {{ index + 1 }}</h3>
|
|
||||||
<WorkspaceActionTooltip label="删除原件"
|
|
||||||
><NButton
|
|
||||||
class="workspace-action-button icon-button"
|
|
||||||
:disabled="form.saving.value"
|
|
||||||
aria-label="删除原件"
|
|
||||||
@click="form.removeArtifact(index)"
|
|
||||||
><Trash2 :size="16" /></NButton
|
|
||||||
></WorkspaceActionTooltip>
|
|
||||||
</div>
|
|
||||||
<div class="grid grid-cols-1 gap-(--app-field-gap) sm:grid-cols-2">
|
|
||||||
<label class="workspace-form-field"
|
|
||||||
><span>包内引用键</span
|
|
||||||
><NInput v-model:value="item.id" :maxlength="120" :disabled="form.saving.value"
|
|
||||||
/></label>
|
|
||||||
<div class="workspace-form-field">
|
|
||||||
<span>原件来源</span
|
|
||||||
><NSelect
|
|
||||||
aria-label="原件来源"
|
|
||||||
v-model:value="item.kind"
|
|
||||||
:options="artifactKinds"
|
|
||||||
:disabled="form.saving.value"
|
:disabled="form.saving.value"
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<label class="workspace-form-field"
|
|
||||||
><span>原件记录编号</span
|
|
||||||
><NInput v-model:value="item.recordId" :maxlength="200" :disabled="form.saving.value"
|
|
||||||
/></label>
|
|
||||||
<label class="workspace-form-field"
|
|
||||||
><span>原件 SHA256</span
|
|
||||||
><NInput v-model:value="item.sha256" :maxlength="64" :disabled="form.saving.value"
|
|
||||||
/></label>
|
|
||||||
<label class="workspace-form-field"
|
|
||||||
><span>非敏感原件定位说明</span
|
|
||||||
><NInput
|
|
||||||
v-model:value="item.reference"
|
|
||||||
type="textarea"
|
|
||||||
:maxlength="1000"
|
|
||||||
:disabled="form.saving.value"
|
|
||||||
/></label>
|
|
||||||
</article>
|
|
||||||
<NButton
|
|
||||||
:disabled="form.saving.value || form.artifacts.value.length >= 20"
|
|
||||||
@click="form.addArtifact"
|
|
||||||
>添加原件</NButton
|
|
||||||
>
|
|
||||||
<div class="grid grid-cols-1 gap-(--app-field-gap) sm:grid-cols-2">
|
|
||||||
<div class="workspace-form-field">
|
|
||||||
<span>供应方执行结果</span
|
|
||||||
><NSelect
|
|
||||||
aria-label="供应方执行结果"
|
|
||||||
v-model:value="form.outcome.value"
|
|
||||||
:options="outcomeOptions"
|
|
||||||
:disabled="form.saving.value"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="workspace-form-field">
|
|
||||||
<span>执行依据原件</span
|
|
||||||
><NSelect
|
|
||||||
aria-label="执行依据原件"
|
|
||||||
v-model:value="form.executionIds.value"
|
|
||||||
multiple
|
|
||||||
:options="form.artifactOptions.value"
|
|
||||||
:disabled="form.saving.value"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="workspace-form-field">
|
|
||||||
<span>原始费用结论</span
|
|
||||||
><NSelect
|
|
||||||
aria-label="原始费用结论"
|
|
||||||
v-model:value="form.finding.value"
|
|
||||||
:options="findingOptions"
|
|
||||||
:disabled="form.saving.value"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="workspace-form-field">
|
|
||||||
<span>费用依据原件</span
|
|
||||||
><NSelect
|
|
||||||
aria-label="费用依据原件"
|
|
||||||
v-model:value="form.billingIds.value"
|
|
||||||
multiple
|
|
||||||
:options="form.artifactOptions.value"
|
|
||||||
:disabled="form.saving.value"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<label class="workspace-form-field"
|
|
||||||
><span>实际金额({{ audit.currency }},未知留空)</span
|
|
||||||
><NInputNumber
|
|
||||||
v-model:value="form.amount.value"
|
|
||||||
:min="0"
|
|
||||||
clearable
|
|
||||||
:disabled="form.saving.value"
|
|
||||||
/></label>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<!-- 以下是独立人工复核表单,资料不足时保留阻断 -->
|
|
||||||
<section v-else class="workspace-section-stack">
|
<section v-else class="workspace-section-stack">
|
||||||
<div class="workspace-form-field">
|
<div class="workspace-form-field">
|
||||||
<span>选择已登记证据包</span
|
<span>选择已登记证据包</span
|
||||||
|
|||||||
@@ -348,6 +348,8 @@ export interface GenerateKeyframesInput {
|
|||||||
|
|
||||||
/** 单镜头首帧生成参数。 */
|
/** 单镜头首帧生成参数。 */
|
||||||
export interface GenerateKeyframeInput {
|
export interface GenerateKeyframeInput {
|
||||||
|
/** 用户主动选择的人工有限追加许可,只作用于原精确OpenAI首帧计划。 */
|
||||||
|
additionalAuthorizationId?: string
|
||||||
/** 用户确认的最终输入版本。 */
|
/** 用户确认的最终输入版本。 */
|
||||||
expectedPreviewFingerprint?: string
|
expectedPreviewFingerprint?: string
|
||||||
/** 单镜头生成总是先生成候选。 */ setPrimary: boolean
|
/** 单镜头生成总是先生成候选。 */ setPrimary: boolean
|
||||||
|
|||||||
@@ -1,22 +1,8 @@
|
|||||||
|
import { billingEvidenceIssues } from '../billing-audit/evidence'
|
||||||
import type { VideoAuditEvidence, VideoAuditStep, VideoAuditView } from './video-audit.types'
|
import type { VideoAuditEvidence, VideoAuditStep, VideoAuditView } from './video-audit.types'
|
||||||
|
|
||||||
/** 原件来源使用中文选项,提交保留原枚举。 */
|
/** 图片与视频复用原件、执行和费用选项,保留原导出路径。 */
|
||||||
export const auditArtifactLabels = {
|
export { auditArtifactLabels, auditOutcomeLabels, auditFindingLabels } from '../billing-audit/labels'
|
||||||
'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: '费用未知' }
|
|
||||||
/** 费用审计状态中文。 */
|
/** 费用审计状态中文。 */
|
||||||
export const auditStatusLabels = { unreviewed: '等待人工核查', blocked: '保留费用阻断', released: '此步骤费用已核清' }
|
export const auditStatusLabels = { unreviewed: '等待人工核查', blocked: '保留费用阻断', released: '此步骤费用已核清' }
|
||||||
/** 原请求步骤名称。 */
|
/** 原请求步骤名称。 */
|
||||||
@@ -35,39 +21,12 @@ export const auditStepLabels: Record<string, string> = {
|
|||||||
* @returns 校验问题
|
* @returns 校验问题
|
||||||
*/
|
*/
|
||||||
export function auditEvidenceIssues(evidence: VideoAuditEvidence): string[] {
|
export function auditEvidenceIssues(evidence: VideoAuditEvidence): string[] {
|
||||||
const issues: string[] = []
|
return billingEvidenceIssues(evidence, [
|
||||||
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 &&
|
|
||||||
([
|
|
||||||
evidence.identity.requestId,
|
evidence.identity.requestId,
|
||||||
evidence.identity.taskId,
|
evidence.identity.taskId,
|
||||||
evidence.identity.workflowExecutionId,
|
evidence.identity.workflowExecutionId,
|
||||||
evidence.identity.videoId
|
evidence.identity.videoId
|
||||||
].includes(evidence.providerRequestId) ||
|
])
|
||||||
evidence.artifacts.some(item => item.kind === 'langsmith' && item.recordId === evidence.providerRequestId))
|
|
||||||
)
|
|
||||||
issues.push('本地任务、请求或 LangSmith 编号不能作为供应方请求号。')
|
|
||||||
return issues
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 资料不完整时禁用核清,最终真实性与唯一认领仍由人工及服务端核验。
|
* 资料不完整时禁用核清,最终真实性与唯一认领仍由人工及服务端核验。
|
||||||
|
|||||||
@@ -56,7 +56,10 @@ export interface Project {
|
|||||||
|
|
||||||
/** 正式数据库剧集;episode 是编号,与 Breakdown 的 episodeNo 区分。 */
|
/** 正式数据库剧集;episode 是编号,与 Breakdown 的 episodeNo 区分。 */
|
||||||
export interface Episode {
|
export interface Episode {
|
||||||
|
/** 正式集ID;缺失时不能构造环境采用证据。 */
|
||||||
id?: string
|
id?: string
|
||||||
|
/** 正式所属项目,环境证据必须与当前项目一致。 */
|
||||||
|
projectId?: string
|
||||||
episode: number
|
episode: number
|
||||||
targetDurationSeconds: number | null
|
targetDurationSeconds: number | null
|
||||||
title: string
|
title: string
|
||||||
|
|||||||
@@ -53,11 +53,12 @@ import SubjectCoverageAudit from './components/SubjectCoverageAudit.vue'
|
|||||||
import type { SubjectCoverageIssue } from './coverage.types'
|
import type { SubjectCoverageIssue } from './coverage.types'
|
||||||
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||||
import { useWorkflowExecution } from '../workflows/execution'
|
import { useWorkflowExecution } from '../workflows/execution'
|
||||||
import { useStoryboard } from './useStoryboard'
|
import { useStoryboard, type StoryboardCommand } from './useStoryboard'
|
||||||
import { storyboardApi, type StoryboardDurationAudit } from './api'
|
import { storyboardApi, type StoryboardDurationAudit } from './api'
|
||||||
import { projectsApi } from '../projects/api'
|
import { projectsApi } from '../projects/api'
|
||||||
import type { ProjectDurationBudgetSummary } from '../projects/types'
|
import type { ProjectDurationBudgetSummary } from '../projects/types'
|
||||||
|
|
||||||
|
/** 默认查看当前镜头设计,生成配置仅从工具入口打开。 */
|
||||||
const detailTab = ref('design')
|
const detailTab = ref('design')
|
||||||
/** 即使生产入口受来源门禁限制,也可免费核对连续性。 */
|
/** 即使生产入口受来源门禁限制,也可免费核对连续性。 */
|
||||||
const continuityOpen = ref(false)
|
const continuityOpen = ref(false)
|
||||||
@@ -128,8 +129,44 @@ const {
|
|||||||
visualStateComplete,
|
visualStateComplete,
|
||||||
hasCurrentEpisodeShots,
|
hasCurrentEpisodeShots,
|
||||||
executions,
|
executions,
|
||||||
run
|
run: runCommand
|
||||||
} = useStoryboard()
|
} = useStoryboard()
|
||||||
|
/** 本页主动操作产生的回执直接显示,恢复的历史回执保持默认收起。 */
|
||||||
|
const currentActionReceipt = ref(false)
|
||||||
|
/**
|
||||||
|
* 仅标记本页明确发起的操作,保留原命令、参数、费用确认和任务观察流程。
|
||||||
|
* @param command 用户已确认的生成阶段
|
||||||
|
* @returns 原操作的提交及状态读取完成
|
||||||
|
*/
|
||||||
|
async function run(command: StoryboardCommand): Promise<void> {
|
||||||
|
if (!allowed.value[command]) return
|
||||||
|
currentActionReceipt.value = true
|
||||||
|
await runCommand(command)
|
||||||
|
}
|
||||||
|
watch(
|
||||||
|
id,
|
||||||
|
() => {
|
||||||
|
currentActionReceipt.value = false
|
||||||
|
},
|
||||||
|
{ flush: 'sync' }
|
||||||
|
)
|
||||||
|
/** 本页真实任务入口,过滤不属于单集重生成的拆解任务。 */
|
||||||
|
const taskEntries = computed(() =>
|
||||||
|
executions.filter(
|
||||||
|
item =>
|
||||||
|
item.observer.executionId.value &&
|
||||||
|
(item.title !== '单集镜头重生成' ||
|
||||||
|
item.observer.query.data.value?.metadata?.action === 'regenerate-storyboard-episode')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
/** 当前活动或尚待读取的记录保持直接可见。 */
|
||||||
|
const currentTasks = computed(() =>
|
||||||
|
taskEntries.value.filter(item => item.observer.query.data.value?.status !== 'completed')
|
||||||
|
)
|
||||||
|
/** 已完成任务完整保留在默认收起的历史区域,失败记录仍直接显示。 */
|
||||||
|
const historicalTasks = computed(() =>
|
||||||
|
taskEntries.value.filter(item => item.observer.query.data.value?.status === 'completed')
|
||||||
|
)
|
||||||
/**
|
/**
|
||||||
* 显示正式派生状态与当前任务,不将候选或领取回执当作审核通过。
|
* 显示正式派生状态与当前任务,不将候选或领取回执当作审核通过。
|
||||||
* @param item 当前正式镜头
|
* @param item 当前正式镜头
|
||||||
@@ -276,7 +313,7 @@ function exportEpisode() {
|
|||||||
'application/json'
|
'application/json'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/** 回执到达后打开诊断区;平时留出镜头检查空间。 */
|
/** 生成配置由用户主动打开,历史回执恢复不打断镜头浏览。 */
|
||||||
const toolsOpen = ref(false)
|
const toolsOpen = ref(false)
|
||||||
/** 覆盖审计只保存剧集与镜头坐标,正式 ID 从当前查询结果中定位。 */
|
/** 覆盖审计只保存剧集与镜头坐标,正式 ID 从当前查询结果中定位。 */
|
||||||
const auditLocation = ref<SubjectCoverageIssue | null>(null)
|
const auditLocation = ref<SubjectCoverageIssue | null>(null)
|
||||||
@@ -327,7 +364,6 @@ watch(
|
|||||||
() => session.value.receipt,
|
() => session.value.receipt,
|
||||||
receipt => {
|
receipt => {
|
||||||
if (receipt) {
|
if (receipt) {
|
||||||
toolsOpen.value = true
|
|
||||||
/** 正式镜头重生成完成后重新读取预算与审计,避免展示旧时长。 */
|
/** 正式镜头重生成完成后重新读取预算与审计,避免展示旧时长。 */
|
||||||
if (receipt.kind === 'shots' && id.value) void refreshDuration(id.value)
|
if (receipt.kind === 'shots' && id.value) void refreshDuration(id.value)
|
||||||
}
|
}
|
||||||
@@ -367,21 +403,6 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
<ContextNotice v-if="episodeSourceUnavailable" type="info" :show-icon="false">
|
<ContextNotice v-if="episodeSourceUnavailable" type="info" :show-icon="false">
|
||||||
本集镜头已更新。标题和剧情详情待补齐。
|
本集镜头已更新。标题和剧情详情待补齐。
|
||||||
</ContextNotice>
|
</ContextNotice>
|
||||||
<!-- 以下是镜头生产所需的全项目设计进度,生成操作仍需单独确认。 -->
|
|
||||||
<ContextNotice v-if="projectDesignGap" type="info">
|
|
||||||
<div class="flex flex-wrap items-center gap-x-3">
|
|
||||||
<span>
|
|
||||||
全项目有效进度:镜头设计 {{ projectDesignGap.directionCount }}/{{
|
|
||||||
projectDesignGap.shotCount
|
|
||||||
}}, 画面状态 {{ projectDesignGap.visualStateCount }}/{{ projectDesignGap.shotCount }}。
|
|
||||||
<template v-if="projectDesignGap.staleDirectionCount || projectDesignGap.staleVisualStateCount">
|
|
||||||
需更新:镜头设计 {{ projectDesignGap.staleDirectionCount ?? 0 }} 个、画面状态
|
|
||||||
{{ projectDesignGap.staleVisualStateCount ?? 0 }} 个。
|
|
||||||
</template>
|
|
||||||
</span>
|
|
||||||
<NButton text size="small" @click="toolsOpen = true">查看生成选项</NButton>
|
|
||||||
</div>
|
|
||||||
</ContextNotice>
|
|
||||||
<ContextNotice v-if="currentEpisodeDurationIssues.length" type="warning" :show-icon="false">
|
<ContextNotice v-if="currentEpisodeDurationIssues.length" type="warning" :show-icon="false">
|
||||||
<div class="text-sm font-medium">
|
<div class="text-sm font-medium">
|
||||||
本集有 {{ currentEpisodeDurationIssues.length }} 条分镜时长建议(不阻断生成)
|
本集有 {{ currentEpisodeDurationIssues.length }} 条分镜时长建议(不阻断生成)
|
||||||
@@ -454,6 +475,12 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolbar-actions">
|
<div class="toolbar-actions">
|
||||||
|
<!-- 以下是统一中性底面的低频操作,位于工具栏最左侧。 -->
|
||||||
|
<ActionMenu
|
||||||
|
label="分镜更多操作"
|
||||||
|
:items="[{ key: 'export', label: '导出本集', disabled: !shots.length }]"
|
||||||
|
@select="exportEpisode"
|
||||||
|
/>
|
||||||
<!-- 以下是复用生产工作区的连续性审核入口 -->
|
<!-- 以下是复用生产工作区的连续性审核入口 -->
|
||||||
<WorkspaceActionTooltip label="连续性审核" mobile-only
|
<WorkspaceActionTooltip label="连续性审核" mobile-only
|
||||||
><NButton
|
><NButton
|
||||||
@@ -461,35 +488,21 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
:disabled="!id || shots.length < 2"
|
:disabled="!id || shots.length < 2"
|
||||||
aria-label="连续性审核"
|
aria-label="连续性审核"
|
||||||
@click="continuityOpen = true"
|
@click="continuityOpen = true"
|
||||||
><ScanEye :size="18" class="mobile-action-icon" /><span class="workspace-action-label"
|
><template #icon><ScanEye :size="15" /></template>
|
||||||
>连续性审核</span
|
<span class="workspace-action-label">连续性审核</span></NButton
|
||||||
></NButton
|
|
||||||
></WorkspaceActionTooltip
|
></WorkspaceActionTooltip
|
||||||
>
|
>
|
||||||
<div class="flex gap-3">
|
|
||||||
<ActionMenu
|
|
||||||
label="分镜更多操作"
|
|
||||||
:items="[{ key: 'export', label: '导出本集', disabled: !shots.length }]"
|
|
||||||
@select="exportEpisode"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 以下是全屏分镜生成配置与回执,标题与关闭栏固定。 -->
|
<!-- 以下是全屏分镜生成配置与回执,标题与关闭栏固定。 -->
|
||||||
<WorkspaceTools
|
<WorkspaceTools
|
||||||
:pending="operation.pending"
|
:pending="operation.pending"
|
||||||
:pending-label="operation.label"
|
:pending-label="operation.label"
|
||||||
v-model:open="toolsOpen"
|
v-model:open="toolsOpen"
|
||||||
title="分镜生成配置与回执"
|
title="分镜生成"
|
||||||
label="生成与恢复"
|
label="生成与恢复"
|
||||||
:has-receipt="!!session.receipt"
|
:has-receipt="!!session.receipt"
|
||||||
fullscreen
|
fullscreen
|
||||||
>
|
>
|
||||||
<div class="flex flex-wrap items-end justify-between gap-4">
|
|
||||||
<div>
|
|
||||||
<h2 class="text-lg font-semibold">分镜设计</h2>
|
|
||||||
<p class="mt-2 text-sm text-muted">从镜头拆解到摄影设计,再补齐每一镜的即时状态。</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- 以下是按正式 Episode、Beat、Shot 选择的生成范围。 -->
|
<!-- 以下是按正式 Episode、Beat、Shot 选择的生成范围。 -->
|
||||||
<section class="workspace-section-stack" aria-label="派生镜头范围">
|
<section class="workspace-section-stack" aria-label="派生镜头范围">
|
||||||
<label class="workspace-form-field"
|
<label class="workspace-form-field"
|
||||||
@@ -504,8 +517,10 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
{ label: '全项目', value: 'project' }
|
{ label: '全项目', value: 'project' }
|
||||||
]"
|
]"
|
||||||
/></label>
|
/></label>
|
||||||
<p class="text-sm">{{ scopeLabel }} · 默认复用已有有效结果。</p>
|
<p class="text-sm">
|
||||||
<NCollapse
|
{{ scopeLabel }} · {{ force ? '覆盖已有结果' : '只补缺失或过期结果' }}
|
||||||
|
</p>
|
||||||
|
<NCollapse v-if="generationScope === 'selected'"
|
||||||
><NCollapseItem name="range-selection" title="选择镜头(按段落)">
|
><NCollapseItem name="range-selection" title="选择镜头(按段落)">
|
||||||
<BeatShotDirectory
|
<BeatShotDirectory
|
||||||
:shots="shots"
|
:shots="shots"
|
||||||
@@ -609,6 +624,15 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
</div>
|
</div>
|
||||||
</AppForm>
|
</AppForm>
|
||||||
</section>
|
</section>
|
||||||
|
<!-- 以下是完整项目进度,仅在生成配置中核对。 -->
|
||||||
|
<p v-if="projectDesignGap" class="text-sm text-muted">
|
||||||
|
全项目:摄影 {{ projectDesignGap.directionCount }}/{{ projectDesignGap.shotCount }} · 画面
|
||||||
|
{{ projectDesignGap.visualStateCount }}/{{ projectDesignGap.shotCount }}
|
||||||
|
<span v-if="projectDesignGap.staleDirectionCount || projectDesignGap.staleVisualStateCount">
|
||||||
|
· 过期摄影 {{ projectDesignGap.staleDirectionCount ?? 0 }} / 画面
|
||||||
|
{{ projectDesignGap.staleVisualStateCount ?? 0 }}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
<!-- 以下是共用中性底色的本集设计进度模块。 -->
|
<!-- 以下是共用中性底色的本集设计进度模块。 -->
|
||||||
<section
|
<section
|
||||||
class="storyboard-coverage workspace-panel grid grid-cols-1 gap-4 sm:grid-cols-2"
|
class="storyboard-coverage workspace-panel grid grid-cols-1 gap-4 sm:grid-cols-2"
|
||||||
@@ -647,11 +671,6 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
<h3 class="text-sm font-semibold">
|
<h3 class="text-sm font-semibold">
|
||||||
<span class="mr-2 font-mono text-xs text-muted">00</span>本集镜头拆解
|
<span class="mr-2 font-mono text-xs text-muted">00</span>本集镜头拆解
|
||||||
</h3>
|
</h3>
|
||||||
<p class="mt-2 text-xs leading-6 text-muted">
|
|
||||||
只重新拆解当前选择的第
|
|
||||||
{{ episodeNo }}
|
|
||||||
集,其他剧集不受影响。新镜头会替换旧镜头,并清空本集已有的导演设计、即时状态、首帧与视频结果。
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-wrap gap-2">
|
<div class="flex flex-wrap gap-2">
|
||||||
<ConfirmAction
|
<ConfirmAction
|
||||||
@@ -677,9 +696,6 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
<h3 class="text-sm font-semibold">
|
<h3 class="text-sm font-semibold">
|
||||||
<span class="mr-2 font-mono text-xs text-muted">01</span>导演摄影设计
|
<span class="mr-2 font-mono text-xs text-muted">01</span>导演摄影设计
|
||||||
</h3>
|
</h3>
|
||||||
<p class="mt-2 text-xs leading-6 text-muted">
|
|
||||||
先准备摄影,再由用户另行发起画面状态生成。已有有效镜头自动复用。
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-wrap gap-2">
|
<div class="flex flex-wrap gap-2">
|
||||||
<ConfirmAction
|
<ConfirmAction
|
||||||
@@ -712,9 +728,6 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
<h3 class="text-sm font-semibold">
|
<h3 class="text-sm font-semibold">
|
||||||
<span class="mr-2 font-mono text-xs text-muted">02</span>即时视觉状态
|
<span class="mr-2 font-mono text-xs text-muted">02</span>即时视觉状态
|
||||||
</h3>
|
</h3>
|
||||||
<p class="mt-2 text-xs leading-6 text-muted">
|
|
||||||
先补齐导演设计,再生成表情、姿态和环境等画面状态。
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-wrap gap-2">
|
<div class="flex flex-wrap gap-2">
|
||||||
<ConfirmAction
|
<ConfirmAction
|
||||||
@@ -747,9 +760,6 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
</p>
|
</p>
|
||||||
<!-- 以下是所选范围的只读参考素材与分阶段生产缺口。 -->
|
<!-- 以下是所选范围的只读参考素材与分阶段生产缺口。 -->
|
||||||
<StagedShotPreparation :project-id="id" :shots="selectedShots" :active="toolsOpen" />
|
<StagedShotPreparation :project-id="id" :shots="selectedShots" :active="toolsOpen" />
|
||||||
<p class="mt-4 text-[11px] leading-6 text-muted">
|
|
||||||
设计更新后,请依次更新画面状态和视频提示词。自动修复次数只用于画面状态。
|
|
||||||
</p>
|
|
||||||
<section>
|
<section>
|
||||||
<h3 class="text-sm font-semibold">视频提示词批量操作</h3>
|
<h3 class="text-sm font-semibold">视频提示词批量操作</h3>
|
||||||
<p class="my-3 text-xs leading-6 text-muted">
|
<p class="my-3 text-xs leading-6 text-muted">
|
||||||
@@ -773,13 +783,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
</section>
|
</section>
|
||||||
<!-- 以下是正式分镜后台执行状态模块 -->
|
<!-- 以下是正式分镜后台执行状态模块 -->
|
||||||
<WorkflowExecutionPanel
|
<WorkflowExecutionPanel
|
||||||
v-for="entry in executions.filter(
|
v-for="entry in currentTasks"
|
||||||
item =>
|
|
||||||
item.observer.executionId.value &&
|
|
||||||
(item.title !== '单集镜头重生成' ||
|
|
||||||
item.observer.query.data.value?.metadata?.action ===
|
|
||||||
'regenerate-storyboard-episode')
|
|
||||||
)"
|
|
||||||
:key="entry.title"
|
:key="entry.title"
|
||||||
:title="entry.title"
|
:title="entry.title"
|
||||||
:execution="entry.observer.query.data.value"
|
:execution="entry.observer.query.data.value"
|
||||||
@@ -791,7 +795,31 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
@refresh="entry.observer.query.refresh"
|
@refresh="entry.observer.query.refresh"
|
||||||
@dismiss="entry.observer.dismiss"
|
@dismiss="entry.observer.dismiss"
|
||||||
/>
|
/>
|
||||||
<GenerationReceipt v-if="session.receipt" :receipt="session.receipt" />
|
<GenerationReceipt
|
||||||
|
v-if="currentActionReceipt && session.receipt"
|
||||||
|
:receipt="session.receipt"
|
||||||
|
/>
|
||||||
|
<!-- 以下是可随时查看的历史回执,不恢复弹窗或遮挡当前配置。 -->
|
||||||
|
<NCollapse v-if="historicalTasks.length || (!currentActionReceipt && session.receipt)">
|
||||||
|
<NCollapseItem name="history" title="历史任务与回执">
|
||||||
|
<div class="workspace-section-stack">
|
||||||
|
<WorkflowExecutionPanel
|
||||||
|
v-for="entry in historicalTasks"
|
||||||
|
:key="entry.title"
|
||||||
|
:title="entry.title"
|
||||||
|
:execution="entry.observer.query.data.value"
|
||||||
|
:loading="entry.observer.query.loading.value"
|
||||||
|
:error="entry.observer.query.error.value"
|
||||||
|
@refresh="entry.observer.query.refresh"
|
||||||
|
@dismiss="entry.observer.dismiss"
|
||||||
|
/>
|
||||||
|
<GenerationReceipt
|
||||||
|
v-if="!currentActionReceipt && session.receipt"
|
||||||
|
:receipt="session.receipt"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</NCollapseItem>
|
||||||
|
</NCollapse>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</WorkspaceTools>
|
</WorkspaceTools>
|
||||||
@@ -845,7 +873,6 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
<h3>
|
<h3>
|
||||||
镜头目录 <span>{{ shots.length }} 镜</span>
|
镜头目录 <span>{{ shots.length }} 镜</span>
|
||||||
</h3>
|
</h3>
|
||||||
<span>已选 {{ checkedShotIds.length }} 镜</span>
|
|
||||||
</div>
|
</div>
|
||||||
<NScrollbar
|
<NScrollbar
|
||||||
class="panel-scroll directory-scroll"
|
class="panel-scroll directory-scroll"
|
||||||
@@ -856,11 +883,6 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
:shots="shots"
|
:shots="shots"
|
||||||
:active-id="shot?.shotId || ''"
|
:active-id="shot?.shotId || ''"
|
||||||
item-class="shot-link"
|
item-class="shot-link"
|
||||||
selectable
|
|
||||||
:checked-ids="checkedShotIds"
|
|
||||||
:selection-disabled="operation.pending || query.loading.value"
|
|
||||||
@toggle="toggleShots([$event])"
|
|
||||||
@toggle-beat="toggleShots"
|
|
||||||
@select="selectedShot = $event"
|
@select="selectedShot = $event"
|
||||||
>
|
>
|
||||||
<template #meta="{ shot: item }">
|
<template #meta="{ shot: item }">
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { visualStateTimeIssueLabel } from '../visual-state-time'
|
||||||
import { userFacingText } from '../../../lib/user-facing-text'
|
import { userFacingText } from '../../../lib/user-facing-text'
|
||||||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||||
|
|
||||||
@@ -87,7 +88,9 @@ function exportReceipt() {
|
|||||||
<p>{{ item.error || '—' }}</p>
|
<p>{{ item.error || '—' }}</p>
|
||||||
<p v-for="(issue, index) in item.remainingIssues" :key="index" class="mt-2 text-danger">
|
<p v-for="(issue, index) in item.remainingIssues" :key="index" class="mt-2 text-danger">
|
||||||
剧情段落 {{ issue.beatNo ?? '—' }} / 镜头 {{ issue.shotNo ?? '—' }}
|
剧情段落 {{ issue.beatNo ?? '—' }} / 镜头 {{ issue.shotNo ?? '—' }}
|
||||||
{{ issue.subjectRef }}:{{ userFacingText(issue.message) }}
|
<span v-if="visualStateTimeIssueLabel(issue)"
|
||||||
|
>{{ visualStateTimeIssueLabel(issue) }} · </span
|
||||||
|
>{{ issue.subjectRef }}:{{ userFacingText(issue.message) }}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { NCollapse, NCollapseItem, NInput } from 'naive-ui'
|
||||||
|
import VisualStateContinuity from './VisualStateContinuity.vue'
|
||||||
|
import DirectionCameraFields from './DirectionCameraFields.vue'
|
||||||
|
import type { ShotReviewDraft } from '../derived-review.types'
|
||||||
|
import { jointFieldLabels } from '../joint-review'
|
||||||
|
/** 同一摄影审核抽屉中的有界联合编辑,不新增身份或形态;环境需本集证据。 */
|
||||||
|
defineProps<{ /** 正式提交时保持完整草案稳定。 */ disabled: boolean }>()
|
||||||
|
/** 当前完整草案,未开放字段保留原值。 */
|
||||||
|
const draft = defineModel<ShotReviewDraft>({ required: true })
|
||||||
|
/** 服务端允许修改的主体0秒字段。 */
|
||||||
|
const fields = ['expression', 'pose', 'gaze', 'position', 'transientState'] as const
|
||||||
|
/** 现有环境Schema的四个字段,未知值保持原空字符串。 */
|
||||||
|
const environmentFields = ['timeOfDay', 'weather', 'atmosphere', 'transientState'] as const
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<!-- 以下是原摄影编辑器共用字段,摄影枚举和正式动作保持只读。 -->
|
||||||
|
<div class="workspace-section-stack">
|
||||||
|
<DirectionCameraFields
|
||||||
|
v-model:composition="draft.direction.composition"
|
||||||
|
v-model:camera-position="draft.direction.cameraPosition"
|
||||||
|
:disabled="disabled"
|
||||||
|
/>
|
||||||
|
<label class="workspace-form-field"
|
||||||
|
><span>摄影意图</span
|
||||||
|
><NInput
|
||||||
|
v-model:value="draft.direction.visualIntent"
|
||||||
|
type="textarea"
|
||||||
|
:disabled="disabled"
|
||||||
|
:maxlength="4000"
|
||||||
|
aria-label="联合摄影意图"
|
||||||
|
/></label>
|
||||||
|
<!-- 以下是可选环境修订,完整差异及本集原文在同一联合面板核对。 -->
|
||||||
|
<NCollapse>
|
||||||
|
<NCollapseItem name="environment" title="环境修订(需本集原文)">
|
||||||
|
<div class="workspace-section-stack">
|
||||||
|
<label v-for="field in environmentFields" :key="field" class="workspace-form-field">
|
||||||
|
<span>{{ jointFieldLabels[field] }}</span>
|
||||||
|
<NInput
|
||||||
|
v-model:value="draft.visualState.environment[field]"
|
||||||
|
type="textarea"
|
||||||
|
:maxlength="4000"
|
||||||
|
:disabled="disabled"
|
||||||
|
:aria-label="`环境${jointFieldLabels[field]}`"
|
||||||
|
placeholder="未知可留空"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</NCollapseItem>
|
||||||
|
</NCollapse>
|
||||||
|
<!-- 以下是原正式主体的开拍状态,不能修改主体集合与形态身份。 -->
|
||||||
|
<section
|
||||||
|
v-for="subject in draft.visualState.subjects"
|
||||||
|
:key="subject.subjectRef"
|
||||||
|
class="workspace-section-stack"
|
||||||
|
>
|
||||||
|
<h4 class="text-sm font-medium">{{ subject.formName }} · {{ subject.subjectRef }} · 当前开拍状态</h4>
|
||||||
|
<label v-for="field in fields" :key="field" class="workspace-form-field"
|
||||||
|
><span>{{ jointFieldLabels[field] }}</span
|
||||||
|
><NInput
|
||||||
|
v-model:value="subject[field]"
|
||||||
|
type="textarea"
|
||||||
|
:maxlength="4000"
|
||||||
|
:disabled="disabled"
|
||||||
|
:aria-label="`${subject.subjectRef} · ${jointFieldLabels[field]}`"
|
||||||
|
/></label>
|
||||||
|
</section>
|
||||||
|
<label class="workspace-form-field"
|
||||||
|
><span>衔接与时间依据</span
|
||||||
|
><NInput
|
||||||
|
v-model:value="draft.visualState.continuityNote"
|
||||||
|
type="textarea"
|
||||||
|
:maxlength="4000"
|
||||||
|
:disabled="disabled"
|
||||||
|
aria-label="联合衔接与时间依据"
|
||||||
|
/></label>
|
||||||
|
<VisualStateContinuity v-if="draft.visualState.continuityNote" :note="draft.visualState.continuityNote" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,692 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||||
|
import { NButton, NCheckbox, NCollapse, NCollapseItem, NInput } from 'naive-ui'
|
||||||
|
import { WorkspaceSectionHeading } from '../../../components/ui'
|
||||||
|
import RawDataDetails from '../../../components/ui/RawDataDetails.vue'
|
||||||
|
import { useActionMessage } from '../../../components/ui/useActionMessage'
|
||||||
|
import { useQuery } from '../../../composables/useQuery'
|
||||||
|
import { ApiError, errorMessage } from '../../../lib/http'
|
||||||
|
import { userFacingText } from '../../../lib/user-facing-text'
|
||||||
|
import { preparationApi } from '../../storyboard-preparation/api'
|
||||||
|
import { currentStoryboardApproval } from '../../storyboard-preparation/model'
|
||||||
|
import { productionApi } from '../../production/api'
|
||||||
|
import { projectsApi } from '../../projects/api'
|
||||||
|
import type { KeyframeGenerationPreview } from '../../production/types'
|
||||||
|
import ImageGenerationPreview from '../../subject-images/components/ImageGenerationPreview.vue'
|
||||||
|
import { runOperation, getOperation } from '../../workflows/operations'
|
||||||
|
import { storyboardApi } from '../api'
|
||||||
|
import { mergeDesignedShots } from '../model'
|
||||||
|
import { derivedReviewApi } from '../derived-review-api'
|
||||||
|
import { draftFromFormal } from '../derived-review'
|
||||||
|
import { jointDraftDifferences, jointValue } from '../joint-review'
|
||||||
|
import type {
|
||||||
|
DerivedReviewSelection,
|
||||||
|
DraftProviderInput,
|
||||||
|
JointDerivedReviewResult,
|
||||||
|
ShotDraftPreview,
|
||||||
|
ShotReviewDraft
|
||||||
|
} from '../derived-review.types'
|
||||||
|
import type { DesignedShot } from '../types'
|
||||||
|
import JointDraftFields from './JointDraftFields.vue'
|
||||||
|
import ShotDesign from './ShotDesign.vue'
|
||||||
|
|
||||||
|
/** 在原摄影抽屉内扩展联合模式,所有动作仍走原草案、预览和采用接口。 */
|
||||||
|
const props = defineProps<{
|
||||||
|
/** 正式项目。 */ projectId: string
|
||||||
|
/** 正式集号。 */ episodeNo: number
|
||||||
|
/** 当前镜头。 */ shot: DesignedShot
|
||||||
|
/** 原目录中的镜头位置。 */ shots: DesignedShot[]
|
||||||
|
/** 实际活动锁。 */ disabled: boolean
|
||||||
|
}>()
|
||||||
|
/** 成功采用后只读刷新原分镜工作台。 */
|
||||||
|
const emit = defineEmits<{ changed: [] }>()
|
||||||
|
/** 当前完整待审草案。 */
|
||||||
|
const draft = ref<ShotReviewDraft | null>(null)
|
||||||
|
/** 保留保存时显式参数,不用当前模型推荐覆盖原参数。 */
|
||||||
|
const providerInput = ref<DraftProviderInput | undefined>()
|
||||||
|
/** 只在首次读取时回填,其后版本刷新保留人工输入。 */
|
||||||
|
const initialized = ref(false)
|
||||||
|
/** 联合修订与剪辑依据。 */
|
||||||
|
const reason = ref('')
|
||||||
|
/** 实际审核人。 */
|
||||||
|
const reviewer = ref('')
|
||||||
|
/** 环境修订的本集逐字片段,不预填、不存入草案或本地授权。 */
|
||||||
|
const environmentQuote = ref('')
|
||||||
|
/** 当前预检经人工明确确认。 */
|
||||||
|
const acknowledged = ref(false)
|
||||||
|
/** 同步保存或正式采用期间锁定底栏和输入。 */
|
||||||
|
const saving = ref(false)
|
||||||
|
/** 只让当前写入操作显示加载,其它底栏操作仅禁用。 */
|
||||||
|
const savingKind = ref<'save' | 'adopt' | null>(null)
|
||||||
|
/** 免费读取的当前动作,避免两个按钮同时显示加载。 */
|
||||||
|
const previewKind = ref<'input' | 'adoption' | null>(null)
|
||||||
|
/** 免费预览与联合预检不阻止用户关闭。 */
|
||||||
|
const previewing = ref(false)
|
||||||
|
/** 已核对的草案画面输入,只能用于草案。 */
|
||||||
|
const preview = ref<ShotDraftPreview | null>(null)
|
||||||
|
/** 采用后独立读取的正式首帧预览,不能沿用草案指纹。 */
|
||||||
|
const formalPreview = ref<KeyframeGenerationPreview | null>(null)
|
||||||
|
/** 冻结同一审核人、完整草案、邻镜及差异,正式采用不重建请求。 */
|
||||||
|
const checked = ref<{ reviewer: string; shots: DerivedReviewSelection[]; result: JointDerivedReviewResult } | null>(
|
||||||
|
null
|
||||||
|
)
|
||||||
|
/** 当前采用回执与草案保存状态分开。 */
|
||||||
|
const adopted = ref<JointDerivedReviewResult | null>(null)
|
||||||
|
/** 409或连接未知后要求显式读取,不自动覆盖或重提。 */
|
||||||
|
const conflict = ref(false)
|
||||||
|
/** 表单问题仅在主动操作后展示。 */
|
||||||
|
const validation = ref('')
|
||||||
|
/** 当前项目与镜头共同隔离。 */
|
||||||
|
const key = computed(() => JSON.stringify([props.projectId, props.episodeNo, props.shot.shotId]))
|
||||||
|
/** 原正式摄影、状态、保存草案及首帧来源共用读取,不推测缺失字段。 */
|
||||||
|
const source = useQuery(key, async (value, signal) => {
|
||||||
|
const [projectId, episodeNo, shotId] = JSON.parse(value) as [string, number, string]
|
||||||
|
const [saved, approval, directions, visuals, keyframe] = await Promise.all([
|
||||||
|
derivedReviewApi.draft(projectId, shotId, signal),
|
||||||
|
preparationApi.approval(projectId, signal),
|
||||||
|
storyboardApi.directions(projectId, episodeNo, signal),
|
||||||
|
storyboardApi.visualStates(projectId, episodeNo, signal),
|
||||||
|
productionApi.keyframeSpec(shotId, signal, projectId)
|
||||||
|
])
|
||||||
|
if (
|
||||||
|
!currentStoryboardApproval(approval, projectId) ||
|
||||||
|
keyframe?.shotId !== shotId ||
|
||||||
|
keyframe.projectId !== projectId ||
|
||||||
|
keyframe.episodeNo !== episodeNo ||
|
||||||
|
!keyframe.formalSourceFingerprint
|
||||||
|
)
|
||||||
|
throw new Error('当前正式来源或审核无法核对,请重新读取。')
|
||||||
|
if (saved && saved.shotId !== shotId) throw new Error('已保存草案不属于当前镜头。')
|
||||||
|
if (
|
||||||
|
directions?.projectId !== projectId ||
|
||||||
|
directions.episodeNo !== episodeNo ||
|
||||||
|
visuals?.projectId !== projectId ||
|
||||||
|
visuals.episodeNo !== episodeNo
|
||||||
|
)
|
||||||
|
throw new Error('正式摄影状态不属于当前项目或剧集。')
|
||||||
|
const rows = mergeDesignedShots(directions, visuals)
|
||||||
|
const shot = rows.find(row => row.shotId === shotId)
|
||||||
|
if (!shot?.direction || !shot.visualState) throw new Error('联合采用需要已有正式摄影和画面状态,不能填充空状态。')
|
||||||
|
return {
|
||||||
|
saved,
|
||||||
|
formal: draftFromFormal(shot, keyframe, approval.confirmation!.shotFingerprint),
|
||||||
|
shot,
|
||||||
|
rows,
|
||||||
|
keyframe
|
||||||
|
}
|
||||||
|
})
|
||||||
|
/** 原保存记录的修订和状态只由正式GET更新。 */
|
||||||
|
const saved = computed(() => source.data.value?.saved)
|
||||||
|
/** 全部变化都展示,越界变化不能通过过滤后提交。 */
|
||||||
|
const differences = computed(() =>
|
||||||
|
source.data.value && draft.value ? jointDraftDifferences(source.data.value.formal, draft.value) : []
|
||||||
|
)
|
||||||
|
/** 只有真实环境差异才读取本集全文,原摄影模式不增加查询。 */
|
||||||
|
const hasEnvironmentChanges = computed(() => differences.value.some(item => item.change?.target === 'environment'))
|
||||||
|
/** 原项目、剧集和镜头隔离本集原文读取。 */
|
||||||
|
const environmentKey = computed(() => (hasEnvironmentChanges.value ? key.value : ''))
|
||||||
|
/** 正式项目详情公开完整content,原字节计算SHA,最终外键归属由原采用事务核对。 */
|
||||||
|
const environmentSource = useQuery(environmentKey, async (value, signal) => {
|
||||||
|
if (!value) return null
|
||||||
|
const [projectId, episodeNo] = JSON.parse(value) as [string, number, string]
|
||||||
|
const project = await projectsApi.detail(projectId, signal)
|
||||||
|
if (project?.id !== projectId || !Array.isArray(project.episodes))
|
||||||
|
throw new Error('本集正式原文无法读取,请刷新后核对。')
|
||||||
|
const matches = project.episodes.filter(episode => episode.episode === episodeNo)
|
||||||
|
const episode = matches[0]
|
||||||
|
if (
|
||||||
|
matches.length !== 1 ||
|
||||||
|
typeof episode?.id !== 'string' ||
|
||||||
|
!episode.id.trim() ||
|
||||||
|
episode.projectId !== projectId ||
|
||||||
|
typeof episode.content !== 'string'
|
||||||
|
)
|
||||||
|
throw new Error('缺少本集正式身份或全文,不能使用摘要代替环境依据。')
|
||||||
|
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(episode.content))
|
||||||
|
return {
|
||||||
|
episodeId: episode.id,
|
||||||
|
title: episode.title,
|
||||||
|
content: episode.content,
|
||||||
|
expectedContentFingerprint: Array.from(new Uint8Array(digest), byte => byte.toString(16).padStart(2, '0')).join(
|
||||||
|
''
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
/** 片段必须逐字出自已读本集全文,匹配仅证明来源和版本,不证明环境语义正确。 */
|
||||||
|
const environmentEvidence = computed(() => {
|
||||||
|
const original = environmentSource.data.value,
|
||||||
|
quote = environmentQuote.value.trim()
|
||||||
|
if (!original || !quote || quote.length > 4000 || !original.content.includes(quote)) return null
|
||||||
|
return { episodeId: original.episodeId, expectedContentFingerprint: original.expectedContentFingerprint, quote }
|
||||||
|
})
|
||||||
|
/** 环境差异缺证、读取失败或刷新期间不开放预检及采用,普通草案保存仍独立。 */
|
||||||
|
const environmentReady = computed(
|
||||||
|
() =>
|
||||||
|
!hasEnvironmentChanges.value ||
|
||||||
|
(!!environmentEvidence.value && !environmentSource.loading.value && !environmentSource.error.value)
|
||||||
|
)
|
||||||
|
/** 同一已保存版本、完整内容和来源匹配后才有联合采用资格。 */
|
||||||
|
const savedMatches = computed(
|
||||||
|
() =>
|
||||||
|
!!saved.value &&
|
||||||
|
saved.value.status === 'current' &&
|
||||||
|
!!draft.value &&
|
||||||
|
jointValue(saved.value.draft) === jointValue(draft.value)
|
||||||
|
)
|
||||||
|
/** 合法白名单之外的差异及其它模式不能混入联合采用。 */
|
||||||
|
const bounded = computed(
|
||||||
|
() =>
|
||||||
|
differences.value.length > 0 &&
|
||||||
|
differences.value.length <= 40 &&
|
||||||
|
differences.value.every(item => item.allowed && item.before.length <= 4000 && item.after.length <= 4000) &&
|
||||||
|
!draft.value?.subjectStateRevision &&
|
||||||
|
!draft.value?.sceneStateCarryForward
|
||||||
|
)
|
||||||
|
/** 超出正式联合契约时解释禁用原因,保留完整原稿供核对。 */
|
||||||
|
const boundaryNotice = computed(() => {
|
||||||
|
if (draft.value?.subjectStateRevision || draft.value?.sceneStateCarryForward)
|
||||||
|
return '当前草案包含其它修订模式,请在原模式核对;联合采用不能混合提交。'
|
||||||
|
if (differences.value.length > 40) return '本次差异超过40项,请缩小联合修订范围后重新保存。'
|
||||||
|
if (differences.value.some(item => item.before.length > 4000 || item.after.length > 4000))
|
||||||
|
return '存在超过4000字的字段差异,请核对完整内容并缩小本次修订范围。'
|
||||||
|
if (differences.value.some(item => !item.allowed)) return '存在不允许联合修改的事实,请核对下方完整差异。'
|
||||||
|
return ''
|
||||||
|
})
|
||||||
|
/** 中文消息与原页面共用。 */
|
||||||
|
const message = useActionMessage()
|
||||||
|
/** 免费请求的取消控制器。 */
|
||||||
|
let controller: AbortController | undefined
|
||||||
|
/** 编辑、切换或重新读取来源后立即废弃旧预检。 */
|
||||||
|
function clearPreview() {
|
||||||
|
controller?.abort()
|
||||||
|
preview.value = null
|
||||||
|
checked.value = null
|
||||||
|
acknowledged.value = false
|
||||||
|
previewing.value = false
|
||||||
|
previewKind.value = null
|
||||||
|
validation.value = ''
|
||||||
|
}
|
||||||
|
watch([draft, providerInput], clearPreview, { deep: true, flush: 'sync' })
|
||||||
|
/** 署名和修订依据改变只撤销采用确认,原画面输入仍须相同。 */
|
||||||
|
watch(
|
||||||
|
[reason, reviewer, environmentQuote, environmentSource.data, environmentSource.loading],
|
||||||
|
() => {
|
||||||
|
controller?.abort()
|
||||||
|
checked.value = null
|
||||||
|
acknowledged.value = false
|
||||||
|
previewing.value = false
|
||||||
|
validation.value = ''
|
||||||
|
},
|
||||||
|
{ flush: 'sync' }
|
||||||
|
)
|
||||||
|
watch(
|
||||||
|
key,
|
||||||
|
() => {
|
||||||
|
clearPreview()
|
||||||
|
initialized.value = false
|
||||||
|
draft.value = null
|
||||||
|
providerInput.value = undefined
|
||||||
|
reason.value = ''
|
||||||
|
reviewer.value = ''
|
||||||
|
environmentQuote.value = ''
|
||||||
|
adopted.value = null
|
||||||
|
formalPreview.value = null
|
||||||
|
conflict.value = false
|
||||||
|
},
|
||||||
|
{ flush: 'sync' }
|
||||||
|
)
|
||||||
|
watch(source.data, value => {
|
||||||
|
clearPreview()
|
||||||
|
if (value && !initialized.value) {
|
||||||
|
draft.value = JSON.parse(JSON.stringify(value.saved?.draft ?? value.formal))
|
||||||
|
providerInput.value = value.saved?.providerInput ?? undefined
|
||||||
|
initialized.value = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
onScopeDispose(clearPreview)
|
||||||
|
/** 原记录有错误或来源读取中时不放行任何写入。 */
|
||||||
|
const canSave = computed(
|
||||||
|
() =>
|
||||||
|
!!draft.value &&
|
||||||
|
!!source.data.value &&
|
||||||
|
!source.error.value &&
|
||||||
|
!source.loading.value &&
|
||||||
|
!props.disabled &&
|
||||||
|
!saving.value &&
|
||||||
|
!previewing.value &&
|
||||||
|
!adopted.value
|
||||||
|
)
|
||||||
|
/** 正式采用仅接收同一份已核对快照。 */
|
||||||
|
const canAdopt = computed(
|
||||||
|
() =>
|
||||||
|
!!checked.value &&
|
||||||
|
acknowledged.value &&
|
||||||
|
!saving.value &&
|
||||||
|
!props.disabled &&
|
||||||
|
!conflict.value &&
|
||||||
|
!source.error.value &&
|
||||||
|
!source.loading.value &&
|
||||||
|
environmentReady.value &&
|
||||||
|
!adopted.value
|
||||||
|
)
|
||||||
|
/**
|
||||||
|
* 明确从当前正式内容重新开始,原已保存草案和历史保持。
|
||||||
|
*/
|
||||||
|
function editFormal() {
|
||||||
|
if (!source.data.value || saving.value) return
|
||||||
|
draft.value = JSON.parse(JSON.stringify(source.data.value.formal))
|
||||||
|
adopted.value = null
|
||||||
|
formalPreview.value = null
|
||||||
|
conflict.value = false
|
||||||
|
}
|
||||||
|
/** 显式重读原版本,保留当前人工草案,不自动重存或采用。 */
|
||||||
|
async function reload() {
|
||||||
|
clearPreview()
|
||||||
|
await Promise.all([source.refresh(), ...(hasEnvironmentChanges.value ? [environmentSource.refresh()] : [])])
|
||||||
|
if (!source.error.value) conflict.value = false
|
||||||
|
}
|
||||||
|
/** 显式保存完整原稿,保存成功不能表示采用成功。 */
|
||||||
|
async function save() {
|
||||||
|
if (!canSave.value || !draft.value || !source.data.value) return
|
||||||
|
const target = key.value
|
||||||
|
savingKind.value = 'save'
|
||||||
|
saving.value = true
|
||||||
|
clearPreview()
|
||||||
|
try {
|
||||||
|
const result = await derivedReviewApi.saveDraft(props.projectId, props.shot.shotId, {
|
||||||
|
expectedRevision: saved.value?.revision ?? null,
|
||||||
|
draft: JSON.parse(JSON.stringify(draft.value)),
|
||||||
|
...(providerInput.value ? { providerInput: providerInput.value } : {}),
|
||||||
|
expectedCurrentFormalSourceFingerprint: source.data.value.keyframe.formalSourceFingerprint
|
||||||
|
})
|
||||||
|
if (target !== key.value) return
|
||||||
|
if (result?.shotId !== props.shot.shotId || !Number.isSafeInteger(result.revision))
|
||||||
|
throw new Error('保存回执无法核对,请读取原草案。')
|
||||||
|
source.data.value = { ...source.data.value!, saved: result }
|
||||||
|
message?.success('联合草案已保存,尚未正式采用')
|
||||||
|
} catch (cause) {
|
||||||
|
if (target === key.value) {
|
||||||
|
conflict.value = cause instanceof ApiError && cause.status === 409
|
||||||
|
message?.error(errorMessage(cause))
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
saving.value = false
|
||||||
|
savingKind.value = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** 免费核对完整草案的正式画面输入和本镜/邻镜版本。 */
|
||||||
|
async function loadPreview() {
|
||||||
|
if (!canSave.value || !savedMatches.value || !bounded.value || !draft.value) {
|
||||||
|
validation.value = '请先保存同一完整草案,并核对全部差异;越界变化不能联合采用。'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
clearPreview()
|
||||||
|
const pending = new AbortController()
|
||||||
|
controller = pending
|
||||||
|
previewKind.value = 'input'
|
||||||
|
previewing.value = true
|
||||||
|
const target = key.value
|
||||||
|
try {
|
||||||
|
const result = await derivedReviewApi.preview(
|
||||||
|
props.shot.shotId,
|
||||||
|
JSON.parse(JSON.stringify(draft.value)),
|
||||||
|
providerInput.value ?? {},
|
||||||
|
pending.signal,
|
||||||
|
props.projectId
|
||||||
|
)
|
||||||
|
if (pending.signal.aborted || target !== key.value) return
|
||||||
|
if (
|
||||||
|
result?.shotId !== props.shot.shotId ||
|
||||||
|
result.productionReady !== false ||
|
||||||
|
!/^[a-f0-9]{64}$/.test(result.draftFingerprint) ||
|
||||||
|
!/^[a-f0-9]{64}$/.test(result.currentDerivedFingerprint ?? '') ||
|
||||||
|
!Array.isArray(result.adjacentDerivedVersions) ||
|
||||||
|
result.adjacentDerivedVersions.length > 2 ||
|
||||||
|
new Set(result.adjacentDerivedVersions.map(row => row.shotId)).size !==
|
||||||
|
result.adjacentDerivedVersions.length ||
|
||||||
|
result.adjacentDerivedVersions.some(row => !row.shotId || !/^[a-f0-9]{64}$/.test(row.derivedFingerprint))
|
||||||
|
)
|
||||||
|
throw new Error('草案预览缺少当前摄影或完整邻镜版本,不能联合采用。')
|
||||||
|
const rows = source.data.value?.rows ?? [],
|
||||||
|
index = rows.findIndex(shot => shot.shotId === props.shot.shotId)
|
||||||
|
const neighbors = [rows[index - 1]?.shotId, rows[index + 1]?.shotId].filter(
|
||||||
|
(shotId): shotId is string => !!shotId
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
result.adjacentDerivedVersions.length !== neighbors.length ||
|
||||||
|
result.adjacentDerivedVersions.some(row => !neighbors.includes(row.shotId))
|
||||||
|
)
|
||||||
|
throw new Error('邻镜列表与当前正式顺序不一致,请重新读取完整来源。')
|
||||||
|
preview.value = result
|
||||||
|
} catch (cause) {
|
||||||
|
if (!pending.signal.aborted && target === key.value) message?.error(errorMessage(cause))
|
||||||
|
} finally {
|
||||||
|
if (controller === pending) {
|
||||||
|
previewing.value = false
|
||||||
|
previewKind.value = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** 免费预检完整采用条件,冻结同一保存版本、差异和邻镜,不写正式记录。 */
|
||||||
|
async function preflight() {
|
||||||
|
if (!environmentReady.value) {
|
||||||
|
validation.value = '请先读取本集完整原文并填写匹配的逐字片段,人工核对环境修改依据。'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!preview.value ||
|
||||||
|
!savedMatches.value ||
|
||||||
|
!bounded.value ||
|
||||||
|
!reason.value.trim() ||
|
||||||
|
!reviewer.value.trim() ||
|
||||||
|
saving.value ||
|
||||||
|
previewing.value ||
|
||||||
|
conflict.value ||
|
||||||
|
props.disabled ||
|
||||||
|
!draft.value ||
|
||||||
|
!source.data.value
|
||||||
|
) {
|
||||||
|
validation.value = '请先核对已保存草案的画面输入,并填写审核人与联合修订依据。'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const shots: DerivedReviewSelection[] = [
|
||||||
|
{
|
||||||
|
...providerInput.value,
|
||||||
|
shotId: props.shot.shotId,
|
||||||
|
draft: JSON.parse(JSON.stringify(draft.value)),
|
||||||
|
expectedDraftFingerprint: preview.value.draftFingerprint,
|
||||||
|
expectedCurrentFormalSourceFingerprint: source.data.value.keyframe.formalSourceFingerprint,
|
||||||
|
jointRevision: {
|
||||||
|
expectedDraftRevision: saved.value!.revision,
|
||||||
|
expectedDerivedFingerprint: preview.value.currentDerivedFingerprint!,
|
||||||
|
expectedNeighbors: JSON.parse(JSON.stringify(preview.value.adjacentDerivedVersions)),
|
||||||
|
reason: reason.value.trim(),
|
||||||
|
...(hasEnvironmentChanges.value ? { environmentSource: { ...environmentEvidence.value! } } : {}),
|
||||||
|
changes: differences.value.map(item => item.change!)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
const author = reviewer.value.trim()
|
||||||
|
const target = key.value
|
||||||
|
const pending = new AbortController()
|
||||||
|
controller = pending
|
||||||
|
previewKind.value = 'adoption'
|
||||||
|
previewing.value = true
|
||||||
|
checked.value = null
|
||||||
|
acknowledged.value = false
|
||||||
|
try {
|
||||||
|
const result = await derivedReviewApi.joint(
|
||||||
|
props.projectId,
|
||||||
|
{ preview: true, reviewer: author, shots },
|
||||||
|
pending.signal
|
||||||
|
)
|
||||||
|
if (pending.signal.aborted || target !== key.value) return
|
||||||
|
if (
|
||||||
|
result?.projectId !== props.projectId ||
|
||||||
|
!result.preview ||
|
||||||
|
!/^[a-f0-9]{64}$/.test(result.requestFingerprint) ||
|
||||||
|
!result.shots?.some(shot => shot.shotId === props.shot.shotId)
|
||||||
|
)
|
||||||
|
throw new Error('联合预检回执不完整,尚不能采用。')
|
||||||
|
checked.value = { reviewer: author, shots, result }
|
||||||
|
message?.success('联合采用免费预检通过,尚未正式采用')
|
||||||
|
} catch (cause) {
|
||||||
|
if (!pending.signal.aborted && target === key.value) {
|
||||||
|
conflict.value = cause instanceof ApiError && cause.status === 409
|
||||||
|
message?.error(errorMessage(cause))
|
||||||
|
if (conflict.value)
|
||||||
|
await Promise.all([
|
||||||
|
source.refresh(),
|
||||||
|
...(hasEnvironmentChanges.value ? [environmentSource.refresh()] : [])
|
||||||
|
])
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (controller === pending) {
|
||||||
|
previewing.value = false
|
||||||
|
previewKind.value = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** 用户明确采用冻结请求;成功后仅刷新正式来源及原首帧预览。 */
|
||||||
|
async function adopt() {
|
||||||
|
if (!canAdopt.value || !checked.value) return
|
||||||
|
const frozen = checked.value
|
||||||
|
const projectId = props.projectId
|
||||||
|
const shotId = props.shot.shotId
|
||||||
|
const target = key.value
|
||||||
|
savingKind.value = 'adopt'
|
||||||
|
saving.value = true
|
||||||
|
try {
|
||||||
|
let result: JointDerivedReviewResult | undefined
|
||||||
|
const ok = await runOperation(projectId, '采用联合摄影与开拍状态', async () => {
|
||||||
|
result = await derivedReviewApi.joint(projectId, {
|
||||||
|
preview: false,
|
||||||
|
reviewer: frozen.reviewer,
|
||||||
|
shots: frozen.shots
|
||||||
|
})
|
||||||
|
if (
|
||||||
|
result?.projectId !== projectId ||
|
||||||
|
result.preview ||
|
||||||
|
!result.shots?.some(shot => shot.shotId === shotId) ||
|
||||||
|
!(result.changed || result.reused)
|
||||||
|
)
|
||||||
|
throw new Error('采用回执待核对,请先读取正式内容,不要重复提交。')
|
||||||
|
})
|
||||||
|
if (target !== key.value) return
|
||||||
|
if (!ok) {
|
||||||
|
const operation = getOperation(projectId)
|
||||||
|
conflict.value = true
|
||||||
|
clearPreview()
|
||||||
|
message?.error(operation.error)
|
||||||
|
await Promise.all([source.refresh(), ...(hasEnvironmentChanges.value ? [environmentSource.refresh()] : [])])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
adopted.value = result!
|
||||||
|
clearPreview()
|
||||||
|
emit('changed')
|
||||||
|
message?.success('已正式采用联合修订,尚未生成图片或通过视觉审核')
|
||||||
|
await source.refresh()
|
||||||
|
try {
|
||||||
|
formalPreview.value = await productionApi.previewKeyframe(shotId, providerInput.value ?? {})
|
||||||
|
if (target !== key.value) formalPreview.value = null
|
||||||
|
} catch (cause) {
|
||||||
|
if (target === key.value) message?.warning('联合采用已完成,正式首帧预览尚未刷新:' + errorMessage(cause))
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
saving.value = false
|
||||||
|
savingKind.value = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** 同一抽屉固定底栏复用当前模式操作。 */
|
||||||
|
defineExpose({ saving, savingKind, canSave, canAdopt, save, adopt })
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<!-- 以下是联合模式的来源与已保存原稿,技术版本默认收起。 -->
|
||||||
|
<div class="workspace-section-stack">
|
||||||
|
<WorkspaceSectionHeading
|
||||||
|
title="摄影与开拍状态联合修订"
|
||||||
|
description="保留主体、形态与动作事实。环境变化需本集原文依据,保存与正式采用分别执行。"
|
||||||
|
/>
|
||||||
|
<NButton class="self-start" :disabled="saving" :loading="source.loading.value" @click="reload"
|
||||||
|
>重新读取正式来源与草案</NButton
|
||||||
|
>
|
||||||
|
<p v-if="source.loading.value" role="status">正在核对完整正式来源…</p>
|
||||||
|
<p v-if="source.error.value" role="alert">{{ source.error.value }}</p>
|
||||||
|
<p v-if="saved" class="text-sm">
|
||||||
|
已保存第 {{ saved.revision }} 版 ·
|
||||||
|
{{
|
||||||
|
saved.status === 'current'
|
||||||
|
? '来源当前有效'
|
||||||
|
: saved.staleReason
|
||||||
|
? userFacingText(saved.staleReason)
|
||||||
|
: '原草案来源已变化,请重新核对'
|
||||||
|
}}。保存记录不代表正式采用。
|
||||||
|
</p>
|
||||||
|
<p v-if="conflict" role="alert">
|
||||||
|
来源、草案或相邻镜头版本发生冲突。当前输入已保留,请重新读取并核对后再次免费预检。
|
||||||
|
</p>
|
||||||
|
<p v-if="adopted" role="status">
|
||||||
|
{{
|
||||||
|
adopted.reused ? '同一联合修订已采用,本次为幂等回读。' : '联合修订已正式采用。'
|
||||||
|
}}原草案和历史保留;图片生成、视觉审核及主图确认仍须分别操作。
|
||||||
|
</p>
|
||||||
|
<template v-if="draft && source.data.value">
|
||||||
|
<NButton class="self-start" :disabled="saving" @click="editFormal">从当前正式内容重新编辑</NButton>
|
||||||
|
<NCollapse
|
||||||
|
><NCollapseItem
|
||||||
|
name="formal"
|
||||||
|
:title="adopted ? '采用后:当前正式摄影与开拍状态' : '修改前:正式摄影与开拍状态'"
|
||||||
|
><ShotDesign :shot="source.data.value.shot"
|
||||||
|
/></NCollapseItem>
|
||||||
|
<NCollapseItem name="history" title="原草案与摄影历史"
|
||||||
|
><RawDataDetails
|
||||||
|
:value="{ 草案: saved, 原摄影原文: source.data.value.shot.direction?.rawJson }"
|
||||||
|
title="高级详情" /></NCollapseItem
|
||||||
|
></NCollapse>
|
||||||
|
<section class="workspace-section-stack">
|
||||||
|
<WorkspaceSectionHeading
|
||||||
|
:title="adopted ? '已采用的完整草案' : '修改后:待审完整草案'"
|
||||||
|
/><JointDraftFields v-model="draft" :disabled="saving || !!adopted" />
|
||||||
|
</section>
|
||||||
|
<!-- 以下是全部字段前后差异,越界项明确阻止联合采用。 -->
|
||||||
|
<section class="workspace-section-stack" aria-label="完整联合差异">
|
||||||
|
<WorkspaceSectionHeading :title="`完整字段差异(${differences.length} 项)`" />
|
||||||
|
<p v-if="boundaryNotice" class="text-sm" role="status">{{ boundaryNotice }}</p>
|
||||||
|
<p v-if="!differences.length" class="text-sm text-muted">与当前正式内容相同。</p>
|
||||||
|
<article v-for="(item, index) in differences" :key="index" class="space-y-2 text-sm">
|
||||||
|
<h4 class="font-medium">{{ item.label }}{{ item.allowed ? '' : ' · 不允许联合修改' }}</h4>
|
||||||
|
<p class="whitespace-pre-wrap wrap-anywhere">修改前:{{ item.before || '(空)' }}</p>
|
||||||
|
<p class="whitespace-pre-wrap wrap-anywhere">修改后:{{ item.after || '(空)' }}</p>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
<!-- 以下是存在环境差异时的本集正式全文与人工证据,技术版本默认收起。 -->
|
||||||
|
<section v-if="hasEnvironmentChanges" class="workspace-section-stack" aria-label="本集原文依据">
|
||||||
|
<WorkspaceSectionHeading
|
||||||
|
title="本集原文依据"
|
||||||
|
description="原文及版本匹配不等于机器语义审核通过,请人工核对环境变化。"
|
||||||
|
/>
|
||||||
|
<NButton
|
||||||
|
class="self-start"
|
||||||
|
:disabled="saving"
|
||||||
|
:loading="environmentSource.loading.value"
|
||||||
|
@click="environmentSource.refresh"
|
||||||
|
>刷新本集原文</NButton
|
||||||
|
>
|
||||||
|
<p v-if="environmentSource.loading.value" class="text-sm" role="status">正在读取本集完整原文…</p>
|
||||||
|
<p v-if="environmentSource.error.value" class="text-sm" role="alert">
|
||||||
|
{{ environmentSource.error.value }}
|
||||||
|
</p>
|
||||||
|
<template v-if="environmentSource.data.value">
|
||||||
|
<NCollapse
|
||||||
|
><NCollapseItem
|
||||||
|
name="episode-original"
|
||||||
|
:title="`第 ${episodeNo} 集 · ${environmentSource.data.value.title} · 完整原文`"
|
||||||
|
>
|
||||||
|
<p class="text-sm whitespace-pre-wrap wrap-anywhere">
|
||||||
|
{{ environmentSource.data.value.content }}
|
||||||
|
</p>
|
||||||
|
</NCollapseItem></NCollapse
|
||||||
|
>
|
||||||
|
<RawDataDetails
|
||||||
|
:value="{
|
||||||
|
episodeId: environmentSource.data.value.episodeId,
|
||||||
|
expectedContentFingerprint: environmentSource.data.value.expectedContentFingerprint
|
||||||
|
}"
|
||||||
|
title="本集身份与正文版本"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<label class="workspace-form-field"
|
||||||
|
><span>本集原文片段(逐字引用)</span>
|
||||||
|
<NInput
|
||||||
|
v-model:value="environmentQuote"
|
||||||
|
type="textarea"
|
||||||
|
:maxlength="4000"
|
||||||
|
:disabled="saving"
|
||||||
|
placeholder="从本集完整原文复制支持本次修改的片段"
|
||||||
|
aria-label="环境原文片段"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<p
|
||||||
|
v-if="!environmentReady && !environmentSource.loading.value && !environmentSource.error.value"
|
||||||
|
class="text-sm text-muted"
|
||||||
|
>
|
||||||
|
填写匹配的本集片段后可免费预检。
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
<NButton
|
||||||
|
class="self-start"
|
||||||
|
:disabled="saving || !savedMatches || !bounded || !!adopted"
|
||||||
|
:loading="previewing && previewKind === 'input'"
|
||||||
|
@click="loadPreview"
|
||||||
|
>免费核对草案画面输入</NButton
|
||||||
|
>
|
||||||
|
<!-- 以下是邻镜正式版本及静态衔接依据,不当作真实视频末态。 -->
|
||||||
|
<section v-if="preview" class="workspace-section-stack" aria-label="联合相邻镜头依据">
|
||||||
|
<WorkspaceSectionHeading
|
||||||
|
title="相邻镜头依据"
|
||||||
|
description="下列是正式静态输入与版本,不能证明尚未验证的真实视频末态。"
|
||||||
|
/>
|
||||||
|
<p v-if="!preview.adjacentDerivedVersions?.length" class="text-sm">本镜没有同集紧邻镜头。</p>
|
||||||
|
<article
|
||||||
|
v-for="neighbor in preview.adjacentDerivedVersions"
|
||||||
|
:key="neighbor.shotId"
|
||||||
|
class="space-y-2 text-sm"
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
镜头 {{ props.shots.find(shot => shot.shotId === neighbor.shotId)?.beatNo ?? '待确认' }}.{{
|
||||||
|
props.shots.find(shot => shot.shotId === neighbor.shotId)?.shotNo ?? '待确认'
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
<p class="whitespace-pre-wrap">
|
||||||
|
{{
|
||||||
|
source.data.value.rows.find(shot => shot.shotId === neighbor.shotId)?.visualState
|
||||||
|
?.continuityNote || '尚无已保存衔接说明。'
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
<RawDataDetails :value="neighbor" title="相邻镜头版本详情" />
|
||||||
|
</article>
|
||||||
|
<ImageGenerationPreview
|
||||||
|
:preview="{ ...preview, previewFingerprint: preview.draftFingerprint }"
|
||||||
|
:loading="false"
|
||||||
|
error=""
|
||||||
|
stale-notice=""
|
||||||
|
display-only
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
<label class="workspace-form-field"
|
||||||
|
><span>联合修订与剪辑依据</span
|
||||||
|
><NInput
|
||||||
|
v-model:value="reason"
|
||||||
|
type="textarea"
|
||||||
|
:maxlength="4000"
|
||||||
|
:disabled="saving"
|
||||||
|
aria-label="联合修订依据"
|
||||||
|
/></label>
|
||||||
|
<label class="workspace-form-field"
|
||||||
|
><span>审核人</span
|
||||||
|
><NInput v-model:value="reviewer" :maxlength="120" :disabled="saving" aria-label="联合审核人"
|
||||||
|
/></label>
|
||||||
|
<NButton
|
||||||
|
class="self-start"
|
||||||
|
:disabled="
|
||||||
|
!preview || !bounded || !savedMatches || !environmentReady || saving || conflict || !!adopted
|
||||||
|
"
|
||||||
|
:loading="previewing && previewKind === 'adoption'"
|
||||||
|
@click="preflight"
|
||||||
|
>免费预检联合采用</NButton
|
||||||
|
>
|
||||||
|
<NCheckbox v-if="checked" v-model:checked="acknowledged" :disabled="saving"
|
||||||
|
>我已核对全部差异、相邻镜头版本和剪辑依据,确认采用这份草案。</NCheckbox
|
||||||
|
>
|
||||||
|
<ImageGenerationPreview
|
||||||
|
v-if="formalPreview"
|
||||||
|
:preview="formalPreview"
|
||||||
|
:loading="false"
|
||||||
|
error=""
|
||||||
|
stale-notice=""
|
||||||
|
display-only
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<p v-if="validation" role="alert" class="text-sm">{{ validation }}</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import VisualStateContinuity from './VisualStateContinuity.vue'
|
||||||
|
import JointDraftReviewPanel from './JointDraftReviewPanel.vue'
|
||||||
import DirectionCameraFields from './DirectionCameraFields.vue'
|
import DirectionCameraFields from './DirectionCameraFields.vue'
|
||||||
import DirectionStageReview from './DirectionStageReview.vue'
|
import DirectionStageReview from './DirectionStageReview.vue'
|
||||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||||
@@ -40,6 +42,10 @@ const props = defineProps<{
|
|||||||
}>()
|
}>()
|
||||||
/** 采用后刷新现有分镜设计数据。 */
|
/** 采用后刷新现有分镜设计数据。 */
|
||||||
const emit = defineEmits<{ changed: [] }>()
|
const emit = defineEmits<{ changed: [] }>()
|
||||||
|
/** 同一摄影抽屉内的联合模式,不创建第二个页面或弹层。 */
|
||||||
|
const jointMode = ref(false)
|
||||||
|
/** 联合模式底栏复用原抽屉。 */
|
||||||
|
const jointPanel = ref<InstanceType<typeof JointDraftReviewPanel> | null>(null)
|
||||||
/** 当前人工审核抽屉。 */
|
/** 当前人工审核抽屉。 */
|
||||||
const open = ref(false)
|
const open = ref(false)
|
||||||
/** 在同一摄影入口切换受控修订与场景沿用。 */
|
/** 在同一摄影入口切换受控修订与场景沿用。 */
|
||||||
@@ -92,7 +98,7 @@ const saving = ref(false)
|
|||||||
const message = useActionMessage()
|
const message = useActionMessage()
|
||||||
/** 关闭或切换镜头后撤销旧读取。 */
|
/** 关闭或切换镜头后撤销旧读取。 */
|
||||||
const key = computed(() =>
|
const key = computed(() =>
|
||||||
open.value && !directionOnly.value ? JSON.stringify([props.projectId, props.shot.shotId]) : ''
|
open.value && !directionOnly.value && !jointMode.value ? JSON.stringify([props.projectId, props.shot.shotId]) : ''
|
||||||
)
|
)
|
||||||
/** 服务端草案单独读取,不阻塞外部草案的免费预览。 */
|
/** 服务端草案单独读取,不阻塞外部草案的免费预览。 */
|
||||||
const savedDraft = useQuery(key, async (value, signal) => {
|
const savedDraft = useQuery(key, async (value, signal) => {
|
||||||
@@ -557,13 +563,29 @@ async function adopt() {
|
|||||||
<NButton class="workspace-action-button" @click="open = true">摄影草案与审核</NButton>
|
<NButton class="workspace-action-button" @click="open = true">摄影草案与审核</NButton>
|
||||||
<AppDrawer
|
<AppDrawer
|
||||||
v-model:open="open"
|
v-model:open="open"
|
||||||
:busy="saving || savingDraft || directionEditor?.saving"
|
:busy="saving || savingDraft || directionEditor?.saving || jointPanel?.saving"
|
||||||
title="摄影草案与审核"
|
title="摄影草案与审核"
|
||||||
:description="`第 ${episodeNo} 集 · 镜头 ${shot.beatNo}.${shot.shotNo} · ${shot.title}`"
|
:description="`第 ${episodeNo} 集 · 镜头 ${shot.beatNo}.${shot.shotNo} · ${shot.title}`"
|
||||||
>
|
>
|
||||||
|
<!-- 以下是原审核入口内的模式切换,不改变原组合或独立摄影能力。 -->
|
||||||
|
<div v-if="formal" class="mb-5 flex flex-wrap gap-3">
|
||||||
|
<NButton :disabled="saving || savingDraft || jointPanel?.saving" @click="jointMode = !jointMode">{{
|
||||||
|
jointMode ? '返回原摄影修订' : '联合修订摄影与开拍状态'
|
||||||
|
}}</NButton>
|
||||||
|
</div>
|
||||||
|
<JointDraftReviewPanel
|
||||||
|
v-if="open && jointMode && formal"
|
||||||
|
ref="jointPanel"
|
||||||
|
:project-id="projectId"
|
||||||
|
:episode-no="episodeNo"
|
||||||
|
:shot="shot"
|
||||||
|
:shots="shots"
|
||||||
|
:disabled="disabled"
|
||||||
|
@changed="emit('changed')"
|
||||||
|
/>
|
||||||
<!-- 以下是画面状态生成之前的独立摄影阶段,原组合流程仍在同一抽屉。 -->
|
<!-- 以下是画面状态生成之前的独立摄影阶段,原组合流程仍在同一抽屉。 -->
|
||||||
<DirectionStageReview
|
<DirectionStageReview
|
||||||
v-if="open && directionOnly"
|
v-else-if="open && directionOnly"
|
||||||
ref="directionEditor"
|
ref="directionEditor"
|
||||||
:project-id="projectId"
|
:project-id="projectId"
|
||||||
:episode-no="episodeNo"
|
:episode-no="episodeNo"
|
||||||
@@ -822,9 +844,11 @@ async function adopt() {
|
|||||||
</dl>
|
</dl>
|
||||||
<NCollapse>
|
<NCollapse>
|
||||||
<NCollapseItem name="visual" title="场景与角色状态">
|
<NCollapseItem name="visual" title="场景与角色状态">
|
||||||
<p v-if="reviewed.selection.draft.visualState.continuityNote" class="mb-2">
|
<VisualStateContinuity
|
||||||
{{ reviewed.selection.draft.visualState.continuityNote }}
|
v-if="reviewed.selection.draft.visualState.continuityNote"
|
||||||
</p>
|
:note="reviewed.selection.draft.visualState.continuityNote"
|
||||||
|
class="mb-2"
|
||||||
|
/>
|
||||||
<ul class="space-y-2">
|
<ul class="space-y-2">
|
||||||
<li
|
<li
|
||||||
v-for="subject in reviewed.selection.draft.visualState.subjects"
|
v-for="subject in reviewed.selection.draft.visualState.subjects"
|
||||||
@@ -874,9 +898,28 @@ async function adopt() {
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<NButton :disabled="saving || savingDraft || directionEditor?.saving" @click="open = false">关闭</NButton>
|
|
||||||
<NButton
|
<NButton
|
||||||
v-if="directionOnly"
|
:disabled="saving || savingDraft || directionEditor?.saving || jointPanel?.saving"
|
||||||
|
@click="open = false"
|
||||||
|
>关闭</NButton
|
||||||
|
>
|
||||||
|
<NButton
|
||||||
|
v-if="jointMode"
|
||||||
|
:disabled="!jointPanel?.canSave"
|
||||||
|
:loading="jointPanel?.savingKind === 'save'"
|
||||||
|
@click="jointPanel?.save"
|
||||||
|
>保存联合草案</NButton
|
||||||
|
>
|
||||||
|
<NButton
|
||||||
|
v-if="jointMode"
|
||||||
|
type="primary"
|
||||||
|
:disabled="!jointPanel?.canAdopt"
|
||||||
|
:loading="jointPanel?.savingKind === 'adopt'"
|
||||||
|
@click="jointPanel?.adopt"
|
||||||
|
>正式采用联合修订</NButton
|
||||||
|
>
|
||||||
|
<NButton
|
||||||
|
v-if="directionOnly && !jointMode"
|
||||||
type="primary"
|
type="primary"
|
||||||
:disabled="!directionEditor?.canAdopt"
|
:disabled="!directionEditor?.canAdopt"
|
||||||
:loading="directionEditor?.saving"
|
:loading="directionEditor?.saving"
|
||||||
@@ -884,7 +927,7 @@ async function adopt() {
|
|||||||
>正式采用摄影修改</NButton
|
>正式采用摄影修改</NButton
|
||||||
>
|
>
|
||||||
<NButton
|
<NButton
|
||||||
v-if="!directionOnly && !useSaved"
|
v-if="!jointMode && !directionOnly && !useSaved"
|
||||||
:loading="savingDraft"
|
:loading="savingDraft"
|
||||||
:disabled="
|
:disabled="
|
||||||
disabled ||
|
disabled ||
|
||||||
@@ -899,7 +942,7 @@ async function adopt() {
|
|||||||
>保存草案</NButton
|
>保存草案</NButton
|
||||||
>
|
>
|
||||||
<NButton
|
<NButton
|
||||||
v-if="!directionOnly && reviewed"
|
v-if="!jointMode && !directionOnly && reviewed"
|
||||||
type="primary"
|
type="primary"
|
||||||
:loading="saving"
|
:loading="saving"
|
||||||
:disabled="disabled || !acknowledged || !reviewer.trim() || !preflight.data.value?.current.valid"
|
:disabled="disabled || !acknowledged || !reviewer.trim() || !preflight.data.value?.current.valid"
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import VisualStateContinuity from './VisualStateContinuity.vue'
|
||||||
import { WorkspaceSectionHeading } from '../../../components/ui'
|
import { WorkspaceSectionHeading } from '../../../components/ui'
|
||||||
import { NTag } from 'naive-ui'
|
import { NCollapse, NCollapseItem, NTag } from 'naive-ui'
|
||||||
import { directionLabel } from '../model'
|
import { directionLabel } from '../model'
|
||||||
import type { DesignedShot } from '../types'
|
import type { DesignedShot } from '../types'
|
||||||
|
|
||||||
/** 正式镜头设计的只读检查;内容编辑尚无后端写接口。 */
|
/** 正式摄影与当前开拍状态只读展示,编辑沿原草案采用流程。 */
|
||||||
defineProps<{ shot: DesignedShot }>()
|
defineProps<{ shot: DesignedShot }>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="workspace-section-stack workspace-section-stack-spacious">
|
<div :key="shot.shotId" class="workspace-section-stack workspace-section-stack-spacious">
|
||||||
<section>
|
<section>
|
||||||
<!-- 以下是统一的导演设计模块标题 -->
|
<!-- 以下是统一的导演设计模块标题 -->
|
||||||
<WorkspaceSectionHeading title="导演摄影设计" />
|
<WorkspaceSectionHeading title="导演摄影设计" />
|
||||||
@@ -30,19 +31,26 @@ defineProps<{ shot: DesignedShot }>()
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<dl class="detail-grid">
|
<dl class="detail-grid">
|
||||||
<dt>构图</dt>
|
|
||||||
<dd>{{ shot.direction.composition }}</dd>
|
|
||||||
<dt>机位</dt>
|
|
||||||
<dd>{{ shot.direction.cameraPosition }}</dd>
|
|
||||||
<dt>视觉意图</dt>
|
<dt>视觉意图</dt>
|
||||||
<dd>{{ shot.direction.visualIntent }}</dd>
|
<dd>{{ shot.direction.visualIntent }}</dd>
|
||||||
</dl></template
|
</dl>
|
||||||
|
<!-- 以下是按需展开的完整摄影原文,不裁剪或改写创作内容。 -->
|
||||||
|
<NCollapse class="mt-4">
|
||||||
|
<NCollapseItem name="camera-detail" title="构图与机位">
|
||||||
|
<dl class="detail-grid">
|
||||||
|
<dt>构图</dt>
|
||||||
|
<dd class="whitespace-pre-wrap wrap-anywhere">{{ shot.direction.composition }}</dd>
|
||||||
|
<dt>机位</dt>
|
||||||
|
<dd class="whitespace-pre-wrap wrap-anywhere">{{ shot.direction.cameraPosition }}</dd>
|
||||||
|
</dl>
|
||||||
|
</NCollapseItem>
|
||||||
|
</NCollapse></template
|
||||||
>
|
>
|
||||||
<p v-else class="mt-4 text-sm text-muted">此镜头尚无已保存的导演设计。</p>
|
<p v-else class="mt-4 text-sm text-muted">此镜头尚无已保存的导演设计。</p>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<!-- 以下是统一的画面状态模块标题 -->
|
<!-- 以下是统一的画面状态模块标题 -->
|
||||||
<WorkspaceSectionHeading title="画面状态" />
|
<WorkspaceSectionHeading title="画面状态 · 开拍0秒" />
|
||||||
<template v-if="shot.visualState"
|
<template v-if="shot.visualState"
|
||||||
><dl class="detail-grid mt-4">
|
><dl class="detail-grid mt-4">
|
||||||
<dt>时间</dt>
|
<dt>时间</dt>
|
||||||
@@ -53,13 +61,20 @@ defineProps<{ shot: DesignedShot }>()
|
|||||||
<dd>{{ shot.visualState.atmosphere || '未指定' }}</dd>
|
<dd>{{ shot.visualState.atmosphere || '未指定' }}</dd>
|
||||||
<dt>环境变化</dt>
|
<dt>环境变化</dt>
|
||||||
<dd>{{ shot.visualState.environmentTransientState || '无临时变化' }}</dd>
|
<dd>{{ shot.visualState.environmentTransientState || '无临时变化' }}</dd>
|
||||||
<dt>连续性</dt>
|
|
||||||
<dd>{{ shot.visualState.continuityNote || '未附说明' }}</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
|
<!-- 以下是完整连续依据与主体状态,普通浏览默认收起。 -->
|
||||||
|
<NCollapse class="mt-4">
|
||||||
|
<NCollapseItem name="continuity" title="衔接与时间依据">
|
||||||
|
<VisualStateContinuity
|
||||||
|
v-if="shot.visualState.continuityNote"
|
||||||
|
:note="shot.visualState.continuityNote"
|
||||||
|
/><span v-else>未附说明;真实视频末态仍待独立证据验证。</span>
|
||||||
|
</NCollapseItem>
|
||||||
|
<NCollapseItem name="subjects" :title="`主体开拍状态(${shot.visualState.subjects.length})`">
|
||||||
<article
|
<article
|
||||||
v-for="subject in shot.visualState.subjects"
|
v-for="subject in shot.visualState.subjects"
|
||||||
:key="subject.subjectId"
|
:key="subject.subjectId"
|
||||||
class="mt-5 surface-inset p-4"
|
class="mb-5 last:mb-0"
|
||||||
>
|
>
|
||||||
<div class="mb-3 flex flex-wrap items-center gap-2">
|
<div class="mb-3 flex flex-wrap items-center gap-2">
|
||||||
<code class="subject-ref">{{ subject.subjectRef }}</code
|
<code class="subject-ref">{{ subject.subjectRef }}</code
|
||||||
@@ -79,9 +94,13 @@ defineProps<{ shot: DesignedShot }>()
|
|||||||
<dd>{{ subject[field.key] || '不适用 / 未指定' }}</dd></template
|
<dd>{{ subject[field.key] || '不适用 / 未指定' }}</dd></template
|
||||||
>
|
>
|
||||||
</dl>
|
</dl>
|
||||||
</article></template
|
</article>
|
||||||
|
</NCollapseItem>
|
||||||
|
</NCollapse></template
|
||||||
>
|
>
|
||||||
<p v-else class="mt-4 text-sm leading-6 text-muted">此镜头还没有画面状态,请先完成镜头设计。</p>
|
<p v-else class="mt-4 text-sm leading-6 text-muted">
|
||||||
|
此镜头尚无画面状态。请在“生成与恢复”中核对本次摄影范围后补齐。
|
||||||
|
</p>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -123,7 +123,7 @@ function referenceAt(index: number) {
|
|||||||
></template
|
></template
|
||||||
>
|
>
|
||||||
</WorkspaceSectionHeading>
|
</WorkspaceSectionHeading>
|
||||||
<p v-if="!shots.length" class="text-xs text-muted">请先在镜头目录勾选要核对的镜头。</p>
|
<p v-if="!shots.length" class="text-xs text-muted">请先展开“选择镜头”勾选本次范围。</p>
|
||||||
<p v-if="query.loading.value" role="status" class="text-xs text-muted">
|
<p v-if="query.loading.value" role="status" class="text-xs text-muted">
|
||||||
正在读取正式生产计划和所选镜头参考素材…
|
正在读取正式生产计划和所选镜头参考素材…
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { visualStateTimeSections } from '../visual-state-time'
|
||||||
|
/** 共用原衔接文字的时间语义展示,不新增时间轴或质量规则。 */
|
||||||
|
const props = defineProps<{ /** 后端完整原文字。 */ note: string }>()
|
||||||
|
/** 原契约明确分段才分类,历史原文不推定开拍或视频末态。 */
|
||||||
|
const sections = computed(() => visualStateTimeSections(props.note))
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<!-- 以下是开拍输入、规划末态、连续要求与视频末态的独立说明。 -->
|
||||||
|
<div class="space-y-3 text-sm">
|
||||||
|
<section v-for="(section, index) in sections" :key="index" class="space-y-1">
|
||||||
|
<p class="font-medium">{{ section.title }}</p>
|
||||||
|
<p class="whitespace-pre-wrap wrap-anywhere">{{ section.text || '未提供文字依据。' }}</p>
|
||||||
|
</section>
|
||||||
|
<p class="text-xs text-muted">规划结束状态和相邻静态输入不代表已验证的真实视频末态。</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { keyframeScope } from '../production/keyframe-scope'
|
import { keyframeScope } from '../production/keyframe-scope'
|
||||||
import { request } from '../../lib/http'
|
import { request } from '../../lib/http'
|
||||||
import type {
|
import type {
|
||||||
|
JointDerivedReviewResult,
|
||||||
DirectionReviewInput,
|
DirectionReviewInput,
|
||||||
DirectionReviewResult,
|
DirectionReviewResult,
|
||||||
DerivedReviewSelection,
|
DerivedReviewSelection,
|
||||||
@@ -13,6 +14,22 @@ import type {
|
|||||||
|
|
||||||
/** 已审摄影草案的正式读写入口。 */
|
/** 已审摄影草案的正式读写入口。 */
|
||||||
export const derivedReviewApi = {
|
export const derivedReviewApi = {
|
||||||
|
/**
|
||||||
|
* 使用原confirm接口免费预检或采用同一完整联合草案。
|
||||||
|
* @param projectId 正式项目
|
||||||
|
* @param body 冻结的审核人、已保存草案和完整差异
|
||||||
|
* @param signal 取消只读预检
|
||||||
|
* @returns 整批采用或幂等回执
|
||||||
|
*/
|
||||||
|
joint: (
|
||||||
|
projectId: string,
|
||||||
|
body: { reviewer: string; shots: DerivedReviewSelection[]; preview: boolean },
|
||||||
|
signal?: AbortSignal
|
||||||
|
) =>
|
||||||
|
request<JointDerivedReviewResult>(
|
||||||
|
`/projects/${encodeURIComponent(projectId)}/storyboard-derived-reviews/confirm`,
|
||||||
|
{ method: 'POST', body, signal }
|
||||||
|
),
|
||||||
/**
|
/**
|
||||||
* 沿原采用接口免费预检或采用独立摄影,不生成画面状态。
|
* 沿原采用接口免费预检或采用独立摄影,不生成画面状态。
|
||||||
* @param projectId 正式项目
|
* @param projectId 正式项目
|
||||||
|
|||||||
@@ -61,6 +61,11 @@ export type DraftProviderInput = Pick<GenerateKeyframeInput, 'provider' | 'width
|
|||||||
|
|
||||||
/** 草案只有草案指纹,不能提交正式生图。 */
|
/** 草案只有草案指纹,不能提交正式生图。 */
|
||||||
export interface ShotDraftPreview extends Omit<KeyframeGenerationPreview, 'previewFingerprint'> {
|
export interface ShotDraftPreview extends Omit<KeyframeGenerationPreview, 'previewFingerprint'> {
|
||||||
|
/** 本镜完整摄影和开拍状态的版本。 */ currentDerivedFingerprint?: string
|
||||||
|
/** 正式同集紧邻镜头的完整版本,原样用于联合采用。 */ adjacentDerivedVersions?: Array<{
|
||||||
|
/** 正式镜头。 */ shotId: string
|
||||||
|
/** 完整派生版本。 */ derivedFingerprint: string
|
||||||
|
}>
|
||||||
/** 本次草案的确切输入版本。 */ draftFingerprint: string
|
/** 本次草案的确切输入版本。 */ draftFingerprint: string
|
||||||
/** 草案始终不能直接生成。 */ productionReady: false
|
/** 草案始终不能直接生成。 */ productionReady: false
|
||||||
/** 项目级制作门禁。 */
|
/** 项目级制作门禁。 */
|
||||||
@@ -70,6 +75,7 @@ export interface ShotDraftPreview extends Omit<KeyframeGenerationPreview, 'previ
|
|||||||
|
|
||||||
/** 每次人工采用一个或多个已预览镜头。 */
|
/** 每次人工采用一个或多个已预览镜头。 */
|
||||||
export interface DerivedReviewSelection extends DraftProviderInput {
|
export interface DerivedReviewSelection extends DraftProviderInput {
|
||||||
|
/** 仅未生产镜头使用的有界联合采用,不能混入其它修订模式。 */ jointRevision?: JointDerivedRevision
|
||||||
/** 正式镜头编号。 */ shotId: string
|
/** 正式镜头编号。 */ shotId: string
|
||||||
/** 用户核对过的草案。 */ draft: ShotReviewDraft
|
/** 用户核对过的草案。 */ draft: ShotReviewDraft
|
||||||
/** 对应的免费预览指纹。 */ expectedDraftFingerprint: string
|
/** 对应的免费预览指纹。 */ expectedDraftFingerprint: string
|
||||||
@@ -132,3 +138,60 @@ export interface DirectionReviewResult {
|
|||||||
/** 是否已经采用相同草案。 */ alreadyApplied: boolean
|
/** 是否已经采用相同草案。 */ alreadyApplied: boolean
|
||||||
}>
|
}>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 联合采用逐字段声明,环境修改另需本集原文,主体身份及形态仍不可编辑。 */
|
||||||
|
export type JointDerivedChange =
|
||||||
|
| {
|
||||||
|
/** 摄影意图。 */ target: 'direction'
|
||||||
|
/** 正式允许字段。 */ field: 'composition' | 'cameraPosition' | 'visualIntent'
|
||||||
|
/** 正式原值。 */ before: string
|
||||||
|
/** 草案目标值。 */ after: string
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
/** 本镜0秒环境。 */ target: 'environment'
|
||||||
|
/** 正式允许的四项环境字段。 */ field: 'timeOfDay' | 'weather' | 'atmosphere' | 'transientState'
|
||||||
|
/** 正式原值,未知可为空。 */ before: string
|
||||||
|
/** 草案目标值,不猜测未知天气。 */ after: string
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
/** 衔接文字。 */ target: 'visualState'
|
||||||
|
/** 正式允许字段。 */ field: 'continuityNote'
|
||||||
|
/** 正式原值。 */ before: string
|
||||||
|
/** 草案目标值。 */ after: string
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
/** 主体0秒状态。 */ target: 'subject'
|
||||||
|
/** 正式主体。 */ subjectRef: string
|
||||||
|
/** 正式允许字段。 */ field: 'expression' | 'pose' | 'gaze' | 'position' | 'transientState'
|
||||||
|
/** 正式原值。 */ before: string
|
||||||
|
/** 草案目标值。 */ after: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 联合采用绑定已保存草案、当前派生与完整邻镜版本。 */
|
||||||
|
export interface JointDerivedRevision {
|
||||||
|
/** 仅存在环境差异时提供,由正式项目详情的本集全文及人工片段形成。 */
|
||||||
|
environmentSource?: {
|
||||||
|
/** 当前正式集ID,采用事务最终核对Storyboard外键。 */ episodeId: string
|
||||||
|
/** 本集完整content原字节SHA256,不使用摘要或截取正文。 */ expectedContentFingerprint: string
|
||||||
|
/** 人工选择的本集逐字片段。 */ quote: string
|
||||||
|
}
|
||||||
|
/** 已保存草案修订。 */ expectedDraftRevision: number
|
||||||
|
/** 当前摄影及画面状态版本。 */ expectedDerivedFingerprint: string
|
||||||
|
/** 完整同集紧邻镜头版本。 */ expectedNeighbors: NonNullable<ShotDraftPreview['adjacentDerivedVersions']>
|
||||||
|
/** 用户确认的修订与剪辑依据。 */ reason: string
|
||||||
|
/** 全部允许差异,不得漏报或重复。 */ changes: JointDerivedChange[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 联合采用的同步事务回执,不代表生图或质量通过。 */
|
||||||
|
export interface JointDerivedReviewResult {
|
||||||
|
/** 正式项目。 */ projectId: string
|
||||||
|
/** 是否只读预检。 */ preview: boolean
|
||||||
|
/** 是否真实写入。 */ changed: boolean
|
||||||
|
/** 是否复用同一已采用请求。 */ reused: boolean
|
||||||
|
/** 本次完整请求版本。 */ requestFingerprint: string
|
||||||
|
/** 整批返回的正式归属。 */ shots: Array<{
|
||||||
|
/** 正式镜头。 */ shotId: string
|
||||||
|
/** 摄影记录。 */ directionId: string
|
||||||
|
/** 画面状态记录。 */ visualStateId: string
|
||||||
|
}>
|
||||||
|
}
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
import type { JointDerivedChange, ShotReviewDraft } from './derived-review.types'
|
||||||
|
|
||||||
|
/** 完整差异展示包含不可修改项,不能只列允许字段而隐藏越界变化。 */
|
||||||
|
export interface JointDraftDifference {
|
||||||
|
/** 中文字段或主体位置。 */ label: string
|
||||||
|
/** 修改前原文。 */ before: string
|
||||||
|
/** 修改后原文。 */ after: string
|
||||||
|
/** 是否属于正式联合采用白名单。 */ allowed: boolean
|
||||||
|
/** 可提交的差异,越界项不构造请求。 */ change?: JointDerivedChange
|
||||||
|
}
|
||||||
|
/** 摄影、主体和时间状态共用的中文字段名。 */
|
||||||
|
export const jointFieldLabels: Record<string, string> = {
|
||||||
|
composition: '构图',
|
||||||
|
cameraPosition: '摄影机位置',
|
||||||
|
visualIntent: '摄影意图',
|
||||||
|
continuityNote: '衔接与时间依据',
|
||||||
|
expression: '表情',
|
||||||
|
pose: '姿态',
|
||||||
|
gaze: '视线',
|
||||||
|
position: '位置',
|
||||||
|
transientState: '即时变化',
|
||||||
|
formId: '形态身份',
|
||||||
|
formName: '形态名称',
|
||||||
|
shotNo: '镜头编号',
|
||||||
|
timeOfDay: '时间',
|
||||||
|
weather: '天气',
|
||||||
|
atmosphere: '氛围',
|
||||||
|
shotSize: '景别',
|
||||||
|
cameraAngle: '摄影角度',
|
||||||
|
cameraMovement: '运镜',
|
||||||
|
lensIntent: '焦段',
|
||||||
|
depthOfField: '景深'
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 稳定比较完整JSON草案,属性顺序不构成修改。
|
||||||
|
* @param value 真实字段值
|
||||||
|
* @returns 可比较的稳定原文
|
||||||
|
*/
|
||||||
|
export function jointValue(value: unknown): string {
|
||||||
|
if (typeof value === 'string') return JSON.stringify(value)
|
||||||
|
if (value === undefined) return '(字段缺失)'
|
||||||
|
if (value && typeof value === 'object' && !Array.isArray(value))
|
||||||
|
return JSON.stringify(
|
||||||
|
Object.fromEntries(
|
||||||
|
Object.entries(value)
|
||||||
|
.toSorted(([a], [b]) => a.localeCompare(b))
|
||||||
|
.map(([key, item]) => [key, jointValue(item)])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if (Array.isArray(value)) return JSON.stringify(value.map(jointValue))
|
||||||
|
return JSON.stringify(value)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 比对完整正式内容与待审草案,允许差异与越界差异都完整展示。
|
||||||
|
* @param formal 当前正式摄影和0秒状态
|
||||||
|
* @param draft 用户完整待审草案
|
||||||
|
* @returns 全部逐字段差异,不能从中悄悄删除越界项后采用
|
||||||
|
*/
|
||||||
|
export function jointDraftDifferences(formal: ShotReviewDraft, draft: ShotReviewDraft): JointDraftDifference[] {
|
||||||
|
const differences: JointDraftDifference[] = []
|
||||||
|
/**
|
||||||
|
* 比对真实值,只为正式允许的字符串字段形成差异声明。
|
||||||
|
* @param label 中文字段名
|
||||||
|
* @param before 正式原值
|
||||||
|
* @param after 完整草案值
|
||||||
|
* @param change 允许字段的正式差异
|
||||||
|
*/
|
||||||
|
function compare(label: string, before: unknown, after: unknown, change?: JointDerivedChange) {
|
||||||
|
if (jointValue(before) === jointValue(after)) return
|
||||||
|
differences.push({
|
||||||
|
label,
|
||||||
|
before: typeof before === 'string' ? before : jointValue(before),
|
||||||
|
after: typeof after === 'string' ? after : jointValue(after),
|
||||||
|
allowed: !!change,
|
||||||
|
change
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for (const field of new Set([...Object.keys(formal.direction), ...Object.keys(draft.direction)])) {
|
||||||
|
const key = field as keyof typeof formal.direction
|
||||||
|
const before = formal.direction[key],
|
||||||
|
after = draft.direction[key]
|
||||||
|
const allowed =
|
||||||
|
['composition', 'cameraPosition', 'visualIntent'].includes(field) &&
|
||||||
|
typeof before === 'string' &&
|
||||||
|
typeof after === 'string'
|
||||||
|
compare(
|
||||||
|
`摄影 · ${jointFieldLabels[field] ?? field}`,
|
||||||
|
before,
|
||||||
|
after,
|
||||||
|
allowed
|
||||||
|
? {
|
||||||
|
target: 'direction',
|
||||||
|
field: field as 'composition' | 'cameraPosition' | 'visualIntent',
|
||||||
|
before: before as string,
|
||||||
|
after: after as string
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
)
|
||||||
|
}
|
||||||
|
compare('画面状态 · 镜头编号', formal.visualState.shotNo, draft.visualState.shotNo)
|
||||||
|
compare('画面状态 · 衔接与时间依据', formal.visualState.continuityNote, draft.visualState.continuityNote, {
|
||||||
|
target: 'visualState',
|
||||||
|
field: 'continuityNote',
|
||||||
|
before: formal.visualState.continuityNote,
|
||||||
|
after: draft.visualState.continuityNote
|
||||||
|
})
|
||||||
|
for (const field of new Set([
|
||||||
|
...Object.keys(formal.visualState.environment),
|
||||||
|
...Object.keys(draft.visualState.environment)
|
||||||
|
])) {
|
||||||
|
const key = field as keyof typeof formal.visualState.environment
|
||||||
|
const before = formal.visualState.environment[key],
|
||||||
|
after = draft.visualState.environment[key]
|
||||||
|
const allowed =
|
||||||
|
['timeOfDay', 'weather', 'atmosphere', 'transientState'].includes(field) &&
|
||||||
|
typeof before === 'string' &&
|
||||||
|
typeof after === 'string'
|
||||||
|
compare(
|
||||||
|
`环境 · ${jointFieldLabels[field] ?? field}`,
|
||||||
|
before,
|
||||||
|
after,
|
||||||
|
allowed ? { target: 'environment', field: key, before, after } : undefined
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const previous = new Map(formal.visualState.subjects.map(subject => [subject.subjectRef, subject]))
|
||||||
|
const next = new Map(draft.visualState.subjects.map(subject => [subject.subjectRef, subject]))
|
||||||
|
if (previous.size !== formal.visualState.subjects.length || next.size !== draft.visualState.subjects.length)
|
||||||
|
compare('主体重复或集合异常', formal.visualState.subjects, draft.visualState.subjects)
|
||||||
|
for (const subjectRef of new Set([...previous.keys(), ...next.keys()])) {
|
||||||
|
const before = previous.get(subjectRef),
|
||||||
|
after = next.get(subjectRef)
|
||||||
|
if (!before || !after) {
|
||||||
|
compare(`${subjectRef} · 主体集合`, before, after)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for (const field of new Set([...Object.keys(before), ...Object.keys(after)])) {
|
||||||
|
const key = field as keyof typeof before
|
||||||
|
const allowed =
|
||||||
|
['expression', 'pose', 'gaze', 'position', 'transientState'].includes(field) &&
|
||||||
|
typeof before[key] === 'string' &&
|
||||||
|
typeof after[key] === 'string'
|
||||||
|
compare(
|
||||||
|
`${subjectRef} · ${jointFieldLabels[field] ?? field}`,
|
||||||
|
before[key],
|
||||||
|
after[key],
|
||||||
|
allowed
|
||||||
|
? {
|
||||||
|
target: 'subject',
|
||||||
|
subjectRef,
|
||||||
|
field: field as 'expression' | 'pose' | 'gaze' | 'position' | 'transientState',
|
||||||
|
before: before[key],
|
||||||
|
after: after[key]
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const field of new Set([...Object.keys(formal), ...Object.keys(draft)])) {
|
||||||
|
if (['direction', 'visualState'].includes(field)) continue
|
||||||
|
compare(
|
||||||
|
field === 'expectedShotFingerprint'
|
||||||
|
? '正式分镜版本'
|
||||||
|
: field === 'sceneSources'
|
||||||
|
? '场景参考与几何版本'
|
||||||
|
: '修订模式',
|
||||||
|
formal[field as keyof ShotReviewDraft],
|
||||||
|
draft[field as keyof ShotReviewDraft]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return differences
|
||||||
|
}
|
||||||
@@ -75,6 +75,9 @@ export interface EpisodeVisualStates {
|
|||||||
|
|
||||||
/** 导演设计与视觉状态统一呈现的校验问题。 */
|
/** 导演设计与视觉状态统一呈现的校验问题。 */
|
||||||
export interface StoryboardIssue {
|
export interface StoryboardIssue {
|
||||||
|
/** 原时间或其它结构化问题码,不改变业务判断。 */ code?: string
|
||||||
|
/** 确定性冲突与人工待审分别展示。 */ severity?: 'error' | 'needs_review'
|
||||||
|
/** 原问题字段用于定位。 */ field?: string
|
||||||
episodeNo: number
|
episodeNo: number
|
||||||
beatNo: number | null
|
beatNo: number | null
|
||||||
shotNo: number | null
|
shotNo: number | null
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/** 统一时间契约的展示分段,不能作为模型结果有效性的判断。 */
|
||||||
|
export interface VisualStateTimeSection {
|
||||||
|
/** 后端明确提供的分类。 */ kind: 'input' | 'planned' | 'continuity' | 'video' | 'legacy'
|
||||||
|
/** 普通用户可读标题。 */ title: string
|
||||||
|
/** 原文字内容,不翻译或改写。 */ text: string
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 只按正式四种显式标记排版,旧文字保持原样,不按动作关键词推断时间或审核结果。
|
||||||
|
* @param note 原continuityNote
|
||||||
|
* @returns 可展示的完整原文分段
|
||||||
|
*/
|
||||||
|
export function visualStateTimeSections(note: string): VisualStateTimeSection[] {
|
||||||
|
const markers = [...note.matchAll(/【(输入事实|规划末态|连续要求|视频末态)】/g)]
|
||||||
|
if (!markers.length) return [{ kind: 'legacy', title: '原衔接说明(未分段)', text: note }]
|
||||||
|
const kinds = { 输入事实: 'input', 规划末态: 'planned', 连续要求: 'continuity', 视频末态: 'video' } as const
|
||||||
|
const titles = {
|
||||||
|
输入事实: '已确认的输入事实',
|
||||||
|
规划末态: '规划中的镜头结束状态',
|
||||||
|
连续要求: '相邻镜头连续性要求',
|
||||||
|
视频末态: '视频末态声明(仍需真实视频证据核验)'
|
||||||
|
}
|
||||||
|
const sections: VisualStateTimeSection[] = []
|
||||||
|
const prefix = note.slice(0, markers[0]!.index).trim()
|
||||||
|
if (prefix) sections.push({ kind: 'legacy', title: '原补充说明', text: prefix })
|
||||||
|
markers.forEach((marker, index) => {
|
||||||
|
const name = marker[1] as keyof typeof kinds
|
||||||
|
sections.push({
|
||||||
|
kind: kinds[name],
|
||||||
|
title: titles[name],
|
||||||
|
text: note.slice(marker.index! + marker[0].length, markers[index + 1]?.index ?? note.length).trim()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return sections
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 仅使用后端问题码与severity命名,保留原消息和定位,不自行判定质量。
|
||||||
|
* @param issue 原问题
|
||||||
|
* @returns 时间问题标题或空值
|
||||||
|
*/
|
||||||
|
export function visualStateTimeIssueLabel(issue: { code?: string; severity?: string }) {
|
||||||
|
if (issue.code === 'VISUAL_STATE_START_CONFLICT') return '开拍状态冲突'
|
||||||
|
if (issue.code === 'VISUAL_STATE_TIME_NEEDS_REVIEW') return '时间语义待人工核对'
|
||||||
|
if (issue.code === 'VISUAL_STATE_VIDEO_END_UNSUPPORTED') return '真实视频末态缺少证据'
|
||||||
|
return issue.severity === 'needs_review' ? '需要人工核对' : ''
|
||||||
|
}
|
||||||
@@ -101,6 +101,10 @@ interface PreviewOptions<Input extends object, Preview extends ImageGenerationPr
|
|||||||
/** 当前正式目标。 */ targetId: string
|
/** 当前正式目标。 */ targetId: string
|
||||||
/** 免费路由是否完整覆盖当前输入。 */ exactPreview: boolean
|
/** 免费路由是否完整覆盖当前输入。 */ exactPreview: boolean
|
||||||
}
|
}
|
||||||
|
/** 用户主动选中的人工追加许可,仅首帧可用。 */
|
||||||
|
additionalAuthorizationId?: () => string | undefined
|
||||||
|
/** 已有完整同计划候选时只读查看,不能新增请求。 */
|
||||||
|
reuseResult?: (preview: Preview) => Promise<boolean>
|
||||||
/** 当前完整生成参数。 */
|
/** 当前完整生成参数。 */
|
||||||
input: () => Input
|
input: () => Input
|
||||||
/** 当前是否允许提交。 */
|
/** 当前是否允许提交。 */
|
||||||
@@ -139,6 +143,8 @@ export function useImageGenerationPreview<Input extends object, Preview extends
|
|||||||
const requiresCostConfirmation = computed(
|
const requiresCostConfirmation = computed(
|
||||||
() => preview.value?.provider !== 'openai-image' || !options.chargeContext
|
() => preview.value?.provider !== 'openai-image' || !options.chargeContext
|
||||||
)
|
)
|
||||||
|
/** 只有正式费用计划证明完整回执可复用时才允许只读查看。 */
|
||||||
|
const reusableResult = computed(() => charge.value?.reusable === true && !!options.reuseResult)
|
||||||
/** 授权与未知费用显示在当前生成入口。 */
|
/** 授权与未知费用显示在当前生成入口。 */
|
||||||
const chargeNotice = computed(() => charge.value?.message ?? '')
|
const chargeNotice = computed(() => charge.value?.message ?? '')
|
||||||
/** 输入快照同时绑定界面目标和显隐周期。 */
|
/** 输入快照同时绑定界面目标和显隐周期。 */
|
||||||
@@ -160,7 +166,7 @@ export function useImageGenerationPreview<Input extends object, Preview extends
|
|||||||
!options.disabled() &&
|
!options.disabled() &&
|
||||||
!submitting.value &&
|
!submitting.value &&
|
||||||
!loading.value &&
|
!loading.value &&
|
||||||
!recoveryNotice.value &&
|
(!recoveryNotice.value || reusableResult.value) &&
|
||||||
!!preview.value &&
|
!!preview.value &&
|
||||||
(requiresCostConfirmation.value ? acknowledged.value : charge.value?.allowed === true)
|
(requiresCostConfirmation.value ? acknowledged.value : charge.value?.allowed === true)
|
||||||
)
|
)
|
||||||
@@ -212,7 +218,7 @@ export function useImageGenerationPreview<Input extends object, Preview extends
|
|||||||
const context = options.chargeContext?.()
|
const context = options.chargeContext?.()
|
||||||
if (result.provider === 'openai-image' && context) {
|
if (result.provider === 'openai-image' && context) {
|
||||||
const values = input as Record<string, unknown>
|
const values = input as Record<string, unknown>
|
||||||
let list, planFingerprint: string | undefined
|
let list, planFingerprint: string | undefined, sourceFingerprint: string | undefined
|
||||||
if (context.exactPreview && ['identity', 'form', 'keyframe'].includes(context.scope)) {
|
if (context.exactPreview && ['identity', 'form', 'keyframe'].includes(context.scope)) {
|
||||||
const plan = await imageAuthorizationApi.preview(
|
const plan = await imageAuthorizationApi.preview(
|
||||||
context.projectId,
|
context.projectId,
|
||||||
@@ -238,6 +244,7 @@ export function useImageGenerationPreview<Input extends object, Preview extends
|
|||||||
throw new Error('授权计划与当前预览不匹配,请重新读取。')
|
throw new Error('授权计划与当前预览不匹配,请重新读取。')
|
||||||
list = plan.authorization
|
list = plan.authorization
|
||||||
planFingerprint = plan.planFingerprint
|
planFingerprint = plan.planFingerprint
|
||||||
|
sourceFingerprint = plan.context.sourceFingerprint
|
||||||
} else list = await imageAuthorizationApi.list(context.projectId, abort.signal)
|
} else list = await imageAuthorizationApi.list(context.projectId, abort.signal)
|
||||||
if (current !== revision || abort.signal.aborted) return
|
if (current !== revision || abort.signal.aborted) return
|
||||||
charge.value = imageChargeEligibility(
|
charge.value = imageChargeEligibility(
|
||||||
@@ -245,7 +252,14 @@ export function useImageGenerationPreview<Input extends object, Preview extends
|
|||||||
context.scope,
|
context.scope,
|
||||||
context.targetId,
|
context.targetId,
|
||||||
result.model,
|
result.model,
|
||||||
planFingerprint
|
planFingerprint,
|
||||||
|
options.additionalAuthorizationId?.()
|
||||||
|
? {
|
||||||
|
id: options.additionalAuthorizationId()!,
|
||||||
|
sourceFingerprint: sourceFingerprint ?? '',
|
||||||
|
projectId: context.projectId
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
preview.value = result
|
preview.value = result
|
||||||
@@ -259,6 +273,18 @@ export function useImageGenerationPreview<Input extends object, Preview extends
|
|||||||
/** 明确提交一次;预览过期只重读预览,绝不自动重新生成。 */
|
/** 明确提交一次;预览过期只重读预览,绝不自动重新生成。 */
|
||||||
async function submit() {
|
async function submit() {
|
||||||
if (!canSubmit.value || !preview.value) return
|
if (!canSubmit.value || !preview.value) return
|
||||||
|
if (reusableResult.value && options.reuseResult) {
|
||||||
|
submitting.value = true
|
||||||
|
try {
|
||||||
|
if (await options.reuseResult(preview.value)) options.open.value = false
|
||||||
|
else error.value = '当前候选列表还未核对到原完整结果,请刷新候选后查看;不会重新收费。'
|
||||||
|
} catch (cause) {
|
||||||
|
error.value = errorMessage(cause)
|
||||||
|
} finally {
|
||||||
|
submitting.value = false
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
const current = revision
|
const current = revision
|
||||||
const input = JSON.parse(JSON.stringify(options.input())) as Input
|
const input = JSON.parse(JSON.stringify(options.input())) as Input
|
||||||
const fingerprint = preview.value.previewFingerprint
|
const fingerprint = preview.value.previewFingerprint
|
||||||
@@ -313,6 +339,7 @@ export function useImageGenerationPreview<Input extends object, Preview extends
|
|||||||
preview,
|
preview,
|
||||||
requiresCostConfirmation,
|
requiresCostConfirmation,
|
||||||
chargeNotice,
|
chargeNotice,
|
||||||
|
reusableResult,
|
||||||
acknowledged,
|
acknowledged,
|
||||||
loading,
|
loading,
|
||||||
submitting,
|
submitting,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { visualStateTimeIssueLabel } from '../storyboard/visual-state-time'
|
||||||
import WorkspaceActionTooltip from '../../components/ui/WorkspaceActionTooltip.vue'
|
import WorkspaceActionTooltip from '../../components/ui/WorkspaceActionTooltip.vue'
|
||||||
import ConfirmAction from './ConfirmAction.vue'
|
import ConfirmAction from './ConfirmAction.vue'
|
||||||
import { useQuery } from '../../composables/useQuery'
|
import { useQuery } from '../../composables/useQuery'
|
||||||
@@ -112,6 +113,9 @@ const derivedEpisodes = computed(() => {
|
|||||||
(
|
(
|
||||||
issue
|
issue
|
||||||
): issue is {
|
): issue is {
|
||||||
|
code?: string
|
||||||
|
severity?: 'error' | 'needs_review'
|
||||||
|
field?: string
|
||||||
episodeNo: number
|
episodeNo: number
|
||||||
beatNo: number | null
|
beatNo: number | null
|
||||||
shotNo: number | null
|
shotNo: number | null
|
||||||
@@ -639,7 +643,9 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
|||||||
: '状态待确认'
|
: '状态待确认'
|
||||||
}}<span v-if="item.error">:{{ derivedErrorSummary(item.error) }}</span>
|
}}<span v-if="item.error">:{{ derivedErrorSummary(item.error) }}</span>
|
||||||
<p v-for="(issue, index) in item.issues" :key="index" class="mt-1">
|
<p v-for="(issue, index) in item.issues" :key="index" class="mt-1">
|
||||||
段落 {{ issue.beatNo ?? '待确认' }} · 镜头 {{ issue.shotNo ?? '待确认' }}:{{
|
<span v-if="visualStateTimeIssueLabel(issue)"
|
||||||
|
>{{ visualStateTimeIssueLabel(issue) }} · </span
|
||||||
|
>段落 {{ issue.beatNo ?? '待确认' }} · 镜头 {{ issue.shotNo ?? '待确认' }}:{{
|
||||||
userFacingText(issue.message)
|
userFacingText(issue.message)
|
||||||
}}
|
}}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
/** 用户可操作的图片授权及视频费用审计错误,保留原码用于业务判断。 */
|
/** 用户可操作的图片授权及视频费用审计错误,保留原码用于业务判断。 */
|
||||||
const messages: Record<string, string> = {
|
const messages: Record<string, string> = {
|
||||||
|
IMAGE_ADDITIONAL_AUTHORIZATION_INVALID: '人工追加许可无效、已撤销、用尽,或原精确计划与预算已变化,请重新核对。',
|
||||||
|
IMAGE_BILLING_AUDIT_CONFLICT: '原图片请求或批准版本冲突,请重新读取审计。',
|
||||||
|
IMAGE_BILLING_AUDIT_IDENTITY_MISMATCH: '材料与原图片请求身份不匹配,或供应方编号已归属其它请求。',
|
||||||
|
IMAGE_BILLING_AUDIT_STALE: '原请求或完整证据集合已变化,请重新核对并确认。',
|
||||||
|
IMAGE_BILLING_AUDIT_REVIEW_CONFLICT: '另一项图片费用复核已先完成,请刷新后重新核对。',
|
||||||
|
IMAGE_BILLING_AUDIT_RELEASE_REJECTED: '尚不具备费用核清条件,请核对原执行、真实账单及唯一关联。',
|
||||||
|
IMAGE_BILLING_AUDIT_EVIDENCE_INVALID: '图片审计历史或摘要无法核实,费用继续阻断。',
|
||||||
IMAGE_AUTHORIZATION_REQUIRED: '当前模型或范围没有有效图片授权,授权可能已到期或撤销。请核对项目生成设置。',
|
IMAGE_AUTHORIZATION_REQUIRED: '当前模型或范围没有有效图片授权,授权可能已到期或撤销。请核对项目生成设置。',
|
||||||
IMAGE_AUTHORIZATION_EXPIRED: '到期时间已过,请重新填写未来时间。',
|
IMAGE_AUTHORIZATION_EXPIRED: '到期时间已过,请重新填写未来时间。',
|
||||||
IMAGE_AUTHORIZATION_BUDGET_EXCEEDED: '图片授权剩余预算不足整次预留,或请求次数已用尽。',
|
IMAGE_AUTHORIZATION_BUDGET_EXCEEDED: '图片授权剩余预算不足整次预留,或请求次数已用尽。',
|
||||||
@@ -35,10 +42,34 @@ const failureMessages: Record<string, string> = {
|
|||||||
* @returns 可操作说明或空值
|
* @returns 可操作说明或空值
|
||||||
*/
|
*/
|
||||||
export function billingErrorText(code: string | undefined, details: unknown): string | undefined {
|
export function billingErrorText(code: string | undefined, details: unknown): string | undefined {
|
||||||
const record = details && typeof details === 'object' ? (details as Record<string, unknown>) : {}
|
const outer = details && typeof details === 'object' ? (details as Record<string, unknown>) : {}
|
||||||
|
const nested = outer.details && typeof outer.details === 'object' ? (outer.details as Record<string, unknown>) : {}
|
||||||
|
const record = { ...outer, ...nested }
|
||||||
const actualCode = code ?? (typeof record.code === 'string' ? record.code : undefined)
|
const actualCode = code ?? (typeof record.code === 'string' ? record.code : undefined)
|
||||||
if (actualCode && messages[actualCode]) return messages[actualCode]
|
if (actualCode && messages[actualCode]) return messages[actualCode]
|
||||||
if (actualCode?.startsWith('OPENAI_IMAGE_'))
|
if (actualCode?.startsWith('OPENAI_IMAGE_')) {
|
||||||
return failureMessages[String(record.failureType)] ?? '图片请求结果或费用尚未核实,请查看原请求,禁止自动重发。'
|
const cause =
|
||||||
|
record.causeCode === 'UND_ERR_CONNECT_TIMEOUT'
|
||||||
|
? '底层连接超时'
|
||||||
|
: record.causeCode === 'ECONNREFUSED'
|
||||||
|
? '底层连接被拒绝'
|
||||||
|
: record.causeCode === 'ETIMEDOUT'
|
||||||
|
? '底层请求超时'
|
||||||
|
: ''
|
||||||
|
const transport =
|
||||||
|
record.transportMode === 'proxy'
|
||||||
|
? '应用通过代理连接'
|
||||||
|
: record.transportMode === 'direct'
|
||||||
|
? '应用直接连接'
|
||||||
|
: ''
|
||||||
|
return [
|
||||||
|
failureMessages[String(record.failureType)] ?? '图片请求结果或费用尚未核实,请查看原请求,禁止自动重发。',
|
||||||
|
...(['network_error', 'timeout_unknown', 'receipt_unknown'].includes(String(record.failureType))
|
||||||
|
? [transport, cause]
|
||||||
|
: [])
|
||||||
|
]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(';')
|
||||||
|
}
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
@@ -152,6 +152,17 @@ export function userFacingText(value: string | null | undefined, fallback = '暂
|
|||||||
STORYBOARD_DERIVED_STALE: '摄影或画面来源已变化,请重新预检,不能覆盖旧版本。',
|
STORYBOARD_DERIVED_STALE: '摄影或画面来源已变化,请重新预检,不能覆盖旧版本。',
|
||||||
STORYBOARD_DERIVED_REQUEST_UNRESOLVED: '原请求结果尚未核清,请核对原任务和费用,不要重复生成。',
|
STORYBOARD_DERIVED_REQUEST_UNRESOLVED: '原请求结果尚未核清,请核对原任务和费用,不要重复生成。',
|
||||||
STORYBOARD_DIRECTION_SCOPE_MISMATCH: '本镜摄影的可见范围与正式绑定冲突,请核对对应段落和镜头。',
|
STORYBOARD_DIRECTION_SCOPE_MISMATCH: '本镜摄影的可见范围与正式绑定冲突,请核对对应段落和镜头。',
|
||||||
|
VISUAL_STATE_START_CONFLICT: '开拍状态与已确认的输入事实冲突,请核对对应镜头。',
|
||||||
|
VISUAL_STATE_TIME_NEEDS_REVIEW: '开拍与结束时点存在歧义,需要人工核对,尚未通过。',
|
||||||
|
VISUAL_STATE_VIDEO_END_UNSUPPORTED: '缺少真实视频末态证据,不能把规划结束状态当作已验证结果。',
|
||||||
|
JOINT_REVISION_DRAFT_STALE: '已保存联合草案或修订号已变化,请重新读取并免费预检。',
|
||||||
|
JOINT_REVISION_ENVIRONMENT_SOURCE_STALE: '本集原文依据缺失或版本已变化,请保留草案,重新读取原文并人工核对。',
|
||||||
|
JOINT_REVISION_NEIGHBOR_STALE: '相邻镜头版本已变化,请重新核对连续性依据。',
|
||||||
|
JOINT_REVISION_STALE: '本镜摄影或开拍状态已变化,请保留草案并重新核对。',
|
||||||
|
JOINT_REVISION_SCOPE: '联合草案超出允许字段或存在未声明差异,请核对完整修改。',
|
||||||
|
JOINT_REVISION_ACTIVE: '本次范围有活动任务,暂不能联合采用。',
|
||||||
|
JOINT_REVISION_DOWNSTREAM: '本镜已有下游生产结果或执行记录,请使用原受控修订流程。',
|
||||||
|
JOINT_REVISION_HISTORY_INVALID: '联合采用历史无法核对,请保留原稿并检查正式记录。',
|
||||||
STORYBOARD_SOURCE_MISMATCH: '镜头与已提交分镜不一致,请刷新后核对。'
|
STORYBOARD_SOURCE_MISMATCH: '镜头与已提交分镜不一致,请刷新后核对。'
|
||||||
}
|
}
|
||||||
const code = Object.keys(codeLabels).find(
|
const code = Object.keys(codeLabels).find(
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>联合摄影与图片费用 · 隔离验收</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="./review-billing.ts"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,456 @@
|
|||||||
|
import { createApp, defineComponent, h, ref } from 'vue'
|
||||||
|
import { NButton, NConfigProvider, NGlobalStyle, NMessageProvider, dateZhCN, zhCN } from 'naive-ui'
|
||||||
|
import ActionMessageProvider from '../../src/components/ui/ActionMessageProvider.vue'
|
||||||
|
import { useTheme } from '../../src/composables/useTheme'
|
||||||
|
import ShotDerivedReview from '../../src/features/storyboard/components/ShotDerivedReview.vue'
|
||||||
|
import ProjectSettingsDialog from '../../src/features/generation-config/components/ProjectSettingsDialog.vue'
|
||||||
|
import KeyframeDialog from '../../src/features/production/components/KeyframeDialog.vue'
|
||||||
|
import { jointReviewFixture } from '../fixtures/joint-review'
|
||||||
|
import { imageAuditFixture } from '../fixtures/image-billing-audit'
|
||||||
|
import { additionalImageFixture } from '../fixtures/image-additional'
|
||||||
|
import { imagePreviewFixture } from '../fixtures/image-preview'
|
||||||
|
import { billingCatalog, billingProfile } from '../fixtures/billing'
|
||||||
|
import type {
|
||||||
|
ImageBillingEvidenceInput,
|
||||||
|
ImageBillingReviewInput
|
||||||
|
} from '../../src/features/image-authorization/billing-audit.types'
|
||||||
|
import type { ImageAdditionalAuthorizationInput } from '../../src/features/image-authorization/types'
|
||||||
|
import '../../src/styles/styles.css'
|
||||||
|
import '../../src/styles/admin.css'
|
||||||
|
|
||||||
|
/** 隔离数据只存在本页面,未知接口403,无任何正式项目或模型连接。 */
|
||||||
|
const joint = jointReviewFixture('mock-joint-project')
|
||||||
|
/** 可选环境验收仅修改内存草案;完整源集正文保留原始换行。 */
|
||||||
|
const environmentMode = new URLSearchParams(location.search).has('environment')
|
||||||
|
/** 模拟正式项目详情公开的本集身份和全文,不使用摘要。 */
|
||||||
|
const environmentEpisode = {
|
||||||
|
id: 'mock-source-episode',
|
||||||
|
projectId: 'mock-joint-project',
|
||||||
|
episode: 1,
|
||||||
|
title: '当前源集',
|
||||||
|
content: '第一行\r\n午后,维修间透入日光。\n天气未指定。'
|
||||||
|
}
|
||||||
|
if (environmentMode) {
|
||||||
|
joint.saved.draft.visualState.environment = {
|
||||||
|
timeOfDay: '午后',
|
||||||
|
weather: '',
|
||||||
|
atmosphere: '自然日光',
|
||||||
|
transientState: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** 原unknown与账单始终保留的隔离费用账本。 */
|
||||||
|
const images = additionalImageFixture()
|
||||||
|
images.additionalAuthorizations = []
|
||||||
|
/** 原图片审计身份与费用父请求一致,所有原件必须由测试操作者填写。 */
|
||||||
|
const audit = imageAuditFixture('billing-project', 'original-image-request')
|
||||||
|
audit.identity.candidateId = 'original-image'
|
||||||
|
audit.reservedMicros = images.requests[0]!.input.reservedMicros
|
||||||
|
/** 只统计模拟同步操作,不是真实模型调用。 */
|
||||||
|
const writes = ref(0)
|
||||||
|
/** 隔离模型请求计数,已成功后同计划不再增加。 */
|
||||||
|
const mockGenerations = ref(0)
|
||||||
|
/** 精确保存当前页面发出的请求,帮助验收无隐式生成。 */
|
||||||
|
const calls: Array<{ path: string; method: string; body: unknown }> = []
|
||||||
|
/** 模拟并发仅作用于下一次正式联合采用,不改变预检。 */
|
||||||
|
let neighborConflict = false
|
||||||
|
/** 下一次采用时模拟本集正文版本变化,预检仍可通过。 */
|
||||||
|
let environmentConflict = false
|
||||||
|
/** 模拟审计409后保留表单。 */
|
||||||
|
let auditConflict = false
|
||||||
|
/** 只读结果是否已有完整同计划候选。 */
|
||||||
|
let hasImage = false
|
||||||
|
/**
|
||||||
|
* 返回隔离的正式接口响应形状。
|
||||||
|
* @param data 当前模拟数据
|
||||||
|
* @returns 不连接网络的响应
|
||||||
|
*/
|
||||||
|
function ok(data: unknown) {
|
||||||
|
return new Response(JSON.stringify({ data }), { headers: { 'Content-Type': 'application/json' } })
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 全请求隔离处理,任何未声明路由都拒绝,不回退真实fetch。
|
||||||
|
* @param input 原请求地址
|
||||||
|
* @param init 原请求参数
|
||||||
|
* @returns 正式接口形状的Mock响应
|
||||||
|
*/
|
||||||
|
window.fetch = async (input, init) => {
|
||||||
|
const path = String(input),
|
||||||
|
method = init?.method ?? 'GET',
|
||||||
|
body = init?.body ? JSON.parse(String(init.body)) : undefined
|
||||||
|
calls.push({ path, method, body })
|
||||||
|
if (method === 'POST' || method === 'PUT') writes.value++
|
||||||
|
if (path === '/api/projects/mock-joint-project')
|
||||||
|
return ok({ id: 'mock-joint-project', episodes: [environmentEpisode] })
|
||||||
|
if (path.endsWith('/generation-models')) return ok(billingCatalog)
|
||||||
|
if (path.endsWith('/creative-profile')) return ok(billingProfile)
|
||||||
|
if (path.endsWith('/resolve')) return ok({ provider: 'openai-image', model: 'gpt-image-2.5-flare', options: {} })
|
||||||
|
if (path.includes('/keyframe-review-draft')) {
|
||||||
|
if (method === 'PUT') {
|
||||||
|
if (body.expectedRevision !== joint.saved.revision)
|
||||||
|
return new Response(JSON.stringify({ message: '草案版本已变化' }), { status: 409 })
|
||||||
|
joint.saved.draft = body.draft
|
||||||
|
joint.saved.providerInput = body.providerInput ?? null
|
||||||
|
joint.saved.expectedCurrentFormalSourceFingerprint = body.expectedCurrentFormalSourceFingerprint
|
||||||
|
joint.saved.revision++
|
||||||
|
joint.saved.status = 'current'
|
||||||
|
}
|
||||||
|
return ok(joint.saved)
|
||||||
|
}
|
||||||
|
if (path.endsWith('/storyboard-quality-confirmation'))
|
||||||
|
return ok({ ...joint.approval.approval, valid: true, confirmation: joint.approval.record })
|
||||||
|
if (path.endsWith('/storyboard-quality-confirmation/preflight'))
|
||||||
|
return ok({
|
||||||
|
current: { ...joint.approval.approval, valid: true, confirmation: joint.approval.record },
|
||||||
|
quality: joint.approval.quality
|
||||||
|
})
|
||||||
|
if (path.includes('/storyboard-directions?')) return ok(joint.directions)
|
||||||
|
if (path.includes('/storyboard-visual-states?')) return ok(joint.visuals)
|
||||||
|
if (path.includes('/keyframe-spec')) return ok(joint.keyframe)
|
||||||
|
if (path.includes('/generation-spec'))
|
||||||
|
return ok({ shotId: joint.shot.shotId, projectId: 'mock-joint-project', subjects: [] })
|
||||||
|
if (path.endsWith('/storyboard-derived-reviews/confirm')) {
|
||||||
|
if (body.shots[0]?.jointRevision) {
|
||||||
|
if (!body.preview && environmentConflict) {
|
||||||
|
environmentConflict = false
|
||||||
|
environmentEpisode.content += '\n另一位编辑已更新源正文。'
|
||||||
|
}
|
||||||
|
if (body.shots[0].jointRevision.changes.some((row: { target: string }) => row.target === 'environment')) {
|
||||||
|
const source = body.shots[0].jointRevision.environmentSource
|
||||||
|
const digest = await crypto.subtle.digest(
|
||||||
|
'SHA-256',
|
||||||
|
new TextEncoder().encode(environmentEpisode.content)
|
||||||
|
)
|
||||||
|
const fingerprint = Array.from(new Uint8Array(digest), byte => byte.toString(16).padStart(2, '0')).join(
|
||||||
|
''
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
!source ||
|
||||||
|
source.episodeId !== environmentEpisode.id ||
|
||||||
|
source.expectedContentFingerprint !== fingerprint ||
|
||||||
|
!environmentEpisode.content.includes(source.quote)
|
||||||
|
)
|
||||||
|
return new Response(
|
||||||
|
JSON.stringify({
|
||||||
|
message: 'JOINT_REVISION_ENVIRONMENT_SOURCE_STALE: 本集原文已变化,请重新核对。'
|
||||||
|
}),
|
||||||
|
{ status: 409 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (!body.preview && neighborConflict) {
|
||||||
|
neighborConflict = false
|
||||||
|
return new Response(
|
||||||
|
JSON.stringify({ message: 'JOINT_REVISION_NEIGHBOR_STALE: 相邻镜头已经更新,请重新读取。' }),
|
||||||
|
{ status: 409 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (!body.preview) {
|
||||||
|
const draft = body.shots[0].draft
|
||||||
|
joint.saved.status = 'stale'
|
||||||
|
joint.directions.beats[0]!.shots[0]!.direction = {
|
||||||
|
...draft.direction,
|
||||||
|
rawJson: JSON.stringify({
|
||||||
|
jointRevisionHistory: [
|
||||||
|
{
|
||||||
|
originalDirection: joint.shot.direction,
|
||||||
|
changes: body.shots[0].jointRevision.changes,
|
||||||
|
environmentSource: body.shots[0].jointRevision.environmentSource,
|
||||||
|
reviewer: body.reviewer
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
joint.visuals.beats[0]!.shots[0]!.visualState = {
|
||||||
|
timeOfDay: draft.visualState.environment.timeOfDay,
|
||||||
|
weather: draft.visualState.environment.weather,
|
||||||
|
atmosphere: draft.visualState.environment.atmosphere,
|
||||||
|
environmentTransientState: draft.visualState.environment.transientState,
|
||||||
|
continuityNote: draft.visualState.continuityNote,
|
||||||
|
subjects: draft.visualState.subjects.map((subject: Record<string, string>) => ({
|
||||||
|
...subject,
|
||||||
|
subjectId: 'mock-subject',
|
||||||
|
subjectFormId: subject.formId
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ok({
|
||||||
|
projectId: 'mock-joint-project',
|
||||||
|
preview: body.preview,
|
||||||
|
changed: !body.preview,
|
||||||
|
reused: false,
|
||||||
|
requestFingerprint: 'f'.repeat(64),
|
||||||
|
shots: [{ shotId: joint.shot.shotId, directionId: 'mock-direction', visualStateId: 'mock-visual' }]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return ok({ shots: [{ shotId: joint.shot.shotId }] })
|
||||||
|
}
|
||||||
|
if (path.includes('/keyframe/preview')) {
|
||||||
|
const image = {
|
||||||
|
...imagePreviewFixture(),
|
||||||
|
provider: body.provider ?? 'openai-image',
|
||||||
|
model: 'gpt-image-2.5-flare',
|
||||||
|
shotId: path.includes('/audit-shot/') ? 'audit-shot' : joint.shot.shotId
|
||||||
|
}
|
||||||
|
return body.draft
|
||||||
|
? ok({
|
||||||
|
...image,
|
||||||
|
draftFingerprint: 'a'.repeat(64),
|
||||||
|
productionReady: false,
|
||||||
|
productionGate: { ready: false, reason: '隔离项目尚未完整生产' },
|
||||||
|
currentDerivedFingerprint: 'c'.repeat(64),
|
||||||
|
adjacentDerivedVersions: [{ shotId: 'shot-db-1-2', derivedFingerprint: 'd'.repeat(64) }],
|
||||||
|
sceneSources: []
|
||||||
|
})
|
||||||
|
: ok(image)
|
||||||
|
}
|
||||||
|
if (path.endsWith('/image-authorizations/preview'))
|
||||||
|
return ok({
|
||||||
|
provider: 'openai-image',
|
||||||
|
model: 'gpt-image-2.5-flare',
|
||||||
|
context: {
|
||||||
|
projectId: 'billing-project',
|
||||||
|
targetId: 'audit-shot',
|
||||||
|
scope: 'keyframe',
|
||||||
|
sourceFingerprint: 'c'.repeat(64)
|
||||||
|
},
|
||||||
|
planFingerprint: 'b'.repeat(64),
|
||||||
|
authorization: images
|
||||||
|
})
|
||||||
|
if (path.endsWith('/image-authorizations') && method === 'GET') return ok(images)
|
||||||
|
if (path.endsWith('/image-authorizations') && method === 'POST') {
|
||||||
|
if (body.mode === 'additional') {
|
||||||
|
const previous = images.additionalAuthorizations!.find(
|
||||||
|
row => row.input.idempotencyKey === body.idempotencyKey
|
||||||
|
)
|
||||||
|
if (previous) return ok({ authorizationId: previous.id, status: previous.status })
|
||||||
|
const approvalInput = body as ImageAdditionalAuthorizationInput
|
||||||
|
const permit = {
|
||||||
|
id: `mock-permit-${images.additionalAuthorizations!.length + 1}`,
|
||||||
|
status: 'approved',
|
||||||
|
input: { ...approvalInput, parentInputFingerprint: 'd'.repeat(64) },
|
||||||
|
usedRequests: 0,
|
||||||
|
remainingRequests: approvalInput.maxRequests
|
||||||
|
}
|
||||||
|
images.additionalAuthorizations!.push(permit)
|
||||||
|
return ok({ authorizationId: permit.id, status: permit.status, parentAuthorizationId: 'grant' })
|
||||||
|
}
|
||||||
|
return ok({ authorizationId: 'mock-standing', status: 'approved' })
|
||||||
|
}
|
||||||
|
if (path.endsWith('/revoke')) {
|
||||||
|
const id = path.split('/').at(-2)!,
|
||||||
|
row =
|
||||||
|
images.authorizations.find(item => item.id === id) ??
|
||||||
|
images.additionalAuthorizations!.find(item => item.id === id)
|
||||||
|
if (row) row.status = 'revoked'
|
||||||
|
return ok({ authorizationId: id, status: 'revoked' })
|
||||||
|
}
|
||||||
|
if (path.endsWith('/audit')) return ok(audit)
|
||||||
|
if (path.endsWith('/audit/evidence')) {
|
||||||
|
const previous = audit.history.evidence.find(row => JSON.stringify(row.body) === JSON.stringify(body))
|
||||||
|
const row = previous ?? {
|
||||||
|
id: `mock-evidence-${audit.history.evidence.length + 1}`,
|
||||||
|
requestId: audit.requestId,
|
||||||
|
taskFingerprint: audit.taskFingerprint,
|
||||||
|
body: body as ImageBillingEvidenceInput,
|
||||||
|
digest: '1'.repeat(64)
|
||||||
|
}
|
||||||
|
if (!previous) audit.history.evidence.push(row)
|
||||||
|
audit.evidenceSetFingerprint = '2'.repeat(64)
|
||||||
|
audit.released = false
|
||||||
|
audit.billingBlocked = true
|
||||||
|
audit.status = 'unreviewed'
|
||||||
|
return ok({ ...audit, evidenceId: row.id, reused: !!previous })
|
||||||
|
}
|
||||||
|
if (path.endsWith('/audit/reviews')) {
|
||||||
|
if (auditConflict) {
|
||||||
|
auditConflict = false
|
||||||
|
audit.reviewFingerprint = '3'.repeat(64)
|
||||||
|
return new Response(
|
||||||
|
JSON.stringify({
|
||||||
|
code: 'IMAGE_BILLING_AUDIT_REVIEW_CONFLICT',
|
||||||
|
message: '另一项隔离复核已先完成,请重新核对。'
|
||||||
|
}),
|
||||||
|
{ status: 409 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const review = body as ImageBillingReviewInput
|
||||||
|
audit.history.reviews.push({
|
||||||
|
id: `mock-review-${audit.history.reviews.length + 1}`,
|
||||||
|
requestId: audit.requestId,
|
||||||
|
taskFingerprint: audit.taskFingerprint,
|
||||||
|
body: review,
|
||||||
|
digest: '4'.repeat(64),
|
||||||
|
revision: audit.history.reviews.length + 1
|
||||||
|
})
|
||||||
|
audit.released = review.decision === 'release_future_charges'
|
||||||
|
audit.status = audit.released ? 'released' : 'blocked'
|
||||||
|
audit.billingBlocked = !audit.released
|
||||||
|
audit.reviewedAmountMicros = audit.released ? 1 : null
|
||||||
|
images.billingBlocked = audit.billingBlocked
|
||||||
|
images.blockingRequestIds = audit.billingBlocked ? ['original-image-request'] : []
|
||||||
|
images.requests[0]!.billingAudit = {
|
||||||
|
status: audit.status,
|
||||||
|
released: audit.released,
|
||||||
|
reviewId: audit.released ? 'mock-review' : null,
|
||||||
|
reviewedAmountMicros: audit.reviewedAmountMicros
|
||||||
|
}
|
||||||
|
return ok({ ...audit, reused: false })
|
||||||
|
}
|
||||||
|
if (/\/audit-shot\/keyframe(?:\?|$)/.test(path)) {
|
||||||
|
if (!hasImage) {
|
||||||
|
const permit = images.additionalAuthorizations!.find(row => row.id === body.additionalAuthorizationId)
|
||||||
|
if (
|
||||||
|
!permit ||
|
||||||
|
permit.status !== 'approved' ||
|
||||||
|
!permit.remainingRequests ||
|
||||||
|
body.provider !== 'openai-image'
|
||||||
|
)
|
||||||
|
return new Response(
|
||||||
|
JSON.stringify({
|
||||||
|
code: 'IMAGE_ADDITIONAL_AUTHORIZATION_INVALID',
|
||||||
|
message: '缺少当前精确计划人工许可'
|
||||||
|
}),
|
||||||
|
{ status: 409 }
|
||||||
|
)
|
||||||
|
permit.usedRequests++
|
||||||
|
permit.remainingRequests--
|
||||||
|
mockGenerations.value++
|
||||||
|
hasImage = true
|
||||||
|
const grant = images.authorizations.find(row => row.id === images.requests[0]!.input.authorizationId)
|
||||||
|
if (grant) {
|
||||||
|
grant.usedRequests++
|
||||||
|
grant.remainingRequests = Math.max(0, grant.remainingRequests - 1)
|
||||||
|
grant.accountedMicros += images.requests[0]!.input.reservedMicros
|
||||||
|
grant.remainingMicros = Math.max(0, grant.input.budgetMicros - grant.accountedMicros)
|
||||||
|
}
|
||||||
|
images.requests.push({
|
||||||
|
...structuredClone(images.requests[0]!),
|
||||||
|
id: 'mock-image-completed',
|
||||||
|
status: 'completed',
|
||||||
|
input: { ...images.requests[0]!.input, additionalAuthorizationId: permit.id },
|
||||||
|
output: { usageCostMicros: 1, actualBilledMicros: null, result: { image: 'mock-existing-result' } }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return ok({
|
||||||
|
id: 'mock-existing-candidate',
|
||||||
|
shotId: 'audit-shot',
|
||||||
|
status: 'completed',
|
||||||
|
recoveryRequired: false,
|
||||||
|
providerInputFingerprint: 'a'.repeat(64)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return new Response(JSON.stringify({ message: '隔离页面拒绝未声明接口;不会连接正式服务。' }), { status: 403 })
|
||||||
|
}
|
||||||
|
/** 原组件与原全屏抽屉组成的本地验收页,不进入正式构建入口。 */
|
||||||
|
const Preview = defineComponent({
|
||||||
|
setup() {
|
||||||
|
const theme = useTheme(),
|
||||||
|
settings = ref(false),
|
||||||
|
keyframe = ref(false)
|
||||||
|
return () =>
|
||||||
|
h(
|
||||||
|
NConfigProvider,
|
||||||
|
{ theme: theme.theme.value, themeOverrides: theme.overrides.value, locale: zhCN, dateLocale: dateZhCN },
|
||||||
|
{
|
||||||
|
default: () =>
|
||||||
|
h(
|
||||||
|
NMessageProvider,
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
default: () =>
|
||||||
|
h(
|
||||||
|
ActionMessageProvider,
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
default: () => [
|
||||||
|
h(NGlobalStyle),
|
||||||
|
h('main', { style: 'height:100dvh;overflow:auto;padding:24px' }, [
|
||||||
|
h(
|
||||||
|
'h1',
|
||||||
|
{ style: 'font-size:22px;margin-bottom:12px' },
|
||||||
|
'联合摄影与图片费用 · Mock隔离验收'
|
||||||
|
),
|
||||||
|
h(
|
||||||
|
'p',
|
||||||
|
{ style: 'margin-bottom:20px' },
|
||||||
|
'全部接口已拦截,测试材料仅保存在内存,不连接正式项目或真实模型。'
|
||||||
|
),
|
||||||
|
h(
|
||||||
|
'div',
|
||||||
|
{
|
||||||
|
style: 'display:flex;flex-wrap:wrap;gap:12px;margin-bottom:20px'
|
||||||
|
},
|
||||||
|
[
|
||||||
|
h(
|
||||||
|
NButton,
|
||||||
|
{ onClick: () => (settings.value = true) },
|
||||||
|
() => '项目图片授权与原请求'
|
||||||
|
),
|
||||||
|
h(
|
||||||
|
NButton,
|
||||||
|
{ onClick: () => (keyframe.value = true) },
|
||||||
|
() => '原首帧生成入口'
|
||||||
|
),
|
||||||
|
h(
|
||||||
|
NButton,
|
||||||
|
{ onClick: () => (neighborConflict = true) },
|
||||||
|
() => '模拟采用时邻镜变化'
|
||||||
|
),
|
||||||
|
h(
|
||||||
|
NButton,
|
||||||
|
{ onClick: () => (auditConflict = true) },
|
||||||
|
() => '模拟一次费用复核冲突'
|
||||||
|
),
|
||||||
|
h(
|
||||||
|
NButton,
|
||||||
|
{ onClick: () => (environmentConflict = true) },
|
||||||
|
() => '模拟采用时原文变化'
|
||||||
|
)
|
||||||
|
]
|
||||||
|
),
|
||||||
|
h(ShotDerivedReview, {
|
||||||
|
projectId: 'mock-joint-project',
|
||||||
|
episodeNo: 1,
|
||||||
|
shot: joint.shot,
|
||||||
|
shots: joint.shots,
|
||||||
|
disabled: false
|
||||||
|
}),
|
||||||
|
h(
|
||||||
|
'p',
|
||||||
|
{ role: 'status', style: 'margin-top:20px' },
|
||||||
|
`模拟同步操作 ${writes.value} 次 · 模拟图片请求 ${mockGenerations.value} 次 · 真实模型请求 0 次`
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
h(ProjectSettingsDialog, {
|
||||||
|
projectId: 'billing-project',
|
||||||
|
disabled: false,
|
||||||
|
initialTab: 'image-authorization',
|
||||||
|
open: settings.value,
|
||||||
|
'onUpdate:open': value => (settings.value = value)
|
||||||
|
}),
|
||||||
|
h(KeyframeDialog, {
|
||||||
|
projectId: 'billing-project',
|
||||||
|
shotId: 'audit-shot',
|
||||||
|
shotTitle: '仅供Mock的原镜头',
|
||||||
|
disabled: true,
|
||||||
|
additionalAllowed: true,
|
||||||
|
open: keyframe.value,
|
||||||
|
'onUpdate:open': value => (keyframe.value = value),
|
||||||
|
reuseExisting: async () => hasImage,
|
||||||
|
submitGeneration: async input => {
|
||||||
|
const result = await fetch(
|
||||||
|
'/api/storyboard-shots/audit-shot/keyframe?projectId=billing-project',
|
||||||
|
{ method: 'POST', body: JSON.stringify(input) }
|
||||||
|
)
|
||||||
|
return { accepted: result.ok }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
createApp(Preview).mount('#app')
|
||||||
@@ -0,0 +1,302 @@
|
|||||||
|
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||||
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||||
|
import { NCheckbox, NInput, NInputNumber, NSelect } from 'naive-ui'
|
||||||
|
import { additionalImageFixture } from '../../fixtures/image-additional'
|
||||||
|
import { additionalImageEligibility, imageChargeEligibility } from '@/features/image-authorization/model'
|
||||||
|
import { billingErrorText } from '@/lib/billing-errors'
|
||||||
|
import { imageAuthorizationApi } from '@/features/image-authorization/api'
|
||||||
|
import ImageAuthorizationSettings from '@/features/image-authorization/ImageAuthorizationSettings.vue'
|
||||||
|
import KeyframeDialog from '@/features/production/components/KeyframeDialog.vue'
|
||||||
|
import { billingCatalog, billingProfile } from '../../fixtures/billing'
|
||||||
|
import { imageRequestNotice, runGuardedImageRequest } from '@/features/subject-images/image-request-guard'
|
||||||
|
|
||||||
|
/** 释放弹层、查询和单次请求标记。 */
|
||||||
|
const wrappers: VueWrapper[] = []
|
||||||
|
afterEach(() => {
|
||||||
|
wrappers.splice(0).forEach(wrapper => wrapper.unmount())
|
||||||
|
sessionStorage.clear()
|
||||||
|
})
|
||||||
|
/**
|
||||||
|
* 创建正式包装结构的隔离响应。
|
||||||
|
* @param data Mock原数据
|
||||||
|
* @returns 独立响应
|
||||||
|
*/
|
||||||
|
function response(data: unknown) {
|
||||||
|
return new Response(JSON.stringify({ data }))
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 以原精确范围核对人工许可。
|
||||||
|
* @param list 当前隔离费用投影
|
||||||
|
* @returns 当前范围资格
|
||||||
|
*/
|
||||||
|
function eligibility(list: ReturnType<typeof additionalImageFixture>) {
|
||||||
|
return additionalImageEligibility(
|
||||||
|
list,
|
||||||
|
'additional-permit',
|
||||||
|
'billing-project',
|
||||||
|
'audit-shot',
|
||||||
|
'gpt-image-2.5-flare',
|
||||||
|
'c'.repeat(64),
|
||||||
|
'b'.repeat(64)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('人工追加不解除原unknown与费用', () => {
|
||||||
|
it('默认unknown阻断;许可仅放行本精确计划,并显示已用和剩余次数', () => {
|
||||||
|
const list = additionalImageFixture()
|
||||||
|
expect(
|
||||||
|
imageChargeEligibility(list, 'keyframe', 'audit-shot', 'gpt-image-2.5-flare', 'b'.repeat(64)).allowed
|
||||||
|
).toBe(false)
|
||||||
|
expect(eligibility(list).allowed).toBe(true)
|
||||||
|
expect(eligibility(list).message).toContain('剩余 2 次')
|
||||||
|
expect(list.requests[0]!.status).toBe('unknown')
|
||||||
|
expect(list.requests[0]!.output?.actualBilledMicros).toBeNull()
|
||||||
|
expect(list.billingBlocked).toBe(true)
|
||||||
|
})
|
||||||
|
it.each([
|
||||||
|
'revoked',
|
||||||
|
'exhausted',
|
||||||
|
'budget',
|
||||||
|
'expired',
|
||||||
|
'project',
|
||||||
|
'shot',
|
||||||
|
'model',
|
||||||
|
'source',
|
||||||
|
'plan',
|
||||||
|
'inflight',
|
||||||
|
'another-unknown'
|
||||||
|
])('拒绝撤销/用尽/跨范围/未核清并发:%s', scenario => {
|
||||||
|
const list = additionalImageFixture(),
|
||||||
|
permit = list.additionalAuthorizations![0]!,
|
||||||
|
parent = list.requests[0]!,
|
||||||
|
grant = list.authorizations[0]!
|
||||||
|
if (scenario === 'revoked') permit.status = 'revoked'
|
||||||
|
if (scenario === 'exhausted') permit.remainingRequests = 0
|
||||||
|
if (scenario === 'budget') grant.remainingMicros = 1
|
||||||
|
if (scenario === 'expired') grant.expired = true
|
||||||
|
if (scenario === 'project') parent.input.projectId = 'other-project'
|
||||||
|
if (scenario === 'shot') parent.input.targetId = 'other-shot'
|
||||||
|
if (scenario === 'model') parent.input.model = 'other-model'
|
||||||
|
if (scenario === 'source') parent.input.sourceFingerprint = 'e'.repeat(64)
|
||||||
|
if (scenario === 'plan') parent.input.planFingerprint = 'f'.repeat(64)
|
||||||
|
if (scenario === 'inflight') parent.status = 'running'
|
||||||
|
if (scenario === 'another-unknown') {
|
||||||
|
list.requests.push({ ...structuredClone(parent), id: 'unapproved-request' })
|
||||||
|
list.blockingRequestIds.push('unapproved-request')
|
||||||
|
}
|
||||||
|
expect(eligibility(list).allowed).toBe(false)
|
||||||
|
})
|
||||||
|
it('完整同计划结果优先免费复用,许可撤销或剩余次数不能触发继续收费', () => {
|
||||||
|
const list = additionalImageFixture()
|
||||||
|
const completed = {
|
||||||
|
...structuredClone(list.requests[0]!),
|
||||||
|
id: 'returned-request',
|
||||||
|
status: 'completed',
|
||||||
|
output: { usageCostMicros: 1, actualBilledMicros: null, result: { image: 'test-saved-result' } }
|
||||||
|
}
|
||||||
|
list.requests.push(completed)
|
||||||
|
list.additionalAuthorizations![0]!.status = 'revoked'
|
||||||
|
const result = imageChargeEligibility(list, 'keyframe', 'audit-shot', 'gpt-image-2.5-flare', 'b'.repeat(64), {
|
||||||
|
id: 'additional-permit',
|
||||||
|
projectId: 'billing-project',
|
||||||
|
sourceFingerprint: 'c'.repeat(64)
|
||||||
|
})
|
||||||
|
expect(result).toMatchObject({ allowed: true, reusable: true })
|
||||||
|
expect(list.billingBlocked).toBe(true)
|
||||||
|
})
|
||||||
|
it('费用核清但没有结果的原unknown精确计划仍不能普通重发', () => {
|
||||||
|
const list = additionalImageFixture()
|
||||||
|
list.billingBlocked = false
|
||||||
|
list.blockingRequestIds = []
|
||||||
|
expect(
|
||||||
|
imageChargeEligibility(list, 'keyframe', 'audit-shot', 'gpt-image-2.5-flare', 'b'.repeat(64)).allowed
|
||||||
|
).toBe(false)
|
||||||
|
})
|
||||||
|
it('原网络连接与真实Provider额度错误分开,底层原因不伪装为额度不足', () => {
|
||||||
|
expect(
|
||||||
|
billingErrorText('OPENAI_IMAGE_REQUEST_UNKNOWN', {
|
||||||
|
failureType: 'timeout_unknown',
|
||||||
|
transportMode: 'proxy',
|
||||||
|
causeCode: 'UND_ERR_CONNECT_TIMEOUT'
|
||||||
|
})
|
||||||
|
).toContain('底层连接超时')
|
||||||
|
expect(
|
||||||
|
billingErrorText('OPENAI_IMAGE_PROVIDER_ERROR', {
|
||||||
|
failureType: 'billing_quota_exceeded',
|
||||||
|
transportMode: 'proxy',
|
||||||
|
causeCode: 'UND_ERR_CONNECT_TIMEOUT'
|
||||||
|
})
|
||||||
|
).toContain('计费配额不足')
|
||||||
|
expect(
|
||||||
|
billingErrorText('OPENAI_IMAGE_PROVIDER_ERROR', {
|
||||||
|
failureType: 'billing_quota_exceeded',
|
||||||
|
transportMode: 'proxy',
|
||||||
|
causeCode: 'UND_ERR_CONNECT_TIMEOUT'
|
||||||
|
})
|
||||||
|
).not.toContain('底层连接超时')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('原授权设置与首帧入口追加交互', () => {
|
||||||
|
it('用户逐项接受风险才登记additional,不提交新金额/模型/目标;撤销仍用原接口', async () => {
|
||||||
|
const list = additionalImageFixture(),
|
||||||
|
fetcher = vi.fn<typeof fetch>(async (url, init) => {
|
||||||
|
if (String(url).endsWith('/generation-models')) return response(billingCatalog)
|
||||||
|
if (init?.method === 'POST')
|
||||||
|
return response({ authorizationId: 'additional-created', status: 'approved' })
|
||||||
|
return response(list)
|
||||||
|
})
|
||||||
|
vi.stubGlobal('fetch', fetcher)
|
||||||
|
const wrapper = mount(ImageAuthorizationSettings, { props: { projectId: 'billing-project', disabled: false } })
|
||||||
|
wrappers.push(wrapper)
|
||||||
|
await flushPromises()
|
||||||
|
await wrapper
|
||||||
|
.findAll('.n-collapse-item__header-main')
|
||||||
|
.find(item => item.text() === '原生成请求与费用状态')!
|
||||||
|
.trigger('click')
|
||||||
|
await flushPromises()
|
||||||
|
await wrapper
|
||||||
|
.findAll('button')
|
||||||
|
.find(button => button.text() === '人工有限追加')!
|
||||||
|
.trigger('click')
|
||||||
|
await flushPromises()
|
||||||
|
expect(wrapper.text()).toContain('原精确计划人工有限追加')
|
||||||
|
expect(
|
||||||
|
wrapper
|
||||||
|
.findAllComponents(NInputNumber)
|
||||||
|
.find(input => input.attributes('aria-label') === '人工追加次数')!
|
||||||
|
.props('value')
|
||||||
|
).toBeNull()
|
||||||
|
await wrapper.vm.save()
|
||||||
|
expect(fetcher.mock.calls.filter(([, init]) => init?.method === 'POST')).toHaveLength(0)
|
||||||
|
wrapper
|
||||||
|
.findAllComponents(NInputNumber)
|
||||||
|
.find(input => input.attributes('aria-label') === '人工追加次数')!
|
||||||
|
.vm.$emit('update:value', 2)
|
||||||
|
wrapper
|
||||||
|
.findAllComponents(NInput)
|
||||||
|
.find(input => input.attributes('aria-label') === '追加批准人')!
|
||||||
|
.vm.$emit('update:value', '测试明确批准人')
|
||||||
|
wrapper
|
||||||
|
.findAllComponents(NInput)
|
||||||
|
.find(input => input.attributes('aria-label') === '追加批准说明')!
|
||||||
|
.vm.$emit('update:value', '接受原未知费用,仅追加此精确计划两次')
|
||||||
|
wrapper
|
||||||
|
.findAllComponents(NCheckbox)
|
||||||
|
.find(input => input.text().includes('我接受原请求'))!
|
||||||
|
.vm.$emit('update:checked', true)
|
||||||
|
await flushPromises()
|
||||||
|
await wrapper.vm.save()
|
||||||
|
const call = fetcher.mock.calls.find(([, init]) => init?.method === 'POST')!
|
||||||
|
expect(JSON.parse(String(call[1]?.body))).toEqual({
|
||||||
|
mode: 'additional',
|
||||||
|
idempotencyKey: expect.any(String),
|
||||||
|
parentRequestId: 'original-image-request',
|
||||||
|
maxRequests: 2,
|
||||||
|
acknowledgeUnknownPriorBilling: true,
|
||||||
|
approvedBy: '测试明确批准人',
|
||||||
|
approvalNote: '接受原未知费用,仅追加此精确计划两次'
|
||||||
|
})
|
||||||
|
expect(list.requests[0]!.status).toBe('unknown')
|
||||||
|
await imageAuthorizationApi.revoke('billing-project', 'additional-created', {
|
||||||
|
revokedBy: '测试操作者',
|
||||||
|
reason: '关闭剩余次数'
|
||||||
|
})
|
||||||
|
expect(fetcher.mock.calls.at(-1)?.[0]).toBe(
|
||||||
|
'/api/projects/billing-project/image-authorizations/additional-created/revoke'
|
||||||
|
)
|
||||||
|
expect(fetcher.mock.calls.some(([url]) => /\/keyframe$|\/generate|\/primary|\/vision/.test(String(url)))).toBe(
|
||||||
|
false
|
||||||
|
)
|
||||||
|
})
|
||||||
|
it('首帧必须主动选许可并重新预览,仅提交一次;原本地unknown标记不清除', async () => {
|
||||||
|
const list = additionalImageFixture(),
|
||||||
|
submit = vi.fn<() => Promise<{ accepted: boolean }>>().mockResolvedValue({ accepted: true })
|
||||||
|
const fetcher = vi.fn<typeof fetch>(async url => {
|
||||||
|
const path = String(url)
|
||||||
|
if (path.endsWith('/generation-models')) return response(billingCatalog)
|
||||||
|
if (path.endsWith('/creative-profile')) return response(billingProfile)
|
||||||
|
if (path.endsWith('/resolve'))
|
||||||
|
return response({ provider: 'openai-image', model: 'gpt-image-2.5-flare', options: {} })
|
||||||
|
if (path.endsWith('/image-authorizations')) return response(list)
|
||||||
|
if (path.endsWith('/image-authorizations/preview'))
|
||||||
|
return response({
|
||||||
|
provider: 'openai-image',
|
||||||
|
model: 'gpt-image-2.5-flare',
|
||||||
|
context: {
|
||||||
|
projectId: 'billing-project',
|
||||||
|
targetId: 'audit-shot',
|
||||||
|
scope: 'keyframe',
|
||||||
|
sourceFingerprint: 'c'.repeat(64)
|
||||||
|
},
|
||||||
|
planFingerprint: 'b'.repeat(64),
|
||||||
|
authorization: list
|
||||||
|
})
|
||||||
|
if (path.endsWith('/keyframe/preview')) {
|
||||||
|
return response({
|
||||||
|
shotId: 'audit-shot',
|
||||||
|
provider: 'openai-image',
|
||||||
|
model: 'gpt-image-2.5-flare',
|
||||||
|
providerPrompt: 'Mock首帧输入',
|
||||||
|
previewFingerprint: 'a'.repeat(64),
|
||||||
|
referenceImages: [],
|
||||||
|
generationConfig: {}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
throw new Error('未模拟 ' + path)
|
||||||
|
})
|
||||||
|
vi.stubGlobal('fetch', fetcher)
|
||||||
|
await expect(
|
||||||
|
runGuardedImageRequest('keyframe:audit-shot', async () => {
|
||||||
|
throw new Error('原连接结果未知')
|
||||||
|
})
|
||||||
|
).rejects.toThrow('原连接结果未知')
|
||||||
|
const wrapper = mount(KeyframeDialog, {
|
||||||
|
attachTo: document.body,
|
||||||
|
props: {
|
||||||
|
open: true,
|
||||||
|
projectId: 'billing-project',
|
||||||
|
shotId: 'audit-shot',
|
||||||
|
shotTitle: '隔离镜头',
|
||||||
|
disabled: true,
|
||||||
|
additionalAllowed: true,
|
||||||
|
submitGeneration: submit
|
||||||
|
}
|
||||||
|
})
|
||||||
|
wrappers.push(wrapper)
|
||||||
|
await flushPromises()
|
||||||
|
const selection = wrapper
|
||||||
|
.findAllComponents(NSelect)
|
||||||
|
.find(select => select.attributes('aria-label') === '本次人工追加许可')!
|
||||||
|
expect(selection.props('value')).toBeNull()
|
||||||
|
selection.vm.$emit('update:value', 'additional-permit')
|
||||||
|
await flushPromises()
|
||||||
|
const preview = [...document.querySelectorAll<HTMLButtonElement>('button')].find(
|
||||||
|
button => button.textContent?.trim() === '预览实际生成输入'
|
||||||
|
)!
|
||||||
|
preview.click()
|
||||||
|
await flushPromises()
|
||||||
|
const confirm = [...document.querySelectorAll<HTMLButtonElement>('button')].find(
|
||||||
|
button => button.textContent?.trim() === '确认生成首帧'
|
||||||
|
)!
|
||||||
|
expect(
|
||||||
|
JSON.parse(String(fetcher.mock.calls.find(([url]) => String(url).endsWith('/keyframe/preview'))![1]?.body))
|
||||||
|
).not.toHaveProperty('additionalAuthorizationId')
|
||||||
|
expect(confirm.disabled).toBe(false)
|
||||||
|
confirm.click()
|
||||||
|
await flushPromises()
|
||||||
|
confirm.click()
|
||||||
|
await flushPromises()
|
||||||
|
expect(submit).toHaveBeenCalledTimes(1)
|
||||||
|
expect(submit).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
provider: 'openai-image',
|
||||||
|
additionalAuthorizationId: 'additional-permit',
|
||||||
|
expectedPreviewFingerprint: 'a'.repeat(64),
|
||||||
|
setPrimary: false
|
||||||
|
})
|
||||||
|
)
|
||||||
|
expect(imageRequestNotice('keyframe:audit-shot')).toContain('待核对')
|
||||||
|
expect(list.requests[0]!.status).toBe('unknown')
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,246 @@
|
|||||||
|
import { defineComponent, h } from 'vue'
|
||||||
|
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||||
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||||
|
import { useImageBillingAudit } from '@/features/image-authorization/useImageBillingAudit'
|
||||||
|
import { imageBillingAuditApi } from '@/features/image-authorization/billing-audit-api'
|
||||||
|
import {
|
||||||
|
imageBillingAmountMicros,
|
||||||
|
imageBillingEvidenceIssues,
|
||||||
|
imageBillingReleaseIssues
|
||||||
|
} from '@/features/image-authorization/billing-audit'
|
||||||
|
import { imageAuditFixture, imageAuditFacts } from '../../fixtures/image-billing-audit'
|
||||||
|
import type {
|
||||||
|
ImageBillingEvidenceInput,
|
||||||
|
ImageBillingReviewInput
|
||||||
|
} from '@/features/image-authorization/billing-audit.types'
|
||||||
|
|
||||||
|
/** 释放查询,避免迟到请求串到其它用例。 */
|
||||||
|
const wrappers: VueWrapper[] = []
|
||||||
|
afterEach(() => wrappers.splice(0).forEach(wrapper => wrapper.unmount()))
|
||||||
|
/**
|
||||||
|
* 返回正式包装结构的隔离响应。
|
||||||
|
* @param data Mock业务值
|
||||||
|
* @returns 独立响应
|
||||||
|
*/
|
||||||
|
function response(data: unknown) {
|
||||||
|
return new Response(JSON.stringify({ data }))
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('图片原请求费用事实与正式API', () => {
|
||||||
|
it.each([
|
||||||
|
{ amount: null, micros: null },
|
||||||
|
{ amount: 0, micros: 0 },
|
||||||
|
{ amount: 0.000001, micros: 1 },
|
||||||
|
{ amount: 1.000001, micros: 1000001 },
|
||||||
|
{ amount: 0.0000001, micros: null },
|
||||||
|
{ amount: -1, micros: null },
|
||||||
|
{ amount: 10000000000, micros: null }
|
||||||
|
])('微美元精确换算,不把unknown显示成0:$amount', ({ amount, micros }) =>
|
||||||
|
expect(imageBillingAmountMicros(amount)).toBe(micros)
|
||||||
|
)
|
||||||
|
it('本地和LangSmith编号、弱证据和原成功事实冲突不能用于核清', () => {
|
||||||
|
const view = imageAuditFixture(),
|
||||||
|
facts = imageAuditFacts()
|
||||||
|
facts.providerRequestId = view.requestId
|
||||||
|
expect(imageBillingEvidenceIssues(facts, view)).toContain(
|
||||||
|
'本地任务、请求或 LangSmith 编号不能作为供应方请求号。'
|
||||||
|
)
|
||||||
|
facts.providerRequestId = 'test-trace'
|
||||||
|
facts.artifacts.push({
|
||||||
|
id: 'trace',
|
||||||
|
kind: 'langsmith',
|
||||||
|
recordId: 'test-trace',
|
||||||
|
sha256: '3'.repeat(64),
|
||||||
|
reference: 'Mock观察'
|
||||||
|
})
|
||||||
|
expect(imageBillingEvidenceIssues(facts, view)).toContain(
|
||||||
|
'本地任务、请求或 LangSmith 编号不能作为供应方请求号。'
|
||||||
|
)
|
||||||
|
facts.providerRequestId = 'test-provider-request'
|
||||||
|
facts.execution.outcome = 'unknown'
|
||||||
|
expect(imageBillingReleaseIssues({ ...facts, identity: view.identity }, view).join(' ')).toContain('仍未确认')
|
||||||
|
facts.execution.outcome = 'failed'
|
||||||
|
view.hasOriginalReceipt = true
|
||||||
|
expect(imageBillingReleaseIssues({ ...facts, identity: view.identity }, view)).toContain(
|
||||||
|
'外部声明与原成功回执冲突。'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
it('原项目、原应用请求和原完整身份通过正式图片路径提交,不混用视频或当前新镜头', async () => {
|
||||||
|
const view = imageAuditFixture('p/1', 'r/1'),
|
||||||
|
fetcher = vi.fn<typeof fetch>().mockImplementation(async () => response(view))
|
||||||
|
vi.stubGlobal('fetch', fetcher)
|
||||||
|
await imageBillingAuditApi.get('p/1', 'r/1')
|
||||||
|
const body: ImageBillingEvidenceInput = {
|
||||||
|
expectedTaskFingerprint: view.taskFingerprint,
|
||||||
|
operator: '测试登记人',
|
||||||
|
evidence: { ...imageAuditFacts(), identity: view.identity }
|
||||||
|
}
|
||||||
|
await imageBillingAuditApi.evidence('p/1', 'r/1', body)
|
||||||
|
expect(fetcher.mock.calls.map(([url]) => url)).toEqual([
|
||||||
|
'/api/projects/p%2F1/image-requests/r%2F1/audit',
|
||||||
|
'/api/projects/p%2F1/image-requests/r%2F1/audit/evidence'
|
||||||
|
])
|
||||||
|
expect(JSON.parse(String(fetcher.mock.calls[1]![1]?.body))).toEqual(body)
|
||||||
|
expect(body.evidence.identity).toBe(view.identity)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主动登记一组隔离材料,绝不自动选择复核或解除。
|
||||||
|
* @param form 真实审计表单
|
||||||
|
*/
|
||||||
|
async function register(form: ReturnType<typeof useImageBillingAudit>) {
|
||||||
|
form.operator.value = '测试登记人'
|
||||||
|
form.facts.value = imageAuditFacts()
|
||||||
|
form.confirmed.value = true
|
||||||
|
await form.submit()
|
||||||
|
await flushPromises()
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('图片证据登记与独立复核编排', () => {
|
||||||
|
/**
|
||||||
|
* 挂载真实Hook,所有写入只进入内存投影。
|
||||||
|
* @param projectId 隔离项目
|
||||||
|
* @returns 表单、Mock控制和只读状态
|
||||||
|
*/
|
||||||
|
async function harness(projectId = 'image-audit-flow') {
|
||||||
|
const view = imageAuditFixture(projectId)
|
||||||
|
let conflictNext = false
|
||||||
|
const changed = vi.fn<() => void>()
|
||||||
|
const fetcher = vi.fn<typeof fetch>(async (url, init) => {
|
||||||
|
const path = String(url)
|
||||||
|
if (init?.method !== 'POST')
|
||||||
|
return response({
|
||||||
|
...view,
|
||||||
|
projectId: path.includes('/other-project/') ? 'other-project' : view.projectId,
|
||||||
|
identity: {
|
||||||
|
...view.identity,
|
||||||
|
projectId: path.includes('/other-project/') ? 'other-project' : view.projectId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const body = JSON.parse(String(init.body))
|
||||||
|
if (path.endsWith('/evidence')) {
|
||||||
|
view.history.evidence.push({
|
||||||
|
id: 'registered-evidence',
|
||||||
|
requestId: view.requestId,
|
||||||
|
taskFingerprint: view.taskFingerprint,
|
||||||
|
digest: '3'.repeat(64),
|
||||||
|
body: body as ImageBillingEvidenceInput
|
||||||
|
})
|
||||||
|
view.evidenceSetFingerprint = '4'.repeat(64)
|
||||||
|
return response({ ...view, evidenceId: 'registered-evidence', reused: false })
|
||||||
|
}
|
||||||
|
if (conflictNext) {
|
||||||
|
conflictNext = false
|
||||||
|
view.reviewFingerprint = '5'.repeat(64)
|
||||||
|
return new Response(
|
||||||
|
JSON.stringify({ code: 'IMAGE_BILLING_AUDIT_REVIEW_CONFLICT', message: '另一项复核已先完成' }),
|
||||||
|
{ status: 409 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
view.history.reviews.push({
|
||||||
|
id: 'reviewed-evidence',
|
||||||
|
requestId: view.requestId,
|
||||||
|
taskFingerprint: view.taskFingerprint,
|
||||||
|
digest: '6'.repeat(64),
|
||||||
|
revision: view.history.reviews.length + 1,
|
||||||
|
body: body as ImageBillingReviewInput
|
||||||
|
})
|
||||||
|
view.status = body.decision === 'release_future_charges' ? 'released' : 'blocked'
|
||||||
|
view.released = view.status === 'released'
|
||||||
|
view.billingBlocked = !view.released
|
||||||
|
view.reviewedAmountMicros = view.released ? 1 : null
|
||||||
|
return response({ ...view, reviewId: 'reviewed-evidence', reused: false })
|
||||||
|
})
|
||||||
|
vi.stubGlobal('fetch', fetcher)
|
||||||
|
let form!: ReturnType<typeof useImageBillingAudit>
|
||||||
|
const wrapper = mount(
|
||||||
|
defineComponent({
|
||||||
|
props: { projectId: { type: String, required: true } },
|
||||||
|
setup(props) {
|
||||||
|
form = useImageBillingAudit(
|
||||||
|
{
|
||||||
|
get projectId() {
|
||||||
|
return props.projectId
|
||||||
|
},
|
||||||
|
requestId: 'unknown-image'
|
||||||
|
},
|
||||||
|
changed
|
||||||
|
)
|
||||||
|
return () => h('div')
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
{ props: { projectId } }
|
||||||
|
)
|
||||||
|
wrappers.push(wrapper)
|
||||||
|
await flushPromises()
|
||||||
|
return {
|
||||||
|
form,
|
||||||
|
fetcher,
|
||||||
|
view,
|
||||||
|
changed,
|
||||||
|
wrapper,
|
||||||
|
conflict: () => {
|
||||||
|
conflictNext = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it('登记不解锁;用户另行选择和复核才核清,原unknown/null/预留仍保留', async () => {
|
||||||
|
const { form, fetcher, view, changed } = await harness()
|
||||||
|
expect(fetcher).toHaveBeenCalledTimes(1)
|
||||||
|
expect(form.facts.value.billing.amount).toBeNull()
|
||||||
|
await register(form)
|
||||||
|
expect(view.billingBlocked).toBe(true)
|
||||||
|
expect(view.originalRequestStatus).toBe('unknown')
|
||||||
|
expect(form.action.value).toBe('evidence')
|
||||||
|
expect(form.confirmed.value).toBe(false)
|
||||||
|
expect(fetcher.mock.calls.filter(([, init]) => init?.method === 'POST')).toHaveLength(1)
|
||||||
|
form.action.value = 'review'
|
||||||
|
form.evidenceId.value = 'registered-evidence'
|
||||||
|
form.decision.value = 'release_future_charges'
|
||||||
|
form.reviewer.value = '测试独立复核人'
|
||||||
|
form.reason.value = 'Mock原件与唯一请求已经核对'
|
||||||
|
form.confirmationSha256.value = '7'.repeat(64)
|
||||||
|
form.confirmed.value = true
|
||||||
|
expect(form.canSubmit.value).toBe(true)
|
||||||
|
await form.submit()
|
||||||
|
await flushPromises()
|
||||||
|
expect(view.billingBlocked).toBe(false)
|
||||||
|
expect(view.originalRequestStatus).toBe('unknown')
|
||||||
|
expect(view.originalActualBilledMicros).toBeNull()
|
||||||
|
expect(view.reservedMicros).toBe(1000000)
|
||||||
|
expect(changed).toHaveBeenCalledTimes(2)
|
||||||
|
expect(fetcher.mock.calls.filter(([, init]) => init?.method === 'POST')).toHaveLength(2)
|
||||||
|
expect(fetcher.mock.calls.every(([url]) => String(url).includes('/image-requests/'))).toBe(true)
|
||||||
|
await form.refresh()
|
||||||
|
await form.submit()
|
||||||
|
expect(fetcher.mock.calls.filter(([, init]) => init?.method === 'POST')).toHaveLength(2)
|
||||||
|
})
|
||||||
|
it('409刷新正式GET并保留表单、撤销确认,不自动重复提交', async () => {
|
||||||
|
const setup = await harness('image-conflict')
|
||||||
|
await register(setup.form)
|
||||||
|
const form = setup.form
|
||||||
|
form.action.value = 'review'
|
||||||
|
form.evidenceId.value = 'registered-evidence'
|
||||||
|
form.reviewer.value = '测试复核人'
|
||||||
|
form.reason.value = '保留此前已填理由'
|
||||||
|
form.confirmationSha256.value = '8'.repeat(64)
|
||||||
|
form.confirmed.value = true
|
||||||
|
setup.conflict()
|
||||||
|
await form.submit()
|
||||||
|
expect(form.reason.value).toBe('保留此前已填理由')
|
||||||
|
expect(form.confirmationSha256.value).toBe('8'.repeat(64))
|
||||||
|
expect(form.confirmed.value).toBe(false)
|
||||||
|
expect(form.query.data.value?.reviewFingerprint).toBe('5'.repeat(64))
|
||||||
|
expect(setup.view.history.reviews).toHaveLength(0)
|
||||||
|
await form.submit()
|
||||||
|
expect(setup.fetcher.mock.calls.filter(([url]) => String(url).endsWith('/reviews'))).toHaveLength(1)
|
||||||
|
await setup.wrapper.setProps({ projectId: 'other-project' })
|
||||||
|
await flushPromises()
|
||||||
|
expect(form.operator.value).toBe('')
|
||||||
|
expect(form.reason.value).toBe('')
|
||||||
|
expect(form.confirmationSha256.value).toBe('')
|
||||||
|
expect(form.evidenceId.value).toBe('')
|
||||||
|
expect(form.facts.value.artifacts).toEqual([])
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import { defineComponent, h } from 'vue'
|
||||||
|
import { flushPromises, mount } from '@vue/test-utils'
|
||||||
|
import { expect, it, vi } from 'vitest'
|
||||||
|
import BeatShotDirectory from '@/features/storyboard/components/BeatShotDirectory.vue'
|
||||||
|
import { designedShot } from '@/features/storyboard/testing/fixtures'
|
||||||
|
|
||||||
|
it('定位嵌套镜头时避让所属段落标题,首行镜号不被吸顶标题遮挡', async () => {
|
||||||
|
const wrapper = mount(
|
||||||
|
defineComponent({
|
||||||
|
props: { activeId: { type: String, required: true } },
|
||||||
|
setup: props => () =>
|
||||||
|
h('div', { class: 'n-scrollbar-container' }, [
|
||||||
|
h(BeatShotDirectory, {
|
||||||
|
shots: [designedShot('first'), { ...designedShot('next'), beatNo: 2 }],
|
||||||
|
activeId: props.activeId,
|
||||||
|
itemClass: 'shot-link'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
}),
|
||||||
|
{ props: { activeId: 'first' } }
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
await flushPromises()
|
||||||
|
const viewport = wrapper.get<HTMLElement>('.n-scrollbar-container').element
|
||||||
|
const selected = wrapper.findAll<HTMLElement>('.directory-item')[1]!.element
|
||||||
|
const heading = selected.closest('[role="group"]')!.querySelector('h4')!
|
||||||
|
Object.defineProperty(heading, 'offsetHeight', { configurable: true, value: 38 })
|
||||||
|
vi.spyOn(viewport, 'getBoundingClientRect').mockReturnValue(new DOMRect(0, 100, 240, 400))
|
||||||
|
vi.spyOn(selected, 'getBoundingClientRect').mockReturnValue(new DOMRect(0, 180, 240, 88))
|
||||||
|
viewport.scrollTop = 80
|
||||||
|
/** 记录目录自身滚动目标,断言标题避让距离。 */
|
||||||
|
const scrollTo = vi.fn<(options: ScrollToOptions) => void>()
|
||||||
|
Object.defineProperty(viewport, 'scrollTo', { configurable: true, value: scrollTo })
|
||||||
|
await wrapper.setProps({ activeId: 'next' })
|
||||||
|
await flushPromises()
|
||||||
|
expect(scrollTo).toHaveBeenLastCalledWith({ top: 122, behavior: 'smooth' })
|
||||||
|
} finally {
|
||||||
|
wrapper.unmount()
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,381 @@
|
|||||||
|
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||||
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||||
|
import { NCheckbox, NInput } from 'naive-ui'
|
||||||
|
import JointDraftReviewPanel from '@/features/storyboard/components/JointDraftReviewPanel.vue'
|
||||||
|
import { jointDraftDifferences } from '@/features/storyboard/joint-review'
|
||||||
|
import { visualStateTimeSections, visualStateTimeIssueLabel } from '@/features/storyboard/visual-state-time'
|
||||||
|
import { imagePreviewFixture } from '../../fixtures/image-preview'
|
||||||
|
import { createHash } from 'node:crypto'
|
||||||
|
import { jointReviewFixture } from '../../fixtures/joint-review'
|
||||||
|
|
||||||
|
/** 每个镜头用例隔离项目锁。 */
|
||||||
|
let serial = 0
|
||||||
|
/** 释放查询和免费请求。 */
|
||||||
|
const wrappers: VueWrapper[] = []
|
||||||
|
afterEach(() => wrappers.splice(0).forEach(wrapper => wrapper.unmount()))
|
||||||
|
/**
|
||||||
|
* 正式包装的独立Mock响应。
|
||||||
|
* @param data 原契约数据
|
||||||
|
* @returns 独立响应
|
||||||
|
*/
|
||||||
|
function response(data: unknown) {
|
||||||
|
return new Response(JSON.stringify({ data }))
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('联合采用完整差异与时间展示', () => {
|
||||||
|
it('完整列出摄影、主体及四项环境差异,身份与主体集合仍禁止修改', () => {
|
||||||
|
const fixture = jointReviewFixture(),
|
||||||
|
draft = structuredClone(fixture.saved.draft)
|
||||||
|
let differences = jointDraftDifferences(fixture.formal, draft)
|
||||||
|
expect(differences).toHaveLength(4)
|
||||||
|
expect(differences.every(item => item.allowed)).toBe(true)
|
||||||
|
expect(differences.map(item => item.change?.target)).toEqual([
|
||||||
|
'direction',
|
||||||
|
'direction',
|
||||||
|
'visualState',
|
||||||
|
'subject'
|
||||||
|
])
|
||||||
|
draft.visualState.environment.weather = ''
|
||||||
|
draft.visualState.subjects[0]!.formId = '不能偷偷换形态'
|
||||||
|
differences = jointDraftDifferences(fixture.formal, draft)
|
||||||
|
expect(differences.find(item => item.label === '环境 · 天气')).toMatchObject({
|
||||||
|
allowed: true,
|
||||||
|
change: { target: 'environment', field: 'weather', before: '小雨', after: '' }
|
||||||
|
})
|
||||||
|
expect(differences.filter(item => !item.allowed).map(item => item.label)).toContain('@CH0001 · 形态身份')
|
||||||
|
draft.visualState.subjects.push({ ...draft.visualState.subjects[0]!, subjectRef: '@CH9999' })
|
||||||
|
expect(
|
||||||
|
jointDraftDifferences(fixture.formal, draft).some(item => !item.allowed && item.label.includes('主体集合'))
|
||||||
|
).toBe(true)
|
||||||
|
})
|
||||||
|
it('只按正式四个时间标记排版,旧文字和原问题不被重写或判通过', () => {
|
||||||
|
const note = jointReviewFixture().saved.draft.visualState.continuityNote
|
||||||
|
expect(visualStateTimeSections(note).map(section => section.kind)).toEqual([
|
||||||
|
'input',
|
||||||
|
'planned',
|
||||||
|
'continuity',
|
||||||
|
'video'
|
||||||
|
])
|
||||||
|
expect(visualStateTimeSections('角色已经持物,后续动作尚待拍摄。')).toEqual([
|
||||||
|
{ kind: 'legacy', title: '原衔接说明(未分段)', text: '角色已经持物,后续动作尚待拍摄。' }
|
||||||
|
])
|
||||||
|
expect(visualStateTimeIssueLabel({ code: 'VISUAL_STATE_START_CONFLICT', severity: 'error' })).toBe(
|
||||||
|
'开拍状态冲突'
|
||||||
|
)
|
||||||
|
expect(visualStateTimeIssueLabel({ code: 'VISUAL_STATE_TIME_NEEDS_REVIEW', severity: 'needs_review' })).toBe(
|
||||||
|
'时间语义待人工核对'
|
||||||
|
)
|
||||||
|
expect(
|
||||||
|
visualStateTimeIssueLabel({ code: 'VISUAL_STATE_VIDEO_END_UNSUPPORTED', severity: 'needs_review' })
|
||||||
|
).toBe('真实视频末态缺少证据')
|
||||||
|
expect(visualStateTimeIssueLabel({ code: 'other', severity: 'needs_review' })).toBe('需要人工核对')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击真实组件当前显示的指定操作。
|
||||||
|
* @param wrapper 实际表单
|
||||||
|
* @param label 可见按钮名称
|
||||||
|
*/
|
||||||
|
async function click(wrapper: VueWrapper, label: string) {
|
||||||
|
const button = wrapper.findAll('button').find(item => item.text() === label)!
|
||||||
|
expect(button.attributes('disabled')).toBeUndefined()
|
||||||
|
await button.trigger('click')
|
||||||
|
await flushPromises()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 明确填写实际审核人及剪辑依据。
|
||||||
|
* @param wrapper 实际表单
|
||||||
|
*/
|
||||||
|
async function author(wrapper: VueWrapper) {
|
||||||
|
wrapper
|
||||||
|
.findAllComponents(NInput)
|
||||||
|
.find(input => input.attributes('aria-label') === '联合修订依据')!
|
||||||
|
.vm.$emit('update:value', '本次仅调整当前开拍状态,保留原动作和相邻观察轴。')
|
||||||
|
wrapper
|
||||||
|
.findAllComponents(NInput)
|
||||||
|
.find(input => input.attributes('aria-label') === '联合审核人')!
|
||||||
|
.vm.$emit('update:value', '测试联合审核人')
|
||||||
|
await flushPromises()
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('原摄影抽屉内的联合流程', () => {
|
||||||
|
/**
|
||||||
|
* 挂载真实联合模式,成功/冲突均只写隔离投影。
|
||||||
|
* @param conflict 是否模拟相邻版本冲突
|
||||||
|
* @param reused 是否模拟幂等采用
|
||||||
|
* @param environment 是否包含有据环境修订
|
||||||
|
* @returns 组件、模拟请求及正式来源
|
||||||
|
*/
|
||||||
|
async function editor(conflict = false, reused = false, environment = false) {
|
||||||
|
const projectId = `joint-flow-${++serial}`,
|
||||||
|
fixture = jointReviewFixture(projectId)
|
||||||
|
/** 正式项目详情中的本集身份与原始正文,摘要不能代替正文哈希。 */
|
||||||
|
const episode = {
|
||||||
|
id: 'source-episode',
|
||||||
|
projectId,
|
||||||
|
episode: 1,
|
||||||
|
title: '当前源集',
|
||||||
|
content: '第一行\r\n午后,维修间透入日光。\n天气未指定。'
|
||||||
|
}
|
||||||
|
if (environment) {
|
||||||
|
fixture.saved.draft.visualState.environment.timeOfDay = '午后'
|
||||||
|
fixture.saved.draft.visualState.environment.weather = ''
|
||||||
|
fixture.saved.draft.visualState.environment.atmosphere = '自然日光'
|
||||||
|
fixture.saved.draft.visualState.environment.transientState = ''
|
||||||
|
}
|
||||||
|
const fetcher = vi.fn<typeof fetch>(async (url, init) => {
|
||||||
|
const path = String(url)
|
||||||
|
if (path === `/api/projects/${projectId}`) return response({ id: projectId, episodes: [episode] })
|
||||||
|
if (path.includes('/keyframe-review-draft')) {
|
||||||
|
if (init?.method === 'PUT') {
|
||||||
|
const body = JSON.parse(String(init.body))
|
||||||
|
fixture.saved.draft = body.draft
|
||||||
|
fixture.saved.revision++
|
||||||
|
fixture.saved.providerInput = body.providerInput
|
||||||
|
fixture.saved.expectedCurrentFormalSourceFingerprint = body.expectedCurrentFormalSourceFingerprint
|
||||||
|
}
|
||||||
|
return response(fixture.saved)
|
||||||
|
}
|
||||||
|
if (path.endsWith('/storyboard-quality-confirmation'))
|
||||||
|
return response({ ...fixture.approval.approval, valid: true, confirmation: fixture.approval.record })
|
||||||
|
if (path.includes('/storyboard-directions?')) return response(fixture.directions)
|
||||||
|
if (path.includes('/storyboard-visual-states?')) return response(fixture.visuals)
|
||||||
|
if (path.includes('/keyframe-spec')) return response(fixture.keyframe)
|
||||||
|
if (path.includes('/keyframe/preview')) {
|
||||||
|
const body = JSON.parse(String(init?.body))
|
||||||
|
if (!body.draft) return response({ ...imagePreviewFixture(), shotId: fixture.shot.shotId })
|
||||||
|
return response({
|
||||||
|
...imagePreviewFixture(),
|
||||||
|
shotId: fixture.shot.shotId,
|
||||||
|
draftFingerprint: 'a'.repeat(64),
|
||||||
|
currentDerivedFingerprint: 'c'.repeat(64),
|
||||||
|
adjacentDerivedVersions: [{ shotId: 'shot-db-1-2', derivedFingerprint: 'd'.repeat(64) }],
|
||||||
|
productionReady: false,
|
||||||
|
productionGate: { ready: false, reason: '项目未完成' },
|
||||||
|
sceneSources: []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (path.endsWith('/storyboard-derived-reviews/confirm')) {
|
||||||
|
const body = JSON.parse(String(init?.body))
|
||||||
|
if (conflict) {
|
||||||
|
if (environment) episode.content += '\n源正文已被其他人修改。'
|
||||||
|
return new Response(
|
||||||
|
JSON.stringify({
|
||||||
|
message: environment
|
||||||
|
? 'JOINT_REVISION_ENVIRONMENT_SOURCE_STALE: 本集原文已变化。'
|
||||||
|
: 'JOINT_REVISION_NEIGHBOR_STALE: 紧邻镜头已更新,请重读。'
|
||||||
|
}),
|
||||||
|
{ status: 409 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (!body.preview) fixture.saved.status = 'stale'
|
||||||
|
return response({
|
||||||
|
projectId,
|
||||||
|
preview: body.preview,
|
||||||
|
changed: !body.preview && !reused,
|
||||||
|
reused: !body.preview && reused,
|
||||||
|
requestFingerprint: 'f'.repeat(64),
|
||||||
|
shots: [
|
||||||
|
{ shotId: fixture.shot.shotId, directionId: 'direction-formal', visualStateId: 'visual-formal' }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
throw new Error(`未模拟 ${init?.method ?? 'GET'} ${path}`)
|
||||||
|
})
|
||||||
|
vi.stubGlobal('fetch', fetcher)
|
||||||
|
const wrapper = mount(JointDraftReviewPanel, {
|
||||||
|
props: { projectId, episodeNo: 1, shot: fixture.shot, shots: fixture.shots, disabled: false }
|
||||||
|
})
|
||||||
|
wrappers.push(wrapper)
|
||||||
|
await flushPromises()
|
||||||
|
return { wrapper, fixture, fetcher, episode }
|
||||||
|
}
|
||||||
|
it.each([false, true])('保存、画面预览、联合免费预检和采用分开,幂等回执=%s', async reused => {
|
||||||
|
const { wrapper, fetcher, fixture } = await editor(false, reused)
|
||||||
|
expect(wrapper.text()).toContain('完整字段差异(4 项)')
|
||||||
|
expect(fetcher.mock.calls.every(([, init]) => init?.method === 'GET')).toBe(true)
|
||||||
|
wrapper
|
||||||
|
.findAllComponents(NInput)
|
||||||
|
.find(input => input.attributes('aria-label') === '联合摄影意图')!
|
||||||
|
.vm.$emit('update:value', '明确修改后保存的摄影意图')
|
||||||
|
await flushPromises()
|
||||||
|
await wrapper.vm.save()
|
||||||
|
await flushPromises()
|
||||||
|
expect(wrapper.emitted('changed')).toBeUndefined()
|
||||||
|
expect(fetcher.mock.calls.filter(([, init]) => init?.method === 'PUT')).toHaveLength(1)
|
||||||
|
await click(wrapper, '免费核对草案画面输入')
|
||||||
|
expect(wrapper.text()).toContain('相邻镜头依据')
|
||||||
|
await author(wrapper)
|
||||||
|
await click(wrapper, '免费预检联合采用')
|
||||||
|
expect(wrapper.vm.canAdopt).toBe(false)
|
||||||
|
wrapper.getComponent(NCheckbox).vm.$emit('update:checked', true)
|
||||||
|
await flushPromises()
|
||||||
|
expect(wrapper.vm.canAdopt).toBe(true)
|
||||||
|
await wrapper.vm.adopt()
|
||||||
|
await flushPromises()
|
||||||
|
const confirms = fetcher.mock.calls.filter(([url]) =>
|
||||||
|
String(url).endsWith('/storyboard-derived-reviews/confirm')
|
||||||
|
)
|
||||||
|
expect(confirms).toHaveLength(2)
|
||||||
|
const first = JSON.parse(String(confirms[0]![1]?.body)),
|
||||||
|
second = JSON.parse(String(confirms[1]![1]?.body))
|
||||||
|
expect(second).toEqual({ ...first, preview: false })
|
||||||
|
expect(first.shots[0].jointRevision).toMatchObject({
|
||||||
|
expectedDraftRevision: 8,
|
||||||
|
expectedDerivedFingerprint: 'c'.repeat(64),
|
||||||
|
expectedNeighbors: [{ shotId: 'shot-db-1-2', derivedFingerprint: 'd'.repeat(64) }]
|
||||||
|
})
|
||||||
|
expect(first.shots[0].jointRevision.changes).toHaveLength(4)
|
||||||
|
expect(first.shots[0].jointRevision).not.toHaveProperty('environmentSource')
|
||||||
|
expect(first.shots[0].expectedCurrentFormalSourceFingerprint).toBe(fixture.keyframe.formalSourceFingerprint)
|
||||||
|
expect(first.shots[0].draft).not.toHaveProperty('subjectStateRevision')
|
||||||
|
expect(wrapper.emitted('changed')).toHaveLength(1)
|
||||||
|
expect(fetcher.mock.calls.filter(([, init]) => init?.method === 'PUT')).toHaveLength(1)
|
||||||
|
expect(fetcher.mock.calls.some(([url]) => /\/keyframe$|\/generate|\/vision|\/primary/.test(String(url)))).toBe(
|
||||||
|
false
|
||||||
|
)
|
||||||
|
expect(wrapper.text()).toContain('原草案和历史保留')
|
||||||
|
})
|
||||||
|
it('邻镜变化409保留原稿并重读,不自动采用或改为当前新版本', async () => {
|
||||||
|
const { wrapper, fetcher } = await editor(true)
|
||||||
|
await click(wrapper, '免费核对草案画面输入')
|
||||||
|
await author(wrapper)
|
||||||
|
await click(wrapper, '免费预检联合采用')
|
||||||
|
expect(wrapper.vm.canAdopt).toBe(false)
|
||||||
|
expect(wrapper.text()).toContain('当前输入已保留')
|
||||||
|
expect(
|
||||||
|
wrapper
|
||||||
|
.findAllComponents(NInput)
|
||||||
|
.find(input => input.attributes('aria-label') === '联合摄影意图')!
|
||||||
|
.props('value')
|
||||||
|
).toBe('保留正式动作的开拍意图')
|
||||||
|
const confirms = fetcher.mock.calls.filter(([url]) =>
|
||||||
|
String(url).endsWith('/storyboard-derived-reviews/confirm')
|
||||||
|
)
|
||||||
|
expect(confirms).toHaveLength(1)
|
||||||
|
expect(JSON.parse(String(confirms[0]![1]?.body)).preview).toBe(true)
|
||||||
|
expect(wrapper.emitted('changed')).toBeUndefined()
|
||||||
|
})
|
||||||
|
it('内容改变撤销原预检,不自动套用重新读取的草案', async () => {
|
||||||
|
const { wrapper, fetcher, fixture } = await editor()
|
||||||
|
await click(wrapper, '免费核对草案画面输入')
|
||||||
|
await author(wrapper)
|
||||||
|
await click(wrapper, '免费预检联合采用')
|
||||||
|
wrapper.getComponent(NCheckbox).vm.$emit('update:checked', true)
|
||||||
|
await flushPromises()
|
||||||
|
wrapper
|
||||||
|
.findAllComponents(NInput)
|
||||||
|
.find(input => input.attributes('aria-label') === '摄影构图')!
|
||||||
|
.vm.$emit('update:value', '重新编辑,旧确认失效')
|
||||||
|
await flushPromises()
|
||||||
|
expect(wrapper.vm.canAdopt).toBe(false)
|
||||||
|
fixture.saved.draft.visualState.environment.weather = '不能暗改天气'
|
||||||
|
await click(wrapper, '重新读取正式来源与草案')
|
||||||
|
expect(
|
||||||
|
fetcher.mock.calls.filter(([url]) => String(url).endsWith('/storyboard-derived-reviews/confirm'))
|
||||||
|
).toHaveLength(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('环境差异须逐字本集证据,冻结原字节全文SHA;保存和预检不自动采用', async () => {
|
||||||
|
const { wrapper, fetcher, episode } = await editor(false, false, true)
|
||||||
|
expect(wrapper.text()).toContain('本集原文依据')
|
||||||
|
await wrapper.vm.save()
|
||||||
|
await flushPromises()
|
||||||
|
await click(wrapper, '免费核对草案画面输入')
|
||||||
|
await author(wrapper)
|
||||||
|
const preflight = () => wrapper.findAll('button').find(item => item.text() === '免费预检联合采用')!
|
||||||
|
expect(preflight().attributes('disabled')).toBeDefined()
|
||||||
|
const quote = wrapper
|
||||||
|
.findAllComponents(NInput)
|
||||||
|
.find(input => input.attributes('aria-label') === '环境原文片段')!
|
||||||
|
quote.vm.$emit('update:value', '另一集才有的晴天')
|
||||||
|
await flushPromises()
|
||||||
|
expect(preflight().attributes('disabled')).toBeDefined()
|
||||||
|
quote.vm.$emit('update:value', '午后,维修间透入日光。')
|
||||||
|
await flushPromises()
|
||||||
|
await click(wrapper, '免费预检联合采用')
|
||||||
|
const confirms = () =>
|
||||||
|
fetcher.mock.calls.filter(([url]) => String(url).endsWith('/storyboard-derived-reviews/confirm'))
|
||||||
|
expect(confirms()).toHaveLength(1)
|
||||||
|
const previewBody = JSON.parse(String(confirms()[0]![1]?.body))
|
||||||
|
expect(previewBody.shots[0].jointRevision.environmentSource).toEqual({
|
||||||
|
episodeId: 'source-episode',
|
||||||
|
expectedContentFingerprint: createHash('sha256').update(episode.content).digest('hex'),
|
||||||
|
quote: '午后,维修间透入日光。'
|
||||||
|
})
|
||||||
|
expect(
|
||||||
|
previewBody.shots[0].jointRevision.changes.filter((row: { target: string }) => row.target === 'environment')
|
||||||
|
).toHaveLength(4)
|
||||||
|
expect(wrapper.vm.canAdopt).toBe(false)
|
||||||
|
wrapper.getComponent(NCheckbox).vm.$emit('update:checked', true)
|
||||||
|
await flushPromises()
|
||||||
|
quote.vm.$emit('update:value', '午后,维修间透入日光。\n天气未指定。')
|
||||||
|
await flushPromises()
|
||||||
|
expect(wrapper.vm.canAdopt).toBe(false)
|
||||||
|
await click(wrapper, '免费预检联合采用')
|
||||||
|
wrapper.getComponent(NCheckbox).vm.$emit('update:checked', true)
|
||||||
|
await flushPromises()
|
||||||
|
await Promise.all([wrapper.vm.adopt(), wrapper.vm.adopt()])
|
||||||
|
expect(confirms()).toHaveLength(3)
|
||||||
|
const second = JSON.parse(String(confirms()[1]![1]?.body)),
|
||||||
|
adopted = JSON.parse(String(confirms()[2]![1]?.body))
|
||||||
|
expect(adopted).toEqual({ ...second, preview: false })
|
||||||
|
expect(fetcher.mock.calls.some(([url]) => /\/keyframe$|\/generate|\/vision|\/primary/.test(String(url)))).toBe(
|
||||||
|
false
|
||||||
|
)
|
||||||
|
})
|
||||||
|
it('环境来源409重读本集全文并保留片段和草案,不自动重试', async () => {
|
||||||
|
const { wrapper, fetcher, episode } = await editor(true, false, true)
|
||||||
|
await click(wrapper, '免费核对草案画面输入')
|
||||||
|
await author(wrapper)
|
||||||
|
const quote = wrapper
|
||||||
|
.findAllComponents(NInput)
|
||||||
|
.find(input => input.attributes('aria-label') === '环境原文片段')!
|
||||||
|
quote.vm.$emit('update:value', '午后,维修间透入日光。')
|
||||||
|
await flushPromises()
|
||||||
|
await click(wrapper, '免费预检联合采用')
|
||||||
|
expect(quote.props('value')).toBe('午后,维修间透入日光。')
|
||||||
|
expect(wrapper.vm.canAdopt).toBe(false)
|
||||||
|
expect(
|
||||||
|
fetcher.mock.calls.filter(([url]) => String(url).endsWith('/storyboard-derived-reviews/confirm'))
|
||||||
|
).toHaveLength(1)
|
||||||
|
expect(
|
||||||
|
fetcher.mock.calls.filter(([url]) => String(url) === `/api/projects/${episode.projectId}`).length
|
||||||
|
).toBeGreaterThanOrEqual(2)
|
||||||
|
await wrapper
|
||||||
|
.findAll('.n-collapse-item__header-main')
|
||||||
|
.find(item => item.text() === '环境修订(需本集原文)')!
|
||||||
|
.trigger('click')
|
||||||
|
await flushPromises()
|
||||||
|
expect(
|
||||||
|
wrapper
|
||||||
|
.findAllComponents(NInput)
|
||||||
|
.find(input => input.attributes('aria-label') === '环境天气')!
|
||||||
|
.props('value')
|
||||||
|
).toBe('')
|
||||||
|
})
|
||||||
|
it('正式集身份或全文缺失时保留输入但不允许环境预检', async () => {
|
||||||
|
const { wrapper, episode, fetcher } = await editor(false, false, true)
|
||||||
|
await click(wrapper, '免费核对草案画面输入')
|
||||||
|
await author(wrapper)
|
||||||
|
const quote = wrapper
|
||||||
|
.findAllComponents(NInput)
|
||||||
|
.find(input => input.attributes('aria-label') === '环境原文片段')!
|
||||||
|
quote.vm.$emit('update:value', '午后,维修间透入日光。')
|
||||||
|
await flushPromises()
|
||||||
|
Reflect.deleteProperty(episode, 'content')
|
||||||
|
await click(wrapper, '刷新本集原文')
|
||||||
|
expect(wrapper.text()).toContain('缺少本集正式身份或全文')
|
||||||
|
expect(quote.props('value')).toBe('午后,维修间透入日光。')
|
||||||
|
expect(
|
||||||
|
wrapper
|
||||||
|
.findAll('button')
|
||||||
|
.find(item => item.text() === '免费预检联合采用')!
|
||||||
|
.attributes('disabled')
|
||||||
|
).toBeDefined()
|
||||||
|
expect(
|
||||||
|
fetcher.mock.calls.filter(([url]) => String(url).endsWith('/storyboard-derived-reviews/confirm'))
|
||||||
|
).toHaveLength(0)
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||||
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||||
|
import StoryboardPage from '@/features/storyboard/StoryboardPage.vue'
|
||||||
|
import { projectContextKey } from '@/features/projects/context'
|
||||||
|
import { testProjectContext } from '@/testing/project-context'
|
||||||
|
import { directionsResult, visualStatesResult, storyboardCheckpoint } from '@/features/storyboard/testing/fixtures'
|
||||||
|
import { preparationFixture } from '../storyboard-preparation/fixtures'
|
||||||
|
import type { WorkflowExecution } from '@/features/workflows/execution.types'
|
||||||
|
|
||||||
|
/** 释放真实页面及任务订阅,避免迟到响应跨用例。 */
|
||||||
|
const wrappers: VueWrapper[] = []
|
||||||
|
afterEach(() => {
|
||||||
|
wrappers.splice(0).forEach(wrapper => wrapper.unmount())
|
||||||
|
localStorage.clear()
|
||||||
|
})
|
||||||
|
/**
|
||||||
|
* 还原进入页面后发现已结束历史任务的场景,不连接真实服务。
|
||||||
|
* @param projectId 当前隔离项目
|
||||||
|
* @returns 实际页面和请求记录
|
||||||
|
*/
|
||||||
|
async function page(projectId: string) {
|
||||||
|
const context = testProjectContext(projectId)
|
||||||
|
context.data.value!.checkpoints = [storyboardCheckpoint()]
|
||||||
|
const fixture = preparationFixture(projectId)
|
||||||
|
const history: WorkflowExecution = {
|
||||||
|
id: 'restored-direction-history',
|
||||||
|
projectId,
|
||||||
|
workflowName: 'storyboard-direction',
|
||||||
|
status: 'completed',
|
||||||
|
stage: 'completed',
|
||||||
|
current: 2,
|
||||||
|
total: 2,
|
||||||
|
currentResourceId: null,
|
||||||
|
metadata: { episodeNo: 1 },
|
||||||
|
error: null,
|
||||||
|
startedAt: null,
|
||||||
|
completedAt: null,
|
||||||
|
createdAt: '2026-11-16T00:00:00Z',
|
||||||
|
updatedAt: '2026-11-16T00:00:00Z',
|
||||||
|
result: {
|
||||||
|
projectId,
|
||||||
|
episodeCount: 1,
|
||||||
|
completedEpisodes: 1,
|
||||||
|
skippedEpisodes: 0,
|
||||||
|
failedEpisodes: 0,
|
||||||
|
episodes: [{ episodeNo: 1, status: 'completed', directionCount: 2, shotCount: 2 }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
localStorage.setItem(`short-drama:workflow-execution:${projectId}:storyboard-direction`, history.id)
|
||||||
|
const fetcher = vi.fn<typeof fetch>(async (url, init) => {
|
||||||
|
const path = String(url)
|
||||||
|
if (init?.method && init.method !== 'GET') throw new Error('浏览页面不应产生写入')
|
||||||
|
let data: unknown
|
||||||
|
if (path.includes('/storyboard-directions?')) data = directionsResult(projectId)
|
||||||
|
else if (path.includes('/storyboard-visual-states?')) data = visualStatesResult(projectId, 1, true)
|
||||||
|
else if (path.endsWith('/storyboard-quality-confirmation'))
|
||||||
|
data = { ...fixture.approval, valid: true, confirmation: fixture.record }
|
||||||
|
else if (path.endsWith('/storyboard-quality-confirmation/preflight'))
|
||||||
|
data = {
|
||||||
|
current: { ...fixture.approval, valid: true, confirmation: fixture.record },
|
||||||
|
quality: fixture.quality
|
||||||
|
}
|
||||||
|
else if (path.endsWith('/production/entry-readiness')) data = fixture.entry
|
||||||
|
else if (path.endsWith('/storyboard/duration-audit')) data = { projectId, issues: [] }
|
||||||
|
else if (path.endsWith('/duration-budget')) data = { projectId, episodes: [] }
|
||||||
|
else if (path.includes('/workflow-executions/latest'))
|
||||||
|
data = path.includes('workflowName=storyboard-direction') ? history : null
|
||||||
|
else if (path.includes('/workflow-executions/restored-direction-history')) data = history
|
||||||
|
else throw new Error(`未模拟只读请求 ${path}`)
|
||||||
|
return Response.json({ data })
|
||||||
|
})
|
||||||
|
vi.stubGlobal('fetch', fetcher)
|
||||||
|
const wrapper = mount(StoryboardPage, {
|
||||||
|
attachTo: document.body,
|
||||||
|
global: { provide: { [projectContextKey as symbol]: context } }
|
||||||
|
})
|
||||||
|
wrappers.push(wrapper)
|
||||||
|
await flushPromises()
|
||||||
|
await flushPromises()
|
||||||
|
return { wrapper, fetcher }
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('分镜浏览与生成配置分离', () => {
|
||||||
|
it('恢复历史回执只提示入口,不自动打开生成配置', async () => {
|
||||||
|
const { wrapper, fetcher } = await page('browse-restored-history')
|
||||||
|
expect(wrapper.find('[data-workspace-tools]').attributes('aria-expanded')).toBe('false')
|
||||||
|
expect(wrapper.find('[data-workspace-tools]').text()).toContain('有回执')
|
||||||
|
expect(document.body.querySelector('.n-drawer')).toBeNull()
|
||||||
|
expect(fetcher.mock.calls.every(([, init]) => !init?.method || init.method === 'GET')).toBe(true)
|
||||||
|
})
|
||||||
|
it('普通目录只浏览,用户打开生成范围后才能按镜头勾选,历史回执仍可查看', async () => {
|
||||||
|
const { wrapper, fetcher } = await page('browse-range-selection')
|
||||||
|
const directory = wrapper.get('nav[aria-label="本集镜头"]')
|
||||||
|
expect(directory.findAll('[role="checkbox"]')).toHaveLength(0)
|
||||||
|
await directory.findAll('button')[1]!.trigger('click')
|
||||||
|
expect(directory.findAll('.selected')).toHaveLength(1)
|
||||||
|
await wrapper.get('[data-workspace-tools]').trigger('click')
|
||||||
|
await flushPromises()
|
||||||
|
const history = [...document.querySelectorAll<HTMLElement>('.n-collapse-item__header-main')].find(item =>
|
||||||
|
item.textContent?.includes('历史任务与回执')
|
||||||
|
)!
|
||||||
|
history.click()
|
||||||
|
await flushPromises()
|
||||||
|
expect(document.body.textContent).toContain('摄影设计任务')
|
||||||
|
const range = [...document.querySelectorAll<HTMLElement>('.n-collapse-item__header-main')].find(item =>
|
||||||
|
item.textContent?.includes('选择镜头')
|
||||||
|
)!
|
||||||
|
range.click()
|
||||||
|
await flushPromises()
|
||||||
|
const checkbox = document.querySelector<HTMLElement>('.n-drawer [aria-label="选择镜头 1.1"]')!
|
||||||
|
checkbox.click()
|
||||||
|
await flushPromises()
|
||||||
|
expect(document.body.textContent).toContain('第 1 集所选 1 镜')
|
||||||
|
expect(directory.findAll('[role="checkbox"]')).toHaveLength(0)
|
||||||
|
expect(fetcher.mock.calls.every(([, init]) => !init?.method || init.method === 'GET')).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
Vendored
+60
@@ -0,0 +1,60 @@
|
|||||||
|
import { imageAuthorizationsFixture } from './billing'
|
||||||
|
import type { ImageChargeRequest, ImageAuthorizationList } from '../../src/features/image-authorization/types'
|
||||||
|
/**
|
||||||
|
* 仅供Mock的unknown请求及同一精确计划的有限许可。
|
||||||
|
* @param projectId 隔离项目
|
||||||
|
* @returns 原预留与unknown始终保留的费用投影
|
||||||
|
*/
|
||||||
|
export function additionalImageFixture(projectId = 'billing-project'): ImageAuthorizationList {
|
||||||
|
const list = imageAuthorizationsFixture()
|
||||||
|
const grant = list.authorizations[0]!
|
||||||
|
const parent: ImageChargeRequest = {
|
||||||
|
id: 'original-image-request',
|
||||||
|
status: 'unknown',
|
||||||
|
input: {
|
||||||
|
projectId,
|
||||||
|
authorizationId: grant.id,
|
||||||
|
candidateId: 'original-image',
|
||||||
|
targetId: 'audit-shot',
|
||||||
|
scope: 'keyframe',
|
||||||
|
provider: 'openai-image',
|
||||||
|
model: 'gpt-image-2.5-flare',
|
||||||
|
planFingerprint: 'b'.repeat(64),
|
||||||
|
sourceFingerprint: 'c'.repeat(64),
|
||||||
|
reservedMicros: grant.input.perRequestMicros,
|
||||||
|
request: { prompt: '仅供Mock的原精确计划' }
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
usageCostMicros: null,
|
||||||
|
actualBilledMicros: null,
|
||||||
|
error: { failureType: 'timeout_unknown', transportMode: 'proxy', causeCode: 'UND_ERR_CONNECT_TIMEOUT' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
grant.usedRequests++
|
||||||
|
grant.remainingRequests--
|
||||||
|
grant.accountedMicros += parent.input.reservedMicros
|
||||||
|
grant.remainingMicros -= parent.input.reservedMicros
|
||||||
|
list.requests.push(parent)
|
||||||
|
list.billingBlocked = true
|
||||||
|
list.originalBlockingRequestIds = [parent.id]
|
||||||
|
list.blockingRequestIds = [parent.id]
|
||||||
|
list.additionalAuthorizations = [
|
||||||
|
{
|
||||||
|
id: 'additional-permit',
|
||||||
|
status: 'approved',
|
||||||
|
input: {
|
||||||
|
mode: 'additional',
|
||||||
|
idempotencyKey: 'test-additional',
|
||||||
|
parentRequestId: parent.id,
|
||||||
|
maxRequests: 2,
|
||||||
|
acknowledgeUnknownPriorBilling: true,
|
||||||
|
approvedBy: '测试人工批准人',
|
||||||
|
approvalNote: '仅供Mock的有限风险确认',
|
||||||
|
parentInputFingerprint: 'd'.repeat(64)
|
||||||
|
},
|
||||||
|
usedRequests: 0,
|
||||||
|
remainingRequests: 2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
return list
|
||||||
|
}
|
||||||
+72
@@ -0,0 +1,72 @@
|
|||||||
|
import type { BillingFacts } from '../../src/features/billing-audit/types'
|
||||||
|
import type { ImageBillingAuditView } from '../../src/features/image-authorization/billing-audit.types'
|
||||||
|
/**
|
||||||
|
* 仅供Mock的原图片请求视图,不代表真实Provider材料。
|
||||||
|
* @param projectId 隔离项目
|
||||||
|
* @param requestId 隔离原请求
|
||||||
|
* @returns 带完整原版本和空历史的审计视图
|
||||||
|
*/
|
||||||
|
export function imageAuditFixture(projectId = 'audit-project', requestId = 'unknown-image'): ImageBillingAuditView {
|
||||||
|
return {
|
||||||
|
projectId,
|
||||||
|
requestId,
|
||||||
|
identity: {
|
||||||
|
projectId,
|
||||||
|
requestId,
|
||||||
|
authorizationId: 'grant',
|
||||||
|
scope: 'keyframe',
|
||||||
|
targetId: 'audit-shot',
|
||||||
|
candidateId: 'unknown-candidate',
|
||||||
|
provider: 'openai-image',
|
||||||
|
model: 'gpt-image-2.5-flare',
|
||||||
|
sourceFingerprint: 'c'.repeat(64),
|
||||||
|
planFingerprint: 'b'.repeat(64),
|
||||||
|
requestFingerprint: 'd'.repeat(64)
|
||||||
|
},
|
||||||
|
taskFingerprint: 'a'.repeat(64),
|
||||||
|
evidenceSetFingerprint: 'e'.repeat(64),
|
||||||
|
reviewFingerprint: 'f'.repeat(64),
|
||||||
|
originalRequestStatus: 'unknown',
|
||||||
|
reservedMicros: 1_000_000,
|
||||||
|
originalUsageCostMicros: null,
|
||||||
|
originalActualBilledMicros: null,
|
||||||
|
originalProviderRequestId: null,
|
||||||
|
hasOriginalReceipt: false,
|
||||||
|
originalBillingBlocked: true,
|
||||||
|
billingBlocked: true,
|
||||||
|
released: false,
|
||||||
|
status: 'unreviewed',
|
||||||
|
reviewId: null,
|
||||||
|
reviewedAmountMicros: null,
|
||||||
|
releaseIssues: ['缺少当前独立复核的证据'],
|
||||||
|
history: { evidence: [], reviews: [] }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 只用于隔离验收的合格材料,不能登记到正式项目。
|
||||||
|
* @returns 明确标为测试的Provider原件声明
|
||||||
|
*/
|
||||||
|
export function imageAuditFacts(): BillingFacts {
|
||||||
|
return {
|
||||||
|
correlation: 'unique',
|
||||||
|
providerRequestId: 'test-provider-request',
|
||||||
|
artifacts: [
|
||||||
|
{
|
||||||
|
id: 'exec',
|
||||||
|
kind: 'provider-execution',
|
||||||
|
recordId: 'test-provider-execution',
|
||||||
|
sha256: '1'.repeat(64),
|
||||||
|
reference: '仅供Mock验收的执行原件'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'bill',
|
||||||
|
kind: 'provider-billing',
|
||||||
|
recordId: 'test-provider-bill',
|
||||||
|
sha256: '2'.repeat(64),
|
||||||
|
reference: '仅供Mock验收的账单原件'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
execution: { outcome: 'failed', evidenceIds: ['exec'] },
|
||||||
|
billing: { finding: 'charged', amount: 0.000001, currency: 'USD', evidenceIds: ['bill'] }
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+53
@@ -0,0 +1,53 @@
|
|||||||
|
import { directionsResult, visualStatesResult, designedShot } from '../../src/features/storyboard/testing/fixtures'
|
||||||
|
import { draftFromFormal } from '../../src/features/storyboard/derived-review'
|
||||||
|
import { preparationFixture } from '../features/storyboard-preparation/fixtures'
|
||||||
|
import type { KeyframeSpec } from '../../src/features/production/types'
|
||||||
|
import type { SavedKeyframeDraft } from '../../src/features/storyboard/derived-review.types'
|
||||||
|
/**
|
||||||
|
* 当前正式数据和已保存草案的隔离投影,不用于正式项目。
|
||||||
|
* @param projectId 隔离项目
|
||||||
|
* @returns 可用于Vitest/Chrome的完整原版本与有限差异
|
||||||
|
*/
|
||||||
|
export function jointReviewFixture(projectId = 'joint-review-project') {
|
||||||
|
const shot = designedShot(),
|
||||||
|
approval = preparationFixture(projectId),
|
||||||
|
directions = directionsResult(projectId),
|
||||||
|
visuals = visualStatesResult(projectId, 1, true)
|
||||||
|
const keyframe: KeyframeSpec = {
|
||||||
|
projectId,
|
||||||
|
shotId: shot.shotId,
|
||||||
|
episodeNo: 1,
|
||||||
|
beatNo: 1,
|
||||||
|
shotNo: 1,
|
||||||
|
prompt: '隔离正式开拍输入',
|
||||||
|
formalSourceFingerprint: 'e'.repeat(64),
|
||||||
|
references: []
|
||||||
|
}
|
||||||
|
const formal = draftFromFormal(shot, keyframe, approval.record.shotFingerprint)
|
||||||
|
const draft = structuredClone(formal)
|
||||||
|
draft.direction.composition = '仅用于Mock的构图调整'
|
||||||
|
draft.direction.visualIntent = '保留正式动作的开拍意图'
|
||||||
|
draft.visualState.subjects[0]!.pose = '仅用于Mock的0秒姿态'
|
||||||
|
draft.visualState.continuityNote =
|
||||||
|
'【输入事实】原主体保持开拍姿态。【规划末态】后续镜头规划,尚未执行。【连续要求】保持原观察轴。【视频末态】未知,尚无真实视频末态证据。'
|
||||||
|
const saved: SavedKeyframeDraft = {
|
||||||
|
shotId: shot.shotId,
|
||||||
|
revision: 7,
|
||||||
|
updatedAt: '2026-11-16T01:00:00Z',
|
||||||
|
status: 'current',
|
||||||
|
staleReason: null,
|
||||||
|
draft,
|
||||||
|
providerInput: { provider: 'openai-image', generationOptions: { quality: 'auto' } },
|
||||||
|
expectedCurrentFormalSourceFingerprint: keyframe.formalSourceFingerprint!
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
shot,
|
||||||
|
shots: [shot, { ...designedShot('shot-db-1-2'), beatNo: 2 }],
|
||||||
|
approval,
|
||||||
|
directions,
|
||||||
|
visuals,
|
||||||
|
keyframe,
|
||||||
|
formal,
|
||||||
|
saved
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user