feat(short-drama-agent-front): 支持母版复用并优化生成交互
This commit is contained in:
1 parent
49fb9c7a27
commit
ee5e49957a
28 files changed
+634
-326
No files matched your search
@@ -90,16 +90,6 @@ const {
|
||||
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} 的身份图片正在生成,刷新页面不会重复提交,请等待当前任务完成。`
|
||||
}
|
||||
return null
|
||||
})
|
||||
/** 首次读取目录才替换整页,刷新已有主体时保留选择与阅读位置。 */
|
||||
const initialLoading = computed(() => catalog.loading.value && !catalog.data.value)
|
||||
/** 切换主体时只替换尚未返回的详情,不遮挡已读取的主体目录。 */
|
||||
@@ -220,21 +210,42 @@ function exportReceipt() {
|
||||
downloadText('subject-identities-receipt.json', JSON.stringify(session.value.receipt, null, 2), 'application/json')
|
||||
}
|
||||
|
||||
/** Character 使用确认选角事务;Scene / Prop 保留普通母版切换。 */
|
||||
/**
|
||||
* 前置校验通过并开始提交时关闭原主体弹窗,后续状态通过消息反馈。
|
||||
* @param input 已确认的身份图生成参数
|
||||
* @returns 提交与详情刷新完成
|
||||
*/
|
||||
async function submitIdentityImage(input: Parameters<typeof generateImage>[0]) {
|
||||
await generateImage(input)
|
||||
if (!operation.value.error) imageOpen.value = false
|
||||
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]) {
|
||||
await generateCastingCandidate(input)
|
||||
if (!operation.value.error) castingOpen.value = false
|
||||
const targetId = selectedId.value
|
||||
await generateCastingCandidate(input, () => {
|
||||
if (selectedId.value === targetId) castingOpen.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** Character 使用确认选角事务;Scene / Prop 保留普通母版切换。 */
|
||||
/**
|
||||
* 按主体类型确认母版,成功后关闭原主体的管理弹窗。
|
||||
* @param imageId 用户明确选择的图片编号
|
||||
*/
|
||||
function chooseAnchor(imageId: string) {
|
||||
if (subject.value?.module === 'character') void confirmCasting(imageId)
|
||||
else void confirmStableAnchor(imageId)
|
||||
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(() => {
|
||||
@@ -356,8 +367,9 @@ const nextAction = computed<{ action: IdentityFlowAction; title: string; descrip
|
||||
return {
|
||||
action: 'confirm',
|
||||
title: '第 3 步:确认并锁定',
|
||||
description: '在“管理候选”弹窗中确认母版;人物会同时锁定,场景和道具还需保存锁定状态。',
|
||||
label: '管理候选并确认'
|
||||
description:
|
||||
'在下方图片卡片中确认母版;其他图片可通过“管理候选”查看。人物会同时锁定,场景和道具还需保存锁定状态。',
|
||||
label: '查看候选并确认'
|
||||
}
|
||||
return {
|
||||
action: 'forms',
|
||||
@@ -374,7 +386,7 @@ 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()
|
||||
@@ -382,7 +394,7 @@ function runNextAction() {
|
||||
if (subject.value?.module === 'character') castingOpen.value = true
|
||||
else imageOpen.value = true
|
||||
} else if (nextAction.value.action === 'confirm') {
|
||||
identityGallery.value?.openCandidates()
|
||||
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) {
|
||||
@@ -720,19 +732,6 @@ function runNextAction() {
|
||||
</div>
|
||||
</NAlert>
|
||||
<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
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
<!-- 以下是与分镜一致的融合工作区模块,目录与详情共用外层背景。 -->
|
||||
<div class="panel workspace-surface directory-workspace identity-workspace">
|
||||
<!-- 以下是主体目录模块,标题和搜索固定,条目通过独立滚动容器浏览。 -->
|
||||
@@ -900,7 +899,7 @@ function runNextAction() {
|
||||
@anchor="chooseAnchor"
|
||||
@regenerate="retryIdentityImage"
|
||||
>
|
||||
<!-- 以下是母版卡片底部的生成入口模块,候选在独立弹窗中管理 -->
|
||||
<!-- 以下是母版卡片底部的生成入口模块,单张候选直接展示,多张候选在弹窗中管理 -->
|
||||
<template #actions>
|
||||
<NButton
|
||||
v-if="subject.module === 'scene' || subject.module === 'prop'"
|
||||
@@ -1034,40 +1033,10 @@ 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 mt-5;
|
||||
|
||||
Reference in new issue
Block a user