From 518b630a46dad36624e97a0b3a52154dfa95d942 Mon Sep 17 00:00:00 2001 From: GJ Date: Sat, 7 Nov 2026 12:23:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(short-drama-agent-front):=20=E6=8E=A5?= =?UTF-8?q?=E5=85=A5=E9=A6=96=E5=B8=A7=E6=8E=88=E6=9D=83=E4=B8=8E=E8=BF=9E?= =?UTF-8?q?=E7=BB=AD=E6=80=A7=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/vision-continuity-integration.md | 37 + src/components/ui/AppDrawer.vue | 2 + src/features/production/ProductionPage.vue | 25 + src/features/production/api.ts | 11 +- .../components/ContinuityReviewDrawer.vue | 724 ++++++++++++++++++ .../components/GeometryObservationEditor.vue | 122 +++ .../production/components/KeyframeCard.vue | 3 + .../components/KeyframeExecutionStatus.vue | 51 ++ .../components/KeyframeValidationHistory.vue | 233 +++++- .../components/LayoutSupplementPanel.vue | 273 +++++++ .../production/components/QualityDialog.vue | 58 +- .../production/components/QualityResult.vue | 5 +- .../components/ShotProductionAssets.vue | 36 +- src/features/production/continuity.ts | 116 +++ src/features/production/continuity.types.ts | 100 +++ src/features/production/keyframe-vision.ts | 207 ++++- src/features/production/layout-api.ts | 85 ++ src/features/production/quality-api.ts | 18 +- src/features/production/quality.ts | 25 + src/features/production/quality.types.ts | 34 +- .../production/vision-execution-history.ts | 45 ++ src/features/storyboard/StoryboardPage.vue | 38 +- src/features/workflows/execution-api.ts | 20 +- src/features/workflows/execution.ts | 11 +- src/lib/user-facing-text.ts | 7 + .../features/production/continuity-ui.test.ts | 146 ++++ tests/features/production/continuity.test.ts | 67 ++ .../keyframe-quality-contract.test.ts | 25 + .../vision-authorization-ui.test.ts | 113 +++ .../production/vision-authorizations.test.ts | 119 +++ .../production/vision-project-scope.test.ts | 180 +++++ tests/features/workflows/execution.test.ts | 2 +- tests/features/workflows/pages.test.ts | 11 +- tests/fixtures/continuity.ts | 214 ++++++ tests/lib/http.test.ts | 4 +- 35 files changed, 3070 insertions(+), 97 deletions(-) create mode 100644 docs/vision-continuity-integration.md create mode 100644 src/features/production/components/ContinuityReviewDrawer.vue create mode 100644 src/features/production/components/GeometryObservationEditor.vue create mode 100644 src/features/production/components/KeyframeExecutionStatus.vue create mode 100644 src/features/production/components/LayoutSupplementPanel.vue create mode 100644 src/features/production/continuity.ts create mode 100644 src/features/production/continuity.types.ts create mode 100644 src/features/production/layout-api.ts create mode 100644 src/features/production/vision-execution-history.ts create mode 100644 tests/features/production/continuity-ui.test.ts create mode 100644 tests/features/production/continuity.test.ts create mode 100644 tests/features/production/vision-authorization-ui.test.ts create mode 100644 tests/features/production/vision-authorizations.test.ts create mode 100644 tests/features/production/vision-project-scope.test.ts create mode 100644 tests/fixtures/continuity.ts diff --git a/docs/vision-continuity-integration.md b/docs/vision-continuity-integration.md new file mode 100644 index 0000000..f780285 --- /dev/null +++ b/docs/vision-continuity-integration.md @@ -0,0 +1,37 @@ +# 首帧审核与固定几何连续性接入 + +日期:2026-11-07。前端起点 `dbf97e6f`,只读核对后端 `6721a4df`,本轮不修改后端。 + +## 已接入 + +- 单执行 GET 与 SSE 共用可选 `projectId`。项目与执行共同构成查询身份,切项目关闭旧连接,丢弃旧响应和错误;SSE 断线只回到 GET 轮询,历史无参数调用继续兼容。 +- 候选历史展示 `legacyTermination` 的原状态、终止时间、审计编号、费用结论和新授权要求。终止不改写原始审核,不解除 Primary 门禁。 +- 独立新审核只传 `legacyVisionAuthorizationId`;物理专项补跑同时传原任务、请求指纹和 `physicalRetryAuthorizationId`。均须手动输入已有授权、明确勾选费用并从弹窗底栏提交,不提供签发入口,不自动重试。 +- 202 只观察已受理执行。200 按实际质量与来源结果展示;409 刷新历史并保留任务及费用门禁。执行完成、质量通过和正式 Primary 分别表达。 +- 多次执行保持审核任务身份,采用历史返回的最新执行,保留本机曾观察到的旧执行编号。已被更新执行取代的本机旧提交不会永久保留未知状态锁。 +- 分镜设计与生产页复用一个全屏连续性审核抽屉,当前集正式顺序连续选择两到三镜,并从正式生成规格求共同 Scene Form。展示 Primary、原图、摄影设计、布局母版、场景形态当前性及原始来源依据。 +- 人工分别填写观察面、地标顺序、固定结构位置或数量及其证据。未知明确保留;不把开关门即时状态自动投影成固定结构变化。免费诊断支持 passed、failed、needs_review、insufficient_evidence、stale。 +- 审核保存绑定本次已诊断观察的来源指纹,编辑后须重新诊断。刷新可恢复本机最近审核编号,也可手动读取其他正式编号。回读分别展示审核人、时间、原始结论和当前失效原因,不修改 Primary。 +- 固定结构 `layoutSupplement` 独立免费预览,不混入摄影 draft;展示当前版本、待审提示词、draftFingerprint、完整 layoutConfirmation 及三个确认/生产标志。待审指纹没有进入任何生图请求。 +- 正式布局确认原样使用本次返回的完整参数,仅补充真实 `confirmedBy`。保存后重新读取布局、母版、场景形态来源和首帧诊断,并回读原审核失效状态;不生成素材、不变更 Primary。 +- 操作反馈沿用应用 Naive Message。正式提交使用 Loading 和关闭锁,免费读取不阻止关闭。手机底栏可换行,图片按实际宽高或稳定比例预留空间,加载骨架静态显示。 + +## 后端契约限制 + +### 同一审核任务的完整执行历史尚无公开读取能力 + +`GET /storyboard-shots/:shotId/keyframes/:keyframeId/validations` 经 `shot-keyframe-asset.service.ts` 与 `readVisionRecovery()` 仅投影任务当前 `executionId`。项目工作流路由只有 latest 与 events,单执行路由需要已知编号,没有按 `validationTaskId` 枚举全部执行的接口。物理专项授权的旧执行及旧回执虽保存在内部审计记录,当前历史 DTO 未公开。 + +因此本轮实现的是:正式最新执行恢复 + 本机已实际观察到的执行记录。不能宣称从新浏览器完整找回未曾观察到的旧执行。后续需要后端正式提供任务执行列表及其公开摘要;本轮未猜测 URL,也未新增后端接口。 + +### 专项补跑入口按公开证据提供,最终资格由后端确认 + +步骤摘要含完成状态、issues、用量,但没有 General 的独立 passed 字段及完整 Physical 原始失败回执。前端仅在最新任务 General 已完成且无硬问题、Physical 失败且有计量时提供已有授权输入,文案明确为“补跑要求”。正式授权受理后才能确认原 General 通过并显示本次单步范围。实际原图、来源、模型、原费用回执与一次性授权继续由后端核对;不向用户伪造缺失证据。 + +## 验证边界 + +自动化全部使用 Mock,测试环境禁止未模拟请求连接真实服务。覆盖项目切换迟到 404、SSE 断线、同任务多执行、独立授权、物理专项三项参数、200 质量展示、终止与 Primary 限制、连续性观察/保存/回读/失效、布局待审及版本冲突。 + +本地 Chrome 复用已有 `localhost:4312` 标签页:真实项目只读核对三张 Primary、正式设计、当前布局与来源失效;写入交互使用临时隔离页面拦截全部 API,验证布局正式确认与审核失效保留原结论。检查桌面、390 × 844 手机、长内容滚动、固定底栏、深浅主题及授权按钮禁用/确认状态。临时验收文件在提交前移除。 + +真实付费 Provider 调用为 0,未提交真实授权、连续性审核或布局修改,未改动正式数据。 diff --git a/src/components/ui/AppDrawer.vue b/src/components/ui/AppDrawer.vue index 934bfed..c957bd5 100644 --- a/src/components/ui/AppDrawer.vue +++ b/src/components/ui/AppDrawer.vue @@ -93,6 +93,8 @@ const emit = defineEmits<{ closed: [] }>() } .app-drawer-footer { display: flex; + /* 多项正式操作在窄屏换行,始终保留关闭和提交入口。 */ + flex-wrap: wrap; justify-content: flex-end; gap: 8px; width: 100%; diff --git a/src/features/production/ProductionPage.vue b/src/features/production/ProductionPage.vue index e410784..85643bf 100644 --- a/src/features/production/ProductionPage.vue +++ b/src/features/production/ProductionPage.vue @@ -1,4 +1,7 @@ + + + + diff --git a/src/features/production/components/GeometryObservationEditor.vue b/src/features/production/components/GeometryObservationEditor.vue new file mode 100644 index 0000000..8ab6063 --- /dev/null +++ b/src/features/production/components/GeometryObservationEditor.vue @@ -0,0 +1,122 @@ + + + diff --git a/src/features/production/components/KeyframeCard.vue b/src/features/production/components/KeyframeCard.vue index ebf7d03..98e2b59 100644 --- a/src/features/production/components/KeyframeCard.vue +++ b/src/features/production/components/KeyframeCard.vue @@ -80,6 +80,9 @@ const reviewLabels: Record = { const isPassed = computed( () => !props.stale && + !vision.history.data.value?.some( + item => item.id === reviewQuery.data.value?.validationTaskId && item.legacyTermination + ) && !wrongCanvas.value && props.item.inputSnapshotStatus !== 'invalid' && (effectiveStatus.value === 'passed' || effectiveStatus.value === 'manual_accepted') diff --git a/src/features/production/components/KeyframeExecutionStatus.vue b/src/features/production/components/KeyframeExecutionStatus.vue new file mode 100644 index 0000000..f517e08 --- /dev/null +++ b/src/features/production/components/KeyframeExecutionStatus.vue @@ -0,0 +1,51 @@ + + + diff --git a/src/features/production/components/KeyframeValidationHistory.vue b/src/features/production/components/KeyframeValidationHistory.vue index 05018c0..cf6b7be 100644 --- a/src/features/production/components/KeyframeValidationHistory.vue +++ b/src/features/production/components/KeyframeValidationHistory.vue @@ -10,9 +10,11 @@ import { errorMessage } from '../../../lib/http' import ReadonlyInspection from '../../../components/ui/ReadonlyInspection.vue' import { useQuery } from '../../../composables/useQuery' import { formatDate } from '../../../lib/format' -import { useKeyframeVision } from '../keyframe-vision' +import { physicalRetryTarget, submitKeyframeVision, useKeyframeVision } from '../keyframe-vision' +import KeyframeExecutionStatus from './KeyframeExecutionStatus.vue' +import { useActionMessage, showActionFeedback } from '../../../components/ui/useActionMessage' import { qualityApi } from '../quality-api' -import { parseKeyframeValidationOutput } from '../quality' +import { parseKeyframeValidationOutput, keyframeValidationPassed } from '../quality' /** 历史仅按正式首帧目标读取,不写入手动晋升会话。 */ const props = defineProps<{ @@ -30,7 +32,7 @@ const props = defineProps<{ observation?: ReturnType }>() /** 通知候选重新读取当前质量状态。 */ -const emit = defineEmits<{ reviewed: [] }>() +const emit = defineEmits<{ reviewed: []; busy: [value: boolean] }>() /** 普通入口展开后查询,独立弹窗打开时直接查询。 */ const open = ref(props.initialOpen ?? false) /** 查询键包含全部归属信息,旧请求会被取消。 */ @@ -47,7 +49,14 @@ const visionKey = computed(() => ) : '' ) -const { history: query, execution, state, uncertain } = props.observation ?? useKeyframeVision(visionKey) +const { + history: query, + execution, + state, + uncertain, + observedExecutions, + submissionMode +} = props.observation ?? useKeyframeVision(visionKey) /** 后台结束时同步刷新人工复核与候选状态。 */ watch( () => state.value.active, @@ -77,7 +86,121 @@ const reviewQuery = useQuery(key, (value, signal) => { const [, shotId, keyframeId] = JSON.parse(value) as [string | undefined, string, string] return qualityApi.keyframeQualityReview(shotId, keyframeId, signal) }) +/** 当前正式质量摘要。 */ const review = computed(() => reviewQuery.data.value) +/** 终止记录不能经人工接受绕过独立授权与 Primary 门禁。 */ +const terminatedReview = computed(() => + query.data.value?.some(item => item.id === review.value?.validationTaskId && item.legacyTermination) +) +/** 只有最新任务的物理失败证据可申请单步补跑。 */ +const physicalTarget = computed(() => physicalRetryTarget(query.data.value ?? [])) +/** 旧终止之后若已出现新任务,继续遵守新任务门禁。 */ +const independentAvailable = computed( + () => !!state.value.terminated && !query.data.value?.some(item => !item.legacyTermination) +) +/** 用户明确填写的已有授权编号,不提供签发入口。 */ +const authorizationId = ref('') +/** 单独确认本次费用和范围,修改编号后撤销。 */ +const authorizationAcknowledged = ref(false) +/** 授权请求进行期间防止重复操作与意外关闭。 */ +const authorizationPending = ref(false) +/** 复用应用消息层展示操作结果。 */ +const message = useActionMessage() +/** 统一由所属弹窗底栏提交新授权,正文仅保留输入和范围说明。 */ +const authorizationAvailable = computed(() => independentAvailable.value || !!physicalTarget.value) +/** 当前表单可明确提交,仍由提交方法再次检查真实任务门禁。 */ +const authorizationReady = computed( + () => + authorizationAvailable.value && + !props.disabled && + !!authorizationId.value.trim() && + authorizationAcknowledged.value && + !state.value.active && + !uncertain.value && + !query.loading.value && + !query.error.value && + !authorizationPending.value +) +/** 底栏使用与本次授权范围一致的名称。 */ +const authorizationLabel = computed(() => (physicalTarget.value ? '授权仅补跑物理专项' : '提交独立新审核授权')) +/** 所属弹窗复用统一底栏,不在正文重复放置操作。 */ +defineExpose({ + authorizationAvailable, + authorizationReady, + authorizationPending, + authorizationLabel, + submitAuthorization, + authorizationAcknowledged, + setAuthorizationAcknowledged +}) +watch([key, authorizationId], () => { + authorizationAcknowledged.value = false +}) +watch(key, () => { + authorizationId.value = '' +}) +/** + * 所属弹窗在固定底栏确认本次费用和范围。 + * @param value 用户明确勾选状态 + */ +function setAuthorizationAcknowledged(value: boolean) { + authorizationAcknowledged.value = value +} +/** + * 明确提交独立授权,冲突后只刷新历史,不自动重试。 + * @returns 本次提交和历史刷新完成 + */ +async function submitAuthorization() { + if ( + !authorizationId.value.trim() || + !authorizationAcknowledged.value || + authorizationPending.value || + props.disabled || + state.value.active || + uncertain.value || + query.loading.value || + query.error.value || + (!independentAvailable.value && !physicalTarget.value) + ) + return + const target = key.value + const shotId = props.shotId + const keyframeId = props.keyframeId + const projectId = props.projectId + const physical = physicalTarget.value + const input = physical + ? { + resumeValidationTaskId: physical.id, + expectedRequestFingerprint: physical.requestFingerprint!, + physicalRetryAuthorizationId: authorizationId.value.trim() + } + : { legacyVisionAuthorizationId: authorizationId.value.trim() } + authorizationPending.value = true + emit('busy', true) + authorizationAcknowledged.value = false + try { + const result = await submitKeyframeVision(shotId, keyframeId, input, query.data.value ?? [], projectId) + if (target !== key.value) return + showActionFeedback( + message, + result + ? keyframeValidationPassed(result) + ? '审核已通过,请核对候选后再设置主首帧。' + : '审核未通过,主首帧仍受质量限制。' + : '已受理,请观察当前审核进度。', + result && keyframeValidationPassed(result) ? 'success' : 'info' + ) + } catch (cause) { + if (target === key.value) showActionFeedback(message, errorMessage(cause), 'error') + } finally { + authorizationPending.value = false + emit('busy', false) + if (target === key.value) { + await Promise.all([query.refresh(), reviewQuery.refresh()]) + if (target === key.value) emit('reviewed') + } + } +} /** 视线复核的系统选项只在展示层转成中文。 */ const gazeEvidenceLabels: Record = { aligned: '符合预期', @@ -110,34 +233,43 @@ async function submitReview() { !reviewer.value.trim() || submitting.value || props.disabled || + terminatedReview.value || state.value.active || state.value.unknown || uncertain.value ) return + const identity = key.value + const shotId = props.shotId + const keyframeId = props.keyframeId + const reason = reviewReason.value.trim() + const reviewerName = reviewer.value.trim() submitting.value = true submitError.value = '' submitSuccess.value = '' try { const taskId = review.value.validationTaskId if (reviewAction.value === 'accepted') { - const preview = await qualityApi.previewKeyframeAccept(props.shotId, props.keyframeId, taskId) + const preview = await qualityApi.previewKeyframeAccept(shotId, keyframeId, taskId) if (!preview.canAccept || !preview.requiresManualConfirmation) { throw new Error('候选未通过人工接受预检查') } - await qualityApi.acceptKeyframeReview(props.shotId, props.keyframeId, { + if (identity !== key.value) return + await qualityApi.acceptKeyframeReview(shotId, keyframeId, { validationTaskId: taskId, expectedPrimaryId: preview.expectedPrimaryId, - reviewer: reviewer.value.trim(), - reason: reviewReason.value.trim() + reviewer: reviewerName, + reason }) + if (identity !== key.value) return submitSuccess.value = '已人工接受,主首帧已更新。' } else { - await qualityApi.rejectKeyframeReview(props.shotId, props.keyframeId, { + await qualityApi.rejectKeyframeReview(shotId, keyframeId, { validationTaskId: taskId, - reviewer: reviewer.value.trim(), - reason: reviewReason.value.trim() + reviewer: reviewerName, + reason }) + if (identity !== key.value) return submitSuccess.value = '已记录人工拒绝,候选图片仍保留。' } reviewAction.value = null @@ -146,11 +278,12 @@ async function submitReview() { query.refresh() emit('reviewed') } catch (cause) { - submitError.value = errorMessage(cause) + if (identity === key.value) submitError.value = errorMessage(cause) } finally { submitting.value = false } } +/** 正式历史原状态与展示结论分开。 */ const records = computed(() => (query.data.value ?? []).map(item => ({ ...item, validation: parseKeyframeValidationOutput(item.output) })) ) @@ -174,8 +307,8 @@ const records = computed(() => >

当前质量复核

-

AI 检查:{{ decisionLabel(review.qualityDecision) }}

-

当前状态:{{ decisionLabel(review.effectiveQualityStatus) }}

+

AI 检查:{{ terminatedReview ? '已终止,无有效结论' : decisionLabel(review.qualityDecision) }}

+

当前状态:{{ terminatedReview ? '质量未确认' : decisionLabel(review.effectiveQualityStatus) }}

人工审核:{{ review.manualReview.decision === 'accepted' ? '已接受' : '已拒绝' }} · {{ review.manualReview.reason || '未填写理由' }} @@ -191,7 +324,7 @@ const records = computed(() =>

{{ item.reason }}

-
+

人工复核

请先预览候选图片并确认视觉效果。接受会替换当前主首帧,拒绝只保存审核记录。

@@ -241,6 +374,47 @@ const records = computed(() => submitSuccess }}

{{ reviewQuery.error.value }}

+ +
+

{{ physicalTarget ? '仅补跑物理专项' : '独立新审核授权' }}

+ +

原审核已人工终止,未标记通过。请填写已取得的独立授权编号,新审核可能产生费用。

+ +
+ +
+

仅补跑物理专项

+

原通用检查已通过,原费用已记录;本次仅补跑一个物理步骤,不重复提交通用检查。

+

当前审核状态以以下正式执行及最新质量结论为准。

+
+ +

{{ execution.error.value }}

+ + +

+ 显示本机已观察到的执行;刷新会读取服务保存的最新执行。较早且未观察到的执行暂不可查询。 +

+

+ 审核任务:{{ item.taskId }} · 执行:{{ item.executionId + }}{{ item.status ? ` · 观察时状态:${stepLabels[item.status] ?? '待确认'}` : '' }} +

+
+

{{ formatDate(record.finishedAt || record.startedAt || record.createdAt) }} · {{ stepLabels[record.status] ?? '待确认' }} · {{ - record.status === 'completed' && record.validation - ? record.validation.passed + !record.legacyTermination && record.status === 'completed' && record.validation + ? keyframeValidationPassed(record.validation) ? '视觉通过' : '视觉未通过' : '暂无结论' }}

+

+ 审核任务:{{ record.id + }} +

+
+

历史审核已人工终止,原任务状态:{{ stepLabels[record.status] ?? '待确认' }};未标记通过。

+

人工终止时间:{{ formatDate(record.legacyTermination.terminatedAt) }}

+

审计编号:{{ record.legacyTermination.auditId }}

+

+ 费用结论:{{ + { + unresolved: '待核查', + 'billing-confirmed': '已确认计费', + 'no-charge-confirmed': '已确认未计费' + }[record.legacyTermination.billingFinding] + }} +

+

+ {{ + record.legacyTermination.requiresNewAuthorization + ? '需要独立新授权' + : '授权要求以当前审核准入为准' + }},不能自动重新提交。 +

+

原文字授权:{{ record.allowedTexts === null diff --git a/src/features/production/components/LayoutSupplementPanel.vue b/src/features/production/components/LayoutSupplementPanel.vue new file mode 100644 index 0000000..7306c60 --- /dev/null +++ b/src/features/production/components/LayoutSupplementPanel.vue @@ -0,0 +1,273 @@ + + + diff --git a/src/features/production/components/QualityDialog.vue b/src/features/production/components/QualityDialog.vue index 540457c..636e22c 100644 --- a/src/features/production/components/QualityDialog.vue +++ b/src/features/production/components/QualityDialog.vue @@ -112,6 +112,10 @@ const provider = ref('') const generationOptions = ref({}) /** 后台任务期间表单也保持锁定。 */ const pending = computed(() => operation.value.pending || execution.active.value) +/** 历史中的独立授权请求期间锁定关闭。 */ +const authorizationPending = ref(false) +/** 候选历史授权表单通过统一底栏明确提交。 */ +const visionHistoryRef = ref | null>(null) /** 当前目标的单镜头范围。 */ const singleShot = computed(() => props.target?.kind === 'batch' && !!props.target.shotId) /** 质量面板的formRef状态,随目标更新。 */ @@ -134,6 +138,17 @@ const height = ref(null) const texts = ref('') /** 质量面板的acknowledged状态,随目标更新。 */ const acknowledged = ref(false) +/** 统一底栏只确认当前实际操作范围,授权操作不重复要求两次确认。 */ +const footerAcknowledged = computed({ + get: () => + visionHistoryRef.value?.authorizationAvailable + ? visionHistoryRef.value.authorizationAcknowledged + : acknowledged.value, + set: (value: boolean) => { + if (visionHistoryRef.value?.authorizationAvailable) visionHistoryRef.value.setAuthorizationAcknowledged(value) + else acknowledged.value = value + } +}) /** 质量面板的videoRepair状态,随目标更新。 */ const videoRepair = computed(() => props.target?.kind === 'video' && action.value === 'repair') /** 质量面板的input状态,随目标更新。 */ @@ -285,7 +300,12 @@ const optionsExpanded = ref(['options'])