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

@@ -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