接入动作时间轴、密度审计、人工视线目标和后台首帧编辑;独立读取已保存提示词,并在首帧晋升前重新核对持久化质量状态。 统一 NMessage 结果反馈、局部 loading 和业务说明间距,保留真实长任务进度与部分失败语义。 验证:pnpm check(49 个文件、393 项测试)、pnpm build;当前环境无法完成 localhost 浏览器验收及真实后端联调。
150 lines
7.4 KiB
Vue
150 lines
7.4 KiB
Vue
<script setup lang="ts">
|
||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||
|
||
import { computed } from 'vue'
|
||
import { NTag } from 'naive-ui'
|
||
import { useQuery } from '../../../composables/useQuery'
|
||
import { formatDate } from '../../../lib/format'
|
||
import { videoDiagnosticsApi } from '../diagnostics-api'
|
||
import { videoQualityStatusLabel } from '../model'
|
||
import type { VideoQualityRollbackTarget } from '../diagnostics.types'
|
||
|
||
/** 视频诊断绑定正式镜头与用户选中的视频,随弹窗挂载直接读取。 */
|
||
const props = defineProps<{
|
||
/** 正式镜头 ID。 */
|
||
shotId: string
|
||
/** 用户选中的视频 ID。 */
|
||
videoId: string
|
||
/** 当前视频是否因首帧或参考图变化而需要更新。 */
|
||
stale: boolean
|
||
}>()
|
||
/** 查询目标包含镜头和视频,切换目标后取消旧请求。 */
|
||
const key = computed(() => (props.shotId && props.videoId ? JSON.stringify([props.shotId, props.videoId]) : ''))
|
||
/** 切换镜头时取消查询,先读取链状态,耗尽时再查询独立归因。 */
|
||
const query = useQuery(key, async (value, signal) => {
|
||
if (!value) return null
|
||
const [shotId] = JSON.parse(value) as [string, string]
|
||
const detail = await videoDiagnosticsApi.qualityDetail(shotId, signal)
|
||
if (detail.shotId !== shotId || !Array.isArray(detail.chain)) throw new Error('质量记录与当前镜头不匹配,请刷新。')
|
||
const analysis =
|
||
detail.status === 'exhausted'
|
||
? await videoDiagnosticsApi.exhaustionAnalysis(shotId, signal)
|
||
: detail.exhaustionAnalysis
|
||
if (analysis && analysis.shotId !== shotId) throw new Error('失败归因与当前镜头不匹配,请刷新。')
|
||
return { detail, analysis }
|
||
})
|
||
/** 当前请求返回的权威质量链。 */
|
||
const detail = computed(() => query.data.value?.detail)
|
||
/** 当前视频的独立记录,不能使用其它候选或流程整体结果兜底。 */
|
||
const currentRecord = computed(() => detail.value?.chain.find(item => item.videoId === props.videoId))
|
||
/** 当前视频优先展示,其它候选明确标识为相关记录。 */
|
||
const orderedChain = computed(() => {
|
||
const chain = detail.value?.chain ?? []
|
||
return [
|
||
...chain.filter(item => item.videoId === props.videoId),
|
||
...chain.filter(item => item.videoId !== props.videoId)
|
||
]
|
||
})
|
||
/** 当前链对应的后端确定性归因。 */
|
||
const analysis = computed(() => query.data.value?.analysis)
|
||
|
||
/**
|
||
* 将后端回退层级转成业务标签,未知值保持原文。
|
||
* @param target 后端建议回退层级
|
||
* @returns 中文标签
|
||
*/
|
||
function rollbackLabel(target: VideoQualityRollbackTarget) {
|
||
const labels: Record<VideoQualityRollbackTarget, string> = {
|
||
identity_reference: '主体身份母版',
|
||
subject_reference: '形态参考图',
|
||
keyframe: '主首帧',
|
||
motion_plan: '运动计划',
|
||
video_prompt: '视频提示词',
|
||
provider: '视频模型'
|
||
}
|
||
return labels[target] ?? target
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<!-- 以下是弹窗中的视频已有检查记录模块,无需再次点击查看 -->
|
||
<section class="workspace-panel text-xs leading-6" aria-label="当前视频质量记录">
|
||
<ContextNotice v-if="stale" type="warning" :show-icon="false" class="mb-3">
|
||
此视频需要更新:首帧或参考图已变化。此前画面检查结果仅供参考,请重新生成视频。
|
||
</ContextNotice>
|
||
<ContextNotice v-if="query.error.value" type="error" :show-icon="false" role="alert">{{
|
||
query.error.value
|
||
}}</ContextNotice>
|
||
<p v-if="query.loading.value" class="text-muted" role="status">正在读取质量记录…</p>
|
||
<template v-else-if="detail">
|
||
<p v-if="currentRecord" class="font-semibold">
|
||
{{
|
||
currentRecord.validationPassed === true
|
||
? '当前视频此前画面检查通过'
|
||
: currentRecord.validationPassed === false
|
||
? '当前视频此前画面检查未通过'
|
||
: '当前视频尚未完成画面检查'
|
||
}}
|
||
</p>
|
||
<p v-else class="text-muted">此视频暂无自动质量流程记录。</p>
|
||
<!-- 以下是镜头质量流程上下文模块,与当前视频的结论区分 -->
|
||
<p class="mt-3 text-muted">
|
||
本镜头共 {{ detail.chain.length }} 条视频记录;当前视频优先显示,其它候选单独标识。
|
||
</p>
|
||
<p v-if="currentRecord" class="text-muted">
|
||
当前视频修复 {{ currentRecord.repairAttempt }} / {{ currentRecord.maxRepairAttempts ?? '未设置' }}
|
||
</p>
|
||
<p v-if="['generating', 'validating', 'repairing'].includes(detail.status)" class="text-muted">
|
||
当前镜头正在执行:{{ videoQualityStatusLabel(detail.status) }}
|
||
</p>
|
||
<p v-if="!detail.chain.length" class="mt-2 text-muted">当前镜头尚无质量链记录。</p>
|
||
<article v-for="item in orderedChain" :key="item.videoId" class="surface-inset mt-3 p-3">
|
||
<div class="flex flex-wrap items-center gap-2">
|
||
<NTag size="small" :bordered="false">{{ item.videoId === videoId ? '当前视频' : '其它候选' }}</NTag>
|
||
<code>{{ item.videoId }}</code>
|
||
<NTag size="small" :bordered="false">第 {{ item.repairAttempt }} 代</NTag>
|
||
<span
|
||
>{{ item.providerStatus }} ·
|
||
{{
|
||
item.validationPassed === true
|
||
? '校验通过'
|
||
: item.validationPassed === false
|
||
? '校验未通过'
|
||
: '尚未校验'
|
||
}}</span
|
||
>
|
||
<span class="text-muted">{{ formatDate(item.updatedAt) }}</span>
|
||
</div>
|
||
<ul v-if="item.issues.length" class="mt-2 space-y-1">
|
||
<li
|
||
v-for="(issue, index) in item.issues"
|
||
:key="index"
|
||
:class="issue.severity === 'error' ? 'text-danger' : 'text-muted'"
|
||
>
|
||
{{ issue.frameLabel ? `${issue.frameLabel} · ` : '' }}{{ issue.description }}
|
||
</li>
|
||
</ul>
|
||
</article>
|
||
<ContextNotice
|
||
v-if="analysis"
|
||
class="mt-3"
|
||
:type="analysis.requiresManualReview ? 'warning' : 'info'"
|
||
:show-icon="false"
|
||
>
|
||
<p class="font-semibold">镜头最近一次质量流程的修改建议</p>
|
||
{{ analysis.summary }}
|
||
<p v-if="analysis.recommendedRollback.length" class="mt-1">
|
||
建议检查:{{ analysis.recommendedRollback.map(rollbackLabel).join('、') }}
|
||
</p>
|
||
</ContextNotice>
|
||
<article v-for="issue in analysis?.persistentIssues ?? []" :key="issue.type" class="mt-3">
|
||
<strong>{{ issue.type }} · 出现 {{ issue.occurrences }} 次</strong>
|
||
<p>{{ issue.suspectedCause }}</p>
|
||
<ul class="text-muted">
|
||
<li v-for="description in issue.descriptions" :key="description">{{ description }}</li>
|
||
</ul>
|
||
</article>
|
||
</template>
|
||
</section>
|
||
</template>
|