diff --git a/src/features/breakdown/BreakdownPage.vue b/src/features/breakdown/BreakdownPage.vue index efbc8b8..31defb0 100644 --- a/src/features/breakdown/BreakdownPage.vue +++ b/src/features/breakdown/BreakdownPage.vue @@ -24,6 +24,7 @@ import StoryboardList from './components/StoryboardList.vue' import StoryboardDiagnosis from './components/StoryboardDiagnosis.vue' import BreakdownCandidatePanel from './components/BreakdownCandidatePanel.vue' import StoryboardQualityRepair from './components/StoryboardQualityRepair.vue' +import BreakdownDurationDiagnostics from './components/BreakdownDurationDiagnostics.vue' import BreakdownIssuesDialog from './components/BreakdownIssuesDialog.vue' import CandidateRepairs from './components/CandidateRepairs.vue' import ActionExceptionRepair from './components/ActionExceptionRepair.vue' @@ -1119,6 +1120,14 @@ const isInitialEmpty = computed( @locate="locateIssue" @refresh="refreshCandidate" > + + + + + + + +

正在读取当前候选审核…

diff --git a/src/features/breakdown/types.ts b/src/features/breakdown/types.ts index ad6e981..d6d6d4b 100644 --- a/src/features/breakdown/types.ts +++ b/src/features/breakdown/types.ts @@ -93,6 +93,8 @@ export interface StoryboardBeat { /** 单集分镜规划。 */ export interface EpisodePlan { + /** 正式时长目标快照,空值为自动,缺失为历史未记录。 */ + targetDurationSeconds?: number | null episodeNo: number episodeTitle: string storyGoal: string @@ -131,6 +133,30 @@ export interface ShotValidation { issues: { episodeNo: number; beatNo?: number | null; shotNo?: number | null; message: string }[] } +/** 当前拆解候选的只读时长审计。 */ +export interface BreakdownDurationBudget { + /** 正式集数。 */ episodeNo: number + /** 已规划的段落预算之和。 */ plannedSeconds: number + /** 当前镜头及动作所需最低总时长。 */ minimumRequiredSeconds: number + /** 局部段落缺口之和。 */ deficitSeconds: number + /** 局部段落的预算及缺口。 */ + beatSuggestions: Array<{ + /** 段落号。 */ beatNo: number + /** 原段落预算。 */ budgetSeconds: number + /** 最低需求。 */ requiredSeconds: number + /** 当前缺口。 */ deficitSeconds: number + }> + /** 当前需要人工核对。 */ needsReview: boolean +} + +/** 最新失败保存记录中的完整实际候选。 */ +export interface BreakdownDurationFailure { + /** 正式候选诊断类型。 */ kind: 'storyboard-duration-failure' + /** 失败集数。 */ episodeNo: number + /** 完整候选保留供诊断。 */ candidate: EpisodeShots + /** 此失败不自动恢复。 */ retryAutomatically: false +} + /** Breakdown 的最终成果及阶段 checkpoint 共有的可展示字段。 */ export interface BreakdownResult { subjectCandidates?: SubjectCandidate[] @@ -152,6 +178,12 @@ export interface WorkflowExecution { /** latest 和 checkpoint 的恢复状态;失败 checkpoint 可能只有 execution。 */ export interface BreakdownState extends BreakdownResult { + /** 最新保存记录编号。 */ + checkpointId?: string + /** 当前服务端时长审计。 */ + storyboardEpisodeDurationBudgets?: BreakdownDurationBudget[] + /** 失败详情仅用于诊断,不作为恢复请求参数。 */ + failureDetails?: { /** 实际失败的结构化证据。 */ details?: unknown } /** 快照所属项目;旧版观测响应可能缺省。 */ projectId?: string /** 当前镜头动作质量决策,不从嵌套历史成果继承。 */ diff --git a/src/features/production/ProductionPage.vue b/src/features/production/ProductionPage.vue index 290dc53..55c3e78 100644 --- a/src/features/production/ProductionPage.vue +++ b/src/features/production/ProductionPage.vue @@ -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 }) /** * 将首帧质量启动句柄交给页面级观察器,始终保存当前原项目归属。 diff --git a/src/features/production/api.ts b/src/features/production/api.ts index 6352003..883a291 100644 --- a/src/features/production/api.ts +++ b/src/features/production/api.ts @@ -159,9 +159,14 @@ export const productionApi = { keyframeSpec: (shotId: string, signal?: AbortSignal) => request(`${shotPath(shotId)}/keyframe-spec`, { signal }), /** 按本次请求选择的图片模型与参数预览最终输入,不创建首帧任务。 */ - previewKeyframe: (shotId: string, input: Pick) => + previewKeyframe: ( + shotId: string, + input: Pick, + signal?: AbortSignal + ) => request(`${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(`${shotPath(shotId)}/keyframes/${encodeURIComponent(keyframeId)}/recover-saved-result`, { + method: 'POST', + timeoutMs: 0 + }), setPrimaryKeyframe: (shotId: string, keyframeId: string) => request(`${shotPath(shotId)}/keyframes/${encodeURIComponent(keyframeId)}/primary`, { method: 'PUT' diff --git a/src/features/production/components/KeyframeCard.vue b/src/features/production/components/KeyframeCard.vue index 6106f0a..991e376 100644 --- a/src/features/production/components/KeyframeCard.vue +++ b/src/features/production/components/KeyframeCard.vue @@ -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 = { + 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 ) @@ -71,7 +86,11 @@ const canSelect = computed( {{ item.isPrimary ? '主首帧' : '候选首帧' }} - 人工已接受 质量通过 @@ -87,6 +106,13 @@ const canSelect = computed( :bordered="false" >质量未通过 + + {{ reviewLabels[effectiveStatus] ?? '质量待确认' }} + 视频参考图 已过期 @@ -95,6 +121,36 @@ const canSelect = computed( >
+ +

+ {{ + { recorded: '已保存生成输入', 'not-recorded': '历史生成输入未记录', invalid: '生成输入证据已失效' }[ + item.inputSnapshotStatus + ] + }} + + · {{ item.providerInputFingerprint.slice(0, 12) }} +

+

+ {{ + productionMessage( + item.recoveryReason || + (item.canRecoverSavedResult + ? '可以恢复已生成图片的下载。' + : '原请求结果待核查,请先核对候选和模型服务记录。') + ) + }} +

+ 恢复已生成图片

{{ formatDate(item.createdAt) }}

diff --git a/src/features/production/components/KeyframeDialog.vue b/src/features/production/components/KeyframeDialog.vue index 5d8d687..b3cb7b4 100644 --- a/src/features/production/components/KeyframeDialog.vue +++ b/src/features/production/components/KeyframeDialog.vue @@ -1,6 +1,7 @@ diff --git a/src/features/production/types.ts b/src/features/production/types.ts index 904a702..f4b9ab8 100644 --- a/src/features/production/types.ts +++ b/src/features/production/types.ts @@ -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 - 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 diff --git a/src/features/production/useProduction.ts b/src/features/production/useProduction.ts index b708101..300f9a2 100644 --- a/src/features/production/useProduction.ts +++ b/src/features/production/useProduction.ts @@ -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') /** 当前工作区的响应式状态或派生业务条件。 */ diff --git a/src/features/subject-identity/SubjectIdentityPage.vue b/src/features/subject-identity/SubjectIdentityPage.vue index e6a4825..a7cdeeb 100644 --- a/src/features/subject-identity/SubjectIdentityPage.vue +++ b/src/features/subject-identity/SubjectIdentityPage.vue @@ -34,6 +34,7 @@ import { useSubjectIdentity } from './useSubjectIdentity' import { useProjectContext } from '../projects/context' import { useProjectStageAccess } from '../projects/useProjectStageAccess' import StableAnchorQualityDialog from './components/StableAnchorQualityDialog.vue' +import VisualFactRevisionDrawer from './components/VisualFactRevisionDrawer.vue' import IdentityEditor from './components/IdentityEditor.vue' import SubjectIdentitySkeleton from './SubjectIdentitySkeleton.vue' import IdentityDetailSkeleton from './components/IdentityDetailSkeleton.vue' @@ -113,6 +114,21 @@ const identityBatchScopeLabel = computed( /** 单主体稳定母版质量生成弹窗开关。 */ const qualityOpen = ref(false) const imageOpen = ref(false) +/** 当前主体视觉事实修订抽屉。 */ +const revisionOpen = ref(false) +watch(selectedId, () => { + revisionOpen.value = false +}) + +/** 保存后重读身份、全部形态与制作准入。 */ +async function refreshVisualFacts() { + await Promise.all([ + detail.refresh(), + catalog.refresh(), + castingQuery.refresh(), + projectContext.refreshStageReadiness() + ]) +} /** 从失败记录重试时保留原视角,普通生成仍使用弹窗默认视角。 */ const retryImageView = ref() const castingOpen = ref(false) @@ -921,6 +937,25 @@ function runNextAction() {

请先保存身份修改,再使用 AI 或生成图片。

+ + 核对与修订视觉事实 + + + (() => ({ generationOptions: { ...generationOptions.value } })) /** 选角使用 primary 且不引用当前母版,与正式候选生成一致。 */ -const { preview, acknowledged, loading, submitting, error, staleNotice, canSubmit, loadPreview, submit } = - useImageGenerationPreview({ - open, - target: () => JSON.stringify([props.subjectId, props.profile]), - input: () => generationInput.value, - disabled: () => props.disabled || !valid.value, - load: (input, signal) => - subjectIdentityApi.previewImage( - props.subjectId, - { ...input, viewType: 'primary', useAnchorReference: false }, - signal - ), - generate: input => props.submitGeneration(input) - }) +const { + preview, + acknowledged, + loading, + submitting, + error, + staleNotice, + recoveryNotice, + canSubmit, + loadPreview, + submit +} = useImageGenerationPreview({ + open, + recoveryTarget: () => (props.subjectId ? 'identity:' + props.subjectId : ''), + target: () => JSON.stringify([props.subjectId, props.profile]), + input: () => generationInput.value, + disabled: () => props.disabled || !valid.value, + load: (input, signal) => + subjectIdentityApi.previewImage( + props.subjectId, + { ...input, viewType: 'primary', useAnchorReference: false }, + signal + ), + generate: input => props.submitGeneration(input) +}) /** 当前描述草稿对应的表单模型。 */ const formModel = computed(() => ({ prompt: prompt.value })) @@ -94,7 +105,7 @@ const formModel = computed(() => ({ prompt: prompt.value })) > AI - 会根据角色身份、项目视觉风格和选角要求生成一张新的候选图,不会复用当前身份母版。生成完成后,请在图库点击“确认选角并锁定”,将图片设为角色母版。 + 会根据角色身份、项目视觉风格和选角要求生成一张新的候选图,不会复用当前身份母版。生成后请在图库审核候选,通过后再确认选角并锁定身份。 ({ prompt: prompt.value })) :loading="loading" :disabled="disabled || submitting || !valid" :error="error" - :stale-notice="staleNotice" + :stale-notice="staleNotice || recoveryNotice" @load="loadPreview" />