feat(short-drama-agent-front): 补齐首帧审核与视线修订

This commit is contained in:
GJ committed 2026-11-09 10:34:25 +08:00
1 parent c7a6b12261
commit 0d58dd8c53
25 files changed
+1140 -30

No files matched your search

@@ -0,0 +1,82 @@
# B04-18 / B04-22 / B04-25 前端接入记录
日期:2026-11-09。仅修改前端根目录 dev,未提交、未推送、未创建工作树。
前端基线 c7a6b1226114d3889e353dc4b0fa733c8ace958d,与本次 fetch 的 origin/dev 一致;后端基线 e7035e68c2bd4239947bef764354819f0f15daac。
## 1. 已补齐功能
- 普通 Vision:QualityDialog 免费读取计划,展示 ready/blocked/reusable、模型、步骤、真实请求次数、原图/参考和摘要、未知费用、在途及未结任务、失败结果复用。点击提交前再次免费核对计划,POST 携带 expectedValidationFingerprint;任何变化撤销确认,409 不自动重试。原图片读取接口的 /api 路径按当前服务源转换为绝对图片地址。
- 来源复核:结构/空间 unknown 可单独声明适用范围,保留原观察;主体从实际绑定选择,全部 RequiredActions 逐项填依赖及原因,状态/构图/无反证/其它证据均不预填。缺动作、非静态机位不提供非阻断选项,其它必要依赖或声明不完整时禁止保存。明确 failed 不开放适用范围。
- 非阻断来源按服务端 validationEligible 准备独立免费计划,明确 false 不被 passed 文案覆盖。保存后回读记录与历史,由现有 changed 通知刷新当前质量和外层资产;409 撤销独立计划和批准。
- 主体 gaze:复用单镜摄影抽屉,从新鲜正式 Direction、VisualState、sceneSources 构建完整 draft,同步声明原值/新值/理由与对应 gaze,保留其它字段。保存、预览、采用继续使用原接口和版本保护。采用前展示变更范围,版本冲突刷新正式依据并等待重新确认。
- 连续性:非阻断未知在最新诊断和历史签收中单列,签收状态与当前性分开;三镜签收不表示项目视频就绪。当前质量继续由 effective-keyframe-quality.ts 消费正式服务端结论,历史 failed 不改写为通过。
## 2. 复用模块
复用 QualityDialog、SourceReviewDrawer、ShotDerivedReview、AppDrawer、AppDialog、NCollapse、AssetImage、消息层、useQuery 取消机制、useEffectiveKeyframeQuality、useKeyframeVision、原 WorkflowExecution GET/SSE、原来源批准接口与独立 Primary 确认入口。没有新增审核或质量状态计算系统。
## 3. 新增文件与职责
| 文件 | 职责 |
| --- | --- |
| src/features/production/validation-preview.ts | 普通免费审核计划类型、GET、正式参考图片路径转换 |
| src/features/production/components/ValidationPreviewPanel.vue | 当前计划和实际图像核对 |
| src/features/production/source-applicability.ts | 人工范围类型、完整性与必要条件校验 |
| src/features/production/components/SourceApplicabilityFields.vue | 未知维度的明确人工声明表单 |
| tests/fixtures/validation-preview.ts | 免费计划隔离数据 |
| tests/features/production/b04-applicability.test.ts | 非阻断范围边界、正式图片地址回归 |
| tests/browser/b04-review.html / b04-review.ts | Chrome 真实组件隔离页,API 写请求全部拒绝 |
| 本记录 | 交付与限制说明 |
## 4. 修改文件与职责
- production/components/QualityDialog.vue、useQuality.ts、keyframe-vision.ts、quality.types.ts:计划展示、确认撤销、提交版本核对和原任务观察。
- production/components/SourceReviewDrawer.vue、useSourceReview.ts、source-review.ts:适用性上下文、表单、保存、服务端准入和独立免费计划。
- production/components/ContinuityReviewDrawer.vue、continuity.types.ts:非阻断未知和签收当前性。
- storyboard/components/ShotDerivedReview.vue、derived-review.ts、derived-review.types.ts:有界视线编辑、完整草案、原值与采用范围。
- lib/user-facing-text.ts:正式主体修订、来源适用性错误的中文说明。
- tests/features/production/quality.test.ts、source-review.test.ts、tests/features/storyboard/derived-review.test.ts:补充计划、非阻断准入与视线回归。
## 5. 重复实现处理
未删除原审核系统或历史记录。普通计划模式不再展示与计划不一致的旧“最多一次审核”提示或可变文字白名单输入;其它既有审核/修复入口保留。没有创建第二套质量计算器。
## 6. 自动化验证
- 全量 Vitest:107 文件、811 用例通过;随后增加图片路径与服务端非阻断资格两个用例,均定向通过。
- 最后相关回归:计划/适用性/来源/视线共 4 文件、48 用例全部通过。
- TypeScript vue-tsc --noEmit、全仓 Oxlint、相关 Vue ESLint 通过;格式化及 git diff --check 通过。
- 使用本地已安装工具运行,未安装依赖。所有模型请求测试使用隔离响应。
## 7. Chrome 验收
使用本地 Google Chrome、localhost:4312,复用本任务标签页;未使用 Playwright。
- 真实项目:正式摄影抽屉、旧草案 stale、从正式状态进入 gaze、正式主体选择、原视线展示、空表单禁用提交;桌面暗色和 iPhone SE 375×667 布局、正文滚动及固定底栏。
- 隔离页:普通 ready/blocked/reusable、未知费用、失败历史与当前 stale 分离、来源 unknown 和空白依赖声明、静态原图与参考、桌面/375px 单列布局和固定关闭/保存栏。
- 真实生产页保留原有整项目门禁,当前仍提示主体形态图片待准备,因此未在该页完成真实保存/付费操作闭环。隔离页面明确拒绝 API 写入。
- 未提交真实用户数据、采用正式修订、发起审核、生图、生视频或改 Primary。真实保存、采用后失效和收费任务完成等场景由现有/补充自动化回归覆盖,不能当作真实生产写入验收。
## 8. 真实只读接口核验与未完成项
项目 cmw02vpwi000005axrdtus3pa:60 镜,首组三镜 skipped=已有可用 Primary,当前 primaryQualityStatus 均 passed 且来源非 stale;其余 57 镜阻断,57 个规格问题、40 个缺参考问题(分类可能重叠)。
逐镜 quality-review:1.1、2.1、2.2 的 effectiveQualityStatus 与历史 qualityDecision 均 passed。
普通免费计划:1.1 reusable、qwen3.8-max、最多 2 请求、每步 5 图,amount=null;2.1/2.2 返回 409 IMAGE_INPUT_STALE。这与“旧像素对照新来源使用独立来源审核,不能普通审核重盖来源”的契约一致,不据此改写当前 passed。
已存三镜签收 cmw7y6sqt0008rono7bv2lopl GET:status=passed、invalidation=null;diagnosis.nonBlockingUnknowns 保留 2.2 的 fixed-door-frame-connection,明确局部不可辨、不能确认轴侧,未核实为通过。
仍未完成:真实数据保存/采用/收费执行的端到端人工验收,本次禁止借验收改正式结果或触发付费;其余 57 镜资产与规格准备也不属于本轮自动补齐范围。
## 9. B04-25 契约一致性与后端问题
已核对后端正式路由、ShotKeyframeReviewDraftSchema、SubjectStateRevisionSchema、SaveShotKeyframeReviewDraftSchema、StoryboardDerivedReviewConfirmationSchema 和服务实现。
提交完整 draft,field 固定 gaze,before 来自最新正式记录,after 和理由由用户填写;正式来源指纹与草案预览指纹分别携带,沿用用户核对的模型参数;不发送 sceneStateCarryForward 或 sceneSourceRecovery,不混入未采用机位稿。400/409 由原 HTTP 层处理并映射中文,版本冲突不重发。
目前没有确认的后端缺陷或必须新增的接口,暂不需要后端修改 prompt。2.1/2.2 普通预检 409、项目入口阻断均属于当前正式来源/准备门禁,不要求后端放宽。
## 10. V02-06
可以继续 V02-06 剩余有序组审核功能的开发与只读准备;首组三镜已核验的通过不能扩展为全部项目准入。正式生成仍须消除相应范围门禁、逐次取得明确费用批准。本轮不宣称 V02-06 整体完成或项目可以直接生成视频。
@@ -605,6 +605,9 @@ function updateFrame(index: number, value: GeometryFrameObservation) {
<p v-for="(issue, index) in diagnosisIssues" :key="index">
镜头 {{ issue.scope }}:{{ userFacingText(issue.message) }}
</p>
<p v-for="(item, index) in diagnosis.nonBlockingUnknowns" :key="'unknown-' + index">
保留非阻断未知:{{ item.featureKey }} · {{ item.evidence }}(未核实通过)
</p>
<p v-if="!diagnosis.issues.length">本次提交的固定结构观察未发现冲突。</p>
<NInput
v-if="diagnosis.observation"
@@ -644,6 +647,17 @@ function updateFrame(index: number, value: GeometryFrameObservation) {
审核人:{{ reviewQuery.data.value.reviewer }} ·
{{ formatDate(reviewQuery.data.value.reviewedAt) }}
</p>
<p
v-for="(item, index) in reviewQuery.data.value.diagnosis.nonBlockingUnknowns"
:key="'saved-unknown-' + index"
>
保留非阻断未知:{{ item.featureKey }} · {{ item.evidence }}(未核实通过)
</p>
<p>
当前性:{{
reviewQuery.data.value.invalidation ? '已失效' : '当前有效'
}};本组签收不代表整个项目可生成视频。
</p>
<p>原审核结论:{{ continuityStatusLabels[reviewQuery.data.value.diagnosis.status] }}</p>
<p>当前状态:{{ continuityStatusLabels[reviewQuery.data.value.status] }}</p>
<template v-if="reviewQuery.data.value.invalidation"
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { validationPreviewApi } from '../validation-preview'
import ValidationPreviewPanel from './ValidationPreviewPanel.vue'
import { userFacingText } from '../../../lib/user-facing-text'
import { videoOperationAllowed } from '../video-permissions'
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
@@ -61,6 +63,30 @@ const visionKey = computed(() =>
: ''
)
const vision = useKeyframeVision(visionKey)
/** 免费计划随候选范围取消旧请求。 */
const validationPlan = useQuery(visionKey, async (value, signal) => {
if (!value) return null
const [shot, image, project] = JSON.parse(value) as [string, string, string]
return validationPreviewApi(shot, image, project, signal)
})
/** 计划加载或改变后撤销旧批准。 */
watch([validationPlan.data, validationPlan.loading], () => {
acknowledged.value = false
})
/** 任务终态后重新免费核对计划,当前质量由既有观察器回读。 */
watch(
() => vision.execution.data.value?.status,
status => {
if (visionKey.value && (status === 'completed' || status === 'failed')) void validationPlan.refresh()
}
)
/** 普通审核必须先取得可执行计划。 */
const planBlocked = computed(
() =>
props.target?.kind === 'keyframe' &&
action.value === 'validate' &&
(validationPlan.loading.value || !!validationPlan.error.value || validationPlan.data.value?.status !== 'ready')
)
/** 当前候选质量独立回读,不以本会话或后台回执作为当前结论。 */
const currentQuality = useEffectiveKeyframeQuality(visionKey, vision)
/** 人工审核完成后同步当前质量和外层资产。 */
@@ -267,6 +293,7 @@ watch(
async function submit() {
if (
!acknowledged.value ||
planBlocked.value ||
!valid.value ||
blocked.value ||
visionBlocked.value ||
@@ -275,7 +302,16 @@ async function submit() {
)
return
acknowledged.value = false
await run(action.value, input.value)
const planned = props.target?.kind === 'keyframe' && action.value === 'validate'
await run(
action.value,
planned ? { ...input.value, allowedTexts: [] } : input.value,
undefined,
planned && validationPlan.data.value
? { expectedValidationFingerprint: validationPlan.data.value.validationFingerprint }
: undefined
)
if (planned) await validationPlan.refresh()
if (visionKey.value) void vision.history.refresh()
}
@@ -322,6 +358,21 @@ const optionsExpanded = ref<string[]>(['options'])
>
{{ userFacingText(videoQuery.error.value || videoQuery.data.value?.staleReason) }}
</ContextNotice>
<ValidationPreviewPanel
v-if="validationPlan.data.value && action === 'validate'"
:plan="validationPlan.data.value"
/>
<NButton
v-if="visionKey"
class="mt-3"
:loading="validationPlan.loading.value"
:disabled="pending"
@click="validationPlan.refresh"
>刷新免费审核计划</NButton
>
<p v-if="validationPlan.error.value" class="mt-2 text-sm text-muted">
{{ userFacingText(validationPlan.error.value) }}
</p>
<AppForm
ref="formRef"
:model="formModel"
@@ -378,7 +429,7 @@ const optionsExpanded = ref<string[]>(['options'])
>当前候选暂时不能执行这项检查,请查看原因或刷新任务状态。</ContextNotice
>
<NCollapse
v-if="!videoRepair && !visionHistoryRef?.authorizationAvailable"
v-if="!videoRepair && !visionHistoryRef?.authorizationAvailable && !visionKey"
v-model:expanded-names="optionsExpanded"
display-directive="show"
class="mt-4"
@@ -448,7 +499,7 @@ const optionsExpanded = ref<string[]>(['options'])
</NCollapseItem>
</NCollapse>
<ContextNotice
v-if="!visionHistoryRef?.authorizationAvailable"
v-if="!visionHistoryRef?.authorizationAvailable && !(visionKey && action === 'validate')"
type="warning"
:show-icon="false"
class="mt-4"
@@ -551,7 +602,7 @@ const optionsExpanded = ref<string[]>(['options'])
v-else
type="primary"
:loading="pending"
:disabled="blocked || visionBlocked || !acknowledged || !repairAvailable"
:disabled="blocked || visionBlocked || planBlocked || !acknowledged || !repairAvailable"
@click="formRef?.validate(submit)"
>{{ label }}</NButton
>
@@ -0,0 +1,139 @@
<script setup lang="ts">
import { computed } from 'vue'
import { NButton, NInput, NSelect } from 'naive-ui'
import type { ApplicabilityBasis, EvidenceAssessment } from '../source-applicability'
/** 当前未知维度的正式上下文。 */
const props = defineProps<{
/** 正式依据。 */ basis: ApplicabilityBasis
/** 参考序号。 */ imageNumber: number
/** 未知维度。 */ dimension: 'structure' | 'spatial'
/** 操作锁。 */ disabled: boolean
}>()
/** 共享表单中的明确范围。 */
const assessments = defineModel<EvidenceAssessment[]>({ required: true })
/** 当前维度唯一范围。 */
const item = computed(() =>
assessments.value.find(a => a.imageNumber === props.imageNumber && a.dimension === props.dimension)
)
/** 布尔声明不预填任何结论。 */
const booleanOptions = [
{ label: '是', value: 'yes' },
{ label: '否', value: 'no' }
]
/** 正式主体绑定,不能手工填入外来主体。 */
const subjects = computed(() =>
(props.basis.references.find(r => r.imageNumber === props.imageNumber)?.subjectRefs ?? []).map(value => ({
label: value,
value
}))
)
/** 非固定机位或缺动作时不开放豁免。 */
const requirements = computed(() => [
{ label: '必要证据', value: 'required' },
{ label: '阻断未知', value: 'blocking_unknown' },
...(props.basis.cameraMovement === 'static' && props.basis.actionIds?.length
? [{ label: '非阻断未知', value: 'non_blocking_unknown' }]
: [])
])
/** 添加空白人工范围,所有依赖与反证须逐项选择。 */
function add() {
assessments.value.push({
imageNumber: props.imageNumber,
dimension: props.dimension,
featureKey: '',
subjectRef: '',
requirement: 'required',
evidence: '',
actions: (props.basis.actionIds ?? []).map(actionId => ({ actionId, requiresEvidence: null, reason: '' })),
stateRequiresEvidence: null,
framingRequiresEvidence: null,
noVisibleContradiction: null,
remainingEvidenceVerified: null
})
}
/**
* 写入用户明确选择,不将空值当作否。
* @param field 核对字段
* @param value 明确答案
*/
function answer(
field: 'stateRequiresEvidence' | 'framingRequiresEvidence' | 'noVisibleContradiction' | 'remainingEvidenceVerified',
value: string
) {
if (item.value) item.value[field] = value === 'yes'
}
/** 同级人工声明名称。 */
const declarations = {
stateRequiresEvidence: '当前状态是否依赖',
framingRequiresEvidence: '当前构图是否依赖',
noVisibleContradiction: '已确认无可见反证',
remainingEvidenceVerified: '其它必要证据已经核对'
} as const
</script>
<template>
<!-- 以下是未知证据的人工适用性范围,不修改原观察 -->
<div class="space-y-3 text-sm">
<NButton v-if="!item" size="small" :disabled="disabled" @click="add">记录此项证据适用性</NButton>
<template v-else>
<NSelect
v-model:value="item.requirement"
:options="requirements"
:disabled="disabled"
aria-label="证据要求"
/>
<NSelect
v-model:value="item.subjectRef"
:options="subjects"
:disabled="disabled"
placeholder="选择正式主体"
aria-label="证据主体"
/>
<NInput
v-model:value="item.featureKey"
:disabled="disabled"
:maxlength="120"
placeholder="局部证据名称"
aria-label="局部证据名称"
/>
<NInput
v-model:value="item.evidence"
:disabled="disabled"
:maxlength="2000"
type="textarea"
placeholder="不可见原因、其它可见证据及适用范围"
aria-label="证据适用理由"
/>
<div v-for="action in item.actions" :key="action.actionId" class="space-y-2">
<p>正式动作 {{ action.actionId }} 是否依赖此证据</p>
<NSelect
:value="action.requiresEvidence === null ? null : action.requiresEvidence ? 'yes' : 'no'"
:options="booleanOptions"
placeholder="请选择核对结果"
:disabled="disabled"
aria-label="动作是否依赖证据"
@update:value="action.requiresEvidence = $event === 'yes'"
/><NInput
v-model:value="action.reason"
:disabled="disabled"
:maxlength="1000"
placeholder="逐动作核对理由"
aria-label="动作证据核对理由"
/>
</div>
<label v-for="(label, field) in declarations" :key="field" class="block space-y-1"
><span>{{ label }}</span
><NSelect
:value="item[field] === null ? null : item[field] ? 'yes' : 'no'"
:options="booleanOptions"
placeholder="请选择核对结果"
:disabled="disabled"
:aria-label="label"
@update:value="answer(field, $event)"
/></label>
<p class="text-muted">非阻断未知只允许继续来源审核;不代表视觉审核通过或可以生成视频。</p>
<NButton size="small" :disabled="disabled" @click="assessments = assessments.filter(a => a !== item)"
>撤销此项适用范围</NButton
>
</template>
</div>
</template>
@@ -1,4 +1,6 @@
<script setup lang="ts">
import SourceApplicabilityFields from './SourceApplicabilityFields.vue'
import RawDataDetails from '../../../components/ui/RawDataDetails.vue'
import { computed, watch } from 'vue'
import { NButton, NCheckbox, NCollapse, NCollapseItem, NInput, NInputNumber, NSelect } from 'naive-ui'
import AppDrawer from '../../../components/ui/AppDrawer.vue'
@@ -47,6 +49,27 @@ const findingOptions = [
{ label: '通过', value: 'passed' },
{ label: '不通过', value: 'failed' }
]
/** 正式动作只从当前预检原文解析,不用编号或关键词猜测。 */
const formalActions = computed(() => {
const raw = form.preview.value?.applicabilityBasis?.facts.rawJson
if (typeof raw !== 'string') return []
try {
const parsed: unknown = JSON.parse(raw)
if (
!parsed ||
typeof parsed !== 'object' ||
!('requiredActions' in parsed) ||
!Array.isArray(parsed.requiredActions)
)
return []
return parsed.requiredActions.filter(
(a): a is { id: string; description: string } =>
!!a && typeof a.id === 'string' && typeof a.description === 'string'
)
} catch {
return []
}
})
/** 当前人工记录或新机器任务,供正式执行历史展开。 */
const task = computed(() => form.vision.history.data.value?.find(item => item.sourceReviewId === form.reviewId.value))
/** 已知原任务才允许明确继续,未知费用不显示恢复按钮。 */
@@ -64,6 +87,7 @@ const statusLabels: Record<string, string> = {
failed: '人工来源观察未通过',
needs_review: '待复核,存在未知观察',
insufficient_evidence: '证据不足',
non_blocking_unknown: '保留非阻断未知,可准备独立视觉审核',
stale: '来源已失效'
}
</script>
@@ -126,8 +150,27 @@ const statusLabels: Record<string, string> = {
>
<WorkspaceSectionHeading
title="本次新参考与逐图观察"
description="新参考仅是本次比较依据,不是原图的生成输入。门轴等固定结构看不清时选未知;开关门不等于固定结构改变。"
description="新参考仅是本次比较依据,不是原图的生成输入。结构看不清时保留未知,并逐项核对本镜是否需要该证据。"
/>
<!-- 以下是正式动作和适用范围的核对依据 -->
<section v-if="form.preview.value.applicabilityBasis" class="space-y-2 text-sm">
<h3 class="font-medium">正式动作与当前状态依据</h3>
<p>
机位:{{
form.preview.value.applicabilityBasis.cameraMovement === 'static'
? '固定机位'
: '非固定或尚未确认的机位'
}}
· 正式动作
{{ form.preview.value.applicabilityBasis.actionIds?.join('、') || '未提供,不能判为非阻断' }}
</p>
<p v-for="action in formalActions" :key="action.id">{{ action.id }}:{{ action.description }}</p>
<p v-if="!formalActions.length">未读到完整正式动作原文,请核对高级详情;不能凭动作编号猜测依赖。</p>
<RawDataDetails
title="核对完整正式动作、摄影与即时状态"
:value="form.preview.value.applicabilityBasis.facts"
/>
</section>
<div class="grid items-start gap-(--app-content-gap) lg:grid-cols-2">
<section
v-for="(observation, index) in form.observations.value"
@@ -155,11 +198,7 @@ const statusLabels: Record<string, string> = {
{{ binding.subjectRef }} · {{ userFacingText(binding.role) }} {{ binding.viewDescription }}
{{ binding.spatialLayoutVersion }}
</p>
<label
v-for="(label, field) in sourceFindingLabels"
:key="field"
class="block space-y-1 text-sm"
>
<div v-for="(label, field) in sourceFindingLabels" :key="field" class="block space-y-1 text-sm">
<span>{{ label }}</span
><NSelect
v-model:value="observation.finding[field]"
@@ -167,7 +206,19 @@ const statusLabels: Record<string, string> = {
:disabled="!!form.pending.value"
:aria-label="'参考 ' + (index + 1) + ' ' + label"
/>
</label>
<SourceApplicabilityFields
v-if="
(field === 'structure' || field === 'spatial') &&
observation.finding[field] === 'unknown' &&
form.preview.value.applicabilityBasis
"
v-model="form.assessments.value"
:basis="form.preview.value.applicabilityBasis"
:image-number="observation.imageNumber"
:dimension="field"
:disabled="!!form.pending.value"
/>
</div>
<NInput
v-model:value="observation.note"
type="textarea"
@@ -228,7 +279,7 @@ const statusLabels: Record<string, string> = {
!!form.pending.value ||
!form.targetMatched.value ||
!form.record.value.current ||
form.record.value.reviewStatus !== 'passed'
!(form.record.value.validationEligible ?? form.record.value.reviewStatus === 'passed')
"
@click="form.loadPlan"
>免费查看独立机器审核计划</NButton
@@ -300,6 +351,22 @@ const statusLabels: Record<string, string> = {
>明确执行本次独立审核,可能产生上述费用</NCheckbox
>
</section>
<!-- 以下是原始观察及独立保存的适用性结论 -->
<section v-if="form.record.value?.applicabilityAssessment" class="space-y-2 text-sm">
<p v-for="(item, index) in form.record.value.applicabilityAssessment.assessments" :key="index">
参考 {{ item.imageNumber }} ·
{{
sourceFindingLabels[item.dimension as keyof typeof sourceFindingLabels] ?? item.dimension
}}:原观察 {{ findingOptions.find(option => option.value === item.finding)?.label ?? '未知' }} ·
{{
item.applicability === 'non_blocking_unknown'
? '非阻断未知(未核实通过)'
: item.applicability === 'blocking_unknown'
? '阻断未知'
: '必要证据'
}}
</p>
</section>
<!-- 以下是既有项目作用域执行观察和服务端分页历史 -->
<p v-if="form.vision.state.value.unknown || form.vision.uncertain.value" class="text-sm text-muted">
结果或费用待核查,仅可只读刷新,不自动重发。
@@ -0,0 +1,73 @@
<script setup lang="ts">
import { NCollapse, NCollapseItem } from 'naive-ui'
import { AssetImage } from '../../../components/ui'
import { validationStepNames } from '../validation-execution-labels'
import { validationImageUrl, type ValidationPreview } from '../validation-preview'
/** 免费普通审核计划;不提供任何自动执行入口。 */
defineProps<{ /** 当前只读计划。 */ plan: ValidationPreview }>()
</script>
<template>
<!-- 以下是普通审核计划与实际图像核对模块 -->
<section class="mt-4 space-y-3 text-sm">
<h3 class="font-medium">免费审核预检</h3>
<p>
{{
plan.status === 'ready'
? '可以准备本次审核确认'
: plan.status === 'blocked'
? '暂不能开始新审核'
: '已有同计划结果,可直接查看'
}}
</p>
<p>
模型:{{ plan.model }} ·
{{ plan.steps.map(s => validationStepNames[s as keyof typeof validationStepNames] ?? s).join(' → ') }}
</p>
<p>每步 {{ plan.actualImagesPerStep }} 张图片,最多 {{ plan.maximumProviderRequests }} 次请求。</p>
<p>
执行费用:{{
plan.feeEstimate.amount === null
? '未知,需先核对费用范围'
: `${plan.feeEstimate.amount} ${plan.feeEstimate.currency}`
}}。预检免费。
</p>
<p v-if="plan.activeTasks.length">有 {{ plan.activeTasks.length }} 个审核正在执行,请查看原任务。</p>
<p v-if="plan.unresolvedTasks.length">有 {{ plan.unresolvedTasks.length }} 个任务的结果或费用待核查。</p>
<p v-if="plan.planConflict">审核模型或步骤已变化,请先处理已有计划冲突。</p>
<p v-if="plan.reusableResult">
历史审核:{{ plan.reusableResult.passed ? '通过' : '未通过' }}。{{ plan.reusableResult.summary }}
当前可用性以当前质量为准。
</p>
<NCollapse
><NCollapseItem name="images" title="核对原图、实际参考与图片摘要">
<div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
<div class="min-w-0 space-y-2">
<p>审核图片 1 · 原图({{ plan.image.width }} × {{ plan.image.height }})</p>
<AssetImage
class="aspect-square"
:src="plan.image.imageUrl"
alt="本次审核原图"
object-fit="contain"
preview
/>
<p class="wrap-anywhere text-xs">SHA:{{ plan.image.sha256 }}</p>
</div>
<div v-for="reference in plan.references" :key="reference.imageNumber" class="min-w-0 space-y-2">
<p>审核图片 {{ reference.imageNumber }} · 生成参考 {{ reference.generationImageNumber }}</p>
<AssetImage
class="aspect-square"
:src="validationImageUrl(reference.imageUrl)"
alt="实际审核参考"
object-fit="contain"
preview
/>
<p v-for="(binding, index) in reference.bindings" :key="index">
{{ binding.subjectRef }} · {{ binding.role }}
</p>
<p class="wrap-anywhere text-xs">SHA:{{ reference.sha256 }}</p>
</div>
</div>
</NCollapseItem></NCollapse
>
</section>
</template>
@@ -84,6 +84,12 @@ export interface ContinuityDiagnosis {
} | null
/** 已消费的人工观察。 */ observation: ContinuityObservation | null
/** 实际诊断结论。 */ status: ContinuityStatus
/** 当前机器审核允许保留的未知,不等于结构已经核实。 */
nonBlockingUnknowns?: Array<{
/** 所属镜头。 */ shotId: string
/** 局部证据。 */ featureKey: string
/** 人工范围依据。 */ evidence: string
}>
/** 当前范围的问题。 */ issues: ContinuityIssue[]
}
/** 持久化审核独立保留原始结论和当前失效信息。 */
+5 -1
View File
@@ -294,6 +294,7 @@ export async function submitKeyframeVision(
const key = JSON.stringify(projectId ? [shotId, assetId, projectId] : [shotId, assetId])
const previous = readSubmission(key)
const current = visionState(records)
const planned = !Array.isArray(input) && 'expectedValidationFingerprint' in input
const independent = !Array.isArray(input) && 'legacyVisionAuthorizationId' in input
const physical = !Array.isArray(input) && 'physicalRetryAuthorizationId' in input
const physicalTask = physicalRetryTarget(records)
@@ -303,7 +304,10 @@ export async function submitKeyframeVision(
(previous && !previous.settled)
)
throw new Error('已有审核或费用待核查,请查看审核记录。')
if (independent) {
if (planned) {
if (!/^[a-f0-9]{64}$/.test(input.expectedValidationFingerprint) || Object.keys(input).length !== 1)
throw new Error('审核计划无效,请重新免费预检。')
} else if (independent) {
if (!current.terminated || !input.legacyVisionAuthorizationId.trim() || Object.keys(input).length !== 1)
throw new Error('请单独填写新审核授权编号。')
} else if (Array.isArray(input)) {
+1
View File
@@ -238,6 +238,7 @@ export interface PhysicalRetryAuthorization extends ResumeKeyframeValidation {
/** 单次审核参数,三种授权流程互斥。 */
export type KeyframeVisionInput =
| string[]
| { /** 用户确认的免费审核计划。 */ expectedValidationFingerprint: string }
| ResumeKeyframeValidation
| LegacyVisionAuthorization
| PhysicalRetryAuthorization
@@ -0,0 +1,65 @@
/** 来源证据的正式适用性依据。 */
export interface ApplicabilityBasis {
/** 当前正式依据摘要。 */ fingerprint: string
/** 全部正式动作编号,缺失不能豁免。 */ actionIds: string[] | null
/** 正式机位运动。 */ cameraMovement: string | null
/** 参考实际主体绑定。 */ references: Array<{
/** 参考编号。 */ imageNumber: number
/** 主体引用。 */ subjectRefs: string[]
}>
/** 正式动作、摄影和状态事实。 */ facts: Record<string, unknown>
}
/** 用户逐项明确填写的证据范围;未选择的布尔值保持空白。 */
export interface EvidenceAssessment {
/** 比较参考序号。 */ imageNumber: number
/** 仅结构和空间允许范围。 */ dimension: 'structure' | 'spatial'
/** 局部证据名称。 */ featureKey: string
/** 绑定主体。 */ subjectRef: string
/** 证据要求。 */ requirement: 'required' | 'blocking_unknown' | 'non_blocking_unknown'
/** 人工依据。 */ evidence: string
/** 全部正式动作的逐项核对。 */ actions: Array<{
/** 正式动作。 */ actionId: string
/** 是否依赖。 */ requiresEvidence: boolean | null
/** 理由。 */ reason: string
}>
/** 状态依赖。 */ stateRequiresEvidence: boolean | null
/** 构图依赖。 */ framingRequiresEvidence: boolean | null
/** 明确无可见反证。 */ noVisibleContradiction: boolean | null
/** 其余证据已核对。 */ remainingEvidenceVerified: boolean | null
}
/**
* 检查人工填写完整性和非阻断必要条件,不改写任何观察。
* @param item 人工范围
* @param basis 当前正式依据
* @returns 是否可以提交
*/
export function validAssessment(item: EvidenceAssessment, basis: ApplicabilityBasis) {
if (
!item.featureKey.trim() ||
!item.evidence.trim() ||
!basis.references.some(r => r.imageNumber === item.imageNumber && r.subjectRefs.includes(item.subjectRef))
)
return false
if (
[
item.stateRequiresEvidence,
item.framingRequiresEvidence,
item.noVisibleContradiction,
item.remainingEvidenceVerified
].some(v => typeof v !== 'boolean') ||
item.actions.some(a => typeof a.requiresEvidence !== 'boolean' || !a.reason.trim())
)
return false
if (item.requirement !== 'non_blocking_unknown') return true
return (
basis.cameraMovement === 'static' &&
!!basis.actionIds?.length &&
JSON.stringify(item.actions.map(a => a.actionId).toSorted()) ===
JSON.stringify([...basis.actionIds].toSorted()) &&
item.actions.every(a => a.requiresEvidence === false) &&
item.stateRequiresEvidence === false &&
item.framingRequiresEvidence === false &&
item.noVisibleContradiction === true &&
item.remainingEvidenceVerified === true
)
}
+16
View File
@@ -1,3 +1,4 @@
import type { ApplicabilityBasis, EvidenceAssessment } from './source-applicability'
import { request } from '../../lib/http'
import type { ProviderImageInputSnapshot } from '../subject-images/generation-preview'
import type { KeyframeValidation, KeyframeValidationAccepted } from './quality.types'
@@ -22,6 +23,10 @@ export interface SourceReviewInput {
/** 预检指纹。 */ expectedFingerprint: string
/** 审核人。 */ reviewer: string
/** 理由。 */ reason: string
/** 人工明确提交的证据适用范围。 */ applicability?: {
/** 正式依据摘要。 */ expectedBasisFingerprint: string
/** 逐项范围。 */ assessments: EvidenceAssessment[]
}
/** 全部物理参考。 */ observations: SourceObservation[]
}
/** 公开输入,不将当前参考冒充原始输入。 */
@@ -44,6 +49,7 @@ export interface SourceReviewPreview {
/** 原主图。 */ keyframeId: string
/** 原图。 */ imageUrl: string
/** 预检指纹。 */ fingerprint: string
/** 当前正式动作、状态和机位。 */ applicabilityBasis?: ApplicabilityBasis
/** 原件证据。 */ originalPixels: { /** 原件摘要。 */ sha256: string }
/** 原输入指纹。 */ originalInputFingerprint: string
/** 原始生成输入。 */ originalProviderInput: SourcePublicInput
@@ -63,6 +69,16 @@ export interface SourceReviewRecord {
/** 失效原因。 */ invalidation: string | null
/** 原观察。 */ review: SourceReviewInput
/** 原结论。 */ originalResult: { /** 状态。 */ status: string; /** 证据类型。 */ evidenceKind: string }
/** 仅允许准备独立审核,不表示视频就绪。 */ validationEligible?: boolean
/** 原观察和适用性分开展示。 */ applicabilityAssessment?: {
/** 当前来源状态。 */ status: string
/** 各维度原观察和适用范围。 */ assessments: Array<{
/** 参考序号。 */ imageNumber: number
/** 维度。 */ dimension: string
/** 原观察。 */ finding: SourceFinding
/** 适用性。 */ applicability: string
}>
}
/** 当前结论。 */ reviewStatus: string
}
/** 精确机器计划,原样批准。 */
+20 -3
View File
@@ -1,3 +1,4 @@
import { validationPreviewApi } from './validation-preview'
import { videoOperationAllowed } from './video-permissions'
import { computed, onScopeDispose, watch } from 'vue'
import { useWorkflowExecution } from '../workflows/execution'
@@ -24,7 +25,8 @@ import type {
QualityReceipt,
QualityTarget,
RepairAttempt,
ResumeKeyframeValidation
ResumeKeyframeValidation,
KeyframeVisionInput
} from './quality.types'
/** 校验有限修复回执的每轮结论,避免结构缺失时误报成功。 */
@@ -114,9 +116,15 @@ export function useQuality(
* @param action 已确认的质量操作
* @param input 已确认的参数
* @param resume 显式继续的原任务身份,可省略
* @param plan 本次已批准的免费计划版本
* @returns 操作结束通知,后台生成由持久化任务继续跟踪
*/
async function run(action: QualityAction, input: QualityInput, resume?: ResumeKeyframeValidation) {
async function run(
action: QualityAction,
input: QualityInput,
resume?: ResumeKeyframeValidation,
plan?: { expectedValidationFingerprint: string }
) {
if (blocked.value || !visible() || !props.target || !validQualityInput(input)) return
const target = { ...props.target }
if (resume && (target.kind !== 'keyframe' || action !== 'validate')) return
@@ -231,10 +239,19 @@ export function useQuality(
)
throw new Error('首帧未完成、画幅不符或来源过期,不能执行质量检查。')
if (!stillCurrent()) throw new Error('已离开原候选,未提交审核。')
if (plan) {
const latest = await validationPreviewApi(target.shotId, target.assetId, projectId)
if (
latest.status !== 'ready' ||
latest.validationFingerprint !== plan.expectedValidationFingerprint
)
throw new Error('审核计划已变化,请重新免费预检并确认。')
if (!stillCurrent()) return
}
const result = await submitKeyframeVision(
target.shotId,
target.assetId,
resume ?? input.allowedTexts ?? [],
(resume ?? plan ?? input.allowedTexts ?? []) as KeyframeVisionInput,
history,
projectId
)
+50 -4
View File
@@ -1,3 +1,4 @@
import { validAssessment, type EvidenceAssessment } from './source-applicability'
import { computed, ref, shallowRef, watch, onScopeDispose, type Ref } from 'vue'
import {
sourceReviewApi,
@@ -9,7 +10,7 @@ import {
} from './source-review'
import { useKeyframeVision, submitSourceVision } from './keyframe-vision'
import { useActionMessage, showActionFeedback } from '../../components/ui/useActionMessage'
import { errorMessage } from '../../lib/http'
import { ApiError, errorMessage } from '../../lib/http'
import { runOperation, getOperation } from '../workflows/operations'
/**
@@ -36,6 +37,8 @@ export function useSourceReview(key: Ref<string>) {
const reason = ref('')
/** 逐图默认未知。 */
const observations = ref<SourceObservation[]>([])
/** 人工证据范围,不默认豁免未知。 */
const assessments = ref<EvidenceAssessment[]>([])
/** 正式授权只在本次页面内保留。 */
const authorizationId = ref('')
/** 批准人。 */
@@ -84,6 +87,7 @@ export function useSourceReview(key: Ref<string>) {
reviewer.value = ''
reason.value = ''
observations.value = []
assessments.value = []
authorizationId.value = ''
approved.value = false
executeApproved.value = false
@@ -138,7 +142,16 @@ export function useSourceReview(key: Ref<string>) {
try {
await work(JSON.parse(target) as string[], controller.signal, valid)
} catch (cause) {
if (valid()) showActionFeedback(message, errorMessage(cause), 'error')
if (valid()) {
if (cause instanceof ApiError && cause.status === 409) {
plan.value = null
authorizationId.value = ''
approved.value = false
executeApproved.value = false
targetMatched.value = false
}
showActionFeedback(message, errorMessage(cause), 'error')
}
} finally {
if (target === key.value && cycle === epoch) pending.value = ''
}
@@ -147,6 +160,7 @@ export function useSourceReview(key: Ref<string>) {
async function loadPreview() {
await run('preview', async ([s, k, p], signal, valid) => {
preview.value = null
assessments.value = []
plan.value = null
record.value = null
targetMatched.value = false
@@ -181,6 +195,7 @@ export function useSourceReview(key: Ref<string>) {
record.value = data
preview.value = null
observations.value = []
assessments.value = []
targetMatched.value = false
const comparison = await sourceReviewApi.preview(p!, s!, k!, signal)
if (valid()) {
@@ -219,10 +234,31 @@ export function useSourceReview(key: Ref<string>) {
showActionFeedback(message, '请填写审核人、理由及每张参考的观察说明。', 'error')
return
}
const basis = preview.value.applicabilityBasis
const scopes = assessments.value.filter(
item =>
observations.value.find(o => o.imageNumber === item.imageNumber)?.finding[item.dimension] === 'unknown'
)
if (scopes.length && (!basis || scopes.some(item => !validAssessment(item, basis)))) {
showActionFeedback(
message,
'请逐项核对正式动作、主体、状态、构图和可见反证;当前范围尚不满足保存条件。',
'error'
)
return
}
await run('save', async ([s, k, p], _, valid) => {
const savedEpoch = epoch
const data = await sourceReviewApi.save(p!, s!, k!, {
expectedFingerprint: preview.value!.fingerprint,
...(scopes.length && basis
? {
applicability: {
expectedBasisFingerprint: basis.fingerprint,
assessments: JSON.parse(JSON.stringify(scopes)) as EvidenceAssessment[]
}
}
: {}),
reviewer: reviewer.value.trim(),
reason: reason.value.trim(),
observations: structuredClone(observations.value.map(o => ({ ...o, finding: { ...o.finding } })))
@@ -238,13 +274,22 @@ export function useSourceReview(key: Ref<string>) {
) {
record.value = next
targetMatched.value = true
authorizationId.value = ''
plan.value = null
void vision.history.refresh()
}
}
})
if (targetMatched.value && record.value?.current) await loadPlan()
}
/** 仅有效且全部通过的原观察才请求免费机器计划。 */
/** 仅当前且服务端允许的来源观察才请求免费机器计划。 */
async function loadPlan() {
if (!targetMatched.value || !record.value?.current || record.value.reviewStatus !== 'passed') return
if (
!targetMatched.value ||
!record.value?.current ||
!(record.value.validationEligible ?? record.value.reviewStatus === 'passed')
)
return
await run('plan', async ([, , p], signal, valid) => {
plan.value = null
authorizationId.value = ''
@@ -343,6 +388,7 @@ export function useSourceReview(key: Ref<string>) {
reviewer,
reason,
observations,
assessments,
authorizationId,
approvedBy,
operator,
@@ -0,0 +1,71 @@
import { request } from '../../lib/http'
import { keyframeScope } from './keyframe-scope'
/** 普通审核免费计划,图片序号与实际送审输入一致。 */
export interface ValidationPreview {
/** 服务端当前资格。 */ status: 'ready' | 'blocked' | 'reusable'
/** 完整计划摘要。 */ validationFingerprint: string
/** 当前审核模型。 */ model: string
/** 实际步骤。 */ steps: string[]
/** 每步图片数。 */ actualImagesPerStep: number
/** 最大请求数。 */ maximumProviderRequests: number
/** 历史记录数。 */ historyCount: number
/** 正在执行的任务。 */ activeTasks: Array<{ /** 状态。 */ status: string }>
/** 费用或结果未结任务。 */ unresolvedTasks: Array<{ /** 状态。 */ status: string }>
/** 配置冲突。 */ planConflict: boolean
/** 原图及真实摘要。 */ image: {
/** 原件地址。 */ imageUrl: string
/** 内容摘要。 */ sha256: string
/** 宽。 */ width: number
/** 高。 */ height: number
}
/** 实际物理参考。 */ references: Array<{
/** 审核序号。 */ imageNumber: number
/** 原生图序号。 */ generationImageNumber: number
/** 原件地址。 */ imageUrl: string
/** 内容摘要。 */ sha256: string
/** 主体职责。 */ bindings: Array<{ /** 主体。 */ subjectRef: string; /** 职责。 */ role: string }>
}>
/** 审核费用,null 不是零元。 */ feeEstimate: {
/** 金额。 */ amount: number | null
/** 币种。 */ currency: string
/** 估算原因。 */ reason: string
}
/** 同计划历史结果,包含失败。 */ reusableResult: {
/** 是否通过。 */ passed: boolean
/** 摘要。 */ summary?: string
} | null
}
/**
* 免费读取当前普通审核计划,不创建任务。
* @param shot 镜头
* @param image 候选
* @param project 项目
* @param signal 取消信号
* @returns 当前计划
*/
export function validationPreviewApi(shot: string, image: string, project: string, signal?: AbortSignal) {
return request<ValidationPreview>(
keyframeScope(
`/storyboard-shots/${encodeURIComponent(shot)}/keyframes/${encodeURIComponent(image)}/validate/preview`,
project
),
{ signal, timeoutMs: 0 }
)
}
/**
* 将正式审核原件读取路径转换为图片组件接受的绝对地址。
* @param value 服务端公开图片地址
* @returns 可供已有图片组件读取的地址,其他路径保持原值并由公共校验器处理
*/
export function validationImageUrl(value: string) {
if (
!/^\/api\/storyboard-shots\/[^/]+\/keyframes\/[^/]+\/generation-input\/references\/\d+\?projectId=[^&]+$/.test(
value
)
)
return value
const api = import.meta.env.VITE_API_BASE_URL || '/api'
const origin = /^https?:\/\//i.test(api) ? new URL(api).origin : window.location.origin
return new URL(value, origin).href
}
@@ -18,7 +18,7 @@ import GenerationModelControls from '../../generation-config/components/Generati
import type { GenerationOptions } from '../../generation-config/types'
import { storyboardApi } from '../api'
import { derivedReviewApi } from '../derived-review-api'
import { draftFromFormal } from '../derived-review'
import { draftFromFormal, reviseSubjectGaze } from '../derived-review'
import type {
DerivedReviewSelection,
DraftProviderInput,
@@ -41,7 +41,24 @@ const emit = defineEmits<{ changed: [] }>()
/** 当前人工审核抽屉。 */
const open = ref(false)
/** 在同一摄影入口切换受控修订与场景沿用。 */
const mode = ref<'camera' | 'scene'>('camera')
const mode = ref<'camera' | 'scene' | 'gaze'>('camera')
/** 本次明确选择的正式主体。 */
const gazeSubject = ref<string | null>(null)
/** 人工填写的目标视线。 */
const gazeAfter = ref('')
/** 人工确认的修订原因。 */
const gazeReason = ref('')
/** 当前正式主体及原视线,来源改变后撤销旧确认。 */
const formalGaze = computed(() =>
formalQuery.data.value?.shot.visualState?.subjects.find(s => s.subjectRef === gazeSubject.value)
)
/** 当前可选正式主体。 */
const gazeOptions = computed(() =>
(formalQuery.data.value?.shot.visualState?.subjects ?? []).map(s => ({
label: `${s.subjectRef} · ${s.formName}`,
value: s.subjectRef
}))
)
/** 当前手动核对的构图与机位。 */
const composition = ref('')
/** 当前手动核对的摄影机位置。 */
@@ -175,6 +192,9 @@ watch(
composition,
cameraPosition,
selectedScene,
gazeSubject,
gazeAfter,
gazeReason,
imported,
provider,
options,
@@ -191,6 +211,9 @@ watch(key, () => {
draftLoaded.value = false
editingSavedInput.value = undefined
mode.value = 'camera'
gazeSubject.value = null
gazeAfter.value = ''
gazeReason.value = ''
selectedScene.value = null
imported.value = ''
reviewer.value = ''
@@ -245,7 +268,13 @@ function editCurrentDraft() {
imported.value = savedDraftText.value
return
}
if (saved.draft.sceneStateCarryForward) {
if (saved.draft.subjectStateRevision) {
mode.value = 'gaze'
const change = saved.draft.subjectStateRevision.changes[0]
gazeSubject.value = change?.subjectRef ?? null
gazeAfter.value = change?.after ?? ''
gazeReason.value = saved.draft.subjectStateRevision.reason
} else if (saved.draft.sceneStateCarryForward) {
mode.value = 'scene'
selectedScene.value = saved.draft.sceneStateCarryForward.subjectRef
} else {
@@ -294,9 +323,14 @@ const canPreview = computed(
(formal.value
? !!formalQuery.data.value &&
!formalQuery.error.value &&
(mode.value === 'scene'
? !!scene.value
: !!composition.value.trim() && !!cameraPosition.value.trim())
(mode.value === 'gaze'
? !!formalGaze.value &&
!!gazeAfter.value.trim() &&
gazeAfter.value.trim() !== formalGaze.value.gaze &&
!!gazeReason.value.trim()
: mode.value === 'scene'
? !!scene.value
: !!composition.value.trim() && !!cameraPosition.value.trim())
: !!imported.value.trim()))
)
/** 展示已预览输入,草案指纹只用于只读公共组件。 */
@@ -339,6 +373,8 @@ function buildDraft(): ShotReviewDraft {
}
const source = formalQuery.data.value!
const draft = draftFromFormal(source.shot, source.keyframe, fingerprint)
if (mode.value === 'gaze')
return reviseSubjectGaze(draft, gazeSubject.value ?? '', gazeAfter.value, gazeReason.value)
if (mode.value === 'camera') {
draft.direction.composition = composition.value.trim()
draft.direction.cameraPosition = cameraPosition.value.trim()
@@ -409,6 +445,8 @@ async function saveDraft() {
if (target !== key.value) return
if (cause instanceof ApiError && cause.status === 409) {
draftConflict.value = true
void preflight.refresh()
void formalQuery.refresh()
const details = cause.details as { code?: string; currentRevision?: number | null } | null
const revisionConflict =
(details?.code ?? cause.code ?? cause.message.split(':')[0]) ===
@@ -586,6 +624,15 @@ async function adopt() {
>
</section>
<!-- 以下是已审视线变更范围,不将修订解释为质量通过 -->
<section v-if="reviewed?.selection.draft.subjectStateRevision" class="space-y-2 text-sm">
<WorkspaceSectionHeading title="本次采用范围:主体视线" />
<p v-for="change in reviewed.selection.draft.subjectStateRevision.changes" :key="change.subjectRef">
{{ change.subjectRef }}:{{ change.before || '未填写' }} → {{ change.after }}
</p>
<p>理由:{{ reviewed.selection.draft.subjectStateRevision.reason }}</p>
<p class="text-muted">当前质量可能变为来源过期;修订不代表视觉审核通过。</p>
</section>
<!-- 以下是受控摄影修订与场景沿用 -->
<section v-if="formal && !useSaved" class="space-y-3 text-sm">
<WorkspaceSectionHeading title="待审修改" />
@@ -596,11 +643,46 @@ async function adopt() {
<NButton :secondary="mode === 'camera'" :disabled="saving" @click="mode = 'camera'"
>修订构图与机位</NButton
>
<NButton :secondary="mode === 'gaze'" :disabled="saving" @click="mode = 'gaze'"
>修订主体视线</NButton
>
<NButton :secondary="mode === 'scene'" :disabled="saving" @click="mode = 'scene'"
>沿用前镜场景状态</NButton
>
</div>
<template v-if="mode === 'camera'">
<!-- 以下是正式主体的有界视线修订 -->
<section v-if="mode === 'gaze'" class="space-y-3">
<NSelect
v-model:value="gazeSubject"
:options="gazeOptions"
:disabled="saving"
placeholder="选择当前正式主体"
aria-label="视线修订主体"
/>
<p v-if="formalGaze">当前正式视线:{{ formalGaze.gaze || '未填写' }}</p>
<label class="block space-y-1"
><span>修订后的视线</span
><NInput
v-model:value="gazeAfter"
type="textarea"
:maxlength="2000"
:disabled="saving"
aria-label="修订后的视线"
/></label>
<label class="block space-y-1"
><span>修订理由</span
><NInput
v-model:value="gazeReason"
type="textarea"
:maxlength="4000"
:disabled="saving"
aria-label="视线修订理由"
/></label>
<p class="text-muted">
只修改所选主体视线。采用后需要重新核对来源与质量,历史审核结论和主图保留。
</p>
</section>
<template v-else-if="mode === 'camera'">
<label class="block"
>构图<NInput v-model:value="composition" type="textarea" :disabled="saving" class="mt-1"
/></label>
@@ -612,7 +694,7 @@ async function adopt() {
class="mt-1"
/></label>
</template>
<template v-else>
<template v-else-if="mode === 'scene'">
<p v-if="previousShot">
前镜 {{ previousShot.beatNo }}.{{ previousShot.shotNo }} · {{ previousShot.title }}
</p>
+28
View File
@@ -62,3 +62,31 @@ export function draftFromFormal(shot: DesignedShot, keyframe: KeyframeSpec, fing
}
}
}
/**
* 在正式草案副本上声明单主体视线修订,其它事实原样保留。
* @param formal 当前正式草案
* @param subjectRef 正式主体
* @param after 新视线
* @param reason 人工理由
* @returns 仅视线变化的完整草案
*/
export function reviseSubjectGaze(
formal: ShotReviewDraft,
subjectRef: string,
after: string,
reason: string
): ShotReviewDraft {
if (formal.subjectStateRevision || formal.sceneStateCarryForward)
throw new Error('请从当前正式状态重新修订,不能混入其它草案。')
const draft = JSON.parse(JSON.stringify(formal)) as ShotReviewDraft
const subject = draft.visualState.subjects.find(s => s.subjectRef === subjectRef)
if (!subject || !after.trim() || !reason.trim() || subject.gaze === after.trim())
throw new Error('请选择正式主体,并填写不同的新视线和修订理由。')
draft.subjectStateRevision = {
reason: reason.trim(),
changes: [{ subjectRef, field: 'gaze', before: subject.gaze, after: after.trim() }]
}
subject.gaze = after.trim()
return draft
}
@@ -36,6 +36,16 @@ export interface ShotReviewDraft {
/** 参考图编号。 */ imageId: string
/** 几何版本。 */ spatialLayoutVersion: string
}>
/** 仅明确声明的主体视线修订,不混入其它模式。 */
subjectStateRevision?: {
/** 人工确认理由。 */ reason: string
/** 完整的原值与目标值。 */ changes: Array<{
/** 当前正式主体。 */ subjectRef: string
/** 首版仅允许视线。 */ field: 'gaze'
/** 正式原值。 */ before: string
/** 明确的新值。 */ after: string
}>
}
/** 用户明确选择的前镜状态来源。 */
sceneStateCarryForward?: {
/** 同集紧邻前镜。 */ previousShotId: string
+6
View File
@@ -1,5 +1,11 @@
/** 项目配置的确定性业务状态说明,不将配置限制显示为系统故障。 */
const configurationErrorLabels: Record<string, string> = {
SUBJECT_STATE_REVISION_STALE: '正式视线或来源已变化,请重新读取原值并确认差异。',
SUBJECT_STATE_REVISION_SCOPE: '此次修改超出视线范围,请从当前正式状态重新填写。',
SUBJECT_STATE_REVISION_ACTIVE: '此镜头仍有任务进行中,请等待结束后再采用视线修订。',
SOURCE_REVIEW_STALE: '来源或动作依据已变化,请重新预检并核对观察。',
SOURCE_REVIEW_INCOMPLETE: '参考观察不完整,请核对每张参考。',
SOURCE_REVIEW_APPLICABILITY_INVALID: '证据范围不满足条件,请逐项核对动作、主体、机位和依赖。',
KEYFRAME_VALIDATION_EXECUTION_CONFLICT: '执行关联或历史证据需要核查,请刷新记录后核对。',
KEYFRAME_VALIDATION_ACTIVE: '已有审核正在进行,请查看当前执行进度。',
KEYFRAME_VALIDATION_RECOVERY_REQUIRED: '原审核结果或费用待核查,请刷新历史并核对,勿重复提交。',
+12
View File
@@ -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="./b04-review.ts"></script>
</body>
</html>
+126
View File
@@ -0,0 +1,126 @@
import { createApp, defineComponent, h, ref } from 'vue'
import { NButton, NConfigProvider, NMessageProvider } from 'naive-ui'
import QualityDialog from '../../src/features/production/components/QualityDialog.vue'
import SourceReviewDrawer from '../../src/features/production/components/SourceReviewDrawer.vue'
import { validationPreview } from '../fixtures/validation-preview'
import '../../src/styles/styles.css'
import '../../src/styles/admin.css'
/** 仅本隔离页的当前计划状态。 */
const status = ref<'ready' | 'blocked' | 'reusable'>('ready')
/** 重新打开不同隔离状态。 */
const revision = ref(0)
/** 仅允许加载本地静态测试图片。 */
const nativeFetch = window.fetch.bind(window)
/**
* 隔离所有 API;全部写入返回拒绝,不能连接真实 Provider。
* @param input 请求路径
* @param init 请求选项
* @returns 隔离回执
*/
window.fetch = async (input, init) => {
if (init?.method && init.method !== 'GET')
return new Response(JSON.stringify({ message: '隔离验收禁止写入' }), { status: 403 })
const path = String(input)
if (path.includes('/tests/browser/')) return nativeFetch(input, init)
const data = path.includes('/validate/preview')
? {
...validationPreview,
status: status.value,
activeTasks: status.value === 'blocked' ? [{ status: 'running' }] : [],
reusableResult:
status.value === 'reusable' ? { passed: false, summary: '历史审核未通过,复用不重复计费' } : null
}
: path.includes('/quality-review')
? {
shotId: 's',
keyframeId: 'k',
qualityDecision: 'failed',
effectiveQualityStatus: 'stale',
manualReviewAvailable: false,
validationTaskId: 't',
historicalGazePreview: [],
manualReview: null
}
: path.includes('/source-review/preview')
? {
projectId: 'p',
shotId: 's',
keyframeId: 'k',
imageUrl: 'http://localhost:4312/tests/browser/candidate.svg',
fingerprint: 'a'.repeat(64),
originalPixels: { sha256: 'b'.repeat(64) },
originalInputFingerprint: 'c'.repeat(64),
originalProviderInput: {},
sourceChanges: {},
historicalVision: [],
references: [
{ imageNumber: 1, imageUrl: 'http://localhost:4312/tests/browser/candidate.svg', imageId: 'i' }
],
currentReferenceInput: {
references: [{ imageNumber: 1, bindings: [{ subjectRef: '@CH1', role: 'identity-anchor' }] }]
},
applicabilityBasis: {
fingerprint: 'd'.repeat(64),
actionIds: ['A1', 'A2'],
cameraMovement: 'static',
references: [{ imageNumber: 1, subjectRefs: ['@CH1'] }],
facts: {
rawJson: JSON.stringify({
requiredActions: [
{ id: 'A1', description: '静立' },
{ id: 'A2', description: '观察' }
]
}),
direction: { cameraMovement: 'static' },
visualState: { gaze: '朝向画面左侧' }
}
}
}
: []
return new Response(JSON.stringify({ data }), { headers: { 'Content-Type': 'application/json' } })
}
/** 真实组件的只读隔离验收入口。 */
const Preview = defineComponent({
setup() {
/** 质量面板可见性。 */ const open = ref(false)
/** 来源面板可见性。 */ const source = ref(false)
return () =>
h('main', { style: 'padding:24px;height:100dvh;overflow:auto' }, [
h('h1', { style: 'margin-bottom:20px' }, 'B04 首帧审核隔离验收(全部写请求禁止)'),
h('div', { style: 'display:flex;flex-wrap:wrap;gap:12px' }, [
...(['ready', 'blocked', 'reusable'] as const).map(value =>
h(
NButton,
{
onClick: () => {
status.value = value
revision.value++
open.value = true
}
},
() => value
)
),
h(NButton, { onClick: () => (source.value = true) }, () => '来源证据范围')
]),
h(QualityDialog, {
key: revision.value,
open: open.value,
'onUpdate:open': (v: boolean) => (open.value = v),
projectId: 'p',
target: { kind: 'keyframe', shotId: 's', assetId: 'k', title: '隔离候选' },
disabled: true
}),
h(SourceReviewDrawer, {
open: source.value,
'onUpdate:open': (v: boolean) => (source.value = v),
projectId: 'p',
shotId: 's',
keyframeId: 'k'
})
])
}
})
createApp({
render: () => h(NConfigProvider, null, { default: () => h(NMessageProvider, null, { default: () => h(Preview) }) })
}).mount('#app')
@@ -0,0 +1,77 @@
import { describe, expect, it } from 'vitest'
import {
validAssessment,
type ApplicabilityBasis,
type EvidenceAssessment
} from '@/features/production/source-applicability'
/** 正式完整依据,不按物件名称推断。 */
const basis: ApplicabilityBasis = {
fingerprint: 'a'.repeat(64),
actionIds: ['a1', 'a2'],
cameraMovement: 'static',
references: [{ imageNumber: 1, subjectRefs: ['@SC1'] }],
facts: {}
}
/**
* 构建已经逐项核对的人工范围。
* @returns 完整声明
*/
function assessment(): EvidenceAssessment {
return {
imageNumber: 1,
dimension: 'structure',
featureKey: '局部结构',
subjectRef: '@SC1',
requirement: 'non_blocking_unknown',
evidence: '当前镜头不可见,其它证据已核对',
actions: ['a1', 'a2'].map(actionId => ({ actionId, requiresEvidence: false, reason: '当前动作不依赖此结构' })),
stateRequiresEvidence: false,
framingRequiresEvidence: false,
noVisibleContradiction: true,
remainingEvidenceVerified: true
}
}
describe('有界证据适用性', () => {
it('仅完整正式依据与人工声明可准备非阻断范围', () => {
expect(validAssessment(assessment(), basis)).toBe(true)
})
it.each(['pan', null])('非固定或缺失机位 %s 拒绝豁免', cameraMovement => {
expect(validAssessment(assessment(), { ...basis, cameraMovement })).toBe(false)
})
it('动作缺失、遗漏、重复均不可豁免', () => {
expect(validAssessment(assessment(), { ...basis, actionIds: null })).toBe(false)
const item = assessment()
item.actions.pop()
expect(validAssessment(item, basis)).toBe(false)
item.actions.push(item.actions[0]!)
expect(validAssessment(item, basis)).toBe(false)
})
it('外来主体和未确认反证不可豁免', () => {
const item = assessment()
item.subjectRef = '@SC2'
expect(validAssessment(item, basis)).toBe(false)
item.subjectRef = '@SC1'
item.noVisibleContradiction = null
expect(validAssessment(item, basis)).toBe(false)
})
it('任何必要依赖或反证均拒绝非阻断', () => {
for (const field of ['stateRequiresEvidence', 'framingRequiresEvidence'] as const) {
const item = assessment()
item[field] = true
expect(validAssessment(item, basis)).toBe(false)
}
const item = assessment()
item.actions[0]!.requiresEvidence = true
expect(validAssessment(item, basis)).toBe(false)
item.actions[0]!.requiresEvidence = false
item.noVisibleContradiction = false
expect(validAssessment(item, basis)).toBe(false)
})
})
it('正式审核原件读取路径可以进入公共图片组件,任意路径不扩展权限', async () => {
const { validationImageUrl } = await import('@/features/production/validation-preview')
const path = '/api/storyboard-shots/s/keyframes/k/generation-input/references/1?projectId=p'
expect(validationImageUrl(path)).toBe(new URL(path, window.location.origin).href)
expect(validationImageUrl('/api/private')).toBe('/api/private')
})
+51 -2
View File
@@ -1,3 +1,4 @@
import { validationPreview } from '../../fixtures/validation-preview'
import { ApiError } from '@/lib/http'
import { defineComponent, reactive, ref } from 'vue'
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
@@ -37,6 +38,7 @@ afterEach(() => {
/** 模拟统一配置后的真实契约,测试绝不调用真实图片或视觉模型。 */
function server() {
const plan = structuredClone(validationPreview)
const projectId = `quality-test-${sequence++}`
const project = testProjectContext(projectId).project.value!
const validation = {
@@ -164,6 +166,7 @@ function server() {
}
else if (String(url).endsWith('/checkpoints?view=summary')) data = []
else if (path.endsWith('/production/entry-readiness')) data = { ready: true }
else if (path.endsWith('/validate/preview')) data = plan
else if (path.endsWith('/validations')) data = []
else if (path.endsWith('/quality-review'))
data = {
@@ -191,6 +194,7 @@ function server() {
vi.stubGlobal('fetch', fetcher)
return {
projectId,
plan,
project,
validation,
keyframe,
@@ -461,8 +465,9 @@ describe('质量面板渐进展示', () => {
})
await flushPromises()
expect(validationButton().disabled).toBe(true)
expect(document.body.textContent).toContain('更多参数与模型限制')
expect(document.querySelector('[aria-label="额外允许的画面文字"]')).not.toBeNull()
expect(document.body.textContent).toContain('免费审核预检')
expect(document.body.textContent).toContain('未知,需先核对费用范围')
expect(document.querySelector('[aria-label="额外允许的画面文字"]')).toBeNull()
expect(data.posts()).toHaveLength(0)
wrapper.findAllComponents(NCheckbox).at(-1)!.vm.$emit('update:checked', true)
await flushPromises()
@@ -639,3 +644,47 @@ describe('视频修复候选与复检晋升', () => {
expect(data.posts()).toHaveLength(0)
})
})
describe('普通审核计划保护', () => {
it.each(['blocked', 'reusable'] as const)('%s 不允许新审核且不自动收费', async status => {
const data = server()
data.plan.status = status
if (status === 'reusable') data.plan.reusableResult = { passed: false, summary: '旧失败结论' }
else data.plan.activeTasks = [{ status: 'running' }]
wrapper = mount(QualityDialog, {
attachTo: document.body,
props: {
projectId: data.projectId,
target: { kind: 'keyframe', shotId: 'shot-1', assetId: 'keyframe-1', title: '计划保护' },
open: true,
disabled: false
}
})
await flushPromises()
wrapper.findAllComponents(NCheckbox).at(-1)!.vm.$emit('update:checked', true)
await flushPromises()
expect(validationButton().disabled).toBe(true)
expect(data.posts()).toHaveLength(0)
expect(document.body.textContent).toContain(status === 'reusable' ? '历史审核:未通过' : '正在执行')
})
it('批准后计划变化撤销提交,刷新后等待重新确认', async () => {
const data = server()
wrapper = mount(QualityDialog, {
attachTo: document.body,
props: {
projectId: data.projectId,
target: { kind: 'keyframe', shotId: 'shot-1', assetId: 'keyframe-1', title: '计划保护' },
open: true,
disabled: false
}
})
await flushPromises()
wrapper.findAllComponents(NCheckbox).at(-1)!.vm.$emit('update:checked', true)
await flushPromises()
data.plan.validationFingerprint = 'b'.repeat(64)
validationButton().click()
await flushPromises()
expect(data.posts()).toHaveLength(0)
expect(validationButton().disabled).toBe(true)
})
})
@@ -276,3 +276,25 @@ it('抽屉使用真实表单,打开只读历史,免费预检逐项展示全
wrapper.unmount()
}
})
/** 非阻断只依据服务端资格开放免费计划,未知观察和机器质量保持独立。 */
it('当前非阻断来源可查看独立计划,服务端明确拒绝时关闭入口', async () => {
const mock = sourceMock('non_blocking_unknown')
Object.assign(mock.record, { validationEligible: true })
mock.record.review.observations[0]!.finding.structure = 'unknown'
vi.stubGlobal('fetch', mock.fetcher)
const form = scope.run(() => useSourceReview(ref(JSON.stringify(['s', 'k', 'p']))))!
await flushPromises()
form.reviewId.value = 'r'
await form.readRecord()
await form.loadPlan()
expect(form.plan.value?.reviewId).toBe('r')
expect(form.record.value?.review.observations[0]!.finding.structure).toBe('unknown')
expect(mock.calls.every(call => call.body === null)).toBe(true)
form.plan.value = null
Object.assign(form.record.value!, { validationEligible: false, reviewStatus: 'passed' })
const before = mock.calls.length
await form.loadPlan()
expect(mock.calls.length).toBe(before)
expect(form.plan.value).toBeNull()
})
@@ -194,3 +194,18 @@ describe('待审摄影草案的保存与回读', () => {
])
})
})
it('视线修订只更新选中 gaze,原正式事实与机位不变', async () => {
const { reviseSubjectGaze } = await import('@/features/storyboard/derived-review')
const formal = draftFromFormal(shot, keyframe, 'a'.repeat(64))
const revised = reviseSubjectGaze(formal, '@SC0001', '画面左侧', '人工确认视线意图')
expect(revised.subjectStateRevision?.changes).toEqual([
{ subjectRef: '@SC0001', field: 'gaze', before: '', after: '画面左侧' }
])
expect(formal.visualState.subjects[0]!.gaze).toBe('')
expect(revised.direction).toEqual(formal.direction)
expect({ ...revised.visualState.subjects[0], gaze: '' }).toEqual(formal.visualState.subjects[0])
expect(() => reviseSubjectGaze(formal, '@CH9999', '左侧', '理由')).toThrow('请选择正式主体')
expect(() => reviseSubjectGaze(formal, '@SC0001', '', '理由')).toThrow('请选择正式主体')
expect(() => reviseSubjectGaze(revised, '@SC0001', '右侧', '理由')).toThrow('请从当前正式状态')
})
+31
View File
@@ -0,0 +1,31 @@
import type { ValidationPreview } from '../../src/features/production/validation-preview'
/** 普通免费审核计划的隔离样本,无真实 Provider。 */
export const validationPreview: ValidationPreview = {
status: 'ready',
validationFingerprint: 'a'.repeat(64),
model: '隔离审核模型',
steps: ['general', 'physical'],
actualImagesPerStep: 2,
maximumProviderRequests: 2,
historyCount: 0,
activeTasks: [],
unresolvedTasks: [],
planConflict: false,
image: {
imageUrl: 'http://localhost:4312/tests/browser/candidate.svg',
sha256: 'b'.repeat(64),
width: 1024,
height: 1024
},
references: [
{
imageNumber: 2,
generationImageNumber: 1,
imageUrl: 'http://localhost:4312/tests/browser/candidate.svg',
sha256: 'c'.repeat(64),
bindings: [{ subjectRef: '@CH1', role: 'identity-anchor' }]
}
],
feeEstimate: { amount: null, currency: 'CNY', reason: '部署用量待估算' },
reusableResult: null
}