1042 lines
56 KiB
Vue
1042 lines
56 KiB
Vue
<script setup lang="ts">
|
||
import AppForm from '../../components/ui/AppForm.vue'
|
||
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,
|
||
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'
|
||
import BeatShotDirectory from '../storyboard/components/BeatShotDirectory.vue'
|
||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||
import { productionStatusLabel } from './model'
|
||
import { useProduction } from './useProduction'
|
||
import ProductionReceipt from './components/ProductionReceipt.vue'
|
||
import ShotProductionAssets from './components/ShotProductionAssets.vue'
|
||
import ActionMenu from '../../components/ui/ActionMenu.vue'
|
||
import AdvancedProduction from './components/AdvancedProduction.vue'
|
||
import StaleKeyframeNotice from './components/StaleKeyframeNotice.vue'
|
||
import { routeLocationKey } from 'vue-router'
|
||
import { queryText } from './asset-links'
|
||
import QualityDialog from './components/QualityDialog.vue'
|
||
import EpisodeAssemblyPanel from './components/EpisodeAssemblyPanel.vue'
|
||
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||
import { useWorkflowExecution } from '../workflows/execution'
|
||
const qualityOpen = ref(false)
|
||
|
||
/** 镜头生产页将项目批处理与单镜头资产管理放在同一条可核验链路中。 */
|
||
const {
|
||
id,
|
||
selectedEpisode,
|
||
selectedShot,
|
||
episodeNo,
|
||
episodeOptions,
|
||
shots,
|
||
shot,
|
||
promptItem,
|
||
keyframeExecution,
|
||
keyframeItem,
|
||
videoItem,
|
||
videoStatusItem,
|
||
query,
|
||
episodeSourceUnavailable,
|
||
operation,
|
||
session,
|
||
concurrency,
|
||
force,
|
||
keyframeLimit,
|
||
keyframeWidth,
|
||
keyframeHeight,
|
||
promptLimit,
|
||
videoLimit,
|
||
videoRepairAttempts,
|
||
videoInputMode,
|
||
keyframeValid,
|
||
promptValid,
|
||
videoQualityValid,
|
||
batchValid,
|
||
blocked,
|
||
run,
|
||
promptExecution,
|
||
videoExecution
|
||
} = useProduction()
|
||
/** 当前镜头资产组件引用,标题菜单仅操作此镜头的只读检查弹窗。 */
|
||
const shotAssetsRef = ref<InstanceType<typeof ShotProductionAssets> | null>(null)
|
||
/** 标题状态只描述最近视频任务,不能表示质量通过或当前主视频仍可用。 */
|
||
const latestVideoTaskLabel = computed(() =>
|
||
videoStatusItem.value?.status === 'completed'
|
||
? '最近视频任务:生成完成'
|
||
: `最近视频任务:${productionStatusLabel(videoStatusItem.value?.status ?? 'not_started')}`
|
||
)
|
||
/** 首帧质量任务在关闭弹窗后仍可观察,刷新页面后恢复持久化句柄。 */
|
||
const keyframeQualityExecution = useWorkflowExecution(id, 'keyframe-quality')
|
||
|
||
/**
|
||
* 将首帧质量启动句柄交给页面级观察器,始终保存当前原项目归属。
|
||
* @param executionId 后端返回的真实任务编号
|
||
* @returns 当前观察状态刷新完成
|
||
*/
|
||
async function trackKeyframeQuality(executionId: string) {
|
||
await keyframeQualityExecution.track(executionId, id.value)
|
||
}
|
||
|
||
/** 后台首帧质量结束后刷新当前项目资产,不把开始任务当作完成。 */
|
||
watch(
|
||
() => keyframeQualityExecution.query.data.value?.status,
|
||
status => {
|
||
const record = keyframeQualityExecution.query.data.value
|
||
if (record?.projectId === id.value && (status === 'completed' || status === 'failed')) void refreshProject()
|
||
}
|
||
)
|
||
const route = inject(routeLocationKey, undefined)
|
||
const linkedShotMissing = computed(
|
||
() =>
|
||
queryText(route?.query.shotId) &&
|
||
query.data.value &&
|
||
!shots.value.some(item => item.shotId === selectedShot.value)
|
||
)
|
||
const openRequestedKeyframe = computed(
|
||
() => queryText(route?.query.action) === 'keyframe' && queryText(route?.query.shotId) === shot.value?.shotId
|
||
)
|
||
const staleVideos = computed(() => query.data.value?.videos.stalePrimaryVideo ?? 0)
|
||
const episodePromptReadiness = computed(() => {
|
||
const source = query.data.value?.prompts
|
||
if (!source) return undefined
|
||
const items = source.items.filter(item => item.episodeNo === episodeNo.value)
|
||
return {
|
||
...source,
|
||
items,
|
||
total: items.length,
|
||
ready: items.filter(item => item.status === 'ready').length,
|
||
skipped: items.filter(item => item.status === 'skipped').length,
|
||
blocked: items.filter(item => item.status === 'blocked').length
|
||
}
|
||
})
|
||
const episodeVideoReadiness = computed(() => {
|
||
const source = query.data.value?.videos
|
||
if (!source) return undefined
|
||
const items = source.items.filter(item => item.episodeNo === episodeNo.value)
|
||
return {
|
||
...source,
|
||
items,
|
||
total: items.length,
|
||
ready: items.filter(item => item.status === 'ready').length,
|
||
skipped: items.filter(item => item.status === 'skipped').length,
|
||
inProgress: items.filter(item => item.status === 'in_progress').length,
|
||
blocked: items.filter(item => item.status === 'blocked').length
|
||
}
|
||
})
|
||
const inputPlan = computed(() => query.data.value?.videoInputPlans)
|
||
const selectedPlanCount = computed(() => {
|
||
if (videoInputMode.value === 'first_frame') return inputPlan.value?.firstFrameCount ?? 0
|
||
if (videoInputMode.value === 'omni_reference') return inputPlan.value?.omniReferenceCount ?? 0
|
||
return inputPlan.value?.readyCount ?? episodeVideoReadiness.value?.ready ?? 0
|
||
})
|
||
const videoInputModeLabel = computed(() => {
|
||
if (videoInputMode.value === 'first_frame') return '首帧模式'
|
||
if (videoInputMode.value === 'omni_reference') return '全模态参考'
|
||
return '全部推荐模式'
|
||
})
|
||
const stages = computed(() => {
|
||
const data = query.data.value
|
||
return [
|
||
{
|
||
key: 'prompts' as const,
|
||
code: '01',
|
||
title: '视频提示词',
|
||
description: '检查镜头设计和主体参考图后,生成视频运动描述。',
|
||
icon: MessageSquareText,
|
||
data: episodePromptReadiness.value,
|
||
done: episodePromptReadiness.value?.skipped ?? 0,
|
||
action: force.value ? '重生成全部提示词' : '补齐视频提示词'
|
||
},
|
||
{
|
||
key: 'keyframes' as const,
|
||
code: '02',
|
||
title: '镜头首帧',
|
||
description: '合并视觉风格、镜头规格和主体参考图,调用图片模型生成。',
|
||
icon: Image,
|
||
data: data?.keyframes,
|
||
done: data?.keyframes.skipped ?? 0,
|
||
action: force.value ? '为全部镜头新增首帧' : '补齐 / 更新主首帧'
|
||
},
|
||
{
|
||
key: 'videos' as const,
|
||
code: '03',
|
||
title: '视频成片',
|
||
description: '生成质量候选,完成后自动校验;失败时有限修复,通过后才晋升主视频。',
|
||
icon: Film,
|
||
data: episodeVideoReadiness.value,
|
||
done: episodeVideoReadiness.value?.skipped ?? 0,
|
||
action: force.value
|
||
? '新增项目质量视频候选'
|
||
: staleVideos.value > 0
|
||
? `更新 ${staleVideos.value} 个过期主视频`
|
||
: '提交视频质量任务'
|
||
}
|
||
]
|
||
})
|
||
const selectedIssues = computed(() =>
|
||
[promptItem.value, keyframeItem.value, videoItem.value].flatMap(item => item?.issues ?? [])
|
||
)
|
||
const selectedKeyframeStale = computed(
|
||
() =>
|
||
!!keyframeItem.value?.primaryKeyframeStale ||
|
||
selectedIssues.value.some(issue => issue.code === 'stale_keyframe')
|
||
)
|
||
const videoRunning = computed(
|
||
() =>
|
||
(query.data.value?.videoStatus.pending ?? 0) +
|
||
(query.data.value?.videoStatus.queued ?? 0) +
|
||
(query.data.value?.videoStatus.running ?? 0)
|
||
)
|
||
const identityBlocked = computed(
|
||
() =>
|
||
(query.data.value?.keyframes.missingIdentity ?? 0) +
|
||
(query.data.value?.keyframes.missingIdentityAnchor ?? 0) +
|
||
(query.data.value?.keyframes.identityUnlocked ?? 0)
|
||
)
|
||
const staleKeyframes = computed(() => query.data.value?.keyframes.stalePrimaryKeyframe ?? 0)
|
||
const invalidGenerationSpecs = computed(
|
||
() =>
|
||
(query.data.value?.keyframes.invalidGenerationSpec ?? 0) +
|
||
(query.data.value?.prompts.invalidGenerationSpec ?? 0)
|
||
)
|
||
/** 父页查询包含整个项目的就绪统计,单镜头变更后立即刷新。 */
|
||
function refreshProject() {
|
||
void query.refresh()
|
||
}
|
||
/** 从质量回执定位本集正式镜头,关闭弹窗不会触发任何生成请求。 */
|
||
function locateQualityShot(shotId: string) {
|
||
selectedShot.value = shotId
|
||
qualityOpen.value = false
|
||
}
|
||
/** 新回执自动展开,避免折叠区隐藏部分失败诊断。 */
|
||
const toolsOpen = ref(false)
|
||
watch(
|
||
() => session.value.receipt,
|
||
receipt => {
|
||
if (receipt) {
|
||
toolsOpen.value = true
|
||
}
|
||
}
|
||
)
|
||
watch(
|
||
() => session.value.pipelineReceipt,
|
||
receipt => {
|
||
if (receipt) toolsOpen.value = true
|
||
}
|
||
)
|
||
|
||
const batchModel = computed(() => ({ concurrency: concurrency.value }))
|
||
const batchRules = { concurrency: integerRule('批量并发') }
|
||
const keyframeModel = computed(() => ({
|
||
keyframeLimit: keyframeLimit.value,
|
||
keyframeWidth: keyframeWidth.value,
|
||
keyframeHeight: keyframeHeight.value
|
||
}))
|
||
const promptModel = computed(() => ({ promptLimit: promptLimit.value }))
|
||
const dimensionRules = sizeRules(() => ({ width: keyframeWidth.value, height: keyframeHeight.value }))
|
||
const keyframeRules = {
|
||
keyframeLimit: integerRule('本批上限', 1, true),
|
||
keyframeWidth: dimensionRules.width,
|
||
keyframeHeight: dimensionRules.height
|
||
}
|
||
const promptRules = { promptLimit: integerRule('本批镜头上限') }
|
||
const videoModel = computed(() => ({
|
||
videoInputMode: videoInputMode.value,
|
||
videoLimit: videoLimit.value,
|
||
videoRepairAttempts: videoRepairAttempts.value
|
||
}))
|
||
const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairAttempts: integerRule('每镜最多自动修复') }
|
||
</script>
|
||
|
||
<template>
|
||
<WorkspacePage split compact mobile-scroll class="production-workspace-page compact-shot-workspace"
|
||
><template #header
|
||
><div class="workspace-toolbar">
|
||
<div class="toolbar-episode">
|
||
<NSelect
|
||
:value="episodeNo"
|
||
aria-label="选择生产剧集"
|
||
@update:value="selectedEpisode = Number($event)"
|
||
:options="[
|
||
...(!episodeOptions.length ? [{ label: String('暂无剧集'), value: 0 }] : []),
|
||
...episodeOptions.map(episode => ({
|
||
label: String(' 第 ' + episode.episodeNo + ' 集 · ' + episode.title),
|
||
value: episode.episodeNo
|
||
}))
|
||
]"
|
||
class="select-control"
|
||
></NSelect>
|
||
</div>
|
||
<span class="toolbar-summary"
|
||
>本集 {{ shots.length }} 镜<span v-if="videoRunning">
|
||
· {{ videoRunning }} 个视频任务进行中</span
|
||
></span
|
||
>
|
||
<div class="toolbar-actions">
|
||
<!-- 以下是移动端图标入口模块,桌面保留完整文字,手机保留中文无障碍说明 -->
|
||
<NButton
|
||
class="mobile-toolbar-icon"
|
||
:disabled="blocked || !episodeNo"
|
||
aria-label="首帧质量生成"
|
||
title="首帧质量生成"
|
||
@click="qualityOpen = true"
|
||
>
|
||
<Image :size="18" class="mobile-action-icon" />
|
||
<span class="workspace-action-label">首帧质量生成</span>
|
||
</NButton>
|
||
|
||
<WorkspaceTools
|
||
v-model:open="toolsOpen"
|
||
title="项目生产总览与批量操作"
|
||
label="批量生产"
|
||
:has-receipt="!!session.receipt || !!session.pipelineReceipt"
|
||
>
|
||
<div class="production-tools-intro workspace-panel">
|
||
<div>
|
||
<p class="eyebrow">PRODUCTION</p>
|
||
<h2 class="text-lg font-semibold">镜头生产</h2>
|
||
<p class="mt-2 text-sm text-muted">
|
||
从可生成的提示词和首帧,到异步视频任务与最终成片。
|
||
</p>
|
||
</div>
|
||
<RouterLink :to="`/projects/${id}/storyboard`" class="text-button">
|
||
<ArrowLeft :size="14" />回到分镜设计
|
||
</RouterLink>
|
||
</div>
|
||
<section class="production-batch-config workspace-panel" aria-label="项目生产配置">
|
||
<div class="production-section-heading">
|
||
<div>
|
||
<h3 class="text-sm font-semibold">批量执行设置</h3>
|
||
<p class="mt-1 text-xs text-muted">控制本次手动批处理的并发与覆盖方式。</p>
|
||
</div>
|
||
</div>
|
||
<AppForm
|
||
:model="batchModel"
|
||
:rules="batchRules"
|
||
:disabled="operation.pending"
|
||
validate-on-change
|
||
>
|
||
<div class="form-controls production-controls">
|
||
<NFormItem 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>
|
||
<NCheckbox
|
||
v-model:checked="force"
|
||
:disabled="operation.pending"
|
||
class="control-row-checkbox text-xs"
|
||
>覆盖模式:重写提示词/新增图视频候选
|
||
</NCheckbox>
|
||
</div>
|
||
</AppForm>
|
||
</section>
|
||
<div class="production-tool-stack workspace-section-stack">
|
||
<!-- 以下是生产范围说明与批量操作模块 -->
|
||
<section class="production-tool-section workspace-panel">
|
||
<h3 class="text-sm font-semibold">处理范围与覆盖规则</h3>
|
||
<p class="mt-3 text-xs leading-6 text-muted">
|
||
提示词与视频就绪检查面向全项目;视频实际提交受本批镜头上限控制,并使用严格质量流水线。首帧默认补当前剧集,存在过期主首帧时优先更新全项目过期项,覆盖模式处理全项目;过期首帧成功后会自动接替旧主图,其余新增候选。图片模型、视频模型与视觉校验均可能产生费用。
|
||
</p>
|
||
</section>
|
||
<section class="workspace-overview-panel production-tool-section workspace-panel">
|
||
<div class="overview-content workspace-section-stack">
|
||
<h3 class="text-sm font-semibold">项目生产总览与批量操作</h3>
|
||
<NAlert v-if="videoRunning" role="status" type="info" :show-icon="false">
|
||
当前有
|
||
{{ videoRunning }}
|
||
个视频任务等待或生成中。系统会持续更新任务状态,同一镜头不会重复提交。
|
||
</NAlert>
|
||
<NAlert v-if="identityBlocked" type="info" :show-icon="false">
|
||
当前有
|
||
{{ identityBlocked }}
|
||
项角色身份尚未准备完成。请先确认角色母版并完成身份锁定,再生成镜头首帧。
|
||
<RouterLink :to="`/projects/${id}/subject-identity`" class="text-button ml-2"
|
||
>前往主体身份 →</RouterLink
|
||
></NAlert
|
||
>
|
||
<NAlert v-if="invalidGenerationSpecs" type="warning" :show-icon="false">
|
||
当前有
|
||
{{ invalidGenerationSpecs }}
|
||
个镜头的设计信息还不完整。请先补齐镜头设计和即时视觉状态。
|
||
<RouterLink :to="`/projects/${id}/storyboard`" class="text-button ml-2">
|
||
前往分镜设计 →
|
||
</RouterLink>
|
||
</NAlert>
|
||
<NAlert v-if="staleKeyframes" role="status" type="info" :show-icon="false">
|
||
当前有
|
||
{{ staleKeyframes }}
|
||
个主首帧已过期。它们使用的主体参考资产已经变化,视频阶段会被阻止;可在下方逐镜重新生成,或使用“补齐
|
||
/ 更新主首帧”批量处理。
|
||
</NAlert>
|
||
<NAlert v-if="staleVideos" role="status" type="info" :show-icon="false">
|
||
当前有
|
||
{{ staleVideos }}
|
||
个主视频已过期。它们使用的主首帧或主体参考图已经变化;非覆盖模式批量生成时会只重建这些过期主视频。
|
||
</NAlert>
|
||
<ProductionReceipt v-if="session.receipt" :receipt="session.receipt" />
|
||
<WorkflowExecutionPanel
|
||
v-if="promptExecution.executionId.value"
|
||
title="视频提示词任务"
|
||
:execution="promptExecution.query.data.value"
|
||
:loading="promptExecution.query.loading.value"
|
||
:error="promptExecution.query.error.value"
|
||
@refresh="promptExecution.query.refresh"
|
||
@dismiss="promptExecution.dismiss"
|
||
/>
|
||
<WorkflowExecutionPanel
|
||
v-if="videoExecution.executionId.value"
|
||
title="视频质量任务"
|
||
:execution="videoExecution.query.data.value"
|
||
:loading="videoExecution.query.loading.value"
|
||
:error="videoExecution.query.error.value"
|
||
@refresh="videoExecution.query.refresh"
|
||
@dismiss="videoExecution.dismiss"
|
||
/>
|
||
<div v-if="query.data.value" class="production-pipeline">
|
||
<article
|
||
v-for="stage in stages"
|
||
:key="stage.key"
|
||
class="production-pipeline-card"
|
||
>
|
||
<div class="flex items-start justify-between gap-3">
|
||
<div class="flex items-start gap-3">
|
||
<span class="production-step"
|
||
><component :is="stage.icon" :size="17"
|
||
/></span>
|
||
<div>
|
||
<p class="eyebrow">STEP {{ stage.code }}</p>
|
||
<h3 class="mt-2 text-sm font-semibold">
|
||
{{ stage.title }}
|
||
</h3>
|
||
</div>
|
||
</div>
|
||
<span class="font-mono text-xs text-muted"
|
||
>{{ stage.done }} / {{ stage.data?.total ?? 0 }}</span
|
||
>
|
||
</div>
|
||
<p class="min-h-10 text-xs leading-5 text-muted">
|
||
{{ stage.description }}
|
||
</p>
|
||
<NProgress
|
||
:aria-label="`${stage.title}完成数量`"
|
||
type="line"
|
||
:show-indicator="false"
|
||
:height="4"
|
||
:percentage="
|
||
Math.min(
|
||
100,
|
||
Math.max(
|
||
0,
|
||
(stage.done /
|
||
Math.max(1, Math.max(stage.data?.total ?? 0, 1))) *
|
||
100
|
||
)
|
||
)
|
||
"
|
||
></NProgress>
|
||
<dl class="production-stats">
|
||
<div>
|
||
<dt>可执行</dt>
|
||
<dd>{{ stage.data?.ready ?? 0 }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt>已有结果</dt>
|
||
<dd>{{ stage.data?.skipped ?? 0 }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt>阻塞</dt>
|
||
<dd>{{ stage.data?.blocked ?? 0 }}</dd>
|
||
</div>
|
||
</dl>
|
||
<p
|
||
v-if="stage.key === 'keyframes' && staleKeyframes"
|
||
class="text-[11px] leading-5"
|
||
>
|
||
已过期 {{ staleKeyframes }} · 会按当前主体参考资产重新生成
|
||
</p>
|
||
<p
|
||
v-if="stage.key === 'videos' && staleVideos"
|
||
class="text-[11px] leading-5"
|
||
>
|
||
主视频已过期 {{ staleVideos }} · 会按当前主首帧与参考资产重新生成
|
||
</p>
|
||
<p
|
||
v-if="stage.key === 'keyframes' && identityBlocked"
|
||
class="text-[11px] leading-5 text-danger"
|
||
>
|
||
身份缺失
|
||
{{ query.data.value?.keyframes.missingIdentity ?? 0 }} · 母版缺失
|
||
{{ query.data.value?.keyframes.missingIdentityAnchor ?? 0 }} · 未锁定
|
||
{{ query.data.value?.keyframes.identityUnlocked ?? 0 }}
|
||
</p>
|
||
<ConfirmAction
|
||
:label="stage.action"
|
||
:disabled="
|
||
blocked ||
|
||
!batchValid ||
|
||
(stage.key === 'prompts' && !promptValid) ||
|
||
(stage.key === 'keyframes' && !keyframeValid) ||
|
||
(stage.key === 'videos' && !videoQualityValid) ||
|
||
(stage.key === 'videos' && !selectedPlanCount) ||
|
||
!(stage.data?.ready ?? 0)
|
||
"
|
||
acknowledgement
|
||
:description="
|
||
stage.key === 'videos'
|
||
? staleVideos && !force
|
||
? `只处理第 ${episodeNo} 集的${videoInputModeLabel},其中至多 ${videoLimit || '—'} 个过期镜头会启动严格质量流水线;通过后才接替旧主视频。`
|
||
: `只处理第 ${episodeNo} 集的${videoInputModeLabel},本批至多 ${videoLimit || '—'} 镜。最多自动修复 ${videoRepairAttempts || '—'} 次,通过后才晋升主视频。`
|
||
: stage.key === 'keyframes'
|
||
? `处理缺失或过期主首帧。过期首帧成功后自动接替旧主图(覆盖模式也如此),其余已有主图只新增候选。本批上限:${keyframeLimit || '不限制'};尺寸:${keyframeWidth && keyframeHeight ? `${keyframeWidth} × ${keyframeHeight}` : '项目默认'}。`
|
||
: `只处理第 ${episodeNo} 集中通过就绪检查的镜头,本批最多 ${promptLimit || '—'} 镜;覆盖模式会重写已有提示词。`
|
||
"
|
||
:primary="stage.key === 'videos'"
|
||
@confirm="run(stage.key)"
|
||
/>
|
||
<AppForm
|
||
v-if="stage.key === 'prompts'"
|
||
:model="promptModel"
|
||
:rules="promptRules"
|
||
:disabled="operation.pending"
|
||
validate-on-change
|
||
class="grid gap-3"
|
||
>
|
||
<NFormItem path="promptLimit" label="本批镜头上限"
|
||
><NInputNumber
|
||
v-model:value="promptLimit"
|
||
:min="1"
|
||
:precision="0"
|
||
:disabled="operation.pending"
|
||
:input-props="{ 'aria-label': '视频提示词本批镜头上限' }"
|
||
/></NFormItem>
|
||
</AppForm>
|
||
<AppForm
|
||
v-if="stage.key === 'keyframes'"
|
||
:model="keyframeModel"
|
||
:rules="keyframeRules"
|
||
:disabled="operation.pending"
|
||
validate-on-change
|
||
class="grid gap-3"
|
||
>
|
||
<NFormItem path="keyframeLimit" label="本批上限(可选)"
|
||
><NInputNumber
|
||
:input-props="{ 'aria-label': '本批上限(可选)' }"
|
||
:value="keyframeLimit === '' ? null : keyframeLimit"
|
||
@update:value="keyframeLimit = $event ?? ''"
|
||
:min="1"
|
||
:precision="0"
|
||
:disabled="operation.pending"
|
||
placeholder="留空不限制"
|
||
/></NFormItem>
|
||
<div class="grid grid-cols-2 gap-3">
|
||
<NFormItem path="keyframeWidth" label="宽度(像素)"
|
||
><NInputNumber
|
||
:input-props="{ 'aria-label': '宽度(像素)' }"
|
||
:value="keyframeWidth === '' ? null : keyframeWidth"
|
||
@update:value="keyframeWidth = $event ?? ''"
|
||
:min="1"
|
||
:disabled="operation.pending"
|
||
placeholder="默认" /></NFormItem
|
||
><NFormItem path="keyframeHeight" label="高度(像素)"
|
||
><NInputNumber
|
||
:input-props="{ 'aria-label': '高度(像素)' }"
|
||
:value="keyframeHeight === '' ? null : keyframeHeight"
|
||
@update:value="keyframeHeight = $event ?? ''"
|
||
:min="1"
|
||
:disabled="operation.pending"
|
||
placeholder="默认"
|
||
/></NFormItem>
|
||
</div>
|
||
</AppForm>
|
||
<AppForm
|
||
v-if="stage.key === 'videos'"
|
||
:model="videoModel"
|
||
:rules="videoRules"
|
||
:disabled="operation.pending"
|
||
validate-on-change
|
||
class="grid gap-3"
|
||
>
|
||
<div class="video-input-plan-summary" aria-label="视频输入规划">
|
||
<div>
|
||
<span>首帧模式</span>
|
||
<strong>{{ inputPlan?.firstFrameCount ?? 0 }}</strong>
|
||
</div>
|
||
<div>
|
||
<span>全模态参考</span>
|
||
<strong>{{ inputPlan?.omniReferenceCount ?? 0 }}</strong>
|
||
</div>
|
||
</div>
|
||
<NAlert
|
||
v-if="query.data.value?.videoInputPlansError"
|
||
type="warning"
|
||
:show-icon="false"
|
||
class="text-xs"
|
||
>
|
||
输入规划暂不可用,仍可按“全部推荐模式”提交;刷新后可重试规划。
|
||
</NAlert>
|
||
<NFormItem path="videoInputMode" label="输入规划范围">
|
||
<NSelect
|
||
v-model:value="videoInputMode"
|
||
:disabled="operation.pending"
|
||
:options="[
|
||
{
|
||
label: `全部推荐模式(${inputPlan?.readyCount ?? 0})`,
|
||
value: 'all'
|
||
},
|
||
{
|
||
label: `首帧模式(${inputPlan?.firstFrameCount ?? 0})`,
|
||
value: 'first_frame',
|
||
disabled: !inputPlan
|
||
},
|
||
{
|
||
label: `全模态参考(${inputPlan?.omniReferenceCount ?? 0})`,
|
||
value: 'omni_reference',
|
||
disabled: !inputPlan
|
||
}
|
||
]"
|
||
aria-label="视频输入规划范围"
|
||
/>
|
||
</NFormItem>
|
||
<NFormItem path="videoLimit" label="本批镜头上限"
|
||
><NInputNumber
|
||
v-model:value="videoLimit"
|
||
:min="1"
|
||
:precision="0"
|
||
:disabled="operation.pending"
|
||
:input-props="{ 'aria-label': '视频质量任务镜头上限' }"
|
||
/></NFormItem>
|
||
<NFormItem path="videoRepairAttempts" label="每镜最多自动修复"
|
||
><NInputNumber
|
||
v-model:value="videoRepairAttempts"
|
||
:min="1"
|
||
:precision="0"
|
||
:disabled="operation.pending"
|
||
:input-props="{ 'aria-label': '视频自动修复次数' }"
|
||
/></NFormItem>
|
||
</AppForm>
|
||
</article>
|
||
</div>
|
||
<div v-if="query.data.value" class="workspace-panel production-video-status">
|
||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||
<div>
|
||
<h3 class="text-sm font-semibold">视频任务状态</h3>
|
||
<p class="mt-2 text-xs text-muted">
|
||
状态统计取每个镜头最近一次任务,不等同于主视频数量。
|
||
</p>
|
||
</div>
|
||
<ConfirmAction
|
||
label="重试失败视频"
|
||
:disabled="
|
||
blocked || !batchValid || !query.data.value.videoStatus.failed
|
||
"
|
||
acknowledgement
|
||
description="只重新提交可以重试的失败视频;其他项目会跳过,并在结果中显示数量。"
|
||
@confirm="run('retry-videos')"
|
||
/>
|
||
</div>
|
||
<dl class="production-status-grid">
|
||
<div>
|
||
<dt>完成</dt>
|
||
<dd>{{ query.data.value.videoStatus.completed }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt>排队/生成</dt>
|
||
<dd>{{ videoRunning }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt>失败</dt>
|
||
<dd>{{ query.data.value.videoStatus.failed }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt>取消</dt>
|
||
<dd>{{ query.data.value.videoStatus.cancelled }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt>未开始</dt>
|
||
<dd>{{ query.data.value.videoStatus.notStarted }}</dd>
|
||
</div>
|
||
</dl>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
<EpisodeAssemblyPanel :project-id="id" />
|
||
<AdvancedProduction />
|
||
</div>
|
||
</WorkspaceTools>
|
||
</div></div
|
||
></template>
|
||
<!-- 以下是关闭弹窗后仍可查看的首帧质量后台任务模块 -->
|
||
<!-- 以下是普通首帧后台执行状态模块 -->
|
||
<WorkflowExecutionPanel
|
||
v-if="keyframeExecution.executionId.value"
|
||
title="普通首帧生成"
|
||
:execution="keyframeExecution.query.data.value"
|
||
:loading="keyframeExecution.query.loading.value"
|
||
:error="keyframeExecution.query.error.value"
|
||
@refresh="keyframeExecution.query.refresh"
|
||
@dismiss="keyframeExecution.dismiss"
|
||
/>
|
||
<WorkflowExecutionPanel
|
||
v-if="keyframeQualityExecution.executionId.value"
|
||
title="首帧质量后台任务"
|
||
:execution="keyframeQualityExecution.query.data.value"
|
||
:loading="keyframeQualityExecution.query.loading.value"
|
||
:error="keyframeQualityExecution.query.error.value"
|
||
@refresh="keyframeQualityExecution.query.refresh"
|
||
@dismiss="keyframeQualityExecution.dismiss"
|
||
/>
|
||
<!-- 以下是重生成后正文缺省的真实数据说明模块 -->
|
||
<NAlert v-if="episodeSourceUnavailable" type="info" :show-icon="false">
|
||
本集镜头已重新生成。新标题和剧情详情尚未提供,当前只显示正式镜头编号;请按实际生成规格核对内容。
|
||
</NAlert>
|
||
<NScrollbar v-if="query.error.value" class="workspace-feedback"
|
||
><NAlert role="alert" type="error" :show-icon="false"
|
||
>{{ query.error.value
|
||
}}<span v-if="query.data.value"> 当前保留上次读取的数据,生产操作已暂停。</span></NAlert
|
||
></NScrollbar
|
||
>
|
||
<!-- 以下是需要处理的项目状态摘要模块,数量为零的项目不占空间 -->
|
||
<div v-if="staleKeyframes || staleVideos || identityBlocked" class="workspace-inline-status">
|
||
<span v-if="staleKeyframes">首帧待更新 {{ staleKeyframes }}</span>
|
||
<span v-if="staleVideos">视频待更新 {{ staleVideos }}</span>
|
||
<span v-if="identityBlocked">身份待确认 {{ identityBlocked }}</span>
|
||
</div>
|
||
<div v-if="shots.length" class="panel production-workspace workspace-surface">
|
||
<nav class="production-shot-list directory-panel" aria-label="本集生产镜头">
|
||
<div class="directory-heading">
|
||
<h3>
|
||
生产镜头 <span>{{ shots.length }} 镜</span>
|
||
</h3>
|
||
</div>
|
||
<NScrollbar
|
||
class="panel-scroll directory-scroll"
|
||
content-class="directory-list-content production-shot-list-content"
|
||
x-scrollable
|
||
>
|
||
<BeatShotDirectory
|
||
:shots="shots"
|
||
:active-id="shot?.shotId || ''"
|
||
@select="selectedShot = $event"
|
||
item-class="production-shot-link"
|
||
>
|
||
<template #meta="{ shot: item }"
|
||
><span
|
||
v-if="
|
||
query.data.value?.keyframes.items.find(row => row.shotId === item.shotId)
|
||
?.primaryKeyframeStale
|
||
"
|
||
class="directory-status"
|
||
>
|
||
<CircleAlert :size="12" />主首帧已过期 </span
|
||
><span
|
||
v-else-if="
|
||
query.data.value?.videos.items.find(row => row.shotId === item.shotId)
|
||
?.primaryVideoStale
|
||
"
|
||
class="directory-status"
|
||
>
|
||
<CircleAlert :size="12" />主视频已过期 </span
|
||
><span v-else class="directory-status">
|
||
<CheckCircle2
|
||
v-if="
|
||
query.data.value?.videos.items.find(row => row.shotId === item.shotId)
|
||
?.status === 'skipped'
|
||
"
|
||
:size="12"
|
||
/>
|
||
<CircleAlert
|
||
v-else-if="
|
||
query.data.value?.videos.items.find(row => row.shotId === item.shotId)
|
||
?.status === 'blocked'
|
||
"
|
||
:size="12"
|
||
/>
|
||
{{
|
||
productionStatusLabel(
|
||
query.data.value?.videoStatus.items.find(row => row.shotId === item.shotId)
|
||
?.status || 'not_started'
|
||
)
|
||
}}
|
||
</span></template
|
||
></BeatShotDirectory
|
||
>
|
||
</NScrollbar>
|
||
</nav>
|
||
<article class="production-detail min-w-0">
|
||
<NScrollbar v-if="shot" class="panel-scroll" content-class="shot-detail-content p-5 lg:p-7">
|
||
<header class="mb-5 pb-5">
|
||
<NAlert v-if="linkedShotMissing" type="warning" :show-icon="false" class="mb-4"
|
||
>链接中的镜头已不存在或不属于该剧集,请在左侧重新选择。</NAlert
|
||
>
|
||
<!-- 以下是镜头编号与最近视频任务状态模块,分别对齐左右边缘 -->
|
||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||
<p class="eyebrow">段落 {{ shot.beatNo }} · 镜头 {{ shot.shotNo }}</p>
|
||
<StatusBadge
|
||
v-if="videoStatusItem"
|
||
:status="videoStatusItem.status"
|
||
:label="latestVideoTaskLabel"
|
||
/>
|
||
</div>
|
||
<!-- 以下是镜头标题与低频生成检查菜单模块,菜单固定在标题行最右侧 -->
|
||
<div class="mt-2 flex items-center justify-between gap-3">
|
||
<h3 class="min-w-0 flex-1 break-words text-lg font-semibold">{{ shot.title }}</h3>
|
||
<div class="shrink-0">
|
||
<ActionMenu
|
||
label="镜头资产更多操作"
|
||
:items="[
|
||
{
|
||
key: 'specs',
|
||
label: '检查生成规格与模型限制',
|
||
disabled: !shotAssetsRef || shotAssetsRef.inspecting
|
||
}
|
||
]"
|
||
@select="shotAssetsRef?.inspectSpecs()"
|
||
/>
|
||
</div>
|
||
</div>
|
||
<p v-if="shot.description" class="mt-3 text-sm leading-7">{{ shot.description }}</p>
|
||
<NAlert
|
||
v-if="videoStatusItem?.status === 'failed'"
|
||
type="error"
|
||
:show-icon="false"
|
||
class="mt-3"
|
||
>
|
||
{{ videoStatusItem.error || '最近一次视频任务失败' }}
|
||
<p v-if="videoStatusItem.retryable === false" class="mt-2">
|
||
此失败不支持普通重试,请先处理失败原因。
|
||
</p>
|
||
<p v-else-if="videoStatusItem.retryable === true" class="mt-2">此任务可以重试。</p>
|
||
</NAlert>
|
||
<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"
|
||
type="info"
|
||
:show-icon="false"
|
||
class="mt-4 text-xs"
|
||
>
|
||
主视频已过期:当前主首帧或主体参考图与生成该视频时不一致。旧视频仍保留,但需要重新生成后才能作为当前有效成片。
|
||
</NAlert>
|
||
</header>
|
||
<ShotProductionAssets
|
||
ref="shotAssetsRef"
|
||
:key="shot.shotId"
|
||
:project-id="id"
|
||
:shot="shot"
|
||
:episode-no="episodeNo"
|
||
:prompt-readiness="promptItem"
|
||
:keyframe-readiness="keyframeItem"
|
||
:video-readiness="videoItem"
|
||
:open-keyframe="openRequestedKeyframe"
|
||
:disabled="blocked || keyframeQualityExecution.active.value || !!linkedShotMissing"
|
||
@changed="refreshProject"
|
||
@quality-started="trackKeyframeQuality"
|
||
/>
|
||
</NScrollbar>
|
||
<!-- 以下是无效镜头地址的定位反馈模块 -->
|
||
<EmptyState
|
||
v-if="!shot"
|
||
title="链接中的镜头已不存在或不属于本集"
|
||
description="请在左侧目录重新选择镜头。"
|
||
/>
|
||
</article>
|
||
</div>
|
||
<EmptyState
|
||
v-else-if="query.data.value"
|
||
title="本集还没有正式镜头"
|
||
description="先完成剧本拆解和分镜设计,再进入镜头生产。"
|
||
>
|
||
<RouterLink :to="`/projects/${id}/storyboard`" class="button button-secondary">前往分镜设计</RouterLink>
|
||
</EmptyState>
|
||
<p v-else-if="query.loading.value" class="panel mt-5 p-8 text-sm text-muted" role="status">
|
||
正在检查全项目生产就绪状态……
|
||
</p>
|
||
<QualityDialog
|
||
v-model:open="qualityOpen"
|
||
:project-id="id"
|
||
:target="episodeNo ? { kind: 'batch', episodeNo, title: `第 ${episodeNo} 集首帧` } : null"
|
||
:disabled="blocked"
|
||
@changed="refreshProject"
|
||
@locate="locateQualityShot"
|
||
@started="trackKeyframeQuality"
|
||
/>
|
||
</WorkspacePage>
|
||
</template>
|
||
|
||
<style>
|
||
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
||
@reference "../../styles/styles.css";
|
||
.production-tools-intro {
|
||
@apply flex flex-wrap items-end justify-between gap-4 p-0 bg-transparent;
|
||
}
|
||
.production-tools-intro .eyebrow {
|
||
@apply mb-2;
|
||
}
|
||
.production-batch-config {
|
||
@apply m-0 p-0 bg-transparent;
|
||
}
|
||
.production-section-heading {
|
||
@apply flex items-start justify-between gap-4;
|
||
}
|
||
.workspace-tools-body .production-batch-config .production-controls {
|
||
@apply mt-4 mb-0;
|
||
}
|
||
.production-tool-stack {
|
||
@apply bg-transparent;
|
||
}
|
||
.production-tool-stack > .workspace-panel,
|
||
.production-tool-stack > .workspace-overview-panel {
|
||
@apply p-0 bg-transparent;
|
||
}
|
||
.production-tool-stack .workspace-overview-panel {
|
||
@apply m-0;
|
||
}
|
||
.production-tool-stack .workspace-overview-panel .overview-content {
|
||
@apply p-0;
|
||
}
|
||
.production-controls {
|
||
@apply grid grid-cols-[minmax(220px,_1fr)_minmax(280px,_1fr)] items-end gap-5;
|
||
}
|
||
.production-pipeline {
|
||
@apply grid grid-cols-[repeat(3,_minmax(0,_1fr))] gap-3.5;
|
||
}
|
||
.production-pipeline-card {
|
||
@apply grid content-start gap-4 p-5 bg-(--app-subtle);
|
||
}
|
||
.production-pipeline-card > * {
|
||
@apply m-0;
|
||
}
|
||
.production-stats {
|
||
@apply grid grid-cols-[repeat(3,_1fr)] gap-3;
|
||
}
|
||
.production-stats div,
|
||
.production-status-grid div {
|
||
@apply p-2.5 rounded-none bg-(--app-subtle);
|
||
}
|
||
.production-stats dt,
|
||
.production-status-grid dt {
|
||
@apply text-muted text-[10px];
|
||
}
|
||
.production-stats dd,
|
||
.production-status-grid dd {
|
||
@apply mt-[5px] text-[13px] font-mono;
|
||
}
|
||
.video-input-plan-summary {
|
||
@apply grid grid-cols-2 gap-3;
|
||
}
|
||
.video-input-plan-summary div {
|
||
@apply flex items-center justify-between gap-2 p-2.5 bg-(--app-subtle) text-[11px] text-muted;
|
||
}
|
||
.video-input-plan-summary strong {
|
||
@apply font-mono text-xs text-(--app-text);
|
||
}
|
||
.production-status-grid {
|
||
@apply grid grid-cols-[repeat(5,_minmax(0,_1fr))] gap-3;
|
||
}
|
||
.production-video-status {
|
||
@apply grid gap-4;
|
||
}
|
||
.production-video-status > * {
|
||
@apply m-0;
|
||
}
|
||
.production-workspace {
|
||
@apply grid grid-cols-[220px_minmax(0,_1fr)] items-start gap-3 overflow-hidden;
|
||
}
|
||
.production-shot-list {
|
||
@apply max-h-[760px] overflow-hidden bg-(--app-surface) py-2;
|
||
}
|
||
@media (max-width: 1100px) {
|
||
.production-pipeline {
|
||
@apply grid-cols-[1fr];
|
||
}
|
||
.production-controls {
|
||
@apply grid-cols-[repeat(2,_minmax(0,_1fr))];
|
||
}
|
||
}
|
||
@media (max-width: 760px) {
|
||
.production-tools-intro,
|
||
.production-section-heading {
|
||
@apply items-start;
|
||
}
|
||
.production-controls,
|
||
.production-workspace {
|
||
@apply grid-cols-[minmax(0,_1fr)];
|
||
}
|
||
.production-shot-list {
|
||
@apply flex max-h-none overflow-hidden;
|
||
border-right: none;
|
||
}
|
||
.production-status-grid {
|
||
@apply grid-cols-[repeat(2,_minmax(0,_1fr))];
|
||
}
|
||
}
|
||
.workspace-inline-status {
|
||
@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;
|
||
}
|
||
.production-workspace {
|
||
@apply grid-cols-[clamp(240px,_22%,_280px)_minmax(0,_1fr)];
|
||
}
|
||
.production-shot-list {
|
||
@apply max-h-none overflow-hidden min-h-0;
|
||
}
|
||
.production-workspace > article {
|
||
@apply overflow-hidden min-h-0 overscroll-contain;
|
||
}
|
||
.production-shot-list-content {
|
||
@apply gap-3 pt-0 px-0 pb-3;
|
||
}
|
||
.production-shot-list {
|
||
@apply p-0;
|
||
}
|
||
@media (max-width: 1000px) {
|
||
.production-controls {
|
||
@apply grid-cols-[minmax(130px,_1fr)_90px];
|
||
}
|
||
}
|
||
@media (max-width: 760px) {
|
||
/* 手机目录按实际内容占高,将剩余空间交给镜头正文。 */
|
||
.production-workspace {
|
||
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[auto_minmax(0,_1fr)] gap-2;
|
||
}
|
||
.production-pipeline {
|
||
@apply grid-cols-[1fr];
|
||
}
|
||
}
|
||
</style>
|