feat(short-drama-agent-front): 接入连续性状态签收与联合审核
This commit is contained in:
1 parent
0d58dd8c53
commit
10e008ca10
21 files changed
+1319
-25
No files matched your search
@@ -0,0 +1,34 @@
|
||||
# V02-06 前端接入记录
|
||||
|
||||
2026-11-09,前端根目录 dev,基线 0d58dd8;仅修改前端,未运行真实付费调用或修改受保护三镜。
|
||||
|
||||
## 正式契约
|
||||
|
||||
已对照后端四份 frontend-prompt:state-review、consumer-gates、joint-preview、joint-execution,并核对 storyboard.routes.ts、连续性 schema/state/vision/execution 服务。C2 的执行能力覆盖早期 C1 的 executionAvailable=false 限制,资格继续以免费计划当前返回值为准。
|
||||
|
||||
## 功能
|
||||
|
||||
- 原连续性抽屉默认固定几何;显式切换 geometry_and_state 后重新读取指纹和 stateContext。边界只取正式紧邻两镜,主体和 sourceIds 只从正式依据选择;before/after 不可辨认时保持 null,意见不默认通过。支持全部十三种维度、证据说明及可选非阻断用途理由。保存仍为用户主动签收,不替代单镜或所有连续性通过。
|
||||
- 消费 continuity_review_required,保留原 readiness 门禁及服务端原因;HTTP409 CONTINUITY_REVIEW_REQUIRED 显示具体组问题并可回到 Storyboard 原连续性入口。已有 Primary、Prompt、force 均不清除服务端问题;没有自动重试。
|
||||
- 原保存组详情加入联合免费计划,展示真实模型、图片顺序、全部绑定、合并空间图用途、未知执行费用、容量核验;完整脱敏请求与摘要放高级详情。只能读取原签收公开图像地址,不猜测路径。
|
||||
- 独立登记真实批准人、操作人、批准材料 SHA 和单次估算范围;maxRequests 固定 1。登记前再次核对总计划 fingerprint,登记不执行,执行必须单独勾选。写入出错即撤销页面批准,断线未知只允许观察,不自动重新批准或重发。
|
||||
- 通过免费计划 latestTask/reusableTaskId 找回原任务,沿现有 useWorkflowExecution GET/SSE 与 latest 发现;终态回读业务任务。completed 不推出 passed,原机器解析、当前评估、原人工未知分别追溯。恢复只依据 resumeAvailable/current,明确区分免费解析原回执与原批准下此前未发送的一次请求。
|
||||
- 首帧卡片来源复核与画幅、操作组之间增加留白,辅助按钮复用中性底面;质量弹窗免费计划刷新按钮使用块级留白,操作和历史模块间距分明。
|
||||
|
||||
## 文件与复用
|
||||
|
||||
新增 continuity-state.ts、ContinuityStateEditor.vue:人工范围类型、输入校验和表单。
|
||||
新增 continuity-joint.ts、ContinuityJointReview.vue:正式联合路由、计划、批准、执行和恢复;固定操作复用原抽屉 footer。
|
||||
扩展 continuity.types.ts、ContinuityReviewDrawer.vue,复用原诊断、签收、历史接口,不新建质量计算或 SSE 系统。
|
||||
扩展 production issue 类型/文案、HTTP 业务错误、项目阻断页和单镜工作区定位入口。
|
||||
新增 tests/fixtures/continuity-joint.ts、continuity-joint.test.ts 与 tests/browser/v02-continuity.html/ts。隔离浏览器页只模拟免费诊断,批准、执行、恢复、保存写请求全部拒绝,不连接真实收费模型。
|
||||
|
||||
## 验证与边界
|
||||
|
||||
- 定向 Vitest:连续性人工、联合批准/业务失败/恢复/过期、原质量、消息共 5 文件 47 用例通过;更广的 production/projects/storyboard 回归曾为 40 文件 253 用例通过,随后补充两项联合恢复/过期测试也通过。提交钩子将运行最终全量 pnpm check,结果以提交日志为准。
|
||||
- TypeScript、Oxlint、ESLint 已执行;最终格式及全量检查随提交钩子复核。
|
||||
- 本地 Chrome 复用 localhost:4312 标签页,未使用 Playwright。隔离页面检查默认几何与人工状态范围、空白意见/未知、正式依据选择、长表单滚动、联合图片/合并绑定/未知费用、390×844 窄屏及固定关闭底栏。真实项目检查首帧卡片与质量弹窗的暗色布局、刷新计划和历史模块间距;未点击真实执行或签收。
|
||||
- 真实 GET 联合免费预检(原签收 cmw7y6sqt0008rono7bv2lopl):ready、executionAvailable=true、qwen3.8-max、paidCalls=0、最多拟请求 1 次、amount=null;图片序号 1–4,绑定数依次 1/1/1/3。它不代表已获批准或联合审核已通过。
|
||||
- 真实授权、联合执行、恢复、状态签收写入没有实测,本次保护正式首组三镜与原签收,自动化使用隔离响应。未生成视频、未修改 Primary、未创造新签收规避缓存。
|
||||
|
||||
未发现必须新增的后端接口。后续真实联合执行仍需按对象、精确计划、次数及费用获得用户独立明确批准。
|
||||
@@ -0,0 +1,405 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onScopeDispose, ref, shallowRef, watch } from 'vue'
|
||||
import { NButton, NCheckbox, NInput, NInputNumber } from 'naive-ui'
|
||||
import { AssetImage } from '../../../components/ui'
|
||||
import RawDataDetails from '../../../components/ui/RawDataDetails.vue'
|
||||
import { useQuery } from '../../../composables/useQuery'
|
||||
import { errorMessage } from '../../../lib/http'
|
||||
import { useActionMessage } from '../../../components/ui/useActionMessage'
|
||||
import { useWorkflowExecution } from '../../workflows/execution'
|
||||
import WorkflowExecutionPanel from '../../workflows/WorkflowExecutionPanel.vue'
|
||||
import { jointApi, type JointApproval, type JointPlan } from '../continuity-joint'
|
||||
import { continuityStatusLabels } from '../continuity'
|
||||
import type { ContinuityReview } from '../continuity.types'
|
||||
/** 原签收范围与项目写入锁。 */
|
||||
const props = defineProps<{
|
||||
/** 项目。 */ projectId: string
|
||||
/** 已存人工记录。 */ review: ContinuityReview
|
||||
/** 项目活动锁。 */ disabled: boolean
|
||||
}>()
|
||||
/** 把写入锁与变化交给原抽屉。 */
|
||||
const emit = defineEmits<{ busy: [boolean]; changed: [] }>()
|
||||
/** 当前免费计划。 */
|
||||
const plan = shallowRef<JointPlan | null>(null)
|
||||
/** 单次操作锁。 */
|
||||
const pending = ref(false)
|
||||
/** 写入结果未知时禁止再次执行。 */
|
||||
const uncertain = ref(false)
|
||||
/** 当前原任务。 */
|
||||
const taskId = ref('')
|
||||
/** 本次批准编号,不持久化或复用到别组。 */
|
||||
const authorization = ref('')
|
||||
/** 真实批准人。 */
|
||||
const approvedBy = ref('')
|
||||
/** 操作人。 */
|
||||
const operator = ref('')
|
||||
/** 真实批准材料摘要。 */
|
||||
const approvalSha256 = ref('')
|
||||
/** 估算下限,不预填报价。 */
|
||||
const estimatedMin = ref<number | null>(null)
|
||||
/** 估算上限。 */
|
||||
const estimatedMax = ref<number | null>(null)
|
||||
/** 明确审阅当前计划。 */
|
||||
const approved = ref(false)
|
||||
/** 执行或恢复另行明确确认。 */
|
||||
const executeApproved = ref(false)
|
||||
/** 绑定范围,关闭后取消旧查询。 */
|
||||
const scopeKey = computed(() => JSON.stringify([props.projectId, props.review.reviewId]))
|
||||
/** 任务回读按项目、签收和任务共同隔离。 */
|
||||
const taskKey = computed(() =>
|
||||
taskId.value ? JSON.stringify([props.projectId, props.review.reviewId, taskId.value]) : ''
|
||||
)
|
||||
/** 原业务状态,不以 Workflow completed 推断通过。 */
|
||||
const task = useQuery(taskKey, async (value, signal) => {
|
||||
if (!value) return null
|
||||
const [p, r, t] = JSON.parse(value) as string[]
|
||||
const result = await jointApi.task(p!, t!, signal)
|
||||
if (result.reviewId !== r || result.validationTaskId !== t) throw new Error('联合任务与当前签收不符。')
|
||||
return result
|
||||
})
|
||||
/** 沿用原 Workflow 的 GET/SSE 和刷新发现。 */
|
||||
const execution = useWorkflowExecution(
|
||||
computed(() => props.projectId),
|
||||
'shot-keyframe-continuity-validation',
|
||||
{ discover: true }
|
||||
)
|
||||
/** 所属签收任务的执行变化后回读业务结果。 */
|
||||
watch(
|
||||
() => execution.query.data.value,
|
||||
record => {
|
||||
if (record && record.id === task.data.value?.executionId) void task.refresh()
|
||||
}
|
||||
)
|
||||
/** 取得任务后沿原执行编号观察,不新建任务。 */
|
||||
watch(
|
||||
() => task.data.value?.executionId,
|
||||
id => {
|
||||
if (id) void execution.track(id, props.projectId)
|
||||
}
|
||||
)
|
||||
/** 原任务与执行都收口后才显示业务结论。 */
|
||||
const taskActive = computed(
|
||||
() =>
|
||||
!!task.data.value &&
|
||||
[task.data.value.taskStatus, task.data.value.workflowStatus].some(s => ['pending', 'running'].includes(s))
|
||||
)
|
||||
/** 消息层。 */
|
||||
const message = useActionMessage()
|
||||
/** 免费请求取消器。 */
|
||||
let controller: AbortController | undefined
|
||||
/** 撤销批准和未知结果的跨范围复用。 */
|
||||
watch(
|
||||
scopeKey,
|
||||
() => {
|
||||
controller?.abort()
|
||||
pending.value = false
|
||||
plan.value = null
|
||||
taskId.value = ''
|
||||
authorization.value = ''
|
||||
approved.value = false
|
||||
executeApproved.value = false
|
||||
uncertain.value = false
|
||||
},
|
||||
{ flush: 'sync' }
|
||||
)
|
||||
onScopeDispose(() => controller?.abort())
|
||||
/** 任何批准材料改变都撤销先前批准。 */
|
||||
watch([approvedBy, operator, approvalSha256, estimatedMin, estimatedMax], () => {
|
||||
approved.value = false
|
||||
authorization.value = ''
|
||||
executeApproved.value = false
|
||||
})
|
||||
/** 可登记批准,费用未知仍须用户提供真实估算范围。 */
|
||||
const canAuthorize = computed(
|
||||
() =>
|
||||
!pending.value &&
|
||||
!props.disabled &&
|
||||
!uncertain.value &&
|
||||
!props.review.invalidation &&
|
||||
plan.value?.status === 'ready' &&
|
||||
plan.value.executionAvailable &&
|
||||
plan.value.capability.verified &&
|
||||
approved.value &&
|
||||
!!approvedBy.value.trim() &&
|
||||
!!operator.value.trim() &&
|
||||
/^[a-f0-9]{64}$/.test(approvalSha256.value) &&
|
||||
estimatedMin.value !== null &&
|
||||
estimatedMin.value >= 0 &&
|
||||
estimatedMax.value !== null &&
|
||||
estimatedMax.value > 0 &&
|
||||
estimatedMin.value <= estimatedMax.value
|
||||
)
|
||||
/** 只有本次批准和单独确认才可执行。 */
|
||||
const canExecute = computed(
|
||||
() =>
|
||||
!pending.value &&
|
||||
!props.disabled &&
|
||||
!uncertain.value &&
|
||||
!taskActive.value &&
|
||||
plan.value?.status === 'ready' &&
|
||||
plan.value.executionAvailable &&
|
||||
!!authorization.value &&
|
||||
executeApproved.value
|
||||
)
|
||||
/** 恢复只依据原任务的正式开关,未知状态不推断。 */
|
||||
const canResume = computed(
|
||||
() =>
|
||||
!pending.value &&
|
||||
!props.disabled &&
|
||||
!task.loading.value &&
|
||||
!task.error.value &&
|
||||
task.data.value?.resumeAvailable === true &&
|
||||
task.data.value.current &&
|
||||
executeApproved.value
|
||||
)
|
||||
/**
|
||||
* 同一范围只执行一次,错误撤销批准,绝不自动重发。
|
||||
* @param work 用户要求的操作
|
||||
* @param writing 是否写入
|
||||
*/
|
||||
async function run(work: () => Promise<void>, writing = false) {
|
||||
if (pending.value) return
|
||||
const scope = scopeKey.value
|
||||
pending.value = true
|
||||
if (writing) emit('busy', true)
|
||||
try {
|
||||
await work()
|
||||
} catch (cause) {
|
||||
if (scope === scopeKey.value) {
|
||||
authorization.value = ''
|
||||
approved.value = false
|
||||
executeApproved.value = false
|
||||
if (writing) uncertain.value = true
|
||||
message?.error(errorMessage(cause))
|
||||
}
|
||||
} finally {
|
||||
if (scope === scopeKey.value) pending.value = false
|
||||
if (writing) emit('busy', false)
|
||||
}
|
||||
}
|
||||
/** 免费刷新,旧指纹冲突后清空计划,下次由用户重新审阅。 */
|
||||
async function preview() {
|
||||
const scope = scopeKey.value
|
||||
const expected = plan.value?.fingerprint
|
||||
authorization.value = ''
|
||||
approved.value = false
|
||||
executeApproved.value = false
|
||||
await run(async () => {
|
||||
controller?.abort()
|
||||
controller = new AbortController()
|
||||
try {
|
||||
const result = await jointApi.preview(props.projectId, props.review.reviewId, expected, controller.signal)
|
||||
if (scope !== scopeKey.value) return
|
||||
if (result.projectId !== props.projectId || result.reviewId !== props.review.reviewId)
|
||||
throw new Error('计划与当前签收不符。')
|
||||
plan.value = result
|
||||
taskId.value = result.reusableTaskId || result.latestTask?.validationTaskId || ''
|
||||
if (taskId.value) await task.refresh()
|
||||
} catch (cause) {
|
||||
if (scope === scopeKey.value) plan.value = null
|
||||
throw cause
|
||||
}
|
||||
})
|
||||
}
|
||||
/** 独立登记当前完整计划与真实批准材料,不启动模型。 */
|
||||
async function authorize() {
|
||||
if (!canAuthorize.value || !plan.value) return
|
||||
const p = props.projectId,
|
||||
r = props.review.reviewId,
|
||||
fingerprint = plan.value.fingerprint
|
||||
const input: JointApproval = {
|
||||
plan: { purpose: 'continuity', reviewId: r, fingerprint },
|
||||
approvedBy: approvedBy.value.trim(),
|
||||
operator: operator.value.trim(),
|
||||
approvalSha256: approvalSha256.value,
|
||||
feeScope: {
|
||||
currency: 'CNY',
|
||||
estimatedMin: estimatedMin.value!,
|
||||
estimatedMax: estimatedMax.value!,
|
||||
maxRequests: 1
|
||||
}
|
||||
}
|
||||
await run(async () => {
|
||||
const latest = await jointApi.preview(p, r, fingerprint)
|
||||
if (scopeKey.value !== JSON.stringify([p, r])) return
|
||||
if (latest.status !== 'ready' || !latest.executionAvailable) throw new Error('计划已不可执行,请重新免费预检。')
|
||||
const result = await jointApi.authorize(p, r, input)
|
||||
if (scopeKey.value !== JSON.stringify([p, r])) return
|
||||
if (result.planFingerprint !== fingerprint) throw new Error('批准范围已改变,请重新审阅。')
|
||||
authorization.value = result.authorizationId
|
||||
executeApproved.value = false
|
||||
}, true)
|
||||
}
|
||||
/** 用户主动执行一次,先消耗页面批准,断线后仅查原任务。 */
|
||||
async function execute() {
|
||||
if (!canExecute.value) return
|
||||
const p = props.projectId,
|
||||
r = props.review.reviewId,
|
||||
id = authorization.value
|
||||
authorization.value = ''
|
||||
executeApproved.value = false
|
||||
await run(async () => {
|
||||
const result = await jointApi.execute(p, r, id)
|
||||
if (scopeKey.value !== JSON.stringify([p, r])) return
|
||||
taskId.value = result.validationTaskId
|
||||
await task.refresh()
|
||||
emit('changed')
|
||||
}, true)
|
||||
}
|
||||
/** 用户明确恢复原任务,不申请新批准或替换任务。 */
|
||||
async function resume() {
|
||||
if (!canResume.value || !task.data.value) return
|
||||
const p = props.projectId,
|
||||
r = props.review.reviewId,
|
||||
original = task.data.value
|
||||
executeApproved.value = false
|
||||
await run(async () => {
|
||||
const result = await jointApi.resume(p, original.validationTaskId, original.planFingerprint)
|
||||
if (scopeKey.value !== JSON.stringify([p, r])) return
|
||||
if (result.validationTaskId !== original.validationTaskId) throw new Error('恢复任务不符,请刷新核对。')
|
||||
await task.refresh()
|
||||
}, true)
|
||||
}
|
||||
/**
|
||||
* 只使用原签收公开的原图地址,不猜测图片路径。
|
||||
* @param image 精确计划中的图片
|
||||
* @returns 原签收对应的公开原件地址
|
||||
*/
|
||||
function imageUrl(image: JointPlan['imageManifest'][number]) {
|
||||
for (const binding of image.bindings) {
|
||||
const frame = props.review.diagnosis.frames.find(f => f.shotId === binding.shotId)
|
||||
const url =
|
||||
binding.role === 'frame'
|
||||
? frame?.imageUrl
|
||||
: frame?.layoutReferences?.find(r => r.imageId === binding.imageId)?.imageUrl
|
||||
if (url) return url
|
||||
}
|
||||
return null
|
||||
}
|
||||
/** 原抽屉固定底栏复用本表单的明确操作。 */
|
||||
defineExpose({ canAuthorize, canExecute, canResume, authorize, execute, resume })
|
||||
</script>
|
||||
<template>
|
||||
<!-- 以下是原有序组签收的联合审核计划、批准与原任务观察 -->
|
||||
<section class="flex flex-col items-stretch gap-4 text-sm">
|
||||
<h3 class="font-medium">联合视觉审核</h3>
|
||||
<p class="text-muted">单镜质量、人工签收与联合机器结论分别核对,免费计划不表示已通过。</p>
|
||||
<NButton class="self-start" :loading="pending" @click="preview">查看/刷新联合审核免费计划</NButton>
|
||||
<template v-if="plan">
|
||||
<p>
|
||||
{{
|
||||
{ ready: '可准备本次批准', blocked: '暂不能执行', reusable: '已有同计划任务,请查看原结果' }[
|
||||
plan.status
|
||||
]
|
||||
}}
|
||||
· 模型 {{ plan.model }}
|
||||
</p>
|
||||
<p>
|
||||
执行费用:{{
|
||||
plan.feeEstimate.amount === null
|
||||
? '未知,需另行明确估算范围'
|
||||
: `${plan.feeEstimate.amount} ${plan.feeEstimate.currency}`
|
||||
}}。本次预检调用 {{ plan.paidCalls }} 次;最多拟请求 {{ plan.proposedMaximumProviderRequests }} 次。
|
||||
</p>
|
||||
<p>
|
||||
型号及输入:{{ plan.capability.verified ? '已核验' : '未核验,禁止执行' }}。{{ plan.capability.reason }}
|
||||
</p>
|
||||
<div v-for="image in plan.imageManifest" :key="image.imageNumber" class="space-y-1">
|
||||
<AssetImage
|
||||
v-if="imageUrl(image)"
|
||||
class="max-w-sm aspect-square"
|
||||
:src="imageUrl(image)"
|
||||
:alt="`联合计划图片 ${image.imageNumber}`"
|
||||
object-fit="contain"
|
||||
preview
|
||||
/>
|
||||
<p>
|
||||
图片 {{ image.imageNumber }} · {{ image.label }} · {{ image.pixels.width }} ×
|
||||
{{ image.pixels.height }}
|
||||
</p>
|
||||
<p v-for="(binding, i) in image.bindings" :key="i">
|
||||
{{ binding.shotId }} ·
|
||||
{{ binding.role === 'frame' ? '镜头首帧' : '空间参考(不代表人物或道具状态)' }}
|
||||
</p>
|
||||
</div>
|
||||
<RawDataDetails title="高级详情:最终脱敏请求、图片摘要与全部绑定" :value="plan" />
|
||||
<template
|
||||
v-if="plan.status === 'ready' && plan.executionAvailable && plan.capability.verified && !uncertain"
|
||||
>
|
||||
<NInput
|
||||
v-model:value="approvedBy"
|
||||
placeholder="真实批准人"
|
||||
aria-label="联合批准人"
|
||||
:disabled="pending"
|
||||
/>
|
||||
<NInput v-model:value="operator" placeholder="真实操作人" aria-label="联合操作人" :disabled="pending" />
|
||||
<NInput
|
||||
v-model:value="approvalSha256"
|
||||
placeholder="真实批准材料 SHA256"
|
||||
aria-label="联合批准摘要"
|
||||
:disabled="pending"
|
||||
/>
|
||||
<NInputNumber
|
||||
v-model:value="estimatedMin"
|
||||
:min="0"
|
||||
placeholder="费用估算下限"
|
||||
aria-label="联合费用下限"
|
||||
:disabled="pending"
|
||||
/>
|
||||
<NInputNumber
|
||||
v-model:value="estimatedMax"
|
||||
:min="0"
|
||||
placeholder="费用估算上限"
|
||||
aria-label="联合费用上限"
|
||||
:disabled="pending"
|
||||
/>
|
||||
<p>估算范围不是实际账单或模型服务的硬金额上限。</p>
|
||||
<NCheckbox v-model:checked="approved" :disabled="pending"
|
||||
>我已核对本次模型、全部图片、范围与真实费用批准材料</NCheckbox
|
||||
>
|
||||
</template>
|
||||
</template>
|
||||
<p v-if="uncertain" class="text-muted">请求结果待核查,请只读刷新计划与原任务;不能重新批准或重发。</p>
|
||||
<template v-if="task.data.value">
|
||||
<p>
|
||||
联合任务:{{
|
||||
taskActive ? '审核中,等待原执行收口' : (continuityStatusLabels[task.data.value.status] ?? '待核查')
|
||||
}}
|
||||
· {{ task.data.value.current ? '来源当前' : '来源已失效' }}
|
||||
</p>
|
||||
<p>{{ task.data.value.summary }}</p>
|
||||
<p>人工原签收和非阻断未知保持原样,机器新观察不会自动覆盖。</p>
|
||||
<RawDataDetails
|
||||
title="原机器评估、解析观察与用量(独立追溯)"
|
||||
:value="{
|
||||
diagnosis: task.data.value.diagnosis,
|
||||
machineObservation: task.data.value.machineObservation,
|
||||
step: task.data.value.step,
|
||||
feeScope: task.data.value.feeScope
|
||||
}"
|
||||
/>
|
||||
<WorkflowExecutionPanel
|
||||
v-if="execution.query.data.value?.id === task.data.value.executionId"
|
||||
:execution="execution.query.data.value"
|
||||
result-is-historical
|
||||
:loading="execution.query.loading.value"
|
||||
:error="execution.query.error.value"
|
||||
@refresh="execution.query.refresh"
|
||||
/>
|
||||
<NButton :loading="task.loading.value" @click="task.refresh">只读刷新原联合任务</NButton>
|
||||
</template>
|
||||
<p v-if="task.error.value" class="text-muted">{{ task.error.value }}</p>
|
||||
<NCheckbox
|
||||
v-if="authorization || task.data.value?.resumeAvailable"
|
||||
v-model:checked="executeApproved"
|
||||
:disabled="pending"
|
||||
>{{
|
||||
authorization
|
||||
? '明确执行本次已批准的一次联合审核'
|
||||
: task.data.value?.requiresNewProviderRequest
|
||||
? '继续原批准且此前未发出的一次请求,可能收费'
|
||||
: '免费解析原回执,不新增模型请求'
|
||||
}}</NCheckbox
|
||||
>
|
||||
</section>
|
||||
</template>
|
||||
@@ -1,4 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import ContinuityStateEditor from './ContinuityStateEditor.vue'
|
||||
import ContinuityJointReview from './ContinuityJointReview.vue'
|
||||
import { validStateChecks, stateDimensions } from '../continuity-state'
|
||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||
import { NButton, NCollapse, NCollapseItem, NInput, NSelect, NSkeleton } from 'naive-ui'
|
||||
import { AssetImage } from '../../../components/ui'
|
||||
@@ -44,6 +47,12 @@ const open = defineModel<boolean>('open', { default: false })
|
||||
const emit = defineEmits<{ changed: [] }>()
|
||||
/** 用户明确选择的镜头。 */
|
||||
const selected = ref<string[]>([])
|
||||
/** 显式人工范围,默认固定几何。 */
|
||||
const scope = ref<'fixed_geometry' | 'geometry_and_state'>('fixed_geometry')
|
||||
/** 联合审核表单通过公共底栏操作。 */
|
||||
const jointRef = ref<InstanceType<typeof ContinuityJointReview> | null>(null)
|
||||
/** 联合批准和执行请求锁。 */
|
||||
const jointBusy = ref(false)
|
||||
/** 当前共同场景形态。 */
|
||||
const sceneFormId = ref('')
|
||||
/** 最新诊断及原始依据。 */
|
||||
@@ -86,7 +95,7 @@ const reviewId = ref('')
|
||||
/** 用户输入后再显式读取,避免输入时反复请求。 */
|
||||
const requestedReviewId = ref('')
|
||||
/** 当前审核提交锁。 */
|
||||
const busy = computed(() => saving.value || layoutSaving.value)
|
||||
const busy = computed(() => saving.value || layoutSaving.value || jointBusy.value)
|
||||
/** 正式镜头选择约束。 */
|
||||
const selectionValid = computed(() =>
|
||||
continuitySelectionValid(
|
||||
@@ -180,7 +189,7 @@ const canSave = computed(
|
||||
!diagnosing.value
|
||||
)
|
||||
/** 与来源和参数绑定的诊断身份。 */
|
||||
const target = computed(() => JSON.stringify([context.value, selected.value, sceneFormId.value]))
|
||||
const target = computed(() => JSON.stringify([context.value, selected.value, sceneFormId.value, scope.value]))
|
||||
/** 请求代次防止切范围、关闭或编辑期间回填旧结果。 */
|
||||
let generation = 0
|
||||
/** 免费诊断取消控制器。 */
|
||||
@@ -236,6 +245,7 @@ function selectShots(ids: string[]) {
|
||||
*/
|
||||
function blankObservation(result: ContinuityDiagnosis): ContinuityObservation {
|
||||
return {
|
||||
...(scope.value === 'geometry_and_state' ? { stateChecks: [] } : {}),
|
||||
expectedFingerprint: result.fingerprint!,
|
||||
landmarks: ['', ''],
|
||||
frames: result.frames.map(frame => ({
|
||||
@@ -262,7 +272,12 @@ async function diagnose(withObservation = false) {
|
||||
sources.error.value
|
||||
)
|
||||
return
|
||||
if (withObservation && !validObservation(observation.value, selected.value)) {
|
||||
if (
|
||||
withObservation &&
|
||||
(!validObservation(observation.value, selected.value) ||
|
||||
(scope.value === 'geometry_and_state' &&
|
||||
!validStateChecks(observation.value?.stateChecks ?? [], diagnosis.value?.stateContext ?? [])))
|
||||
) {
|
||||
showActionFeedback(message, '请填写两个不同地标、逐镜观察依据及固定结构位置或数量。', 'warning')
|
||||
return
|
||||
}
|
||||
@@ -274,6 +289,7 @@ async function diagnose(withObservation = false) {
|
||||
JSON.stringify({
|
||||
shotIds: [...selected.value],
|
||||
sceneFormId: sceneFormId.value,
|
||||
...(scope.value === 'geometry_and_state' ? { scope: scope.value } : {}),
|
||||
...(withObservation ? { observation: observation.value } : {})
|
||||
})
|
||||
)
|
||||
@@ -379,11 +395,21 @@ function updateFrame(index: number, value: GeometryFrameObservation) {
|
||||
<!-- 以下是同场景连续镜头的全屏诊断与持久化审核模块 -->
|
||||
<AppDrawer
|
||||
v-model:open="open"
|
||||
title="跨镜固定几何审核"
|
||||
description="免费对照相邻两到三镜的固定结构,审核不会自动修改主首帧。"
|
||||
title="跨镜连续性审核"
|
||||
description="免费核对相邻两到三镜的固定结构与所选人工状态,各范围独立签收,不自动修改主首帧。"
|
||||
:busy="busy"
|
||||
>
|
||||
<div class="space-y-6">
|
||||
<!-- 以下是独立签收范围选择,切换后重新读取指纹 -->
|
||||
<NSelect
|
||||
v-model:value="scope"
|
||||
:disabled="busy || diagnosing"
|
||||
:options="[
|
||||
{ label: '固定几何(默认)', value: 'fixed_geometry' },
|
||||
{ label: '几何与状态(人工)', value: 'geometry_and_state' }
|
||||
]"
|
||||
aria-label="连续性签收范围"
|
||||
/>
|
||||
<section class="space-y-3">
|
||||
<WorkspaceSectionHeading
|
||||
title="选择审核范围"
|
||||
@@ -597,6 +623,12 @@ function updateFrame(index: number, value: GeometryFrameObservation) {
|
||||
/>
|
||||
</article>
|
||||
</div>
|
||||
<ContinuityStateEditor
|
||||
v-if="scope === 'geometry_and_state' && diagnosis?.stateContext && observation.stateChecks"
|
||||
v-model="observation.stateChecks"
|
||||
:contexts="diagnosis.stateContext"
|
||||
:disabled="busy || diagnosing"
|
||||
/>
|
||||
<NButton :loading="diagnosing" :disabled="busy" @click="diagnose(true)">免费诊断人工观察</NButton>
|
||||
</section>
|
||||
<!-- 以下是最新诊断结论及正式审核保存模块 -->
|
||||
@@ -608,6 +640,16 @@ function updateFrame(index: number, value: GeometryFrameObservation) {
|
||||
<p v-for="(item, index) in diagnosis.nonBlockingUnknowns" :key="'unknown-' + index">
|
||||
保留非阻断未知:{{ item.featureKey }} · {{ item.evidence }}(未核实通过)
|
||||
</p>
|
||||
<p v-for="(check, index) in diagnosis.stateChecks" :key="'state-' + index">
|
||||
{{ check.subjectRef }} · {{ stateDimensions[check.dimension] }}:{{ check.before ?? '未知' }} →
|
||||
{{ check.after ?? '未知' }} ·
|
||||
{{
|
||||
check.status === 'non_blocking_unknown'
|
||||
? '非阻断未知(仍未核实)'
|
||||
: continuityStatusLabels[check.status]
|
||||
}}
|
||||
· {{ check.evidence }}
|
||||
</p>
|
||||
<p v-if="!diagnosis.issues.length">本次提交的固定结构观察未发现冲突。</p>
|
||||
<NInput
|
||||
v-if="diagnosis.observation"
|
||||
@@ -677,6 +719,17 @@ function updateFrame(index: number, value: GeometryFrameObservation) {
|
||||
>
|
||||
</article>
|
||||
</section>
|
||||
<!-- 以下是已存有序组的联合审核计划与单次批准 -->
|
||||
<ContinuityJointReview
|
||||
ref="jointRef"
|
||||
v-if="reviewQuery.data.value && context"
|
||||
:key="reviewKey"
|
||||
:project-id="projectId"
|
||||
:review="reviewQuery.data.value"
|
||||
:disabled="disabled || saving || layoutSaving"
|
||||
@busy="jointBusy = $event"
|
||||
@changed="emit('changed')"
|
||||
/>
|
||||
<!-- 以下是布局补充与正式确认模块,确认后回读来源但不生成素材 -->
|
||||
<LayoutSupplementPanel
|
||||
ref="layoutPanelRef"
|
||||
@@ -693,6 +746,15 @@ function updateFrame(index: number, value: GeometryFrameObservation) {
|
||||
</div>
|
||||
<template #footer>
|
||||
<NButton :disabled="busy" @click="open = false">关闭</NButton>
|
||||
<NButton v-if="jointRef?.canAuthorize" type="primary" :disabled="busy" @click="jointRef.authorize"
|
||||
>登记联合审核费用批准</NButton
|
||||
>
|
||||
<NButton v-if="jointRef?.canExecute" type="primary" :disabled="busy" @click="jointRef.execute"
|
||||
>执行本次联合审核</NButton
|
||||
>
|
||||
<NButton v-if="jointRef?.canResume" type="primary" :disabled="busy" @click="jointRef.resume"
|
||||
>明确恢复原联合任务</NButton
|
||||
>
|
||||
<NButton
|
||||
v-if="diagnosis?.observation"
|
||||
type="primary"
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { NButton, NInput, NSelect } from 'naive-ui'
|
||||
import RawDataDetails from '../../../components/ui/RawDataDetails.vue'
|
||||
import { stateDimensions, type StateCheck, type StateContext } from '../continuity-state'
|
||||
/** 正式有序组与操作锁。 */
|
||||
const props = defineProps<{ /** 正式上下文。 */ contexts: StateContext[]; /** 操作锁。 */ disabled: boolean }>()
|
||||
/** 人工逐项观察,不预设通过。 */
|
||||
const checks = defineModel<StateCheck[]>({ required: true })
|
||||
/** 只列正式紧邻边界。 */
|
||||
const boundaries = computed(() =>
|
||||
props.contexts.slice(0, -1).map((c, i) => ({ label: `第 ${i + 1} 镜 → 第 ${i + 2} 镜`, value: c.shotId }))
|
||||
)
|
||||
/** 可观察维度。 */
|
||||
const dimensions = Object.entries(stateDimensions).map(([value, label]) => ({ label, value }))
|
||||
/** 意见须明确选择。 */
|
||||
const verdicts = [
|
||||
{ label: '一致或变化有据', value: 'consistent' },
|
||||
{ label: '存在冲突', value: 'conflict' },
|
||||
{ label: '未知/无法辨认', value: 'unknown' }
|
||||
]
|
||||
/**
|
||||
* 当前边界的正式依据。
|
||||
* @param check 人工项
|
||||
* @returns 两镜原始依据
|
||||
*/
|
||||
function sources(check: StateCheck) {
|
||||
return props.contexts.filter(c => [check.fromShotId, check.toShotId].includes(c.shotId)).flatMap(c => c.sources)
|
||||
}
|
||||
/** 添加空白项,主体、维度与意见由审核人选择。 */
|
||||
function add() {
|
||||
checks.value.push({
|
||||
fromShotId: '',
|
||||
toShotId: '',
|
||||
subjectRef: '',
|
||||
dimension: 'position',
|
||||
before: null,
|
||||
after: null,
|
||||
verdict: null,
|
||||
sourceIds: [],
|
||||
evidence: ''
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 切换边界时清空旧主体和依据。
|
||||
* @param check 人工项
|
||||
* @param value 正式前镜编号
|
||||
*/
|
||||
function boundary(check: StateCheck, value: string) {
|
||||
check.fromShotId = value
|
||||
check.toShotId = props.contexts[props.contexts.findIndex(c => c.shotId === value) + 1]?.shotId ?? ''
|
||||
check.subjectRef = ''
|
||||
check.sourceIds = []
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<!-- 以下是正式状态上下文及有界人工签收模块 -->
|
||||
<section class="space-y-4 text-sm">
|
||||
<h3 class="font-medium">几何与状态(人工)</h3>
|
||||
<p class="text-muted">
|
||||
逐项核对原图和正式依据。无法辨认留空;出画不等于主体消失。交接或开关变化须有前镜实际动作及后镜本主体状态支持,不能只凭勾选依据判为一致。
|
||||
</p>
|
||||
<RawDataDetails
|
||||
v-for="(context, i) in contexts"
|
||||
:key="context.shotId"
|
||||
:title="`第 ${i + 1} 镜正式状态与动作`"
|
||||
:value="context"
|
||||
/>
|
||||
<section v-for="(check, index) in checks" :key="index" class="space-y-3 bg-(--app-subtle) p-4">
|
||||
<NSelect
|
||||
:value="check.fromShotId || null"
|
||||
:options="boundaries"
|
||||
:disabled="disabled"
|
||||
placeholder="选择相邻镜头"
|
||||
aria-label="状态边界"
|
||||
@update:value="boundary(check, $event)"
|
||||
/>
|
||||
<NSelect
|
||||
v-model:value="check.subjectRef"
|
||||
:options="
|
||||
[
|
||||
...new Set(
|
||||
sources(check)
|
||||
.map(s => s.subjectRef)
|
||||
.filter((s): s is string => !!s)
|
||||
)
|
||||
].map(value => ({ label: value, value }))
|
||||
"
|
||||
:disabled="disabled"
|
||||
placeholder="选择正式主体"
|
||||
aria-label="状态主体"
|
||||
/>
|
||||
<NSelect v-model:value="check.dimension" :options="dimensions" :disabled="disabled" aria-label="状态维度" />
|
||||
<NInput
|
||||
v-model:value="check.before"
|
||||
:disabled="disabled"
|
||||
:maxlength="500"
|
||||
placeholder="前镜观察值,不可辨认留空"
|
||||
aria-label="前镜观察"
|
||||
@update:value="check.before = $event?.trim() ? $event : null"
|
||||
/>
|
||||
<NInput
|
||||
v-model:value="check.after"
|
||||
:disabled="disabled"
|
||||
:maxlength="500"
|
||||
placeholder="后镜观察值,不可辨认留空"
|
||||
aria-label="后镜观察"
|
||||
@update:value="check.after = $event?.trim() ? $event : null"
|
||||
/>
|
||||
<NSelect
|
||||
v-model:value="check.verdict"
|
||||
:options="verdicts"
|
||||
:disabled="disabled"
|
||||
placeholder="明确选择人工意见"
|
||||
aria-label="人工状态意见"
|
||||
/>
|
||||
<NSelect
|
||||
v-model:value="check.sourceIds"
|
||||
multiple
|
||||
:options="
|
||||
sources(check).map(s => ({
|
||||
value: s.id,
|
||||
label: `${s.shotId === check.fromShotId ? '前镜' : '后镜'} · ${s.subjectRef ?? '镜头'} · ${s.field} · ${s.text}${s.executable ? '(本镜实际执行)' : ''}`
|
||||
}))
|
||||
"
|
||||
:disabled="disabled"
|
||||
placeholder="选择原始正式依据"
|
||||
aria-label="正式状态依据"
|
||||
/>
|
||||
<NInput
|
||||
v-model:value="check.evidence"
|
||||
type="textarea"
|
||||
:maxlength="1000"
|
||||
:disabled="disabled"
|
||||
placeholder="说明像素观察如何与正式依据对应"
|
||||
aria-label="状态证据说明"
|
||||
/>
|
||||
<NInput
|
||||
:value="check.nonBlockingReason"
|
||||
:maxlength="500"
|
||||
:disabled="disabled"
|
||||
placeholder="非阻断未知的用途理由(可选,不豁免明确冲突)"
|
||||
aria-label="非阻断用途理由"
|
||||
@update:value="check.nonBlockingReason = $event.trim() || undefined"
|
||||
/>
|
||||
<NButton :disabled="disabled" @click="checks.splice(index, 1)">删除此项观察</NButton>
|
||||
</section>
|
||||
<NButton :disabled="disabled || checks.length >= 128" @click="add">添加状态观察</NButton>
|
||||
</section>
|
||||
</template>
|
||||
@@ -178,13 +178,11 @@ const canSelect = computed(
|
||||
</p>
|
||||
<IssueHint v-if="item.error" :messages="[productionMessage(item.error)]" type="error" />
|
||||
<!-- 以下是来源记录与独立的免费恢复入口 -->
|
||||
<NButton
|
||||
v-if="item.isPrimary && item.status === 'completed' && projectId"
|
||||
class="workspace-action-button mt-2"
|
||||
size="small"
|
||||
@click="sourceReviewOpen = true"
|
||||
>按当前来源人工复核</NButton
|
||||
>
|
||||
<div v-if="item.isPrimary && item.status === 'completed' && projectId" class="mt-4 mb-3">
|
||||
<NButton class="workspace-action-button" size="small" @click="sourceReviewOpen = true"
|
||||
>按当前来源人工复核</NButton
|
||||
>
|
||||
</div>
|
||||
<p v-if="item.inputSnapshotStatus" class="mt-2 text-xs text-muted">
|
||||
{{
|
||||
{ recorded: '已保存生成输入', 'not-recorded': '历史生成输入未记录', invalid: '生成输入证据已失效' }[
|
||||
@@ -215,8 +213,13 @@ const canSelect = computed(
|
||||
>恢复已生成图片</NButton
|
||||
>
|
||||
<p class="mt-2 text-[10px] text-muted">{{ formatDate(item.createdAt) }}</p>
|
||||
<div v-if="item.status === 'completed' && item.imageUrl" class="mt-2 flex flex-wrap items-center gap-3">
|
||||
<NButton v-if="!wrongCanvas && !stale" text size="small" @click="emit('quality')">
|
||||
<div v-if="item.status === 'completed' && item.imageUrl" class="mt-4 flex flex-wrap items-center gap-2">
|
||||
<NButton
|
||||
v-if="!wrongCanvas && !stale"
|
||||
class="workspace-action-button"
|
||||
size="small"
|
||||
@click="emit('quality')"
|
||||
>
|
||||
{{
|
||||
vision.state.value.active || vision.state.value.unknown || vision.uncertain.value
|
||||
? '查看审核进度'
|
||||
@@ -225,14 +228,18 @@ const canSelect = computed(
|
||||
</NButton>
|
||||
<NButton
|
||||
v-if="item.source !== 'provider_variant' && !wrongCanvas && !stale"
|
||||
text
|
||||
class="workspace-action-button"
|
||||
size="small"
|
||||
:disabled="blocked"
|
||||
:loading="editing"
|
||||
@click="emit('edit')"
|
||||
>编辑此首帧</NButton
|
||||
>
|
||||
<NButton v-if="item.status === 'completed'" text size="small" @click="emit('history')"
|
||||
<NButton
|
||||
v-if="item.status === 'completed'"
|
||||
class="workspace-action-button"
|
||||
size="small"
|
||||
@click="emit('history')"
|
||||
>查看首帧校验历史</NButton
|
||||
>
|
||||
<NButton v-if="canSelect" :disabled="blocked" text size="small" @click="emit('select')">
|
||||
|
||||
@@ -362,14 +362,11 @@ const optionsExpanded = ref<string[]>(['options'])
|
||||
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
|
||||
>
|
||||
<div v-if="visionKey" class="py-4">
|
||||
<NButton :loading="validationPlan.loading.value" :disabled="pending" @click="validationPlan.refresh"
|
||||
>刷新免费审核计划</NButton
|
||||
>
|
||||
</div>
|
||||
<p v-if="validationPlan.error.value" class="mt-2 text-sm text-muted">
|
||||
{{ userFacingText(validationPlan.error.value) }}
|
||||
</p>
|
||||
@@ -545,6 +542,7 @@ const optionsExpanded = ref<string[]>(['options'])
|
||||
:keyframe-id="target.assetId"
|
||||
:observation="vision"
|
||||
:disabled="disabled || pending"
|
||||
class="mt-5"
|
||||
initial-open
|
||||
@reviewed="onReviewed"
|
||||
@busy="authorizationPending = $event"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { RouterLink } from 'vue-router'
|
||||
import { videoOperationAllowed } from '../video-permissions'
|
||||
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
|
||||
|
||||
@@ -682,6 +683,19 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
</ContextNotice>
|
||||
|
||||
<!-- 以下是项目制作中的视频提示词模块 -->
|
||||
<!-- 以下是连续性门禁的原审核处理入口 -->
|
||||
<RouterLink
|
||||
v-if="
|
||||
[
|
||||
...(keyframeReadiness?.issues ?? []),
|
||||
...(promptReadiness?.issues ?? []),
|
||||
...(videoReadiness?.issues ?? [])
|
||||
].some(issue => issue.code === 'continuity_review_required')
|
||||
"
|
||||
class="workspace-action-button"
|
||||
:to="`/projects/${projectId}/storyboard?action=continuity`"
|
||||
>复核连续性有序组</RouterLink
|
||||
>
|
||||
<div v-if="!keyframeOnly" class="production-stage">
|
||||
<div class="production-stage-heading">
|
||||
<div>
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
import { request } from '../../lib/http'
|
||||
/** 一次明确批准的估算费用,不是账单或硬上限。 */
|
||||
export interface JointApproval {
|
||||
/** 精确用途及计划。 */ plan: {
|
||||
/** 固定用途。 */ purpose: 'continuity'
|
||||
/** 原签收。 */ reviewId: string
|
||||
/** 总计划摘要。 */ fingerprint: string
|
||||
}
|
||||
/** 批准人。 */ approvedBy: string
|
||||
/** 操作人。 */ operator: string
|
||||
/** 真实批准材料。 */ approvalSha256: string
|
||||
/** 原批准费用范围。 */ feeScope: {
|
||||
/** 币种。 */ currency: 'CNY'
|
||||
/** 最低估算。 */ estimatedMin: number
|
||||
/** 最高估算。 */ estimatedMax: number
|
||||
/** 请求次数。 */ maxRequests: 1
|
||||
}
|
||||
}
|
||||
/** 联合审核精确免费计划,不能替代单镜或人工签收。 */
|
||||
export interface JointPlan {
|
||||
/** 项目。 */ projectId: string
|
||||
/** 原签收。 */ reviewId: string
|
||||
/** 总计划摘要。 */ fingerprint: string
|
||||
/** 实际模型。 */ model: string
|
||||
/** 当前可执行状态。 */ status: 'ready' | 'blocked' | 'reusable'
|
||||
/** 仅模型输入核验通过。 */ executionAvailable: boolean
|
||||
/** 仍须逐次批准。 */ requiresExplicitApproval: boolean
|
||||
/** 本次免费请求的计费数。 */ paidCalls: number
|
||||
/** 最大拟请求次数。 */ proposedMaximumProviderRequests: number
|
||||
/** 新请求数。 */ additionalProviderRequests: number
|
||||
/** 费用估算。 */ feeEstimate: {
|
||||
/** 金额未知不是零元。 */ amount: number | null
|
||||
/** 原因。 */ reason: string
|
||||
/** 币种。 */ currency: string
|
||||
}
|
||||
/** 型号及输入核验。 */ capability: {
|
||||
/** 是否核验。 */ verified: boolean
|
||||
/** 说明。 */ reason: string
|
||||
/** 检查时间。 */ checkedAt?: string
|
||||
/** 容量。 */ requestBodyUpperBound?: number
|
||||
/** 文档。 */ documentation?: unknown
|
||||
}
|
||||
/** 刷新恢复用原任务。 */ latestTask: {
|
||||
/** 任务。 */ validationTaskId: string
|
||||
/** 原执行。 */ executionId: string | null
|
||||
/** 状态。 */ taskStatus: string
|
||||
} | null
|
||||
/** 可复用任务。 */ reusableTaskId: string | null
|
||||
/** 原始图片顺序与全部绑定。 */ imageManifest: Array<{
|
||||
/** 图号。 */ imageNumber: number
|
||||
/** 用途。 */ label: string
|
||||
/** 像素证据。 */ pixels: {
|
||||
/** 摘要。 */ sha256: string
|
||||
/** 宽。 */ width: number
|
||||
/** 高。 */ height: number
|
||||
}
|
||||
/** 全部绑定。 */ bindings: Array<{
|
||||
/** 镜头。 */ shotId: string
|
||||
/** 图像。 */ imageId: string
|
||||
/** 职责。 */ role: 'frame' | 'spatial_reference'
|
||||
/** 布局编号。 */ spatialLayoutId?: string
|
||||
/** 布局版本。 */ spatialLayoutVersion?: string
|
||||
}>
|
||||
}>
|
||||
/** 最终脱敏输入,原样追溯。 */ request: Record<string, unknown>
|
||||
/** 限制说明。 */ limitation?: string
|
||||
}
|
||||
/** 持久化联合任务,执行完成与业务通过独立。 */
|
||||
export interface JointTask {
|
||||
/** 任务。 */ validationTaskId: string
|
||||
/** 所属签收。 */ reviewId: string
|
||||
/** 原执行。 */ executionId: string
|
||||
/** 任务状态。 */ taskStatus: string
|
||||
/** 执行状态。 */ workflowStatus: string
|
||||
/** 当前业务结论。 */ status: string
|
||||
/** 来源当前性。 */ current: boolean
|
||||
/** 原计划。 */ planFingerprint: string
|
||||
/** 可显式恢复。 */ resumeAvailable: boolean
|
||||
/** 是否会发送此前未发请求。 */ requiresNewProviderRequest: boolean
|
||||
/** 固定禁止自动重试。 */ retryAutomatically: false
|
||||
/** 原机器业务评估。 */ diagnosis: unknown
|
||||
/** 机器原解析,不能冒充当前事实。 */ machineObservation: unknown
|
||||
/** 范围摘要。 */ summary: string | null
|
||||
/** 估算费用,非账单。 */ feeScope: JointApproval['feeScope']
|
||||
/** 步骤及用量。 */ step: unknown
|
||||
}
|
||||
/**
|
||||
* 联合审核原范围路径。
|
||||
* @param p 项目
|
||||
* @returns 项目下的连续性路径
|
||||
*/
|
||||
function root(p: string) {
|
||||
return `/projects/${encodeURIComponent(p)}/storyboard-keyframes/continuity`
|
||||
}
|
||||
/** 仅用户主动触发批准、执行和恢复;无重试中间层。 */
|
||||
export const jointApi = {
|
||||
/**
|
||||
* 免费精确预检。
|
||||
* @param p 项目
|
||||
* @param r 原签收
|
||||
* @param expected 已读计划
|
||||
* @param signal 取消信号
|
||||
* @returns 精确计划
|
||||
*/
|
||||
preview: (p: string, r: string, expected?: string, signal?: AbortSignal) =>
|
||||
request<JointPlan>(
|
||||
`${root(p)}/reviews/${encodeURIComponent(r)}/vision/preview${expected ? '?expectedFingerprint=' + encodeURIComponent(expected) : ''}`,
|
||||
{ signal, timeoutMs: 0 }
|
||||
),
|
||||
/**
|
||||
* 读取原任务。
|
||||
* @param p 项目
|
||||
* @param t 任务
|
||||
* @param signal 取消信号
|
||||
* @returns 原任务结果
|
||||
*/
|
||||
task: (p: string, t: string, signal?: AbortSignal) =>
|
||||
request<JointTask>(`${root(p)}/vision-tasks/${encodeURIComponent(t)}`, { signal }),
|
||||
/**
|
||||
* 独立登记批准,不执行。
|
||||
* @param p 项目
|
||||
* @param r 原签收
|
||||
* @param body 真实批准
|
||||
* @returns 本次批准编号
|
||||
*/
|
||||
authorize: (p: string, r: string, body: JointApproval) =>
|
||||
request<{ authorizationId: string; planFingerprint: string }>(
|
||||
`${root(p)}/reviews/${encodeURIComponent(r)}/vision/authorizations`,
|
||||
{ method: 'POST', body }
|
||||
),
|
||||
/**
|
||||
* 单次显式执行。
|
||||
* @param p 项目
|
||||
* @param r 原签收
|
||||
* @param authorizationId 本次批准
|
||||
* @returns 原任务句柄
|
||||
*/
|
||||
execute: (p: string, r: string, authorizationId: string) =>
|
||||
request<{ validationTaskId: string; executionId: string; status: string; reused: boolean }>(
|
||||
`${root(p)}/reviews/${encodeURIComponent(r)}/vision`,
|
||||
{ method: 'POST', body: { authorizationId } }
|
||||
),
|
||||
/**
|
||||
* 显式恢复原任务。
|
||||
* @param p 项目
|
||||
* @param t 原任务
|
||||
* @param expectedFingerprint 原任务精确计划
|
||||
* @returns 原任务句柄
|
||||
*/
|
||||
resume: (p: string, t: string, expectedFingerprint: string) =>
|
||||
request<{ validationTaskId: string; executionId: string }>(
|
||||
`${root(p)}/vision-tasks/${encodeURIComponent(t)}/resume`,
|
||||
{ method: 'POST', body: { expectedFingerprint } }
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/** 人工签收的具体维度,不能扩大为所有连续性通过。 */
|
||||
export const stateDimensions = {
|
||||
identity: '身份',
|
||||
position: '位置',
|
||||
pose: '姿态',
|
||||
gaze: '视线',
|
||||
holder: '持有者',
|
||||
prop_position: '道具位置',
|
||||
openness: '开关状态',
|
||||
visibility: '出入画',
|
||||
camera: '机位',
|
||||
count: '数量',
|
||||
structure: '结构',
|
||||
topology: '连接关系',
|
||||
action: '动作'
|
||||
} as const
|
||||
/** 服务提供的正式状态上下文。 */
|
||||
export interface StateContext {
|
||||
/** 正式镜头。 */ shotId: string
|
||||
/** 正式编译事实。 */ generation: Record<string, unknown>
|
||||
/** 正式动作。 */ requiredActions?: Array<{
|
||||
/** 编号。 */ id: string
|
||||
/** 原文。 */ description: string
|
||||
/** 类型。 */ kind: string
|
||||
/** 是否本镜执行。 */ mustPerformInShot: boolean
|
||||
}>
|
||||
/** 可选择的正式依据。 */ sources: Array<{
|
||||
/** 原编号。 */ id: string
|
||||
/** 所属镜头。 */ shotId: string
|
||||
/** 类型。 */ kind: string
|
||||
/** 主体。 */ subjectRef: string | null
|
||||
/** 字段。 */ field: string
|
||||
/** 原文。 */ text: string
|
||||
/** 是否执行动作。 */ executable: boolean
|
||||
}>
|
||||
}
|
||||
/** 用户有界人工观察,空值表示不可辨认。 */
|
||||
export interface StateCheck {
|
||||
/** 前镜。 */ fromShotId: string
|
||||
/** 后镜。 */ toShotId: string
|
||||
/** 正式主体。 */ subjectRef: string
|
||||
/** 所选维度。 */ dimension: keyof typeof stateDimensions
|
||||
/** 前镜观察。 */ before: string | null
|
||||
/** 后镜观察。 */ after: string | null
|
||||
/** 人工意见,未选时为空。 */ verdict: 'consistent' | 'conflict' | 'unknown' | null
|
||||
/** 正式依据。 */ sourceIds: string[]
|
||||
/** 像素与依据的对应解释。 */ evidence: string
|
||||
/** 可选非阻断理由。 */ nonBlockingReason?: string
|
||||
}
|
||||
/**
|
||||
* 只检查输入完整性和正式归属,业务结论由服务端决定。
|
||||
* @param checks 用户观察
|
||||
* @param contexts 正式上下文
|
||||
* @returns 是否可提交免费诊断
|
||||
*/
|
||||
export function validStateChecks(checks: StateCheck[], contexts: StateContext[]) {
|
||||
const keys = checks.map(c => JSON.stringify([c.fromShotId, c.toShotId, c.subjectRef, c.dimension]))
|
||||
return (
|
||||
checks.length > 0 &&
|
||||
checks.length <= 128 &&
|
||||
new Set(keys).size === checks.length &&
|
||||
checks.every(c => {
|
||||
const index = contexts.findIndex(x => x.shotId === c.fromShotId)
|
||||
const pair = contexts.slice(index, index + 2)
|
||||
const sources = pair.flatMap(x => x.sources)
|
||||
return (
|
||||
index >= 0 &&
|
||||
contexts[index + 1]?.shotId === c.toShotId &&
|
||||
sources.some(s => s.subjectRef === c.subjectRef) &&
|
||||
c.dimension in stateDimensions &&
|
||||
!!c.verdict &&
|
||||
!!c.evidence.trim() &&
|
||||
c.evidence.length <= 1000 &&
|
||||
c.sourceIds.length <= 20 &&
|
||||
new Set(c.sourceIds).size === c.sourceIds.length &&
|
||||
c.sourceIds.every(id => sources.some(s => s.id === id)) &&
|
||||
[c.before, c.after].every(
|
||||
v =>
|
||||
v === null ||
|
||||
(!!v.trim() && v.length <= 500 && (c.dimension !== 'count' || /^(0|[1-9]\d*)$/.test(v)))
|
||||
)
|
||||
)
|
||||
})
|
||||
)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { StateCheck, StateContext } from './continuity-state'
|
||||
import type { SpatialLayoutConstraint } from './layout-api'
|
||||
import type { ShotDirection } from '../storyboard/types'
|
||||
|
||||
@@ -20,12 +21,14 @@ export interface GeometryFrameObservation {
|
||||
}
|
||||
/** 绑定本次正式图组指纹的人工观察。 */
|
||||
export interface ContinuityObservation {
|
||||
/** 显式人工状态范围。 */ stateChecks?: StateCheck[]
|
||||
/** 最近一次诊断证据指纹。 */ expectedFingerprint: string
|
||||
/** 两个不同的稳定地标。 */ landmarks: [string, string]
|
||||
/** 按正式镜头顺序逐镜观察。 */ frames: GeometryFrameObservation[]
|
||||
}
|
||||
/** 同一场景形态下的相邻两到三镜请求。 */
|
||||
export interface ContinuityInput {
|
||||
/** 省略保持原固定几何范围。 */ scope?: 'geometry_and_state'
|
||||
/** 正式顺序的镜头编号。 */ shotIds: string[]
|
||||
/** 正式场景形态编号。 */ sceneFormId: string
|
||||
/** 第二次诊断时提交,不自动生成。 */ observation?: ContinuityObservation
|
||||
@@ -71,6 +74,10 @@ export interface ContinuityFrame {
|
||||
}
|
||||
/** 免费诊断结果,不修改单镜质量和 Primary。 */
|
||||
export interface ContinuityDiagnosis {
|
||||
/** 正式状态依据。 */ stateContext?: StateContext[]
|
||||
/** 人工逐项结果。 */ stateChecks?: Array<StateCheck & { /** 当前业务结论。 */ status: string }>
|
||||
/** 本次签收范围。 */ scope?: string
|
||||
/** 审阅方法。 */ reviewMethod?: string
|
||||
/** 项目归属。 */ projectId: string
|
||||
/** 场景形态范围。 */ sceneFormId: string
|
||||
/** 当前图组。 */ frames: ContinuityFrame[]
|
||||
|
||||
@@ -62,6 +62,7 @@ export function isActiveVideo(item: ShotVideo): boolean {
|
||||
*/
|
||||
export function issueLabel(code: ProductionIssueCode): string {
|
||||
const labels: Record<ProductionIssueCode, string> = {
|
||||
continuity_review_required: '连续性审核尚未解决',
|
||||
invalid_generation_spec: '生成规格不完整',
|
||||
missing_visual_style: '缺少视觉风格',
|
||||
missing_reference: '缺少主体参考图',
|
||||
|
||||
@@ -46,6 +46,9 @@ export function productionMessage(message: string): string {
|
||||
* @returns 页面展示的原因与处理建议
|
||||
*/
|
||||
export function productionIssueText(issue: ProductionIssue): string {
|
||||
if (issue.code === 'failed_keyframe_quality') return '首帧画面检查未通过,请重新生成或修复首帧。'
|
||||
if (issue.code === 'continuity_review_required')
|
||||
return productionMessage(issue.reason) || '连续性审核尚未解决,请复核对应有序组。'
|
||||
if (issue.code === 'failed_keyframe_quality')
|
||||
return productionMessage(issue.reason) || '首帧当前质量尚未满足要求,请核对审核状态。'
|
||||
return productionMessage(issue.reason) || issueLabel(issue.code)
|
||||
}
|
||||
@@ -6,6 +6,8 @@ export type ProductionReadinessStatus = 'ready' | 'skipped' | 'in_progress' | 'b
|
||||
|
||||
/** 三个阶段可能返回的正式问题代码。 */
|
||||
export type ProductionIssueCode =
|
||||
/** 已存有序组连续性尚未解决。 */
|
||||
| 'continuity_review_required'
|
||||
| 'invalid_generation_spec'
|
||||
| 'missing_visual_style'
|
||||
| 'missing_reference'
|
||||
|
||||
@@ -434,6 +434,11 @@ onScopeDispose(() => {
|
||||
@click="router.push(`/projects/${id}/${currentAccess.nextPath}`)"
|
||||
>{{ currentAccess.nextLabel || '前往上一步' }}</NButton
|
||||
>
|
||||
<NButton
|
||||
v-if="currentAccess?.reason.includes('连续性') && stageAccess.sections.value.storyboard.enabled"
|
||||
@click="router.push(`/projects/${id}/storyboard?action=continuity`)"
|
||||
>复核连续性有序组</NButton
|
||||
>
|
||||
<!-- 以下是手动刷新项目状态模块,图标位常驻以保持加载前后的按钮尺寸 -->
|
||||
<WorkspaceRefreshButton
|
||||
v-if="currentAccess"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { inject } from 'vue'
|
||||
import { routeLocationKey } from 'vue-router'
|
||||
import ContinuityReviewDrawer from '../production/components/ContinuityReviewDrawer.vue'
|
||||
import WorkspaceActionTooltip from '../../components/ui/WorkspaceActionTooltip.vue'
|
||||
import { ScanEye } from '@lucide/vue'
|
||||
@@ -44,6 +46,15 @@ import type { ProjectDurationBudgetSummary } from '../projects/types'
|
||||
const detailTab = ref('design')
|
||||
/** 即使生产入口受来源门禁限制,也可免费核对连续性。 */
|
||||
const continuityOpen = ref(false)
|
||||
/** 连续性阻断入口只打开原审核界面,不自动诊断或签收。 */
|
||||
const continuityRoute = inject(routeLocationKey, undefined)
|
||||
watch(
|
||||
() => continuityRoute?.query.action,
|
||||
action => {
|
||||
if (action === 'continuity') continuityOpen.value = true
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
/** 动作审计只能定位当前项目正式列表中的镜头。 */
|
||||
const feedback = useActionMessage()
|
||||
/**
|
||||
|
||||
@@ -121,6 +121,16 @@ export function errorMessage(error: unknown): string {
|
||||
const configurationMessage =
|
||||
configurationErrorText(error.code) ??
|
||||
configurationErrorText(isRecord(error.details) ? error.details.code : undefined)
|
||||
/** 连续性阻断保留服务端有序组原因,不能只显示通用错误。 */
|
||||
const continuityCode =
|
||||
error.code ?? (isRecord(error.details) ? error.details.code : undefined) ?? error.message.split(':')[0]
|
||||
if (continuityCode === 'CONTINUITY_REVIEW_REQUIRED')
|
||||
return [
|
||||
...new Set([
|
||||
configurationMessage || '连续性审核尚未解决,请复核对应有序组。',
|
||||
...businessErrorMessages(error.details)
|
||||
])
|
||||
].join(';')
|
||||
if (configurationMessage) return configurationMessage
|
||||
return (
|
||||
[
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
/** 项目配置的确定性业务状态说明,不将配置限制显示为系统故障。 */
|
||||
const configurationErrorLabels: Record<string, string> = {
|
||||
CONTINUITY_REVIEW_REQUIRED: '当前有序组的连续性审核尚未解决,请进入连续性审核核对。',
|
||||
CONTINUITY_VISION_PLAN_STALE: '联合审核计划已变化,请重新免费预检并审阅。',
|
||||
CONTINUITY_VISION_SOURCE_STALE: '组签收或正式来源已变化,请重新核对原组。',
|
||||
CONTINUITY_VISION_PIXELS_CHANGED: '实际图片证据已变化,请重新核对。',
|
||||
CONTINUITY_VISION_CAPABILITY_UNVERIFIED: '当前型号或输入尚未核验,暂不能执行联合审核。',
|
||||
CONTINUITY_VISION_AUTHORIZATION_REQUIRED: '请先明确登记本次联合审核的费用批准。',
|
||||
CONTINUITY_VISION_AUTHORIZATION_INVALID: '本次批准已失效或范围不符,请先核查原任务。',
|
||||
CONTINUITY_VISION_AUTHORIZATION_CONSUMED: '本次批准已消费,请查看原任务,勿重复执行。',
|
||||
CONTINUITY_VISION_RECOVERY_REQUIRED: '原任务或费用待核查,请只读刷新,不要重发。',
|
||||
CONTINUITY_VISION_EXECUTION_CHANGED: '原执行已变化,请刷新核对。',
|
||||
CONTINUITY_VISION_EVIDENCE_INVALID: '联合证据需要复核,不能作为通过结论。',
|
||||
CONTINUITY_VISION_COVERAGE_INVALID: '联合审核覆盖不完整,请核对原任务。',
|
||||
SUBJECT_STATE_REVISION_STALE: '正式视线或来源已变化,请重新读取原值并确认差异。',
|
||||
SUBJECT_STATE_REVISION_SCOPE: '此次修改超出视线范围,请从当前正式状态重新填写。',
|
||||
SUBJECT_STATE_REVISION_ACTIVE: '此镜头仍有任务进行中,请等待结束后再采用视线修订。',
|
||||
|
||||
@@ -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="./v02-continuity.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,91 @@
|
||||
import { createApp, defineComponent, h, ref } from 'vue'
|
||||
import { NButton, NConfigProvider, NMessageProvider, zhCN, dateZhCN } from 'naive-ui'
|
||||
import Drawer from '../../src/features/production/components/ContinuityReviewDrawer.vue'
|
||||
import { createContinuityMock, continuityShots, diagnosisFixture } from '../fixtures/continuity'
|
||||
import { jointPlan, jointTask, stateContexts } from '../fixtures/continuity-joint'
|
||||
import '../../src/styles/styles.css'
|
||||
import '../../src/styles/admin.css'
|
||||
/** 全部服务隔离,不向真实 API 发写请求。 */
|
||||
const mock = createContinuityMock('http://localhost:4312/tests/browser/candidate.svg')
|
||||
/** 当前隔离计划状态。 */
|
||||
const planStatus = ref<'ready' | 'blocked' | 'reusable'>('ready')
|
||||
/** 当前隔离签收。 */
|
||||
const review = {
|
||||
reviewId: 'mock-review',
|
||||
reviewer: '隔离审核人',
|
||||
reviewedAt: '',
|
||||
status: 'passed',
|
||||
invalidation: null,
|
||||
diagnosis: diagnosisFixture(
|
||||
{ shotIds: ['s1', 's2'], sceneFormId: 'scene-form' },
|
||||
'http://localhost:4312/tests/browser/candidate.svg'
|
||||
)
|
||||
}
|
||||
/**
|
||||
* 只允许免费诊断和只读回读,批准、签收、执行及恢复全部拒绝。
|
||||
* @param input 请求地址
|
||||
* @param init 请求选项
|
||||
* @returns 隔离响应
|
||||
*/
|
||||
window.fetch = async (input, init) => {
|
||||
const path = String(input)
|
||||
if (init?.method && init.method !== 'GET' && !path.endsWith('/continuity/diagnosis'))
|
||||
return new Response(JSON.stringify({ message: '隔离页禁止写入与付费' }), { status: 403 })
|
||||
let data: unknown
|
||||
if (path.includes('/vision/preview'))
|
||||
data = {
|
||||
...jointPlan,
|
||||
projectId: 'mock-project',
|
||||
reviewId: 'mock-review',
|
||||
status: planStatus.value,
|
||||
executionAvailable: planStatus.value === 'ready',
|
||||
reusableTaskId: planStatus.value === 'reusable' ? 't' : null
|
||||
}
|
||||
else if (path.includes('/vision-tasks/')) data = { ...jointTask, reviewId: 'mock-review' }
|
||||
else if (path.endsWith('/reviews/mock-review')) data = review
|
||||
else if (path.includes('/workflow-executions/')) data = null
|
||||
else if (path.endsWith('/continuity/diagnosis')) {
|
||||
const response = await mock.fetcher(input, init)
|
||||
const body = await response.json()
|
||||
if (JSON.parse(String(init?.body)).scope) body.data.stateContext = stateContexts
|
||||
return new Response(JSON.stringify(body))
|
||||
} else return mock.fetcher(input, init)
|
||||
return new Response(JSON.stringify({ data }))
|
||||
}
|
||||
/** 可复用现有抽屉的隔离浏览器入口。 */
|
||||
const Preview = defineComponent({
|
||||
setup() {
|
||||
/** 当前抽屉。 */ const open = ref(false)
|
||||
return () =>
|
||||
h('main', { style: 'padding:24px' }, [
|
||||
h('h1', 'V02 连续性隔离验收:批准、执行、保存均禁止'),
|
||||
...(['ready', 'blocked', 'reusable'] as const).map(value =>
|
||||
h(
|
||||
NButton,
|
||||
{
|
||||
onClick: () => {
|
||||
planStatus.value = value
|
||||
open.value = true
|
||||
}
|
||||
},
|
||||
() => value
|
||||
)
|
||||
),
|
||||
h(Drawer, {
|
||||
open: open.value,
|
||||
'onUpdate:open': (v: boolean) => (open.value = v),
|
||||
projectId: 'mock-project',
|
||||
shots: continuityShots,
|
||||
disabled: false
|
||||
})
|
||||
])
|
||||
}
|
||||
})
|
||||
createApp({
|
||||
render: () =>
|
||||
h(
|
||||
NConfigProvider,
|
||||
{ locale: zhCN, dateLocale: dateZhCN },
|
||||
{ default: () => h(NMessageProvider, null, { default: () => h(Preview) }) }
|
||||
)
|
||||
}).mount('#app')
|
||||
@@ -0,0 +1,157 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { mount, flushPromises, type VueWrapper } from '@vue/test-utils'
|
||||
import { NInput, NInputNumber, NCheckbox } from 'naive-ui'
|
||||
import Joint from '@/features/production/components/ContinuityJointReview.vue'
|
||||
import { jointApi } from '@/features/production/continuity-joint'
|
||||
import { validStateChecks, type StateCheck } from '@/features/production/continuity-state'
|
||||
import { jointPlan, jointTask, stateContexts } from '../../fixtures/continuity-joint'
|
||||
import { diagnosisFixture } from '../../fixtures/continuity'
|
||||
vi.mock('@/features/workflows/execution', () => ({
|
||||
useWorkflowExecution: () => ({
|
||||
query: { data: { value: null }, loading: { value: false }, error: { value: '' }, refresh: vi.fn<() => void>() },
|
||||
track: vi.fn<() => void>()
|
||||
})
|
||||
}))
|
||||
/** 当前隔离组件。 */
|
||||
let wrapper: VueWrapper | undefined
|
||||
afterEach(() => {
|
||||
wrapper?.unmount()
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
/**
|
||||
* 挂载真实联合表单,所有服务隔离。
|
||||
* @param status 计划状态
|
||||
* @returns 组件
|
||||
*/
|
||||
async function open(status: 'ready' | 'blocked' | 'reusable' = 'ready') {
|
||||
vi.spyOn(jointApi, 'preview').mockResolvedValue({
|
||||
...jointPlan,
|
||||
status,
|
||||
executionAvailable: status === 'ready',
|
||||
reusableTaskId: status === 'reusable' ? 't' : null
|
||||
})
|
||||
vi.spyOn(jointApi, 'task').mockResolvedValue(jointTask)
|
||||
wrapper = mount(Joint, {
|
||||
props: {
|
||||
projectId: 'p',
|
||||
disabled: false,
|
||||
review: {
|
||||
reviewId: 'r',
|
||||
reviewer: '审核人',
|
||||
reviewedAt: '',
|
||||
status: 'passed',
|
||||
invalidation: null,
|
||||
diagnosis: diagnosisFixture({ shotIds: ['s1', 's2'], sceneFormId: 'f' })
|
||||
}
|
||||
}
|
||||
})
|
||||
await wrapper.find('button').trigger('click')
|
||||
await flushPromises()
|
||||
return wrapper
|
||||
}
|
||||
describe('联合审核单次批准和业务状态', () => {
|
||||
it.each(['ready', 'blocked', 'reusable'] as const)('%s 免费计划不自动批准执行', async status => {
|
||||
const auth = vi.spyOn(jointApi, 'authorize')
|
||||
const execute = vi.spyOn(jointApi, 'execute')
|
||||
const w = await open(status)
|
||||
expect(w.text()).toContain('未知')
|
||||
expect(w.text()).toContain('空间参考')
|
||||
expect(w.text()).toContain('s1')
|
||||
expect(w.text()).toContain('s2')
|
||||
expect(auth).not.toHaveBeenCalled()
|
||||
expect(execute).not.toHaveBeenCalled()
|
||||
expect((w.vm as unknown as { canExecute: boolean }).canExecute).toBeFalsy()
|
||||
expect(w.text()).not.toContain('联合任务:通过')
|
||||
expect(w.text().includes('联合任务:未通过')).toBe(status === 'reusable')
|
||||
})
|
||||
it('明确批准当前总指纹后仍须单独执行确认', async () => {
|
||||
const w = await open()
|
||||
const auth = vi
|
||||
.spyOn(jointApi, 'authorize')
|
||||
.mockResolvedValue({ authorizationId: 'auth', planFingerprint: jointPlan.fingerprint })
|
||||
const execute = vi
|
||||
.spyOn(jointApi, 'execute')
|
||||
.mockResolvedValue({ validationTaskId: 't', executionId: 'e', status: 'completed', reused: false })
|
||||
w.findAllComponents(NInput).forEach((input, i) =>
|
||||
input.vm.$emit('update:value', ['批准人', '操作人', 'b'.repeat(64)][i])
|
||||
)
|
||||
w.findAllComponents(NInputNumber).forEach((input, i) => input.vm.$emit('update:value', i))
|
||||
await flushPromises()
|
||||
w.findComponent(NCheckbox).vm.$emit('update:checked', true)
|
||||
await flushPromises()
|
||||
const vm = w.vm as unknown as {
|
||||
authorize: () => Promise<void>
|
||||
canExecute: boolean
|
||||
execute: () => Promise<void>
|
||||
}
|
||||
await vm.authorize()
|
||||
expect(auth.mock.calls[0]?.[2].plan).toEqual({
|
||||
purpose: 'continuity',
|
||||
reviewId: 'r',
|
||||
fingerprint: jointPlan.fingerprint
|
||||
})
|
||||
expect(vm.canExecute).toBe(false)
|
||||
expect(execute).not.toHaveBeenCalled()
|
||||
w.findAllComponents(NCheckbox).at(-1)!.vm.$emit('update:checked', true)
|
||||
await flushPromises()
|
||||
await vm.execute()
|
||||
await flushPromises()
|
||||
expect(execute).toHaveBeenCalledExactlyOnceWith('p', 'r', 'auth')
|
||||
expect(w.text()).toContain('联合任务:未通过')
|
||||
})
|
||||
})
|
||||
it('状态范围只接受相邻正式主体、原依据和完整人工意见,保留 null', () => {
|
||||
const check: StateCheck = {
|
||||
fromShotId: 's1',
|
||||
toShotId: 's2',
|
||||
subjectRef: '@CH1',
|
||||
dimension: 'gaze',
|
||||
before: null,
|
||||
after: '向前',
|
||||
verdict: 'unknown',
|
||||
sourceIds: ['s1-state'],
|
||||
evidence: '前镜视线无法辨认'
|
||||
}
|
||||
expect(validStateChecks([check], stateContexts)).toBe(true)
|
||||
expect(validStateChecks([{ ...check, verdict: null }], stateContexts)).toBe(false)
|
||||
expect(validStateChecks([{ ...check, sourceIds: ['伪造'] }], stateContexts)).toBe(false)
|
||||
expect(validStateChecks([{ ...check, subjectRef: '@CH2' }], stateContexts)).toBe(false)
|
||||
expect(validStateChecks([check, check], stateContexts)).toBe(false)
|
||||
})
|
||||
|
||||
it('恢复仅使用服务端证明的原任务和原指纹,另行确认且不新授权', async () => {
|
||||
const w = await open('reusable')
|
||||
vi.mocked(jointApi.task).mockResolvedValue({
|
||||
...jointTask,
|
||||
taskStatus: 'failed',
|
||||
workflowStatus: 'failed',
|
||||
resumeAvailable: true
|
||||
})
|
||||
const refresh = w.findAll('button').find(b => b.text() === '只读刷新原联合任务')!
|
||||
await refresh.trigger('click')
|
||||
await flushPromises()
|
||||
const auth = vi.spyOn(jointApi, 'authorize')
|
||||
const resume = vi.spyOn(jointApi, 'resume').mockResolvedValue({ validationTaskId: 't', executionId: 'e' })
|
||||
const vm = w.vm as unknown as { canResume: boolean; resume: () => Promise<void> }
|
||||
expect(vm.canResume).toBe(false)
|
||||
w.findAllComponents(NCheckbox).at(-1)!.vm.$emit('update:checked', true)
|
||||
await flushPromises()
|
||||
expect(vm.canResume).toBe(true)
|
||||
expect(w.text()).toContain('免费解析原回执')
|
||||
await vm.resume()
|
||||
expect(resume).toHaveBeenCalledExactlyOnceWith('p', 't', jointPlan.fingerprint)
|
||||
expect(auth).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('旧计划刷新失败后撤销批准,不自动重试或调用收费接口', async () => {
|
||||
const w = await open()
|
||||
const auth = vi.spyOn(jointApi, 'authorize')
|
||||
const execute = vi.spyOn(jointApi, 'execute')
|
||||
vi.mocked(jointApi.preview).mockRejectedValueOnce(new Error('CONTINUITY_VISION_PLAN_STALE: 来源变化'))
|
||||
await w.find('button').trigger('click')
|
||||
await flushPromises()
|
||||
expect(jointApi.preview).toHaveBeenLastCalledWith('p', 'r', jointPlan.fingerprint, expect.any(AbortSignal))
|
||||
expect((w.vm as unknown as { canAuthorize: boolean }).canAuthorize).toBeFalsy()
|
||||
expect(auth).not.toHaveBeenCalled()
|
||||
expect(execute).not.toHaveBeenCalled()
|
||||
})
|
||||
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
import type { JointPlan, JointTask } from '../../src/features/production/continuity-joint'
|
||||
import type { StateContext } from '../../src/features/production/continuity-state'
|
||||
/** 联合审核隔离计划,不包含真实收费批准。 */
|
||||
export const jointPlan: JointPlan = {
|
||||
projectId: 'p',
|
||||
reviewId: 'r',
|
||||
fingerprint: 'a'.repeat(64),
|
||||
model: '隔离模型',
|
||||
status: 'ready',
|
||||
executionAvailable: true,
|
||||
requiresExplicitApproval: true,
|
||||
paidCalls: 0,
|
||||
proposedMaximumProviderRequests: 1,
|
||||
additionalProviderRequests: 1,
|
||||
feeEstimate: { currency: 'CNY', amount: null, reason: '待估算' },
|
||||
capability: { verified: true, reason: '隔离核验' },
|
||||
latestTask: null,
|
||||
reusableTaskId: null,
|
||||
imageManifest: [
|
||||
{
|
||||
imageNumber: 1,
|
||||
label: '首帧',
|
||||
pixels: { sha256: 'b'.repeat(64), width: 1024, height: 1024 },
|
||||
bindings: [{ shotId: 's1', imageId: 'i1', role: 'frame' }]
|
||||
},
|
||||
{
|
||||
imageNumber: 2,
|
||||
label: '合并空间图',
|
||||
pixels: { sha256: 'c'.repeat(64), width: 1024, height: 1024 },
|
||||
bindings: [
|
||||
{ shotId: 's1', imageId: 'layout', role: 'spatial_reference' },
|
||||
{ shotId: 's2', imageId: 'layout', role: 'spatial_reference' }
|
||||
]
|
||||
}
|
||||
],
|
||||
request: { messages: [{ role: 'user', content: '正式状态与动作依据' }] }
|
||||
}
|
||||
/** 已完成但业务失败的原任务。 */
|
||||
export const jointTask: JointTask = {
|
||||
validationTaskId: 't',
|
||||
executionId: 'e',
|
||||
reviewId: 'r',
|
||||
taskStatus: 'completed',
|
||||
workflowStatus: 'completed',
|
||||
status: 'failed',
|
||||
current: true,
|
||||
planFingerprint: jointPlan.fingerprint,
|
||||
resumeAvailable: false,
|
||||
requiresNewProviderRequest: false,
|
||||
retryAutomatically: false,
|
||||
diagnosis: { status: 'failed' },
|
||||
machineObservation: { summary: '原机器观察' },
|
||||
summary: '结构冲突',
|
||||
feeScope: { currency: 'CNY', estimatedMin: 0, estimatedMax: 1, maxRequests: 1 },
|
||||
step: { name: 'general', status: 'completed' }
|
||||
}
|
||||
/** 正式相邻两镜人工状态依据。 */
|
||||
export const stateContexts: StateContext[] = ['s1', 's2'].map(shotId => ({
|
||||
shotId,
|
||||
generation: { subjects: [{ subjectRef: '@CH1', gaze: shotId === 's1' ? '向左' : '向前' }] },
|
||||
requiredActions: [{ id: 'A1', description: '观察', kind: 'action', mustPerformInShot: true }],
|
||||
sources: [
|
||||
{
|
||||
id: shotId + '-state',
|
||||
shotId,
|
||||
kind: 'visual_state',
|
||||
subjectRef: '@CH1',
|
||||
field: 'gaze',
|
||||
text: '当前正式视线',
|
||||
executable: false
|
||||
}
|
||||
]
|
||||
}))
|
||||
Reference in new issue
Block a user