diff --git a/src/components/ui/AppDialog.vue b/src/components/ui/AppDialog.vue index 4c320d9..4757256 100644 --- a/src/components/ui/AppDialog.vue +++ b/src/components/ui/AppDialog.vue @@ -1,5 +1,6 @@ - - diff --git a/src/features/subject-identity/SubjectIdentityPage.vue b/src/features/subject-identity/SubjectIdentityPage.vue index 5648201..d76460a 100644 --- a/src/features/subject-identity/SubjectIdentityPage.vue +++ b/src/features/subject-identity/SubjectIdentityPage.vue @@ -22,10 +22,11 @@ import { NTag, type ScrollbarInst } from 'naive-ui' -import { computed, ref, watch } from 'vue' +import { computed, inject, ref, watch } from 'vue' import { useRoute, useRouter, type LocationQueryRaw } from 'vue-router' import { Check, Circle, UserCheck } from '@lucide/vue' -import { DirectoryItem, EmptyState, StatusBadge } from '../../components/ui' +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' @@ -74,6 +75,8 @@ const { canGenerateText, canGenerateImage, canGenerateCandidate, + canRequestImage, + canRequestCandidate, activeIdentityGeneration, batchValid, candidateLimitValid, @@ -294,6 +297,59 @@ function retryIdentityImage(imageId: string) { } /** 批量操作抽屉显隐状态,新回执到达时自动打开以展示结果。 */ 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('') /** @@ -306,6 +362,11 @@ function selectFromOverview(id: string) { } /** 抽屉关闭后显示目标角色,清除可能隐藏该角色的目录筛选并保留草稿确认。 */ 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 @@ -365,7 +426,7 @@ const nextAction = computed<{ action: IdentityFlowAction; title: string; descrip return { action: 'profile', title: '先配置生成模型', - description: '选择项目图片与视频模型后才能生图。', + description: '请点击右上角“项目配置”,选择图片与视频模型后再生成身份图。', label: '配置生成模型' } if (!identityTextReady.value) @@ -414,18 +475,11 @@ const nextAction = computed<{ action: IdentityFlowAction; title: string; descrip } }) -/** 原配置恢复入口打开标题栏共用的全局配置弹窗。 */ -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 === 'candidate') { - if (subject.value?.module === 'character') castingOpen.value = true - else imageOpen.value = true + 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') { @@ -568,8 +622,10 @@ function runNextAction() { - -
- 需要先配置项目生成模型,否则身份图和选角候选无法生成。 - 立即配置 -
-
@@ -866,7 +919,7 @@ function runNextAction() { {{ index + 1 }}. {{ step.label }} -
+
{{ nextAction.title }}

{{ nextAction.description }}

@@ -938,17 +991,17 @@ function runNextAction() {