feat(short-drama-agent-front): 补齐后端生产与质量功能

This commit is contained in:
GJ committed 2026-10-08 18:28:35 +08:00
1 parent 967c4ebea1
commit 470b52e26d
52 files changed
+3754 -1075

No files matched your search

@@ -25,6 +25,7 @@ import ConfirmAction from '../workflows/ConfirmAction.vue'
import { castingStatusLabel, currentAnchor } from './model'
import { useSubjectIdentity } from './useSubjectIdentity'
import { useProjectContext } from '../projects/context'
import StableAnchorQualityDialog from './components/StableAnchorQualityDialog.vue'
import IdentityEditor from './components/IdentityEditor.vue'
import IdentityGallery from './components/IdentityGallery.vue'
import IdentityImageDialog from './components/IdentityImageDialog.vue'
@@ -78,11 +79,17 @@ const {
generateImage,
generateCastingCandidate,
confirmStableAnchor,
confirmCasting
confirmCasting,
validateImage,
generateStableAnchorQuality,
validationResult,
qualityResult
} = useSubjectIdentity()
const search = ref('')
const module = ref('all')
const identityBatchModule = ref<'all' | 'character' | 'scene' | 'prop'>('all')
/** 单主体稳定母版质量生成弹窗开关。 */
const qualityOpen = ref(false)
const imageOpen = ref(false)
const castingOpen = ref(false)
const pendingSelection = ref('')
@@ -122,6 +129,7 @@ watch(
{ immediate: true }
)
watch(selectedId, () => {
qualityOpen.value = false
imageOpen.value = false
castingOpen.value = false
pendingSelection.value = ''
@@ -308,7 +316,9 @@ watch(
<template #notice>
<NAlert v-if="stageComplete" type="success" :show-icon="false">
所有需要确认的角色身份已经准备好,可以继续制作主体形态图片。
<RouterLink :to="`/projects/${projectId}/subject-images`" class="text-button ml-2">继续形态图片 →</RouterLink>
<RouterLink :to="`/projects/${projectId}/subject-images`" class="text-button ml-2"
>继续形态图片 →</RouterLink
>
</NAlert>
</template>
<template #header>
@@ -345,287 +355,253 @@ watch(
<div class="workspace-overview-panel">
<div class="overview-content workspace-section-stack dialog-flat-stack">
<h3 class="text-sm font-semibold">角色选角总览与批量操作</h3>
<NAlert type="info" :show-icon="false" class="text-xs">
人物需要依次完成身份描述、选角候选、确认角色母版并锁定,之后才能用于镜头制作。未明确人物背景时,AI 默认以中国人物作为选角基线;项目和角色的明确事实始终优先。场景和道具使用稳定身份母版流程。
</NAlert>
<NAlert
v-if="styleQuery.data.value && !hasStyle"
type="info"
:show-icon="false"
>
先创建项目视觉风格,才能 AI 生成身份或身份图片。<RouterLink
:to="`/projects/${projectId}/visual-style`"
class="text-button ml-2"
>设置视觉风格 →</RouterLink
></NAlert
>
<section v-if="casting" class="workspace-panel" aria-label="角色选角流程">
<div class="flex flex-wrap items-start justify-between gap-4">
<div class="flex items-start gap-3">
<span class="production-step"><UserCheck :size="17" /></span>
<div>
<h3 class="text-sm font-semibold">角色选角</h3>
<p class="mt-2 text-xs leading-6 text-muted">
只处理 Character。每张候选都根据当前身份描述独立生成,不复用旧母版;确认选择后才会设为角色母版并锁定身份。
</p>
</div>
</div>
<span class="font-mono text-xs text-muted"
>{{ casting.ready }} / {{ casting.total }} 已完成</span
>
</div>
<dl class="casting-stats mt-4">
<div>
<dt>缺身份文本</dt>
<dd>{{ casting.missingIdentity }}</dd>
</div>
<div>
<dt>缺候选图</dt>
<dd>{{ casting.missingAnchor }}</dd>
</div>
<div>
<dt>待确认演员</dt>
<dd>{{ casting.candidatePending }}</dd>
</div>
<div>
<dt>母版未锁定</dt>
<dd>{{ casting.unlocked }}</dd>
</div>
<div>
<dt>选角完成</dt>
<dd>{{ casting.ready }}</dd>
</div>
</dl>
<AppForm
:model="formModel"
:rules="rules"
:disabled="operation.pending"
validate-on-change
>
<div class="form-controls mt-5 flex flex-wrap gap-4 pt-4">
<NFormItem class="w-28" path="concurrency" label="并发数">
<NInputNumber
:input-props="{ 'aria-label': '并发数' }"
:disabled="operation.pending"
:value="
typeof concurrency === 'number' ? concurrency : null
"
@update:value="concurrency = $event ?? 0"
:min="1"
:step="1"
></NInputNumber>
</NFormItem>
<NFormItem class="w-28" path="candidateLimit" label="本批上限">
<NInputNumber
:input-props="{ 'aria-label': '本批上限' }"
:disabled="operation.pending"
:value="
typeof candidateLimit === 'number'
? candidateLimit
: null
"
@update:value="candidateLimit = $event ?? 0"
:min="1"
:step="1"
></NInputNumber>
</NFormItem>
<NCheckbox
v-model:checked="force"
:disabled="operation.pending"
class="control-row-checkbox text-xs"
>覆盖未锁定身份文本
</NCheckbox>
<ConfirmAction
:label="force ? '重生成角色身份文本' : '补齐角色身份文本'"
:disabled="
blocked ||
!hasStyle ||
!batchValid ||
!candidateLimitValid ||
dirty ||
!casting.total
"
acknowledgement
description="只生成 Character Identity 文本,不生成图片。已锁定角色始终跳过;覆盖文本不会自动更新已有候选图。"
@confirm="generateProject(true)"
/>
<ConfirmAction
label="生成选角候选"
:disabled="
castingBlocked ||
!hasStyle ||
!batchValid ||
!candidateLimitValid ||
!casting.missingAnchor
"
acknowledgement
description="最多按本批上限为缺少 Anchor 的 Character 调用 图片模型,各自独立生成一张停用的 primary 候选,不复用旧身份母版。已有候选、已有母版或已完成选角的角色不会重复处理。"
@confirm="generateCastingCandidates"
/>
</div>
</AppForm>
<div class="casting-list" role="group" aria-label="角色选角进度">
<NButton
v-for="item in casting.items"
:key="item.subjectId"
@click="select(item.subjectId)"
class="casting-item"
:class="{ selected: selectedId === item.subjectId }"
:aria-pressed="selectedId === item.subjectId"
><span class="casting-item-identity">
<span class="casting-item-name">{{ item.subjectName }}</span>
<span class="casting-item-ref">{{
item.subjectRef
}}</span> </span
><StatusBadge
class="casting-item-status"
:status="item.status"
:label="castingStatusLabel(item.status)"
/></NButton>
</div>
</section>
<section class="workspace-panel" aria-label="场景与道具身份母版">
<div class="flex flex-wrap items-start justify-between gap-4">
<div>
<h3 class="text-sm font-semibold">场景与道具稳定母版</h3>
<p class="mt-2 text-xs leading-6 text-muted">
为已有身份描述但缺少有效母版的场景或道具小批量生图。成功后会自动设为身份母版并锁定。
</p>
</div>
<div class="flex flex-wrap gap-3">
<ConfirmAction
label="生成场景母版"
:disabled="
blocked ||
!hasStyle ||
!batchValid ||
!candidateLimitValid ||
dirty ||
!subjects.length
"
acknowledgement
:description="`最多处理 ${candidateLimit} 个场景,生成成功后自动设为身份母版并锁定。可能产生图片模型费用。`"
@confirm="generateStableAnchors('scene')"
/>
<ConfirmAction
label="生成道具母版"
:disabled="
blocked ||
!hasStyle ||
!batchValid ||
dirty ||
!subjects.length
"
acknowledgement
:description="`最多处理 ${candidateLimit} 个道具,生成成功后自动设为身份母版并锁定。可能产生图片模型费用。`"
@confirm="generateStableAnchors('prop')"
/>
</div>
</div>
</section>
<NCollapse class="workspace-panel" :default-expanded-names="['details']"
><NCollapseItem name="details"
><template #header>高级:全部主体身份文本</template>
<p class="mt-3 text-xs leading-6 text-muted">
同时处理 Character、Scene 和
Prop;角色选角建议优先使用上方专用入口。已锁定身份始终跳过。
<NAlert type="info" :show-icon="false" class="text-xs">
人物需要依次完成身份描述、选角候选、确认角色母版并锁定,之后才能用于镜头制作。未明确人物背景时,AI
默认以中国人物作为选角基线;项目和角色的明确事实始终优先。场景和道具使用稳定身份母版流程。
</NAlert>
<NAlert v-if="styleQuery.data.value && !hasStyle" type="info" :show-icon="false">
先创建项目视觉风格,才能 AI 生成身份或身份图片。<RouterLink
:to="`/projects/${projectId}/visual-style`"
class="text-button ml-2"
>设置视觉风格 →</RouterLink
></NAlert
>
<section v-if="casting" class="workspace-panel" aria-label="角色选角流程">
<div class="flex flex-wrap items-start justify-between gap-4">
<div class="flex items-start gap-3">
<span class="production-step"><UserCheck :size="17" /></span>
<div>
<h3 class="text-sm font-semibold">角色选角</h3>
<p class="mt-2 text-xs leading-6 text-muted">
只处理
Character。每张候选都根据当前身份描述独立生成,不复用旧母版;确认选择后才会设为角色母版并锁定身份。
</p>
<NSelect
v-model:value="identityBatchModule"
class="mt-4 w-48"
aria-label="身份文本批处理范围"
:options="[
{ label: String('全部类型'), value: 'all' },
{ label: String('仅人物'), value: 'character' },
{ label: String('仅场景'), value: 'scene' },
{ label: String('仅道具'), value: 'prop' }
]" />
<ConfirmAction
class="mt-4"
:label="force ? '重生成全部未锁定身份' : '补齐全部主体身份文本'"
:disabled="
blocked || !hasStyle || !batchValid || dirty || !subjects.length
"
acknowledgement
description="生成全项目主体身份描述与提示词,不生成图片。覆盖不会自动更新旧身份图、形态图、首帧或视频。"
@confirm="
identityBatchModule === 'character'
? generateProject(true)
: generateProject(
false,
identityBatchModule === 'scene' ||
identityBatchModule === 'prop'
? identityBatchModule
: undefined
)
" /></NCollapseItem
></NCollapse>
<section
v-if="session.receipt"
class="workspace-panel"
aria-label="身份文本批量回执"
>
<div class="flex justify-between gap-3">
<h3 class="text-sm font-medium">
{{ session.receipt.title }} · 本次回执
</h3>
<NButton @click="exportReceipt" text size="small">导出诊断</NButton>
</div>
<p
v-if="session.receipt.kind === 'identities'"
class="mt-3 text-xs text-muted"
>
共 {{ session.receipt.result.total }} 个主体 · 目标
{{ session.receipt.result.targetCount }} · 生成
{{ session.receipt.result.generated }} · 跳过
{{ session.receipt.result.skipped }}(含锁定
{{ session.receipt.result.skippedLocked }})· 失败
{{ session.receipt.result.failed }}
</p>
<p
v-else-if="session.receipt.kind === 'casting'"
class="mt-3 text-xs text-muted"
>
共 {{ session.receipt.result.totalCharacters }} 个角色 · 缺候选
{{ session.receipt.result.missingAnchor }} · 本批目标
{{ session.receipt.result.targetCount }} · 已生成
{{ session.receipt.result.generated }} · 失败
{{ session.receipt.result.failed }}
</p>
<p v-else class="mt-3 text-xs text-muted">
共 {{ session.receipt.result.total }} 个{{
session.receipt.result.module === 'scene' ? '场景' : '道具'
}}
· 符合条件 {{ session.receipt.result.eligibleCount }} · 本批目标
{{ session.receipt.result.targetCount }} · 已生成并锁定
{{ session.receipt.result.generated }} · 失败
{{ session.receipt.result.failed }}
</p>
<NAlert
v-if="session.receipt.result.failed"
role="alert"
type="error"
:show-icon="false"
class="mt-3"
>
本次存在部分失败,成功结果不会回滚。请检查逐角色原因后再重试。
</NAlert>
<ul class="mt-3 space-y-2 text-xs text-danger">
<li
v-for="failure in session.receipt.result.failures"
:key="failure.subjectId"
>
{{ failure.subjectRef }} · {{ failure.subjectId }}:{{
failure.error
}}
</li>
</ul>
<p class="mt-3 text-[11px] text-muted">
回执仅保留于当前浏览器会话;最终状态以刷新后的正式记录为准。
</p>
</section>
</div>
<span class="font-mono text-xs text-muted"
>{{ casting.ready }} / {{ casting.total }} 已完成</span
>
</div>
<dl class="casting-stats mt-4">
<div>
<dt>缺身份文本</dt>
<dd>{{ casting.missingIdentity }}</dd>
</div>
<div>
<dt>缺候选图</dt>
<dd>{{ casting.missingAnchor }}</dd>
</div>
<div>
<dt>待确认演员</dt>
<dd>{{ casting.candidatePending }}</dd>
</div>
<div>
<dt>母版未锁定</dt>
<dd>{{ casting.unlocked }}</dd>
</div>
<div>
<dt>选角完成</dt>
<dd>{{ casting.ready }}</dd>
</div>
</dl>
<AppForm
:model="formModel"
:rules="rules"
:disabled="operation.pending"
validate-on-change
>
<div class="form-controls mt-5 flex flex-wrap gap-4 pt-4">
<NFormItem class="w-28" path="concurrency" label="并发数">
<NInputNumber
:input-props="{ 'aria-label': '并发数' }"
:disabled="operation.pending"
:value="typeof concurrency === 'number' ? concurrency : null"
@update:value="concurrency = $event ?? 0"
:min="1"
:step="1"
></NInputNumber>
</NFormItem>
<NFormItem class="w-28" path="candidateLimit" label="本批上限">
<NInputNumber
:input-props="{ 'aria-label': '本批上限' }"
:disabled="operation.pending"
:value="typeof candidateLimit === 'number' ? candidateLimit : null"
@update:value="candidateLimit = $event ?? 0"
:min="1"
:step="1"
></NInputNumber>
</NFormItem>
<NCheckbox
v-model:checked="force"
:disabled="operation.pending"
class="control-row-checkbox text-xs"
>覆盖未锁定身份文本
</NCheckbox>
<ConfirmAction
:label="force ? '重生成角色身份文本' : '补齐角色身份文本'"
:disabled="
blocked ||
!hasStyle ||
!batchValid ||
!candidateLimitValid ||
dirty ||
!casting.total
"
acknowledgement
description="只生成 Character Identity 文本,不生成图片。已锁定角色始终跳过;覆盖文本不会自动更新已有候选图。"
@confirm="generateProject(true)"
/>
<ConfirmAction
label="生成选角候选"
:disabled="
castingBlocked ||
!hasStyle ||
!batchValid ||
!candidateLimitValid ||
!casting.missingAnchor
"
acknowledgement
description="最多按本批上限为缺少 Anchor 的 Character 调用 图片模型,各自独立生成一张停用的 primary 候选,不复用旧身份母版。已有候选、已有母版或已完成选角的角色不会重复处理。"
@confirm="generateCastingCandidates"
/>
</div>
</AppForm>
<div class="casting-list" role="group" aria-label="角色选角进度">
<NButton
v-for="item in casting.items"
:key="item.subjectId"
@click="select(item.subjectId)"
class="casting-item"
:class="{ selected: selectedId === item.subjectId }"
:aria-pressed="selectedId === item.subjectId"
><span class="casting-item-identity">
<span class="casting-item-name">{{ item.subjectName }}</span>
<span class="casting-item-ref">{{ item.subjectRef }}</span> </span
><StatusBadge
class="casting-item-status"
:status="item.status"
:label="castingStatusLabel(item.status)"
/></NButton>
</div>
</section>
<section class="workspace-panel" aria-label="场景与道具身份母版">
<div class="flex flex-wrap items-start justify-between gap-4">
<div>
<h3 class="text-sm font-semibold">场景与道具稳定母版</h3>
<p class="mt-2 text-xs leading-6 text-muted">
为已有身份描述但缺少有效母版的场景或道具小批量生图。成功后会自动设为身份母版并锁定。
</p>
</div>
<div class="flex flex-wrap gap-3">
<ConfirmAction
label="生成场景母版"
:disabled="
blocked ||
!hasStyle ||
!batchValid ||
!candidateLimitValid ||
dirty ||
!subjects.length
"
acknowledgement
:description="`最多处理 ${candidateLimit} 个场景,生成成功后自动设为身份母版并锁定。可能产生图片模型费用。`"
@confirm="generateStableAnchors('scene')"
/>
<ConfirmAction
label="生成道具母版"
:disabled="
blocked || !hasStyle || !batchValid || dirty || !subjects.length
"
acknowledgement
:description="`最多处理 ${candidateLimit} 个道具,生成成功后自动设为身份母版并锁定。可能产生图片模型费用。`"
@confirm="generateStableAnchors('prop')"
/>
</div>
</div>
</section>
<NCollapse class="workspace-panel" :default-expanded-names="['details']"
><NCollapseItem name="details"
><template #header>高级:全部主体身份文本</template>
<p class="mt-3 text-xs leading-6 text-muted">
同时处理 Character、Scene 和
Prop;角色选角建议优先使用上方专用入口。已锁定身份始终跳过。
</p>
<NSelect
v-model:value="identityBatchModule"
class="mt-4 w-48"
aria-label="身份文本批处理范围"
:options="[
{ label: String('全部类型'), value: 'all' },
{ label: String('仅人物'), value: 'character' },
{ label: String('仅场景'), value: 'scene' },
{ label: String('仅道具'), value: 'prop' }
]" />
<ConfirmAction
class="mt-4"
:label="force ? '重生成全部未锁定身份' : '补齐全部主体身份文本'"
:disabled="blocked || !hasStyle || !batchValid || dirty || !subjects.length"
acknowledgement
description="生成全项目主体身份描述与提示词,不生成图片。覆盖不会自动更新旧身份图、形态图、首帧或视频。"
@confirm="
identityBatchModule === 'character'
? generateProject(true)
: generateProject(
false,
identityBatchModule === 'scene' ||
identityBatchModule === 'prop'
? identityBatchModule
: undefined
)
" /></NCollapseItem
></NCollapse>
<section v-if="session.receipt" class="workspace-panel" aria-label="身份文本批量回执">
<div class="flex justify-between gap-3">
<h3 class="text-sm font-medium">{{ session.receipt.title }} · 本次回执</h3>
<NButton @click="exportReceipt" text size="small">导出诊断</NButton>
</div>
<p v-if="session.receipt.kind === 'identities'" class="mt-3 text-xs text-muted">
共 {{ session.receipt.result.total }} 个主体 · 目标
{{ session.receipt.result.targetCount }} · 生成
{{ session.receipt.result.generated }} · 跳过
{{ session.receipt.result.skipped }}(含锁定
{{ session.receipt.result.skippedLocked }})· 失败
{{ session.receipt.result.failed }}
</p>
<p v-else-if="session.receipt.kind === 'casting'" class="mt-3 text-xs text-muted">
共 {{ session.receipt.result.totalCharacters }} 个角色 · 缺候选
{{ session.receipt.result.missingAnchor }} · 本批目标
{{ session.receipt.result.targetCount }} · 已生成
{{ session.receipt.result.generated }} · 失败
{{ session.receipt.result.failed }}
</p>
<p v-else class="mt-3 text-xs text-muted">
共 {{ session.receipt.result.total }} 个{{
session.receipt.result.module === 'scene' ? '场景' : '道具'
}}
· 符合条件 {{ session.receipt.result.eligibleCount }} · 本批目标
{{ session.receipt.result.targetCount }} · 已生成并锁定
{{ session.receipt.result.generated }} · 失败
{{ session.receipt.result.failed }}
</p>
<NAlert
v-if="session.receipt.result.failed"
role="alert"
type="error"
:show-icon="false"
class="mt-3"
>
本次存在部分失败,成功结果不会回滚。请检查逐角色原因后再重试。
</NAlert>
<ul class="mt-3 space-y-2 text-xs text-danger">
<li v-for="failure in session.receipt.result.failures" :key="failure.subjectId">
{{ failure.subjectRef }} · {{ failure.subjectId }}:{{ failure.error }}
</li>
</ul>
<p class="mt-3 text-[11px] text-muted">
回执仅保留于当前浏览器会话;最终状态以刷新后的正式记录为准。
</p>
</section>
</div>
</div>
</WorkspaceTools>
</div>
@@ -803,6 +779,30 @@ watch(
</p>
</div>
</div>
<!-- 以下是场景与道具单主体母版质量生成模块 -->
<NButton
v-if="subject.module === 'scene' || subject.module === 'prop'"
class="mt-4"
:disabled="!canGenerateImage"
@click="qualityOpen = true"
>生成稳定母版并校验质量</NButton
>
<NAlert v-if="qualityResult" :type="qualityResult.passed ? 'success' : 'warning'" class="mt-3">
{{
qualityResult.passed
? '质量闭环通过,母版与锁定已确认'
: '质量闭环未通过,候选仍保留在图库'
}}
· 已修复 {{ qualityResult.repairAttempts }} 次
<p v-if="qualityResult.stopReason">停止原因:{{ qualityResult.stopReason }}</p>
<pre class="whitespace-pre-wrap break-all text-xs">{{
JSON.stringify(qualityResult.attempts, null, 2)
}}</pre>
</NAlert>
<!-- 以下是已完成主体的候选生成与真实输入预览入口模块 -->
<NButton class="mt-4" :disabled="!canGenerateImage" @click="imageOpen = true">
{{ subject.module === 'character' ? '生成辅助参考图' : '生成母版候选' }}
</NButton>
<IdentityGallery
id="identity-reference-gallery"
:key="selectedId"
@@ -811,6 +811,8 @@ watch(
:module="subject.module"
:identity-locked="!!identity?.isLocked"
:disabled="detailBlocked || (subject.module === 'character' && !!castingQuery.error.value)"
:validation-result="validationResult"
@validate="validateImage"
@anchor="chooseAnchor"
/>
</template>
@@ -842,22 +844,30 @@ watch(
>前往剧本拆解</RouterLink
></EmptyState
>
<NAlert
v-if="activeIdentityGeneration"
type="info"
:show-icon="false"
class="mb-4 text-xs"
>
{{ subject?.name }} 的身份图片正在生成({{ activeIdentityGeneration.provider || '图片模型' }}),刷新页面不会重复提交,请等待当前任务完成。
<NAlert v-if="activeIdentityGeneration" type="info" :show-icon="false" class="mb-4 text-xs">
{{ subject?.name }} 的身份图片正在生成({{
activeIdentityGeneration.provider || '图片模型'
}}),刷新页面不会重复提交,请等待当前任务完成。
</NAlert>
<NAlert
v-else-if="latestIdentityFailure"
type="error"
:show-icon="false"
class="mb-4 text-xs"
>
最近一次身份图片生成失败:{{ latestIdentityFailure.error || '未返回具体错误' }}。可以调整模型参数后重新生成。
<NAlert v-else-if="latestIdentityFailure" type="error" :show-icon="false" class="mb-4 text-xs">
最近一次身份图片生成失败:{{
latestIdentityFailure.error || '未返回具体错误'
}}。可以调整模型参数后重新生成。
</NAlert>
<StableAnchorQualityDialog
v-if="
subject &&
(subject.module === 'scene' || subject.module === 'prop') &&
profileQuery.data.value?.profile &&
generationModelsQuery.data.value
"
v-model:open="qualityOpen"
:subject-id="subject.id"
:subject-name="subject.name"
:catalog="generationModelsQuery.data.value"
:profile="profileQuery.data.value.profile"
:disabled="!canGenerateImage"
@generate="generateStableAnchorQuality" />
<IdentityImageDialog
v-if="subject && profileQuery.data.value?.profile && generationModelsQuery.data.value"
v-model:open="imageOpen"
@@ -870,7 +880,9 @@ watch(
:disabled="!canGenerateImage"
@generate="submitIdentityImage" />
<CastingCandidateDialog
v-if="subject?.module === 'character' && profileQuery.data.value?.profile && generationModelsQuery.data.value"
v-if="
subject?.module === 'character' && profileQuery.data.value?.profile && generationModelsQuery.data.value
"
v-model:open="castingOpen"
:subject-id="subject.id"
:subject-name="subject.name"
+47 -3
View File
@@ -1,5 +1,9 @@
import { request } from '../../lib/http'
import type {
IdentityImagePreview,
IdentityValidationResult,
StableAnchorQualityInput,
StableAnchorQualityResult,
CastingBatchResult,
CharacterCastingReadiness,
ConfirmCastingResult,
@@ -71,14 +75,54 @@ export const subjectIdentityApi = {
request<IdentityImage[]>(`${identityPath(subjectId)}/images`, { signal }),
generateImage: (subjectId: string, input: GenerateIdentityImageInput) =>
request<IdentityImage>(`${identityPath(subjectId)}/images`, { method: 'POST', body: input, timeoutMs: 0 }),
/**
* 读取与实际生图同源的输入预览,道具可能执行已确认的结构模型编译。
* @param subjectId 正式主体 ID
* @param input 与实际生图相同的参数
* @param signal 只读预览取消信号,可能付费的道具不传
* @returns 后端真实输入与最终参数
*/
previewImage: (subjectId: string, input: GenerateIdentityImageInput, signal?: AbortSignal) =>
request<IdentityImagePreview>(`${identityPath(subjectId)}/images/preview`, {
method: 'POST',
body: input,
signal,
timeoutMs: 0
}),
/**
* 明确确认后对指定身份图片执行视觉校验。
* @param subjectId 正式主体 ID
* @param imageId 此主体的正式图片 ID
* @returns 真实视觉校验回执
*/
validateImage: (subjectId: string, imageId: string) =>
request<IdentityValidationResult>(`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}/validate`, {
method: 'POST',
timeoutMs: 0
}),
/**
* 为单个场景或道具执行有限预算的稳定母版质量闭环。
* @param subjectId 正式主体 ID
* @param input 已确认的模型与修复预算
* @returns 候选、各轮质量和实际母版确认回执
*/
generateStableAnchorQuality: (subjectId: string, input: StableAnchorQualityInput) =>
request<StableAnchorQualityResult>(`${identityPath(subjectId)}/stable-anchor/generate-quality`, {
method: 'POST',
body: input,
timeoutMs: 0
}),
setAnchor: (subjectId: string, imageId: string) =>
request<IdentityImage>(`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}/anchor`, {
method: 'PUT'
}),
confirmStableAnchor: (subjectId: string, imageId: string) =>
request<ConfirmCastingResult>(`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}/stable-anchor`, {
method: 'PUT'
}),
request<ConfirmCastingResult>(
`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}/stable-anchor`,
{
method: 'PUT'
}
),
confirmCasting: (subjectId: string, imageId: string) =>
request<ConfirmCastingResult>(`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}/casting`, {
method: 'PUT'
@@ -1,28 +1,38 @@
<script setup lang="ts">
import ConfirmAction from '../../workflows/ConfirmAction.vue'
import { NScrollbar, NAlert, NButton, NTag } from 'naive-ui'
import { computed, ref, watch } from 'vue'
import { AssetImage, StatusBadge } from '../../../components/ui'
import { referenceImageUrl } from '../../../lib/assets'
import { formatDate } from '../../../lib/format'
import { canBeAnchor, currentAnchor, identityViewLabels } from '../model'
import type { IdentityImage } from '../types'
import type { IdentityImage, IdentityValidationResult } from '../types'
/** 身份图库区分权威母版、primary 候选和辅助视图,保留后端原始状态。 */
const props = defineProps<{
/** 指定图片本次校验回执。 */
validationResult?: IdentityValidationResult | null
images: IdentityImage[]
subjectName: string
module: string
identityLocked: boolean
disabled: boolean
}>()
const emit = defineEmits<{ anchor: [imageId: string] }>()
/** 用户确认的图片操作。 */
const emit = defineEmits<{ anchor: [imageId: string]; validate: [imageId: string] }>()
/** selectedId 的当前界面状态与输入绑定。 */
const selectedId = ref('')
/** confirming 的当前界面状态与输入绑定。 */
const confirming = ref(false)
/** anchor 的当前界面状态与输入绑定。 */
const anchor = computed(() => currentAnchor(props.images))
/** selected 的当前界面状态与输入绑定。 */
const selected = computed(
() => props.images.find(image => image.id === selectedId.value) ?? anchor.value ?? props.images[0]
)
/** character 的当前界面状态与输入绑定。 */
const character = computed(() => props.module === 'character')
/** canSelect 的当前界面状态与输入绑定。 */
const canSelect = computed(
() =>
!props.disabled &&
@@ -30,7 +40,9 @@ const canSelect = computed(
canBeAnchor(selected.value) &&
(!selected.value.isAnchor || (character.value && !props.identityLocked))
)
/** imageUrl 的当前界面状态与输入绑定。 */
const imageUrl = computed(() => referenceImageUrl(selected.value?.imageUrl ?? ''))
/** 监听界面目标变化并重置关联确认状态。 */
watch(
() => selected.value?.id,
() => {
@@ -133,6 +145,25 @@ function chooseAnchor() {
>{{ selected.provider }} · {{ selected.model }} · {{ formatDate(selected.createdAt) }}</span
>
</div>
<!-- 以下是指定身份图片质量校验模块 -->
<ConfirmAction
:key="selected.id"
label="校验此身份图片"
:description="`将校验图片 ${selected.id},会调用视觉模型并可能产生费用,不会切换母版。`"
:disabled="disabled || selected.status !== 'completed' || !selected.imageUrl"
acknowledgement
@confirm="emit('validate', selected.id)"
/>
<NAlert
v-if="validationResult?.imageId === selected.id"
:type="validationResult.passed ? 'success' : 'warning'"
class="mt-3"
>
<p>{{ validationResult.passed ? '本次校验通过' : '本次校验未通过' }}:{{ validationResult.summary }}</p>
<p v-for="(issue, index) in validationResult.issues" :key="index">
{{ issue.severity }} · {{ issue.type }}:{{ issue.description }}
</p>
</NAlert>
<p v-if="selected.viewType !== 'primary'" class="mt-2 text-xs text-muted">
辅助视图不能直接设为母版;它会继承当前身份母版,不适合用来更换演员。
</p>
@@ -1,12 +1,16 @@
<script setup lang="ts">
import ConfirmAction from '../../workflows/ConfirmAction.vue'
import { getOperation, runOperation } from '../../workflows/operations'
import AppForm from '../../../components/ui/AppForm.vue'
import { NFormItem } from 'naive-ui'
import { fieldRule } from '../../../lib/form-rules'
import { NAlert, NButton, NCheckbox, NInput, NSelect } from 'naive-ui'
import { computed, ref, watch } from 'vue'
import { computed, onBeforeUnmount, ref, watch } from 'vue'
import { AppDialog } from '../../../components/ui'
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
import { subjectIdentityApi } from '../api'
import type { IdentityImagePreview } from '../types'
import { currentAnchor, identityViewLabels } from '../model'
import type { GenerateIdentityImageInput, IdentityImage, IdentityViewType } from '../types'
@@ -20,32 +24,46 @@ const props = defineProps<{
catalog: GenerationModelCatalog
profile: CreativeProfile
}>()
/** open 的当前界面状态与输入绑定。 */
const open = defineModel<boolean>('open', { default: false })
/** emit 的当前界面状态与输入绑定。 */
const emit = defineEmits<{ generate: [input: GenerateIdentityImageInput] }>()
const formRef = ref<InstanceType<typeof AppForm> | null>(null)
const viewType = ref<IdentityViewType>('primary')
/** referenceImageId 的当前界面状态与输入绑定。 */
const referenceImageId = ref('')
/** prompt 的当前界面状态与输入绑定。 */
const prompt = ref('')
/** provider 的当前界面状态与输入绑定。 */
const provider = ref('')
const generationOptions = ref<GenerationOptions>({})
/** acknowledged 的当前界面状态与输入绑定。 */
const acknowledged = ref(false)
/** anchor 的当前界面状态与输入绑定。 */
const anchor = computed(() => currentAnchor(props.images))
/** allowedViews 的当前界面状态与输入绑定。 */
const allowedViews = computed(() =>
props.module === 'character'
? Object.entries(identityViewLabels).filter(([value]) => value !== 'primary')
: [['primary', identityViewLabels.primary]]
)
/** references 的当前界面状态与输入绑定。 */
const references = computed(() => props.images.filter(image => image.status === 'completed' && image.imageUrl))
/** valid 的当前界面状态与输入绑定。 */
const valid = computed(
() => Boolean(provider.value) && (!referenceImageId.value || references.value.some(image => image.id === referenceImageId.value))
() =>
Boolean(provider.value) &&
(!referenceImageId.value || references.value.some(image => image.id === referenceImageId.value))
)
/** 监听界面目标变化并重置关联确认状态。 */
watch(
() => [open.value, props.subjectId],
() => {
viewType.value = props.module === 'character' ? 'front' : 'primary'
referenceImageId.value = ''
prompt.value = ''
const selected = props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
const selected =
props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
props.catalog.images.find(item => item.enabled)
provider.value = selected?.provider ?? ''
generationOptions.value = {
@@ -53,7 +71,10 @@ watch(
...(selected?.provider === props.profile.imageProvider ? props.profile.imageOptions : {})
}
const sizeSchema = selected?.generationOptions.find(item => item.key === 'size')
if (sizeSchema?.options?.length && !sizeSchema.options.some(option => option.value === generationOptions.value.size)) {
if (
sizeSchema?.options?.length &&
!sizeSchema.options.some(option => option.value === generationOptions.value.size)
) {
generationOptions.value.size = selected?.defaults.size ?? sizeSchema.options[0]?.value ?? ''
}
acknowledged.value = false
@@ -61,18 +82,78 @@ watch(
{ immediate: true }
)
/** 预览与正式生图共享的最终请求参数。 */
const generationInput = computed<GenerateIdentityImageInput>(() => ({
viewType: props.module === 'character' ? viewType.value : 'primary',
...(referenceImageId.value ? { referenceImageId: referenceImageId.value } : {}),
...(prompt.value.trim() ? { prompt: prompt.value.trim() } : {}),
provider: provider.value,
generationOptions: { ...generationOptions.value }
}))
/** 当前参数的预览结果。 */
const preview = ref<IdentityImagePreview | null>(null)
/** 预览读取状态。 */
const previewLoading = ref(false)
/** 道具预览可能付费,保持项目锁直到真实请求结束,不能因关闭弹窗提前释放。 */
const paidPreviewPending = ref(false)
/** 预览读取错误。 */
const previewError = ref('')
/** 用于取消迟到预览的请求控制器。 */
let previewController: AbortController | undefined
/** 参数、主体或弹窗变化时清除旧结果和费用确认。 */
/** 监听界面目标变化并重置关联确认状态。 */
watch(
() => [props.subjectId, open.value, JSON.stringify(generationInput.value), JSON.stringify(props.images)],
() => {
previewController?.abort()
preview.value = null
previewError.value = ''
previewLoading.value = false
acknowledged.value = false
}
)
/** 卸载时取消未完成的只读请求。 */
onBeforeUnmount(() => previewController?.abort())
/** 读取当前参数的真实预览;道具后端可能编译结构模型,禁止当作免费读取。 */
async function loadPreview() {
if (props.disabled || !valid.value || previewLoading.value || paidPreviewPending.value) return
previewController?.abort()
const controller = new AbortController()
previewController = controller
const subjectId = props.subjectId
const projectId = props.profile.projectId
const paid = props.module === 'prop'
const input = { ...generationInput.value, generationOptions: { ...generationInput.value.generationOptions } }
previewLoading.value = true
previewError.value = ''
paidPreviewPending.value = paid
/** 道具请求不传取消信号,取消客户端展示不能取消后端结构模型的工作。 */
const inspect = async () => {
const result = await subjectIdentityApi.previewImage(subjectId, input, paid ? undefined : controller.signal)
if (!controller.signal.aborted && previewController === controller && subjectId === props.subjectId)
preview.value = result
}
try {
if (paid) {
const ok = await runOperation(projectId, '预览道具结构输入', inspect)
if (!ok && !controller.signal.aborted && subjectId === props.subjectId)
previewError.value = getOperation(projectId).error
} else await inspect()
} catch (error) {
if (!controller.signal.aborted)
previewError.value = error instanceof Error ? error.message : '身份输入预览读取失败'
} finally {
paidPreviewPending.value = false
if (previewController === controller) previewLoading.value = false
}
}
/** 提交生图参数;省略空参考 ID 以保留后端自动选择逻辑。 */
function submit() {
if (props.disabled || !valid.value || !acknowledged.value) return
const effectiveViewType: IdentityViewType = props.module === 'character' ? viewType.value : 'primary'
emit('generate', {
viewType: effectiveViewType,
...(referenceImageId.value ? { referenceImageId: referenceImageId.value } : {}),
...(prompt.value.trim() ? { prompt: prompt.value.trim() } : {}),
provider: provider.value,
generationOptions: generationOptions.value
})
if (props.disabled || paidPreviewPending.value || !valid.value || !acknowledged.value) return
emit('generate', generationInput.value)
}
/** formModel 的当前界面状态与输入绑定。 */
const formModel = computed(() => ({
prompt: prompt.value,
viewType: viewType.value,
@@ -88,7 +169,7 @@ const rules = {
</script>
<template>
<AppDialog v-model:open="open" title="生成身份参考图" :description="subjectName">
<AppDialog v-model:open="open" title="生成身份参考图" :description="subjectName" :busy="paidPreviewPending">
<AppForm
ref="formRef"
:model="formModel"
@@ -162,6 +243,34 @@ const rules = {
@update:provider="provider = $event"
@update:options="generationOptions = $event"
/>
<!-- 以下是真实生图输入预览模块 -->
<ConfirmAction
v-if="module === 'prop'"
label="预览道具真实输入"
description="缺少有效结构缓存时可能调用文本模型并产生费用;不会生成身份图片。确认后读取本次最终参数。"
:disabled="disabled || !valid || previewLoading"
acknowledgement
@confirm="loadPreview"
/>
<NButton v-else :disabled="disabled || !valid" :loading="previewLoading" @click="loadPreview"
>预览本次真实输入</NButton
>
<NAlert v-if="previewError" type="error">{{ previewError }}</NAlert>
<div v-if="preview" class="text-xs space-y-3">
<p>实际供应方:{{ preview.provider }} · 模型:{{ preview.model }}</p>
<p class="whitespace-pre-wrap">最终提示词:{{ preview.providerPrompt }}</p>
<pre class="whitespace-pre-wrap break-all">{{
JSON.stringify(
{
referenceImages: preview.referenceImages,
referencePlan: preview.referencePlan,
generationConfig: preview.generationConfig
},
null,
2
)
}}</pre>
</div>
<NCheckbox
id="identity-image-cost"
v-model:checked="acknowledged"
@@ -170,10 +279,14 @@ const rules = {
>
</AppForm>
<template #footer>
<NButton @click="open = false">取消</NButton
><NButton :disabled="disabled || !valid || !acknowledged" type="primary" @click="formRef?.validate(submit)">
确认生成身份图
</NButton>
<NButton @click="open = false">取消</NButton
><NButton
:disabled="disabled || paidPreviewPending || !valid || !acknowledged"
type="primary"
@click="formRef?.validate(submit)"
>
确认生成身份图
</NButton>
</template>
</AppDialog>
</template>
@@ -0,0 +1,109 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { NAlert, NButton, NCheckbox, NInputNumber } from 'naive-ui'
import { AppDialog } from '../../../components/ui'
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
import type { CreativeProfile, GenerationModelCatalog, GenerationOptions } from '../../generation-config/types'
import type { StableAnchorQualityInput } from '../types'
/** 单主体稳定母版质量生成配置。 */
const props = defineProps<{
/** 正式主体 ID。 */
subjectId: string
/** 主体名称。 */
subjectName: string
/** 模型目录。 */
catalog: GenerationModelCatalog
/** 项目生成配置。 */
profile: CreativeProfile
/** 当前是否阻断提交。 */
disabled: boolean
}>()
/** 质量弹窗开关。 */
const open = defineModel<boolean>('open', { default: false })
/** 已确认费用的生成事件。 */
const emit = defineEmits<{ generate: [input: StableAnchorQualityInput] }>()
/** 本次供应方。 */
const provider = ref('')
/** 本次图片参数。 */
const options = ref<GenerationOptions>({})
/** 最多修复次数。 */
const maxRepairAttempts = ref(0)
/** 明确费用确认。 */
const acknowledged = ref(false)
/** 有限预算和供应方是否可用。 */
const valid = computed(
() =>
!!provider.value &&
Number.isInteger(maxRepairAttempts.value) &&
maxRepairAttempts.value >= 0 &&
maxRepairAttempts.value <= 3
)
/** 每次重新打开或切主体初始化项目参数。 */
watch(
() => [open.value, props.subjectId],
() => {
const selected =
props.catalog.images.find(item => item.provider === props.profile.imageProvider && item.enabled) ??
props.catalog.images.find(item => item.enabled)
provider.value = selected?.provider ?? ''
options.value = {
...selected?.defaults,
...(selected?.provider === props.profile.imageProvider ? props.profile.imageOptions : {})
}
maxRepairAttempts.value = 0
acknowledged.value = false
},
{ immediate: true }
)
/** 改变预算或模型后必须再次确认。 */
watch(
() => [provider.value, JSON.stringify(options.value), maxRepairAttempts.value],
() => {
acknowledged.value = false
}
)
/** 提交有限预算的模型生成参数。 */
function submit() {
if (props.disabled || !valid.value || !acknowledged.value) return
emit('generate', {
provider: provider.value,
generationOptions: { ...options.value },
maxRepairAttempts: maxRepairAttempts.value
})
open.value = false
}
</script>
<template>
<!-- 以下是单主体母版质量生成费用确认模块 -->
<AppDialog v-model:open="open" title="生成稳定母版并校验质量" :description="subjectName">
<div class="dialog-form-stack">
<NAlert type="warning" :show-icon="false"
>最多生成
{{ maxRepairAttempts + 1 }}
张候选,并逐张调用视觉校验;道具还可能调用结构编译模型,均可能产生费用。只有真实通过后,后端才会切换母版并锁定身份。</NAlert
>
<GenerationModelControls
type="image"
:catalog="catalog"
:provider="provider"
:options="options"
:aspect-ratio="profile.aspectRatio"
:disabled="disabled"
@update:provider="provider = $event"
@update:options="options = $event"
/>
<label
>最多修复次数(0–3)<NInputNumber v-model:value="maxRepairAttempts" :min="0" :max="3" :precision="0"
/></label>
<NCheckbox v-model:checked="acknowledged">我已确认本次候选数量、模型费用,且后台没有同项目任务。</NCheckbox>
</div>
<template #footer
><NButton @click="open = false">取消</NButton
><NButton type="primary" :disabled="disabled || !valid || !acknowledged" @click="submit"
>确认生成并校验</NButton
></template
>
</AppDialog>
</template>
+78
View File
@@ -167,3 +167,81 @@ export type IdentityReceipt =
| { kind: 'identities'; title: string; result: IdentityBatchResult }
| { kind: 'casting'; title: string; result: CastingBatchResult }
| { kind: 'stable-anchors'; title: string; result: StableAnchorBatchResult }
/** 最终身份图片 Provider 输入,直接对应身份预览接口。 */
export interface IdentityImagePreview {
/** 实际供应方。 */
provider: string
/** 实际模型。 */
model: string
/** 最终提示词。 */
providerPrompt: string
/** 实际引用图片地址。 */
referenceImages: string[]
/** 后端参考图选择计划。 */
referencePlan: Record<string, unknown>
/** 后端解析后的生成配置。 */
generationConfig: Record<string, unknown>
}
/** 指定身份图片的视觉校验回执。 */
export interface IdentityValidationResult {
/** 正式主体 ID。 */
subjectId: string
/** 被校验的图片 ID。 */
imageId: string
/** 是否通过本次校验。 */
passed: boolean
/** 校验总结。 */
summary: string
/** 具体问题。 */
issues: Array<{
/** 问题类型。 */
type: string
/** 严重程度。 */
severity: string
/** 问题描述。 */
description: string
}>
}
/** 有限预算的单主体稳定母版生成参数。 */
export interface StableAnchorQualityInput {
/** 最大修复次数,页面限制为 0 到 3。 */
maxRepairAttempts: number
/** 本次供应方。 */
provider: string
/** 本次图片生成参数。 */
generationOptions: Record<string, string | number | boolean>
}
/** 单主体质量闭环的真实终态回执。 */
export interface StableAnchorQualityResult {
/** 最终是否通过。 */
passed: boolean
/** 最后一张候选图片 ID。 */
imageId?: string
/** 实际修复次数。 */
repairAttempts: number
/** 后端停止原因。 */
stopReason?: string
/** 重复错误签名。 */
repeatedErrorSignature?: string
/** 每轮结果。 */
attempts: Array<{
/** 从零开始的轮次。 */
attempt: number
/** 本轮图片 ID。 */
imageId: string
/** 本轮是否通过。 */
passed: boolean
/** 原始诊断问题。 */
issues: unknown[]
/** 结构问题类型。 */
structuralIssueTypes?: string[]
/** 错误签名。 */
errorSignature?: string
}>
/** 通过后原子确认的母版与锁定回执。 */
confirmed?: ConfirmCastingResult
}
@@ -10,6 +10,9 @@ import { useProjectContext } from '../projects/context'
import { subjectIdentityApi } from './api'
import { canBeAnchor, getIdentitySession, groupIdentitySubjects, mergeCastingSubjects } from './model'
import type {
IdentityValidationResult,
StableAnchorQualityInput,
StableAnchorQualityResult,
GenerateCastingCandidateInput,
GenerateIdentityImageInput,
IdentityImage,
@@ -82,7 +85,9 @@ export function useSubjectIdentity() {
)
const subject = computed(() => subjects.value.find(item => item.id === selectedId.value))
const selectionKey = computed(() => subject.value?.id ?? '')
const detailRef = {} as { current?: ReturnType<typeof usePolling<{ identity: SubjectIdentity | null; images: IdentityImage[] }>> }
const detailRef = {} as {
current?: ReturnType<typeof usePolling<{ identity: SubjectIdentity | null; images: IdentityImage[] }>>
}
const detailPollInterval = computed(() =>
detailRef.current?.data.value?.images.some(image => image.status === 'pending' || image.status === 'generating')
? 4000
@@ -163,6 +168,72 @@ export function useSubjectIdentity() {
editorRevision.value++
})
/** 校验结果以正式主体 ID 保存,切换主体不会串回执。 */
const validationResults = ref<Record<string, IdentityValidationResult>>({})
/** 质量闭环结果以正式主体 ID 保存。 */
const qualityResults = ref<Record<string, StableAnchorQualityResult>>({})
/** 当前主体的指定图片校验结果。 */
const validationResult = computed(() => validationResults.value[selectedId.value] ?? null)
/** 当前主体的质量闭环回执。 */
const qualityResult = computed(() => qualityResults.value[selectedId.value] ?? null)
/**
* 校验当前主体的正式图片,费用确认由图库负责。
* @param imageId 指定正式身份图片 ID
*/
async function validateImage(imageId: string) {
const image = images.value.find(item => item.id === imageId)
if (detailBlocked.value || !subject.value || image?.status !== 'completed' || !image.imageUrl) return
const id = subject.value.id
const project = projectId.value
delete validationResults.value[id]
await runOperation(project, '校验身份参考图质量', async () => {
const result = await subjectIdentityApi.validateImage(id, imageId)
if (result.subjectId !== id || result.imageId !== imageId) throw new Error('身份校验回执与提交目标不匹配')
validationResults.value[id] = result
})
}
/**
* 为场景或道具执行有限预算质量闭环,仅按真实回执确认锁定。
* @param input 模型、参数和修复次数
*/
async function generateStableAnchorQuality(input: StableAnchorQualityInput) {
if (
!canGenerateImage.value ||
!subject.value ||
!identity.value ||
!['scene', 'prop'].includes(subject.value.module)
)
return
if (!Number.isInteger(input.maxRepairAttempts) || input.maxRepairAttempts < 0 || input.maxRepairAttempts > 3)
return
const id = subject.value.id
const identityId = identity.value.id
const project = projectId.value
delete qualityResults.value[id]
await runOperation(project, '生成稳定身份母版并校验质量', async () => {
const result = await subjectIdentityApi.generateStableAnchorQuality(id, input)
if (
result.passed &&
(!result.confirmed ||
result.confirmed.subjectId !== id ||
result.confirmed.identityId !== identityId ||
!result.confirmed.isLocked ||
!result.confirmed.anchor.isAnchor ||
result.confirmed.anchor.id !== result.imageId)
)
throw new Error('质量生成的母版与锁定回执未确认,请刷新核对')
qualityResults.value[id] = result
})
if (projectId.value === project) {
await Promise.all([
catalog.refresh(),
castingQuery.refresh(),
projectContext.refreshStageReadiness(),
...(selectedId.value === id ? [detail.refresh()] : [])
])
}
}
/** 长请求跨主体切换后只更新原项目的操作回执,不用旧响应覆盖新主体。 */
async function writeIdentity(label: string, action: (id: string) => Promise<SubjectIdentity>) {
if (detailBlocked.value || !subject.value) return
@@ -447,6 +518,10 @@ export function useSubjectIdentity() {
generateCastingCandidate,
setAnchor,
confirmStableAnchor,
confirmCasting
confirmCasting,
validateImage,
generateStableAnchorQuality,
validationResult,
qualityResult
}
}