feat(short-drama-agent-front): 完善主体身份骨架屏与交互反馈
This commit is contained in:
1 parent
5fa1c251a9
commit
dd0bd79a35
19 files changed
+1552
-419
No files matched your search
@@ -26,8 +26,11 @@ import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||
import { castingStatusLabel, currentAnchor } from './model'
|
||||
import { useSubjectIdentity } from './useSubjectIdentity'
|
||||
import { useProjectContext } from '../projects/context'
|
||||
import { useProjectStageAccess } from '../projects/useProjectStageAccess'
|
||||
import StableAnchorQualityDialog from './components/StableAnchorQualityDialog.vue'
|
||||
import IdentityEditor from './components/IdentityEditor.vue'
|
||||
import SubjectIdentitySkeleton from './SubjectIdentitySkeleton.vue'
|
||||
import IdentityDetailSkeleton from './components/IdentityDetailSkeleton.vue'
|
||||
import IdentityGallery from './components/IdentityGallery.vue'
|
||||
import IdentityImageDialog from './components/IdentityImageDialog.vue'
|
||||
import CastingCandidateDialog from './components/CastingCandidateDialog.vue'
|
||||
@@ -38,7 +41,6 @@ import type { IdentitySubject } from './types'
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const projectContext = useProjectContext()
|
||||
const stageComplete = computed(() => projectContext.stageReadiness.value?.identity.ready === true)
|
||||
const {
|
||||
projectId,
|
||||
operation,
|
||||
@@ -82,9 +84,31 @@ const {
|
||||
confirmCasting,
|
||||
validateImage,
|
||||
generateStableAnchorQuality,
|
||||
validationResult,
|
||||
qualityResult
|
||||
pendingImageOperation
|
||||
} = useSubjectIdentity()
|
||||
/** 所有形态图片入口复用侧栏和路由的服务端阶段准入规则。 */
|
||||
const stageAccess = useProjectStageAccess(projectId, projectContext.stageReadiness)
|
||||
/** 当前项目是否允许进入形态图片,以及尚未开放的具体原因。 */
|
||||
const subjectImagesAccess = computed(() => stageAccess.sections.value['subject-images'])
|
||||
/** 当前主体的生成进度或失败原因统一放在两栏上方,切换主体时跟随正式详情更新。 */
|
||||
const generationFeedback = computed(() => {
|
||||
if (!subject.value) return null
|
||||
if (activeIdentityGeneration.value)
|
||||
return {
|
||||
type: 'info' as const,
|
||||
message: `${subject.value.name} 的身份图片正在生成,刷新页面不会重复提交,请等待当前任务完成。`
|
||||
}
|
||||
if (latestIdentityFailure.value)
|
||||
return {
|
||||
type: 'error' as const,
|
||||
message: `最近一次身份图片生成失败:${latestIdentityFailure.value.error || '未返回具体错误'}。可以调整模型参数后重新生成。`
|
||||
}
|
||||
return null
|
||||
})
|
||||
/** 首次读取目录才替换整页,刷新已有主体时保留选择与阅读位置。 */
|
||||
const initialLoading = computed(() => catalog.loading.value && !catalog.data.value)
|
||||
/** 切换主体时只替换尚未返回的详情,不遮挡已读取的主体目录。 */
|
||||
const detailInitialLoading = computed(() => detail.loading.value && !detail.data.value)
|
||||
const search = ref('')
|
||||
const module = ref('all')
|
||||
const identityBatchModule = ref<'all' | 'character' | 'scene' | 'prop'>('all')
|
||||
@@ -219,7 +243,7 @@ const identityFlow = computed(() => {
|
||||
const character = subject.value?.module === 'character'
|
||||
return [
|
||||
{ label: '身份文本', done: identityTextReady.value },
|
||||
{ label: character ? '选角候选' : '身份参考图', done: candidateReady.value },
|
||||
{ label: character ? '角色候选图' : '身份参考图', done: candidateReady.value },
|
||||
{ label: '确认并锁定', done: identityReady.value }
|
||||
]
|
||||
})
|
||||
@@ -227,6 +251,7 @@ const currentFlowIndex = computed(() => {
|
||||
const index = identityFlow.value.findIndex(step => !step.done)
|
||||
return index < 0 ? identityFlow.value.length : index
|
||||
})
|
||||
/** 按身份文本、角色候选图和母版确认状态说明下一步,明确 AI 生成的是文本还是图片。 */
|
||||
const nextAction = computed<{ action: IdentityFlowAction; title: string; description: string; label: string }>(() => {
|
||||
if (!hasStyle.value)
|
||||
return {
|
||||
@@ -246,16 +271,16 @@ const nextAction = computed<{ action: IdentityFlowAction; title: string; descrip
|
||||
return {
|
||||
action: 'identity',
|
||||
title: '第 1 步:生成身份文本',
|
||||
description: '生成稳定身份描述和核心提示词。',
|
||||
label: '生成身份文本'
|
||||
description: 'AI 填写下方身份描述和核心提示词,生成后会保存到项目。',
|
||||
label: 'AI 生成主体身份'
|
||||
}
|
||||
if (!candidateReady.value)
|
||||
return subject.value?.module === 'character'
|
||||
? {
|
||||
action: 'candidate',
|
||||
title: '第 2 步:生成选角候选',
|
||||
description: '生成候选后再确认正式演员。',
|
||||
label: '生成选角候选'
|
||||
title: '第 2 步:生成角色候选图',
|
||||
description: 'AI 根据身份文本生成角色外观图片,选定一张作为角色母版,用于后续图片生成。',
|
||||
label: 'AI 生成角色候选图'
|
||||
}
|
||||
: {
|
||||
action: 'candidate',
|
||||
@@ -280,7 +305,9 @@ const nextAction = computed<{ action: IdentityFlowAction; title: string; descrip
|
||||
return {
|
||||
action: 'forms',
|
||||
title: '主体身份已完成',
|
||||
description: '可以继续生成此主体的形态图片。',
|
||||
description: subjectImagesAccess.value.enabled
|
||||
? '可以继续生成此主体的形态图片。'
|
||||
: `${subjectImagesAccess.value.reason},完成项目准备后可进入形态图片。`,
|
||||
label: '查看形态图片'
|
||||
}
|
||||
})
|
||||
@@ -290,10 +317,10 @@ function openProfileSettings() {
|
||||
if (route.query.configure !== 'profile') void router.replace({ query: { ...route.query, configure: 'profile' } })
|
||||
}
|
||||
|
||||
/** 根据当前主体的下一步引导执行操作,形态图片跳转仍遵守项目统一准入规则。 */
|
||||
function runNextAction() {
|
||||
if (nextAction.value.action === 'style') void router.push(`/projects/${projectId.value}/visual-style`)
|
||||
else if (nextAction.value.action === 'profile') openProfileSettings()
|
||||
else if (nextAction.value.action === 'identity') void generate()
|
||||
else if (nextAction.value.action === 'candidate') {
|
||||
if (subject.value?.module === 'character') castingOpen.value = true
|
||||
else imageOpen.value = true
|
||||
@@ -301,7 +328,7 @@ function runNextAction() {
|
||||
document.querySelector('#identity-reference-gallery')?.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
||||
} else if (nextAction.value.action === 'lock') {
|
||||
document.querySelector('#identity-lock')?.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||||
} else if (nextAction.value.action === 'forms') {
|
||||
} else if (nextAction.value.action === 'forms' && subjectImagesAccess.value.enabled) {
|
||||
void router.push({
|
||||
path: `/projects/${projectId.value}/subject-images`,
|
||||
query: { subjectRef: subject.value?.ref }
|
||||
@@ -311,9 +338,11 @@ function runNextAction() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<WorkspacePage split compact mobile-scroll class="identity-workspace-page">
|
||||
<!-- 以下是项目已读取但正式主体目录尚未返回时的完整骨架屏模块 -->
|
||||
<SubjectIdentitySkeleton v-if="initialLoading" />
|
||||
<WorkspacePage v-else split compact mobile-scroll class="identity-workspace-page">
|
||||
<template #notice>
|
||||
<NAlert v-if="stageComplete" type="success" :show-icon="false">
|
||||
<NAlert v-if="subjectImagesAccess.enabled" type="success" :show-icon="false">
|
||||
所有需要确认的角色身份已经准备好,可以继续制作主体形态图片。
|
||||
<RouterLink :to="`/projects/${projectId}/subject-images`" class="text-button ml-2"
|
||||
>继续形态图片 →</RouterLink
|
||||
@@ -451,7 +480,7 @@ function runNextAction() {
|
||||
@confirm="generateProject(true)"
|
||||
/>
|
||||
<ConfirmAction
|
||||
label="生成选角候选"
|
||||
label="AI 批量生成角色候选图"
|
||||
:disabled="
|
||||
castingBlocked ||
|
||||
!hasStyle ||
|
||||
@@ -612,6 +641,14 @@ function runNextAction() {
|
||||
><NAlert role="alert" type="error" :show-icon="false"
|
||||
>{{ catalog.error.value || styleQuery.error.value || castingQuery.error.value }}
|
||||
当前相关操作已暂停,请刷新核对后端。
|
||||
<NButton
|
||||
v-if="catalog.error.value"
|
||||
text
|
||||
class="ml-3"
|
||||
:loading="catalog.loading.value"
|
||||
@click="catalog.refresh"
|
||||
>重试读取目录</NButton
|
||||
>
|
||||
</NAlert></NScrollbar
|
||||
>
|
||||
<NAlert
|
||||
@@ -625,209 +662,236 @@ function runNextAction() {
|
||||
<NButton type="primary" @click="openProfileSettings">立即配置</NButton>
|
||||
</div>
|
||||
</NAlert>
|
||||
<div v-if="subjects.length" class="identity-workspace">
|
||||
<!-- 以下是主体目录 -->
|
||||
<aside class="panel directory-panel identity-directory">
|
||||
<div class="directory-heading">
|
||||
<h3>
|
||||
主体目录 <span>{{ filtered.length }} / {{ subjects.length }}</span>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="directory-filters">
|
||||
<NInput
|
||||
placeholder="搜索主体或引用"
|
||||
aria-label="搜索主体身份"
|
||||
:input-props="{ 'aria-label': '搜索主体身份' }"
|
||||
v-model:value="search"
|
||||
clearable
|
||||
></NInput>
|
||||
</div>
|
||||
<NScrollbar
|
||||
class="identity-subject-list panel-scroll directory-scroll"
|
||||
content-class="directory-list-content identity-subject-list-content"
|
||||
x-scrollable
|
||||
>
|
||||
<!-- 以下是主体选中项自动定位模块,不增加目录布局占位 -->
|
||||
<div ref="subjectDirectoryRoot" class="identity-directory-items">
|
||||
<DirectoryItem
|
||||
v-for="item in filtered"
|
||||
:key="item.id"
|
||||
:aria-pressed="selectedId === item.id"
|
||||
:active="selectedId === item.id"
|
||||
@click="select(item.id)"
|
||||
class="identity-subject-item"
|
||||
>{{ item.name }}
|
||||
<template #leading>
|
||||
<IdentityThumbnail
|
||||
:project-id="projectId"
|
||||
:subject-id="item.id"
|
||||
:name="item.name"
|
||||
:module="item.module"
|
||||
:identity-id="item.identity === null ? null : item.identity?.id"
|
||||
:source="thumbnailSource(item)"
|
||||
:refresh-key="thumbnailRefreshKey"
|
||||
/>
|
||||
</template>
|
||||
<template #eyebrow>{{ item.ref }}</template>
|
||||
<template #meta>
|
||||
<span>{{ item.forms.length }} 个形态</span
|
||||
><span v-if="castingBySubject.has(item.id)" class="directory-status">
|
||||
{{ castingStatusLabel(castingBySubject.get(item.id)!.status) }}</span
|
||||
>
|
||||
</template></DirectoryItem
|
||||
<div v-if="subjects.length" class="identity-workspace-region">
|
||||
<!-- 以下是目录与详情上方的全栏生成提示模块,显示和隐藏时平滑收放高度 -->
|
||||
<Transition name="identity-feedback" appear>
|
||||
<div v-if="generationFeedback" class="identity-feedback-motion">
|
||||
<div class="identity-feedback-body workspace-feedback">
|
||||
<NAlert
|
||||
:type="generationFeedback.type"
|
||||
:show-icon="false"
|
||||
class="identity-generation-feedback text-xs"
|
||||
>{{ generationFeedback.message }}</NAlert
|
||||
>
|
||||
<p v-if="!filtered.length" class="py-6 text-xs text-muted">没有匹配主体,请调整筛选。</p>
|
||||
</div>
|
||||
</NScrollbar>
|
||||
</aside>
|
||||
<NScrollbar class="identity-detail panel-scroll min-w-0">
|
||||
<NAlert v-if="pendingSelection" type="info" :show-icon="false" class="mb-4"
|
||||
><p class="text-xs">当前主体有未保存修改,切换会丢弃草稿。</p>
|
||||
<div class="mt-3 flex gap-3">
|
||||
<NButton @click="discardAndSelect">放弃草稿并切换</NButton
|
||||
><NButton @click="pendingSelection = ''" text size="small">继续编辑</NButton>
|
||||
</div></NAlert
|
||||
>
|
||||
<section v-if="subject" class="panel workspace-panel">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<h3 class="font-semibold">
|
||||
{{ subject.name }} <code class="subject-ref ml-2">{{ subject.ref }}</code>
|
||||
</h3>
|
||||
</div>
|
||||
<NButton :disabled="detail.loading.value" @click="detail.refresh" text size="small">
|
||||
刷新身份
|
||||
</NButton>
|
||||
</div>
|
||||
</Transition>
|
||||
<div class="identity-workspace">
|
||||
<!-- 以下是主体目录 -->
|
||||
<aside class="panel directory-panel identity-directory">
|
||||
<div class="directory-heading">
|
||||
<h3>
|
||||
主体目录 <span>{{ filtered.length }} / {{ subjects.length }}</span>
|
||||
</h3>
|
||||
</div>
|
||||
<NAlert v-if="detail.error.value" role="alert" type="error" :show-icon="false" class="mt-4"
|
||||
>{{ detail.error.value }} 查询失败时不允许生成或覆盖。
|
||||
</NAlert>
|
||||
<p v-if="!detail.data.value && detail.loading.value" class="py-8 text-sm text-muted" role="status">
|
||||
正在读取主体身份…
|
||||
</p>
|
||||
<template v-if="detail.data.value">
|
||||
<div class="identity-flow mt-4" aria-label="主体身份操作步骤">
|
||||
<ol class="identity-flow-steps">
|
||||
<li
|
||||
v-for="(step, index) in identityFlow"
|
||||
:key="step.label"
|
||||
:class="{ done: step.done, current: index === currentFlowIndex }"
|
||||
>
|
||||
<span class="identity-flow-marker">
|
||||
<Check v-if="step.done" :size="14" />
|
||||
<Circle v-else :size="12" />
|
||||
</span>
|
||||
<span>{{ index + 1 }}. {{ step.label }}</span>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="identity-next-action">
|
||||
<div>
|
||||
<strong>{{ nextAction.title }}</strong>
|
||||
<p>{{ nextAction.description }}</p>
|
||||
</div>
|
||||
<NButton
|
||||
type="primary"
|
||||
:disabled="
|
||||
operation.pending ||
|
||||
(nextAction.action === 'identity' && !canGenerateText) ||
|
||||
(nextAction.action === 'candidate' &&
|
||||
(subject.module === 'character'
|
||||
? !canGenerateCandidate
|
||||
: !canGenerateImage))
|
||||
"
|
||||
@click="runNextAction"
|
||||
>{{ nextAction.label }}</NButton
|
||||
>
|
||||
</div>
|
||||
<div class="directory-filters">
|
||||
<NInput
|
||||
placeholder="搜索主体或引用"
|
||||
aria-label="搜索主体身份"
|
||||
:input-props="{ 'aria-label': '搜索主体身份' }"
|
||||
v-model:value="search"
|
||||
clearable
|
||||
></NInput>
|
||||
</div>
|
||||
<NScrollbar
|
||||
class="identity-subject-list panel-scroll directory-scroll"
|
||||
content-class="directory-list-content identity-subject-list-content"
|
||||
x-scrollable
|
||||
>
|
||||
<!-- 以下是主体选中项自动定位模块,不增加目录布局占位 -->
|
||||
<div ref="subjectDirectoryRoot" class="identity-directory-items">
|
||||
<DirectoryItem
|
||||
v-for="item in filtered"
|
||||
:key="item.id"
|
||||
:aria-pressed="selectedId === item.id"
|
||||
:active="selectedId === item.id"
|
||||
@click="select(item.id)"
|
||||
class="identity-subject-item"
|
||||
>{{ item.name }}
|
||||
<template #leading>
|
||||
<IdentityThumbnail
|
||||
:project-id="projectId"
|
||||
:subject-id="item.id"
|
||||
:name="item.name"
|
||||
:module="item.module"
|
||||
:identity-id="item.identity === null ? null : item.identity?.id"
|
||||
:source="thumbnailSource(item)"
|
||||
:refresh-key="thumbnailRefreshKey"
|
||||
/>
|
||||
</template>
|
||||
<template #eyebrow>{{ item.ref }}</template>
|
||||
<template #meta>
|
||||
<span>{{ item.forms.length }} 个形态</span
|
||||
><span v-if="castingBySubject.has(item.id)" class="directory-status">
|
||||
{{ castingStatusLabel(castingBySubject.get(item.id)!.status) }}</span
|
||||
>
|
||||
</template></DirectoryItem
|
||||
>
|
||||
<p v-if="!filtered.length" class="py-6 text-xs text-muted">没有匹配主体,请调整筛选。</p>
|
||||
</div>
|
||||
<p v-if="dirty" class="mt-3 text-xs text-muted">请先保存身份修改,再使用 AI 或生成图片。</p>
|
||||
<IdentityEditor
|
||||
:key="`${selectedId}:${editorRevision}`"
|
||||
:identity="identity"
|
||||
:module="subject.module"
|
||||
:disabled="detailBlocked"
|
||||
@save="save"
|
||||
@dirty="dirty = $event"
|
||||
/>
|
||||
<div v-if="anchor" class="identity-anchor mt-5 flex items-center gap-4 pt-5">
|
||||
<AssetImage
|
||||
:src="anchor.imageUrl"
|
||||
:alt="`${subject.name}当前身份母版`"
|
||||
preview
|
||||
class="h-20 w-20 shrink-0"
|
||||
/>
|
||||
</NScrollbar>
|
||||
</aside>
|
||||
<NScrollbar class="identity-detail panel-scroll min-w-0">
|
||||
<NAlert v-if="pendingSelection" type="info" :show-icon="false" class="mb-4"
|
||||
><p class="text-xs">当前主体有未保存修改,切换会丢弃草稿。</p>
|
||||
<div class="mt-3 flex gap-3">
|
||||
<NButton @click="discardAndSelect">放弃草稿并切换</NButton
|
||||
><NButton @click="pendingSelection = ''" text size="small">继续编辑</NButton>
|
||||
</div></NAlert
|
||||
>
|
||||
<section v-if="subject" class="panel workspace-panel">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<p class="text-sm font-medium">当前身份母版</p>
|
||||
<p class="mt-2 text-xs text-muted">
|
||||
{{
|
||||
subject.module === 'character'
|
||||
? identity?.isLocked
|
||||
? '演员身份已确认并锁定,可用于形态图与镜头首帧。'
|
||||
: '已有演员母版但 Identity 尚未锁定,镜头首帧仍会被阻塞。'
|
||||
: subject.module === 'prop'
|
||||
? '锁定后,后续道具形态图会继承当前母版。'
|
||||
: '后续场景形态图会继承此图的空间结构。'
|
||||
}}
|
||||
</p>
|
||||
<h3 class="font-semibold">
|
||||
{{ subject.name }} <code class="subject-ref ml-2">{{ subject.ref }}</code>
|
||||
</h3>
|
||||
</div>
|
||||
<NButton :disabled="detail.loading.value" @click="detail.refresh" text size="small">
|
||||
刷新身份
|
||||
</NButton>
|
||||
</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 v-if="detail.error.value" role="alert" type="error" :show-icon="false" class="mt-4"
|
||||
>{{ detail.error.value }} 查询失败时不允许生成或覆盖。
|
||||
</NAlert>
|
||||
<!-- 以下是已完成主体的候选生成与真实输入预览入口模块 -->
|
||||
<NButton class="mt-4" :disabled="!canGenerateImage" @click="imageOpen = true">
|
||||
{{ subject.module === 'character' ? '生成辅助参考图' : '生成母版候选' }}
|
||||
</NButton>
|
||||
<IdentityGallery
|
||||
id="identity-reference-gallery"
|
||||
:key="selectedId"
|
||||
:images="images"
|
||||
:subject-name="subject.name"
|
||||
:module="subject.module"
|
||||
:identity-locked="!!identity?.isLocked"
|
||||
:disabled="detailBlocked || (subject.module === 'character' && !!castingQuery.error.value)"
|
||||
:validation-result="validationResult"
|
||||
@validate="validateImage"
|
||||
@anchor="chooseAnchor"
|
||||
/>
|
||||
</template>
|
||||
<div class="mt-5 pt-5">
|
||||
<h4 class="text-xs font-medium">此主体的形态</h4>
|
||||
<div class="mt-3 flex flex-wrap gap-2">
|
||||
<NTag v-for="form in subject.forms" :key="form.id" size="small" :bordered="false"
|
||||
>{{ form.name }}{{ form.isDefault ? ' · 默认' : '' }}</NTag
|
||||
<!-- 以下是切换主体时的局部骨架模块,保留真实主体名称与目录 -->
|
||||
<IdentityDetailSkeleton v-if="detailInitialLoading" class="mt-5" />
|
||||
<template v-if="detail.data.value">
|
||||
<div class="identity-flow" aria-label="主体身份操作步骤">
|
||||
<ol class="identity-flow-steps">
|
||||
<li
|
||||
v-for="(step, index) in identityFlow"
|
||||
:key="step.label"
|
||||
:class="{ done: step.done, current: index === currentFlowIndex }"
|
||||
>
|
||||
<span class="identity-flow-marker">
|
||||
<Check v-if="step.done" :size="14" />
|
||||
<Circle v-else :size="12" />
|
||||
</span>
|
||||
<span>{{ index + 1 }}. {{ step.label }}</span>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="identity-next-action">
|
||||
<div>
|
||||
<strong>{{ nextAction.title }}</strong>
|
||||
<p>{{ nextAction.description }}</p>
|
||||
</div>
|
||||
<NButton
|
||||
v-if="
|
||||
nextAction.action !== 'identity' &&
|
||||
(nextAction.action !== 'forms' || subjectImagesAccess.enabled)
|
||||
"
|
||||
type="primary"
|
||||
:disabled="
|
||||
operation.pending ||
|
||||
(nextAction.action === 'candidate' &&
|
||||
(subject.module === 'character'
|
||||
? !canGenerateCandidate
|
||||
: !canGenerateImage))
|
||||
"
|
||||
@click="runNextAction"
|
||||
>{{ nextAction.label }}</NButton
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="dirty" class="mt-3 text-xs text-muted">请先保存身份修改,再使用 AI 或生成图片。</p>
|
||||
<IdentityEditor
|
||||
:key="`${selectedId}:${editorRevision}`"
|
||||
:identity="identity"
|
||||
:module="subject.module"
|
||||
:disabled="detailBlocked"
|
||||
@save="save"
|
||||
@dirty="dirty = $event"
|
||||
>
|
||||
<!-- 以下是唯一的单主体 AI 文本生成入口,覆盖已有文本时沿用确认弹窗 -->
|
||||
<template #generate>
|
||||
<ConfirmAction
|
||||
v-if="identity?.description?.trim() || identity?.generationPrompt?.trim()"
|
||||
label="AI 生成主体身份"
|
||||
description="AI 将重新生成当前主体的身份描述和核心提示词,并覆盖已保存的文本;已有图片不会自动更新。"
|
||||
:disabled="!canGenerateText"
|
||||
primary
|
||||
@confirm="generate"
|
||||
/>
|
||||
<NButton v-else type="primary" :disabled="!canGenerateText" @click="generate">
|
||||
AI 生成主体身份
|
||||
</NButton>
|
||||
</template>
|
||||
</IdentityEditor>
|
||||
<div v-if="anchor" class="identity-anchor mt-5 flex items-center gap-4 pt-5">
|
||||
<AssetImage
|
||||
:src="anchor.imageUrl"
|
||||
:alt="`${subject.name}当前身份母版`"
|
||||
preview
|
||||
class="h-20 w-20 shrink-0"
|
||||
/>
|
||||
<div>
|
||||
<p class="text-sm font-medium">当前身份母版</p>
|
||||
<p class="mt-2 text-xs text-muted">
|
||||
{{
|
||||
subject.module === 'character'
|
||||
? identity?.isLocked
|
||||
? '演员身份已确认并锁定,可用于形态图与镜头首帧。'
|
||||
: '已有演员母版但 Identity 尚未锁定,镜头首帧仍会被阻塞。'
|
||||
: subject.module === 'prop'
|
||||
? '锁定后,后续道具形态图会继承当前母版。'
|
||||
: '后续场景形态图会继承此图的空间结构。'
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<IdentityGallery
|
||||
id="identity-reference-gallery"
|
||||
:key="selectedId"
|
||||
:images="images"
|
||||
:subject-name="subject.name"
|
||||
:module="subject.module"
|
||||
:identity-locked="!!identity?.isLocked"
|
||||
:disabled="
|
||||
detailBlocked || (subject.module === 'character' && !!castingQuery.error.value)
|
||||
"
|
||||
:pending-operation="pendingImageOperation"
|
||||
@validate="validateImage"
|
||||
@anchor="chooseAnchor"
|
||||
>
|
||||
<!-- 以下是图库标题栏的生成入口模块,与身份保存操作分组 -->
|
||||
<template #actions>
|
||||
<NButton
|
||||
v-if="subject.module === 'scene' || subject.module === 'prop'"
|
||||
:disabled="!canGenerateImage"
|
||||
@click="qualityOpen = true"
|
||||
>生成稳定母版并校验质量</NButton
|
||||
>
|
||||
<NButton :disabled="!canGenerateImage" @click="imageOpen = true">
|
||||
{{ subject.module === 'character' ? '生成辅助参考图' : '生成母版候选' }}
|
||||
</NButton>
|
||||
</template>
|
||||
</IdentityGallery>
|
||||
</template>
|
||||
<!-- 以下是当前主体形态与可用跳转入口,各行沿用统一上下间距 -->
|
||||
<div v-if="!detailInitialLoading" class="identity-subject-forms">
|
||||
<h4 class="text-xs font-medium">此主体的形态</h4>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<NTag v-for="form in subject.forms" :key="form.id" size="small" :bordered="false"
|
||||
>{{ form.name }}{{ form.isDefault ? ' · 默认' : '' }}</NTag
|
||||
>
|
||||
</div>
|
||||
<p v-if="!subject.forms.length" class="text-xs text-muted">
|
||||
此角色尚无正式形态,但可以先完成 Identity 与选角。
|
||||
</p>
|
||||
<RouterLink
|
||||
v-if="subjectImagesAccess.enabled"
|
||||
:to="{
|
||||
path: `/projects/${projectId}/subject-images`,
|
||||
query: { subjectRef: subject.ref }
|
||||
}"
|
||||
class="text-button justify-self-start"
|
||||
>查看此主体形态图片 →</RouterLink
|
||||
>
|
||||
</div>
|
||||
<p v-if="!subject.forms.length" class="mt-3 text-xs text-muted">
|
||||
此角色尚无正式形态,但可以先完成 Identity 与选角。
|
||||
</p>
|
||||
<RouterLink
|
||||
:to="{ path: `/projects/${projectId}/subject-images`, query: { subjectRef: subject.ref } }"
|
||||
class="text-button mt-3"
|
||||
>查看此主体形态图片 →</RouterLink
|
||||
>
|
||||
</div>
|
||||
</section>
|
||||
</NScrollbar>
|
||||
</section>
|
||||
</NScrollbar>
|
||||
</div>
|
||||
</div>
|
||||
<p v-else-if="catalog.loading.value" class="py-8 text-sm text-muted" role="status">正在读取正式主体目录…</p>
|
||||
<EmptyState
|
||||
v-else-if="catalog.data.value"
|
||||
title="还没有可展示的正式主体"
|
||||
@@ -836,16 +900,6 @@ function runNextAction() {
|
||||
>前往剧本拆解</RouterLink
|
||||
></EmptyState
|
||||
>
|
||||
<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>
|
||||
<StableAnchorQualityDialog
|
||||
v-if="
|
||||
subject &&
|
||||
@@ -927,8 +981,43 @@ function runNextAction() {
|
||||
.identity-prerequisite {
|
||||
@apply shrink-0 mx-0 mb-3;
|
||||
}
|
||||
/* 全栏提示与双栏工作区共用外层宽度,提示的间距随自身高度一起收放。 */
|
||||
.identity-workspace-region {
|
||||
@apply flex flex-col flex-1 min-h-0 overflow-hidden;
|
||||
}
|
||||
.identity-feedback-motion {
|
||||
display: grid;
|
||||
grid-template-rows: 1fr;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.identity-feedback-body {
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.identity-generation-feedback {
|
||||
margin-bottom: var(--app-content-gap);
|
||||
}
|
||||
/* 使用自然内容高度适配手机长文案,避免出现和消失时直接挤动目录与详情。 */
|
||||
.identity-feedback-enter-active,
|
||||
.identity-feedback-leave-active {
|
||||
transition:
|
||||
grid-template-rows 240ms cubic-bezier(0.25, 1, 0.5, 1),
|
||||
opacity 180ms ease;
|
||||
}
|
||||
.identity-feedback-enter-from,
|
||||
.identity-feedback-leave-to {
|
||||
grid-template-rows: 0fr;
|
||||
opacity: 0;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.identity-feedback-enter-active,
|
||||
.identity-feedback-leave-active {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
.identity-flow {
|
||||
@apply p-4 bg-(--app-subtle);
|
||||
/* 步骤、下一步说明与上下方标题和字段共用面板边界,避免二次缩进。 */
|
||||
@apply mt-5;
|
||||
}
|
||||
.identity-flow-steps {
|
||||
@apply flex flex-wrap items-center gap-x-6 gap-y-2;
|
||||
@@ -956,6 +1045,16 @@ function runNextAction() {
|
||||
.identity-next-action p {
|
||||
@apply mt-1 text-xs text-muted;
|
||||
}
|
||||
.identity-next-action > div {
|
||||
@apply min-w-0;
|
||||
}
|
||||
.identity-next-action > .n-button {
|
||||
@apply shrink-0;
|
||||
}
|
||||
/* 形态标题、标签和可用入口独立排列,避免内联链接的上边距失效。 */
|
||||
.identity-subject-forms {
|
||||
@apply mt-6 grid gap-4;
|
||||
}
|
||||
.toolbar-type-filter {
|
||||
@apply w-[152px] min-w-0;
|
||||
}
|
||||
@@ -1052,6 +1151,11 @@ function runNextAction() {
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
/* 主体详情自然撑高,提示与主体导航随正文滚走;顶部两行保留固定。 */
|
||||
.identity-workspace-page .identity-workspace-region {
|
||||
height: auto;
|
||||
flex: none;
|
||||
overflow: visible;
|
||||
}
|
||||
.identity-workspace-page .identity-workspace {
|
||||
height: auto;
|
||||
flex: none;
|
||||
@@ -1067,6 +1171,9 @@ function runNextAction() {
|
||||
.identity-next-action {
|
||||
@apply items-start flex-col;
|
||||
}
|
||||
.identity-next-action > .n-button {
|
||||
@apply w-full;
|
||||
}
|
||||
.identity-workspace {
|
||||
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[auto_minmax(0,_1fr)] gap-3;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user