feat: 对接项目生成配置与单集成片

This commit is contained in:
GouJ committed 2026-09-21 10:03:50 +08:00
1 parent 1bbfd30627
commit 01f274cd8e
9 files changed
+722 -8

No files matched your search

@@ -6,16 +6,21 @@ import { hasRunningImages } from '../subject-images/model'
import { getOperation, runOperation } from '../workflows/operations'
import { hasRunningWorkflow } from '../workflows/selectors'
import { errorMessage } from '../../lib/http'
import { generationConfigApi } from '../generation-config/api'
import { productionApi } from './api'
import { getProductionSession } from './model'
/** 使用后端计划区分可自动补齐和人工阻塞,保留项目归属及活动任务检查。 */
export async function checkPipeline(projectId: string) {
const profile = await generationConfigApi.profile(projectId)
const providers = profile
? { imageProvider: profile.imageProvider, videoProvider: profile.videoProvider }
: undefined
const [project, checkpoints, forms, plan, status] = await Promise.all([
projectsApi.detail(projectId),
projectsApi.checkpoints(projectId),
subjectImagesApi.listForms(projectId),
productionApi.plan(projectId),
productionApi.plan(projectId, undefined, providers),
productionApi.status(projectId)
])
if (
@@ -26,6 +31,7 @@ export async function checkPipeline(projectId: string) {
)
throw new Error('预检返回了其他项目的数据,请重新读取。')
const issues: string[] = []
if (!profile) issues.push('尚未配置项目画布与生成模型,请先在批量生产工具中保存配置。')
const shotIds = new Set(plan.details.keyframes.map(item => item.shotId))
if (
shotIds.size !== plan.keyframes.total ||
@@ -54,7 +60,15 @@ export async function checkPipeline(projectId: string) {
else if (![plan.subjectImages, plan.keyframes, plan.videoPrompts, plan.videos].some(stage => stage.planned > 0))
issues.push('当前没有可执行的制作任务,请先处理计划中的阻塞项。')
// 人工阻塞在计划中独立展示;不拦截其余 ready 形态的部分成功生产。
return { projectId, issues, plan, status, shotCount: plan.keyframes.total, checkedAt: new Date().toISOString() }
return {
projectId,
issues,
plan,
status,
profile,
shotCount: plan.keyframes.total,
checkedAt: new Date().toISOString()
}
}
/** 预检不付费;确认后再次预检并锁住本浏览器项目,长请求不自动重发。 */
@@ -128,7 +142,15 @@ export function useAdvancedProduction() {
if (result.issues.length) throw new Error('提交前预检发现条件变化,未启动生产。请处理下方问题。')
target.pipelineReceipt = null
submitted = true
const receipt = await productionApi.startPipeline(projectId)
const receipt = await productionApi.startPipeline(
projectId,
result.profile
? {
imageProvider: result.profile.imageProvider,
videoProvider: result.profile.videoProvider
}
: undefined
)
if (!receipt || receipt.projectId !== projectId)
throw new Error('回执项目不匹配,请读取资产状态核对,不要直接重试。')
target.pipelineReceipt = receipt