feat: 过期首帧重生成默认替换主图

This commit is contained in:
GouJ
2026-09-01 14:47:37 +08:00
parent e65077a57f
commit 1aae80d730
@@ -4,8 +4,14 @@ import { AppDialog } from '../../../components/ui'
import { validOptionalSize } from '../model' import { validOptionalSize } from '../model'
import type { GenerateKeyframeInput, ShotKeyframe } from '../types' import type { GenerateKeyframeInput, ShotKeyframe } from '../types'
/** 单镜头首帧表单;是否替换主首帧必须由用户明确选择。 */ /** 单镜头首帧表单;普通候选仍由用户明确选择,过期主首帧默认替换为新图。 */
const props = defineProps<{ shotId: string; shotTitle: string; keyframes: ShotKeyframe[]; disabled: boolean }>() const props = defineProps<{
shotId: string
shotTitle: string
keyframes: ShotKeyframe[]
disabled: boolean
replacePrimary?: boolean
}>()
const open = defineModel<boolean>('open', { default: false }) const open = defineModel<boolean>('open', { default: false })
const emit = defineEmits<{ generate: [input: GenerateKeyframeInput] }>() const emit = defineEmits<{ generate: [input: GenerateKeyframeInput] }>()
const width = ref<number | ''>('') const width = ref<number | ''>('')
@@ -16,11 +22,11 @@ const hasPrimary = computed(() => props.keyframes.some(item => item.isPrimary &&
const sizeValid = computed(() => validOptionalSize(width.value, height.value)) const sizeValid = computed(() => validOptionalSize(width.value, height.value))
const canSubmit = computed(() => !props.disabled && sizeValid.value && confirmed.value) const canSubmit = computed(() => !props.disabled && sizeValid.value && confirmed.value)
/** 切换镜头或重新打开时清空费用确认,避免沿用上个镜头的覆盖选择。 */ /** 切换镜头或重新打开时清空费用确认;过期首帧默认让新结果成为 Primary。 */
function reset() { function reset() {
width.value = '' width.value = ''
height.value = '' height.value = ''
setPrimary.value = !hasPrimary.value setPrimary.value = !!props.replacePrimary || !hasPrimary.value
confirmed.value = false confirmed.value = false
} }
watch([() => props.shotId, open], reset, { immediate: true }) watch([() => props.shotId, open], reset, { immediate: true })
@@ -41,9 +47,12 @@ function submit() {
<template> <template>
<AppDialog <AppDialog
v-model:open="open" v-model:open="open"
:title="`生成首帧 · ${shotTitle}`" :title="`${replacePrimary ? '重新生成主首帧' : '生成首帧'} · ${shotTitle}`"
description="依据视觉风格、GenerationSpec 和主体主参考图编译首帧提示词,并调用 Seedream。" description="依据视觉风格、GenerationSpec 和主体主参考图编译首帧提示词,并调用 Seedream。"
> >
<p v-if="replacePrimary" class="alert mt-5 text-xs">
当前主首帧使用的主体参考资产已经变化新图成功后应设为主首帧旧图会继续保留为历史候选
</p>
<div class="mt-5 grid grid-cols-2 gap-4"> <div class="mt-5 grid grid-cols-2 gap-4">
<label <label
><span class="field-label">宽度可选</span ><span class="field-label">宽度可选</span