1287 lines
68 KiB
Vue
1287 lines
68 KiB
Vue
<script setup lang="ts">
|
||
import { userFacingText } from '../../lib/user-facing-text'
|
||
import { isOperationRunning } from '../workflows/operations'
|
||
|
||
import ContextNotice from '../../components/ui/ContextNotice.vue'
|
||
|
||
import AppForm from '../../components/ui/AppForm.vue'
|
||
import { NFormItem } from 'naive-ui'
|
||
import { integerRule } from '../../lib/form-rules'
|
||
import { useDirectorySelection } from '../../composables/useDirectorySelection'
|
||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
|
||
import {
|
||
NScrollbar,
|
||
NButton,
|
||
NCheckbox,
|
||
NCollapse,
|
||
NCollapseItem,
|
||
NInput,
|
||
NInputNumber,
|
||
NSelect,
|
||
NTag,
|
||
type ScrollbarInst
|
||
} from 'naive-ui'
|
||
import { computed, inject, ref, watch } from 'vue'
|
||
import { useRoute, useRouter, type LocationQueryRaw } from 'vue-router'
|
||
import { Check, Circle, UserCheck } from '@lucide/vue'
|
||
import { AppDialog, DirectoryItem, EmptyState, StatusBadge } from '../../components/ui'
|
||
import { projectSettingsOpenKey } from '../generation-config/context'
|
||
import { downloadText } from '../../lib/format'
|
||
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'
|
||
import IdentityThumbnail from './components/IdentityThumbnail.vue'
|
||
import type { IdentitySubject, IdentityViewType } from './types'
|
||
|
||
/** 主体身份工作区按正式主体聚合,不把同一主体的多个 Form 当成不同身份。 */
|
||
const route = useRoute()
|
||
const router = useRouter()
|
||
const projectContext = useProjectContext()
|
||
const {
|
||
projectId,
|
||
operation,
|
||
selectedId,
|
||
subject,
|
||
subjects,
|
||
catalog,
|
||
generationModelsQuery,
|
||
castingQuery,
|
||
styleQuery,
|
||
profileQuery,
|
||
detail,
|
||
identity,
|
||
images,
|
||
session,
|
||
concurrency,
|
||
candidateLimit,
|
||
force,
|
||
editorRevision,
|
||
dirty,
|
||
blocked,
|
||
castingBlocked,
|
||
detailBlocked,
|
||
hasStyle,
|
||
hasCreativeProfile,
|
||
canGenerateText,
|
||
canGenerateImage,
|
||
canGenerateCandidate,
|
||
canRequestImage,
|
||
canRequestCandidate,
|
||
activeIdentityGeneration,
|
||
batchValid,
|
||
candidateLimitValid,
|
||
save,
|
||
generate,
|
||
generateProject,
|
||
generateStableAnchors,
|
||
generateCastingCandidates,
|
||
generateImage,
|
||
generateCastingCandidate,
|
||
confirmStableAnchor,
|
||
confirmCasting,
|
||
validateImage,
|
||
generateStableAnchorQuality,
|
||
pendingImageOperation
|
||
} = useSubjectIdentity()
|
||
/** 所有形态图片入口复用侧栏和路由的服务端阶段准入规则。 */
|
||
const stageAccess = useProjectStageAccess(projectId, projectContext.stageReadiness)
|
||
/** 当前项目是否允许进入形态图片,以及尚未开放的具体原因。 */
|
||
const subjectImagesAccess = computed(() => stageAccess.sections.value['subject-images'])
|
||
/** 首次读取目录才替换整页,刷新已有主体时保留选择与阅读位置。 */
|
||
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')
|
||
/** 高级批量操作的按钮和确认说明使用同一范围名称,避免筛选后仍显示“全部”。 */
|
||
const identityBatchScopeLabel = computed(
|
||
() => ({ all: '全部主体', character: '人物', scene: '场景', prop: '道具' })[identityBatchModule.value]
|
||
)
|
||
/** 单主体稳定母版质量生成弹窗开关。 */
|
||
const qualityOpen = ref(false)
|
||
const imageOpen = ref(false)
|
||
/** 从失败记录重试时保留原视角,普通生成仍使用弹窗默认视角。 */
|
||
const retryImageView = ref<IdentityViewType>()
|
||
const castingOpen = ref(false)
|
||
const pendingSelection = ref('')
|
||
const anchor = computed(() => currentAnchor(images.value))
|
||
const thumbnailRefreshKey = ref(0)
|
||
const casting = computed(() => {
|
||
const value = castingQuery.data.value
|
||
return value && Array.isArray(value.items) ? value : null
|
||
})
|
||
const castingBySubject = computed(() => new Map(casting.value?.items.map(item => [item.subjectId, item]) ?? []))
|
||
|
||
/** 详情与选角数据已有母版地址时直接复用,避免对每个角色重复查询。 */
|
||
function thumbnailSource(item: IdentitySubject): string | null | undefined {
|
||
if (item.id === selectedId.value && detail.data.value) return anchor.value?.imageUrl ?? null
|
||
const row = castingBySubject.value.get(item.id)
|
||
if (row) return row.anchorImageUrl || (row.anchorImageId ? undefined : null)
|
||
if (item.id === selectedId.value) return null
|
||
return undefined
|
||
}
|
||
const filtered = computed(() =>
|
||
subjects.value.filter(
|
||
item =>
|
||
(module.value === 'all' || item.module === module.value) &&
|
||
`${item.name} ${item.ref}`.toLowerCase().includes(search.value.trim().toLowerCase())
|
||
)
|
||
)
|
||
/** 主体目录根节点,复用分镜与生产目录的自动定位和平滑滚动。 */
|
||
const subjectDirectoryRoot = ref<HTMLElement | null>(null)
|
||
/** 桌面主体正文的独立滚动容器,切换主体时通过组件公开方法回到顶部。 */
|
||
const identityDetailScrollbar = ref<ScrollbarInst | null>(null)
|
||
/** 图片管理组件,步骤引导通过公开入口打开候选弹窗。 */
|
||
const identityGallery = ref<InstanceType<typeof IdentityGallery> | null>(null)
|
||
/** 手机正文起点,用于在页面共用滚动容器中定位新主体的内容顶部。 */
|
||
const identityContentRoot = ref<HTMLElement | null>(null)
|
||
useDirectorySelection(
|
||
subjectDirectoryRoot,
|
||
() => selectedId.value,
|
||
() => filtered.value.map(item => item.id)
|
||
)
|
||
/** 只在主体实际改变后重置正文,刷新身份或取消切换时保留当前阅读位置。 */
|
||
watch(
|
||
selectedId,
|
||
(id, previousId) => {
|
||
if (!id || !previousId || id === previousId) return
|
||
identityDetailScrollbar.value?.scrollTo({ top: 0, behavior: 'instant' })
|
||
if (!window.matchMedia('(max-width: 760px)').matches) return
|
||
const content = identityContentRoot.value
|
||
const viewport = content?.closest<HTMLElement>('.project-view')
|
||
if (!content || !viewport) return
|
||
viewport.scrollTo({
|
||
top: viewport.scrollTop + content.getBoundingClientRect().top - viewport.getBoundingClientRect().top,
|
||
behavior: 'instant'
|
||
})
|
||
},
|
||
{ flush: 'post' }
|
||
)
|
||
|
||
/** 深链接仅在目标 ID 变化时选择,不因目录轮询把用户切回原主体。 */
|
||
const linkedSubjectId = computed(
|
||
() => subjects.value.find(item => item.id === route.query.subjectId || item.ref === route.query.subjectRef)?.id
|
||
)
|
||
watch(
|
||
linkedSubjectId,
|
||
id => {
|
||
if (id) select(id)
|
||
},
|
||
{ immediate: true }
|
||
)
|
||
watch(selectedId, () => {
|
||
qualityOpen.value = false
|
||
imageOpen.value = false
|
||
castingOpen.value = false
|
||
pendingSelection.value = ''
|
||
})
|
||
/** 关闭生成弹窗后清除重试视角,避免影响下一次普通生成。 */
|
||
watch(imageOpen, open => {
|
||
if (!open) retryImageView.value = undefined
|
||
})
|
||
/** 当前主体写入地址,刷新和返回页面后恢复相同主体,再定位到对应目录项。 */
|
||
watch(
|
||
selectedId,
|
||
id => {
|
||
if (!id || !subjects.value.some(item => item.id === id) || route.query.subjectId === id) return
|
||
const query: LocationQueryRaw = { ...route.query, subjectId: id }
|
||
delete query.subjectRef
|
||
void router.replace({ query })
|
||
},
|
||
{ flush: 'post' }
|
||
)
|
||
|
||
/**
|
||
* 切换主体前确认放弃当前草稿,避免误丢尚未保存的文本。
|
||
* @param id 目标主体编号
|
||
*/
|
||
function select(id: string) {
|
||
if (id === selectedId.value) return
|
||
if (dirty.value) pendingSelection.value = id
|
||
else selectedId.value = id
|
||
}
|
||
|
||
/** 用户明确放弃草稿后切换,查询层会取消旧请求。 */
|
||
function discardAndSelect() {
|
||
if (!pendingSelection.value) return
|
||
dirty.value = false
|
||
selectedId.value = pendingSelection.value
|
||
}
|
||
|
||
/** 保存真实回执便于定位部分失败主体。 */
|
||
function exportReceipt() {
|
||
downloadText('subject-identities-receipt.json', JSON.stringify(session.value.receipt, null, 2), 'application/json')
|
||
}
|
||
|
||
/**
|
||
* 前置校验通过并开始提交时关闭原主体弹窗,后续状态通过消息反馈。
|
||
* @param input 已确认的身份图生成参数
|
||
* @returns 提交与详情刷新完成
|
||
*/
|
||
async function submitIdentityImage(input: Parameters<typeof generateImage>[0]) {
|
||
const targetId = selectedId.value
|
||
await generateImage(input, () => {
|
||
if (selectedId.value === targetId) imageOpen.value = false
|
||
})
|
||
}
|
||
|
||
/**
|
||
* 前置校验通过并开始提交时关闭原主体选角弹窗,不等待接口返回。
|
||
* @param input 已确认的选角生成参数
|
||
* @returns 提交与列表刷新完成
|
||
*/
|
||
async function submitCastingCandidate(input: Parameters<typeof generateCastingCandidate>[0]) {
|
||
const targetId = selectedId.value
|
||
await generateCastingCandidate(input, () => {
|
||
if (selectedId.value === targetId) castingOpen.value = false
|
||
})
|
||
}
|
||
|
||
/**
|
||
* 按主体类型确认母版,成功后关闭原主体的管理弹窗。
|
||
* @param imageId 用户明确选择的图片编号
|
||
*/
|
||
function chooseAnchor(imageId: string) {
|
||
const targetId = selectedId.value
|
||
/** 迟到响应不能关闭另一个主体的弹窗。 */
|
||
const closeConfirmedDialog = () => {
|
||
if (selectedId.value === targetId) identityGallery.value?.closeCandidates()
|
||
}
|
||
if (subject.value?.module === 'character') void confirmCasting(imageId, closeConfirmedDialog)
|
||
else void confirmStableAnchor(imageId, closeConfirmedDialog)
|
||
}
|
||
/** 当前主体生图暂不可用时,在失败记录旁说明具体恢复步骤。 */
|
||
const imageRetryDisabledReason = computed(() => {
|
||
if (operation.value.pending) return '当前操作尚未结束,请等待完成后再重新生成。'
|
||
if (activeIdentityGeneration.value) return '此主体已有图片正在生成,请等待当前任务完成。'
|
||
if (dirty.value) return '请先保存下方身份文本修改,再重新生成图片。'
|
||
if (catalog.error.value || !catalog.data.value || detail.error.value || !detail.data.value)
|
||
return '主体数据读取失败或尚未完成,请先点击“刷新身份”或重试读取目录。'
|
||
if (styleQuery.error.value || !styleQuery.data.value) return '视觉风格尚未读取成功,请刷新页面后重试。'
|
||
if (blocked.value) return '当前项目暂不允许生成图片,请检查剧本与拆解状态,或刷新页面后重试。'
|
||
if (!hasStyle.value) return '请先在视觉风格页面保存项目风格。'
|
||
if (generationModelsQuery.error.value || !generationModelsQuery.data.value)
|
||
return '生成模型目录尚未读取成功,请刷新页面后重试。'
|
||
if (profileQuery.error.value) return '项目生成配置读取失败,请刷新页面后重试。'
|
||
if (!hasCreativeProfile.value) return '请先在“项目配置”中选择生成模型。'
|
||
if (!identity.value?.generationPrompt?.trim()) return '请先填写并保存核心提示词,或使用 AI 生成主体身份。'
|
||
if (subject.value?.module === 'character' && (castingQuery.error.value || !castingQuery.data.value))
|
||
return '角色选角状态尚未读取成功,请刷新页面后重试。'
|
||
return ''
|
||
})
|
||
/**
|
||
* 重新生成只打开原图片类型对应的参数弹窗,费用确认前不发送请求。
|
||
* @param imageId 当前主体中失败图片的正式编号
|
||
*/
|
||
function retryIdentityImage(imageId: string) {
|
||
const image = images.value.find(item => item.id === imageId && item.status === 'failed')
|
||
if (!image || imageRetryDisabledReason.value) return
|
||
if (subject.value?.module === 'character' && image.viewType === 'primary') {
|
||
if (canGenerateCandidate.value) castingOpen.value = true
|
||
} else if (canGenerateImage.value) {
|
||
retryImageView.value = image.viewType
|
||
imageOpen.value = true
|
||
}
|
||
}
|
||
/** 批量操作抽屉显隐状态,新回执到达时自动打开以展示结果。 */
|
||
const toolsOpen = ref(false)
|
||
/** 缺少模型时只展示轻量引导,不保存配置或启动生成。 */
|
||
const modelPromptOpen = ref(false)
|
||
/** 复用右上角已有项目配置抽屉。 */
|
||
const openProjectSettings = inject(projectSettingsOpenKey, undefined)
|
||
/** 从批量抽屉交接到提示弹窗时绑定当前项目。 */
|
||
const pendingModelProject = ref('')
|
||
/** 提示关闭后才打开现有配置抽屉,避免焦点叠加。 */
|
||
const pendingConfigProject = ref('')
|
||
/** 批量生图同样等待真实配置读取,读取失败不能当作尚未配置。 */
|
||
const modelQueryBlocked = computed(
|
||
() => !profileQuery.data.value || profileQuery.loading.value || !!profileQuery.error.value
|
||
)
|
||
/**
|
||
* 共用的生图前置检查,仅缺少配置时显示引导,不默认接受费用。
|
||
* @returns 是否可以继续打开生成参数或费用确认
|
||
*/
|
||
function ensureGenerationProfile(): boolean {
|
||
if (blocked.value || modelQueryBlocked.value) return false
|
||
if (hasCreativeProfile.value) return true
|
||
if (toolsOpen.value) {
|
||
pendingModelProject.value = projectId.value
|
||
toolsOpen.value = false
|
||
} else modelPromptOpen.value = true
|
||
return false
|
||
}
|
||
/**
|
||
* 单主体共用生图入口,先检查配置,再显示原有生成表单。
|
||
* @param target 当前用户选择的图片生成类型
|
||
*/
|
||
function requestImage(target: 'image' | 'casting' | 'quality') {
|
||
if (!(target === 'casting' ? canRequestCandidate.value : canRequestImage.value) || !ensureGenerationProfile())
|
||
return
|
||
if (target === 'casting') castingOpen.value = true
|
||
else if (target === 'quality') qualityOpen.value = true
|
||
else imageOpen.value = true
|
||
}
|
||
/** 用户主动前往配置,先关闭当前提示,原操作不会自动恢复执行。 */
|
||
function requestProjectConfig() {
|
||
pendingConfigProject.value = projectId.value
|
||
modelPromptOpen.value = false
|
||
}
|
||
/** 提示完全离场后交给右上角同一个项目配置抽屉。 */
|
||
function finishModelPrompt() {
|
||
const id = pendingConfigProject.value
|
||
pendingConfigProject.value = ''
|
||
if (id && id === projectId.value) openProjectSettings?.('generation')
|
||
}
|
||
/** 切项目时废弃旧的配置交接。 */
|
||
watch(projectId, () => {
|
||
modelPromptOpen.value = false
|
||
pendingModelProject.value = ''
|
||
pendingConfigProject.value = ''
|
||
})
|
||
/** 角色卡片的切换目标,等抽屉离场后再交给详情页处理草稿确认。 */
|
||
const overviewSelection = ref('')
|
||
/**
|
||
* 点击角色卡片时先关闭抽屉,点击当前角色也会关闭。
|
||
* @param id 需要查看的角色主体编号
|
||
*/
|
||
function selectFromOverview(id: string) {
|
||
overviewSelection.value = id
|
||
toolsOpen.value = false
|
||
}
|
||
/** 抽屉关闭后显示目标角色,清除可能隐藏该角色的目录筛选并保留草稿确认。 */
|
||
function finishOverviewSelection() {
|
||
if (pendingModelProject.value) {
|
||
const project = pendingModelProject.value
|
||
pendingModelProject.value = ''
|
||
if (project === projectId.value) modelPromptOpen.value = true
|
||
}
|
||
const id = overviewSelection.value
|
||
overviewSelection.value = ''
|
||
if (!subjects.value.some(item => item.id === id && item.module === 'character')) return
|
||
module.value = 'character'
|
||
search.value = ''
|
||
select(id)
|
||
}
|
||
watch(
|
||
() => session.value.receipt,
|
||
receipt => {
|
||
if (receipt) {
|
||
toolsOpen.value = true
|
||
}
|
||
}
|
||
)
|
||
/** 批量表单只校验同时处理数量与每批图片处理数量,不改变真实请求字段。 */
|
||
const formModel = computed(() => ({ concurrency: concurrency.value, candidateLimit: candidateLimit.value }))
|
||
/** 校验提示与批量参数的可见名称保持一致。 */
|
||
const rules = { concurrency: integerRule('同时处理数量'), candidateLimit: integerRule('每批图片数量上限') }
|
||
|
||
type IdentityFlowAction = 'style' | 'profile' | 'identity' | 'candidate' | 'confirm' | 'lock' | 'forms'
|
||
const primaryCandidate = computed(() =>
|
||
images.value.find(image => image.viewType === 'primary' && image.status === 'completed' && image.imageUrl)
|
||
)
|
||
/**
|
||
* Scene / Prop 的 primary 完成图本身即可进入确认母版阶段。
|
||
* Character 仍以正式 Anchor / Casting 状态为准。
|
||
*/
|
||
const referenceImageReady = computed(() =>
|
||
subject.value?.module === 'character' ? !!anchor.value || !!primaryCandidate.value : !!primaryCandidate.value
|
||
)
|
||
const identityTextReady = computed(() => !!identity.value?.generationPrompt?.trim())
|
||
const candidateReady = computed(() => referenceImageReady.value)
|
||
const identityReady = computed(() => !!anchor.value && !!identity.value?.isLocked)
|
||
const identityFlow = computed(() => {
|
||
const character = subject.value?.module === 'character'
|
||
return [
|
||
{ label: '身份文本', done: identityTextReady.value },
|
||
{ label: character ? '角色候选图' : '身份参考图', done: candidateReady.value },
|
||
{ label: '确认并锁定', done: identityReady.value }
|
||
]
|
||
})
|
||
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 {
|
||
action: 'style',
|
||
title: '先设置视觉风格',
|
||
description: '身份生成需要项目视觉风格。',
|
||
label: '设置视觉风格'
|
||
}
|
||
if (!hasCreativeProfile.value)
|
||
return {
|
||
action: 'profile',
|
||
title: '先配置生成模型',
|
||
description: '请点击右上角“项目配置”,选择图片与视频模型后再生成身份图。',
|
||
label: '配置生成模型'
|
||
}
|
||
if (!identityTextReady.value)
|
||
return {
|
||
action: 'identity',
|
||
title: '第 1 步:生成身份文本',
|
||
description: 'AI 填写下方身份描述和核心提示词,生成后会保存到项目。',
|
||
label: 'AI 生成主体身份'
|
||
}
|
||
if (!candidateReady.value)
|
||
return subject.value?.module === 'character'
|
||
? {
|
||
action: 'candidate',
|
||
title: '第 2 步:生成角色候选图',
|
||
description: 'AI 根据身份文本生成角色外观图片,选定一张作为角色母版,用于后续图片生成。',
|
||
label: 'AI 生成角色候选图'
|
||
}
|
||
: {
|
||
action: 'candidate',
|
||
title: '第 2 步:生成身份参考图',
|
||
description: '生成一张可选为母版的参考图。',
|
||
label: '生成身份参考图'
|
||
}
|
||
if (anchor.value && !identity.value?.isLocked)
|
||
return {
|
||
action: 'lock',
|
||
title: '第 3 步:锁定身份',
|
||
description: '勾选锁定并保存,后续生成才会稳定引用当前母版。',
|
||
label: '前往锁定'
|
||
}
|
||
if (!identityReady.value)
|
||
return {
|
||
action: 'confirm',
|
||
title: '第 3 步:确认并锁定',
|
||
description:
|
||
'在下方图片卡片中确认母版;其他图片可通过“管理候选”查看。人物会同时锁定,场景和道具还需保存锁定状态。',
|
||
label: '查看候选并确认'
|
||
}
|
||
return {
|
||
action: 'forms',
|
||
title: '主体身份已完成',
|
||
description: subjectImagesAccess.value.enabled
|
||
? '可以继续生成此主体的形态图片。'
|
||
: `${subjectImagesAccess.value.reason},完成项目准备后可进入形态图片。`,
|
||
label: '查看形态图片'
|
||
}
|
||
})
|
||
|
||
/** 下一步引导定位单张图片或打开多候选管理,形态图片跳转遵守项目准入规则。 */
|
||
function runNextAction() {
|
||
if (nextAction.value.action === 'style') void router.push(`/projects/${projectId.value}/visual-style`)
|
||
else if (nextAction.value.action === 'candidate') {
|
||
requestImage(subject.value?.module === 'character' ? 'casting' : 'image')
|
||
} else if (nextAction.value.action === 'confirm') {
|
||
document.querySelector('#identity-reference-gallery')?.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||
} else if (nextAction.value.action === 'lock') {
|
||
document.querySelector('#identity-lock')?.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||
} else if (nextAction.value.action === 'forms' && subjectImagesAccess.value.enabled) {
|
||
void router.push({
|
||
path: `/projects/${projectId.value}/subject-images`,
|
||
query: { subjectRef: subject.value?.ref }
|
||
})
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<!-- 以下是项目已读取但正式主体目录尚未返回时的完整骨架屏模块 -->
|
||
<SubjectIdentitySkeleton v-if="initialLoading" />
|
||
<WorkspacePage v-else split compact mobile-scroll class="identity-workspace-page">
|
||
<template #header>
|
||
<!-- 以下是类型筛选、主体数量与操作入口 -->
|
||
<div class="workspace-toolbar">
|
||
<div class="toolbar-type-filter">
|
||
<NSelect
|
||
aria-label="身份主体类型"
|
||
v-model:value="module"
|
||
:options="[
|
||
{ label: String('全部类型'), value: 'all' },
|
||
{ label: String('人物'), value: 'character' },
|
||
{ label: String('场景'), value: 'scene' },
|
||
{ label: String('道具'), value: 'prop' }
|
||
]"
|
||
></NSelect>
|
||
</div>
|
||
<span class="toolbar-summary">共 {{ subjects.length }} 个主体</span>
|
||
<div class="toolbar-actions">
|
||
<WorkspaceTools
|
||
:pending="operation.pending"
|
||
:pending-label="operation.label"
|
||
v-model:open="toolsOpen"
|
||
title="角色选角与批量生成"
|
||
fullscreen
|
||
:has-receipt="!!session.receipt"
|
||
@closed="finishOverviewSelection"
|
||
>
|
||
<!-- 以下是主体身份说明与选角批量操作模块 -->
|
||
<div class="workspace-overview-panel">
|
||
<div class="overview-content workspace-section-stack dialog-flat-stack">
|
||
<ContextNotice type="info" :show-icon="false" class="text-xs">
|
||
先保存人物、场景或道具的固定特征,再生成参考图。确认并锁定的标准参考图称为“身份母版”,后续制作会以它保持外观一致。
|
||
</ContextNotice>
|
||
<ContextNotice v-if="styleQuery.data.value && !hasStyle" type="info" :show-icon="false">
|
||
请先在“视觉风格”页面保存项目风格,再生成身份描述或参考图。</ContextNotice
|
||
>
|
||
<!-- 以下是人物选角进度、批量参数与角色详情入口模块 -->
|
||
<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">
|
||
补齐身份描述 → 生成候选图 →
|
||
进入角色详情确认选角。候选图根据当前描述独立生成,不参考旧母版;确认后才设为母版并锁定身份。
|
||
</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-36" 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-36" 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
|
||
:loading="isOperationRunning(operation, '批量生成角色身份文本')"
|
||
:label="force ? '重新生成角色身份描述' : '补齐角色身份描述'"
|
||
:disabled="
|
||
blocked ||
|
||
!hasStyle ||
|
||
!batchValid ||
|
||
!candidateLimitValid ||
|
||
dirty ||
|
||
!casting.total
|
||
"
|
||
acknowledgement
|
||
description="处理本项目的人物身份描述与提示词,不生成图片,也不受每批图片数量上限限制。已锁定角色会跳过;勾选重新生成后会覆盖未锁定角色的已有描述,但不会更新已有图片。可能产生 AI 生成费用。"
|
||
@confirm="generateProject(true)"
|
||
/>
|
||
<ConfirmAction
|
||
:loading="isOperationRunning(operation, '批量生成角色选角候选')"
|
||
label="批量生成角色候选图"
|
||
:before-open="ensureGenerationProfile"
|
||
:disabled="
|
||
castingBlocked ||
|
||
modelQueryBlocked ||
|
||
!hasStyle ||
|
||
!batchValid ||
|
||
!candidateLimitValid ||
|
||
!casting.missingAnchor
|
||
"
|
||
acknowledgement
|
||
:description="`最多为 ${candidateLimit} 个缺少候选图的人物角色各生成一张候选图,可能产生费用。已有候选图或母版的角色会跳过;生成后仍需进入角色详情确认选角。`"
|
||
@confirm="generateCastingCandidates"
|
||
/>
|
||
</div>
|
||
</AppForm>
|
||
<p class="mt-2 text-xs leading-6 text-muted">
|
||
同时处理数量适用于所有批量生成;每批图片数量上限仅限制角色候选图、场景和道具母版的处理数量。重新生成选项仅影响身份描述,不影响图片。
|
||
</p>
|
||
<p class="mt-2 text-xs leading-6 text-muted">
|
||
未注明人物背景时,AI
|
||
默认采用中国人物特征;剧本和角色设定优先。点击下方角色可关闭此界面并查看详情,不会确认或更改选角。
|
||
</p>
|
||
<div class="casting-list" role="group" aria-label="角色选角进度">
|
||
<NButton
|
||
v-for="item in casting.items"
|
||
:key="item.subjectId"
|
||
@click="selectFromOverview(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
|
||
:loading="isOperationRunning(operation, '批量生成场景身份母版')"
|
||
label="生成场景母版"
|
||
:before-open="ensureGenerationProfile"
|
||
:disabled="
|
||
blocked ||
|
||
modelQueryBlocked ||
|
||
!hasStyle ||
|
||
!batchValid ||
|
||
!candidateLimitValid ||
|
||
dirty ||
|
||
!subjects.length
|
||
"
|
||
acknowledgement
|
||
:description="`最多处理 ${candidateLimit} 个场景,可能产生图片生成与质量校验费用。通过校验后自动设为母版并锁定,可能替换尚未锁定的已有母版;已锁定且有有效母版的场景会跳过。`"
|
||
@confirm="generateStableAnchors('scene')"
|
||
/>
|
||
<ConfirmAction
|
||
:loading="isOperationRunning(operation, '批量生成道具身份母版')"
|
||
label="生成道具母版"
|
||
:before-open="ensureGenerationProfile"
|
||
:disabled="
|
||
blocked ||
|
||
modelQueryBlocked ||
|
||
!hasStyle ||
|
||
!batchValid ||
|
||
dirty ||
|
||
!subjects.length
|
||
"
|
||
acknowledgement
|
||
:description="`最多处理 ${candidateLimit} 个道具,可能产生图片生成与质量校验费用。通过校验后自动设为母版并锁定,可能替换尚未锁定的已有母版;已锁定且有有效母版的道具会跳过。`"
|
||
@confirm="generateStableAnchors('prop')"
|
||
/>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
<!-- 以下是默认收起、按所选类型生成身份描述的高级模块 -->
|
||
<NCollapse class="workspace-panel"
|
||
><NCollapseItem name="details"
|
||
><template #header>高级:按类型批量生成身份描述</template>
|
||
<p class="mt-3 text-xs leading-6 text-muted">
|
||
按所选类型处理身份描述与提示词,不生成图片。沿用上方的同时处理数量和重新生成选项,已锁定身份会跳过,不受每批图片数量上限限制。
|
||
</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 ? '重新生成' : '补齐'}${identityBatchScopeLabel}身份描述`"
|
||
:disabled="blocked || !hasStyle || !batchValid || dirty || !subjects.length"
|
||
acknowledgement
|
||
:description="`处理本项目的${identityBatchScopeLabel}身份描述与提示词,不生成图片,已锁定身份会跳过。${force ? '将覆盖未锁定主体的已有描述' : '仅补齐缺失的描述或提示词'},不会自动更新已有身份图、形态图、首帧或视频。可能产生 AI 生成费用。`"
|
||
@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>
|
||
<ContextNotice
|
||
v-if="session.receipt.result.failed"
|
||
role="alert"
|
||
type="error"
|
||
:show-icon="false"
|
||
class="mt-3"
|
||
>
|
||
部分生成未完成,已成功的结果会保留。请查看下方原因后再重试。
|
||
</ContextNotice>
|
||
<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 }}:{{ userFacingText(failure.error) }}
|
||
</li>
|
||
</ul>
|
||
<p class="mt-3 text-[11px] text-muted">
|
||
回执仅保留于当前浏览器会话;最终状态以刷新后的正式记录为准。
|
||
</p>
|
||
</section>
|
||
</div>
|
||
</div>
|
||
</WorkspaceTools>
|
||
</div>
|
||
</div></template
|
||
>
|
||
<NScrollbar
|
||
class="workspace-feedback"
|
||
v-if="catalog.error.value || styleQuery.error.value || castingQuery.error.value"
|
||
><ContextNotice 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
|
||
>
|
||
</ContextNotice></NScrollbar
|
||
>
|
||
<div v-if="subjects.length" class="identity-workspace-region">
|
||
<!-- 以下是与分镜一致的融合工作区模块,目录与详情共用外层背景。 -->
|
||
<div class="panel workspace-surface directory-workspace identity-workspace">
|
||
<!-- 以下是主体目录模块,标题和搜索固定,条目通过独立滚动容器浏览。 -->
|
||
<nav class="directory-panel identity-directory" aria-label="主体目录">
|
||
<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
|
||
>
|
||
<p v-if="!filtered.length" class="py-6 text-xs text-muted">没有匹配主体,请调整筛选。</p>
|
||
</div>
|
||
</NScrollbar>
|
||
</nav>
|
||
<!-- 以下是主体详情模块,滚动和内边距由公共工作区布局统一管理。 -->
|
||
<article class="directory-workspace-detail identity-detail" aria-label="主体身份详情">
|
||
<NScrollbar
|
||
ref="identityDetailScrollbar"
|
||
class="panel-scroll"
|
||
content-class="directory-workspace-content identity-detail-content"
|
||
>
|
||
<ContextNotice 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></ContextNotice
|
||
>
|
||
<section v-if="subject" ref="identityContentRoot" class="identity-subject-content">
|
||
<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>
|
||
<ContextNotice
|
||
v-if="detail.error.value"
|
||
role="alert"
|
||
type="error"
|
||
:show-icon="false"
|
||
class="mt-4"
|
||
>{{ detail.error.value }} 查询失败时不允许生成或覆盖。
|
||
</ContextNotice>
|
||
<!-- 以下是切换主体时的局部骨架模块,保留真实主体名称与目录 -->
|
||
<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 v-if="nextAction.action !== 'profile'" 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
|
||
:saving="isOperationRunning(operation, '保存主体身份')"
|
||
:key="`${selectedId}:${editorRevision}`"
|
||
:identity="identity"
|
||
:module="subject.module"
|
||
:disabled="detailBlocked"
|
||
@save="save"
|
||
@dirty="dirty = $event"
|
||
>
|
||
<!-- 以下是唯一的单主体 AI 文本生成入口,覆盖已有文本时沿用确认弹窗 -->
|
||
<template #generate>
|
||
<ConfirmAction
|
||
:loading="isOperationRunning(operation, 'AI 生成主体身份')"
|
||
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>
|
||
<IdentityGallery
|
||
id="identity-reference-gallery"
|
||
ref="identityGallery"
|
||
: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"
|
||
:retry-disabled-reason="imageRetryDisabledReason"
|
||
@validate="validateImage"
|
||
@anchor="chooseAnchor"
|
||
@regenerate="retryIdentityImage"
|
||
>
|
||
<!-- 以下是母版卡片底部的生成入口模块,单张候选直接展示,多张候选在弹窗中管理 -->
|
||
<template #actions>
|
||
<NButton
|
||
v-if="subject.module === 'scene' || subject.module === 'prop'"
|
||
:disabled="!canRequestImage"
|
||
@click="requestImage('quality')"
|
||
>生成稳定母版并校验质量</NButton
|
||
>
|
||
<NButton
|
||
v-if="subject.module === 'character'"
|
||
:disabled="!canRequestCandidate"
|
||
@click="requestImage('casting')"
|
||
>{{ anchor ? '再生成一张候选' : 'AI 生成角色候选图' }}</NButton
|
||
>
|
||
<NButton :disabled="!canRequestImage" @click="requestImage('image')">
|
||
{{
|
||
subject.module === 'character'
|
||
? '生成辅助参考图'
|
||
: anchor
|
||
? '再生成一张候选'
|
||
: '生成母版候选'
|
||
}}
|
||
</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">
|
||
这个角色还没有正式形态,可以先完善角色特征并选择外观。
|
||
</p>
|
||
<RouterLink
|
||
v-if="subjectImagesAccess.enabled"
|
||
:to="{
|
||
path: `/projects/${projectId}/subject-images`,
|
||
query: { subjectRef: subject.ref }
|
||
}"
|
||
class="text-button justify-self-start"
|
||
>查看此主体形态图片 →</RouterLink
|
||
>
|
||
</div>
|
||
</section>
|
||
</NScrollbar>
|
||
</article>
|
||
</div>
|
||
</div>
|
||
<EmptyState
|
||
v-else-if="catalog.data.value"
|
||
title="还没有可展示的正式主体"
|
||
description="先完成剧本拆解与主体形态持久化,再来管理稳定身份。" />
|
||
<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"
|
||
:subject-id="subject.id"
|
||
:subject-name="subject.name"
|
||
:module="subject.module"
|
||
:initial-view-type="retryImageView"
|
||
:images="images"
|
||
:catalog="generationModelsQuery.data.value"
|
||
:profile="profileQuery.data.value.profile"
|
||
:disabled="!canGenerateImage"
|
||
@generate="submitIdentityImage" />
|
||
<CastingCandidateDialog
|
||
v-if="
|
||
subject?.module === 'character' && profileQuery.data.value?.profile && generationModelsQuery.data.value
|
||
"
|
||
v-model:open="castingOpen"
|
||
:subject-id="subject.id"
|
||
:subject-name="subject.name"
|
||
:catalog="generationModelsQuery.data.value"
|
||
:profile="profileQuery.data.value.profile"
|
||
:disabled="!canGenerateCandidate"
|
||
@generate="submitCastingCandidate"
|
||
/></WorkspacePage>
|
||
<!-- 以下是点击生图时才展示的模型配置引导,关闭后交给唯一项目配置抽屉 -->
|
||
<AppDialog v-model:open="modelPromptOpen" title="需要配置生成模型" status="warning" @closed="finishModelPrompt">
|
||
<!-- 以下是独立于标题的配置引导正文,沿用公共弹窗内容与底栏间距 -->
|
||
<p class="text-sm leading-7 text-muted">
|
||
请在右上角“项目配置”中选择图片与视频模型。配置保存后,请重新点击需要的生成操作;本次尚未生成,也未产生费用。
|
||
</p>
|
||
<template #footer>
|
||
<NButton @click="modelPromptOpen = false">取消</NButton>
|
||
<NButton type="primary" :disabled="!openProjectSettings" @click="requestProjectConfig"
|
||
>前往项目配置</NButton
|
||
>
|
||
</template>
|
||
</AppDialog>
|
||
</template>
|
||
|
||
<style>
|
||
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
||
@reference "../../styles/styles.css";
|
||
/* 主体目录根节点只用于定位,保留桌面纵向和手机横向的自然布局。 */
|
||
.identity-directory-items {
|
||
display: contents;
|
||
}
|
||
/* 目录由可用工作区高度约束,标题与搜索之外的空间供列表独立滚动。 */
|
||
.identity-subject-list {
|
||
@apply min-h-0 flex-1 overflow-hidden;
|
||
}
|
||
.casting-stats {
|
||
@apply grid grid-cols-[repeat(5,_minmax(0,_1fr))] gap-2.5;
|
||
}
|
||
.casting-stats div {
|
||
@apply py-2.5 px-3 rounded-none bg-(--app-subtle);
|
||
}
|
||
.casting-stats dt {
|
||
@apply text-muted text-[10px];
|
||
}
|
||
.casting-stats dd {
|
||
@apply mt-[5px] font-mono text-[13px];
|
||
}
|
||
@media (max-width: 900px) {
|
||
.casting-stats {
|
||
@apply grid-cols-[repeat(2,_minmax(0,_1fr))];
|
||
}
|
||
}
|
||
.identity-workspace-page {
|
||
container: identity-header / inline-size;
|
||
}
|
||
.identity-prerequisite {
|
||
@apply shrink-0 mx-0 mb-3;
|
||
}
|
||
/* 目录与详情占满工作区,图片生成状态统一由图库展示。 */
|
||
.identity-workspace-region {
|
||
@apply flex flex-col flex-1 min-h-0 overflow-hidden;
|
||
}
|
||
.identity-flow {
|
||
/* 步骤、下一步说明与上下方标题和字段共用面板边界,避免二次缩进。 */
|
||
@apply mt-5;
|
||
}
|
||
.identity-flow-steps {
|
||
@apply flex flex-wrap items-center gap-x-6 gap-y-2;
|
||
}
|
||
.identity-flow-steps li {
|
||
@apply flex items-center gap-2 text-xs text-muted;
|
||
}
|
||
.identity-flow-steps li.current {
|
||
@apply text-accent font-semibold;
|
||
}
|
||
.identity-flow-steps li.done {
|
||
@apply text-muted;
|
||
}
|
||
.identity-flow-marker {
|
||
@apply grid place-items-center w-5 h-5 rounded-full border border-(--app-border);
|
||
}
|
||
.identity-flow-steps li.done .identity-flow-marker,
|
||
.identity-flow-steps li.current .identity-flow-marker {
|
||
@apply border-(--app-accent) text-accent;
|
||
}
|
||
.identity-next-action {
|
||
@apply mt-4 pt-4 flex items-center justify-between gap-4;
|
||
border-top: 1px solid var(--app-border);
|
||
}
|
||
.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;
|
||
}
|
||
.toolbar-type-filter .n-select {
|
||
@apply w-full min-w-0;
|
||
}
|
||
.directory-filters {
|
||
@apply grid gap-3 p-3 shrink-0;
|
||
}
|
||
.directory-filters > * {
|
||
@apply min-w-0;
|
||
}
|
||
.identity-subject-list-content {
|
||
@apply gap-0.5 pt-0 px-0 pb-2;
|
||
}
|
||
/* 目录条目沿用分镜公共底色与选中反馈,仅调整缩略图所需间距。 */
|
||
.n-button.identity-subject-item {
|
||
@apply min-h-[86px] py-2.5 px-3.5;
|
||
}
|
||
.identity-subject-item .directory-item-body {
|
||
@apply gap-[3px];
|
||
}
|
||
.identity-subject-item .directory-item-title {
|
||
@apply order-0 text-sm font-semibold;
|
||
}
|
||
.identity-subject-item .directory-item-eyebrow {
|
||
@apply order-1 text-[10px];
|
||
}
|
||
.identity-subject-item .directory-item-meta {
|
||
@apply order-2 gap-y-1 gap-x-1.5 text-[10px];
|
||
}
|
||
.casting-list {
|
||
@apply grid grid-cols-[repeat(auto-fit,_minmax(min(100%,_260px),_1fr))] gap-3 mt-6 pt-5;
|
||
}
|
||
.n-button.casting-item {
|
||
@apply w-full min-w-0 h-auto min-h-[76px] py-3 px-3.5 whitespace-normal text-left bg-(--app-subtle);
|
||
}
|
||
.n-button.casting-item.selected {
|
||
@apply bg-(--app-selected) shadow-[inset_3px_0_0_var(--app-accent)];
|
||
}
|
||
.n-button.casting-item .n-button__content {
|
||
@apply flex w-full min-w-0 items-center justify-between gap-4 text-left;
|
||
}
|
||
.casting-item-identity {
|
||
@apply flex flex-col gap-[5px] min-w-0;
|
||
}
|
||
.casting-item-name {
|
||
@apply text-sm font-medium leading-normal wrap-anywhere;
|
||
}
|
||
.casting-item-ref {
|
||
@apply text-muted font-mono text-[11px] leading-normal wrap-anywhere;
|
||
}
|
||
.casting-item-status {
|
||
@apply shrink-0;
|
||
}
|
||
@media (max-width: 760px) {
|
||
/* 主体详情自然撑高,提示与主体导航随正文滚走;顶部两行保留固定。 */
|
||
.identity-workspace-page .identity-workspace-region {
|
||
height: auto;
|
||
flex: none;
|
||
overflow: visible;
|
||
}
|
||
.identity-next-action {
|
||
@apply items-start flex-col;
|
||
}
|
||
.identity-next-action > .n-button {
|
||
@apply w-full;
|
||
}
|
||
.identity-directory {
|
||
@apply h-auto;
|
||
}
|
||
.identity-subject-list {
|
||
@apply flex-none h-auto max-h-none;
|
||
}
|
||
.identity-directory .identity-subject-list.n-scrollbar,
|
||
.identity-directory .identity-subject-list .n-scrollbar-container,
|
||
.identity-directory .identity-subject-list .n-scrollbar-content {
|
||
@apply h-auto;
|
||
}
|
||
.directory-filters {
|
||
@apply grid-cols-[minmax(0,_1fr)];
|
||
}
|
||
}
|
||
/* 窄内容区去掉数量文案,操作入口收成图标与类型筛选同一行。 */
|
||
@container identity-header (max-width: 760px) {
|
||
.identity-workspace-page .workspace-toolbar {
|
||
@apply flex-nowrap gap-2;
|
||
}
|
||
.toolbar-type-filter {
|
||
@apply w-auto min-w-[120px] flex-1;
|
||
}
|
||
.identity-workspace-page .toolbar-summary {
|
||
@apply hidden;
|
||
}
|
||
.identity-workspace-page .toolbar-actions {
|
||
@apply ml-0 shrink-0;
|
||
}
|
||
.identity-workspace-page .workspace-tools-label,
|
||
.identity-workspace-page .workspace-tools-trigger .text-muted {
|
||
@apply hidden;
|
||
}
|
||
.identity-workspace-page .workspace-tools-trigger {
|
||
@apply h-[34px] w-[34px] p-0;
|
||
min-width: 34px;
|
||
}
|
||
.identity-workspace-page .workspace-tools-trigger .n-button__icon {
|
||
@apply m-0;
|
||
}
|
||
}
|
||
</style>
|