fix(short-drama-agent-front): 修复首帧当前质量展示

This commit is contained in:
GJ committed 2026-11-07 21:58:23 +08:00
1 parent 13efe5b786
commit 8674ba0c83
18 files changed
+679 -137

No files matched your search

@@ -6,8 +6,7 @@ import { productionMessage } from '../production-messages'
import { useKeyframeVision } from '../keyframe-vision'
import { computed, ref, watch } from 'vue'
import SourceReviewDrawer from './SourceReviewDrawer.vue'
import { useQuery } from '../../../composables/useQuery'
import { qualityApi } from '../quality-api'
import { useEffectiveKeyframeQuality, effectiveQualityLabels } from '../effective-keyframe-quality'
import { NButton, NTag } from 'naive-ui'
import { AssetImage, AssetOpenLink, StatusBadge } from '../../../components/ui'
import { formatDate } from '../../../lib/format'
@@ -69,23 +68,16 @@ watch(
)
/** 画幅不符的历史图保留浏览和只读审核记录。 */
const wrongCanvas = computed(() => props.item.canvasDiagnosis?.status === 'mismatch')
/** 质量状态以数据库为准;会话内检查仅在历史状态未知时兜底。 */
/** 查询范围包含项目及来源证据,切换立即取消旧请求。 */
const reviewKey = computed(() =>
props.item.status === 'completed' ? JSON.stringify([props.shotId, props.item.id, props.reviewRevision ?? 0]) : ''
props.item.status === 'completed'
? JSON.stringify([props.shotId, props.item.id, props.projectId, props.reviewRevision ?? 0, props.item])
: ''
)
const reviewQuery = useQuery(reviewKey, (value, signal) => {
if (!value) return Promise.resolve(null)
const [shotId, keyframeId] = JSON.parse(value) as [string, string, number]
return qualityApi.keyframeQualityReview(shotId, keyframeId, signal)
})
const effectiveStatus = computed(() => reviewQuery.data.value?.effectiveQualityStatus ?? 'unknown')
/** 其余未达可用门禁的独立质量状态。 */
const reviewLabels: Record<string, string> = {
stale: '审核来源过期',
blocked: '质量受阻',
insufficient_evidence: '审核证据不足',
unknown: '质量待确认'
}
/** 所有质量徽标使用当前有效质量。 */
const reviewQuery = useEffectiveKeyframeQuality(reviewKey, vision)
/** 当前有效质量,不使用会话内历史校验兜底。 */
const effectiveStatus = reviewQuery.status
/** 旧来源或已损坏的输入证据不能被会话中的历史通过覆盖。 */
const isPassed = computed(
() =>
@@ -97,6 +89,11 @@ const isPassed = computed(
props.item.inputSnapshotStatus !== 'invalid' &&
(effectiveStatus.value === 'passed' || effectiveStatus.value === 'manual_accepted')
)
/** 独立来源审核变化后同步当前候选和外层列表。 */
function onSourceChanged() {
void reviewQuery.refresh()
emit('settled')
}
/** 晋升入口只接受持久化通过和已结算审核。 */
const canSelect = computed(
() =>
@@ -142,21 +139,11 @@ const canSelect = computed(
<NTag v-else-if="effectiveStatus === 'needs_review'" size="small" type="warning" :bordered="false"
>待人工复核</NTag
>
<NTag
v-else-if="
effectiveStatus === 'failed' || (effectiveStatus === 'unknown' && validationPassed === false)
"
size="small"
type="error"
:bordered="false"
<NTag v-else-if="effectiveStatus === 'failed'" size="small" type="error" :bordered="false"
>质量未通过</NTag
>
<NTag
v-else-if="item.status === 'completed' && effectiveStatus !== 'passed'"
size="small"
:bordered="false"
>
{{ reviewLabels[effectiveStatus] ?? '质量待确认' }}
<NTag v-else-if="item.status === 'completed'" size="small" :bordered="false">
{{ effectiveQualityLabels[effectiveStatus] }}
</NTag>
<NTag v-if="item.source === 'provider_variant'" size="small" :bordered="false">视频参考图</NTag>
<NTag v-if="item.isPrimary && stale" size="small" type="warning" :bordered="false">已过期</NTag>
@@ -267,5 +254,6 @@ const canSelect = computed(
:project-id="projectId"
:shot-id="shotId"
:keyframe-id="item.id"
@changed="onSourceChanged"
/>
</template>