fix(short-drama-agent-front): 修复B01分镜与历史失败状态

This commit is contained in:
GJ committed 2026-11-04 17:22:22 +08:00
1 parent ecb0423153
commit 75e86f7486
4 files changed
+123 -31

No files matched your search

+34 -23
View File
@@ -116,6 +116,15 @@ const sourceLabel = computed(
empty: ''
})[quality.value.source]
)
/** 从当前正式版本逐镜汇总,不沿用历史执行进度或候选统计。 */
const formalStoryboardSummary = computed(() => {
if (quality.value.source !== 'formal' || !quality.value.committed || !shots.value.length) return ''
const allShots = shots.value.flatMap(episode => episode.beatShots.flatMap(beat => beat.shots))
const bindingSummary = allShots.some(shot => shot.subjectRefs.length && !shot.subjectBindings)
? '绑定数量待确认'
: `${allShots.reduce((total, shot) => total + (shot.subjectBindings?.length ?? 0), 0)} 条绑定`
return `${shots.value.length} 集 · ${allShots.length} 镜 · ${bindingSummary}`
})
const operation = computed(() => getOperation(projectId.value))
/** 分镜阅读和诊断入口共用当前剧集,不维护独立的诊断集号输入。 */
const selectedEpisodeNo = ref<number>()
@@ -166,18 +175,23 @@ const execution = computed(() => {
}
: latestCheckpoint.value?.state.workflowExecution
})
/** 修复或提交之后的历史失败不污染新版本;活动任务仍使用真实状态。 */
const currentWorkflowError = computed(() => {
if (execution.value?.status !== 'failed') return ''
const latest = latestCheckpoint.value
const failedAt = Date.parse(execution.value.completedAt ?? '')
const checkpointAt = Date.parse(latest?.createdAt ?? '')
// 优先比较真实终态时间,修复元数据不能屏蔽随后启动的新任务失败。
if (Number.isFinite(failedAt) && Number.isFinite(checkpointAt))
return checkpointAt > failedAt ? '' : execution.value.errorMessage || ''
if (!backgroundExecution.query.data.value && latest?.metadata?.sourceCheckpointId) return ''
return execution.value.errorMessage || ''
/** 终态早于当前结果时归入历史,正式采用可以在原检查点上更新。 */
const executionHistorical = computed(() => {
const task = execution.value
const source = qualityObservation.source.value
const checkpoint = source.checkpoint
if (!task || task.status === 'running' || !checkpoint) return false
const record = backgroundExecution.query.data.value
const finishedAt = Date.parse(task.completedAt ?? record?.updatedAt ?? '')
const adoptedAt = quality.value.committed ? Date.parse(checkpoint.updatedAt ?? '') : NaN
const resultAt = Number.isFinite(adoptedAt) ? adoptedAt : Date.parse(checkpoint.createdAt)
if (Number.isFinite(finishedAt) && Number.isFinite(resultAt)) return resultAt > finishedAt
return !record && checkpoint === latestCheckpoint.value && !!checkpoint.metadata?.sourceCheckpointId
})
/** 当前失败与历史回执使用相同的判断,避免状态栏和详情展示相反结论。 */
const currentWorkflowError = computed(() =>
execution.value?.status === 'failed' && !executionHistorical.value ? execution.value.errorMessage || '' : ''
)
/** 拆解运行状态同时控制状态栏、诊断入口及所有恢复写操作。 */
const breakdownBusy = computed(
() =>
@@ -252,16 +266,6 @@ async function locateIssue(issue: ShotValidation['issues'][number]) {
)
}
const taskStopped = computed(() => execution.value?.status === 'failed' || execution.value?.status === 'completed')
/** 后续候选修订已替代旧任务结果时,只在明确的历史记录中展示回执。 */
const executionHistorical = computed(() => {
const record = backgroundExecution.query.data.value
return (
!!record &&
!!latestCheckpoint.value &&
!!record.completedAt &&
Date.parse(latestCheckpoint.value.createdAt) > Date.parse(record.completedAt)
)
})
/** 后台拆解结束后自动刷新项目、Checkpoint 与正式主体/分镜数据。 */
watch(
() => backgroundExecution.query.data.value?.status,
@@ -607,7 +611,12 @@ const isInitialEmpty = computed(
<span v-if="summary"
>抽取 {{ summary.completed }} / {{ summary.total }} · 失败 {{ summary.failed }}</span
>
<span>主体 {{ subjects.length }} · 分镜剧集 {{ shots.length }} / {{ plans.length }}</span>
<span
>主体 {{ subjects.length
}}<template v-if="!formalStoryboardSummary">
· 分镜剧集 {{ shots.length }} / {{ plans.length }}</template
></span
>
<StatusBadge :status="qualityStatus" :label="qualityLabel" />
<span v-if="breakdownBusy" class="flex items-center gap-2" role="status"
><LoaderCircle :size="13" class="animate-spin" />最近阶段:{{ runningStage }}</span
@@ -836,6 +845,7 @@ const isInitialEmpty = computed(
:title="executionHistorical ? '历史拆解任务' : '剧本拆解任务'"
class="breakdown-execution-panel"
:show-status-hint="false"
:result-is-historical="executionHistorical"
:execution="backgroundExecution.query.data.value"
:loading="backgroundExecution.query.loading.value"
:error="backgroundExecution.query.error.value"
@@ -908,7 +918,8 @@ const isInitialEmpty = computed(
<section class="breakdown-results-section" :data-breakdown-source="quality.source">
<!-- 以下是候选与正式数据来源提示,手机也不隐藏,防止把候选镜头当作正式资产 -->
<p v-if="sourceLabel" class="text-xs text-muted" role="status">
{{ sourceLabel }}<span v-if="quality.loading"> · 正在读取当前质量审核…</span>
{{ sourceLabel }}<span v-if="formalStoryboardSummary"> · {{ formalStoryboardSummary }}</span
><span v-if="quality.loading"> · 正在读取当前质量审核…</span>
</p>
<div v-if="!isInitialEmpty" class="result-toolbar tabs-toolbar">
<NTabs v-model:value="tab" class="workspace-tabs" type="line" size="small" aria-label="拆解结果"