fix(short-drama-agent-front): 优化工作区提示与弹窗布局

This commit is contained in:
GJ committed 2026-10-09 18:31:09 +08:00
1 parent 5b134207b8
commit 72a86171dc
35 files changed
+586 -378

No files matched your search

+109 -102
View File
@@ -4,6 +4,7 @@ import { RouterLink, useRoute } from 'vue-router'
import {
NButton,
NConfigProvider,
NMessageProvider,
NGlobalStyle,
NLayout,
NLayoutHeader,
@@ -28,6 +29,7 @@ import {
Settings2,
X
} from '@lucide/vue'
import ActionMessageProvider from './components/ui/ActionMessageProvider.vue'
import { AppDialog, StudioLogo } from './components/ui'
import { useTheme } from './composables/useTheme'
import ThemeToggle from './components/ui/ThemeToggle.vue'
@@ -172,110 +174,115 @@ const menuOptions = computed<MenuOption[]>(() => {
:date-locale="dateZhCN"
class="app-provider"
>
<NGlobalStyle />
<a href="#main-content" class="skip-link">跳到主要内容</a>
<div
class="admin-layout"
:style="{
'--admin-sider-collapsed': siderCollapsedWidth + 'px',
'--admin-sider-expanded': siderExpandedWidth + 'px'
}"
>
<!-- 以下是主导航侧栏:桌面参与分栏,移动端固定覆盖整个视口。 -->
<aside
id="main-navigation"
class="admin-sider"
:class="{ 'is-collapsed': collapsed }"
:style="{
width: narrow ? '100%' : (collapsed ? siderCollapsedWidth : siderExpandedWidth) + 'px'
}"
aria-label="主导航"
:aria-hidden="narrow && collapsed ? 'true' : undefined"
:inert="narrow && collapsed ? true : undefined"
>
<header class="admin-sider-header">
<!-- 以下是侧栏品牌:桌面折叠裁切文字,移动端始终展示完整品牌。 -->
<RouterLink
to="/projects"
class="admin-brand"
<!-- 以下是全局轻量操作结果提示模块 -->
<NMessageProvider :max="3">
<ActionMessageProvider>
<NGlobalStyle />
<a href="#main-content" class="skip-link">跳到主要内容</a>
<div
class="admin-layout"
:style="{
'--admin-sider-collapsed': siderCollapsedWidth + 'px',
'--admin-sider-expanded': siderExpandedWidth + 'px'
}"
>
<!-- 以下是主导航侧栏:桌面参与分栏,移动端固定覆盖整个视口。 -->
<aside
id="main-navigation"
class="admin-sider"
:class="{ 'is-collapsed': collapsed }"
aria-label="短剧工作台首页"
:style="{
width: narrow ? '100%' : (collapsed ? siderCollapsedWidth : siderExpandedWidth) + 'px'
}"
aria-label="主导航"
:aria-hidden="narrow && collapsed ? 'true' : undefined"
:inert="narrow && collapsed ? true : undefined"
>
<StudioLogo :size="narrow ? 23 : 27" /><span class="admin-brand-copy"
>短剧工作台<small>SHORT DRAMA STUDIO</small></span
>
</RouterLink>
<!-- 移动端全屏侧栏覆盖顶栏,因此在侧栏内部提供明确关闭入口。 -->
<NButton
quaternary
class="icon-button mobile-sider-close"
aria-label="关闭主菜单"
@click="toggleNav"
>
<template #icon><X :size="20" /></template>
</NButton>
</header>
<NScrollbar class="admin-nav-scroll">
<NMenu
:value="route.path"
:options="menuOptions"
:collapsed="menuCollapsed"
:collapsed-width="siderCollapsedWidth"
:icon-size="NAV_ICON_SIZE"
:collapsed-icon-size="NAV_ICON_SIZE"
:indent="navIconIndent"
:root-indent="navIconIndent"
/>
</NScrollbar>
<!-- 底部入口与菜单名称一起显示,图标始终可点击。 -->
<footer class="admin-sider-footer">
<NButton
quaternary
block
class="admin-settings-button"
:class="{ 'is-collapsed': collapsed }"
aria-label="连接设置"
@click="openSettings"
>
<template #icon><Settings2 :size="18" /></template>
<span class="admin-settings-label">连接设置</span>
</NButton>
</footer>
</aside>
<!-- 以下是顶栏与主内容 -->
<NLayout class="admin-main">
<NLayoutHeader class="admin-topbar">
<div class="flex min-w-0 items-center gap-3">
<NButton
quaternary
class="icon-button"
:aria-label="navToggleLabel"
:title="navToggleLabel"
:aria-expanded="!collapsed"
aria-controls="main-navigation"
@click="toggleNav"
>
<template #icon
><component :is="collapsed ? PanelLeftOpen : PanelLeftClose" :size="20"
/></template>
</NButton>
<span class="truncate text-sm">{{ route.meta.title || '工作空间' }}</span>
</div>
<ThemeToggle v-model="preference" />
</NLayoutHeader>
<main id="main-content" tabindex="-1" class="admin-content"><RouterView /></main>
</NLayout>
</div>
<AppDialog v-model:open="settingsOpen" title="连接设置" description="查看当前服务地址。">
<dl class="detail-grid mt-6">
<dt>API 地址</dt>
<dd>
<code>{{ apiBase }}</code>
</dd>
<dt>状态更新</dt>
<dd>制作任务会保存进度;刷新或重新进入页面后可以继续查看。</dd>
</dl>
</AppDialog>
<header class="admin-sider-header">
<!-- 以下是侧栏品牌:桌面折叠裁切文字,移动端始终展示完整品牌。 -->
<RouterLink
to="/projects"
class="admin-brand"
:class="{ 'is-collapsed': collapsed }"
aria-label="短剧工作台首页"
>
<StudioLogo :size="narrow ? 23 : 27" /><span class="admin-brand-copy"
>短剧工作台<small>SHORT DRAMA STUDIO</small></span
>
</RouterLink>
<!-- 移动端全屏侧栏覆盖顶栏,因此在侧栏内部提供明确关闭入口。 -->
<NButton
quaternary
class="icon-button mobile-sider-close"
aria-label="关闭主菜单"
@click="toggleNav"
>
<template #icon><X :size="20" /></template>
</NButton>
</header>
<NScrollbar class="admin-nav-scroll">
<NMenu
:value="route.path"
:options="menuOptions"
:collapsed="menuCollapsed"
:collapsed-width="siderCollapsedWidth"
:icon-size="NAV_ICON_SIZE"
:collapsed-icon-size="NAV_ICON_SIZE"
:indent="navIconIndent"
:root-indent="navIconIndent"
/>
</NScrollbar>
<!-- 底部入口与菜单名称一起显示,图标始终可点击。 -->
<footer class="admin-sider-footer">
<NButton
quaternary
block
class="admin-settings-button"
:class="{ 'is-collapsed': collapsed }"
aria-label="连接设置"
@click="openSettings"
>
<template #icon><Settings2 :size="18" /></template>
<span class="admin-settings-label">连接设置</span>
</NButton>
</footer>
</aside>
<!-- 以下是顶栏与主内容 -->
<NLayout class="admin-main">
<NLayoutHeader class="admin-topbar">
<div class="flex min-w-0 items-center gap-3">
<NButton
quaternary
class="icon-button"
:aria-label="navToggleLabel"
:title="navToggleLabel"
:aria-expanded="!collapsed"
aria-controls="main-navigation"
@click="toggleNav"
>
<template #icon
><component :is="collapsed ? PanelLeftOpen : PanelLeftClose" :size="20"
/></template>
</NButton>
<span class="truncate text-sm">{{ route.meta.title || '工作空间' }}</span>
</div>
<ThemeToggle v-model="preference" />
</NLayoutHeader>
<main id="main-content" tabindex="-1" class="admin-content"><RouterView /></main>
</NLayout>
</div>
<AppDialog v-model:open="settingsOpen" title="连接设置" description="查看当前服务地址。">
<dl class="detail-grid mt-6">
<dt>API 地址</dt>
<dd>
<code>{{ apiBase }}</code>
</dd>
<dt>状态更新</dt>
<dd>制作任务会保存进度;刷新或重新进入页面后可以继续查看。</dd>
</dl>
</AppDialog>
</ActionMessageProvider>
</NMessageProvider>
</NConfigProvider>
</template>
@@ -0,0 +1,13 @@
<script setup lang="ts">
import { provide } from 'vue'
import { useMessage } from 'naive-ui'
import { actionMessageKey } from './useActionMessage'
/** 在应用消息层内取得实例,子页面和公共控件使用同一反馈区域。 */
const message = useMessage()
provide(actionMessageKey, message)
</script>
<template>
<slot />
</template>
+35 -38
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { NModal, NScrollbar } from 'naive-ui'
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
/** 公共弹窗的标题、说明、操作状态和宽度。 */
withDefaults(
@@ -18,55 +18,61 @@ withDefaults(
)
/** 弹窗显隐状态,关闭行为由 Naive 管理。 */
const open = defineModel<boolean>('open', { default: false })
/** 正文测量锚点,不包含固定 header 与 footer。 */
const bodyAnchor = ref<HTMLElement | null>(null)
/** 可用正文滚动高度。 */
const bodyHeight = ref(0)
/** 正文容器隔离子元素外边距,保留完整的自然内容高度。 */
const bodyContent = ref<HTMLElement | null>(null)
/** 正文最大可用高度;未挂载时不限制自然高度。 */
const maxBodyHeight = ref<number | undefined>(undefined)
/** 监听正文和固定区域的尺寸变化,适配异步内容与换行。 */
let layoutObserver: ResizeObserver | undefined
/** 正文使用内容高度与剩余视口高度的较小值,扣除固定标题、说明与 footer。 */
/** 扣除视口上下间距、标题、底栏、正文内边距和边框,只限制正文最大高度。 */
function updateBodyHeight() {
const card = bodyAnchor.value?.closest('.app-dialog')
const scrollContent = bodyAnchor.value?.parentElement
if (!card || !scrollContent) return
const card = bodyContent.value?.closest('.app-dialog')
if (!card) return
const header = card.querySelector<HTMLElement>('.n-card-header')
const footer = card.querySelector<HTMLElement>('.n-card__footer')
const content = card.querySelector<HTMLElement>('.n-card-content')
const contentStyle = content ? getComputedStyle(content) : null
const available = Math.max(
const cardStyle = getComputedStyle(card)
maxBodyHeight.value = Math.max(
0,
window.innerHeight -
(window.visualViewport?.height ?? window.innerHeight) -
32 -
(header?.offsetHeight ?? 0) -
(footer?.offsetHeight ?? 0) -
(contentStyle ? parseFloat(contentStyle.paddingTop) + parseFloat(contentStyle.paddingBottom) : 0) -
2
parseFloat(cardStyle.borderTopWidth) -
parseFloat(cardStyle.borderBottomWidth)
)
bodyHeight.value = Math.min(scrollContent.scrollHeight, available)
}
watch(
open,
async shown => {
[open, bodyContent],
([shown]) => {
layoutObserver?.disconnect()
if (!shown) return
await nextTick()
if (!shown) {
maxBodyHeight.value = undefined
return
}
updateBodyHeight()
const card = bodyAnchor.value?.closest('.app-dialog')
const scrollContent = bodyAnchor.value?.parentElement
if (!card || !scrollContent) return
const card = bodyContent.value?.closest('.app-dialog')
if (!card || !bodyContent.value) return
layoutObserver = new ResizeObserver(updateBodyHeight)
const header = card.querySelector('.n-card-header')
const footer = card.querySelector('.n-card__footer')
if (header) layoutObserver.observe(header)
if (footer) layoutObserver.observe(footer)
layoutObserver.observe(scrollContent)
layoutObserver.observe(bodyContent.value)
},
{ flush: 'post', immediate: true }
)
onMounted(() => window.addEventListener('resize', updateBodyHeight))
onMounted(() => {
window.addEventListener('resize', updateBodyHeight)
window.visualViewport?.addEventListener('resize', updateBodyHeight)
})
onBeforeUnmount(() => {
layoutObserver?.disconnect()
window.removeEventListener('resize', updateBodyHeight)
window.visualViewport?.removeEventListener('resize', updateBodyHeight)
})
</script>
@@ -92,10 +98,12 @@ onBeforeUnmount(() => {
</div>
</div>
</template>
<!-- 以下是弹窗正文滚动模块 -->
<NScrollbar class="dialog-body-scroll" :style="{ height: bodyHeight + 'px' }">
<span ref="bodyAnchor" class="dialog-body-anchor" aria-hidden="true" />
<slot />
<!-- 以下是自然高度正文模块,仅超过剩余视口高度时滚动 -->
<NScrollbar
class="dialog-body-scroll"
:style="{ height: 'auto', maxHeight: maxBodyHeight === undefined ? undefined : maxBodyHeight + 'px' }"
>
<div ref="bodyContent" class="flow-root"><slot /></div>
</NScrollbar>
<template v-if="$slots.footer" #footer>
<div class="dialog-footer"><slot name="footer" /></div>
@@ -118,7 +126,7 @@ onBeforeUnmount(() => {
.app-dialog .n-card-header {
@apply shrink-0 items-start;
}
/* 正文容器可收缩,滚动高度由内容与剩余视口共同确定。 */
/* 正文自然撑开,超过剩余视口高度后由 NScrollbar 内部滚动。 */
.app-dialog .n-card-content {
@apply min-h-0 overflow-hidden;
display: block;
@@ -128,17 +136,6 @@ onBeforeUnmount(() => {
@apply min-h-0;
}
/* 仅隐藏 NScrollbar 的视觉滚动条,不影响鼠标滚轮、触控板与内容拖动滚动。 */
.dialog-body-anchor {
display: block;
height: 0;
}
.dialog-body-scroll.n-scrollbar .n-scrollbar-rail {
opacity: 0 !important;
pointer-events: none !important;
}
.app-dialog .n-card-header__close {
@apply grid place-items-center w-10 h-10 -m-2 rounded-none bg-transparent;
}
+37
View File
@@ -0,0 +1,37 @@
<script setup lang="ts">
import { h } from 'vue'
import { NButton } from 'naive-ui'
import { useActionMessage } from './useActionMessage'
/** 问题说明按需查看,页面不长期堆叠错误段落。 */
const props = withDefaults(
defineProps<{
/** 当前实际问题的中文说明。 */
messages: string[]
/** 操作按钮名称。 */
label?: string
/** 问题对应的反馈级别。 */
type?: 'warning' | 'error' | 'info'
}>(),
{ label: '查看原因', type: 'warning' }
)
/** 统一使用应用的 Naive 消息层。 */
const message = useActionMessage()
/** 点击后展示去重问题,不重新请求或生成内容。 */
function showReasons() {
const content = [...new Set(props.messages.map(item => item.trim()).filter(Boolean))].join(';')
if (content)
message?.[props.type](() => h('div', { class: 'max-w-[min(600px,calc(100vw-48px))] break-words' }, content), {
duration: 7000,
closable: true
})
}
</script>
<template>
<!-- 以下是按需查看问题说明的操作模块 -->
<div v-if="messages.length" class="mt-3 flex items-center gap-2">
<NButton text size="small" @click="showReasons">{{ label }}</NButton>
</div>
</template>
+3 -3
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import FieldLabel from './FieldLabel.vue'
import { NAlert, NButton } from 'naive-ui'
/** 只读诊断模块的展示参数。 */
@@ -24,7 +25,7 @@ const emit = defineEmits<{ refresh: [] }>()
<!-- 以下是只读诊断的标题、展开与手动刷新模块 -->
<section class="workspace-panel text-xs leading-6" :aria-label="title">
<div class="flex flex-wrap items-center justify-between gap-3">
<strong>{{ title }}</strong>
<strong><FieldLabel :label="title" :description="description" /></strong>
<div class="flex items-center gap-3">
<NButton text size="small" :aria-label="`${open ? '收起' : '查看'}${title}`" @click="open = !open">
{{ open ? '收起' : '查看' }}
@@ -41,11 +42,10 @@ const emit = defineEmits<{ refresh: [] }>()
</NButton>
</div>
</div>
<p v-if="description" class="mt-1 text-muted">{{ description }}</p>
<!-- 以下是读取状态、错误与实际诊断结果模块 -->
<div v-if="open" class="mt-3">
<NAlert v-if="error" type="error" :show-icon="false" role="alert">{{ error }}</NAlert>
<p v-if="loading" class="text-muted" role="status">正在读取后端记录…</p>
<p v-if="loading" class="text-muted" role="status">正在加载…</p>
<slot v-else />
</div>
</section>
+13
View File
@@ -0,0 +1,13 @@
import { inject, type InjectionKey } from 'vue'
import type { MessageApi } from 'naive-ui'
/** 页面操作结果共用的 Naive Message 实例。 */
export const actionMessageKey: InjectionKey<MessageApi> = Symbol('action-message')
/**
* 读取应用提供的轻量反馈接口,独立使用组件时允许不提供消息层。
* @returns 当前应用消息接口,没有消息层时返回 null
*/
export function useActionMessage() {
return inject(actionMessageKey, null)
}
+32 -51
View File
@@ -4,7 +4,17 @@ import { NFormItem } from 'naive-ui'
import { integerRule, sizeRules } from '../../lib/form-rules'
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
import { NScrollbar, NAlert, NButton, NCheckbox, NInputNumber, NProgress, NSelect } from 'naive-ui'
import {
NScrollbar,
NAlert,
NButton,
NCheckbox,
NInputNumber,
NProgress,
NSelect,
NCollapse,
NCollapseItem
} from 'naive-ui'
import { computed, inject, ref, watch } from 'vue'
import { ArrowLeft, CheckCircle2, CircleAlert, Film, Image, MessageSquareText } from '@lucide/vue'
import { EmptyState, StatusBadge } from '../../components/ui'
@@ -19,7 +29,6 @@ import StaleKeyframeNotice from './components/StaleKeyframeNotice.vue'
import { routeLocationKey } from 'vue-router'
import { queryText } from './asset-links'
import QualityDialog from './components/QualityDialog.vue'
import CreativeProfileSettings from '../generation-config/components/CreativeProfileSettings.vue'
import EpisodeAssemblyPanel from './components/EpisodeAssemblyPanel.vue'
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
import { useWorkflowExecution } from '../workflows/execution'
@@ -195,25 +204,6 @@ const invalidGenerationSpecs = computed(
(query.data.value?.keyframes.invalidGenerationSpec ?? 0) +
(query.data.value?.prompts.invalidGenerationSpec ?? 0)
)
const preparationComplete = computed(() => {
const data = query.data.value
if (!data) return false
return (
data.keyframes.total > 0 &&
data.keyframes.skipped === data.keyframes.total &&
data.prompts.total > 0 &&
data.prompts.skipped === data.prompts.total &&
!identityBlocked.value &&
!invalidGenerationSpecs.value &&
!staleKeyframes.value
)
})
const finalVideosComplete = computed(() => {
const data = query.data.value
if (!data?.videos.total) return false
return data.videos.skipped === data.videos.total && !staleVideos.value && !videoRunning.value
})
/** 父页查询包含整个项目的就绪统计,单镜头变更后立即刷新。 */
function refreshProject() {
void query.refresh()
@@ -240,9 +230,6 @@ watch(
}
)
function profileSaved() {
operation.value.error = ''
}
const batchModel = computed(() => ({ concurrency: concurrency.value }))
const batchRules = { concurrency: integerRule('批量并发') }
const keyframeModel = computed(() => ({
@@ -345,11 +332,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
</AppForm>
</section>
<div class="production-tool-stack workspace-section-stack">
<CreativeProfileSettings
:project-id="id"
:disabled="operation.pending"
@saved="profileSaved"
/>
<!-- 以下是生产范围说明与批量操作模块 -->
<section class="production-tool-section workspace-panel">
<h3 class="text-sm font-semibold">处理范围与覆盖规则</h3>
<p class="mt-3 text-xs leading-6 text-muted">
@@ -707,11 +690,6 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
<NAlert v-if="episodeSourceUnavailable" type="info" :show-icon="false">
本集镜头已重新生成。新标题和剧情详情尚未提供,当前只显示正式镜头编号;请按实际生成规格核对内容。
</NAlert>
<div v-if="preparationComplete" class="workspace-inline-status">
<span v-if="finalVideosComplete">本项目镜头素材和视频成片已经准备完成。</span>
<span v-else>镜头制作准备已经完成。视频生成费用较高,可按需要逐批提交视频任务。</span>
<NButton v-if="!finalVideosComplete" text size="small" @click="toolsOpen = true">打开批量生产</NButton>
</div>
<NScrollbar v-if="query.error.value" class="workspace-feedback"
><NAlert role="alert" type="error" :show-icon="false"
>{{ query.error.value
@@ -719,8 +697,9 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
></NScrollbar
>
<div v-if="staleKeyframes || staleVideos || identityBlocked" class="workspace-inline-status">
<span>过期首帧 {{ staleKeyframes }} · 过期视频 {{ staleVideos }} · 身份前置问题 {{ identityBlocked }}</span>
<NButton text size="small" @click="toolsOpen = true">查看处理方式</NButton>
<span
>首帧待更新 {{ staleKeyframes }} · 视频待更新 {{ staleVideos }} · 身份待确认 {{ identityBlocked }}</span
>
</div>
<div v-if="shots.length" class="panel production-workspace workspace-surface">
<nav class="production-shot-list directory-panel" aria-label="本集生产镜头">
@@ -791,7 +770,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
>
<div class="flex flex-wrap items-start justify-between gap-3">
<div>
<p class="eyebrow">BEAT {{ shot.beatNo }} / SHOT {{ shot.shotNo }}</p>
<p class="eyebrow">段落 {{ shot.beatNo }} · 镜头 {{ shot.shotNo }}</p>
<h3 class="mt-2 text-lg font-semibold">{{ shot.title }}</h3>
</div>
<StatusBadge
@@ -801,7 +780,6 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
/>
</div>
<p v-if="shot.description" class="mt-3 text-sm leading-7">{{ shot.description }}</p>
<p class="mt-3 break-all font-mono text-[10px] text-muted">Shot ID · {{ shot.shotId }}</p>
<NAlert
v-if="videoStatusItem?.status === 'failed'"
type="error"
@@ -814,17 +792,20 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
</p>
<p v-else-if="videoStatusItem.retryable === true" class="mt-2">此任务可以重试。</p>
</NAlert>
<StaleKeyframeNotice
v-if="selectedKeyframeStale"
:key="shot.shotId"
:project-id="id"
:shot-id="shot.shotId"
:issues="selectedIssues"
:inconsistent="
keyframeItem?.primaryKeyframeStale === false &&
selectedIssues.some(issue => issue.code === 'stale_keyframe')
"
/>
<NCollapse v-if="selectedKeyframeStale" class="mt-3">
<NCollapseItem title="首帧需要更新 · 查看相关素材" name="stale-keyframe">
<StaleKeyframeNotice
:key="shot.shotId"
:project-id="id"
:shot-id="shot.shotId"
:issues="selectedIssues"
:inconsistent="
keyframeItem?.primaryKeyframeStale === false &&
selectedIssues.some(issue => issue.code === 'stale_keyframe')
"
/>
</NCollapseItem>
</NCollapse>
<NAlert
v-if="videoItem?.primaryVideoStale"
role="status"
@@ -860,7 +841,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
<EmptyState
v-else-if="query.data.value"
title="本集还没有正式镜头"
description="先完成剧本拆解、导演设计与正式镜头持久化,再进入镜头生产。"
description="先完成剧本拆解和分镜设计,再进入镜头生产。"
>
<RouterLink :to="`/projects/${id}/storyboard`" class="button button-secondary">前往分镜设计</RouterLink>
</EmptyState>
@@ -987,7 +968,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
}
}
.workspace-inline-status {
@apply flex items-center flex-wrap justify-between gap-y-2 gap-x-4 py-[7px] px-3 shrink-0 rounded-none bg-(--app-subtle) text-xs;
@apply flex items-center flex-wrap justify-between gap-y-2 gap-x-4 py-[10px] px-3 shrink-0 rounded-none bg-(--app-subtle) text-xs;
}
.production-workspace {
@apply flex-1 min-h-0 items-stretch overflow-hidden;
@@ -78,10 +78,10 @@ const confirmationDescription = computed(
Prompt,但会在视频生成前正常停止,不向视频 Provider 提交任务。
</p>
<!-- 以下是生产范围配置模块,修改任一参数后须重新预检。 -->
<div class="surface-inset mt-3 p-3">
<div class="surface-inset mt-4 p-4">
<NCheckbox v-model:checked="safeMode">测试安全模式(不生成视频)</NCheckbox>
<!-- 以下是本轮断点与生成上限模块。 -->
<div class="mt-3 grid grid-cols-2 gap-3 text-xs">
<div class="advanced-production-fields">
<label
>起始阶段<NSelect
v-model:value="startFrom"
@@ -228,3 +228,16 @@ const confirmationDescription = computed(
</NCollapseItem></NCollapse
>
</template>
<style scoped>
@reference "../../../styles/styles.css";
/* 串联生产表单统一标签间距与行列间距,窄屏改为单列。 */
.advanced-production-fields {
@apply mt-4 grid grid-cols-1 gap-x-5 gap-y-4 text-xs sm:grid-cols-2;
}
.advanced-production-fields > label {
@apply flex min-w-0 flex-col gap-2;
}
</style>
@@ -1,4 +1,6 @@
<script setup lang="ts">
import IssueHint from '../../../components/ui/IssueHint.vue'
import { productionMessage } from '../production-messages'
import { computed } from 'vue'
import { BadgeCheck } from '@lucide/vue'
import { NAlert, NButton, NTag } from 'naive-ui'
@@ -47,11 +49,11 @@ const canSelect = computed(
<NTag v-else-if="validationPassed === false" size="small" type="error" :bordered="false"
>质量未通过</NTag
>
<NTag v-if="item.source === 'provider_variant'" size="small" :bordered="false">模型输入变体</NTag>
<NTag v-if="item.source === 'provider_variant'" size="small" :bordered="false">视频参考图</NTag>
<NTag v-if="item.isPrimary && stale" size="small" :bordered="false">已过期</NTag>
<span class="text-[10px] text-muted">{{ item.width || '—' }} × {{ item.height || '—' }}</span>
</div>
<p v-if="item.error" class="mt-2 line-clamp-3 text-xs text-danger">{{ item.error }}</p>
<IssueHint v-if="item.error" :messages="[productionMessage(item.error)]" type="error" />
<p class="mt-2 text-[10px] text-muted">{{ formatDate(item.createdAt) }}</p>
<div v-if="item.status === 'completed' && item.imageUrl" class="mt-2 flex flex-wrap items-center gap-3">
<NButton text size="small" @click="emit('quality')">
@@ -40,7 +40,7 @@ const records = computed(() =>
<ReadonlyInspection
v-model:open="open"
title="首帧校验历史"
description="读取已有记录不产生费用;历史通过不会自动晋升,也不保证当前素材仍然一致。"
description="查看记录不收费;设置主首帧前仍需完成本次检查。"
:loading="query.loading.value"
:error="query.error.value"
@refresh="query.refresh"
@@ -54,7 +54,7 @@ async function inspect() {
</script>
<template>
<section class="mt-4 text-xs">
<NButton size="small" :loading="loading" :disabled="loading" @click="inspect">查看后端模型能力</NButton>
<NButton size="small" :loading="loading" :disabled="loading" @click="inspect">查看模型限制</NButton>
<NAlert v-if="error" type="error" :show-icon="false" class="mt-3">{{ error }}</NAlert>
<template v-if="providers">
<p v-if="!providers.some(item => item.active)" class="mt-2 text-danger">
@@ -50,10 +50,8 @@ async function inspect() {
<template>
<section class="surface-inset mt-4 p-4" aria-label="视频模型最终输入检查">
<h4 class="text-sm font-medium">按模型检查实际输入</h4>
<p class="mt-2 text-xs text-muted">
填写后端使用的视频模型标识,检查实际首帧与授权素材。只读查询,不产生生成费用。
</p>
<h4 class="text-sm font-medium">检查视频素材</h4>
<p class="mt-2 text-xs text-muted">输入模型名称,检查素材是否满足要求。查看不收费。</p>
<div class="mt-3 flex flex-wrap gap-2">
<NInput
v-model:value="provider"
@@ -366,9 +366,6 @@ const optionsExpanded = ref<string[]>(['options'])
: '仅校验,不修改主资产。'
}}</template>
</NAlert>
<NCheckbox v-model:checked="acknowledged" :disabled="pending" class="mt-4"
>我已确认费用、处理范围,且同项目没有其他生成任务。</NCheckbox
>
</AppForm>
<p v-if="pending" role="status" class="mt-3 text-xs text-muted">{{ operation.label }}进行中,请勿重复提交。</p>
<NAlert v-if="session.error" role="alert" type="error" :show-icon="false" class="mt-4">{{
@@ -403,15 +400,23 @@ const optionsExpanded = ref<string[]>(['options'])
<p v-if="target?.kind !== 'batch'" class="mt-3 text-xs text-muted">
本会话回执可导出;首帧已有校验可在历史中只读查看,后台质量任务刷新后继续恢复。
</p>
<!-- 以下是底栏左侧费用确认与右侧操作按钮模块 -->
<template #footer>
<NButton @click="open = false">关闭</NButton>
<NButton
type="primary"
:loading="pending"
:disabled="blocked || !acknowledged || !repairAvailable"
@click="formRef?.validate(submit)"
>{{ label }}</NButton
>
<div class="quality-dialog-footer">
<NCheckbox v-model:checked="acknowledged" :disabled="pending" class="quality-dialog-acknowledgement"
>我已确认费用、处理范围,且同项目没有其他生成任务。</NCheckbox
>
<div class="quality-dialog-actions">
<NButton @click="open = false">关闭</NButton>
<NButton
type="primary"
:loading="pending"
:disabled="blocked || !acknowledged || !repairAvailable"
@click="formRef?.validate(submit)"
>{{ label }}</NButton
>
</div>
</div>
</template>
</AppDialog>
</template>
@@ -422,4 +427,19 @@ const optionsExpanded = ref<string[]>(['options'])
.quality-fields {
@apply grid grid-cols-[repeat(auto-fit,_minmax(min(100%,_180px),_1fr))] items-start gap-4;
}
/* 确认项固定在底栏左侧,操作按钮在右侧;窄屏允许分行。 */
.app-dialog .dialog-footer:has(> .quality-dialog-footer) {
@apply w-full;
}
.quality-dialog-footer {
@apply flex w-full flex-wrap items-center justify-between gap-4;
}
.quality-dialog-acknowledgement {
@apply min-w-0 flex-1;
flex-basis: 360px;
}
.quality-dialog-actions {
@apply ml-auto flex shrink-0 items-center gap-2;
}
</style>
@@ -1,7 +1,9 @@
<script setup lang="ts">
import IssueHint from '../../../components/ui/IssueHint.vue'
import { useActionMessage } from '../../../components/ui/useActionMessage'
import ProviderInputInspector from './ProviderInputInspector.vue'
import { NAlert, NButton, NCollapse, NCollapseItem, NSelect, NTag } from 'naive-ui'
import { computed, ref, watch } from 'vue'
import { computed, onScopeDispose, ref, watch } from 'vue'
import { ExternalLink, ImagePlus, RefreshCw } from '@lucide/vue'
import { AssetImage, StatusBadge } from '../../../components/ui'
import { usePolling } from '../../../composables/usePolling'
@@ -13,14 +15,8 @@ import { storyboardApi } from '../../storyboard/api'
import ConfirmAction from '../../workflows/ConfirmAction.vue'
import { runOperation } from '../../workflows/operations'
import { productionApi } from '../api'
import {
isActiveVideo,
issueLabel,
primaryKeyframe,
primaryVideo,
productionStatusLabel,
videoQualityStatusLabel
} from '../model'
import { isActiveVideo, primaryKeyframe, primaryVideo, productionStatusLabel, videoQualityStatusLabel } from '../model'
import { productionIssueText, productionMessage } from '../production-messages'
import type {
GenerateKeyframeInput,
KeyframeReadinessItem,
@@ -48,6 +44,14 @@ import type {
} from '../../generation-config/types'
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
/** 当前页面操作反馈使用消息提示,不长期占据正文。 */
const actionMessage = useActionMessage()
/** 离开镜头后忽略迟到的手动读取反馈。 */
let disposed = false
onScopeDispose(() => {
disposed = true
})
/** 单镜头生产面板只负责正式资产,不修改上游导演设计与即时状态。 */
const props = defineProps<{
/** 当前正式项目 ID。 */
@@ -123,6 +127,10 @@ const promptQuery = usePolling(key, (shotId, signal) => storyboardApi.videoPromp
const savedPrompt = computed(() => (promptQuery.data.value?.shotId === key.value ? promptQuery.data.value : null))
/** 当前视频生成规格的首帧和主体参考图,独立查询避免影响资产列表。 */
const videoInputQuery = usePolling(key, (shotId, signal) => productionApi.videoGenerationSpec(shotId, signal), false)
/** 素材查询问题与就绪检查使用同一中文说明,避免重复展示后端术语。 */
const videoInputError = computed(() => productionMessage(videoInputQuery.error.value))
/** 视频准备问题按实际含义去重,保留所有不同的处理建议。 */
const videoIssueMessages = computed(() => [...new Set((props.videoReadiness?.issues ?? []).map(productionIssueText))])
const currentVideoInput = computed(() =>
videoInputQuery.data.value?.shotId === key.value ? videoInputQuery.data.value : null
)
@@ -263,6 +271,17 @@ async function refreshAll() {
emit('changed')
}
/** 手动更新素材时才反馈查询结果,切换镜头后不显示旧目标提示。 */
async function refreshVideoInput() {
if (videoInputQuery.loading.value) return
const target = `${props.projectId}:${props.shot.shotId}`
await videoInputQuery.refresh()
if (disposed || target !== `${props.projectId}:${props.shot.shotId}`) return
if (videoInputQuery.error.value)
actionMessage?.warning(productionMessage(videoInputQuery.error.value), { duration: 7000, closable: true })
else actionMessage?.success('视频素材已更新。', { duration: 3000 })
}
/** 单镜头提示词根据现有状态决定是否 force 覆盖。 */
async function generatePrompt() {
if (!canGeneratePrompt.value) return
@@ -413,11 +432,7 @@ async function inspectSpecs() {
:label="productionStatusLabel(promptReadiness.status)"
/>
</div>
<ul v-if="promptReadiness?.issues.length" class="mt-3 space-y-2 text-xs text-danger">
<li v-for="issue in promptReadiness.issues" :key="issue.code">
{{ issueLabel(issue.code) }}:{{ issue.reason }}
</li>
</ul>
<IssueHint :messages="(promptReadiness?.issues ?? []).map(productionIssueText)" />
<div v-if="savedPrompt?.videoPrompt" class="surface-inset mt-4 p-4" aria-label="本镜视频提示词">
<p class="text-xs font-medium">本镜视频提示词</p>
<p class="mt-3 whitespace-pre-wrap break-words text-sm leading-6">{{ savedPrompt.videoPrompt }}</p>
@@ -465,14 +480,7 @@ async function inspectSpecs() {
:label="keyframeStale ? '主首帧已过期' : productionStatusLabel(keyframeReadiness.status)"
/>
</div>
<NAlert v-if="keyframeStale" role="status" type="info" :show-icon="false" class="mt-3 text-xs">
当前主首帧使用的主体参考资产已经变化,旧图仍保留但不会继续进入视频生成。请重新生成主首帧。
</NAlert>
<ul v-if="keyframeReadiness?.issues.length" class="mt-3 space-y-2 text-xs text-danger">
<li v-for="issue in keyframeReadiness.issues" :key="issue.code">
{{ issueLabel(issue.code) }}:{{ issue.reason }}
</li>
</ul>
<IssueHint :messages="(keyframeReadiness?.issues ?? []).map(productionIssueText)" />
<div v-if="currentKeyframe" class="keyframe-grid mt-4">
<KeyframeCard
:item="currentKeyframe"
@@ -533,29 +541,18 @@ async function inspectSpecs() {
</div>
<div v-if="videoInputPlan" class="mt-3 flex flex-wrap items-center gap-2 text-xs">
<NTag size="small" :bordered="false" type="info">
{{ videoInputPlan.inputMode === 'omni_reference' ? '全模态参考' : '首帧模式' }}
{{ videoInputPlan.inputMode === 'omni_reference' ? '使用多张参考图' : '使用首帧' }}
</NTag>
<span class="text-muted">{{ videoInputPlan.reasons.join(';') }}</span>
<span class="text-muted">{{ videoInputPlan.reasons.map(productionMessage).join(';') }}</span>
</div>
<NAlert v-else-if="query.data.value?.inputPlanError" type="warning" :show-icon="false" class="mt-3 text-xs">
当前镜头输入规划暂不可用;请先处理视频就绪问题后刷新。
</NAlert>
<NAlert v-if="videoStale" role="status" type="info" :show-icon="false" class="mt-3 text-xs">
当前主视频使用的主首帧或主体参考图已经变化。旧视频仍保留;重新生成完成后,新视频会自动接替过期主视频。
</NAlert>
<ul v-if="videoReadiness?.issues.length" class="mt-3 space-y-2 text-xs text-danger">
<li v-for="issue in videoReadiness.issues" :key="issue.code">
{{ issueLabel(issue.code) }}:{{ issue.reason }}
</li>
</ul>
<IssueHint :messages="videoIssueMessages" />
<section class="surface-inset mt-4 p-4" aria-label="当前视频生成素材引用">
<div class="flex flex-wrap items-center justify-between gap-2">
<h6 class="text-xs font-medium">当前视频生成素材引用</h6>
<h6 class="text-xs font-medium">视频使用的素材</h6>
<span v-if="currentVideoInput" class="text-[11px] text-muted">
主首帧 1 张 · 主体参考图 {{ currentVideoInput.references.length }} 张
首帧 1 张 · 参考图 {{ currentVideoInput.references.length }} 张
</span>
</div>
<p class="mt-2 text-xs text-muted">以下是当前镜头的生成输入;已生成的视频可能使用更早的素材。</p>
<div v-if="currentVideoInput" class="video-input-grid mt-4">
<article class="video-input-card">
<div class="video-input-image">
@@ -604,38 +601,38 @@ async function inspectSpecs() {
正在读取视频生成素材…
</p>
<div v-else class="mt-4 text-xs text-muted">
<p>当前生成规格尚未就绪,请检查视频提示词、主首帧与主体参考图。</p>
<p v-if="videoInputQuery.error.value" class="mt-2 break-words">{{ videoInputQuery.error.value }}</p>
<NButton
v-if="videoInputQuery.error.value"
text
size="small"
class="mt-2"
@click="videoInputQuery.refresh"
>重新读取</NButton
>
<p>视频素材还未准备好,请先检查视频提示词、首帧和参考图。</p>
<IssueHint v-if="!videoIssueMessages.length" :messages="videoInputError ? [videoInputError] : []" />
<!-- 以下是重新获取素材的操作模块,与上下正文保持间距 -->
<div v-if="videoInputQuery.error.value" class="mt-3 flex pb-1">
<NButton text size="small" :loading="videoInputQuery.loading.value" @click="refreshVideoInput"
>重新获取</NButton
>
</div>
</div>
</section>
<NAlert
<div
v-if="videoQualityStatus && videoQualityStatus.status !== 'not_started'"
:type="
videoQualityStatus.status === 'passed'
? 'success'
: videoQualityStatus.status === 'exhausted'
? 'error'
: 'info'
"
:show-icon="false"
class="mt-3 text-xs"
class="mt-3 flex items-center gap-2"
>
{{ videoQualityStatusLabel(videoQualityStatus.status) }}
<template v-if="videoQualityStatus.maxRepairAttempts !== null">
· 修复 {{ videoQualityStatus.repairAttempt }} / {{ videoQualityStatus.maxRepairAttempts }}
</template>
<template v-if="videoQualityStatus.status === 'exhausted'">
。请检查候选视频和校验结果,调整提示词或参考资产后再重新生成。
</template>
</NAlert>
<NTag
size="small"
:type="
videoQualityStatus.status === 'passed'
? 'success'
: videoQualityStatus.status === 'exhausted'
? 'error'
: 'info'
"
:bordered="false"
>
{{
videoQualityStatus.status === 'passed'
? '视频检查通过'
: videoQualityStatusLabel(videoQualityStatus.status)
}}
</NTag>
</div>
<!-- 以下是当前镜头只读视频质量详情与失败归因模块 -->
<VideoQualityDiagnostics :key="shot.shotId" :shot-id="shot.shotId" class="mt-3" />
<div v-if="videos.length" class="video-grid mt-4">
@@ -739,22 +736,22 @@ async function inspectSpecs() {
@update:options="videoGenerationOptions = $event"
/>
<div class="generation-input-mode">
<p class="generation-input-mode-label">输入模式</p>
<p class="generation-input-mode-label">生成方式</p>
<NSelect
:value="videoInputModeOverride"
:disabled="assetBlocked"
:options="[
{
label: `自动(推荐:${videoInputPlan?.inputMode === 'omni_reference' ? '全模态参考' : '首帧模式'})`,
label: `自动(推荐:${videoInputPlan?.inputMode === 'omni_reference' ? '多张参考图' : '首帧'})`,
value: 'auto'
},
{ label: '首帧模式', value: 'first_frame' },
{ label: '全模态参考', value: 'omni_reference' }
{ label: '多张参考图', value: 'omni_reference' }
]"
@update:value="videoInputModeOverride = $event"
/>
<p class="mt-1.5 text-[11px] leading-5 text-muted">
自动模式遵循后端 Planner;手动选择只影响当前镜头本次生成。
自动选择合适的生成方式;手动选择只影响本次生成。
</p>
</div>
</div>
@@ -785,17 +782,17 @@ async function inspectSpecs() {
</div>
</div>
<AppDialog v-model:open="specsOpen" title="生成规格与模型限制" description="只读检查,不调用生成模型。" wide>
<AppDialog v-model:open="specsOpen" title="生成设置与模型限制" description="查看不收费。" wide>
<NAlert v-if="specError" role="alert" type="error" :show-icon="false" class="mt-4">{{ specError }}</NAlert>
<p v-if="inspecting" role="status" class="mt-4 text-xs text-muted">正在读取生成规格…</p>
<ModelCapabilities :shot-id="shot.shotId" />
<ProviderInputInspector :shot-id="shot.shotId" />
<NCollapse v-if="keyframeSpec || videoSpec" class="mt-5 pt-4 text-xs" :default-expanded-names="['details']"
<NCollapse v-if="keyframeSpec || videoSpec" class="mt-5 pt-4 text-xs"
><NCollapseItem name="details"
><template #header>本镜确定性生成规格</template>
><template #header>查看生成描述</template>
<div class="mt-4 grid gap-5 lg:grid-cols-2">
<div v-if="keyframeSpec">
<h5 class="font-medium">首帧 Prompt · {{ keyframeSpec.references.length }} 张参考图</h5>
<h5 class="font-medium">首帧描述 · {{ keyframeSpec.references.length }} 张参考图</h5>
<p class="mt-3 whitespace-pre-wrap leading-6 text-muted">{{ keyframeSpec.prompt }}</p>
<ul v-if="keyframeSpec.references.length" class="mt-3 space-y-1 text-[11px] text-muted">
<li
@@ -803,27 +800,15 @@ async function inspectSpecs() {
:key="`${reference.role}:${reference.imageId}`"
>
{{ reference.subjectRef }} ·
{{ reference.role === 'identity-anchor' ? '演员身份母版' : '形态主图' }} ·
<code>{{ reference.imageId }}</code>
{{ reference.role === 'identity-anchor' ? '演员身份母版' : '形态主图' }}
</li>
</ul>
</div>
<div v-if="videoSpec">
<h5 class="font-medium">视频 Prompt · {{ videoSpec.durationSeconds }}s</h5>
<h5 class="font-medium">视频描述 · {{ videoSpec.durationSeconds }} 秒</h5>
<p class="mt-3 whitespace-pre-wrap leading-6 text-muted">{{ videoSpec.videoPrompt }}</p>
<p v-if="videoSpec.negativePrompt" class="mt-3 whitespace-pre-wrap leading-6 text-muted">
Negative prompt: {{ videoSpec.negativePrompt }}
</p>
<p class="mt-3 break-all font-mono text-[10px] text-muted">
业务主首帧 ID · {{ videoSpec.keyframe.id }}
</p>
<p v-if="videoSpec.providerInputKeyframe" class="mt-2 break-all text-[10px] text-muted">
通用规格首帧 ID(未指定模型) · {{ videoSpec.providerInputKeyframe.id }}
{{
videoSpec.providerInputKeyframe.source === 'provider_variant'
? '(专用变体)'
: '(业务主首帧)'
}}
不希望出现的内容: {{ videoSpec.negativePrompt }}
</p>
</div>
</div></NCollapseItem
@@ -844,7 +829,11 @@ async function inspectSpecs() {
description="先完成质量检查;只有本会话校验通过的候选才能设为主首帧。"
wide
>
<div v-if="keyframeCandidates.length" class="keyframe-grid mt-4">
<!-- 以下是自适应等宽候选图网格模块,完整行与弹窗正文两侧对齐 -->
<div
v-if="keyframeCandidates.length"
class="mt-4 grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-3 max-[760px]:grid-cols-2"
>
<KeyframeCard
v-for="item in keyframeCandidates"
:key="item.id"
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { productionIssueText } from '../production-messages'
import { computed } from 'vue'
import { NAlert, NButton } from 'naive-ui'
import { referenceLocation, referenceTargets } from '../asset-links'
@@ -12,8 +13,9 @@ const references = useShotReferences(
computed(() => props.shotId)
)
const targets = computed(() => referenceTargets(references.data.value, props.issues))
/** 以普通用户可以理解的原因说明当前首帧需要更新。 */
const reasons = computed(() => [
...new Set(props.issues.filter(issue => issue.code === 'stale_keyframe').map(issue => issue.reason))
...new Set(props.issues.filter(issue => issue.code === 'stale_keyframe').map(productionIssueText))
])
const precise = computed(() =>
props.issues.some(issue => issue.code === 'stale_keyframe' && issue.missingSubjects?.length)
@@ -27,15 +29,11 @@ const precise = computed(() =>
class="mt-4 text-xs"
:title="inconsistent ? '主首帧状态待核对' : '主首帧已过期'"
>
<p v-if="inconsistent">
首帧检查未标记过期,但视频检查报告参考资产已变化。两项后端检查结果不一致,请先核对下列素材与身份母版,不建议直接重复生图;视频仍会按后端检查阻止提交。
</p>
<p v-else>
当前参考资产与生成该首帧时不一致,旧首帧需重建。素材本身不一定过期,请先核对关联素材;确认有效后返回本镜头重新生成主首帧。
</p>
<p v-if="inconsistent">首帧与视频准备状态不一致,请先核对相关素材,再决定是否更新首帧。</p>
<p v-else>请先核对相关参考图,再重新生成并检查首帧。</p>
<p v-for="reason in reasons" :key="reason" class="mt-2">{{ reason }}</p>
<p class="mt-3 font-medium">
{{ precise ? '定位后端标记的变更主体' : '核对本镜头关联素材(后端未返回具体变更项)' }}
{{ precise ? '需要核对的素材' : '本镜头的相关素材' }}
</p>
<div class="mt-2 flex flex-wrap items-center gap-3">
<RouterLink
@@ -54,7 +54,7 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
<ReadonlyInspection
v-model:open="open"
title="视频质量详情"
description="读取已有校验链和失败归因,不重新校验或生成视频。"
description="查看检查结果和修改建议,不收费。"
:loading="query.loading.value"
:error="query.error.value"
@refresh="query.refresh"
+8 -3
View File
@@ -39,7 +39,11 @@ export function isActiveVideo(item: ShotVideo): boolean {
return ['pending', 'queued', 'running'].includes(item.status)
}
/** 就绪问题转为用户可直接理解的短标签;页面不暴露服务端实现术语。 */
/**
* 就绪问题转为可直接理解的中文短标签,未知问题仍显示明确提示。
* @param code 后端就绪问题码
* @returns 页面显示的中文问题标签
*/
export function issueLabel(code: ProductionIssueCode): string {
const labels: Record<ProductionIssueCode, string> = {
invalid_generation_spec: '生成规格不完整',
@@ -53,9 +57,10 @@ export function issueLabel(code: ProductionIssueCode): string {
stale_prompt: '视频提示词需要更新',
provider_input_recovery: '视频模型输入需要处理',
missing_keyframe: '缺少主首帧',
stale_keyframe: '主首帧已过期'
stale_keyframe: '主首帧已过期',
failed_keyframe_quality: '首帧画面检查未通过'
}
return labels[code]
return labels[code] ?? '生成条件需要完善'
}
/** 生产状态中文标签,未知值由状态组件回退显示原文。 */
@@ -0,0 +1,47 @@
import { issueLabel } from './model'
import type { ProductionIssue } from './types'
/**
* 把后端生产原因转换为普通用户可读的中文提示。
* @param message 后端原始说明或错误信息
* @returns 页面展示的中文说明
*/
export function productionMessage(message: string): string {
const text = message.trim()
if (!text) return ''
if (
/(?:Primary Keyframe|主首帧|首帧)/i.test(text) &&
/(?:视觉|画面)(?:质量)?(?:校验|检查).*?(?:未通过|失败)/.test(text)
)
return '首帧画面检查未通过,请重新生成或修复首帧。'
if (/(?:Video Prompt|视频提示词).*未绑定.*(?:Primary Keyframe|首帧)/i.test(text))
return '视频提示词与当前首帧不一致,请重新生成视频提示词。'
if (/空间目标绑定.*(?:变化|变更|调整)/.test(text)) return '镜头画面设置已调整,请重新生成并检查首帧。'
if (/缺少.*(?:Primary Keyframe|主首帧)/i.test(text)) return '还没有可用首帧,请先生成并确认首帧。'
if (/(?:Primary Keyframe|主首帧).*(?:过期|旧版|参考资产.*变化)/i.test(text))
return '当前首帧需要更新,请重新生成并检查首帧。'
if (/fetch failed|failed to fetch|network error/i.test(text)) return '暂时无法连接服务,请稍后重新获取。'
const translated = text
.replace(/Storyboard Shot/gi, '镜头')
.replace(/Primary Keyframe/gi, '首帧')
.replace(/Video Prompt/gi, '视频提示词')
.replace(/Motion Plan/gi, '动作设计')
.replace(/Identity Anchor/gi, '身份母版')
.replace(/SubjectForm/gi, '主体形态')
.replace(/Provider/gi, '生成模型')
.replace(/\bShot\b/gi, '镜头')
.replace(/服务器内部错误[::]?\s*/g, '')
.replace(/\s*[::]?\s*\bc[a-z0-9]{20,}\b/g, '')
.trim()
return /[\u4e00-\u9fff]/.test(translated) ? translated : '暂时无法读取生成信息,请稍后重新获取。'
}
/**
* 将就绪检查问题转换为页面说明,不改变原始问题数据。
* @param issue 后端结构化就绪问题
* @returns 页面展示的原因与处理建议
*/
export function productionIssueText(issue: ProductionIssue): string {
if (issue.code === 'failed_keyframe_quality') return '首帧画面检查未通过,请重新生成或修复首帧。'
return productionMessage(issue.reason) || issueLabel(issue.code)
}
+2
View File
@@ -17,6 +17,8 @@ export type ProductionIssueCode =
| 'provider_input_recovery'
| 'missing_keyframe'
| 'stale_keyframe'
/** 当前主首帧最新画面检查未通过。 */
| 'failed_keyframe_quality'
/** 就绪检查中的具体阻塞原因;部分参考图问题会附带主体引用。 */
export interface ProductionIssue {
@@ -44,7 +44,7 @@ export async function checkPipeline(projectId: string, scope: ProductionStartInp
const issues: string[] = []
if (plan.entryReadiness && !plan.entryReadiness.ready)
issues.push(plan.entryReadiness.reason || '项目尚未满足生产入口条件。')
if (!profile) issues.push('尚未配置项目画布与生成模型,请先在批量生产工具中保存配置。')
if (!profile) issues.push('尚未配置项目画布与生成模型,请先在右上角“项目配置”中保存配置。')
const shotIds = new Set(plan.details.keyframes.map(item => item.shotId))
if (
shotIds.size !== plan.keyframes.total ||
+50 -4
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, inject, onScopeDispose, provide, ref, watch, watchEffect } from 'vue'
import { computed, h, inject, onScopeDispose, provide, ref, watch, watchEffect } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { NScrollbar, NAlert, NButton, NPageHeader, NSpin, NEllipsis } from 'naive-ui'
import { EmptyState } from '../../components/ui'
@@ -9,6 +9,8 @@ import { projectAccessKey, projectSectionFromPath, type ProjectAccess } from './
import { useProjectStageAccess } from './useProjectStageAccess'
import { useWorkflowExecution } from '../workflows/execution'
import { clearEpisodeSourceInvalidations, invalidateEpisodeSource } from '../storyboard/model'
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'
@@ -140,6 +142,48 @@ const operationGuide = computed<OperationGuide | null>(() => {
return { title: '操作未完成', description: error }
})
/** 镜头工作区的操作结果只在用户发起操作后显示,不在进入页面时重放旧提示。 */
const actionMessage = useActionMessage()
/** 分镜和生产页保留必要进度,操作成功或失败改用临时消息。 */
const quietFeedback = computed(() => currentSection.value === 'production' || currentSection.value === 'storyboard')
/** 只通知仍在当前项目的真实新结果,不把任务提交当作素材生成完成。 */
watch(
() => [id.value, operation.value.error, operation.value.notice] as const,
([projectId, error, notice], [previousProject, previousError, previousNotice]) => {
if (!quietFeedback.value || projectId !== previousProject) return
if (error && error !== previousError) {
const guide = operationGuide.value
const content = productionMessage(error)
actionMessage?.error(
() =>
h('div', { class: 'flex max-w-[min(600px,calc(100vw-48px))] flex-wrap items-center gap-3' }, [
h('span', content),
guide?.action
? h(
NButton,
{
text: true,
size: 'small',
onClick: () => {
if (id.value === projectId && operation.value.error === error)
resolveOperationError()
}
},
() => guide.action
)
: null
]),
{ duration: 8000, closable: true }
)
} else if (notice && notice !== previousNotice) {
if (/生成|提交/.test(operation.value.label))
actionMessage?.info('任务已提交,完成后会显示结果。', { duration: 4000 })
else actionMessage?.success('操作已完成。', { duration: 3000 })
}
},
{ flush: 'post' }
)
/** 已知前置条件直接送达对应工作区;保留当前页面,修复后可继续原操作。 */
function resolveOperationError() {
const target = operationGuide.value?.target
@@ -191,7 +235,7 @@ onScopeDispose(() => {
</NPageHeader>
</header>
<NScrollbar
v-if="context.error.value || operation.pending || operation.error || operation.notice"
v-if="context.error.value || operation.pending || (!quietFeedback && (operation.error || operation.notice))"
class="project-notices"
content-class="project-notices-content"
>
@@ -204,7 +248,7 @@ onScopeDispose(() => {
<NAlert v-if="operation.pending" :show-icon="false" role="status"
>{{ operation.label || '后台制作任务执行中' }}。可切换页面查看结果,请勿重复提交。</NAlert
>
<NAlert v-if="operationGuide" type="error" :show-icon="false" class="operation-guide">
<NAlert v-if="operationGuide && !quietFeedback" type="error" :show-icon="false" class="operation-guide">
<div class="operation-guide-content">
<div>
<strong>{{ operationGuide.title }}</strong>
@@ -215,7 +259,9 @@ onScopeDispose(() => {
}}</NButton>
</div>
</NAlert>
<NAlert v-if="operation.notice" :show-icon="false" role="status">{{ operation.notice }}</NAlert>
<NAlert v-if="operation.notice && !quietFeedback" :show-icon="false" role="status">{{
operation.notice
}}</NAlert>
</NScrollbar>
<WorkflowExecutionPanel
v-if="isCreation && createDramaExecution.executionId.value"
+4 -15
View File
@@ -19,11 +19,8 @@ import SubjectCoverageAudit from './components/SubjectCoverageAudit.vue'
import type { SubjectCoverageIssue } from './coverage.types'
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
import { useStoryboard } from './useStoryboard'
import { useProjectContext } from '../projects/context'
const detailTab = ref('design')
const projectContext = useProjectContext()
const stageComplete = computed(() => projectContext.stageReadiness.value?.storyboard.ready === true)
/** 分镜工作区按单集查看正式数据,生成配置与镜头检查分开。 */
const {
@@ -59,7 +56,7 @@ const coverage = computed(() => [
total: data.value?.directions.shotCount ?? 0
},
{
title: '即时状态',
title: '画面状态',
count: data.value?.visualStates.visualStateCount ?? 0,
total: data.value?.visualStates.shotCount ?? 0
}
@@ -148,10 +145,6 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
<NAlert v-if="episodeSourceUnavailable" type="info" :show-icon="false">
本集镜头已重新生成。新标题和剧情详情尚未提供,当前只显示正式镜头编号;请按实际生成规格核对内容。
</NAlert>
<NAlert v-if="stageComplete" type="success" :show-icon="false">
分镜设计已经准备完成,可以继续生成首帧、视频提示词和视频。
<RouterLink :to="`/projects/${id}/production`" class="text-button ml-2">继续镜头生产 →</RouterLink>
</NAlert>
</template>
<template #header
><div class="workspace-toolbar">
@@ -438,7 +431,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
<h3>
镜头目录 <span>{{ shots.length }} 镜</span>
</h3>
<span>按 Beat 排列</span>
<span>按段落排列</span>
</div>
<NScrollbar
class="panel-scroll directory-scroll"
@@ -462,7 +455,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
<NScrollbar v-if="shot" class="panel-scroll" content-class="p-5 lg:p-7">
<header class="mb-6">
<p class="eyebrow">
BEAT {{ shot.beatNo }} / SHOT {{ shot.shotNo }}
段落 {{ shot.beatNo }} · 镜头 {{ shot.shotNo }}
<span v-if="shot.durationSeconds" class="ml-3">{{ shot.durationSeconds }}s</span>
</p>
<h3 class="mt-2 text-lg font-semibold">{{ shot.title }}</h3>
@@ -472,10 +465,6 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
<p v-if="shot.visualFocus" class="mt-2 text-xs leading-6 text-muted">
视觉重点:{{ shot.visualFocus }}
</p>
<p class="mt-3 break-all font-mono text-[10px] text-muted">Shot ID · {{ shot.shotId }}</p>
<p v-if="!episodeSourceUnavailable" class="mt-1 text-[10px] text-muted">
标题与剧情描述取自最近可用 Breakdown 快照;以下设计与状态取自数据库。
</p>
</header>
<div>
<NTabs v-model:value="detailTab" type="line" size="small" aria-label="镜头详情"
@@ -504,7 +493,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
<EmptyState
v-else-if="data"
title="本集还没有正式分镜"
description="先完成剧本拆解与分镜持久化,再回来生成导演设计和即时状态。"
description="先完成剧本拆解,再回来完善镜头设计和画面状态。"
><RouterLink :to="`/projects/${id}/breakdown`" class="button button-secondary mt-4"
>前往拆解</RouterLink
></EmptyState
@@ -32,7 +32,7 @@ const groups = computed(() => {
:aria-labelledby="`${directoryId}-beat-${group.beatNo}`"
>
<h4 :id="`${directoryId}-beat-${group.beatNo}`" class="directory-group-heading">
<span>BEAT {{ String(group.beatNo).padStart(2, '0') }}</span>
<span>段落 {{ String(group.beatNo).padStart(2, '0') }}</span>
<span class="directory-group-count">{{ group.shots.length }} 镜</span>
</h4>
<div class="beat-directory-items">
@@ -41,13 +41,13 @@ const groups = computed(() => {
:key="shot.shotId"
:active="activeId === shot.shotId"
:class="itemClass"
:aria-label="`BEAT ${group.beatNo} · 镜头 ${shot.shotNo} · ${shot.title}`"
:aria-label="`段落 ${group.beatNo} · 镜头 ${shot.shotNo} · ${shot.title}`"
@click="emit('select', shot.shotId)"
>
{{ shot.title }}
<template #eyebrow>
<!-- 窄屏目录变为横向条目时补回归属,桌面不重复显示分组编号。 -->
<span class="directory-mobile-beat">BEAT {{ String(group.beatNo).padStart(2, '0') }} / </span>
<span class="directory-mobile-beat">段落 {{ String(group.beatNo).padStart(2, '0') }} / </span>
<span class="directory-shot-number">镜头 {{ String(shot.shotNo).padStart(2, '0') }}</span>
</template>
<template #meta><slot name="meta" :shot="shot" /></template>
@@ -10,9 +10,7 @@ defineProps<{ shot: DesignedShot }>()
<template>
<div class="space-y-7">
<section>
<h3 class="mb-4 text-sm font-semibold">
导演摄影设计 <span class="ml-2 font-mono text-[10px] font-normal text-muted">Direction</span>
</h3>
<h3 class="mb-4 text-sm font-semibold">导演摄影设计</h3>
<template v-if="shot.direction"
><div class="mb-5 flex flex-wrap gap-2">
<NTag
@@ -41,9 +39,7 @@ defineProps<{ shot: DesignedShot }>()
<p v-else class="text-sm text-muted">此镜头尚无已保存的导演设计。</p>
</section>
<section class="pt-6">
<h3 class="mb-4 text-sm font-semibold">
即时视觉状态 <span class="ml-2 font-mono text-[10px] font-normal text-muted">VisualState</span>
</h3>
<h3 class="mb-4 text-sm font-semibold">画面状态</h3>
<template v-if="shot.visualState"
><dl class="detail-grid">
<dt>时间</dt>
@@ -82,9 +78,7 @@ defineProps<{ shot: DesignedShot }>()
</dl>
</article></template
>
<p v-else class="text-sm leading-6 text-muted">
此镜头尚无已保存的即时状态。先补齐本集导演设计,再生成 VisualState。
</p>
<p v-else class="text-sm leading-6 text-muted">此镜头还没有画面状态,请先完成镜头设计。</p>
</section>
</div>
</template>
@@ -31,7 +31,6 @@ 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 CreativeProfileSettings from '../generation-config/components/CreativeProfileSettings.vue'
import type { IdentitySubject } from './types'
/** 主体身份工作区按正式主体聚合,不把同一主体的多个 Form 当成不同身份。 */
@@ -290,11 +289,6 @@ function runNextAction() {
})
}
}
async function profileSaved() {
operation.value.error = ''
await profileQuery.refresh()
}
</script>
<template>
@@ -329,11 +323,7 @@ async function profileSaved() {
title="角色选角总览与批量操作"
:has-receipt="!!session.receipt"
>
<CreativeProfileSettings
:project-id="projectId"
:disabled="operation.pending"
@saved="profileSaved"
/>
<!-- 以下是主体身份说明与选角批量操作模块 -->
<div class="identity-tools-intro flex flex-wrap items-end justify-between gap-4">
<div>
<h2 class="text-lg font-semibold">主体身份</h2>
@@ -92,9 +92,11 @@ const rules = {}
</script>
<template>
<!-- 以下是宽版形态图片生成弹窗模块,长提示词与模型参数保留完整空间 -->
<AppDialog
v-model:open="open"
title="生成形态图片"
wide
:description="`${form?.subject.name || ''} · ${form?.name || ''}`"
>
<AppForm
+8 -3
View File
@@ -21,12 +21,16 @@ export type OperationRecovery = {
/** 按项目而非 graph 上锁,防止改写剧本与拆解同时提交。 */
const operations = reactive<Record<string, Operation>>({})
/** 取得项目操作状态,不向浏览器持久化虚假的后台运行状态。 */
/**
* 取得项目响应式操作状态,首次创建也返回代理,使操作反馈及时更新。
* @param projectId 当前项目编号
* @returns 当前项目响应式操作状态
*/
export function getOperation(projectId: string): Operation {
if (operations[projectId]) return operations[projectId]
/** 当前 HTTP 操作锁与持久化后台活动锁合并,后台结束前不能重复启动付费操作。 */
let requestPending = false
return (operations[projectId] = {
operations[projectId] = {
/** 当前项目是否有短请求或后台任务仍在执行。 */
get pending() {
return requestPending || hasActiveWorkflowExecution(projectId)
@@ -39,7 +43,8 @@ export function getOperation(projectId: string): Operation {
error: '',
notice: '',
recovery: null
})
}
return operations[projectId]
}
/** 只提交一次;断网不自动重试,后台是否已执行由刷新后的 checkpoint 确认。 */
@@ -0,0 +1,46 @@
import { describe, expect, it } from 'vitest'
import { productionMessage, productionIssueText } from '../../../src/features/production/production-messages'
/** 真实后端首帧问题改为中文处理建议,不暴露实现名称和内部编号。 */
describe('镜头生产用户提示', () => {
it('就绪问题和素材查询的质量失败使用同一中文提示,方便页面去重', () => {
const expected = '首帧画面检查未通过,请重新生成或修复首帧。'
expect(
productionIssueText({
code: 'failed_keyframe_quality',
reason: 'Primary Keyframe 最新视觉质量校验未通过,请先重新生成合格首帧'
})
).toBe(expected)
expect(
productionMessage(
'Storyboard Shot Primary Keyframe 最新视觉校验未通过,请先修复首帧: cmunpp5b7003hk6ldk2ekw3k5'
)
).toBe(expected)
})
it('提示词与新首帧不匹配时说明更新哪个内容', () => {
expect(
productionMessage(
'Storyboard Shot Video Prompt 未绑定当前 Primary Keyframe,请先重新生成 Video Prompt: cmunpp5b7003hk6ldk2ekw3k5'
)
).toBe('视频提示词与当前首帧不一致,请重新生成视频提示词。')
})
it('位置绑定变化说明需要更新首帧,不显示英文接口术语', () => {
expect(productionMessage('Primary Keyframe 的空间目标绑定已变化,需要重新生成并校验首帧')).toBe(
'镜头画面设置已调整,请重新生成并检查首帧。'
)
})
it('保留已有中文原因并移除内部镜头编号', () => {
expect(productionMessage('主体参考图已更新: cmunpp5b7003hk6ldk2ekw3k5')).toBe('主体参考图已更新')
})
it('英文连接失败转为可操作提示', () => {
expect(productionMessage('fetch failed')).toBe('暂时无法连接服务,请稍后重新获取。')
})
it('视频自己的检查问题保留视频对象,不误写成首帧问题', () => {
const message = '视频画面检查未通过,请重新生成视频。'
expect(productionMessage(message)).toBe(message)
})
it('后台状态不确定时保留不要重复提交的提醒', () => {
const message = '请求等待超时。后台任务可能仍在运行,请先刷新状态,不要重复提交。'
expect(productionMessage(message)).toBe(message)
})
})
+1 -2
View File
@@ -46,9 +46,8 @@ describe('镜头生产数据契约', () => {
expect(source).toMatch(/\.generation-input-mode-label\s*\{[^}]*mb-\[7px\][^}]*text-xs/)
})
it('首帧、素材引用和视频使用固定上限的正方形网格,不随少量记录撑满整行', () => {
it('主首帧、素材引用和视频使用固定上限的正方形网格,不随少量记录撑满整行', () => {
const source = readFileSync('src/features/production/components/ShotProductionAssets.vue', 'utf8')
expect(source).toContain('v-if="keyframeCandidates.length" class="keyframe-grid mt-4"')
expect(source).toContain('v-if="videos.length" class="video-grid mt-4"')
expect(source).toMatch(
/\.keyframe-grid\s*\{[^}]*grid-template-columns:\s*repeat\(auto-fill, minmax\(180px, 220px\)\)/
@@ -133,8 +133,10 @@ describe('精简公开资产回归', () => {
.find(item => item.text().includes('管理候选'))!
.trigger('click')
await flushPromises()
expect(document.body.textContent).toContain('模型输入变体')
expect(wrapper.findAll('button').some(button => button.text() === '设为主首帧')).toBe(false)
expect(document.body.textContent).toContain('视频参考图')
expect([...document.querySelectorAll('button')].some(button => button.textContent === '设为主首帧')).toBe(
false
)
} finally {
wrapper.unmount()
}
+7 -4
View File
@@ -1,6 +1,6 @@
import { h } from 'vue'
import { createMemoryHistory, createRouter } from 'vue-router'
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
import { DOMWrapper, flushPromises, mount, type VueWrapper } from '@vue/test-utils'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { readFileSync } from 'node:fs'
import App from '@/App.vue'
@@ -291,9 +291,12 @@ describe('剧本完成前的下游访问限制', () => {
})
await flushPromises()
expect(wrapper!.get('.operation-guide').text()).toContain('缺少镜头主首帧')
expect(wrapper!.get('.operation-guide').text()).toContain('先生成并确认主首帧')
await wrapper!.get('.operation-guide button').trigger('click')
/** 操作失败改为临时消息,但保留直接定位首帧生成的恢复入口。 */
const message = new DOMWrapper(document.querySelector('.n-message')!)
expect(wrapper!.find('.operation-guide').exists()).toBe(false)
expect(message.text()).toContain('还没有可用首帧,请先生成并确认首帧。')
expect(message.get('button').text()).toBe('先生成主首帧')
await message.get('button').trigger('click')
await flushPromises()
expect(router.currentRoute.value.path).toBe(`/projects/${projectId}/production`)
+3 -3
View File
@@ -20,9 +20,9 @@ describe('Beat 两级镜头目录', () => {
})
const groups = wrapper.findAll('.beat-directory-group')
expect(groups).toHaveLength(2)
expect(groups[0]!.get('h4').text()).toContain('BEAT 01')
expect(groups[0]!.get('h4').text()).toContain('段落 01')
expect(groups[0]!.get('.directory-group-count').text()).toBe('2 镜')
expect(groups[1]!.get('h4').text()).toContain('BEAT 02')
expect(groups[1]!.get('h4').text()).toContain('段落 02')
expect(groups[1]!.get('.directory-group-count').text()).toBe('1 镜')
expect(wrapper.findAll('.directory-shot-number').map(item => item.text())).toEqual([
'镜头 01',
@@ -43,7 +43,7 @@ describe('Beat 两级镜头目录', () => {
activeId: 'b2-s1',
shots: [...shots, { ...designedShot('b2-s2'), beatNo: 2, shotNo: 2 }]
})
expect(wrapper.get('.selected').attributes('aria-label')).toBe('BEAT 2 · 镜头 1 · 来信')
expect(wrapper.get('.selected').attributes('aria-label')).toBe('段落 2 · 镜头 1 · 来信')
expect(wrapper.findAll('.selected')).toHaveLength(1)
expect(wrapper.findAll('.directory-group-count')[1]!.text()).toBe('2 镜')
})
@@ -9,6 +9,7 @@ import { referenceLocation, referenceTargets } from '@/features/production/asset
import StaleKeyframeNotice from '@/features/production/components/StaleKeyframeNotice.vue'
import SubjectImagesPage from '@/features/subject-images/SubjectImagesPage.vue'
import ProductionPage from '@/features/production/ProductionPage.vue'
import ShotProductionAssets from '@/features/production/components/ShotProductionAssets.vue'
import ImageGalleryDialog from '@/features/subject-images/components/ImageGalleryDialog.vue'
import type { CreativeProfile, GenerationModelCatalog } from '@/features/generation-config/types'
import { directionsResult, storyboardCheckpoint } from '@/features/storyboard/testing/fixtures'
@@ -563,7 +564,10 @@ describe('过期首帧到具体素材定位', () => {
global: { plugins: [router], provide: { [projectContextKey as symbol]: context } }
})
await flushPromises()
expect(wrapper!.get('.production-detail').text()).toContain(target.shotId)
/** 正式编号只用于选择和请求,不作为普通用户可见文案。 */
expect(wrapper!.getComponent(ShotProductionAssets).props('shot').shotId).toBe(target.shotId)
expect(wrapper!.get('.production-detail').text()).toContain('第2集镜头2')
expect(wrapper!.get('.production-detail').text()).not.toContain(target.shotId)
expect(fetcher.mock.calls.some(([url]) => String(url).includes('episodeNo=2'))).toBe(true)
expect(fetcher.mock.calls.every(([, init]) => init?.method === 'GET')).toBe(true)
})
+7 -3
View File
@@ -13,6 +13,7 @@ import type { ProjectDetail } from '@/features/projects/types'
import type { Checkpoint } from '@/features/workflows/types'
import StoryboardPage from '@/features/storyboard/StoryboardPage.vue'
import ShotTools from '@/features/storyboard/components/ShotTools.vue'
import ShotDesign from '@/features/storyboard/components/ShotDesign.vue'
import {
designedShot,
directionsResult,
@@ -1416,8 +1417,10 @@ describe('工作台页面交互', () => {
)
)
await flushPromises()
expect(wrapper!.text()).toContain('shot-db-2-1')
expect(wrapper!.text()).not.toContain('shot-db-1-1')
/** 用当前设计组件的正式镜头验证迟到响应隔离,不依赖已隐藏的内部编号文案。 */
expect(wrapper!.getComponent(ShotDesign).props('shot').shotId).toBe('shot-db-2-1')
expect(wrapper!.text()).toContain('第2集镜头1')
expect(wrapper!.text()).not.toContain('第1集镜头1')
expect(fetcher.mock.calls).toHaveLength(4)
})
@@ -1442,7 +1445,8 @@ describe('工作台页面交互', () => {
button('重试查询').click()
await flushPromises()
expect(button('补齐项目导演设计').disabled).toBe(false)
expect(wrapper!.text()).toContain('shot-db-1-1')
/** 重试恢复正式镜头数据,内部编号仍用于业务选择。 */
expect(wrapper!.getComponent(ShotDesign).props('shot').shotId).toBe('shot-db-1-1')
})
it('镜头工具按需 GET,切换镜头会废弃旧参考图,未完成设计不能编译规格', async () => {
+2
View File
@@ -9,6 +9,8 @@ export default defineConfig({
test: {
environment: 'happy-dom',
restoreMocks: true,
/** 只收集正式测试目录,避免把包管理缓存中的旧项目快照作为当前测试。 */
include: ['tests/**/*.test.ts'],
/** 只检查当前 checkout,避免收集其它隔离 worktree 中的重复测试。 */
exclude: [...configDefaults.exclude, '**/.worktrees/**', '**/.worktree/**']
}