feat: 按质量结果管理主首帧候选

This commit is contained in:
GouJ committed 2026-09-23 11:35:53 +08:00
1 parent a72d96506a
commit 4298438219
6 files changed
+243 -88

No files matched your search

@@ -8,13 +8,12 @@ import { AppDialog } from '../../../components/ui'
import { errorMessage } from '../../../lib/http'
import { productionApi } from '../api'
import { validOptionalSize } from '../model'
import type { GenerateKeyframeInput, KeyframeGenerationPreview, ShotKeyframe } from '../types'
import type { GenerateKeyframeInput, KeyframeGenerationPreview } from '../types'
/** 单镜头首帧表单;普通候选仍由用户明确选择,过期主首帧默认替换为新图。 */
/** 单镜头首帧表单;所有新图先生成候选,通过质量检查后再人工晋升。 */
const props = defineProps<{
shotId: string
shotTitle: string
keyframes: ShotKeyframe[]
disabled: boolean
replacePrimary?: boolean
}>()
@@ -22,20 +21,17 @@ const open = defineModel<boolean>('open', { default: false })
const emit = defineEmits<{ generate: [input: GenerateKeyframeInput] }>()
const width = ref<number | ''>('')
const height = ref<number | ''>('')
const setPrimary = ref(false)
const confirmed = ref(false)
const preview = ref<KeyframeGenerationPreview | null>(null)
const previewError = ref('')
const previewPending = ref(false)
const hasPrimary = computed(() => props.keyframes.some(item => item.isPrimary && item.status === 'completed'))
const sizeValid = computed(() => validOptionalSize(width.value, height.value))
const canSubmit = computed(() => !props.disabled && sizeValid.value && confirmed.value)
/** 切换镜头或重新打开时清空费用确认;过期首帧默认让新结果成为 Primary。 */
/** 切换镜头或重新打开时清空费用确认;新图一律先作为候选。 */
function reset() {
width.value = ''
height.value = ''
setPrimary.value = !!props.replacePrimary || !hasPrimary.value
confirmed.value = false
preview.value = null
previewError.value = ''
@@ -48,7 +44,7 @@ function submit() {
if (!canSubmit.value) return
emit('generate', {
...(width.value === '' ? {} : { width: width.value, height: height.value as number }),
setPrimary: setPrimary.value
setPrimary: false
})
open.value = false
reset()
@@ -77,8 +73,8 @@ async function loadPreview() {
<template>
<AppDialog
v-model:open="open"
:title="`${replacePrimary ? '重新生成主首帧' : '生成首帧'} · ${shotTitle}`"
description="依据视觉风格、GenerationSpec 和主体主参考图编译首帧提示词,并调用 图片模型。"
:title="`${replacePrimary ? '生成替代候选' : '生成首帧候选'} · ${shotTitle}`"
description="新图先作为候选;完成质量检查并通过后,才能设为主首帧。"
>
<AppForm
:model="formModel"
@@ -152,12 +148,6 @@ async function loadPreview() {
></NInputNumber
></NFormItem>
</div>
<NCheckbox v-model:checked="setPrimary" class="mt-5 flex items-start gap-3 text-sm leading-6"
>生成成功后设为当前主首帧
</NCheckbox>
<NAlert v-if="hasPrimary && setPrimary" type="info" :show-icon="false" class="mt-3 text-xs">
当前已有主首帧。新图成功后将成为视频生成使用的首帧,旧图仍保留为候选。
</NAlert>
<NCheckbox
id="confirm-keyframe-cost"
v-model:checked="confirmed"