feat: 接入视频输入规划与任务筛选

This commit is contained in:
GouJ committed 2026-09-24 17:04:39 +08:00
1 parent 9747a8f0ab
commit 2c3e72ae9a
7 files changed
+264 -96

No files matched your search

+86 -5
View File
@@ -59,6 +59,7 @@ const {
promptLimit,
videoLimit,
videoRepairAttempts,
videoInputMode,
keyframeValid,
promptValid,
videoQualityValid,
@@ -102,6 +103,31 @@ const episodePromptReadiness = computed(() => {
blocked: items.filter(item => item.status === 'blocked').length
}
})
const episodeVideoReadiness = computed(() => {
const source = query.data.value?.videos
if (!source) return undefined
const items = source.items.filter(item => item.episodeNo === episodeNo.value)
return {
...source,
items,
total: items.length,
ready: items.filter(item => item.status === 'ready').length,
skipped: items.filter(item => item.status === 'skipped').length,
inProgress: items.filter(item => item.status === 'in_progress').length,
blocked: items.filter(item => item.status === 'blocked').length
}
})
const inputPlan = computed(() => query.data.value?.videoInputPlans)
const selectedPlanCount = computed(() => {
if (videoInputMode.value === 'first_frame') return inputPlan.value?.firstFrameCount ?? 0
if (videoInputMode.value === 'omni_reference') return inputPlan.value?.omniReferenceCount ?? 0
return inputPlan.value?.readyCount ?? episodeVideoReadiness.value?.ready ?? 0
})
const videoInputModeLabel = computed(() => {
if (videoInputMode.value === 'first_frame') return '首帧模式'
if (videoInputMode.value === 'omni_reference') return '全模态参考'
return '全部推荐模式'
})
const stages = computed(() => {
const data = query.data.value
return [
@@ -131,8 +157,8 @@ const stages = computed(() => {
title: '视频成片',
description: '生成质量候选,完成后自动校验;失败时有限修复,通过后才晋升主视频。',
icon: Film,
data: data?.videos,
done: data?.videos.skipped ?? 0,
data: episodeVideoReadiness.value,
done: episodeVideoReadiness.value?.skipped ?? 0,
action: force.value
? '新增项目质量视频候选'
: staleVideos.value > 0
@@ -216,7 +242,11 @@ const keyframeRules = {
keyframeHeight: dimensionRules.height
}
const promptRules = { promptLimit: integerRule('本批镜头上限') }
const videoModel = computed(() => ({ videoLimit: videoLimit.value, videoRepairAttempts: videoRepairAttempts.value }))
const videoModel = computed(() => ({
videoInputMode: videoInputMode.value,
videoLimit: videoLimit.value,
videoRepairAttempts: videoRepairAttempts.value
}))
const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairAttempts: integerRule('每镜最多自动修复') }
</script>
@@ -471,14 +501,15 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
(stage.key === 'prompts' && !promptValid) ||
(stage.key === 'keyframes' && !keyframeValid) ||
(stage.key === 'videos' && !videoQualityValid) ||
(stage.key === 'videos' && !selectedPlanCount) ||
!(stage.data?.ready ?? 0)
"
acknowledgement
:description="
stage.key === 'videos'
? staleVideos && !force
? `当前存在过期主视频,非覆盖模式只会为其中至多 ${videoLimit || '—'} 个镜头启动严格质量流水线;候选自动校验并有限修复,通过后才接替旧主视频。`
: `只为至多 ${videoLimit || '—'} 个就绪镜头启动严格质量流水线。任务创建后由后端自动校验,最多修复 ${videoRepairAttempts || '—'} 次,通过后才晋升主视频。`
? `只处理第 ${episodeNo} 集的${videoInputModeLabel},其中至多 ${videoLimit || '—'} 个过期镜头会启动严格质量流水线;通过后才接替旧主视频。`
: `只处理第 ${episodeNo} 集的${videoInputModeLabel},本批至多 ${videoLimit || '—'} 镜。后端最多自动修复 ${videoRepairAttempts || '—'} 次,通过后才晋升主视频。`
: stage.key === 'keyframes'
? `处理缺失或过期主首帧。过期首帧成功后自动接替旧主图(覆盖模式也如此),其余已有主图只新增候选。本批上限:${keyframeLimit || '不限制'};尺寸:${keyframeWidth && keyframeHeight ? `${keyframeWidth} × ${keyframeHeight}` : '后端默认'}。`
: `只处理第 ${episodeNo} 集中通过就绪检查的镜头,本批最多 ${promptLimit || '—'} 镜;覆盖模式会重写已有提示词。`
@@ -551,6 +582,47 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
validate-on-change
class="mt-4 grid gap-3"
>
<div class="video-input-plan-summary" aria-label="视频输入规划">
<div>
<span>首帧模式</span>
<strong>{{ inputPlan?.firstFrameCount ?? 0 }}</strong>
</div>
<div>
<span>全模态参考</span>
<strong>{{ inputPlan?.omniReferenceCount ?? 0 }}</strong>
</div>
</div>
<NAlert
v-if="query.data.value?.videoInputPlansError"
type="warning"
:show-icon="false"
class="text-xs"
>
输入规划暂不可用,仍可按“全部推荐模式”提交;刷新后可重试规划。
</NAlert>
<NFormItem path="videoInputMode" label="输入规划范围">
<NSelect
v-model:value="videoInputMode"
:disabled="operation.pending"
:options="[
{
label: `全部推荐模式(${inputPlan?.readyCount ?? 0})`,
value: 'all'
},
{
label: `首帧模式(${inputPlan?.firstFrameCount ?? 0})`,
value: 'first_frame',
disabled: !inputPlan
},
{
label: `全模态参考(${inputPlan?.omniReferenceCount ?? 0})`,
value: 'omni_reference',
disabled: !inputPlan
}
]"
aria-label="视频输入规划范围"
/>
</NFormItem>
<NFormItem path="videoLimit" label="本批镜头上限"
><NInputNumber
v-model:value="videoLimit"
@@ -848,6 +920,15 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
.production-status-grid dd {
@apply mt-[5px] text-[13px] font-mono;
}
.video-input-plan-summary {
@apply grid grid-cols-2 gap-2;
}
.video-input-plan-summary div {
@apply flex items-center justify-between gap-2 p-2.5 bg-(--app-subtle) text-[11px] text-muted;
}
.video-input-plan-summary strong {
@apply font-mono text-xs text-(--app-text);
}
.production-status-grid {
@apply grid grid-cols-[repeat(5,_minmax(0,_1fr))] gap-2.5;
}
+12
View File
@@ -9,6 +9,7 @@ import type {
KeyframeGenerationPreview,
KeyframeSpec,
ProjectVideoStatus,
ProjectVideoInputPlan,
PromptReadiness,
ProductionPipelineResult,
ProductionPlan,
@@ -22,6 +23,7 @@ import type {
VideoQualityBatchResult,
VideoQualityConfig,
VideoGenerationSpec,
VideoInputPlan,
VideoReadiness,
ProjectAssemblyReadiness,
EpisodeAssemblyResult
@@ -96,6 +98,16 @@ export const productionApi = {
}),
videoReadiness: (projectId: string, force: boolean, signal?: AbortSignal) =>
request<VideoReadiness>(`${projectPath(projectId)}/videos/readiness?force=${force}`, { signal }),
/** 预览当前项目或剧集的推荐视频输入模式,不创建 Provider 任务。 */
videoInputPlans: (projectId: string, episodeNo?: number, signal?: AbortSignal) => {
const params = new URLSearchParams()
if (episodeNo) params.set('episodeNo', String(episodeNo))
const query = params.size ? `?${params}` : ''
return request<ProjectVideoInputPlan>(`${projectPath(projectId)}/video-input-plans${query}`, { signal })
},
/** 读取单镜头的确定性输入规划。 */
videoInputPlan: (shotId: string, signal?: AbortSignal) =>
request<VideoInputPlan>(`${shotPath(shotId)}/video-input-plan`, { signal }),
/** 启动项目级严格视频质量流水线;创建后由后端自动完成校验、有限修复与晋升。 */
generateQualityVideos: (projectId: string, input: GenerateQualityVideosInput) =>
request<VideoQualityBatchResult>(`${projectPath(projectId)}/videos/generate-quality`, {
@@ -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'
@@ -54,34 +54,37 @@ const key = computed(() => props.shot.shotId)
const query = usePolling(
key,
async (shotId, signal) => {
const [keyframes, videos, qualityState] = await Promise.all([
const [keyframes, videos, qualityState, inputPlanState] = await Promise.all([
productionApi.listKeyframes(shotId, signal),
productionApi.listVideos(shotId, signal),
productionApi
.videoQualityStatus(shotId, signal)
.then(data => ({ data, error: '' }))
.catch(cause => ({ data: null, error: errorMessage(cause) })),
productionApi
.videoInputPlan(shotId, signal)
.then(data => ({ data, error: '' }))
.catch(cause => ({ data: null, error: errorMessage(cause) }))
])
if (keyframes.some(item => item.shotId !== shotId) || videos.some(item => item.shotId !== shotId))
throw new Error('资产记录与当前镜头不匹配,请刷新后重试。')
const qualityStatus = qualityState.data?.shotId === shotId ? qualityState.data : null
return { keyframes, videos, qualityStatus, qualityStatusError: qualityState.error }
const inputPlan = inputPlanState.data?.shotId === shotId ? inputPlanState.data : null
return {
keyframes,
videos,
qualityStatus,
qualityStatusError: qualityState.error,
inputPlan,
inputPlanError: inputPlanState.error
}
},
false
)
/** 单独读取已保存的提示词,查询失败不影响首帧和视频资产展示。 */
const promptQuery = usePolling(key, (shotId, signal) => storyboardApi.videoPrompt(shotId, signal), false)
const savedPrompt = computed(() =>
promptQuery.data.value?.shotId === key.value ? promptQuery.data.value : null
)
/** 当前视频生成规格的首帧和主体参考图,独立查询避免影响资产列表。 */
const videoInputQuery = usePolling(key, (shotId, signal) => productionApi.videoGenerationSpec(shotId, signal), false)
const currentVideoInput = computed(() =>
videoInputQuery.data.value?.shotId === key.value ? videoInputQuery.data.value : null
)
const keyframes = computed(() => query.data.value?.keyframes ?? [])
const videos = computed(() => query.data.value?.videos ?? [])
const videoQualityStatus = computed(() => query.data.value?.qualityStatus ?? null)
const videoInputPlan = computed(() => query.data.value?.inputPlan ?? null)
const currentKeyframe = computed(() => primaryKeyframe(keyframes.value))
const currentVideo = computed(() => primaryVideo(videos.value))
const activeVideo = computed(() => videos.value.find(isActiveVideo))
@@ -163,7 +166,7 @@ function safeVideoUrl(value: string | null): string | null {
/** 重新读取单镜头资产,并通知父页刷新项目就绪状态。 */
async function refreshAll() {
await Promise.all([query.refresh(), promptQuery.refresh(), videoInputQuery.refresh()])
await query.refresh()
emit('changed')
}
@@ -325,29 +328,6 @@ async function inspectSpecs() {
{{ issueLabel(issue.code) }}:{{ issue.reason }}
</li>
</ul>
<div v-if="savedPrompt?.videoPrompt" class="surface-inset mt-4 p-4" aria-label="本镜视频提示词">
<p class="text-xs font-medium">本镜视频提示词</p>
<p class="mt-3 whitespace-pre-wrap break-words text-sm leading-6">{{ savedPrompt.videoPrompt }}</p>
<template v-if="savedPrompt.negativePrompt">
<p class="mt-4 text-xs font-medium">负向提示词</p>
<p class="mt-2 whitespace-pre-wrap break-words text-xs leading-6 text-muted">
{{ savedPrompt.negativePrompt }}
</p>
</template>
<p v-if="promptReadiness?.stalePrompt" class="mt-3 text-xs text-danger">
此提示词已过期,请重新生成后再制作视频。
</p>
</div>
<p v-else-if="promptQuery.loading.value" role="status" class="mt-4 text-xs text-muted">
正在读取视频提示词…
</p>
<p v-else-if="!promptQuery.error.value" class="mt-4 text-xs text-muted">
尚未生成本镜视频提示词。
</p>
<NAlert v-if="promptQuery.error.value" role="alert" type="warning" :show-icon="false" class="mt-4 text-xs">
提示词读取失败:{{ promptQuery.error.value }}
<NButton text size="small" @click="promptQuery.refresh">重试</NButton>
</NAlert>
<div class="production-stage-actions">
<ConfirmAction
:label="promptReadiness?.status === 'skipped' ? '重新生成本镜提示词' : '生成本镜提示词'"
@@ -430,6 +410,15 @@ async function inspectSpecs() {
:label="videoStale ? '主视频已过期' : productionStatusLabel(videoReadiness.status)"
/>
</div>
<div v-if="videoInputPlan" class="mt-3 flex flex-wrap items-center gap-2 text-xs">
<NTag size="small" :bordered="false" type="info">
{{ videoInputPlan.inputMode === 'omni_reference' ? '全模态参考' : '首帧模式' }}
</NTag>
<span class="text-muted">{{ videoInputPlan.reasons.join(';') }}</span>
</div>
<NAlert v-else-if="query.data.value?.inputPlanError" type="warning" :show-icon="false" class="mt-3 text-xs">
当前镜头输入规划暂不可用;请先处理视频就绪问题后刷新。
</NAlert>
<NAlert v-if="videoStale" role="status" type="info" :show-icon="false" class="mt-3 text-xs">
当前主视频使用的主首帧或主体参考图已经变化。旧视频仍保留;重新生成完成后,新视频会自动接替过期主视频。
</NAlert>
@@ -438,47 +427,6 @@ async function inspectSpecs() {
{{ issueLabel(issue.code) }}:{{ issue.reason }}
</li>
</ul>
<section class="surface-inset mt-4 p-4" aria-label="当前视频生成素材引用">
<div class="flex flex-wrap items-center justify-between gap-2">
<h6 class="text-xs font-medium">当前视频生成素材引用</h6>
<span v-if="currentVideoInput" class="text-[11px] text-muted">
主首帧 1 张 · 主体参考图 {{ currentVideoInput.references.length }} 张
</span>
</div>
<p class="mt-2 text-xs text-muted">以下是当前镜头的生成输入;已生成的视频可能使用更早的素材。</p>
<div v-if="currentVideoInput" class="video-input-grid mt-4">
<article class="min-w-0 bg-(--app-subtle)">
<AssetImage :src="currentVideoInput.providerInputKeyframe.imageUrl"
:alt="`镜头 ${shot.shotNo} 视频输入首帧`" preview object-fit="contain" />
<div class="min-w-0 p-2 text-center text-xs">
<p class="font-medium">视频输入首帧</p>
<p class="mt-1 text-[11px] text-muted">
{{ currentVideoInput.providerInputKeyframe.source === 'provider_variant' ? '模型专用变体' : '当前主首帧' }}
</p>
</div>
</article>
<article v-for="reference in currentVideoInput.references"
:key="`${reference.subjectId}:${reference.imageId}`" class="min-w-0 bg-(--app-subtle)">
<AssetImage :src="reference.imageUrl" :alt="`${reference.subjectName} ${reference.subjectFormName} 参考图`"
preview object-fit="contain" />
<div class="min-w-0 p-2 text-center text-xs">
<p class="truncate font-medium" :title="reference.subjectName">{{ reference.subjectName }}</p>
<p class="mt-1 truncate text-[11px] text-muted" :title="reference.subjectFormName">
{{ reference.subjectFormName }} · {{ reference.subjectRef }}
</p>
</div>
</article>
</div>
<p v-else-if="videoInputQuery.loading.value" role="status" class="mt-4 text-xs text-muted">
正在读取视频生成素材…
</p>
<div v-else class="mt-4 text-xs text-muted">
<p>当前生成规格尚未就绪,请检查视频提示词、主首帧与主体参考图。</p>
<p v-if="videoInputQuery.error.value" class="mt-2 break-words">{{ videoInputQuery.error.value }}</p>
<NButton v-if="videoInputQuery.error.value" text size="small" class="mt-2"
@click="videoInputQuery.refresh">重新读取</NButton>
</div>
</section>
<NAlert
v-if="videoQualityStatus && videoQualityStatus.status !== 'not_started'"
:type="
@@ -499,7 +447,7 @@ async function inspectSpecs() {
。请检查候选视频和校验结果,调整提示词或参考资产后再重新生成。
</template>
</NAlert>
<div v-if="videos.length" class="video-grid mt-4">
<div v-if="videos.length" class="mt-4 space-y-3">
<article v-for="item in videos" :key="item.id" class="video-record">
<video
v-if="item.status === 'completed' && safeVideoUrl(item.videoUrl)"
@@ -508,7 +456,7 @@ async function inspectSpecs() {
preload="metadata"
class="production-video"
></video>
<div class="min-w-0 p-3">
<div class="min-w-0 flex-1 p-4">
<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>
@@ -721,21 +669,24 @@ async function inspectSpecs() {
0 0 0 1px rgb(0 0 0 / 55%),
0 2px 8px rgb(0 0 0 / 35%);
}
.video-input-grid {
@apply grid grid-cols-[repeat(auto-fill,_minmax(min(160px,_100%),_1fr))] gap-3;
}
.video-grid {
@apply grid grid-cols-[repeat(auto-fill,_minmax(min(260px,_100%),_1fr))] gap-3;
}
.video-record {
@apply min-w-0 overflow-hidden rounded-none bg-(--app-subtle);
@apply flex overflow-hidden rounded-none bg-(--app-subtle);
}
.production-video {
@apply block w-full aspect-square bg-[#080808] object-contain;
@apply w-[min(44%,390px)] min-h-[170px] bg-ink object-contain;
}
@media (max-width: 760px) {
.keyframe-grid {
@apply grid-cols-[repeat(2,_minmax(0,_1fr))];
}
.video-record {
@apply block;
}
.production-video {
@apply w-full;
}
}
.production-video {
@apply bg-[#080808];
}
</style>
+39
View File
@@ -65,6 +65,7 @@ export interface KeyframeReadiness extends PromptReadiness {
/** 视频任务就绪检查的逐镜结果。 */
export interface VideoReadinessItem {
shotId: string
episodeNo: number
shotNo: number
status: ProductionReadinessStatus
issues: ProductionIssue[]
@@ -75,6 +76,37 @@ export interface VideoReadinessItem {
providerInputRecovery?: ProviderInputRecoveryStatus | null
}
/** 后端确定性选择的视频模型输入模式。 */
export type VideoInputMode = 'first_frame' | 'omni_reference'
/** 单镜头输入规划;只读预览不会创建模型任务。 */
export interface VideoInputPlan {
shotId: string
inputMode: VideoInputMode
reasons: string[]
metrics: {
characterCount: number
propCount: number
sceneCount: number
referenceCount: number
hasMultipleCharacters: boolean
hasProp: boolean
hasCharacterPropInteraction: boolean
}
}
/** 当前项目或剧集内可生成镜头的输入模式分布。 */
export interface ProjectVideoInputPlan {
projectId: string
provider: string
episodeNo: number | null
projectReadyCount: number
readyCount: number
firstFrameCount: number
omniReferenceCount: number
plans: VideoInputPlan[]
}
/** 视频任务项目级就绪汇总。 */
export interface VideoReadiness {
total: number
@@ -272,7 +304,11 @@ export interface VideoQualityConfig {
export interface GenerateQualityVideosInput extends VideoQualityConfig {
concurrency: number
force: boolean
/** 仅处理当前剧集,避免批量操作误跑全项目。 */
episodeNo?: number
limit?: number
/** 只提交后端 Planner 判定为该模式的镜头。 */
inputMode?: VideoInputMode
}
/** 单镜头严格视频质量任务回执;candidate 只是异步候选,不代表已经通过校验。 */
@@ -291,6 +327,8 @@ export interface VideoQualityBatchResult {
qualityPipeline: Required<VideoQualityConfig>
total: number
readyTargetCount: number
episodeTargetCount?: number
filteredTargetCount?: number
targetCount: number
remainingReady: number
created: number
@@ -300,6 +338,7 @@ export interface VideoQualityBatchResult {
failed: number
readiness: Omit<VideoReadiness, 'total' | 'items'>
failures: { shotId: string; error: string }[]
inputPlans?: VideoInputPlan[]
candidateIds: string[]
}
+21 -3
View File
@@ -8,6 +8,8 @@ import { getOperation, runOperation } from '../workflows/operations'
import { useWorkflowExecution } from '../workflows/execution'
import { productionApi } from './api'
import { getProductionSession, validOptionalSize } from './model'
import type { VideoInputMode } from './types'
import { errorMessage } from '../../lib/http'
/** 项目级生产动作;每次请求都由统一项目锁防止重复提交。 */
export type ProductionCommand = 'prompts' | 'keyframes' | 'videos' | 'retry-videos'
@@ -26,6 +28,7 @@ export function useProduction() {
const promptLimit = ref<number | null>(1)
const videoLimit = ref<number | null>(1)
const videoRepairAttempts = ref<number | null>(2)
const videoInputMode = ref<VideoInputMode | 'all'>('all')
const snapshot = computed(() => breakdownSnapshot(context.checkpoints.value))
const sourceEpisodes = computed(
() => snapshot.value?.storyboardEpisodeShots ?? snapshot.value?.breakdownResult?.storyboardEpisodeShots ?? []
@@ -52,16 +55,28 @@ export function useProduction() {
async (key, signal) => {
const [projectId, number, overwrite] = JSON.parse(key) as [string, number, boolean]
if (!projectId || !number) return null
const [directions, prompts, keyframes, videos, videoStatus] = await Promise.all([
const [directions, prompts, keyframes, videos, videoStatus, videoInputPlanState] = await Promise.all([
storyboardApi.directions(projectId, number, signal),
productionApi.promptReadiness(projectId, overwrite, signal),
productionApi.keyframeReadiness(projectId, overwrite, signal),
productionApi.videoReadiness(projectId, overwrite, signal),
productionApi.projectVideoStatus(projectId, signal)
productionApi.projectVideoStatus(projectId, signal),
productionApi
.videoInputPlans(projectId, number, signal)
.then(data => ({ data, error: '' }))
.catch(cause => ({ data: null, error: errorMessage(cause) }))
])
if (directions.projectId !== projectId || directions.episodeNo !== number)
throw new Error('镜头生产查询返回了不匹配的项目或剧集,请刷新后重试。')
return { directions, prompts, keyframes, videos, videoStatus }
return {
directions,
prompts,
keyframes,
videos,
videoStatus,
videoInputPlans: videoInputPlanState.data,
videoInputPlansError: videoInputPlanState.error
}
},
false
)
@@ -175,7 +190,9 @@ export function useProduction() {
} else if (command === 'videos') {
const started = await productionApi.startQualityVideoExecution(projectId, {
...input,
episodeNo: episodeNo.value,
limit: videoLimit.value ?? undefined,
...(videoInputMode.value === 'all' ? {} : { inputMode: videoInputMode.value }),
maxRepairAttempts: videoRepairAttempts.value ?? 0
})
await videoExecution.track(started.executionId)
@@ -213,6 +230,7 @@ export function useProduction() {
promptLimit,
videoLimit,
videoRepairAttempts,
videoInputMode,
keyframeValid,
promptValid,
videoQualityValid,
@@ -22,6 +22,31 @@ const statusType = computed(() =>
)
const finished = computed(() => ['completed', 'failed'].includes(props.execution?.status ?? ''))
const videoQuality = computed(() => props.execution?.workflowName === 'video-quality')
const scopeLabel = computed(() => {
const metadata = props.execution?.metadata
if (!metadata) return ''
const episode = typeof metadata.episodeNo === 'number' ? `第 ${metadata.episodeNo} 集` : '全项目'
const mode =
metadata.inputModeFilter === 'first_frame'
? '首帧模式'
: metadata.inputModeFilter === 'omni_reference'
? '全模态参考'
: '全部推荐模式'
return videoQuality.value ? `${episode} · ${mode}` : episode
})
const inputPlanCounts = computed(() => {
const plans = result.value.inputPlans
if (!Array.isArray(plans)) return null
return {
firstFrame: plans.filter(plan => isInputMode(plan, 'first_frame')).length,
omniReference: plans.filter(plan => isInputMode(plan, 'omni_reference')).length
}
})
/** 对持久化 JSON 做最小结构校验,避免模板依赖不可信结果字段。 */
function isInputMode(value: unknown, inputMode: string): boolean {
return !!value && typeof value === 'object' && 'inputMode' in value && value.inputMode === inputMode
}
</script>
<template>
@@ -35,6 +60,7 @@ const videoQuality = computed(() => props.execution?.workflowName === 'video-qua
<p v-if="execution" class="mt-2 text-xs text-muted">
{{ executionStageLabel(execution.stage) }} · 更新于 {{ formatDate(execution.updatedAt) }}
</p>
<p v-if="scopeLabel" class="mt-1 text-xs text-muted">范围:{{ scopeLabel }}</p>
</div>
<div class="flex items-center gap-2">
<NButton
@@ -87,6 +113,10 @@ const videoQuality = computed(() => props.execution?.workflowName === 'video-qua
{{ result.exhausted ?? 0 }} · 模型失败 {{ result.providerFailed ?? 0 }} · 提交失败
{{ result.submissionFailed ?? 0 }}
</p>
<p v-if="videoQuality && inputPlanCounts" class="mt-2 text-xs">
输入规划:首帧模式 {{ inputPlanCounts.firstFrame }} · 全模态参考
{{ inputPlanCounts.omniReference }}
</p>
<p v-else class="mt-2 text-xs">
共 {{ result.total ?? execution.total }} · 生成 {{ result.generated ?? execution.current }} · 跳过
{{ result.skipped ?? 0 }} · 阻塞 {{ result.blocked ?? 0 }} · 失败 {{ result.failed ?? 0 }}
@@ -131,7 +131,9 @@ describe('镜头生产数据契约', () => {
await productionApi.startQualityVideoExecution('project/1', {
concurrency: 3,
force: true,
episodeNo: 2,
limit: 2,
inputMode: 'omni_reference',
maxRepairAttempts: 2
})
expect(fetcher.mock.calls[0]?.[0]).toBe('/api/projects/project%2F1/videos/readiness?force=true')
@@ -139,11 +141,46 @@ describe('镜头生产数据契约', () => {
expect(JSON.parse(String(fetcher.mock.calls[1]?.[1]?.body))).toEqual({
concurrency: 3,
force: true,
episodeNo: 2,
limit: 2,
inputMode: 'omni_reference',
maxRepairAttempts: 2
})
})
it('视频输入规划支持当前集预览和单镜头预览', async () => {
const fetcher = vi.fn<typeof fetch>().mockImplementation(async url => {
const path = String(url)
const shotId = path.includes('/storyboard-shots/') ? 'shot-1' : undefined
return new Response(
JSON.stringify({
data: shotId
? {
shotId,
inputMode: 'first_frame',
reasons: ['主体关系简单'],
metrics: {}
}
: {
projectId: 'project/1',
episodeNo: 3,
readyCount: 1,
firstFrameCount: 1,
omniReferenceCount: 0,
plans: []
}
})
)
})
vi.stubGlobal('fetch', fetcher)
await productionApi.videoInputPlans('project/1', 3)
await productionApi.videoInputPlan('shot-1')
expect(fetcher.mock.calls[0]?.[0]).toBe('/api/projects/project%2F1/video-input-plans?episodeNo=3')
expect(fetcher.mock.calls[1]?.[0]).toBe('/api/storyboard-shots/shot-1/video-input-plan')
expect(fetcher.mock.calls[0]?.[1]?.method).toBe('GET')
expect(fetcher.mock.calls[1]?.[1]?.method).toBe('GET')
})
it('所有首帧生成都先成为候选,并要求费用确认', async () => {
wrapper = mount(KeyframeDialog, {
attachTo: document.body,