diff --git a/src/features/production/ProductionPage.vue b/src/features/production/ProductionPage.vue
index a99840f..5de56ec 100644
--- a/src/features/production/ProductionPage.vue
+++ b/src/features/production/ProductionPage.vue
@@ -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('每镜最多自动修复') }
@@ -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"
>
+
+
+ 输入规划暂不可用,仍可按“全部推荐模式”提交;刷新后可重试规划。
+
+
+
+
request(`${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(`${projectPath(projectId)}/video-input-plans${query}`, { signal })
+ },
+ /** 读取单镜头的确定性输入规划。 */
+ videoInputPlan: (shotId: string, signal?: AbortSignal) =>
+ request(`${shotPath(shotId)}/video-input-plan`, { signal }),
/** 启动项目级严格视频质量流水线;创建后由后端自动完成校验、有限修复与晋升。 */
generateQualityVideos: (projectId: string, input: GenerateQualityVideosInput) =>
request(`${projectPath(projectId)}/videos/generate-quality`, {
diff --git a/src/features/production/components/ShotProductionAssets.vue b/src/features/production/components/ShotProductionAssets.vue
index b577e55..4d6e8aa 100644
--- a/src/features/production/components/ShotProductionAssets.vue
+++ b/src/features/production/components/ShotProductionAssets.vue
@@ -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 }}
-
-
本镜视频提示词
-
{{ savedPrompt.videoPrompt }}
-
- 负向提示词
-
- {{ savedPrompt.negativePrompt }}
-
-
-
- 此提示词已过期,请重新生成后再制作视频。
-
-
-
- 正在读取视频提示词…
-
-
- 尚未生成本镜视频提示词。
-
-
- 提示词读取失败:{{ promptQuery.error.value }}
- 重试
-
+
+
+ {{ videoInputPlan.inputMode === 'omni_reference' ? '全模态参考' : '首帧模式' }}
+
+ {{ videoInputPlan.reasons.join(';') }}
+
+
+ 当前镜头输入规划暂不可用;请先处理视频就绪问题后刷新。
+
当前主视频使用的主首帧或主体参考图已经变化。旧视频仍保留;重新生成完成后,新视频会自动接替过期主视频。
@@ -438,47 +427,6 @@ async function inspectSpecs() {
{{ issueLabel(issue.code) }}:{{ issue.reason }}
-
-
-
当前视频生成素材引用
-
- 主首帧 1 张 · 主体参考图 {{ currentVideoInput.references.length }} 张
-
-
- 以下是当前镜头的生成输入;已生成的视频可能使用更早的素材。
-
-
- 正在读取视频生成素材…
-
-
-
当前生成规格尚未就绪,请检查视频提示词、主首帧与主体参考图。
-
{{ videoInputQuery.error.value }}
-
重新读取
-
-
+
-
+
主视频
@@ -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];
}
diff --git a/src/features/production/types.ts b/src/features/production/types.ts
index f598ae7..86d12e6 100644
--- a/src/features/production/types.ts
+++ b/src/features/production/types.ts
@@ -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
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
failures: { shotId: string; error: string }[]
+ inputPlans?: VideoInputPlan[]
candidateIds: string[]
}
diff --git a/src/features/production/useProduction.ts b/src/features/production/useProduction.ts
index a57faf0..939fc8e 100644
--- a/src/features/production/useProduction.ts
+++ b/src/features/production/useProduction.ts
@@ -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(1)
const videoLimit = ref(1)
const videoRepairAttempts = ref(2)
+ const videoInputMode = ref('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,
diff --git a/src/features/workflows/WorkflowExecutionPanel.vue b/src/features/workflows/WorkflowExecutionPanel.vue
index 8aa8205..b23c770 100644
--- a/src/features/workflows/WorkflowExecutionPanel.vue
+++ b/src/features/workflows/WorkflowExecutionPanel.vue
@@ -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
+}
@@ -35,6 +60,7 @@ const videoQuality = computed(() => props.execution?.workflowName === 'video-qua
{{ executionStageLabel(execution.stage) }} · 更新于 {{ formatDate(execution.updatedAt) }}
+ 范围:{{ scopeLabel }}
props.execution?.workflowName === 'video-qua
{{ result.exhausted ?? 0 }} · 模型失败 {{ result.providerFailed ?? 0 }} · 提交失败
{{ result.submissionFailed ?? 0 }}
+
+ 输入规划:首帧模式 {{ inputPlanCounts.firstFrame }} · 全模态参考
+ {{ inputPlanCounts.omniReference }}
+
共 {{ result.total ?? execution.total }} · 生成 {{ result.generated ?? execution.current }} · 跳过
{{ result.skipped ?? 0 }} · 阻塞 {{ result.blocked ?? 0 }} · 失败 {{ result.failed ?? 0 }}
diff --git a/tests/features/production/production.test.ts b/tests/features/production/production.test.ts
index b8faa24..20531e9 100644
--- a/tests/features/production/production.test.ts
+++ b/tests/features/production/production.test.ts
@@ -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().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,