feat: 同步动作与首帧编辑能力并统一工作区反馈

接入动作时间轴、密度审计、人工视线目标和后台首帧编辑;独立读取已保存提示词,并在首帧晋升前重新核对持久化质量状态。
统一 NMessage 结果反馈、局部 loading 和业务说明间距,保留真实长任务进度与部分失败语义。
验证:pnpm check(49 个文件、393 项测试)、pnpm build;当前环境无法完成 localhost 浏览器验收及真实后端联调。
This commit is contained in:
GouJ committed 2026-10-12 20:05:03 +08:00
1 parent 83482a70c5
commit 7a60db3ced
76 files changed
+2485 -457

No files matched your search

@@ -1,8 +1,12 @@
<script setup lang="ts">
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
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 { NButton, NCollapse, NCollapseItem, NSelect, NTag } from 'naive-ui'
import { computed, onScopeDispose, ref, watch } from 'vue'
import { ImagePlus, RefreshCw } from '@lucide/vue'
import { AssetImage } from '../../../components/ui'
@@ -26,7 +30,12 @@ import type {
VideoGenerationSpec,
VideoReadinessItem
} from '../types'
import MotionPlanPanel from '../../storyboard/components/MotionPlanPanel.vue'
import SpatialBindingsPanel from '../../storyboard/components/SpatialBindingsPanel.vue'
import KeyframeDialog from './KeyframeDialog.vue'
import KeyframeEditDialog from './KeyframeEditDialog.vue'
import type { ShotKeyframe } from '../types'
import { getOperation, isOperationRunning } from '../../workflows/operations'
import KeyframeCard from './KeyframeCard.vue'
import VideoCard from './VideoCard.vue'
import ProductionStageStatus from './ProductionStageStatus.vue'
@@ -48,6 +57,25 @@ import GenerationModelControls from '../../generation-config/components/Generati
/** 当前页面操作反馈使用消息提示,不长期占据正文。 */
const actionMessage = useActionMessage()
/** 动作与视线按需打开,避免进入生产页便编译全部镜头。 */
const motionOpen = ref(false)
/** 编辑源图保持正式资产身份,不能把视频输入变体当作业务源图。 */
const editOpen = ref(false)
const editSource = ref<ShotKeyframe | null>(null)
/**
* 编辑具体主图或历史候选,切镜时废弃原源图。
* @param source 当前镜头已完成首帧
*/
function openEdit(source: ShotKeyframe) {
if (assetBlocked.value || source.status !== 'completed' || source.source === 'provider_variant') return
editSource.value = source
editOpen.value = true
}
/** 单镜头动作按钮反映本镜头操作,不把整个项目锁显示为所有按钮加载。 */
const promptLoading = computed(() => {
const op = getOperation(props.projectId)
return op.pending && op.label === `生成镜头 ${props.shot.shotNo} 视频提示词`
})
/** 离开镜头后忽略迟到的手动读取反馈。 */
let disposed = false
onScopeDispose(() => {
@@ -76,6 +104,15 @@ const props = defineProps<{
/** 通知父页面刷新及观察已启动的质量任务。 */
const emit = defineEmits<{ changed: []; qualityStarted: [executionId: string] }>()
const key = computed(() => props.shot.shotId)
watch(
() => props.shot.shotId,
() => {
editOpen.value = false
editSource.value = null
motionOpen.value = false
}
)
/** 仅当前镜头存在后台首帧或视频任务时临时轮询,终态后自动停止。 */
let query!: ReturnType<
typeof usePolling<{
@@ -381,13 +418,16 @@ async function setPrimaryKeyframe() {
if (
assetBlocked.value ||
!keyframeId ||
keyframePassed(keyframeId) !== true ||
keyframes.value.find(item => item.id === keyframeId)?.source === 'provider_variant'
)
return
const shotId = props.shot.shotId
confirmingKeyframe.value = ''
await runOperation(props.projectId, `设置镜头 ${props.shot.shotNo} 主首帧`, async () => {
// 晋升前重新读取持久化质量结论,刷新页面后也认可真实历史通过。
const review = await qualityApi.keyframeQualityReview(shotId, keyframeId)
if (!['passed', 'manual_accepted'].includes(review.effectiveQualityStatus))
throw new Error('此候选尚未通过当前质量要求,请先完成质量检查或有效人工复核。')
const result = await productionApi.setPrimaryKeyframe(shotId, keyframeId)
if (!result || result.id !== keyframeId || !result.isPrimary || result.status !== 'completed')
throw new Error('接口未确认主首帧切换。')
@@ -477,9 +517,9 @@ defineExpose({ inspectSpecs, inspecting })
<template>
<section class="production-assets">
<NAlert v-if="query.error.value" role="alert" type="error" :show-icon="false" class="mt-4"
<ContextNotice v-if="query.error.value" role="alert" type="error" :show-icon="false" class="mt-4"
>{{ query.error.value }} 当前保留上次成功读取的资产,操作已暂停。
</NAlert>
</ContextNotice>
<div class="production-stage">
<div class="production-stage-heading">
@@ -494,7 +534,10 @@ defineExpose({ inspectSpecs, inspecting })
/>
</div>
<div v-if="savedPrompt?.videoPrompt" class="surface-inset mt-4 p-4" aria-label="本镜视频提示词">
<p class="text-xs font-medium">本镜视频提示词</p>
<div class="flex flex-wrap items-center justify-between gap-3">
<p class="text-xs font-medium">本镜视频提示词</p>
<NButton text size="small" @click="motionOpen = true">查看动作与视线</NButton>
</div>
<p class="mt-3 whitespace-pre-wrap break-words text-sm leading-6">{{ savedPrompt.videoPrompt }}</p>
<template v-if="savedPrompt.negativePrompt">
<p class="mt-4 text-xs font-medium">负向提示词</p>
@@ -510,13 +553,20 @@ defineExpose({ inspectSpecs, inspecting })
正在读取视频提示词…
</p>
<p v-else-if="!promptQuery.error.value" class="mt-4 text-xs text-muted">尚未生成本镜视频提示词。</p>
<NAlert v-if="promptQuery.error.value" role="alert" type="warning" :show-icon="false" class="mt-4 text-xs">
<ContextNotice
v-if="promptQuery.error.value"
role="alert"
type="warning"
:show-icon="false"
class="mt-4 text-xs"
>
提示词读取失败:{{ promptQuery.error.value }}
<NButton text size="small" @click="promptQuery.refresh">重试</NButton>
</NAlert>
</ContextNotice>
<div class="production-stage-actions">
<ConfirmAction
:label="promptReadiness?.status === 'skipped' ? '重新生成本镜提示词' : '生成本镜提示词'"
:loading="promptLoading"
:disabled="!canGeneratePrompt"
acknowledgement
:description="
@@ -548,27 +598,37 @@ defineExpose({ inspectSpecs, inspecting })
:shot-id="shot.shotId"
:review-revision="reviewRevision"
:item="currentKeyframe"
:editing="
editSource?.id === currentKeyframe.id &&
isOperationRunning(getOperation(projectId), `编辑镜头 ${shot.shotId} 首帧`)
"
:shot-no="shot.shotNo"
:stale="keyframeStale"
:blocked="assetBlocked"
:validation-passed="keyframePassed(currentKeyframe.id)"
:confirming="false"
@quality="openQuality('keyframe', currentKeyframe.id)"
@edit="openEdit(currentKeyframe)"
@history="openKeyframeHistory(currentKeyframe.id)"
/>
</div>
<p v-else class="mt-4 text-xs text-muted">尚无已确认主首帧。请生成候选,完成质量检查后再设为主首帧。</p>
<NAlert
<ContextNotice
v-if="currentKeyframe && keyframePassed(currentKeyframe.id) === false"
type="error"
:show-icon="false"
class="mt-3 text-xs"
>
当前主首帧在本次质量检查中未通过,已阻止继续生成视频。请从候选中选择质量通过的图片。
</NAlert>
<NAlert v-if="query.data.value?.qualityStatusError" type="warning" :show-icon="false" class="mt-3 text-xs">
</ContextNotice>
<ContextNotice
v-if="query.data.value?.qualityStatusError"
type="warning"
:show-icon="false"
class="mt-3 text-xs"
>
视频质量链状态暂时无法读取;视频资产仍可查看。请稍后刷新。
</NAlert>
</ContextNotice>
<div class="production-stage-actions">
<NButton :disabled="!episodeNo || !canGenerateKeyframe" @click="openShotKeyframeQuality"
>本镜首帧质量重跑</NButton
@@ -580,7 +640,10 @@ defineExpose({ inspectSpecs, inspecting })
<NTag v-if="activeKeyframeCount" size="small" type="warning" :bordered="false" role="status">
首帧任务进行中({{ activeKeyframeCount }})
</NTag>
<NButton :disabled="!canGenerateKeyframe" @click="keyframeOpen = true"
<NButton
:loading="isOperationRunning(getOperation(projectId), `生成镜头 ${shot.shotNo} 首帧`)"
:disabled="!canGenerateKeyframe"
@click="keyframeOpen = true"
><ImagePlus :size="14" />{{
keyframeStale ? '生成替代候选' : currentKeyframe ? '再生成一张候选' : '生成首帧候选'
}}</NButton
@@ -752,9 +815,9 @@ defineExpose({ inspectSpecs, inspecting })
</div>
</div>
</section>
<NAlert v-else-if="generationCatalogError" type="warning" :show-icon="false" class="mt-4 text-xs">
<ContextNotice v-else-if="generationCatalogError" type="warning" :show-icon="false" class="mt-4 text-xs">
生成模型目录读取失败:{{ generationCatalogError }}
</NAlert>
</ContextNotice>
<div class="production-stage-actions">
<ConfirmAction
:label="
@@ -779,7 +842,7 @@ defineExpose({ inspectSpecs, inspecting })
</div>
<AppDialog v-model:open="specsOpen" title="生成设置与模型限制" description="查看不收费。" wide>
<NAlert v-if="specError" role="alert" type="error" :show-icon="false" class="mt-4">{{ specError }}</NAlert>
<FeedbackMessage v-if="specError" :message="specError" />
<p v-if="inspecting" role="status" class="mt-4 text-xs text-muted">正在读取生成规格…</p>
<ModelCapabilities :shot-id="shot.shotId" />
<ProviderInputInspector :shot-id="shot.shotId" />
@@ -811,6 +874,26 @@ defineExpose({ inspectSpecs, inspecting })
></NCollapse
>
</AppDialog>
<AppDialog v-model:open="motionOpen" title="镜头动作与视线" wide>
<div v-if="motionOpen" class="space-y-6">
<MotionPlanPanel :key="shot.shotId" :shot-id="shot.shotId" :revision="savedPrompt?.updatedAt" />
<SpatialBindingsPanel
:key="shot.shotId"
:project-id="projectId"
:shot-id="shot.shotId"
:disabled="assetBlocked"
@changed="refreshAll"
/>
</div>
</AppDialog>
<KeyframeEditDialog
v-model:open="editOpen"
:project-id="projectId"
:shot-id="shot.shotId"
:source="editSource"
:disabled="assetBlocked"
@started="emit('qualityStarted', $event)"
/>
<QualityDialog
v-model:open="qualityOpen"
:project-id="projectId"
@@ -822,7 +905,7 @@ defineExpose({ inspectSpecs, inspecting })
<AppDialog
v-model:open="candidatesOpen"
title="首帧候选管理"
description="先完成质量检查;只有本会话校验通过的候选才能设为主首帧。"
description="读取已保存质量结论;通过质量检查或完成有效人工复核的候选可以设为主首帧。"
:width="keyframeCandidatesWidth"
>
<!-- 候选图片和对应的人工复核入口按相同候选 ID 分组。 -->
@@ -832,12 +915,17 @@ defineExpose({ inspectSpecs, inspecting })
:shot-id="shot.shotId"
:review-revision="reviewRevision"
:item="item"
:editing="
editSource?.id === item.id &&
isOperationRunning(getOperation(projectId), `编辑镜头 ${shot.shotId} 首帧`)
"
:shot-no="shot.shotNo"
:stale="false"
:blocked="assetBlocked"
:validation-passed="keyframePassed(item.id)"
:confirming="confirmingKeyframe === item.id"
@quality="openQuality('keyframe', item.id)"
@edit="openEdit(item)"
@history="openKeyframeHistory(item.id)"
@select="confirmingKeyframe = item.id"
@confirm="setPrimaryKeyframe"