feat(short-drama-agent-front): 完善视觉资产审核流程

This commit is contained in:
GJ committed 2026-11-04 14:09:21 +08:00
1 parent dc8bb17a23
commit b88ad8770f
45 files changed
+2258 -352

No files matched your search

+1 -1
View File
@@ -77,7 +77,7 @@ const latestVideoTaskLabel = computed(() =>
: `最近视频任务:${productionStatusLabel(videoStatusItem.value?.status ?? 'not_started')}`
)
/** 首帧质量任务在关闭弹窗后仍可观察,刷新页面后恢复持久化句柄。 */
const keyframeQualityExecution = useWorkflowExecution(id, 'keyframe-quality')
const keyframeQualityExecution = useWorkflowExecution(id, 'keyframe-quality', { discover: true })
/**
* 将首帧质量启动句柄交给页面级观察器,始终保存当前原项目归属。
+17 -1
View File
@@ -159,9 +159,14 @@ export const productionApi = {
keyframeSpec: (shotId: string, signal?: AbortSignal) =>
request<KeyframeSpec>(`${shotPath(shotId)}/keyframe-spec`, { signal }),
/** 按本次请求选择的图片模型与参数预览最终输入,不创建首帧任务。 */
previewKeyframe: (shotId: string, input: Pick<GenerateKeyframeInput, 'provider' | 'generationOptions'>) =>
previewKeyframe: (
shotId: string,
input: Pick<GenerateKeyframeInput, 'provider' | 'generationOptions'>,
signal?: AbortSignal
) =>
request<KeyframeGenerationPreview>(`${shotPath(shotId)}/keyframe/preview`, {
method: 'POST',
signal,
body: input
}),
generateKeyframe: (shotId: string, input: GenerateKeyframeInput) =>
@@ -170,6 +175,17 @@ export const productionApi = {
body: input,
timeoutMs: 0
}),
/**
* 仅恢复已有首帧的下载,不重新发起生成。
* @param shotId 当前镜头
* @param keyframeId 已保存结果的候选
* @returns 同一候选更新后的记录
*/
recoverSavedKeyframe: (shotId: string, keyframeId: string) =>
request<ShotKeyframe>(`${shotPath(shotId)}/keyframes/${encodeURIComponent(keyframeId)}/recover-saved-result`, {
method: 'POST',
timeoutMs: 0
}),
setPrimaryKeyframe: (shotId: string, keyframeId: string) =>
request<ShotKeyframe | null>(`${shotPath(shotId)}/keyframes/${encodeURIComponent(keyframeId)}/primary`, {
method: 'PUT'
@@ -23,10 +23,13 @@ const props = defineProps<{
blocked: boolean
/** 只在当前源图编辑任务运行期间显示局部加载。 */
editing?: boolean
/** 仅本候选在下载时显示加载。 */
recovering?: boolean
validationPassed: boolean | null
confirming: boolean
}>()
const emit = defineEmits<{ quality: []; edit: []; select: []; confirm: []; cancel: []; history: [] }>()
/** 用户显式触发候选审核、确认或免费恢复。 */
const emit = defineEmits<{ recover: []; quality: []; edit: []; select: []; confirm: []; cancel: []; history: [] }>()
/** 质量状态以数据库为准;会话内检查仅在历史状态未知时兜底。 */
const reviewKey = computed(() =>
props.item.status === 'completed' ? JSON.stringify([props.shotId, props.item.id, props.reviewRevision ?? 0]) : ''
@@ -37,11 +40,21 @@ const reviewQuery = useQuery(reviewKey, (value, signal) => {
return qualityApi.keyframeQualityReview(shotId, keyframeId, signal)
})
const effectiveStatus = computed(() => reviewQuery.data.value?.effectiveQualityStatus ?? 'unknown')
/** 其余未达可用门禁的独立质量状态。 */
const reviewLabels: Record<string, string> = {
stale: '审核来源过期',
blocked: '质量受阻',
insufficient_evidence: '审核证据不足',
unknown: '质量待确认'
}
/** 旧来源或已损坏的输入证据不能被会话中的历史通过覆盖。 */
const isPassed = computed(
() =>
effectiveStatus.value === 'passed' ||
effectiveStatus.value === 'manual_accepted' ||
(effectiveStatus.value === 'unknown' && props.validationPassed === true)
!props.stale &&
props.item.inputSnapshotStatus !== 'invalid' &&
(effectiveStatus.value === 'passed' ||
effectiveStatus.value === 'manual_accepted' ||
(effectiveStatus.value === 'unknown' && props.validationPassed === true))
)
const canSelect = computed(
() =>
@@ -49,6 +62,8 @@ const canSelect = computed(
!!props.item.imageUrl &&
props.item.source !== 'provider_variant' &&
!props.item.isPrimary &&
!props.stale &&
props.item.inputSnapshotStatus !== 'invalid' &&
isPassed.value
)
</script>
@@ -71,7 +86,11 @@ const canSelect = computed(
<NTag v-if="item.source !== 'provider_variant'" size="small" :bordered="false">
{{ item.isPrimary ? '主首帧' : '候选首帧' }}
</NTag>
<NTag v-if="effectiveStatus === 'manual_accepted'" size="small" type="success" :bordered="false"
<NTag
v-if="effectiveStatus === 'manual_accepted' && isPassed"
size="small"
type="success"
:bordered="false"
>人工已接受</NTag
>
<NTag v-else-if="isPassed" size="small" type="success" :bordered="false">质量通过</NTag>
@@ -87,6 +106,13 @@ const canSelect = computed(
:bordered="false"
>质量未通过</NTag
>
<NTag
v-else-if="item.status === 'completed' && effectiveStatus !== 'passed'"
size="small"
:bordered="false"
>
{{ reviewLabels[effectiveStatus] ?? '质量待确认' }}
</NTag>
<NTag v-if="item.source === 'provider_variant'" size="small" :bordered="false">视频参考图</NTag>
<NTag v-if="item.isPrimary && stale" size="small" type="warning" :bordered="false">已过期</NTag>
<!-- 以下是完整尺寸信息模块,数据缺失时隐藏 -->
@@ -95,6 +121,36 @@ const canSelect = computed(
>
</div>
<IssueHint v-if="item.error" :messages="[productionMessage(item.error)]" type="error" />
<!-- 以下是来源记录与独立的免费恢复入口 -->
<p v-if="item.inputSnapshotStatus" class="mt-2 text-xs text-muted">
{{
{ recorded: '已保存生成输入', 'not-recorded': '历史生成输入未记录', invalid: '生成输入证据已失效' }[
item.inputSnapshotStatus
]
}}
<span v-if="item.providerInputFingerprint" :title="item.providerInputFingerprint">
· {{ item.providerInputFingerprint.slice(0, 12) }}</span
>
</p>
<p v-if="item.recoveryRequired" class="mt-2 text-xs text-muted">
{{
productionMessage(
item.recoveryReason ||
(item.canRecoverSavedResult
? '可以恢复已生成图片的下载。'
: '原请求结果待核查,请先核对候选和模型服务记录。')
)
}}
</p>
<NButton
v-if="item.canRecoverSavedResult"
class="mt-2"
size="small"
:disabled="blocked || recovering"
:loading="recovering"
@click="emit('recover')"
>恢复已生成图片</NButton
>
<p class="mt-2 text-[10px] text-muted">{{ formatDate(item.createdAt) }}</p>
<div v-if="item.status === 'completed' && item.imageUrl" class="mt-2 flex flex-wrap items-center gap-3">
<NButton text size="small" @click="emit('quality')">
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { userFacingText } from '../../../lib/user-facing-text'
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
import ImageGenerationPreview from '../../subject-images/components/ImageGenerationPreview.vue'
import { useImageGenerationPreview, type ImageGenerationSubmission } from '../../subject-images/generation-preview'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
@@ -17,7 +18,9 @@ import GenerationModelControls from '../../generation-config/components/Generati
import { AppDialog, FieldLabel } from '../../../components/ui'
import { errorMessage } from '../../../lib/http'
import { productionApi } from '../api'
import type { GenerateKeyframeInput, KeyframeGenerationPreview } from '../types'
import { directionLabel } from '../../storyboard/model'
import type { ShotDirection, ShotVisualState } from '../../storyboard/types'
import type { GenerateKeyframeInput } from '../types'
/** 单镜头首帧表单;所有新图先生成候选,通过质量检查后再人工晋升。 */
const props = defineProps<{
@@ -26,88 +29,89 @@ const props = defineProps<{
projectId: string
disabled: boolean
replacePrimary?: boolean
/** 当前镜头的正式摄影设计。 */
direction?: ShotDirection | null
/** 当前镜头的正式画面即时状态。 */
visualState?: ShotVisualState | null
/** 仅发送已经确认的当前快照。 */
submitGeneration: (input: GenerateKeyframeInput) => Promise<ImageGenerationSubmission>
}>()
const open = defineModel<boolean>('open', { default: false })
const emit = defineEmits<{ generate: [input: GenerateKeyframeInput] }>()
/** 生成参数表单,用于复用字段校验。 */
const formRef = ref<InstanceType<typeof AppForm> | null>(null)
const confirmed = ref(false)
const preview = ref<KeyframeGenerationPreview | null>(null)
const previewError = ref('')
const previewPending = ref(false)
/** 摄影枚举复用分镜页面的中文展示。 */
const directionSummary = computed(() =>
props.direction
? Object.entries(props.direction)
.filter(([, value]) => value)
.map(([field, value]) => directionLabel(value, field))
.join(' · ')
: ''
)
const generationCatalog = ref<GenerationModelCatalog | null>(null)
const generationCatalogError = ref('')
const imageProvider = ref('')
const imageGenerationOptions = ref<GenerationOptions>({})
const projectAspectRatio = ref<CreativeProfileAspectRatio>('9:16')
const canSubmit = computed(() => !props.disabled && confirmed.value)
/** 预览仅对应当前镜头、模型和参数;请求过期后不得覆盖新配置。 */
const previewRequestKey = computed(() =>
JSON.stringify([props.shotId, imageProvider.value, imageGenerationOptions.value])
)
watch(previewRequestKey, () => {
preview.value = null
previewError.value = ''
/** 预览和生成复用当前请求字段,生成时再附加版本及候选标记。 */
const generationInput = computed(() => ({
provider: imageProvider.value || undefined,
generationOptions: imageGenerationOptions.value
}))
/** 首帧与主体图片使用同一套预览确认与未知费用保护。 */
const {
preview,
acknowledged,
loading,
submitting,
error,
staleNotice,
recoveryNotice,
canSubmit,
loadPreview,
submit
} = useImageGenerationPreview({
open,
recoveryTarget: () => (props.shotId ? 'keyframe:' + props.shotId : ''),
target: () => JSON.stringify([props.shotId, props.direction, props.visualState]),
input: () => generationInput.value,
disabled: () => props.disabled || !imageProvider.value,
load: async (input, signal) => {
const shotId = props.shotId
const result = await productionApi.previewKeyframe(shotId, input, signal)
if (result?.shotId !== shotId) throw new Error('预览结果与当前镜头不匹配。')
return result
},
generate: input => props.submitGeneration({ ...input, setPrimary: false })
})
/** 切换镜头或重新打开时清空费用确认;新图一律先作为候选。 */
async function reset() {
confirmed.value = false
preview.value = null
previewError.value = ''
previewPending.value = false
generationCatalogError.value = ''
if (!open.value) return
try {
const [catalog, profile] = await Promise.all([
generationConfigApi.catalog(),
generationConfigApi.profile(props.projectId)
])
generationCatalog.value = catalog
projectAspectRatio.value = profile?.aspectRatio ?? '9:16'
imageProvider.value = profile?.imageProvider || catalog.defaults.imageProvider
const selected = catalog.images.find(item => item.provider === imageProvider.value)
imageGenerationOptions.value = { ...selected?.defaults, ...profile?.imageOptions }
} catch (cause) {
generationCatalogError.value = errorMessage(cause)
}
}
watch([() => props.shotId, open], reset, { immediate: true })
/** 发送当前模型与动态生成参数;图片尺寸统一由 generationOptions.size 管理。 */
function submit() {
if (!canSubmit.value) return
emit('generate', {
provider: imageProvider.value || undefined,
generationOptions: imageGenerationOptions.value,
setPrimary: false
})
open.value = false
reset()
}
/** 读取后端最终参考图选择与 Prompt,不创建首帧候选。 */
async function loadPreview() {
if (!props.shotId || previewPending.value) return
previewPending.value = true
previewError.value = ''
const requestKey = previewRequestKey.value
try {
const result = await productionApi.previewKeyframe(props.shotId, {
provider: imageProvider.value || undefined,
generationOptions: imageGenerationOptions.value
})
if (requestKey !== previewRequestKey.value || !open.value) return
if (!result || result.shotId !== props.shotId) throw new Error('预览结果与当前镜头不匹配。')
preview.value = result
} catch (cause) {
if (requestKey === previewRequestKey.value && open.value) {
preview.value = null
previewError.value = errorMessage(cause)
/** 切换镜头或重新打开时只读取模型配置,忽略已关闭弹窗的结果。 */
watch(
[() => props.shotId, () => props.projectId, open],
async ([, projectId, isOpen], _, onCleanup) => {
if (!isOpen) return
const controller = new AbortController()
onCleanup(() => controller.abort())
generationCatalog.value = null
generationCatalogError.value = ''
imageProvider.value = ''
try {
const [catalog, profile] = await Promise.all([
generationConfigApi.catalog(controller.signal),
generationConfigApi.profile(projectId, controller.signal)
])
if (controller.signal.aborted) return
generationCatalog.value = catalog
projectAspectRatio.value = profile?.aspectRatio ?? '9:16'
imageProvider.value = profile?.imageProvider || catalog.defaults.imageProvider
const selected = catalog.images.find(item => item.provider === imageProvider.value)
imageGenerationOptions.value = { ...selected?.defaults, ...profile?.imageOptions }
} catch (cause) {
if (!controller.signal.aborted) generationCatalogError.value = errorMessage(cause)
}
} finally {
previewPending.value = false
}
}
},
{ immediate: true }
)
</script>
<template>
@@ -115,11 +119,12 @@ async function loadPreview() {
v-model:open="open"
:title="`${replacePrimary ? '生成替代候选' : '生成首帧候选'} · ${shotTitle}`"
description="新图先作为候选;完成质量检查并通过后,才能设为主首帧。"
:busy="submitting"
>
<AppForm
ref="formRef"
:model="imageGenerationOptions"
:disabled="disabled"
:disabled="disabled || submitting"
:reset-key="`${open}:${shotId}`"
validate-on-change
@submit="submit"
@@ -141,7 +146,7 @@ async function loadPreview() {
:provider="imageProvider"
:options="imageGenerationOptions"
:aspect-ratio="projectAspectRatio"
:disabled="disabled"
:disabled="disabled || submitting"
@update:provider="imageProvider = $event"
@update:options="imageGenerationOptions = $event"
/>
@@ -149,22 +154,53 @@ async function loadPreview() {
<ContextNotice v-else-if="generationCatalogError" type="warning" :show-icon="false" class="mt-5 text-xs">
生成模型目录读取失败:{{ generationCatalogError }}
</ContextNotice>
<div class="mt-5 flex flex-wrap items-center gap-3">
<NButton :loading="previewPending" @click="loadPreview">预览实际生成输入</NButton>
<span class="text-xs text-muted">只读取参考图规划与最终画面描述,不调用图片模型。</span>
</div>
<FeedbackMessage v-if="previewError" :message="previewError" />
<div v-if="preview" class="panel mt-3 p-4 text-xs leading-6">
<div class="flex flex-wrap items-center gap-2">
<strong>{{ preview.provider }} / {{ preview.model }}</strong>
<NTag size="small" :bordered="false">
已选 {{ preview.referencePlan.selected.length }} /
{{ preview.referencePlan.totalCandidates }} 张
</NTag>
<NTag v-if="preview.referencePlan.omitted.length" size="small" type="warning" :bordered="false">
省略 {{ preview.referencePlan.omitted.length }} 张
</NTag>
</div>
<!-- 以下是正式摄影设计与画面状态 -->
<NCollapse v-if="direction || visualState" class="mt-5">
<NCollapseItem v-if="direction" name="direction" title="当前镜头设计">
<p class="text-xs leading-6">{{ directionSummary }}</p>
</NCollapseItem>
<NCollapseItem v-if="visualState" name="visual-state" title="当前画面状态">
<p class="text-xs leading-6">
{{
[
visualState.timeOfDay,
visualState.weather,
visualState.atmosphere,
visualState.environmentTransientState,
visualState.continuityNote
]
.filter(Boolean)
.join(' · ')
}}
</p>
<p v-for="subject in visualState.subjects" :key="subject.subjectId" class="mt-2 text-xs leading-6">
{{
[
subject.subjectRef,
subject.formName,
subject.position,
subject.pose,
subject.expression,
subject.gaze,
subject.transientState
]
.filter(Boolean)
.join(' · ')
}}
</p>
</NCollapseItem>
</NCollapse>
<!-- 以下是最终模型输入和正式参考资产 -->
<ImageGenerationPreview
class="mt-5"
:preview="preview"
:loading="loading"
:disabled="!imageProvider || submitting"
:error="error"
:stale-notice="staleNotice || recoveryNotice"
@load="loadPreview"
/>
<div v-if="preview" class="mt-3 text-xs leading-6">
<!-- 规格审计仅提示导演约束风险,不阻止首帧生成。 -->
<section
v-if="preview.specConsistencySummary"
@@ -201,43 +237,18 @@ async function loadPreview() {
</NCollapseItem>
</NCollapse>
</section>
<ul v-if="preview.referencePlan.selected.length" class="mt-3 space-y-1 text-muted">
<li v-for="item in preview.referencePlan.selected" :key="`${item.role}:${item.imageId}`">
{{ item.subjectRef }} · {{ item.role }} · <code>{{ item.imageId }}</code>
</li>
</ul>
<NCollapse class="mt-3" :default-expanded-names="['prompt']">
<NCollapseItem name="prompt" title="本次实际使用的画面描述">
<p class="mt-3 whitespace-pre-wrap">{{ preview.providerPrompt }}</p>
</NCollapseItem>
<NCollapseItem
v-if="preview.referencePlan.omitted.length"
name="omitted"
title="未进入模型的参考图"
>
<ul class="mt-3 space-y-1 text-muted">
<li v-for="item in preview.referencePlan.omitted" :key="`${item.role}:${item.imageId}`">
{{ item.subjectRef }} · {{ item.role }} · <code>{{ item.imageId }}</code>
</li>
</ul>
</NCollapseItem>
<NCollapseItem name="config" title="生成配置">
<pre class="mt-3 whitespace-pre-wrap">{{
JSON.stringify(preview.generationConfig, null, 2)
}}</pre>
</NCollapseItem>
</NCollapse>
</div>
<NCheckbox
id="confirm-keyframe-cost"
v-model:checked="confirmed"
v-model:checked="acknowledged"
:disabled="!preview || submitting || !!recoveryNotice"
class="mt-5 flex items-start gap-3 text-sm leading-6"
>我已确认调用图片模型可能产生费用,且当前没有相同镜头的生图任务。
>我已核对实际输入,并确认本次图片生成可能产生费用。
</NCheckbox>
</AppForm>
<template #footer>
<NButton @click="open = false">取消</NButton>
<NButton :disabled="disabled || !confirmed" @click="formRef?.validate(submit)" type="primary"
<NButton :disabled="submitting" @click="open = false">取消</NButton>
<NButton :disabled="!canSubmit" :loading="submitting" @click="formRef?.validate(submit)" type="primary"
>确认生成首帧</NButton
>
</template>
@@ -13,7 +13,7 @@ import { ImagePlus, RefreshCw } from '@lucide/vue'
import { AssetImage } from '../../../components/ui'
import { usePolling } from '../../../composables/usePolling'
import { useQuery } from '../../../composables/useQuery'
import { errorMessage } from '../../../lib/http'
import { ApiError, errorMessage } from '../../../lib/http'
import { candidateDialogWidth } from '../../../lib/candidate-layout'
import type { DesignedShot } from '../../storyboard/types'
import { storyboardApi } from '../../storyboard/api'
@@ -328,7 +328,7 @@ const canGeneratePrompt = computed(
const canGenerateKeyframe = computed(
() =>
!assetBlocked.value &&
!keyframes.value.some(item => ['pending', 'generating'].includes(item.status)) &&
!keyframes.value.some(item => item.recoveryRequired || ['pending', 'generating'].includes(item.status)) &&
!!props.keyframeReadiness &&
props.keyframeReadiness.issues.length === 0
)
@@ -442,15 +442,38 @@ async function generatePrompt() {
await refreshAll()
}
/** 调用图片模型生成单镜头首帧;成功后重新读取候选和主图。 */
/**
* 提交已确认的首帧输入,并刷新该镜头候选。
* @param input 预览绑定的生成参数
* @returns 真实提交结果与可能的冲突
*/
async function generateKeyframe(input: GenerateKeyframeInput) {
if (!canGenerateKeyframe.value) return
if (!canGenerateKeyframe.value || !input.expectedPreviewFingerprint) return { accepted: false }
const shotId = props.shot.shotId
await runOperation(props.projectId, `生成镜头 ${props.shot.shotNo} 首帧`, async () => {
const projectId = props.projectId
const accepted = await runOperation(projectId, `生成镜头 ${props.shot.shotNo} 首帧`, async () => {
const result = await productionApi.generateKeyframe(shotId, input)
if (!result || result.shotId !== shotId) throw new Error('接口未确认首帧生成结果。')
if (!result || result.shotId !== shotId) throw new ApiError('首帧生成结果待核对。', 200)
})
await refreshAll()
const cause = getOperation(projectId).cause
if (props.projectId === projectId && props.shot.shotId === shotId) await refreshAll()
return { accepted, cause }
}
/**
* 恢复原候选下载,只在服务明确有可恢复结果时允许。
* @param item 当前候选
*/
async function recoverSavedKeyframe(item: ShotKeyframe) {
if (assetBlocked.value || !item.canRecoverSavedResult || item.shotId !== props.shot.shotId) return
const projectId = props.projectId
const shotId = props.shot.shotId
await runOperation(projectId, `恢复已生成首帧 ${item.id}`, async () => {
const result = await productionApi.recoverSavedKeyframe(shotId, item.id)
if (result.id !== item.id || result.shotId !== shotId || result.status !== 'completed')
throw new Error('下载结果待核对,请刷新候选。')
})
if (projectId === props.projectId && shotId === props.shot.shotId) await refreshAll()
}
/** 切换主首帧不调用模型,但会改变后续视频生成输入。 */
@@ -966,6 +989,8 @@ defineExpose({ inspectSpecs, inspecting })
:shot-id="shot.shotId"
:review-revision="reviewRevision"
:item="item"
:recovering="isOperationRunning(getOperation(projectId), `恢复已生成首帧 ${item.id}`)"
@recover="recoverSavedKeyframe(item)"
:editing="
editSource?.id === item.id &&
isOperationRunning(getOperation(projectId), `编辑镜头 ${shot.shotId} 首帧`)
@@ -1054,8 +1079,10 @@ defineExpose({ inspectSpecs, inspecting })
:shot-title="shot.title"
:project-id="projectId"
:replace-primary="keyframeStale"
:direction="shot.direction"
:visual-state="shot.visualState"
:disabled="!canGenerateKeyframe"
@generate="generateKeyframe"
:submit-generation="generateKeyframe"
/>
</section>
</template>
+17 -15
View File
@@ -1,3 +1,4 @@
import type { ImageGenerationPreview } from '../subject-images/generation-preview'
import type { GenerationOptions, ResolvedGenerationConfig } from '../generation-config/types'
/** 项目生产链的就绪状态;进行中只会出现在视频阶段。 */
@@ -141,6 +142,16 @@ export interface VideoReadiness {
/** 首帧生成记录;成功图片与失败历史都保留。 */
export interface ShotKeyframe {
/** 持久化的实际输入状态。 */
inputSnapshotStatus?: 'recorded' | 'not-recorded' | 'invalid'
/** 当次实际输入指纹。 */
providerInputFingerprint?: string | null
/** 中断后需核查已有请求。 */
recoveryRequired?: boolean
/** 保存的恢复原因。 */
recoveryReason?: string | null
/** 仅允许下载已知生成结果。 */
canRecoverSavedResult?: boolean
id: string
shotId: string
source: string | null
@@ -221,15 +232,8 @@ export type ImageReferenceRole =
| 'style-prop'
| 'identity-anchor'
| 'form-primary'
export interface KeyframePreviewReference {
originalImageNumber: number
subjectRef: string
module: string
role: ImageReferenceRole
imageId: string
imageUrl: string
}
| 'scene-form-view'
| 'layout-master'
export interface KeyframeReferencePlanItem {
subjectId?: string
@@ -251,7 +255,8 @@ export interface KeyframeSpecConsistencyIssue {
message: string
}
export interface KeyframeGenerationPreview {
/** 正式镜头的最终图片输入与导演约束检查。 */
export interface KeyframeGenerationPreview extends ImageGenerationPreview {
specConsistencyIssues?: KeyframeSpecConsistencyIssue[]
specConsistencySummary?: {
warningCount: number
@@ -263,10 +268,6 @@ export interface KeyframeGenerationPreview {
episodeNo: number
beatNo: number
shotNo: number
provider: string
model: string
generationConfig: Record<string, unknown>
references: KeyframePreviewReference[]
referencePlan: {
provider: string
maxReferenceImages: number | null
@@ -275,7 +276,6 @@ export interface KeyframeGenerationPreview {
selected: KeyframeReferencePlanItem[]
omitted: KeyframeReferencePlanItem[]
}
providerPrompt: string
}
/** 视频生成规格中的主体参考图。 */
@@ -326,6 +326,8 @@ export interface GenerateKeyframesInput {
/** 单镜头首帧生成参数。 */
export interface GenerateKeyframeInput {
/** 用户确认的最终输入版本。 */
expectedPreviewFingerprint?: string
setPrimary: boolean
provider?: string
generationOptions?: Record<string, string | number | boolean>
+19 -13
View File
@@ -73,21 +73,25 @@ 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, 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
.videoInputPlans(projectId, number, signal)
.then(data => ({ data, error: '' }))
.catch(cause => ({ data: null, error: errorMessage(cause) }))
])
const [directions, visualStates, prompts, keyframes, videos, videoStatus, videoInputPlanState] =
await Promise.all([
storyboardApi.directions(projectId, number, signal),
storyboardApi.visualStates(projectId, number, signal).catch(() => null),
productionApi.promptReadiness(projectId, overwrite, signal),
productionApi.keyframeReadiness(projectId, overwrite, signal),
productionApi.videoReadiness(projectId, overwrite, 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,
visualStates:
visualStates?.projectId === projectId && visualStates.episodeNo === number ? visualStates : null,
prompts,
keyframes,
videos,
@@ -112,7 +116,9 @@ export function useProduction() {
() => !!getStoryboardSession(id.value).invalidatedEpisodeSources[episodeNo.value]
)
/** 当前剧集的正式镜头目录。 */
const shots = computed(() => mergeDesignedShots(query.data.value?.directions ?? null, null, source.value))
const shots = computed(() =>
mergeDesignedShots(query.data.value?.directions ?? null, query.data.value?.visualStates ?? null, source.value)
)
/** 明确指定的镜头不存在时不代选其它镜头;首次进入才选择第一镜。 */
const shot = computed(() =>
selectedShot.value ? shots.value.find(item => item.shotId === selectedShot.value) : shots.value[0]
@@ -134,7 +140,7 @@ export function useProduction() {
/** 当前工作区的响应式状态或派生业务条件。 */
const session = computed(() => getProductionSession(id.value))
/** 普通首帧后台观察器,刷新页面后恢复真实执行状态。 */
const keyframeExecution = useWorkflowExecution(id, 'keyframe-generation')
const keyframeExecution = useWorkflowExecution(id, 'keyframe-generation', { discover: true })
const promptExecution = useWorkflowExecution(id, 'video-prompt')
const videoExecution = useWorkflowExecution(id, 'video-quality')
/** 当前工作区的响应式状态或派生业务条件。 */