diff --git a/docs/api-contract-sync.md b/docs/api-contract-sync.md index 94603bb..b968099 100644 --- a/docs/api-contract-sync.md +++ b/docs/api-contract-sync.md @@ -1,5 +1,18 @@ # 接口数据同步说明 +## 2026-11-01 图片预览、质量门禁与派生任务 + +本次只接入后端根目录 `dev` 的正式 `/api` 路由,依据 `subject-form.routes.ts`、`subject-identity.routes.ts`、`production.routes.ts`、`storyboard.routes.ts` 及相应 Service 核对。未接入 3413 隔离验收服务、脚本、测试专用路由或测试页面;测试夹具只用于 Vitest。 + +- 身份图、独立选角候选和形态图共用只读预览确认。提交携带 `expectedPreviewFingerprint`;选角预览固定 `viewType=primary,useAnchorReference=false`,实际候选请求沿用正式选角接口。修改目标、参数或重新打开会清除确认,迟到响应不回填。只有 `409 + IMAGE_PREVIEW_STALE` 自动重读预览,之后仍须人工重新确认;不会自动重复生图。保留 Identity 的 `{executionId,image}` 与 Form/Casting 的直接图片回执区别。 +- 图库区分生成完成、最近审核与已采纳状态。新增正式 Form `POST images/:imageId/validate` 与显式有限预算 `POST images/generate-quality`,默认额外生成次数为 0。主图和母版确认披露可能发生的视觉审核费用,成功后只读刷新;质量失败、证据过期或请求冲突不乐观替换旧图。GET 图库仅查询,不触发模型或主图变更。 +- 身份与形态共用质量证据展示,按 `requirementId/quantityId` 关联原文、明确数量与实际观察;缺失、重复、不可观察及数量冲突不显示通过。原文与请求字段保持不变,内部编号收在高级详情。当前会话审核结果不冒充服务端长期有效的 Readiness。 +- 图片页新增 `POST production/plan {stage:'subjectImages'}` 只读检查,展示道具规格、已确认母版依赖顺序及质量问题入口。需准备资料时,经费用确认分别调用既有 `generation-prompt` 或 `prop-structure-spec/generate` 正式文字入口,不自动串联后续生图。未添加诊断脚本、测试路由或批量历史恢复入口。 +- 导演设计与画面状态任务增加服务端发现;刷新后恢复观察。`failed` 终态保留逐集部分成功、失败及 `manualReviewRequired`,不显示全部成功。订阅断线只重连/查询,离开页面关闭连接,不重提交生成。正式分镜审核和派生资产覆盖分别展示。 +- 复杂生图和图库处理复用 `AppDrawer`,固定标题与底栏,正文独立滚动,深浅主题复用现有变量。未提交或推送代码。 + +验证:类型检查、改动范围 Oxlint / Vue ESLint、全量 Vitest 和 Vite 构建;Chrome 复用 `localhost:4312` 标签,核对真实预览、参数变更清除确认、缺规格阻断、图库只读与费用确认入口、桌面和手机布局、深浅主题及固定底栏。没有执行真实付费生成/视觉审核、候选采纳或正式结果覆盖;这些写操作的成功/失败边界通过无费用自动化替身验证。 + ## 2026-10-28 剧本审核人工确认、延期验证与改写预检 按同级后端 `dev@b26aa94e` 的正式审核路由、人工确认事务、质量问题 Schema 和改写预检接入,前端仅修改根目录 `dev`。 diff --git a/src/features/breakdown/BreakdownPage.vue b/src/features/breakdown/BreakdownPage.vue index 744fee0..efbc8b8 100644 --- a/src/features/breakdown/BreakdownPage.vue +++ b/src/features/breakdown/BreakdownPage.vue @@ -1179,8 +1179,8 @@ const isInitialEmpty = computed( @confirm="run('retry')" />

- 当前阻断不属于批量接口支持的结果状态引用问题,无法在此自动修订。 + 此处仅支持填写结果状态引用的动作修订。其它问题可先使用下方“继续整理镜头”,由系统检查可修正项并保留剩余阻断。

- 本集已完成节拍规划,镜头尚未生成。请等待进度更新,或在确认中断后使用“补齐缺失镜头”。 + 本集已完成节拍规划,镜头尚未生成。请等待进度更新,或在确认中断后使用“继续整理镜头”。
= Date.parse(execution.startedAt ?? execution.createdAt)) const saved = currentSnapshot ? state : undefined + // 仅恢复审核时,服务端预检已绑定具体保存记录,前序产物继续有效;旧审核不能当成本轮结论。 + const reusesReviewSource = + execution?.metadata?.action === 'resume-review' && execution.metadata.checkpointId === checkpoint?.checkpointId + const savedContent = currentSnapshot || reusesReviewSource ? state : undefined const count = project?.episodeCount ?? saved?.episodeCount const completed: Record = { // 恢复服务明确复用最新保存记录中的规划;不从 Episode、Character 或执行顺序反推规划成功。 @@ -55,10 +66,11 @@ export function dramaStages( !!state?.storyPlan && (currentSnapshot || execution?.metadata?.action === 'resume-generation' || - execution?.metadata?.action === 'resume-rewrite'), - generateEpisode: !!count && (saved?.episodes?.length ?? 0) >= count, - generateCharacter: !!saved?.characters, - generateWorld: !!saved?.world, + execution?.metadata?.action === 'resume-rewrite' || + reusesReviewSource), + generateEpisode: !!count && (savedContent?.episodes?.length ?? 0) >= count, + generateCharacter: !!savedContent?.characters, + generateWorld: !!savedContent?.world, reviewDrama: typeof saved?.reviewPassed === 'boolean', finishProject: project?.status === 'completed' } diff --git a/src/features/create-drama/review/DramaReviewPanel.vue b/src/features/create-drama/review/DramaReviewPanel.vue index d556aa9..0031cc0 100644 --- a/src/features/create-drama/review/DramaReviewPanel.vue +++ b/src/features/create-drama/review/DramaReviewPanel.vue @@ -10,6 +10,7 @@ import { useQuery } from '../../../composables/useQuery' import { useProjectContext } from '../../projects/context' import { workflowCheckpoints } from '../../workflows/selectors' import DramaRewriteAction from './DramaRewriteAction.vue' +import DramaSystemReviewAction from './DramaSystemReviewAction.vue' import ManualReviewIssueEditor from './ManualReviewIssueEditor.vue' import ReviewUncertaintyCard from './ReviewUncertaintyCard.vue' import { reviewCategoryOptions, suggestionForUncertainty, savedReviewDecisions } from './model' @@ -87,12 +88,12 @@ const hasRewriteTargets = computed( ) ) /** 当前有效预检只强调一个下一步入口,配色不代替服务端操作权限。 */ -const primaryAction = computed<'confirm' | 'rewrite' | null>(() => { +const primaryAction = computed<'review' | 'rewrite' | null>(() => { if (flow.locked.value || rewriteQuery.loading.value || rewriteQuery.error.value || latest.value?.passed !== false) return null if (currentRewrite.value?.status === 'blocked' || currentRewrite.value?.status === 'stale') return null if (hasRewriteTargets.value) return currentRewrite.value?.ready === true ? 'rewrite' : null - return hasManualIssues.value ? 'confirm' : null + return hasManualIssues.value ? 'review' : null }) /** 剧集范围同样读取真实改写预检,设定单独改写不伪造成剧集任务。 */ const rewriteEpisodeSummary = computed(() => { @@ -117,9 +118,9 @@ const nextStep = computed(() => { description: `${scope}已有改写依据。点击“改写预检”核对范围${hasManualIssues.value ? ';待确认问题仍可继续人工处理' : ''}。开始改写前会再次确认费用。` } : { - title: '请先核对审核问题', + title: '可由系统继续核查', description: - '点击“人工确认”对照原文逐项处理。确认后如需改写,会显示“改写预检”入口;所有处理都需要你确认。' + '点击“系统重新核查”检查已保存正文,系统会优先复核疑点。只有仍无法确认的关键问题才需要人工处理。' } }) /** 正式正文的当前阅读集号。 */ @@ -283,10 +284,16 @@ function editorClosed() { :disabled="flow.writing.value" @refresh="flow.query.refresh" /> + + +

+ + +

+import { computed, onScopeDispose, ref, watch } from 'vue' +import { NButton } from 'naive-ui' +import { FileSearch } from '@lucide/vue' +import { AppDialog, WorkspaceRefreshButton } from '../../../components/ui' +import ContextNotice from '../../../components/ui/ContextNotice.vue' +import { useQuery } from '../../../composables/useQuery' +import { errorMessage } from '../../../lib/http' +import { getOperation, runOperation } from '../../workflows/operations' +import { useWorkflowExecution } from '../../workflows/execution' +import { dramaReviewApi, loadDramaReviewResumePreview } from './api' + +/** 已保存剧本的系统核查入口,沿用项目级活动任务锁。 */ +const props = withDefaults( + defineProps<{ + /** 当前正式项目。 */ projectId: string + /** 当前外部操作锁。 */ disabled?: boolean + /** 无明确改写目标时强调系统核查。 */ primary?: boolean + }>(), + { disabled: false, primary: false } +) +/** 后台实际受理后才通知页面刷新。 */ +const emit = defineEmits<{ started: [executionId: string, projectId: string] }>() +/** 费用与范围确认弹窗。 */ +const open = ref(false) +/** 正在提交,防止重复收费请求。 */ +const writing = ref(false) +/** 只展示当前项目的操作错误。 */ +const actionError = ref('') +/** 当前项目的公共操作状态。 */ +const operation = computed(() => getOperation(props.projectId)) +/** 弹窗打开后才查询来源。 */ +const queryKey = computed(() => (open.value ? props.projectId : '')) +/** 只读查询可取消,关闭弹窗不启动模型。 */ +const query = useQuery(queryKey, (id, signal) => + id ? loadDramaReviewResumePreview(id, signal) : Promise.resolve(null) +) +/** 页面布局观察后台任务,本入口仅保存真实句柄。 */ +const trackerProject = ref('') +/** 与其他创作入口共用持久化任务句柄。 */ +const tracker = useWorkflowExecution(trackerProject, 'create-drama') +/** 当前确认来源版本。 */ +let revision = 0 +/** 二次预检的取消控制器。 */ +let controller: AbortController | undefined +watch([open, () => props.projectId], () => { + revision++ + controller?.abort() + actionError.value = '' +}) +onScopeDispose(() => { + revision++ + controller?.abort() +}) +/** 仅使用当前预检与真实活动状态开放提交。 */ +const ready = computed( + () => + query.data.value?.ready === true && + !query.loading.value && + !query.error.value && + !props.disabled && + !operation.value.pending && + !writing.value +) + +/** 二次核对保存记录后提交一次核查;来源变化或网络不确定时不自动重试。 */ +async function confirm() { + if (!ready.value || !query.data.value) return + const expected = query.data.value + const id = props.projectId + const version = revision + writing.value = true + actionError.value = '' + controller = new AbortController() + try { + await runOperation( + id, + '系统核查剧本', + async () => { + const current = await loadDramaReviewResumePreview(id, controller!.signal) + if (version !== revision || props.projectId !== id) throw new Error('当前项目已变化,请重新核对。') + if ( + !current.ready || + current.checkpointId !== expected.checkpointId || + current.episodeCount !== expected.episodeCount + ) { + query.data.value = current + throw new Error('保存记录已变化,请重新核对本次范围。') + } + const started = await dramaReviewApi.resumeReview(id, expected.checkpointId) + await tracker.track(started.executionId, id) + if (version === revision && props.projectId === id) { + emit('started', started.executionId, id) + open.value = false + } + return started + }, + { type: 'info', content: '系统核查已开始,请查看创作任务进度。' } + ) + if (version === revision && props.projectId === id && getOperation(id).error) + actionError.value = getOperation(id).error + } catch (cause) { + if (version === revision && props.projectId === id) actionError.value = errorMessage(cause) + } finally { + writing.value = false + } +} + + + diff --git a/src/features/create-drama/review/api.ts b/src/features/create-drama/review/api.ts index 5b28bb4..5df09b4 100644 --- a/src/features/create-drama/review/api.ts +++ b/src/features/create-drama/review/api.ts @@ -3,6 +3,7 @@ import type { ConfirmDramaIssuesInput, ConfirmDramaIssuesResult, DramaReviewPreview, + DramaReviewResumePreview, DramaReviewSnapshot, DramaRewritePreview, LatestDramaReview @@ -100,6 +101,28 @@ function validSuggestions(value: unknown): boolean { /** 真实剧本审核接口;只读预检和人工确认均不调用模型。 */ export const dramaReviewApi = { + /** + * 读取重新核查已保存剧本的来源,不调用模型。 + * @param id 正式项目 + * @param signal 取消过期查询 + * @returns 可核查的正文版本与集数 + */ + resumePreview: (id: string, signal?: AbortSignal) => + request(`/projects/${encodeURIComponent(id)}/resume-review/preview`, { signal }), + /** + * 明确启动当前保存版本的系统核查,不重写正文。 + * @param id 正式项目 + * @param expectedCheckpointId 用户核对的来源版本 + * @returns 持久化任务句柄 + */ + resumeReview: (id: string, expectedCheckpointId: string) => + request<{ executionId: string; projectId: string; status: string }>( + `/projects/${encodeURIComponent(id)}/resume-review`, + { + method: 'POST', + body: { confirmed: true, expectedCheckpointId } + } + ), /** * 读取最新正式审核,尚无审核时返回空值。 * @param id 正式项目编号 @@ -198,3 +221,26 @@ export async function loadDramaReview(id: string, signal?: AbortSignal): Promise return { latest, preview: null, previewError: errorMessage(cause) } } } + +/** + * 核对系统核查预检的归属与完整字段,不能据本地状态补造就绪结果。 + * @param id 正式项目 + * @param signal 取消过期查询 + * @returns 当前可信核查预检 + */ +export async function loadDramaReviewResumePreview( + id: string, + signal?: AbortSignal +): Promise { + const value = await dramaReviewApi.resumePreview(id, signal) + if ( + value.projectId !== id || + !value.checkpointId || + value.readOnly !== true || + typeof value.ready !== 'boolean' || + !Number.isSafeInteger(value.episodeCount) || + value.episodeCount < 1 + ) + throw new Error('系统核查的保存记录不完整,请重新读取。') + return value +} diff --git a/src/features/create-drama/review/types.ts b/src/features/create-drama/review/types.ts index cc93318..4bf1222 100644 --- a/src/features/create-drama/review/types.ts +++ b/src/features/create-drama/review/types.ts @@ -35,6 +35,15 @@ export interface ManualReviewDecision { /** 已保存的后续核验标准。 */ verificationCriteria?: string } +/** 系统核查已保存正文前的只读来源预检。 */ +export interface DramaReviewResumePreview { + /** 正式项目。 */ projectId: string + /** 当前完整正文对应的保存记录。 */ checkpointId: string + /** 实际保存的剧集数。 */ episodeCount: number + /** 后端已确认可核查。 */ ready: boolean + /** 预检不调用模型。 */ readOnly: true +} + /** 最新正式审核,不从保存记录的布尔值虚构明细。 */ export interface LatestDramaReview { /** 正式审核编号。 */ id: string @@ -48,6 +57,16 @@ export interface LatestDramaReview { } | null /** 原始待人工确认的问题。 */ pendingQualityIssues: DramaReviewIssue[] /** 已保存的人工裁决。 */ manualUncertaintyDecisions: ManualReviewDecision[] + /** 系统逐项复核摘要;不等同于人工确认。 */ automaticQualityResolution?: { + /** 本次复核候选数。 */ candidateCount: number + /** 已有有效依据的项数。 */ resolvedCount: number + /** 仍需核对的项数。 */ remainingCount: number + /** 系统复核实际状态。 */ status: 'completed' | 'failed' + /** 实际判断依据,仅供追溯。 */ decisions: Array<{ + /** 本轮候选索引。 */ candidateIndex: number + /** 判断原因。 */ reason: string + }> + } | null /** 已有改写目标集数。 */ affectedEpisodes: number[] /** 敏感词审核结果。 */ hitWords: string[] } diff --git a/src/features/generation-config/image-defaults.ts b/src/features/generation-config/image-defaults.ts new file mode 100644 index 0000000..e2d7e3a --- /dev/null +++ b/src/features/generation-config/image-defaults.ts @@ -0,0 +1,27 @@ +import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from './types' + +/** + * 从当前项目与能力目录恢复单图配置,丢弃目录不支持的旧尺寸。 + * @param catalog 当前模型能力目录 + * @param profile 当前项目保存的配置 + * @returns 可用供应方及本次独立的参数副本 + */ +export function imageGenerationDefaults( + catalog: GenerationModelCatalog, + profile: CreativeProfile +): { + /** 可用供应方。 */ provider: string + /** 模型默认值与项目值合并后的参数。 */ options: GenerationOptions +} { + const selected = + catalog.images.find(item => item.provider === profile.imageProvider && item.enabled) ?? + catalog.images.find(item => item.enabled) + const options: GenerationOptions = { + ...selected?.defaults, + ...(selected?.provider === profile.imageProvider ? profile.imageOptions : {}) + } + const size = selected?.generationOptions.find(item => item.key === 'size') + if (size?.options?.length && !size.options.some(option => option.value === options.size)) + options.size = selected?.defaults.size ?? size.options[0]?.value ?? '' + return { provider: selected?.provider ?? '', options } +} diff --git a/src/features/production/api.ts b/src/features/production/api.ts index 3b4d7d7..6352003 100644 --- a/src/features/production/api.ts +++ b/src/features/production/api.ts @@ -67,8 +67,9 @@ export const productionApi = { plan: (projectId: string, signal?: AbortSignal, input: ProductionPlanInput = {}) => request(`${projectPath(projectId)}/production/plan`, { method: 'POST', - // 计划只解析这三项;阶段范围及视频参数只由启动接口消费。 + // 计划携带与当前准备范围一致的阶段,不创建任务。 body: { + stage: input.stage, imageProvider: input.imageProvider, imageGenerationOptions: input.imageGenerationOptions, videoProvider: input.videoProvider diff --git a/src/features/production/components/ImagePreparationPlan.vue b/src/features/production/components/ImagePreparationPlan.vue new file mode 100644 index 0000000..af89dd8 --- /dev/null +++ b/src/features/production/components/ImagePreparationPlan.vue @@ -0,0 +1,142 @@ + + + diff --git a/src/features/production/components/ProductionPlanPanel.vue b/src/features/production/components/ProductionPlanPanel.vue index 9fe3b34..7b89260 100644 --- a/src/features/production/components/ProductionPlanPanel.vue +++ b/src/features/production/components/ProductionPlanPanel.vue @@ -1,12 +1,17 @@ diff --git a/src/features/subject-identity/components/IdentityGallery.vue b/src/features/subject-identity/components/IdentityGallery.vue index e57c0c6..db2da90 100644 --- a/src/features/subject-identity/components/IdentityGallery.vue +++ b/src/features/subject-identity/components/IdentityGallery.vue @@ -1,4 +1,6 @@ diff --git a/src/features/subject-identity/types.ts b/src/features/subject-identity/types.ts index 4010516..6323318 100644 --- a/src/features/subject-identity/types.ts +++ b/src/features/subject-identity/types.ts @@ -1,4 +1,6 @@ import type { SubjectImageStatus, SubjectFormAsset } from '../subject-images/types' +import type { ImageGenerationPreview } from '../subject-images/generation-preview' +import type { ImageValidationResult } from '../subject-images/validation' /** 只有 primary 视图可以选为身份母版,其余视图是辅助参考。 */ export type IdentityViewType = 'primary' | 'front' | 'three-quarter' | 'full-body' @@ -62,19 +64,31 @@ export type SaveIdentityInput = Partial } /** Character 选角候选固定独立生成 primary,不复用旧 Anchor,也不会自动成为新 Anchor。 */ -export interface GenerateCastingCandidateInput { - prompt?: string - provider?: string - generationOptions?: Record -} +export type GenerateCastingCandidateInput = Omit< + GenerateIdentityImageInput, + 'viewType' | 'referenceImageId' | 'useAnchorReference' +> /** 身份文本批量生成回执,不代表已生成参考图。 */ export interface IdentityBatchResult { @@ -189,41 +203,10 @@ export type IdentityReceipt = | { kind: 'stable-anchors'; title: string; result: StableAnchorBatchResult } /** 最终身份图片 Provider 输入,直接对应身份预览接口。 */ -export interface IdentityImagePreview { - /** 实际供应方。 */ - provider: string - /** 实际模型。 */ - model: string - /** 最终提示词。 */ - providerPrompt: string - /** 实际引用图片地址。 */ - referenceImages: string[] - /** 后端参考图选择计划。 */ - referencePlan: Record - /** 后端解析后的生成配置。 */ - generationConfig: Record -} +export type IdentityImagePreview = ImageGenerationPreview /** 指定身份图片的视觉校验回执。 */ -export interface IdentityValidationResult { - /** 正式主体 ID。 */ - subjectId: string - /** 被校验的图片 ID。 */ - imageId: string - /** 是否通过本次校验。 */ - passed: boolean - /** 校验总结。 */ - summary: string - /** 具体问题。 */ - issues: Array<{ - /** 问题类型。 */ - type: string - /** 严重程度。 */ - severity: string - /** 问题描述。 */ - description: string - }> -} +export type IdentityValidationResult = ImageValidationResult /** 有限预算的单主体稳定母版生成参数。 */ export interface StableAnchorQualityInput { diff --git a/src/features/subject-identity/useSubjectIdentity.ts b/src/features/subject-identity/useSubjectIdentity.ts index f7056ea..8d025c0 100644 --- a/src/features/subject-identity/useSubjectIdentity.ts +++ b/src/features/subject-identity/useSubjectIdentity.ts @@ -1,3 +1,5 @@ +import { imageValidationPassed } from '../subject-images/validation' +import type { ImageGenerationSubmission } from '../subject-images/generation-preview' import { computed, ref, shallowRef, watch } from 'vue' import { usePolling } from '../../composables/usePolling' import { visualStyleApi } from '../visual-style' @@ -5,7 +7,7 @@ import { useProjectGenerationRevision } from '../generation-config/context' import { generationConfigApi } from '../generation-config/api' import { subjectImagesApi } from '../subject-images/api' import { hasRunningImages } from '../subject-images/model' -import { batchResultNotice, runOperation, type OperationNotice } from '../workflows/operations' +import { batchResultNotice, getOperation, runOperation, type OperationNotice } from '../workflows/operations' import { useProjectMutationGuard } from '../workflows/useProjectMutationGuard' import { useProjectContext } from '../projects/context' import { subjectIdentityApi } from './api' @@ -207,6 +209,18 @@ export function useSubjectIdentity() { const validationResults = ref>({}) /** 质量闭环结果以正式主体 ID 保存。 */ const qualityResults = ref>({}) + /** 审核只适用于本次主体、身份版本和图片输入。 */ + const validationSourceKey = computed(() => + JSON.stringify([projectId.value, selectedId.value, identity.value, images.value]) + ) + /** 来源变化或切换主体后清除旧审核展示,不能沿用历史通过。 */ + watch( + validationSourceKey, + () => { + delete validationResults.value[selectedId.value] + }, + { flush: 'sync' } + ) /** 当前主体的指定图片校验结果。 */ const validationResult = computed(() => validationResults.value[selectedId.value] ?? null) /** 当前主体的质量闭环回执。 */ @@ -261,6 +275,7 @@ export function useSubjectIdentity() { const id = subject.value.id const name = subject.value.name delete validationResults.value[id] + const sourceKey = validationSourceKey.value await runImageOperation( 'validate', imageId, @@ -269,12 +284,12 @@ export function useSubjectIdentity() { const result = await subjectIdentityApi.validateImage(id, imageId) if (result.subjectId !== id || result.imageId !== imageId) throw new Error('身份校验回执与提交目标不匹配') - validationResults.value[id] = result + if (validationSourceKey.value === sourceKey) validationResults.value[id] = result return result }, result => ({ - type: result.passed ? 'success' : 'warning', - content: `${name} 的身份图片校验${result.passed ? '通过' : '未通过'}:${result.summary}` + type: imageValidationPassed(result) ? 'success' : 'warning', + content: `${name} 的身份图片校验${imageValidationPassed(result) ? '通过' : '未通过或待复核'}:${result.summary}` }) ) } @@ -478,26 +493,25 @@ export function useSubjectIdentity() { /** * 生图不修改文字锁定;即使有自定义提示词,也需已有身份提示词与项目风格。 * @param input 已确认的视图、模型与参考图片参数 - * @param onSubmitStarted 通过前置检查并开始提交时的回调 + * @returns 任务创建结果及原始错误 */ - async function generateImage(input: GenerateIdentityImageInput, onSubmitStarted?: () => void) { - if (!canGenerateImage.value || !subject.value || !identity.value) return + async function generateImage(input: GenerateIdentityImageInput): Promise { + if (!canGenerateImage.value || !subject.value || !identity.value) return { accepted: false } if ( input.referenceImageId && !images.value.some( image => image.id === input.referenceImageId && image.status === 'completed' && image.imageUrl ) ) - return + return { accepted: false } const id = subject.value.id const identityId = identity.value.id const project = projectId.value const name = subject.value.name - await runOperation( + const accepted = await runOperation( project, `提交 ${name} 身份参考图生成`, async () => { - onSubmitStarted?.() const started = await subjectIdentityApi.generateImage(id, input) const image = started?.image if ( @@ -521,24 +535,24 @@ export function useSubjectIdentity() { }, { type: 'info', content: `${name} 的身份参考图已提交生成,完成后会显示结果。` } ) + return { accepted, cause: getOperation(project).cause } } /** * 单角色候选图固定独立生成,不复用旧母版,生成成功后仍需人工确认选角。 * @param input 已确认的候选图模型与生成参数 - * @param onSubmitStarted 通过前置检查并开始提交时的回调 + * @returns 任务创建结果及原始错误 */ - async function generateCastingCandidate(input: GenerateCastingCandidateInput, onSubmitStarted?: () => void) { - if (!canGenerateCandidate.value || !subject.value || !identity.value) return + async function generateCastingCandidate(input: GenerateCastingCandidateInput): Promise { + if (!canGenerateCandidate.value || !subject.value || !identity.value) return { accepted: false } const id = subject.value.id const identityId = identity.value.id const project = projectId.value const name = subject.value.name - await runOperation( + const accepted = await runOperation( project, `提交 ${name} 角色候选图生成`, async () => { - onSubmitStarted?.() const image = await subjectIdentityApi.generateCastingCandidate(id, input) if (!image || image.identityId !== identityId || !['pending', 'generating'].includes(image.status)) { throw new Error(image?.error || '选角候选任务未成功创建,请刷新后重试。') @@ -552,6 +566,7 @@ export function useSubjectIdentity() { }, { type: 'info', content: `${name} 的角色候选图已提交生成,完成后会显示结果。` } ) + return { accepted, cause: getOperation(project).cause } } /** diff --git a/src/features/subject-images/SubjectImagesPage.vue b/src/features/subject-images/SubjectImagesPage.vue index 97973ef..dbc86ab 100644 --- a/src/features/subject-images/SubjectImagesPage.vue +++ b/src/features/subject-images/SubjectImagesPage.vue @@ -14,14 +14,25 @@ import WorkspaceTools from '../../components/ui/WorkspaceTools.vue' import { NButton, NCheckbox, NInput, NInputNumber, NPopover, NScrollbar, NSelect, NTag } from 'naive-ui' import { computed, onScopeDispose, ref, watch, type Directive } from 'vue' import { useRoute, useRouter } from 'vue-router' -import { Search, Download, ImagePlus, ArrowLeft, LayoutGrid, Columns3, LoaderCircle, Settings2 } from '@lucide/vue' +import { + Search, + Download, + ImagePlus, + ArrowLeft, + LayoutGrid, + Columns3, + LoaderCircle, + Settings2, + ClipboardCheck +} from '@lucide/vue' import { AssetImage, EmptyState, StatusBadge } from '../../components/ui' import { downloadText } from '../../lib/format' import ConfirmAction from '../workflows/ConfirmAction.vue' import { useSubjectImages } from './useSubjectImages' import { hasRunningImages, primaryImage, isIdentityAnchorReuse } from './model' -import type { GenerateFormImageInput, SubjectFormAsset } from './types' +import type { SubjectFormAsset } from './types' import GenerateImageDialog from './components/GenerateImageDialog.vue' +import ImagePreparationDrawer from './components/ImagePreparationDrawer.vue' import ImageGalleryDialog from './components/ImageGalleryDialog.vue' import FormPromptDialog from './components/FormPromptDialog.vue' import FormPromptBatch from './components/FormPromptBatch.vue' @@ -107,6 +118,8 @@ const impactOptions = computed(() => { })) }) const toolsOpen = ref(false) +/** 免费检查图片阶段规格和母版依赖。 */ +const preparationOpen = ref(false) /** 移动端禁用纯图标按钮的悬浮说明,避免触摸操作弹出多余浮层。 */ const isMobile = ref(false) if (typeof window !== 'undefined') { @@ -262,10 +275,6 @@ function openGallery(form: SubjectFormAsset) { galleryId.value = form.id galleryOpen.value = true } -/** 本次提交的 ID 和配置由弹窗固定,关闭弹窗不会取消制作任务。 */ -function submitGenerate(formId: string, input: GenerateFormImageInput) { - void generate(formId, input) -} /** 导出真实批量回执供排障,不构造成功图片地址。 */ function exportReceipt() { downloadText('subject-images-receipt.json', JSON.stringify(session.value.receipt, null, 2), 'application/json') @@ -316,7 +325,7 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule(' - 人物、场景、道具的基础形态默认复用已确认并锁定的身份母版,无需再次生图。其他形态仍需单独生成。自动复用的主图随母版更新;你手选或独立生成的主图保留,母版变化后需要核对。 + 基础形态可复用已确认并锁定的身份母版,其他形态仍需单独生成。浏览图库不会补建或切换主图;母版变化后,已有图片保留并需重新核对来源与质量。

- 图库在进入和操作完成后读取最新记录。基础形态会自动复用已锁定身份母版,主图可直接供分镜引用;独立候选与历史失败记录均保留。 + 图库仅查看已保存的图片。已有主图仍须通过当前来源和质量检查,才能用于后续分镜;独立候选与历史失败记录均保留。

项目批量生图

@@ -581,6 +590,18 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule(' {{ filtered.length }} 个形态