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
@@ -14,7 +14,6 @@ import { useActionMessage } from '../../components/ui/useActionMessage'
|
||||
import { productionMessage } from '../production/production-messages'
|
||||
import ProjectSettingsDialog from '../generation-config/components/ProjectSettingsDialog.vue'
|
||||
import { projectGenerationRevisionKey } from '../generation-config/context'
|
||||
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||
import CreateDramaSkeleton from '../create-drama/CreateDramaSkeleton.vue'
|
||||
import BreakdownSkeleton from '../breakdown/BreakdownSkeleton.vue'
|
||||
import VisualStyleSkeleton from '../visual-style/VisualStyleSkeleton.vue'
|
||||
@@ -114,6 +113,7 @@ type OperationGuide = {
|
||||
action?: string
|
||||
target?: 'profile' | 'style' | 'identity' | 'keyframe'
|
||||
}
|
||||
/** 仅为明确缺失的前置条件提供恢复入口,不把同页生成失败变成无效跳转。 */
|
||||
const operationGuide = computed<OperationGuide | null>(() => {
|
||||
const error = operation.value.error?.trim()
|
||||
if (!error) return null
|
||||
@@ -139,7 +139,11 @@ const operationGuide = computed<OperationGuide | null>(() => {
|
||||
action: '设置视觉风格',
|
||||
target: 'style'
|
||||
}
|
||||
if (error.includes('身份') || normalized.includes('identity'))
|
||||
if (
|
||||
currentSection.value !== 'subject-identity' &&
|
||||
(error.includes('身份') || normalized.includes('identity')) &&
|
||||
/缺少|缺失|未就绪|未锁定|尚未|未确认|missing|not ready|not locked|not found|unconfirmed/i.test(error)
|
||||
)
|
||||
return {
|
||||
title: '主体身份尚未就绪',
|
||||
description: '先按主体身份页的步骤补齐文本、母版并完成锁定。',
|
||||
@@ -151,22 +155,21 @@ const operationGuide = computed<OperationGuide | null>(() => {
|
||||
|
||||
/** 操作结果只在当前项目收到新响应后通知,不在进入工作区时重放旧提示。 */
|
||||
const actionMessage = useActionMessage()
|
||||
/** 分镜、生产和主体身份的操作结果使用临时消息。 */
|
||||
const quietFeedback = computed(() =>
|
||||
['production', 'storyboard', 'subject-identity'].includes(currentSection.value ?? '')
|
||||
)
|
||||
/** 主体身份请求进度使用消息,其余工作区继续展示已有任务进度。 */
|
||||
const inlinePendingFeedback = computed(() => operation.value.pending && currentSection.value !== 'subject-identity')
|
||||
/** 当前身份请求的加载消息,完成或离开工作区后立即销毁。 */
|
||||
/** 当前请求的加载消息,完成或离开工作区后销毁。 */
|
||||
let pendingMessage: MessageReactive | null = null
|
||||
/** 请求开始即反馈,切换主体时保留请求目标名称,避免无反馈的禁用按钮。 */
|
||||
/** 新操作用短消息反馈,页面切换不重放后台任务提示。 */
|
||||
watch(
|
||||
() => [id.value, currentSection.value, operation.value.pending, operation.value.label] as const,
|
||||
([, section, pending, label]) => {
|
||||
([projectId, section, pending, label], [previousId, previousSection, previousPending, previousLabel]) => {
|
||||
pendingMessage?.destroy()
|
||||
pendingMessage = null
|
||||
if (section === 'subject-identity' && pending)
|
||||
pendingMessage = actionMessage?.loading(`${label || '主体身份操作'},请稍候…`, { duration: 0 }) ?? null
|
||||
if (projectId !== previousId || section !== previousSection || !pending) return
|
||||
if (previousPending && label === previousLabel) return
|
||||
pendingMessage =
|
||||
actionMessage?.loading(`${label || '后台任务执行中'},请稍候…`, {
|
||||
duration: section === 'subject-identity' ? 0 : 4000,
|
||||
closable: true
|
||||
}) ?? null
|
||||
}
|
||||
)
|
||||
/** 关闭页面时清理未完成请求的加载消息。 */
|
||||
@@ -176,8 +179,11 @@ watch(
|
||||
() => [id.value, operation.value.error, operation.value.notice] as const,
|
||||
([projectId, error, notice], [previousProject, previousError, previousNotice]) => {
|
||||
if (projectId !== previousProject) return
|
||||
if ((error && error !== previousError) || (notice && notice !== previousNotice)) {
|
||||
pendingMessage?.destroy()
|
||||
pendingMessage = null
|
||||
}
|
||||
if (error && error !== previousError) {
|
||||
if (!quietFeedback.value) return
|
||||
const guide = operationGuide.value
|
||||
const content =
|
||||
currentSection.value === 'subject-identity'
|
||||
@@ -205,7 +211,6 @@ watch(
|
||||
{ duration: 8000, closable: true }
|
||||
)
|
||||
} else if (notice && notice !== previousNotice) {
|
||||
if (!quietFeedback.value) return
|
||||
if (operation.value.noticeType)
|
||||
actionMessage?.[operation.value.noticeType](notice, {
|
||||
duration: operation.value.noticeType === 'warning' ? 8000 : 4000,
|
||||
@@ -278,50 +283,14 @@ onScopeDispose(() => {
|
||||
</template>
|
||||
</NPageHeader>
|
||||
</header>
|
||||
<NScrollbar
|
||||
v-if="
|
||||
context.error.value ||
|
||||
inlinePendingFeedback ||
|
||||
(!quietFeedback && operation.error) ||
|
||||
(!quietFeedback && operation.notice)
|
||||
"
|
||||
class="project-notices"
|
||||
content-class="project-notices-content"
|
||||
>
|
||||
<NScrollbar v-if="context.error.value" class="project-notices" content-class="project-notices-content">
|
||||
<NAlert v-if="context.error.value" type="error" :show-icon="false"
|
||||
>{{ context.error.value }}<span v-if="context.project.value"> 当前保留上次成功读取的数据。</span>
|
||||
<NButton text class="ml-3" :loading="context.loading.value" @click="context.refresh"
|
||||
>重试读取</NButton
|
||||
></NAlert
|
||||
>
|
||||
<NAlert v-if="inlinePendingFeedback" :show-icon="false" role="status"
|
||||
>{{ operation.label || '后台制作任务执行中' }}。可切换页面查看结果,请勿重复提交。</NAlert
|
||||
>
|
||||
<NAlert v-if="operationGuide && !quietFeedback" type="error" :show-icon="false" class="operation-guide">
|
||||
<div class="operation-guide-content">
|
||||
<div>
|
||||
<strong>{{ operationGuide.title }}</strong>
|
||||
<span class="ml-2">{{ operationGuide.description }}</span>
|
||||
</div>
|
||||
<NButton v-if="operationGuide.action" size="small" type="primary" @click="resolveOperationError">{{
|
||||
operationGuide.action
|
||||
}}</NButton>
|
||||
</div>
|
||||
</NAlert>
|
||||
<NAlert v-if="operation.notice && !quietFeedback" :show-icon="false" role="status">{{
|
||||
operation.notice
|
||||
}}</NAlert>
|
||||
</NScrollbar>
|
||||
<WorkflowExecutionPanel
|
||||
v-if="isCreation && createDramaExecution.executionId.value"
|
||||
class="project-workflow-status"
|
||||
title="剧本创作后台任务"
|
||||
:execution="createDramaExecution.query.data.value"
|
||||
:loading="createDramaExecution.query.loading.value"
|
||||
:error="createDramaExecution.query.error.value"
|
||||
@refresh="createDramaExecution.query.refresh"
|
||||
@dismiss="createDramaExecution.dismiss"
|
||||
/>
|
||||
<!-- 以下是当前项目图片与视频配置弹窗模块 -->
|
||||
<ProjectSettingsDialog
|
||||
:key="id"
|
||||
@@ -392,9 +361,6 @@ onScopeDispose(() => {
|
||||
padding: var(--app-content-padding) var(--app-content-padding) 0;
|
||||
gap: var(--app-content-gap);
|
||||
}
|
||||
.project-workflow-status {
|
||||
margin: var(--app-content-gap) var(--app-content-padding) 0;
|
||||
}
|
||||
.operation-guide-content {
|
||||
@apply flex items-center justify-between gap-4;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user