feat: 同步镜头首帧与视频生产工作区

This commit is contained in:
GouJ committed 2026-08-31 15:02:31 +08:00
1 parent 669f4d9df0
commit aeb3ce2986
16 files changed
+1802 -5

No files matched your search

@@ -0,0 +1,77 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { AppDialog } from '../../../components/ui'
import { validOptionalSize } from '../model'
import type { GenerateKeyframeInput, ShotKeyframe } from '../types'
/** 单镜头首帧表单;是否替换主首帧必须由用户明确选择。 */
const props = defineProps<{ shotId: string; shotTitle: string; keyframes: ShotKeyframe[]; disabled: boolean }>()
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 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)
/** 切换镜头或重新打开时清空费用确认,避免沿用上个镜头的覆盖选择。 */
function reset() {
width.value = ''
height.value = ''
setPrimary.value = !hasPrimary.value
confirmed.value = false
}
watch([() => props.shotId, open], reset, { immediate: true })
/** 只发送后端允许的字段,未填写尺寸时使用 Provider 默认值。 */
function submit() {
if (!canSubmit.value) return
emit('generate', {
provider: 'seedream',
...(width.value === '' ? {} : { width: width.value, height: height.value as number }),
setPrimary: setPrimary.value
})
open.value = false
reset()
}
</script>
<template>
<AppDialog
v-model:open="open"
:title="`生成首帧 · ${shotTitle}`"
description="依据视觉风格、GenerationSpec 和主体主参考图编译首帧提示词,并调用 Seedream。"
>
<div class="mt-5 grid grid-cols-2 gap-4">
<label
><span class="field-label">宽度(可选)</span
><input v-model.number="width" class="input" type="number" min="1"
/></label>
<label
><span class="field-label">高度(可选)</span
><input v-model.number="height" class="input" type="number" min="1"
/></label>
</div>
<p v-if="!sizeValid" class="mt-2 text-xs text-danger">宽高需要同时留空,或同时填写正整数。</p>
<label class="mt-5 flex items-start gap-3 text-sm leading-6">
<input v-model="setPrimary" class="mt-1 accent-accent" type="checkbox" />生成成功后设为当前主首帧
</label>
<p v-if="hasPrimary && setPrimary" class="alert mt-3 text-xs">
当前已有主首帧。新图成功后将成为视频生成使用的首帧,旧图仍保留为候选。
</p>
<label class="mt-5 flex items-start gap-3 text-sm leading-6">
<input
id="confirm-keyframe-cost"
v-model="confirmed"
class="mt-1 accent-accent"
type="checkbox"
/>我已确认调用 Seedream 可能产生费用,且当前没有相同镜头的生图任务。
</label>
<div class="dialog-footer mt-6">
<button class="button button-secondary" @click="open = false">取消</button>
<button class="button button-primary" :disabled="!canSubmit" @click="submit">确认生成首帧</button>
</div>
</AppDialog>
</template>