feat: 按质量结果管理主首帧候选
This commit is contained in:
1 parent
a72d96506a
commit
4298438219
6 files changed
+243
-88
No files matched your search
@@ -3,7 +3,7 @@ import ProviderInputInspector from './ProviderInputInspector.vue'
|
||||
import { NAlert, NButton, NCollapse, NCollapseItem, NTag } from 'naive-ui'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { ExternalLink, ImagePlus, RefreshCw } from '@lucide/vue'
|
||||
import { AssetImage, StatusBadge } from '../../../components/ui'
|
||||
import { StatusBadge } from '../../../components/ui'
|
||||
import { usePolling } from '../../../composables/usePolling'
|
||||
import { mediaAssetUrl } from '../../../lib/assets'
|
||||
import { errorMessage } from '../../../lib/http'
|
||||
@@ -23,12 +23,13 @@ import type {
|
||||
VideoReadinessItem
|
||||
} from '../types'
|
||||
import KeyframeDialog from './KeyframeDialog.vue'
|
||||
import KeyframeCard from './KeyframeCard.vue'
|
||||
import QualityDialog from './QualityDialog.vue'
|
||||
import ActionMenu from '../../../components/ui/ActionMenu.vue'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import ModelCapabilities from './ModelCapabilities.vue'
|
||||
import type { QualityTarget } from '../quality.types'
|
||||
import { sessionVideoValidation } from '../quality'
|
||||
import { sessionKeyframePassed, sessionVideoValidation } from '../quality'
|
||||
|
||||
/** 单镜头生产面板只负责正式资产,不修改上游导演设计与即时状态。 */
|
||||
const props = defineProps<{
|
||||
@@ -72,11 +73,13 @@ watch(
|
||||
{ immediate: true }
|
||||
)
|
||||
const qualityOpen = ref(false)
|
||||
const candidatesOpen = ref(false)
|
||||
const qualityTarget = ref<QualityTarget | null>(null)
|
||||
const specsOpen = ref(false)
|
||||
|
||||
/** 从实际候选打开质量面板,保留单镜头主操作。 */
|
||||
function openQuality(kind: 'keyframe' | 'video', assetId: string) {
|
||||
candidatesOpen.value = false
|
||||
qualityTarget.value = {
|
||||
kind,
|
||||
shotId: props.shot.shotId,
|
||||
@@ -103,9 +106,20 @@ const canGenerateKeyframe = computed(
|
||||
)
|
||||
const canGenerateVideo = computed(
|
||||
() =>
|
||||
!assetBlocked.value && !activeVideo.value && !!props.videoReadiness && props.videoReadiness.issues.length === 0
|
||||
!assetBlocked.value &&
|
||||
!activeVideo.value &&
|
||||
!!props.videoReadiness &&
|
||||
props.videoReadiness.issues.length === 0 &&
|
||||
(!currentKeyframe.value || keyframePassed(currentKeyframe.value.id) !== false)
|
||||
)
|
||||
const keyframeStale = computed(() => !!props.keyframeReadiness?.primaryKeyframeStale)
|
||||
const keyframeCandidates = computed(() =>
|
||||
keyframes.value.filter(item => item.id !== currentKeyframe.value?.id)
|
||||
)
|
||||
/** 质量历史尚无 GET;只消费当前会话中该候选的真实校验结果。 */
|
||||
function keyframePassed(assetId: string) {
|
||||
return sessionKeyframePassed(props.projectId, props.shot.shotId, assetId)
|
||||
}
|
||||
const videoStale = computed(() => !!props.videoReadiness?.primaryVideoStale)
|
||||
|
||||
watch(key, () => {
|
||||
@@ -159,6 +173,7 @@ async function setPrimaryKeyframe() {
|
||||
if (
|
||||
assetBlocked.value ||
|
||||
!keyframeId ||
|
||||
keyframePassed(keyframeId) !== true ||
|
||||
keyframes.value.find(item => item.id === keyframeId)?.source === 'provider_variant'
|
||||
)
|
||||
return
|
||||
@@ -321,70 +336,35 @@ async function inspectSpecs() {
|
||||
{{ issueLabel(issue.code) }}:{{ issue.reason }}
|
||||
</li>
|
||||
</ul>
|
||||
<div v-if="keyframes.length" class="keyframe-grid mt-4">
|
||||
<article v-for="item in keyframes" :key="item.id" class="keyframe-card">
|
||||
<AssetImage
|
||||
:src="item.status === 'completed' ? item.imageUrl : null"
|
||||
:alt="`镜头 ${shot.shotNo} 首帧`"
|
||||
preview
|
||||
:empty-text="item.status === 'failed' ? '首帧生成失败' : '首帧生成中'"
|
||||
/>
|
||||
<div class="p-3">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<StatusBadge :status="item.status" :label="productionStatusLabel(item.status)" />
|
||||
<NTag v-if="item.isPrimary" size="small" :bordered="false">主首帧</NTag>
|
||||
<NTag v-if="item.source === 'provider_variant'" size="small" :bordered="false"
|
||||
>模型输入变体</NTag
|
||||
>
|
||||
<NTag v-if="item.isPrimary && keyframeStale" size="small" :bordered="false">已过期</NTag>
|
||||
<span class="text-[10px] text-muted"
|
||||
>{{ item.width || '—' }} × {{ item.height || '—' }}</span
|
||||
>
|
||||
</div>
|
||||
<p v-if="item.error" class="mt-2 line-clamp-3 text-xs text-danger">{{ item.error }}</p>
|
||||
<p class="mt-2 text-[10px] text-muted">{{ formatDate(item.createdAt) }}</p>
|
||||
<NButton
|
||||
v-if="item.status === 'completed' && item.imageUrl"
|
||||
text
|
||||
size="small"
|
||||
class="mt-2 mr-3"
|
||||
@click="openQuality('keyframe', item.id)"
|
||||
>质量检查</NButton
|
||||
>
|
||||
<NButton
|
||||
v-if="
|
||||
item.status === 'completed' &&
|
||||
item.imageUrl &&
|
||||
item.source !== 'provider_variant' &&
|
||||
!item.isPrimary
|
||||
"
|
||||
:disabled="assetBlocked"
|
||||
@click="confirmingKeyframe = item.id"
|
||||
text
|
||||
size="small"
|
||||
class="mt-2"
|
||||
>
|
||||
设为主首帧
|
||||
</NButton>
|
||||
<NAlert
|
||||
v-if="confirmingKeyframe === item.id"
|
||||
type="info"
|
||||
:show-icon="false"
|
||||
class="mt-2 text-xs"
|
||||
><p>确认让后续视频使用此首帧?已有视频不会自动重生成。</p>
|
||||
<div class="mt-2 flex gap-3">
|
||||
<NButton @click="setPrimaryKeyframe" type="primary">确认切换</NButton>
|
||||
<NButton @click="confirmingKeyframe = ''" text size="small">取消</NButton>
|
||||
</div></NAlert
|
||||
>
|
||||
</div>
|
||||
</article>
|
||||
<div v-if="currentKeyframe" class="keyframe-grid mt-4">
|
||||
<KeyframeCard
|
||||
:item="currentKeyframe"
|
||||
:shot-no="shot.shotNo"
|
||||
:stale="keyframeStale"
|
||||
:blocked="assetBlocked"
|
||||
:validation-passed="keyframePassed(currentKeyframe.id)"
|
||||
:confirming="false"
|
||||
@quality="openQuality('keyframe', currentKeyframe.id)"
|
||||
/>
|
||||
</div>
|
||||
<p v-else class="mt-4 text-xs text-muted">尚无首帧记录。</p>
|
||||
<p v-else class="mt-4 text-xs text-muted">
|
||||
尚无已确认主首帧。请生成候选,完成质量检查后再设为主首帧。
|
||||
</p>
|
||||
<NAlert
|
||||
v-if="currentKeyframe && keyframePassed(currentKeyframe.id) === false"
|
||||
type="error"
|
||||
:show-icon="false"
|
||||
class="mt-3 text-xs"
|
||||
>
|
||||
当前主首帧在本次质量检查中未通过,已阻止继续生成视频。请从候选中选择质量通过的图片。
|
||||
</NAlert>
|
||||
<div class="production-stage-actions">
|
||||
<NButton v-if="keyframeCandidates.length" @click="candidatesOpen = true">
|
||||
管理候选({{ keyframeCandidates.length }})
|
||||
</NButton>
|
||||
<NButton :disabled="!canGenerateKeyframe" @click="keyframeOpen = true"
|
||||
><ImagePlus :size="14" />{{
|
||||
keyframeStale ? '重新生成主首帧' : currentKeyframe ? '再生成一张候选' : '生成首帧'
|
||||
keyframeStale ? '生成替代候选' : currentKeyframe ? '再生成一张候选' : '生成首帧候选'
|
||||
}}</NButton
|
||||
>
|
||||
</div>
|
||||
@@ -561,11 +541,34 @@ async function inspectSpecs() {
|
||||
:disabled="assetBlocked"
|
||||
@changed="refreshAll"
|
||||
/>
|
||||
<AppDialog
|
||||
v-model:open="candidatesOpen"
|
||||
title="首帧候选管理"
|
||||
description="先完成质量检查;只有本会话校验通过的候选才能设为主首帧。"
|
||||
wide
|
||||
>
|
||||
<div v-if="keyframeCandidates.length" class="keyframe-grid">
|
||||
<KeyframeCard
|
||||
v-for="item in keyframeCandidates"
|
||||
:key="item.id"
|
||||
:item="item"
|
||||
:shot-no="shot.shotNo"
|
||||
:stale="false"
|
||||
:blocked="assetBlocked"
|
||||
:validation-passed="keyframePassed(item.id)"
|
||||
:confirming="confirmingKeyframe === item.id"
|
||||
@quality="openQuality('keyframe', item.id)"
|
||||
@select="confirmingKeyframe = item.id"
|
||||
@confirm="setPrimaryKeyframe"
|
||||
@cancel="confirmingKeyframe = ''"
|
||||
/>
|
||||
</div>
|
||||
<p v-else class="text-xs text-muted">暂无其它首帧候选。</p>
|
||||
</AppDialog>
|
||||
<KeyframeDialog
|
||||
v-model:open="keyframeOpen"
|
||||
:shot-id="shot.shotId"
|
||||
:shot-title="shot.title"
|
||||
:keyframes="keyframes"
|
||||
:replace-primary="keyframeStale"
|
||||
:disabled="!canGenerateKeyframe"
|
||||
@generate="generateKeyframe"
|
||||
@@ -592,11 +595,17 @@ async function inspectSpecs() {
|
||||
@apply grid grid-cols-[repeat(auto-fill,_minmax(180px,_1fr))] gap-3;
|
||||
}
|
||||
.keyframe-card {
|
||||
@apply overflow-hidden rounded-none bg-(--app-subtle);
|
||||
@apply relative overflow-hidden rounded-none bg-(--app-subtle);
|
||||
}
|
||||
.keyframe-card .asset-image {
|
||||
@apply aspect-video rounded-none;
|
||||
}
|
||||
.keyframe-image {
|
||||
@apply relative;
|
||||
}
|
||||
.primary-keyframe-mark {
|
||||
@apply absolute top-2 left-2 z-1 flex size-7 items-center justify-center bg-success text-white;
|
||||
}
|
||||
.video-record {
|
||||
@apply flex overflow-hidden rounded-none bg-(--app-subtle);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user