fix: 同步串联生产视频参数与数量限制

This commit is contained in:
GJ committed 2026-10-10 13:08:11 +08:00
1 parent a85a740cd5
commit 112ff719ce
6 files changed
+68 -9

No files matched your search

+12
View File
@@ -59,3 +59,15 @@
- 首帧预览按 `referencePlan.selected`/`omitted` 展示 Provider 上限后的真实输入;不再从通用 `keyframe-spec` 推断最终选图。
- 形态提示词、形态图片及主体身份文本批处理均可发送可选 `module`;省略时保持全项目行为。
- 场景/道具身份母版使用 `/projects/:projectId/subject-identities/anchors/generate`,请求包含 `module`、`limit`、`concurrency`;成功项已由后端设为 Anchor 并锁定,不再由前端逐项补 PUT。
## 2026-10-10 串联生产增量同步
核对后端本地与远端 `dev@8acc22db66605b2094098eb3f25b4d1de0ef4a69`。本轮调整已有生产流程:
- `POST /projects/:projectId/production/start` 新增 `videoLimit` 和 `videoGenerationOptions`。高级串联生产默认视频候选最多一镜,限制值必须为正整数;默认安全模式仍在视频提示词阶段停止。
- 项目 `creative-profile.videoOptions` 被复制到本轮启动快照。确认后重新读取配置,视频参数变化也会撤销旧预检与确认,避免启动未经确认的参数。计划接口仍仅解析图片参数及图片/视频供应方,视频参数和数量上限由启动接口实际消费,不将计划表中的全项目计数描述为本批上限。
- 补齐首帧就绪项 `primaryQualityStatus` 和视频就绪汇总 `failedKeyframeQuality`。缺省状态不推断通过;已有 `failed_keyframe_quality` 问题显示沿用后端真实原因。
- 新增首帧编辑、候选质量恢复和人工空间目标绑定属于独立操作入口,本轮未新增这些页面功能。已有通用 JSON 规格展示和导出保留后端新增数据,不人工编造空间目标。
验证:`pnpm check`(45 个测试文件、357 项测试)及 `pnpm build` 通过;本地 Chrome 的 `localhost:4312` 读取真实后端 `localhost:3412`,生产预检成功,视频候选上限可编辑,修改后旧预检失效且启动禁用。真实生产状态返回 passed/failed 主首帧质量标记;当前项目视频参数来自实际配置。未启动图片、视频或视觉校验模型任务。测试输出存在 localhost:3000 连接拒绝日志,但全部测试通过;不据此宣称付费生产端到端验证。
@@ -24,6 +24,7 @@ const {
stableIdentityAnchorLimit,
subjectImageLimit,
videoPromptLimit,
videoLimit,
scope,
scopeError,
preflight,
@@ -64,7 +65,7 @@ const stageOptions = [
/** 确认内容涵盖所有付费范围,变更后公共确认组件会废弃原勾选。 */
const confirmationDescription = computed(
() =>
`项目 ${id.value}:从 ${startFrom.value ?? '默认入口'} 执行至 ${scope.value.stopAfter ?? '视频任务提交'};稳定身份母版最多 ${stableIdentityAnchorLimit.value} 个、主体图片最多 ${subjectImageLimit.value} 张、首帧最多 ${testKeyframeLimit.value} 张、视频提示词最多 ${videoPromptLimit.value} 条。${scope.value.stopAfter ? '会产生图片、语言或视觉模型费用,不提交视频任务。' : '会产生较高视频模型费用。'} 项目模型和图片参数以本次预检为准。`
`项目 ${id.value}:从 ${startFrom.value ?? '默认入口'} 执行至 ${scope.value.stopAfter ?? '视频任务提交'};稳定身份母版最多 ${stableIdentityAnchorLimit.value} 个、主体图片最多 ${subjectImageLimit.value} 张、首帧最多 ${testKeyframeLimit.value} 张、视频提示词最多 ${videoPromptLimit.value} 条、视频候选最多 ${videoLimit.value} 镜。${scope.value.stopAfter ? '会产生图片、语言或视觉模型费用,不提交视频任务。' : '会产生较高视频模型费用。'} 项目模型及图片、视频参数以本次预检快照为准。`
)
</script>
<template>
@@ -112,6 +113,10 @@ const confirmationDescription = computed(
<label
>视频提示词上限<NInputNumber v-model:value="videoPromptLimit" :min="1" :step="1" :precision="0"
/></label>
<!-- 以下是完整流程的视频候选数量限制模块。 -->
<label
>视频候选镜头上限<NInputNumber v-model:value="videoLimit" :min="1" :step="1" :precision="0"
/></label>
</div>
<NAlert v-if="scopeError" type="error" :show-icon="false" class="mt-3">{{ scopeError }}</NAlert>
<NAlert v-if="!safeMode && !stopAfter" type="warning" :show-icon="false" class="mt-3">
+8
View File
@@ -55,6 +55,8 @@ export interface KeyframeReadinessItem extends PromptReadinessItem {
primaryKeyframeId?: string | null
/** 当前主首帧已基于旧 SubjectForm Primary,需要重新生成。 */
primaryKeyframeStale?: boolean
/** 当前主首帧最新有效视觉校验状态;缺省不推断通过。 */
primaryQualityStatus?: 'passed' | 'failed' | 'unknown'
}
/** 镜头首帧项目级就绪汇总。 */
@@ -122,6 +124,8 @@ export interface VideoReadiness {
missingPrompt: number
missingKeyframe: number
staleKeyframe: number
/** 当前主首帧视觉质量未通过的镜头数量。 */
failedKeyframeQuality?: number
stalePrompt?: number
providerInputRecovery?: number
stalePrimaryVideo: number
@@ -649,6 +653,8 @@ export interface ProductionPlanInput {
/** 后端生产启动范围;上限必须是大于零的整数。 */
export interface ProductionStartInput extends ProductionPlanInput {
/** 本轮视频候选生成参数;随预检快照锁定,启动时传递。 */
videoGenerationOptions?: GenerationOptions
/** 从具备前置资产的阶段继续。 */
startFrom?: ProductionStage
/** 完成此阶段后正常停止;省略则允许提交视频。 */
@@ -661,6 +667,8 @@ export interface ProductionStartInput extends ProductionPlanInput {
keyframeLimit?: number
/** 本轮视频提示词上限。 */
videoPromptLimit?: number
/** 本轮严格视频质量候选的镜头上限。 */
videoLimit?: number
}
/** 生产计划中的角色身份汇总,字段遵循后端实际返回。 */
@@ -24,7 +24,8 @@ export async function checkPipeline(projectId: string, scope: ProductionStartInp
? {
imageProvider: profile.imageProvider,
videoProvider: profile.videoProvider,
imageGenerationOptions: { ...profile.imageOptions }
imageGenerationOptions: { ...profile.imageOptions },
videoGenerationOptions: { ...profile.videoOptions }
}
: undefined
const [project, checkpoints, forms, plan, status] = await Promise.all([
@@ -116,6 +117,8 @@ export function useAdvancedProduction() {
const subjectImageLimit = ref<number | null>(1)
/** 本轮视频提示词上限。 */
const videoPromptLimit = ref<number | null>(1)
/** 本轮视频候选镜头上限,默认只处理一镜。 */
const videoLimit = ref<number | null>(1)
/** 可供界面和确认描述共用的生产范围。 */
const scope = computed<ProductionStartInput>(() => ({
...(startFrom.value ? { startFrom: startFrom.value } : {}),
@@ -123,7 +126,8 @@ export function useAdvancedProduction() {
stableIdentityAnchorLimit: stableIdentityAnchorLimit.value ?? 0,
subjectImageLimit: subjectImageLimit.value ?? 0,
keyframeLimit: testKeyframeLimit.value ?? 0,
videoPromptLimit: videoPromptLimit.value ?? 0
videoPromptLimit: videoPromptLimit.value ?? 0,
videoLimit: videoLimit.value ?? 0
}))
/** 阶段顺序与后端正整数约束。 */
const scopeError = computed(() => validateProductionScope(scope.value))
@@ -208,7 +212,7 @@ export function useAdvancedProduction() {
return
if (JSON.stringify(result.input) !== confirmedInput) {
check.value = null
throw new Error('项目模型或图片参数已变化,请重新预检并确认费用。')
throw new Error('项目模型或图片、视频参数已变化,请重新预检并确认费用。')
}
check.value = result
if (result.issues.length) throw new Error('提交前预检发现条件变化,未启动生产。请处理下方问题。')
@@ -271,6 +275,7 @@ export function useAdvancedProduction() {
stableIdentityAnchorLimit,
subjectImageLimit,
videoPromptLimit,
videoLimit,
scope,
scopeError,
preflight,
@@ -304,9 +309,13 @@ export function validateProductionScope(input: ProductionStartInput): string {
if (input.startFrom && input.stopAfter && stages.indexOf(input.startFrom) > stages.indexOf(input.stopAfter))
return '结束阶段不能早于起始阶段。'
if (
[input.stableIdentityAnchorLimit, input.subjectImageLimit, input.keyframeLimit, input.videoPromptLimit].some(
value => value !== undefined && (!Number.isInteger(value) || value <= 0)
)
[
input.stableIdentityAnchorLimit,
input.subjectImageLimit,
input.keyframeLimit,
input.videoPromptLimit,
input.videoLimit
].some(value => value !== undefined && (!Number.isInteger(value) || value <= 0))
)
return '所有生成上限必须是大于 0 的整数。'
return ''
@@ -52,6 +52,8 @@ describe('生产后端真实请求契约', () => {
it('拒绝反向阶段、零值和非整数,支持主体图片结束阶段', () => {
expect(validateProductionScope({ startFrom: 'videoPrompts', stopAfter: 'subjectImages' })).toContain('结束阶段')
expect(validateProductionScope({ subjectImageLimit: 0 })).toContain('整数')
expect(validateProductionScope({ videoLimit: 0 })).toContain('整数')
expect(validateProductionScope({ videoLimit: 1.5 })).toContain('整数')
expect(validateProductionScope({ stableIdentityAnchorLimit: 1.5 })).toContain('整数')
expect(
validateProductionScope({ startFrom: 'subjectImages', stopAfter: 'subjectImages', videoPromptLimit: 1 })
+25 -2
View File
@@ -124,7 +124,8 @@ function server() {
const fetcher = vi.fn<typeof fetch>().mockImplementation(async (url, init) => {
const path = String(url)
let data: unknown = context.project.value
if (path.endsWith('/creative-profile')) data = generationProfile('capability-test')
if (path.endsWith('/creative-profile'))
data = { ...generationProfile('capability-test'), videoOptions: { resolution: '720p' } }
else if (path.includes('/workflow-executions/'))
data = {
id: 'capability-execution-1',
@@ -222,14 +223,36 @@ describe('高级串联生产的安全边界', () => {
subjectImageLimit: 1,
keyframeLimit: 1,
videoPromptLimit: 1,
videoLimit: 1,
imageProvider: 'qwen-image',
videoProvider: 'seedance',
imageGenerationOptions: { size: '2048*2048' }
imageGenerationOptions: { size: '2048*2048' },
videoGenerationOptions: { resolution: '720p' }
})
expect(fetcher.mock.calls.filter(([url]) => String(url).endsWith('/production/plan'))).toHaveLength(2)
expect(service.session.value.pipelineReceipt?.errors).toEqual(['一个提示词未生成'])
expect(service.check.value).toBeNull()
})
it('预检后视频参数变化会撤销旧确认,避免提交未经确认的参数', async () => {
const { service, fetcher, posts } = await advanced()
await service.preflight()
const original = fetcher.getMockImplementation()!
fetcher.mockImplementation((url, init) =>
String(url).endsWith('/creative-profile')
? Promise.resolve(
new Response(
JSON.stringify({
data: { ...generationProfile('capability-test'), videoOptions: { resolution: '1080p' } }
})
)
)
: original(url, init)
)
await service.start()
expect(posts()).toHaveLength(0)
expect(service.check.value).toBeNull()
expect(getOperation('capability-test').error).toContain('参数已变化')
})
it('预检后新增活动任务,确认时重新检查并阻止重复提交', async () => {
const { service, readiness, posts } = await advanced()
await service.preflight()