feat(short-drama-agent-front): 完善分镜审核与制作准备流程

This commit is contained in:
GJ committed 2026-10-19 21:59:22 +08:00
1 parent c4b43b9725
commit 1da56e0d46
72 files changed
+2801 -528

No files matched your search

+9 -4
View File
@@ -10,7 +10,7 @@ import type {
ProjectVideoStatus,
ProjectVideoInputPlan,
PromptReadiness,
ProductionPlan,
ProductionPlanResponse,
ProductionPlanInput,
ProductionStartInput,
ProviderInputSpec,
@@ -62,12 +62,17 @@ export const productionApi = {
* @param projectId 正式项目 ID
* @param signal 取消信号
* @param input 与启动同源的模型及图片参数
* @returns 后端实际生产计划
* @returns 后端实际生产计划或配置阻断状态
*/
plan: (projectId: string, signal?: AbortSignal, input: ProductionPlanInput = {}) =>
request<ProductionPlan>(`${projectPath(projectId)}/production/plan`, {
request<ProductionPlanResponse>(`${projectPath(projectId)}/production/plan`, {
method: 'POST',
body: input,
// 计划只解析这三项;阶段范围及视频参数只由启动接口消费。
body: {
imageProvider: input.imageProvider,
imageGenerationOptions: input.imageGenerationOptions,
videoProvider: input.videoProvider
},
signal
}),
/** 读取真实主资产完成状态,不能用任务提交回执代替。 */
@@ -4,7 +4,9 @@ import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { NButton, NCheckbox, NCollapse, NCollapseItem, NInputNumber, NSelect } from 'naive-ui'
import { computed, ref, watch } from 'vue'
import { computed, inject, ref, watch } from 'vue'
import { Settings2 } from '@lucide/vue'
import { projectSettingsOpenKey } from '../../generation-config/context'
import ConfirmAction from '../../workflows/ConfirmAction.vue'
import { downloadText, formatDate } from '../../../lib/format'
import { useAdvancedProduction } from '../useAdvancedProduction'
@@ -19,6 +21,7 @@ const {
execution,
checking,
error,
configurationRequired,
check,
blocked,
safeMode,
@@ -34,6 +37,8 @@ const {
preflight,
start
} = useAdvancedProduction()
/** 配置缺失时打开项目标题栏已有的全屏配置,不创建第二份表单。 */
const openProjectSettings = inject(projectSettingsOpenKey, undefined)
/** 本轮真实生产回执。 */
const receipt = computed(() => session.value.pipelineReceipt)
/** 高级工具折叠状态。 */
@@ -141,6 +146,13 @@ const confirmationDescription = computed(
@confirm="start"
/>
</div>
<!-- 以下是项目配置缺失的恢复入口,保存后仍须重新检查制作条件。 -->
<div v-if="configurationRequired" class="mt-3 flex flex-wrap items-center gap-3">
<span class="text-xs text-muted">请先保存项目生成配置,再重新检查制作条件。</span>
<NButton v-if="openProjectSettings" class="workspace-action-button" :disabled="operation.pending" @click="openProjectSettings">
<template #icon><Settings2 :size="15" aria-hidden="true" /></template>前往项目配置
</NButton>
</div>
<!-- 以下是后台任务与真实结果模块。 -->
<WorkflowExecutionPanel
v-if="execution.executionId.value"
@@ -95,9 +95,9 @@ const problems = computed(() => [
计划会根据当前素材自动更新。已有有效结果会直接复用;重新生成的过期主体图会自动设为当前主图,手动生成的候选仍可在形态图片页自行确认。
</p>
<ContextNotice v-if="plan.hasManualBlockers" type="warning" :show-icon="false" class="mt-3">
各阶段合计
当前有
{{ plan.manualBlocked }}
项需人工处理(同一镜头可能重复计数)。可先生成就绪的主体参考图;成功结果会保留,遇到阻塞时后续阶段可能暂停。
项独立准备问题需人工处理。上表各阶段的影响数量可能重叠,不能直接相加。可先生成就绪的主体参考图;成功结果会保留,遇到阻塞时后续阶段可能暂停。
</ContextNotice>
<NCollapse v-if="problems.length" class="mt-3" :default-expanded-names="['issues']">
<NCollapseItem name="issues" title="查看还需要准备的内容">
+64
View File
@@ -534,6 +534,15 @@ export interface ProductionPlanStage {
/** 后端执行计划只读取资产,不触发模型生成。 */
export interface ProductionPlan {
/** 项目配置就绪状态;兼容尚未返回此字段的服务版本。 */
configuration?: {
/** 当前配置可用于制作计划。 */
status: 'ready'
/** 无配置错误。 */
code: null
/** 无配置阻断说明。 */
reason: null
}
projectId: string
providers: { image: string; video: string }
/** 实际解析后的图片模型与参数。 */
@@ -566,6 +575,61 @@ export interface ProductionPlan {
}
}
/** 缺少项目配置时仅返回入口状态,各制作阶段不可读取或执行。 */
export interface ProductionConfigurationBlockedPlan {
/** 所属项目编号。 */
projectId: string
/** 配置未完成时禁止启动。 */
canStart: false
/** 配置未完成时禁止自动执行。 */
canAutoRun: false
/** 当前存在人工配置阻断。 */
hasManualBlockers: true
/** 配置阻断数量。 */
manualBlocked: number
/** 真实配置阻断原因,原始值保留用于业务判断。 */
configuration: {
/** 配置尚不可用。 */
status: 'blocked'
/** 缺少项目生成配置。 */
code: 'CREATIVE_PROFILE_REQUIRED'
/** 面向展示层转换的业务说明。 */
reason: string
}
/** 正式分镜入口可能已就绪,但不能替代项目配置。 */
entryReadiness: {
/** 分镜入口是否就绪。 */
ready: boolean
/** 当前阻断原因。 */
reason?: string | null
}
/** 配置缺失时没有可执行的模型选择。 */
providers: null
/** 配置缺失时没有可执行的生成参数。 */
generationConfig: null
/** 未完成制作。 */
completed: false
/** 配置补齐前的明确阶段。 */
stage: 'configuration_required'
/** 未计算角色身份阶段。 */
characterIdentity: null
/** 未计算身份母版阶段。 */
stableIdentityAnchors: null
/** 未计算主体图片阶段。 */
subjectImages: null
/** 未计算首帧阶段。 */
keyframes: null
/** 未计算视频提示词阶段。 */
videoPrompts: null
/** 未计算视频阶段。 */
videos: null
/** 不存在阶段明细,不能用于启动判断。 */
details: null
}
/** 计划预检明确区分配置阻断与可读取的制作阶段。 */
export type ProductionPlanResponse = ProductionPlan | ProductionConfigurationBlockedPlan
/** 真实制作状态;只有主体主图、主首帧和主视频均有效才完成。 */
export interface ProjectProductionStatus {
projectId: string
@@ -1,4 +1,5 @@
import { computed, onScopeDispose, ref, watch } from 'vue'
import { preparationApi, assertCurrentStoryboardDesigns } from '../storyboard-preparation/api'
import { projectsApi } from '../projects/api'
import { useProjectContext } from '../projects/context'
import { subjectImagesApi } from '../subject-images/api'
@@ -12,6 +13,18 @@ import { productionApi } from './api'
import { getProductionSession } from './model'
import type { ProductionPlan, ProductionStartInput, ProductionStage } from './types'
/** 缺少项目配置属于可恢复业务状态,保留独立身份供界面提供配置入口。 */
class ProductionConfigurationRequiredError extends Error {
/**
* 保留计划返回的业务原因,不伪造 HTTP 请求失败状态。
* @param message 原始业务说明,默认使用公开配置状态码
*/
constructor(message = 'CREATIVE_PROFILE_REQUIRED') {
super(message)
this.name = 'ProductionConfigurationRequiredError'
}
}
/**
* 指定续跑阶段会跳过上游生成,必须使用已有有效资产而非可生成数量。
* @param plan 后端当前真实生产计划
@@ -46,17 +59,20 @@ export function productionResumeIssues(
* @returns 无消耗计划、实际状态与同源请求参数
*/
export async function checkPipeline(projectId: string, scope: ProductionStartInput = {}) {
const entry = await preparationApi.entry(projectId)
if (entry.ready !== true) throw new Error(entry.reason || '请先完成正式分镜检查与人工审核,再进入制作计划。')
const project = await projectsApi.detail(projectId)
if (project.id !== projectId) throw new Error('预检返回了其他项目的数据,请重新读取。')
await assertCurrentStoryboardDesigns(projectId, project.episodes.map(item => item.episode), entry.derivedAssets.shotCount)
const profile = await generationConfigApi.profile(projectId)
const providers = profile
? {
imageProvider: profile.imageProvider,
videoProvider: profile.videoProvider,
imageGenerationOptions: { ...profile.imageOptions },
videoGenerationOptions: { ...profile.videoOptions }
}
: undefined
const [project, checkpoints, forms, plan, status] = await Promise.all([
projectsApi.detail(projectId),
if (!profile) throw new ProductionConfigurationRequiredError()
const providers = {
imageProvider: profile.imageProvider,
videoProvider: profile.videoProvider,
imageGenerationOptions: { ...profile.imageOptions },
videoGenerationOptions: { ...profile.videoOptions }
}
const [checkpoints, forms, plan, status] = await Promise.all([
projectsApi.checkpoints(projectId),
subjectImagesApi.listForms(projectId),
productionApi.plan(projectId, undefined, providers),
@@ -69,11 +85,12 @@ export async function checkPipeline(projectId: string, scope: ProductionStartInp
forms.some(form => form.subject.projectId !== projectId)
)
throw new Error('预检返回了其他项目的数据,请重新读取。')
if (plan.stage === 'configuration_required')
throw new ProductionConfigurationRequiredError(plan.configuration.reason || undefined)
const issues: string[] = []
if (plan.entryReadiness && !plan.entryReadiness.ready)
issues.push(plan.entryReadiness.reason || '项目尚未满足生产入口条件。')
issues.push(...productionResumeIssues(plan, scope))
if (!profile) issues.push('尚未配置项目画布与生成模型,请先在右上角“项目配置”中保存配置。')
const shotIds = new Set(plan.details.keyframes.map(item => item.shotId))
if (
shotIds.size !== plan.keyframes.total ||
@@ -131,6 +148,8 @@ export function useAdvancedProduction() {
const checking = ref(false)
/** 预检错误或已有任务说明。 */
const error = ref('')
/** 配置未保存时展示已有项目配置的恢复入口,不根据错误文案猜测状态。 */
const configurationRequired = ref(false)
/** 默认使用无视频测试模式,只有用户明确切换后才允许提交高费用视频任务。 */
const safeMode = ref(true)
/** 本轮有限首帧数量,保留原安全模式字段。 */
@@ -180,6 +199,7 @@ export function useAdvancedProduction() {
version++
check.value = null
error.value = ''
configurationRequired.value = false
checking.value = false
})
@@ -190,6 +210,7 @@ export function useAdvancedProduction() {
check.value = null
checking.value = false
error.value = ''
configurationRequired.value = false
},
{ deep: true, flush: 'sync' }
)
@@ -202,11 +223,15 @@ export function useAdvancedProduction() {
checking.value = true
check.value = null
error.value = ''
configurationRequired.value = false
try {
const result = await checkPipeline(projectId, scope.value)
if (current === version && id.value === projectId) check.value = result
} catch (cause) {
if (current === version) error.value = errorMessage(cause)
if (current === version) {
configurationRequired.value = cause instanceof ProductionConfigurationRequiredError
error.value = errorMessage(cause)
}
} finally {
if (current === version) checking.value = false
}
@@ -229,7 +254,13 @@ export function useAdvancedProduction() {
const confirmedVersion = version
let submitted = false
await runOperation(projectId, '高级串联生产', async () => {
const result = await checkPipeline(projectId, scope.value)
const result = await checkPipeline(projectId, scope.value).catch(cause => {
if (!disposed && id.value === projectId && confirmedVersion === version && cause instanceof ProductionConfigurationRequiredError) {
check.value = null
configurationRequired.value = true
}
throw cause
})
if (
confirmedVersion !== version ||
disposed ||
@@ -294,6 +325,7 @@ export function useAdvancedProduction() {
execution,
checking,
error,
configurationRequired,
check,
blocked,
safeMode,