feat(short-drama-agent-front): 接入素材预览审核并完善创作流程

This commit is contained in:
GJ committed 2026-11-02 10:16:10 +08:00
1 parent f8b0fbb8ca
commit dc8bb17a23
66 files changed
+2864 -632

No files matched your search

+2 -1
View File
@@ -67,8 +67,9 @@ export const productionApi = {
plan: (projectId: string, signal?: AbortSignal, input: ProductionPlanInput = {}) =>
request<ProductionPlanResponse>(`${projectPath(projectId)}/production/plan`, {
method: 'POST',
// 计划只解析这三项;阶段范围及视频参数只由启动接口消费。
// 计划携带与当前准备范围一致的阶段,不创建任务。
body: {
stage: input.stage,
imageProvider: input.imageProvider,
imageGenerationOptions: input.imageGenerationOptions,
videoProvider: input.videoProvider
@@ -0,0 +1,142 @@
<script setup lang="ts">
import { computed } from 'vue'
import { NButton, NCollapse, NCollapseItem, NTag } from 'naive-ui'
import { RouterLink } from 'vue-router'
import { ArrowUpRight } from '@lucide/vue'
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
import { userFacingText } from '../../../lib/user-facing-text'
import type { ProductionPlan } from '../types'
/** 图片准备与生产计划共用同一份后端规格及依赖。 */
const props = defineProps<{
/** 当前真实制作计划。 */ plan: ProductionPlan
/** 图片准备抽屉允许明确准备文字资料,生产计划仍只读。 */ allowPreparation?: boolean
/** 当前项目存在任务或检查未成功时禁止准备。 */ disabled?: boolean
}>()
/** 从计划转到资产处理时关闭外层检查抽屉。 */
const emit = defineEmits<{
/** 转到现有资产处理页面。 */ navigate: []
/** 确认前选择一次文字准备操作。 */ prepare: [formId: string, kind: 'prompt' | 'structure']
}>()
/** 顶层规格与稳定母版携带的规格来自同一后端检查。 */
const specs = computed(() => props.plan.propStructureSpecs ?? props.plan.stableIdentityAnchors?.propStructureSpecs)
/** 以服务端依赖顺序展示母版,未返回顺序时保留原始顺序。 */
const anchors = computed(() => {
const items = props.plan.stableIdentityAnchors?.items ?? props.plan.details.stableIdentityAnchors ?? []
const order = props.plan.stableIdentityAnchors?.dependencyOrder ?? []
return items.toSorted((a, b) => {
const left = order.indexOf(a.subjectId),
right = order.indexOf(b.subjectId)
return (left < 0 ? order.length : left) - (right < 0 ? order.length : right)
})
})
/** 主体名称从真实计划取得,不由引用或案例推断。 */
const names = computed(() => new Map(anchors.value.map(item => [item.subjectId, item.subjectName])))
/** 质量失败或过期只提供候选审核入口,不自动重生。 */
const qualityIssues = computed(() =>
props.plan.details.subjectImages.filter(item =>
item.issues.some(issue => ['quality_failed', 'quality_stale'].includes(issue.code))
)
)
</script>
<template>
<!-- 以下是道具结构规格准备模块,可准备不等于已经完成 -->
<section v-if="specs" class="space-y-4" aria-label="道具结构规格">
<WorkspaceSectionHeading
title="道具结构规格"
description="仅检查已有资料。待准备项需先补齐画面描述或规格,尚未执行。"
/>
<div class="flex flex-wrap gap-x-5 gap-y-2 text-xs">
<span>共 {{ specs.total }} 项</span><span>已就绪 {{ specs.ready }}</span
><span>待准备 {{ specs.upstreamResolvable }}</span
><span :class="specs.manualBlocked ? 'text-danger' : 'text-muted'"
>需人工处理 {{ specs.manualBlocked }}</span
>
</div>
<NCollapse v-if="specs.items.length" :default-expanded-names="specs.manualBlocked ? ['specs'] : []">
<NCollapseItem name="specs" title="查看规格准备明细">
<ul class="space-y-4 text-xs leading-6">
<li v-for="item in specs.items" :key="item.subjectFormId ?? item.subjectId">
<div class="flex flex-wrap items-center gap-2">
<strong>{{ names.get(item.subjectId) ?? item.subjectRef }}</strong
><NTag
size="small"
:bordered="false"
:type="item.status === 'blocked' ? 'error' : 'default'"
>{{ { ready: '已就绪', upstream: '待准备', blocked: '需人工处理' }[item.status] }}</NTag
>
</div>
<p class="mt-1 wrap-anywhere text-muted">{{ userFacingText(item.reason) }}</p>
<NButton
v-if="allowPreparation && item.status === 'upstream' && item.subjectFormId"
size="small"
class="workspace-action-button mt-2"
:disabled="disabled"
@click="
emit('prepare', item.subjectFormId, item.requiresFormPrompt ? 'prompt' : 'structure')
"
>{{ item.requiresFormPrompt ? '准备形态画面描述' : '准备结构规格' }}</NButton
>
</li>
</ul>
</NCollapseItem>
</NCollapse>
</section>
<!-- 以下是已确认母版依赖及准备顺序模块 -->
<section v-if="anchors.length" class="space-y-4" aria-label="母版准备顺序">
<WorkspaceSectionHeading
title="母版准备顺序"
description="按已确认的共享关系排列;锁定资产和人工阻断需要先核对。"
/>
<ol class="space-y-4 text-xs leading-6">
<li v-for="(item, index) in anchors" :key="item.subjectId" class="min-w-0">
<div class="flex flex-wrap items-center gap-2">
<strong>{{ index + 1 }}. {{ item.subjectName }}</strong
><NTag :bordered="false" size="small" :type="item.status === 'blocked' ? 'error' : 'default'">{{
{ skipped: '已有母版', ready: '待生成', upstream: '待准备资料', blocked: '需人工处理' }[
item.status
]
}}</NTag>
</div>
<p v-if="item.dependencySubjectIds?.length" class="mt-1 text-muted">
先准备:{{ item.dependencySubjectIds.map(id => names.get(id) ?? '关联主体').join('、') }}
</p>
<p class="mt-1 wrap-anywhere text-muted">{{ userFacingText(item.reason) }}</p>
<RouterLink
v-if="item.status === 'blocked'"
class="text-button mt-2 inline-flex items-center gap-2"
:to="{ path: `/projects/${plan.projectId}/subject-identity`, query: { subjectId: item.subjectId } }"
@click="emit('navigate')"
><ArrowUpRight :size="14" />查看主体与候选</RouterLink
>
</li>
</ol>
</section>
<!-- 以下是图片质量问题处理入口模块,保留旧图且不自动生成 -->
<section v-if="qualityIssues.length" class="space-y-4 lg:col-span-2" aria-label="图片质量待处理">
<WorkspaceSectionHeading
title="图片质量待处理"
description="审核失败或证据过期时,先核对候选并明确重新审核。"
/>
<article v-for="item in qualityIssues" :key="item.subjectFormId" class="space-y-2 text-xs leading-6">
<strong>{{ item.subjectName }} · {{ item.formName }}</strong>
<p
v-for="issue in item.issues.filter(issue => ['quality_failed', 'quality_stale'].includes(issue.code))"
:key="issue.code"
class="text-danger"
>
{{ userFacingText(issue.reason) }}
</p>
<RouterLink
class="text-button inline-flex items-center gap-2"
:to="{
path: `/projects/${plan.projectId}/subject-images`,
query: { subjectFormId: item.subjectFormId }
}"
@click="emit('navigate')"
><ArrowUpRight :size="14" />查看候选与审核</RouterLink
>
</article>
</section>
</template>
@@ -1,12 +1,17 @@
<script setup lang="ts">
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import ImagePreparationPlan from './ImagePreparationPlan.vue'
import { userFacingText } from '../../../lib/user-facing-text'
import { computed } from 'vue'
import { NCollapse, NCollapseItem, NScrollbar } from 'naive-ui'
import type { ProductionPlan, ProjectProductionStatus } from '../types'
/** 展示当前制作计划与真实资产状态,不在页面重复推断业务规则。 */
const props = defineProps<{ plan: ProductionPlan; status: ProjectProductionStatus }>()
const props = defineProps<{
/** 当前真实计划。 */ plan: ProductionPlan
/** 可选的已生成资产统计。 */ status?: ProjectProductionStatus
}>()
/** 生产阶段共享计划字段,角色身份就绪信息单独展示,避免混用不同 DTO。 */
const rows = computed(() => [
...(props.plan.stableIdentityAnchors ? [{ label: '稳定身份锚点', stage: props.plan.stableIdentityAnchors }] : []),
@@ -56,7 +61,7 @@ const problems = computed(() => [
{{ plan.characterIdentity.pending }} · 可自动补齐 {{ plan.characterIdentity.autoResolvable }} · 需人工处理
{{ plan.characterIdentity.manualBlocked }}
</p>
<p class="mt-2 text-xs" role="status">
<p v-if="status" class="mt-2 text-xs" role="status">
当前制作状态:{{ status.completed ? '制作已完成' : `待完成${stageNames[status.stage]}` }} · 有效主体图
{{ status.subjectImages.current }}/{{ status.subjectImages.total }} · 有效首帧
{{ status.keyframes.skipped }}/{{ status.keyframes.total }} · 有效主视频 {{ status.videos.skipped }}/{{
@@ -92,20 +97,22 @@ const problems = computed(() => [
</table>
</NScrollbar>
<p class="mt-2 text-xs text-muted">
计划会根据当前素材自动更新。已有有效结果会直接复用;重新生成的过期主体图会自动设为当前主图,手动生成的候选仍可在形态图片页自行确认。
计划只反映当前准备情况。图片生成完成后仍需通过质量和来源检查;失败候选会保留,不能用重新生图自动消除质量阻断。
</p>
<ContextNotice v-if="plan.hasManualBlockers" type="warning" :show-icon="false" class="mt-3">
当前有
{{ plan.manualBlocked }}
项独立准备问题需人工处理。上表各阶段的影响数量可能重叠,不能直接相加。可先生成就绪的主体参考图;成功结果会保留,遇到阻塞时后续阶段可能暂停。
</ContextNotice>
<!-- 以下是当前道具规格、共享母版依赖与质量处理入口 -->
<div class="mt-5 grid items-start gap-6 lg:grid-cols-2"><ImagePreparationPlan :plan="plan" /></div>
<NCollapse v-if="problems.length" class="mt-3" :default-expanded-names="['issues']">
<NCollapseItem name="issues" title="查看还需要准备的内容">
<ul class="space-y-3 text-xs">
<li v-for="item in problems" :key="item.key">
<strong class="break-all">{{ item.label }}</strong>
<p v-for="(issue, index) in item.issues" :key="index" class="mt-1 break-words">
{{ issue.reason
{{ userFacingText(issue.reason)
}}<span v-if="issue.missingSubjects?.length">
· 关联主体:{{ issue.missingSubjects.join('、') }}</span
>
+2
View File
@@ -68,6 +68,8 @@ export function issueLabel(code: ProductionIssueCode): string {
missing_primary_keyframe: '缺少可用首帧',
missing_identity: '缺少角色身份',
missing_identity_anchor: '缺少演员母版',
quality_failed: '主体图片质量未通过',
quality_stale: '主体图片审核需更新',
identity_unlocked: '演员身份未锁定',
missing_prompt: '缺少视频提示词',
stale_prompt: '视频提示词需要更新',
+43
View File
@@ -11,6 +11,10 @@ export type ProductionIssueCode =
| 'missing_primary_keyframe'
| 'missing_identity'
| 'missing_identity_anchor'
/** 当前主图质量未通过。 */
| 'quality_failed'
/** 当前主图审核证据已失效。 */
| 'quality_stale'
| 'identity_unlocked'
| 'missing_prompt'
| 'stale_prompt'
@@ -555,9 +559,15 @@ export interface ProductionPlan {
characterIdentity?: ProductionCharacterIdentityPlan
/** 稳定身份母版阶段与真实逐项计划。 */
stableIdentityAnchors?: ProductionPlanStage & {
/** 按已确认共享关系给出的准备顺序。 */
dependencyOrder?: string[]
/** 同源的道具规格统计。 */
propStructureSpecs?: PropStructurePreparation
/** 稳定主体的逐项就绪结果。 */
items?: ProductionStableIdentityItem[]
}
/** 道具规格准备统计,仅表示当前计划,不代表执行完成。 */
propStructureSpecs?: PropStructurePreparation | null
stage: ProductionStatusStage
hasManualBlockers: boolean
manualBlocked: number
@@ -746,6 +756,8 @@ export type ProductionStage = 'subjectImages' | 'keyframes' | 'videoPrompts'
/** 无消耗生产计划与实际启动共用的模型配置。 */
export interface ProductionPlanInput {
/** 只读核对本轮阶段范围。 */
stage?: ProductionStage
/** 本轮图片模型供应方。 */
imageProvider?: string
/** 主体图片与首帧共用的图片生成参数。 */
@@ -790,6 +802,8 @@ export interface ProductionCharacterIdentityPlan {
/** 后端稳定身份母版计划的单个主体。 */
export interface ProductionStableIdentityItem {
/** 本主体依赖的已确认共享主体编号。 */
dependencySubjectIds?: string[]
/** 数据库主体 ID。 */
subjectId: string
/** 主体引用标识。 */
@@ -803,3 +817,32 @@ export interface ProductionStableIdentityItem {
/** 后端提供的就绪或阻塞原因。 */
reason: string
}
/** 只读道具规格的准备情况。 */
export interface PropStructurePreparation {
/** 规格总数。 */
total: number
/** 当前有效规格数。 */
ready: number
/** 需先补描述或规格的数量。 */
upstreamResolvable: number
/** 需人工处理的数量。 */
manualBlocked: number
/** 逐形态真实检查结果。 */
items: Array<{
/** 所属正式主体编号。 */
subjectId: string
/** 主体引用。 */
subjectRef: string
/** 正式形态编号,缺少形态时为 null。 */
subjectFormId: string | null
/** 有效、需准备或人工阻断。 */
status: 'ready' | 'upstream' | 'blocked'
/** 规格的真实状态。 */
specStatus: 'ready' | 'missing' | 'stale' | 'missing_form'
/** 是否需先准备正式画面描述。 */
requiresFormPrompt: boolean
/** 后端具体原因。 */
reason: string
}>
}