refactor: 分镜质量诊断移至分镜 Tab 并与拆解设置解耦

This commit is contained in:
GouJ committed 2026-10-16 13:07:05 +08:00
1 parent 9254d2a789
commit 97dc784c8b
1 file changed
+110 -100
+110 -100
View File
@@ -32,6 +32,8 @@ const preview = ref<BreakdownPreview | null>(null)
const previewBusy = ref(false)
const tab = ref('character')
const toolsOpen = ref(false)
/** 分镜诊断与拆解设置解耦,默认不占用列表空间。 */
const qualityPanelOpen = ref(false)
/** 仅打开设置面板时按需查询,不增加页面常驻提示或后台轮询。 */
const handDiagnostics = ref<StoryboardHandOccupancyDiagnostics | null>(null)
const handDiagnosticsBusy = ref(false)
@@ -43,9 +45,9 @@ async function loadHandRepairPreview(id: string) {
handRepairBusy.value = true
try {
const data = await breakdownApi.handRepairPreview(id)
if (version === handDiagnosticsVersion && toolsOpen.value && projectId.value === id) handRepairPreview.value = data
if (version === handDiagnosticsVersion && qualityPanelOpen.value && projectId.value === id) handRepairPreview.value = data
} catch (cause) {
if (version === handDiagnosticsVersion && toolsOpen.value && projectId.value === id) actionMessage?.error(errorMessage(cause))
if (version === handDiagnosticsVersion && qualityPanelOpen.value && projectId.value === id) actionMessage?.error(errorMessage(cause))
} finally {
if (version === handDiagnosticsVersion) handRepairBusy.value = false
}
@@ -58,9 +60,9 @@ async function loadHandDiagnostics(id: string) {
handDiagnostics.value = null
try {
const data = await breakdownApi.handOccupancyDiagnostics(id)
if (version === handDiagnosticsVersion && toolsOpen.value && projectId.value === id) handDiagnostics.value = data
if (version === handDiagnosticsVersion && qualityPanelOpen.value && projectId.value === id) handDiagnostics.value = data
} catch (cause) {
if (version === handDiagnosticsVersion && toolsOpen.value && projectId.value === id) actionMessage?.error(errorMessage(cause))
if (version === handDiagnosticsVersion && qualityPanelOpen.value && projectId.value === id) actionMessage?.error(errorMessage(cause))
} finally {
if (version === handDiagnosticsVersion) handDiagnosticsBusy.value = false
}
@@ -82,7 +84,7 @@ const summary = computed(() => snapshot.value?.taskSummary)
const validation = computed(() => result.value?.storyboardShotValidation ?? snapshot.value?.storyboardShotValidation)
const projectId = computed(() => project.value?.id ?? '')
const operation = computed(() => getOperation(projectId.value))
watch([toolsOpen, projectId], () => {
watch([qualityPanelOpen, projectId], () => {
++handDiagnosticsVersion
handDiagnostics.value = null
handDiagnosticsBusy.value = false
@@ -114,15 +116,15 @@ async function loadLegacyResults() {
legacyResultsBusy.value = true
try {
const data = await breakdownApi.legacyActionDiagnosisResults(id, episode)
if (requestVersion === legacyResultsRequest && version === handDiagnosticsVersion && projectId.value === id && toolsOpen.value) legacyResults.value = data
if (requestVersion === legacyResultsRequest && version === handDiagnosticsVersion && projectId.value === id && qualityPanelOpen.value) legacyResults.value = data
} catch (cause) {
if (requestVersion === legacyResultsRequest && version === handDiagnosticsVersion && projectId.value === id && toolsOpen.value) actionMessage?.error(errorMessage(cause))
if (requestVersion === legacyResultsRequest && version === handDiagnosticsVersion && projectId.value === id && qualityPanelOpen.value) actionMessage?.error(errorMessage(cause))
} finally {
if (requestVersion === legacyResultsRequest) legacyResultsBusy.value = false
}
}
watch(() => legacyDiagnosisExecution.query.data.value?.status, (status, previous) => {
if (status && status !== previous && (status === 'completed' || status === 'failed') && toolsOpen.value) {
if (status && status !== previous && (status === 'completed' || status === 'failed') && qualityPanelOpen.value) {
void loadLegacyResults()
}
})
@@ -143,9 +145,9 @@ async function loadLegacyPreview() {
const data = await breakdownApi.legacyActionDiagnosisPreview(id, legacyEpisodeNo.value,
legacyDiagnosisScope.value === 'beat' || legacyDiagnosisScope.value === 'shot' ? legacyBeatNo.value : undefined,
legacyDiagnosisScope.value === 'shot' ? legacyShotNo.value : undefined)
if (version === handDiagnosticsVersion && projectId.value === id && toolsOpen.value) legacyPreview.value = data
if (version === handDiagnosticsVersion && projectId.value === id && qualityPanelOpen.value) legacyPreview.value = data
} catch (cause) {
if (version === handDiagnosticsVersion && projectId.value === id && toolsOpen.value) actionMessage?.error(errorMessage(cause))
if (version === handDiagnosticsVersion && projectId.value === id && qualityPanelOpen.value) actionMessage?.error(errorMessage(cause))
} finally {
if (version === handDiagnosticsVersion) legacyPreviewBusy.value = false
}
@@ -156,7 +158,8 @@ async function openLegacyShotDiagnosis(scope: { episodeNo: number; beatNo: numbe
legacyBeatNo.value = scope.beatNo
legacyShotNo.value = scope.shotNo
legacyDiagnosisScope.value = scope.shotNo === undefined ? 'beat' : 'shot'
toolsOpen.value = true
tab.value = 'storyboard'
qualityPanelOpen.value = true
await loadLegacyPreview()
}
async function startLegacyDiagnosis() {
@@ -508,95 +511,6 @@ const rules = {
@refresh="backgroundExecution.query.refresh"
@dismiss="backgroundExecution.dismiss"
/>
<!-- 手部动作诊断按需读取,历史镜头缺少证据时不误报为安全。 -->
<section class="workspace-panel">
<div class="flex flex-wrap items-center justify-between gap-3">
<h3 class="text-sm font-medium">手部动作质量</h3>
<NButton text :loading="handDiagnosticsBusy" :disabled="!projectId || handDiagnosticsBusy" @click="loadHandDiagnostics(projectId)">{{ handDiagnostics ? '刷新' : '查看诊断' }}</NButton>
</div>
<div v-if="handDiagnostics" class="mt-3 flex flex-wrap gap-x-4 gap-y-2 text-xs text-muted">
<span>镜头 {{ handDiagnostics.shotCount }}</span>
<span>有效证据 {{ handDiagnostics.evidenceShotCount }} / {{ handDiagnostics.shotCount }}</span>
<span>冲突 {{ handDiagnostics.warningCount }}</span>
<span v-if="handDiagnostics.assessment === 'insufficient_evidence'">证据不足</span>
<span v-else-if="handDiagnostics.assessment === 'partial_evidence'">部分镜头缺少证据</span>
</div>
<div v-if="handDiagnostics?.diagnostics.length" class="mt-3 space-y-2 text-xs">
<div v-for="(issue, index) in handDiagnostics.diagnostics" :key="index">
第 {{ issue.episodeNo }} 集 / Beat {{ issue.beatNo }} / Shot {{ issue.shotNo }} / 阶段 {{ issue.phaseNo }}:{{ issue.suggestion }}
</div>
</div>
</section>
<section class="workspace-panel">
<div class="flex flex-wrap items-center justify-between gap-3">
<h3 class="text-sm font-medium">历史镜头 AI 动作诊断</h3>
<NButton text :loading="legacyPreviewBusy" @click="loadLegacyPreview">预览范围</NButton>
</div>
<div class="mt-3 flex flex-wrap items-center gap-3">
<NButton size="small" :type="legacyDiagnosisScope === 'episode' ? 'primary' : 'default'" @click="legacyDiagnosisScope = 'episode'">单集</NButton>
<NButton size="small" :type="legacyDiagnosisScope === 'project' ? 'primary' : 'default'" @click="legacyDiagnosisScope = 'project'">全项目</NButton>
<span v-if="legacyDiagnosisScope === 'beat' || legacyDiagnosisScope === 'shot'" class="text-xs text-muted">Beat {{ legacyBeatNo }}{{ legacyDiagnosisScope === 'shot' ? ` / Shot ${legacyShotNo}` : '' }}</span>
<NInputNumber v-if="legacyDiagnosisScope !== 'project'" v-model:value="legacyEpisodeNo" :min="1" :precision="0" size="small" class="w-24" />
<span class="text-xs text-muted">并发</span>
<NInputNumber v-model:value="legacyConcurrency" :min="1" :max="5" :precision="0" size="small" class="w-20" />
</div>
<div v-if="legacyPreview" class="mt-3 text-xs text-muted">
第 {{ legacyPreview.episodeNo }} 集:{{ legacyPreview.candidateCount }} 个镜头,{{ legacyPreview.needsEvidenceCount }} 个待补证据
</div>
<div class="mt-3 flex justify-end">
<ConfirmAction label="启动 AI 诊断" :description="legacyDiagnosisDescription"
:loading="legacyStarting" :disabled="legacyDiagnosisExecution.active.value || legacyStarting || (legacyDiagnosisScope !== 'project' && !legacyPreview)"
primary @confirm="startLegacyDiagnosis" />
</div>
<div class="mt-3 flex flex-wrap items-center justify-between gap-3">
<span class="text-xs text-muted">诊断结果</span>
<NButton text :loading="legacyResultsBusy" @click="loadLegacyResults">查看结果</NButton>
</div>
<div v-if="legacyResults" class="mt-2 space-y-3 text-xs">
<div class="flex flex-wrap gap-x-4 gap-y-2 text-muted">
<span>总计 {{ legacyResults.counts.total }}</span>
<span>冲突 {{ legacyResults.counts.conflict }}</span>
<span>未发现冲突 {{ legacyResults.counts.clear }}</span>
<span>证据不足 {{ legacyResults.counts.insufficient }}</span>
<span>证据无效 {{ legacyResults.counts.invalid }}</span>
<span>已过期 {{ legacyResults.counts.stale }}</span>
<span>未诊断 {{ legacyResults.counts.pending }}</span>
</div>
<div v-for="item in legacyResults.shots.filter(shot => shot.status !== 'no_conflict_found')" :key="item.shotId" class="py-1">
第 {{ item.episodeNo }} 集 / Beat {{ item.beatNo }} / Shot {{ item.shotNo }} · {{ item.title }}
<span class="ml-2 text-muted">{{ ({
conflict_found: '手部冲突',
insufficient_evidence: '证据不足',
invalid_evidence: '证据无效',
stale: '诊断过期',
not_diagnosed: '尚未诊断',
no_conflict_found: '未发现冲突'
} as const)[item.status] }}</span>
</div>
</div>
<WorkflowExecutionPanel v-if="legacyDiagnosisExecution.executionId.value"
title="历史动作诊断任务"
:execution="legacyDiagnosisExecution.query.data.value ?? null"
:loading="legacyDiagnosisExecution.query.loading.value"
:error="legacyDiagnosisExecution.query.error.value ?? ''"
@refresh="legacyDiagnosisExecution.query.refresh()"
@dismiss="legacyDiagnosisExecution.dismiss()" />
</section>
<section v-if="handDiagnostics?.warningCount" class="workspace-panel">
<div class="flex items-center justify-between gap-3">
<h3 class="text-sm font-medium">局部修复候选</h3>
<NButton text :loading="handRepairBusy" :disabled="handRepairBusy" @click="loadHandRepairPreview(projectId)">
{{ handRepairPreview ? '刷新候选' : '查看候选' }}
</NButton>
</div>
<div v-if="handRepairPreview" class="mt-3 space-y-2 text-xs">
<div v-for="(item, index) in handRepairPreview.candidates" :key="index" class="space-y-1">
<p>第 {{ item.episodeNo }} 集 / Beat {{ item.beatNo }} / Shot {{ item.shotNo }} / 阶段 {{ item.phaseNo }}</p>
<p class="text-muted">{{ item.suggestion }}</p>
<p v-if="item.blockingReasons.length" class="text-muted">{{ item.blockingReasons.join(';') }}</p>
</div>
</div>
</section>
<section v-if="snapshot">
<div class="mb-3 flex flex-wrap items-center justify-between gap-3">
<h2 class="text-sm font-medium">
@@ -770,6 +684,102 @@ const rules = {
/></div
></template>
<div v-if="tab === 'storyboard'" class="breakdown-result-pad">
<div class="mb-3 flex justify-end">
<NButton text @click="qualityPanelOpen = !qualityPanelOpen">{{ qualityPanelOpen ? '收起质量诊断' : '分镜质量诊断' }}</NButton>
</div>
<div v-if="qualityPanelOpen" class="mb-5 space-y-3">
<div class="text-sm font-medium">分镜质量诊断</div>
<!-- 手部动作诊断按需读取,历史镜头缺少证据时不误报为安全。 -->
<section class="workspace-panel">
<div class="flex flex-wrap items-center justify-between gap-3">
<h3 class="text-sm font-medium">结构化动作校验</h3>
<NButton text :loading="handDiagnosticsBusy" :disabled="!projectId || handDiagnosticsBusy" @click="loadHandDiagnostics(projectId)">{{ handDiagnostics ? '刷新' : '查看诊断' }}</NButton>
</div>
<div v-if="handDiagnostics" class="mt-3 flex flex-wrap gap-x-4 gap-y-2 text-xs text-muted">
<span>镜头 {{ handDiagnostics.shotCount }}</span>
<span>有效证据 {{ handDiagnostics.evidenceShotCount }} / {{ handDiagnostics.shotCount }}</span>
<span>冲突 {{ handDiagnostics.warningCount }}</span>
<span v-if="handDiagnostics.assessment === 'insufficient_evidence'">证据不足</span>
<span v-else-if="handDiagnostics.assessment === 'partial_evidence'">部分镜头缺少证据</span>
</div>
<div v-if="handDiagnostics?.diagnostics.length" class="mt-3 space-y-2 text-xs">
<div v-for="(issue, index) in handDiagnostics.diagnostics" :key="index">
第 {{ issue.episodeNo }} 集 / Beat {{ issue.beatNo }} / Shot {{ issue.shotNo }} / 阶段 {{ issue.phaseNo }}:{{ issue.suggestion }}
</div>
</div>
</section>
<section class="workspace-panel">
<div class="flex flex-wrap items-center justify-between gap-3">
<h3 class="text-sm font-medium">历史镜头 AI 诊断</h3>
<NButton text :loading="legacyPreviewBusy" @click="loadLegacyPreview">预览范围</NButton>
</div>
<div class="mt-3 flex flex-wrap items-center gap-3">
<NButton size="small" :type="legacyDiagnosisScope === 'episode' ? 'primary' : 'default'" @click="legacyDiagnosisScope = 'episode'">单集</NButton>
<NButton size="small" :type="legacyDiagnosisScope === 'project' ? 'primary' : 'default'" @click="legacyDiagnosisScope = 'project'">全项目</NButton>
<span v-if="legacyDiagnosisScope === 'beat' || legacyDiagnosisScope === 'shot'" class="text-xs text-muted">Beat {{ legacyBeatNo }}{{ legacyDiagnosisScope === 'shot' ? ` / Shot ${legacyShotNo}` : '' }}</span>
<NInputNumber v-if="legacyDiagnosisScope !== 'project'" v-model:value="legacyEpisodeNo" :min="1" :precision="0" size="small" class="w-24" />
<span class="text-xs text-muted">并发</span>
<NInputNumber v-model:value="legacyConcurrency" :min="1" :max="5" :precision="0" size="small" class="w-20" />
</div>
<div v-if="legacyPreview" class="mt-3 text-xs text-muted">
第 {{ legacyPreview.episodeNo }} 集:{{ legacyPreview.candidateCount }} 个镜头,{{ legacyPreview.needsEvidenceCount }} 个待补证据
</div>
<div class="mt-3 flex justify-end">
<ConfirmAction label="启动 AI 诊断" :description="legacyDiagnosisDescription"
:loading="legacyStarting" :disabled="legacyDiagnosisExecution.active.value || legacyStarting || (legacyDiagnosisScope !== 'project' && !legacyPreview)"
primary @confirm="startLegacyDiagnosis" />
</div>
<div class="mt-3 flex flex-wrap items-center justify-between gap-3">
<span class="text-xs text-muted">诊断结果</span>
<NButton text :loading="legacyResultsBusy" @click="loadLegacyResults">查看结果</NButton>
</div>
<div v-if="legacyResults" class="mt-2 space-y-3 text-xs">
<div class="flex flex-wrap gap-x-4 gap-y-2 text-muted">
<span>总计 {{ legacyResults.counts.total }}</span>
<span>冲突 {{ legacyResults.counts.conflict }}</span>
<span>未发现冲突 {{ legacyResults.counts.clear }}</span>
<span>证据不足 {{ legacyResults.counts.insufficient }}</span>
<span>证据无效 {{ legacyResults.counts.invalid }}</span>
<span>已过期 {{ legacyResults.counts.stale }}</span>
<span>未诊断 {{ legacyResults.counts.pending }}</span>
</div>
<div v-for="item in legacyResults.shots.filter(shot => shot.status !== 'no_conflict_found')" :key="item.shotId" class="py-1">
第 {{ item.episodeNo }} 集 / Beat {{ item.beatNo }} / Shot {{ item.shotNo }} · {{ item.title }}
<span class="ml-2 text-muted">{{ ({
conflict_found: '手部冲突',
insufficient_evidence: '证据不足',
invalid_evidence: '证据无效',
stale: '诊断过期',
not_diagnosed: '尚未诊断',
no_conflict_found: '未发现冲突'
} as const)[item.status] }}</span>
</div>
</div>
<WorkflowExecutionPanel v-if="legacyDiagnosisExecution.executionId.value"
title="历史动作诊断任务"
:execution="legacyDiagnosisExecution.query.data.value ?? null"
:loading="legacyDiagnosisExecution.query.loading.value"
:error="legacyDiagnosisExecution.query.error.value ?? ''"
@refresh="legacyDiagnosisExecution.query.refresh()"
@dismiss="legacyDiagnosisExecution.dismiss()" />
</section>
<section v-if="handDiagnostics?.warningCount" class="workspace-panel">
<div class="flex items-center justify-between gap-3">
<h3 class="text-sm font-medium">局部修复候选</h3>
<NButton text :loading="handRepairBusy" :disabled="handRepairBusy" @click="loadHandRepairPreview(projectId)">
{{ handRepairPreview ? '刷新候选' : '查看候选' }}
</NButton>
</div>
<div v-if="handRepairPreview" class="mt-3 space-y-2 text-xs">
<div v-for="(item, index) in handRepairPreview.candidates" :key="index" class="space-y-1">
<p>第 {{ item.episodeNo }} 集 / Beat {{ item.beatNo }} / Shot {{ item.shotNo }} / 阶段 {{ item.phaseNo }}</p>
<p class="text-muted">{{ item.suggestion }}</p>
<p v-if="item.blockingReasons.length" class="text-muted">{{ item.blockingReasons.join(';') }}</p>
</div>
</div>
</section>
</div>
<StoryboardList :plans="plans" :episodes="shots" @diagnose="openLegacyShotDiagnosis">
<template #actions>
<RouterLink :to="`/projects/${project?.id}/storyboard`" class="text-button"