feat(short-drama-agent-front): 接入人工动作修订与视频版本权限
This commit is contained in:
1 parent
7a60db3ced
commit
fa76165960
38 files changed
+2003
-158
No files matched your search
@@ -0,0 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton } from 'naive-ui'
|
||||
import { RefreshCw } from '@lucide/vue'
|
||||
|
||||
/** 工作区刷新按钮统一沿用默认按钮尺寸、背景与图标间距。 */
|
||||
interface Props {
|
||||
/** 刷新操作名称。 */
|
||||
label?: string
|
||||
/** 是否正在读取最新数据。 */
|
||||
loading?: boolean
|
||||
/** 是否暂时禁止刷新。 */
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
/** 刷新仅改变读取状态,调用方负责真实接口请求。 */
|
||||
withDefaults(defineProps<Props>(), { label: '刷新', loading: false, disabled: false })
|
||||
/** 用户明确点击刷新时通知调用方。 */
|
||||
const emit = defineEmits<{ refresh: [] }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是统一的手动刷新按钮模块 -->
|
||||
<NButton :loading="loading" :disabled="disabled" @click="emit('refresh')">
|
||||
<template #icon><RefreshCw :size="13" aria-hidden="true" /></template>
|
||||
{{ label }}
|
||||
</NButton>
|
||||
</template>
|
||||
@@ -0,0 +1,39 @@
|
||||
<script setup lang="ts">
|
||||
/** 工作区模块标题、说明与右侧操作的统一展示参数。 */
|
||||
interface Props {
|
||||
/** 模块标题。 */
|
||||
title: string
|
||||
/** 模块说明,可通过 description 插槽补充状态与提示。 */
|
||||
description?: string
|
||||
}
|
||||
|
||||
/** 标题与说明由业务模块提供,操作通过插槽复用统一对齐方式。 */
|
||||
defineProps<Props>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是统一的模块标题与右侧操作模块 -->
|
||||
<header class="workspace-section-heading">
|
||||
<div class="workspace-section-heading-row">
|
||||
<h3 class="text-sm font-semibold">{{ title }}</h3>
|
||||
<div v-if="$slots.actions" class="workspace-section-heading-actions"><slot name="actions" /></div>
|
||||
</div>
|
||||
<!-- 以下是标题下方的说明与状态模块 -->
|
||||
<div v-if="description || $slots.description" class="workspace-section-description">
|
||||
<slot name="description">{{ description }}</slot>
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
@reference "../../styles/styles.css";
|
||||
.workspace-section-heading-row {
|
||||
@apply flex min-w-0 flex-wrap items-center justify-between gap-3;
|
||||
}
|
||||
.workspace-section-heading-actions {
|
||||
@apply flex shrink-0 flex-wrap items-center gap-3;
|
||||
}
|
||||
.workspace-section-description {
|
||||
@apply mt-2 text-xs leading-6 text-muted;
|
||||
}
|
||||
</style>
|
||||
@@ -9,3 +9,5 @@ export { default as AssetOpenLink } from './AssetOpenLink.vue'
|
||||
export { default as RevealImage } from './RevealImage.vue'
|
||||
export { default as DirectoryItem } from './DirectoryItem.vue'
|
||||
export { default as WorkspaceTools } from './WorkspaceTools.vue'
|
||||
export { default as WorkspaceSectionHeading } from './WorkspaceSectionHeading.vue'
|
||||
export { default as WorkspaceRefreshButton } from './WorkspaceRefreshButton.vue'
|
||||
@@ -15,6 +15,7 @@ import { EmptyState, StatusBadge } from '../../components/ui'
|
||||
import BeatShotDirectory from '../storyboard/components/BeatShotDirectory.vue'
|
||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||
import { productionStatusLabel } from './model'
|
||||
import { videoInputStaleReason } from './production-messages'
|
||||
import { useProduction } from './useProduction'
|
||||
import ProductionReceipt from './components/ProductionReceipt.vue'
|
||||
import ShotProductionAssets from './components/ShotProductionAssets.vue'
|
||||
@@ -65,6 +66,8 @@ const {
|
||||
promptExecution,
|
||||
videoExecution
|
||||
} = useProduction()
|
||||
/** 关闭动作弹窗或切换镜头时继续观察视觉任务,避免遗留未知活动锁。 */
|
||||
useWorkflowExecution(id, 'motion-plan-start-state-validation')
|
||||
/** 当前镜头资产组件引用,标题菜单仅操作此镜头的只读检查弹窗。 */
|
||||
const shotAssetsRef = ref<InstanceType<typeof ShotProductionAssets> | null>(null)
|
||||
/** 标题状态只描述最近视频任务,不能表示质量通过或当前主视频仍可用。 */
|
||||
@@ -387,7 +390,9 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
|
||||
<ContextNotice v-if="staleVideos" role="status" type="info" :show-icon="false">
|
||||
当前有
|
||||
{{ staleVideos }}
|
||||
个主视频已过期。它们使用的主首帧或主体参考图已经变化;非覆盖模式批量生成时会只重建这些过期主视频。
|
||||
个主视频已过期。{{
|
||||
videoInputStaleReason
|
||||
}};非覆盖模式批量生成会按最新输入重建过期主视频。
|
||||
</ContextNotice>
|
||||
<ProductionReceipt v-if="session.receipt" :receipt="session.receipt" />
|
||||
<WorkflowExecutionPanel
|
||||
@@ -474,7 +479,8 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
|
||||
v-if="stage.key === 'videos' && staleVideos"
|
||||
class="text-[11px] leading-5"
|
||||
>
|
||||
主视频已过期 {{ staleVideos }} · 会按当前主首帧与参考资产重新生成
|
||||
主视频已过期 {{ staleVideos }} ·
|
||||
会按当前主首帧、参考资产与动作规划重新生成
|
||||
</p>
|
||||
<p
|
||||
v-if="stage.key === 'keyframes' && identityBlocked"
|
||||
@@ -855,7 +861,9 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
|
||||
:show-icon="false"
|
||||
class="mt-4 text-xs"
|
||||
>
|
||||
主视频已过期:当前主首帧或主体参考图与生成该视频时不一致。旧视频仍保留,但需要重新生成后才能作为当前有效成片。
|
||||
主视频已过期:{{
|
||||
videoItem.primaryVideoStaleReasons?.join(';') || videoInputStaleReason
|
||||
}}。旧视频仍保留,但需要重新生成后才能作为当前有效成片。
|
||||
</ContextNotice>
|
||||
</header>
|
||||
<ShotProductionAssets
|
||||
|
||||
@@ -181,8 +181,16 @@ export const productionApi = {
|
||||
}),
|
||||
refreshVideo: (videoId: string, signal?: AbortSignal) =>
|
||||
request<ShotVideo | null>(`/storyboard-shot-videos/${encodeURIComponent(videoId)}/status`, { signal }),
|
||||
setPrimaryVideo: (shotId: string, videoId: string) =>
|
||||
/**
|
||||
* 按候选后端权限切换主视频,并携带已读取的生效版本作并发检查。
|
||||
* @param shotId 镜头 ID
|
||||
* @param videoId 候选 ID
|
||||
* @param expectedMotionPlanRevisionId 已查询的当前动作版本
|
||||
* @returns 后端确认后的主视频
|
||||
*/
|
||||
setPrimaryVideo: (shotId: string, videoId: string, expectedMotionPlanRevisionId?: string | null) =>
|
||||
request<ShotVideo | null>(`${shotPath(shotId)}/videos/${encodeURIComponent(videoId)}/primary`, {
|
||||
method: 'PUT'
|
||||
method: 'PUT',
|
||||
body: expectedMotionPlanRevisionId === undefined ? {} : { expectedMotionPlanRevisionId }
|
||||
})
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { videoOperationAllowed } from '../video-permissions'
|
||||
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
|
||||
|
||||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
@@ -20,6 +21,8 @@ import { generationConfigApi } from '../../generation-config/api'
|
||||
import type { GenerationOptions } from '../../generation-config/types'
|
||||
import { useQuery } from '../../../composables/useQuery'
|
||||
import ModelCapabilities from './ModelCapabilities.vue'
|
||||
import { productionApi } from '../api'
|
||||
import type { ShotVideo } from '../types'
|
||||
|
||||
/** 单素材与当前集质量生成共用一个按需打开的面板,默认小批量且不自动调用模型。 */
|
||||
const props = defineProps<{
|
||||
@@ -29,6 +32,10 @@ const props = defineProps<{
|
||||
target: QualityTarget | null
|
||||
/** 上游状态阻断 */
|
||||
disabled: boolean
|
||||
/** 当前候选的公开权限,更新后撤销费用确认。 */
|
||||
video?: ShotVideo | null
|
||||
/** 明确修复入口的初始动作,不代替费用确认。 */
|
||||
initialAction?: 'validate' | 'repair'
|
||||
}>()
|
||||
/** 质量面板的open状态,随目标更新。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
@@ -37,9 +44,42 @@ const emit = defineEmits<{ changed: []; locate: [shotId: string]; started: [exec
|
||||
const { key, session, operation, execution, blocked, run } = useQuality(
|
||||
props,
|
||||
() => open.value,
|
||||
() => emit('changed'),
|
||||
() => {
|
||||
emit('changed')
|
||||
void videoQuery.refresh()
|
||||
},
|
||||
id => emit('started', id)
|
||||
)
|
||||
/** 质量弹窗重新读取所选候选自身的权限,不以会话历史代替后端事实。 */
|
||||
const videoKey = computed(() =>
|
||||
open.value && props.target?.kind === 'video' ? JSON.stringify([props.target.shotId, props.target.assetId]) : ''
|
||||
)
|
||||
/** 按正式镜头和候选 ID 查询公开权限。 */
|
||||
const videoQuery = useQuery(videoKey, async (value, signal) => {
|
||||
if (!value) return null
|
||||
const [shotId, assetId] = JSON.parse(value) as [string, string]
|
||||
const items = await productionApi.listVideos(shotId, signal)
|
||||
const item = items.find(video => video.id === assetId && video.shotId === shotId)
|
||||
if (!item) throw new Error('当前视频不存在,请刷新候选。')
|
||||
return item
|
||||
})
|
||||
/**
|
||||
* 独立读取和外层最新资产均不得明确拒绝本候选操作。
|
||||
* @param requested 请求的质量操作
|
||||
* @returns 当前是否可以进入费用确认后的提交
|
||||
*/
|
||||
function canUseVideoAction(requested: 'validate' | 'repair') {
|
||||
return (
|
||||
!videoQuery.loading.value &&
|
||||
!videoQuery.error.value &&
|
||||
(!props.video || videoOperationAllowed(props.video, requested)) &&
|
||||
videoOperationAllowed(videoQuery.data.value, requested)
|
||||
)
|
||||
}
|
||||
/** 质量目标与当前候选操作权限共同控制提交。 */
|
||||
const videoAllowed = computed(
|
||||
() => props.target?.kind !== 'video' || canUseVideoAction(action.value === 'repair' ? 'repair' : 'validate')
|
||||
)
|
||||
/** 模型目录只读查询,随当前项目和弹窗状态取消过期请求。 */
|
||||
const modelKey = computed(() =>
|
||||
open.value && props.target?.kind === 'batch' && props.projectId ? props.projectId : ''
|
||||
@@ -138,20 +178,25 @@ const maxValidations = computed(() =>
|
||||
)
|
||||
/** 质量面板的saved状态,随目标更新。 */
|
||||
const saved = computed(() => (props.target?.kind === 'video' ? (session.value.videoValidation ?? null) : null))
|
||||
/** 质量面板的repairAvailable状态,随目标更新。 */
|
||||
const repairAvailable = computed(
|
||||
() =>
|
||||
!videoRepair.value ||
|
||||
(session.value.receipt?.kind === 'video'
|
||||
? session.value.receipt.result.passed === false
|
||||
: saved.value?.passed === false)
|
||||
/** 修复与校验均使用所选候选后端权限,持久化失败可直接修复。 */
|
||||
const repairAvailable = computed(() => videoAllowed.value)
|
||||
/** 外层候选版本或权限变化后撤销已确认费用。 */
|
||||
watch([() => props.video, () => videoQuery.data.value], () => {
|
||||
acknowledged.value = false
|
||||
})
|
||||
/** 优先选择后端允许的操作,两个权限均关闭时保持按钮禁用。 */
|
||||
watch(
|
||||
() => videoQuery.data.value,
|
||||
video => {
|
||||
if (video && !video.canValidate && video.canRepair) action.value = 'repair'
|
||||
}
|
||||
)
|
||||
|
||||
/** 目标和费用范围变化均撤销确认;关闭不取消已经发送到后端的长请求。 */
|
||||
watch(
|
||||
[key, open],
|
||||
() => {
|
||||
action.value = props.target?.kind === 'batch' ? 'batch' : 'validate'
|
||||
action.value = props.target?.kind === 'batch' ? 'batch' : (props.initialAction ?? 'validate')
|
||||
attempts.value = props.target?.kind === 'video' ? 2 : 1
|
||||
concurrency.value = 1
|
||||
limit.value = 1
|
||||
@@ -215,6 +260,13 @@ const optionsExpanded = ref<string[]>(['options'])
|
||||
description="查看质量结果,或按需发起新的视觉检查。"
|
||||
wide
|
||||
>
|
||||
<ContextNotice
|
||||
v-if="target?.kind === 'video' && (videoQuery.error.value || videoQuery.data.value?.staleReason)"
|
||||
type="warning"
|
||||
:show-icon="false"
|
||||
>
|
||||
{{ videoQuery.error.value || videoQuery.data.value?.staleReason }}
|
||||
</ContextNotice>
|
||||
<AppForm
|
||||
ref="formRef"
|
||||
:model="formModel"
|
||||
@@ -232,8 +284,9 @@ const optionsExpanded = ref<string[]>(['options'])
|
||||
class="mt-4"
|
||||
aria-label="素材质量操作"
|
||||
>
|
||||
<NRadioButton value="validate">视觉校验</NRadioButton
|
||||
><NRadioButton value="repair">{{
|
||||
<NRadioButton value="validate" :disabled="target?.kind === 'video' && !canUseVideoAction('validate')"
|
||||
>视觉校验</NRadioButton
|
||||
><NRadioButton value="repair" :disabled="target?.kind === 'video' && !canUseVideoAction('repair')">{{
|
||||
target?.kind === 'video' ? '生成修复候选' : '校验并修复'
|
||||
}}</NRadioButton>
|
||||
</NRadioGroup>
|
||||
@@ -269,7 +322,7 @@ const optionsExpanded = ref<string[]>(['options'])
|
||||
本次仅创建一个修复视频,不自动等待或复检。完成后请打开新候选的质量检查;修复约束沿用上次失败校验,不使用额外参数。
|
||||
</p>
|
||||
<ContextNotice v-if="!repairAvailable" type="warning" :show-icon="false" class="mt-3"
|
||||
>请先执行视觉校验,只有未通过的视频可以创建修复候选。</ContextNotice
|
||||
>当前候选不允许执行所选质量操作,请查看后端原因或刷新权限。</ContextNotice
|
||||
>
|
||||
<NCollapse
|
||||
v-if="!videoRepair"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { videoOperationAllowed } from '../video-permissions'
|
||||
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
|
||||
|
||||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
@@ -21,7 +22,7 @@ import { runOperation } from '../../workflows/operations'
|
||||
import { productionApi } from '../api'
|
||||
import { qualityApi } from '../quality-api'
|
||||
import { isActiveVideo, primaryKeyframe, primaryVideo, productionStatusLabel, videoRecordedValidation } from '../model'
|
||||
import { productionIssueText, productionMessage } from '../production-messages'
|
||||
import { productionIssueText, productionMessage, videoInputStaleReason } from '../production-messages'
|
||||
import type {
|
||||
GenerateKeyframeInput,
|
||||
KeyframeReadinessItem,
|
||||
@@ -45,7 +46,7 @@ import KeyframeValidationHistory from './KeyframeValidationHistory.vue'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import ModelCapabilities from './ModelCapabilities.vue'
|
||||
import type { QualityTarget } from '../quality.types'
|
||||
import { sessionKeyframePassed, sessionVideoValidation } from '../quality'
|
||||
import { clearVideoConflict, clearVideoQualification, sessionKeyframePassed, sessionVideoValidation } from '../quality'
|
||||
import { useProjectGenerationRevision } from '../../generation-config/context'
|
||||
import { generationConfigApi } from '../../generation-config/api'
|
||||
import type {
|
||||
@@ -210,9 +211,23 @@ const videoCandidatesOpen = ref(false)
|
||||
const videoHistoryOpen = ref(false)
|
||||
/** 当前查看记录的视频 ID,按资产隔离主视频和候选。 */
|
||||
const videoHistoryId = ref('')
|
||||
/** 记录弹窗中的视频是否为需要更新的当前主视频。 */
|
||||
const videoHistoryStale = computed(() => videoHistoryId.value === currentVideo.value?.id && videoStale.value)
|
||||
/** 历史弹窗按用户选择的候选独立判断过期,不套用主视频结论。 */
|
||||
const videoHistoryAsset = computed(() => videos.value.find(item => item.id === videoHistoryId.value))
|
||||
/** 当前选中视频的过期终态独立于主视频判断。 */
|
||||
const videoHistoryStale = computed(
|
||||
() =>
|
||||
!!videoHistoryAsset.value?.motionPlanStale ||
|
||||
videoHistoryAsset.value?.qualityTerminalStatus === 'stale_motion_plan' ||
|
||||
(videoHistoryId.value === currentVideo.value?.id && videoStale.value)
|
||||
)
|
||||
/** 质量操作绑定当前视频的权限,每次刷新列表都会更新。 */
|
||||
const qualityVideo = computed(() => {
|
||||
const target = qualityTarget.value
|
||||
return target?.kind === 'video' ? (videos.value.find(item => item.id === target.assetId) ?? null) : null
|
||||
})
|
||||
const qualityTarget = ref<QualityTarget | null>(null)
|
||||
/** 修复入口打开面板时选择对应动作,仍需重新确认费用。 */
|
||||
const qualityAction = ref<'validate' | 'repair'>('validate')
|
||||
const specsOpen = ref(false)
|
||||
const generationCatalog = ref<GenerationModelCatalog | null>(null)
|
||||
const generationCatalogError = ref('')
|
||||
@@ -255,8 +270,10 @@ watch(
|
||||
* 从实际候选打开质量面板,先关闭候选弹窗,避免遮挡费用与操作确认。
|
||||
* @param kind 需要检查的资产种类
|
||||
* @param assetId 当前选中的真实资产编号
|
||||
* @param repair 是否直接进入修复选项,仍须确认费用
|
||||
*/
|
||||
function openQuality(kind: 'keyframe' | 'video', assetId: string) {
|
||||
function openQuality(kind: 'keyframe' | 'video', assetId: string, repair = false) {
|
||||
qualityAction.value = repair ? 'repair' : 'validate'
|
||||
candidatesOpen.value = false
|
||||
videoCandidatesOpen.value = false
|
||||
qualityTarget.value = {
|
||||
@@ -354,7 +371,31 @@ const videoCandidatesWidth = computed(() => candidateDialogWidth(videoCandidates
|
||||
function keyframePassed(assetId: string) {
|
||||
return sessionKeyframePassed(props.projectId, props.shot.shotId, assetId)
|
||||
}
|
||||
const videoStale = computed(() => !!props.videoReadiness?.primaryVideoStale)
|
||||
/** 主视频过期由资产终态及 readiness 共同说明。 */
|
||||
const videoStale = computed(
|
||||
() =>
|
||||
!!props.videoReadiness?.primaryVideoStale ||
|
||||
!!currentVideo.value?.motionPlanStale ||
|
||||
currentVideo.value?.qualityTerminalStatus === 'stale_motion_plan'
|
||||
)
|
||||
/** 后端具体原因优先,缺省时使用兼容概括说明。 */
|
||||
const videoStaleReason = computed(
|
||||
() =>
|
||||
props.videoReadiness?.primaryVideoStaleReasons?.join(';') ||
|
||||
currentVideo.value?.staleReason ||
|
||||
videoInputStaleReason
|
||||
)
|
||||
/** 权限或版本变化后撤销已失效的本会话结论与切换确认。 */
|
||||
watch(videos, items => {
|
||||
for (const item of items) {
|
||||
if (item.motionPlanStale || item.qualityTerminalStatus === 'stale_motion_plan') {
|
||||
clearVideoQualification(props.projectId, item.shotId, item.id)
|
||||
if (confirmingVideo.value === item.id) confirmingVideo.value = ''
|
||||
}
|
||||
}
|
||||
if (confirmingVideo.value && !items.find(item => item.id === confirmingVideo.value)?.canSetPrimary)
|
||||
confirmingVideo.value = ''
|
||||
})
|
||||
|
||||
watch(key, () => {
|
||||
qualityOpen.value = false
|
||||
@@ -467,22 +508,21 @@ async function refreshActiveVideo() {
|
||||
await refreshAll()
|
||||
}
|
||||
|
||||
/** 切换主视频只接受已完成并具有持久化地址的候选。 */
|
||||
/** 根据本候选后端权限切换主视频;冲突后撤销资格并重新读取真实资产。 */
|
||||
async function setPrimaryVideo() {
|
||||
const videoId = confirmingVideo.value
|
||||
if (assetBlocked.value || !videoId) return
|
||||
const video = videos.value.find(item => item.id === videoId)
|
||||
if (
|
||||
!video ||
|
||||
video.status !== 'completed' ||
|
||||
!video.videoUrl ||
|
||||
sessionVideoValidation(props.projectId, video.shotId, video.id)?.passed !== true
|
||||
)
|
||||
return
|
||||
if (!video || video.status !== 'completed' || !video.videoUrl || !videoOperationAllowed(video, 'primary')) return
|
||||
const shotId = props.shot.shotId
|
||||
confirmingVideo.value = ''
|
||||
await runOperation(props.projectId, `设置镜头 ${props.shot.shotNo} 主视频`, async () => {
|
||||
const result = await productionApi.setPrimaryVideo(shotId, videoId)
|
||||
const result = await productionApi
|
||||
.setPrimaryVideo(shotId, videoId, video.currentMotionPlanRevisionId)
|
||||
.catch(cause => {
|
||||
clearVideoConflict(cause, props.projectId, shotId, videoId)
|
||||
throw cause
|
||||
})
|
||||
if (!result || result.id !== videoId || !result.isPrimary || result.status !== 'completed')
|
||||
throw new Error('接口未确认主视频切换。')
|
||||
})
|
||||
@@ -664,8 +704,8 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
:messages="videoIssueMessages"
|
||||
/>
|
||||
</div>
|
||||
<!-- 以下是主视频素材变化说明模块,与此前画面检查结论分别说明 -->
|
||||
<p v-if="videoStale" class="mt-3 text-xs text-muted">首帧或参考图已变化,请重新生成视频。</p>
|
||||
<!-- 以下是主视频输入或动作规划版本变化说明模块,与此前画面检查结论分别说明 -->
|
||||
<p v-if="videoStale" class="mt-3 text-xs text-muted">{{ videoStaleReason }},请重新生成视频。</p>
|
||||
<!-- 以下是主视频展示模块,位于素材引用之前,其它记录在候选弹窗中查看 -->
|
||||
<div v-if="currentVideo" class="video-grid mt-4">
|
||||
<VideoCard
|
||||
@@ -680,6 +720,7 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
"
|
||||
:confirming="false"
|
||||
@quality="openQuality('video', currentVideo.id)"
|
||||
@repair="openQuality('video', currentVideo.id, true)"
|
||||
@history="openVideoHistory(currentVideo.id)"
|
||||
/>
|
||||
</div>
|
||||
@@ -875,8 +916,16 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
>
|
||||
</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" />
|
||||
<!-- 以下是与分镜详情一致的动作和视线模块间距 -->
|
||||
<div v-if="motionOpen" class="workspace-section-stack workspace-section-stack-spacious">
|
||||
<MotionPlanPanel
|
||||
:key="shot.shotId"
|
||||
:shot-id="shot.shotId"
|
||||
:project-id="projectId"
|
||||
:disabled="assetBlocked"
|
||||
:revision="savedPrompt?.updatedAt"
|
||||
@changed="refreshAll"
|
||||
/>
|
||||
<SpatialBindingsPanel
|
||||
:key="shot.shotId"
|
||||
:project-id="projectId"
|
||||
@@ -898,6 +947,8 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
v-model:open="qualityOpen"
|
||||
:project-id="projectId"
|
||||
:target="qualityTarget"
|
||||
:video="qualityVideo"
|
||||
:initial-action="qualityAction"
|
||||
:disabled="assetBlocked"
|
||||
@changed="refreshAll"
|
||||
@started="emit('qualityStarted', $event)"
|
||||
@@ -949,12 +1000,13 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
:item="item"
|
||||
:shot-no="shot.shotNo"
|
||||
:duration-seconds="shot.durationSeconds"
|
||||
:stale="false"
|
||||
:stale="item.motionPlanStale || item.qualityTerminalStatus === 'stale_motion_plan'"
|
||||
:blocked="assetBlocked"
|
||||
:validation-passed="sessionVideoValidation(projectId, item.shotId, item.id)?.passed ?? null"
|
||||
:recorded-validation-passed="videoRecordedValidation(videoQualityStatus, item.shotId, item.id)"
|
||||
:confirming="confirmingVideo === item.id"
|
||||
@quality="openQuality('video', item.id)"
|
||||
@repair="openQuality('video', item.id, true)"
|
||||
@history="openVideoHistory(item.id)"
|
||||
@select="confirmingVideo = item.id"
|
||||
@confirm="setPrimaryVideo"
|
||||
@@ -976,6 +1028,7 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
:shot-id="shot.shotId"
|
||||
:video-id="videoHistoryId"
|
||||
:stale="videoHistoryStale"
|
||||
:stale-reason="videoHistoryId === currentVideo?.id ? videoStaleReason : videoHistoryAsset?.staleReason"
|
||||
/>
|
||||
</AppDialog>
|
||||
<AppDialog
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { videoOperationAllowed } from '../video-permissions'
|
||||
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
|
||||
|
||||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
@@ -31,18 +32,18 @@ const props = defineProps<{
|
||||
confirming: boolean
|
||||
}>()
|
||||
/** 交由父面板执行检查与切换,卡片不直接调用生成接口。 */
|
||||
const emit = defineEmits<{ quality: []; history: []; select: []; confirm: []; cancel: [] }>()
|
||||
const emit = defineEmits<{ quality: []; repair: []; history: []; select: []; confirm: []; cancel: [] }>()
|
||||
/** 播放和外链共用经过协议与资源路径校验的地址。 */
|
||||
const videoUrl = computed(() => (props.item.videoUrl ? mediaAssetUrl(props.item.videoUrl) : null))
|
||||
/** 优先显示本次会话的检查结果,否则显示此视频已有的记录。 */
|
||||
const previousValidation = computed(() => props.validationPassed ?? props.recordedValidationPassed ?? null)
|
||||
/** 只有已完成且在当前会话检查通过的候选才能发起切换。 */
|
||||
/** 晋升资格只使用本候选的后端权限,历史通过不恢复过期资格。 */
|
||||
const canSelect = computed(
|
||||
() =>
|
||||
props.item.status === 'completed' &&
|
||||
!!videoUrl.value &&
|
||||
!props.item.isPrimary &&
|
||||
props.validationPassed === true
|
||||
videoOperationAllowed(props.item, 'primary')
|
||||
)
|
||||
</script>
|
||||
|
||||
@@ -75,10 +76,24 @@ const canSelect = computed(
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<StatusBadge :status="item.status" :label="productionStatusLabel(item.status)" />
|
||||
<NTag size="small" :bordered="false">{{ item.isPrimary ? '主视频' : '候选视频' }}</NTag>
|
||||
<NTag v-if="item.isPrimary && stale" size="small" type="warning" :bordered="false">需更新</NTag>
|
||||
<NTag
|
||||
v-if="stale || item.motionPlanStale || item.qualityTerminalStatus === 'stale_motion_plan'"
|
||||
size="small"
|
||||
type="warning"
|
||||
:bordered="false"
|
||||
>需更新</NTag
|
||||
>
|
||||
<span class="text-[10px] text-muted">{{ item.durationSeconds || durationSeconds || '—' }}s</span>
|
||||
</div>
|
||||
<!-- 以下是此视频此前检查结果模块,历史通过不代表当前素材仍然适用 -->
|
||||
<p v-if="item.staleReason" class="mt-2 text-xs text-muted">{{ item.staleReason }}</p>
|
||||
<p
|
||||
v-if="item.motionPlanRevisionId || item.currentMotionPlanRevisionId"
|
||||
class="mt-2 break-all text-[10px] text-muted"
|
||||
>
|
||||
生成动作版本 {{ item.motionPlanRevisionId ?? 'AI 原始' }} · 当前
|
||||
{{ item.currentMotionPlanRevisionId ?? 'AI 原始' }}
|
||||
</p>
|
||||
<p v-if="previousValidation !== null" class="mt-2 text-[11px] text-muted">
|
||||
{{ previousValidation ? '此前画面检查通过' : '此前画面检查未通过' }}
|
||||
</p>
|
||||
@@ -87,9 +102,23 @@ const canSelect = computed(
|
||||
{{ item.provider }} · {{ item.model }} · {{ formatDate(item.createdAt) }}
|
||||
</p>
|
||||
<div class="mt-3 flex flex-wrap gap-3">
|
||||
<NButton v-if="item.status === 'completed' && videoUrl" text size="small" @click="emit('quality')">
|
||||
<NButton
|
||||
v-if="item.status === 'completed' && videoUrl"
|
||||
:disabled="blocked || !videoOperationAllowed(item, 'validate')"
|
||||
text
|
||||
size="small"
|
||||
@click="emit('quality')"
|
||||
>
|
||||
质量检查
|
||||
</NButton>
|
||||
<NButton
|
||||
v-if="item.status === 'completed' && videoUrl && videoOperationAllowed(item, 'repair')"
|
||||
:disabled="blocked"
|
||||
text
|
||||
size="small"
|
||||
@click="emit('repair')"
|
||||
>创建修复候选</NButton
|
||||
>
|
||||
<NButton text size="small" @click="emit('history')">查看质量记录</NButton>
|
||||
<NButton v-if="canSelect" :disabled="blocked" text size="small" @click="emit('select')">
|
||||
设为主视频
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useQuery } from '../../../composables/useQuery'
|
||||
import { formatDate } from '../../../lib/format'
|
||||
import { videoDiagnosticsApi } from '../diagnostics-api'
|
||||
import { videoQualityStatusLabel } from '../model'
|
||||
import { videoInputStaleReason } from '../production-messages'
|
||||
import type { VideoQualityRollbackTarget } from '../diagnostics.types'
|
||||
|
||||
/** 视频诊断绑定正式镜头与用户选中的视频,随弹窗挂载直接读取。 */
|
||||
@@ -15,8 +16,10 @@ const props = defineProps<{
|
||||
shotId: string
|
||||
/** 用户选中的视频 ID。 */
|
||||
videoId: string
|
||||
/** 当前视频是否因首帧或参考图变化而需要更新。 */
|
||||
/** 当前视频是否因首帧、参考图或动作规划版本等输入变化而需要更新。 */
|
||||
stale: boolean
|
||||
/** 当前资产公开的过期原因,普通候选也可能不在自动链中。 */
|
||||
staleReason?: string | null
|
||||
}>()
|
||||
/** 查询目标包含镜头和视频,切换目标后取消旧请求。 */
|
||||
const key = computed(() => (props.shotId && props.videoId ? JSON.stringify([props.shotId, props.videoId]) : ''))
|
||||
@@ -37,6 +40,15 @@ const query = useQuery(key, async (value, signal) => {
|
||||
const detail = computed(() => query.data.value?.detail)
|
||||
/** 当前视频的独立记录,不能使用其它候选或流程整体结果兜底。 */
|
||||
const currentRecord = computed(() => detail.value?.chain.find(item => item.videoId === props.videoId))
|
||||
/** 当前候选的终态优先于保留的历史通过证据。 */
|
||||
const currentStale = computed(
|
||||
() =>
|
||||
props.stale ||
|
||||
!!currentRecord.value?.motionPlanStale ||
|
||||
currentRecord.value?.qualityTerminalStatus === 'stale_motion_plan'
|
||||
)
|
||||
/** 仅展示当前候选的具体原因,不能套用最新候选的原因。 */
|
||||
const reason = computed(() => currentRecord.value?.staleReason || props.staleReason || videoInputStaleReason)
|
||||
/** 当前视频优先展示,其它候选明确标识为相关记录。 */
|
||||
const orderedChain = computed(() => {
|
||||
const chain = detail.value?.chain ?? []
|
||||
@@ -69,8 +81,8 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
|
||||
<template>
|
||||
<!-- 以下是弹窗中的视频已有检查记录模块,无需再次点击查看 -->
|
||||
<section class="workspace-panel text-xs leading-6" aria-label="当前视频质量记录">
|
||||
<ContextNotice v-if="stale" type="warning" :show-icon="false" class="mb-3">
|
||||
此视频需要更新:首帧或参考图已变化。此前画面检查结果仅供参考,请重新生成视频。
|
||||
<ContextNotice v-if="currentStale" type="warning" :show-icon="false" class="mb-3">
|
||||
此视频需要更新:{{ reason }}。此前画面检查结果仅供参考,请重新生成视频。
|
||||
</ContextNotice>
|
||||
<ContextNotice v-if="query.error.value" type="error" :show-icon="false" role="alert">{{
|
||||
query.error.value
|
||||
@@ -79,11 +91,13 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
|
||||
<template v-else-if="detail">
|
||||
<p v-if="currentRecord" class="font-semibold">
|
||||
{{
|
||||
currentRecord.validationPassed === true
|
||||
? '当前视频此前画面检查通过'
|
||||
: currentRecord.validationPassed === false
|
||||
? '当前视频此前画面检查未通过'
|
||||
: '当前视频尚未完成画面检查'
|
||||
currentStale
|
||||
? '当前候选版本已过期,质量流程已停止;历史画面检查仅供参考'
|
||||
: currentRecord.validationPassed === true
|
||||
? '当前视频此前画面检查通过'
|
||||
: currentRecord.validationPassed === false
|
||||
? '当前视频此前画面检查未通过'
|
||||
: '当前视频尚未完成画面检查'
|
||||
}}
|
||||
</p>
|
||||
<p v-else class="text-muted">此视频暂无自动质量流程记录。</p>
|
||||
@@ -91,10 +105,17 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
|
||||
<p class="mt-3 text-muted">
|
||||
本镜头共 {{ detail.chain.length }} 条视频记录;当前视频优先显示,其它候选单独标识。
|
||||
</p>
|
||||
<p v-if="currentRecord" class="text-muted">
|
||||
生成动作版本 {{ currentRecord.motionPlanRevisionId ?? 'AI 原始' }} · 当前
|
||||
{{ currentRecord.currentMotionPlanRevisionId ?? 'AI 原始' }}
|
||||
</p>
|
||||
<p v-if="currentRecord" class="text-muted">
|
||||
当前视频修复 {{ currentRecord.repairAttempt }} / {{ currentRecord.maxRepairAttempts ?? '未设置' }}
|
||||
</p>
|
||||
<p v-if="['generating', 'validating', 'repairing'].includes(detail.status)" class="text-muted">
|
||||
<p
|
||||
v-if="!currentStale && ['generating', 'validating', 'repairing'].includes(detail.status)"
|
||||
class="text-muted"
|
||||
>
|
||||
当前镜头正在执行:{{ videoQualityStatusLabel(detail.status) }}
|
||||
</p>
|
||||
<p v-if="!detail.chain.length" class="mt-2 text-muted">当前镜头尚无质量链记录。</p>
|
||||
@@ -106,15 +127,18 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
|
||||
<span
|
||||
>{{ item.providerStatus }} ·
|
||||
{{
|
||||
item.validationPassed === true
|
||||
? '校验通过'
|
||||
: item.validationPassed === false
|
||||
? '校验未通过'
|
||||
: '尚未校验'
|
||||
item.motionPlanStale || item.qualityTerminalStatus === 'stale_motion_plan'
|
||||
? '动作版本过期,质量流程已停止'
|
||||
: item.validationPassed === true
|
||||
? '历史校验通过'
|
||||
: item.validationPassed === false
|
||||
? '校验未通过'
|
||||
: '尚未校验'
|
||||
}}</span
|
||||
>
|
||||
<span class="text-muted">{{ formatDate(item.updatedAt) }}</span>
|
||||
</div>
|
||||
<p v-if="item.staleReason" class="mt-2 text-xs">{{ item.staleReason }}</p>
|
||||
<ul v-if="item.issues.length" class="mt-2 space-y-1">
|
||||
<li
|
||||
v-for="(issue, index) in item.issues"
|
||||
|
||||
@@ -110,7 +110,8 @@ export function videoQualityStatusLabel(status: string): string {
|
||||
validating: '正在执行质量校验',
|
||||
repairing: '正在自动修复',
|
||||
passed: '质量校验通过',
|
||||
exhausted: '自动修复次数已用完'
|
||||
exhausted: '自动修复次数已用完',
|
||||
stale_motion_plan: '动作版本过期,质量流程已停止'
|
||||
}
|
||||
return labels[status] ?? status
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
import { issueLabel } from './model'
|
||||
import type { ProductionIssue } from './types'
|
||||
|
||||
/** 只返回过期布尔值时使用统一概括原因,不推断首帧、参考图或动作版本中的具体变化项。 */
|
||||
export const videoInputStaleReason = '视频输入已变化,可能涉及首帧、参考图或动作规划版本'
|
||||
|
||||
/**
|
||||
* 把后端生产原因转换为普通用户可读的中文提示。
|
||||
* @param message 后端原始说明或错误信息
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { ApiError } from '../../lib/http'
|
||||
import { reactive } from 'vue'
|
||||
import { validOptionalSize } from './model'
|
||||
import type { KeyframeReadiness } from './types'
|
||||
@@ -141,3 +142,26 @@ export function sessionKeyframePassed(projectId: string, shotId: string, assetId
|
||||
if (!receipt.result.repaired && receipt.result.initialKeyframeId === assetId) return receipt.result.passed
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤销指定视频的本会话操作资格,保留后端历史证据由只读接口展示。
|
||||
* @param projectId 项目 ID
|
||||
* @param shotId 镜头 ID
|
||||
* @param assetId 视频 ID
|
||||
*/
|
||||
export function clearVideoQualification(projectId: string, shotId: string, assetId: string) {
|
||||
const session = qualitySession(qualityKey(projectId, { kind: 'video', shotId, assetId, title: '' }))
|
||||
session.videoValidation = undefined
|
||||
session.receipt = null
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步视频权限冲突后统一撤销当前候选的会话资格。
|
||||
* @param cause 接口错误
|
||||
* @param projectId 项目 ID
|
||||
* @param shotId 镜头 ID
|
||||
* @param assetId 视频候选 ID
|
||||
*/
|
||||
export function clearVideoConflict(cause: unknown, projectId: string, shotId: string, assetId: string) {
|
||||
if (cause instanceof ApiError && cause.status === 409) clearVideoQualification(projectId, shotId, assetId)
|
||||
}
|
||||
@@ -20,9 +20,21 @@ export function keyframeFixture(patch: Partial<ShotKeyframe> = {}): ShotKeyframe
|
||||
}
|
||||
}
|
||||
|
||||
/** 视频测试记录,默认是已完成的主视频。 */
|
||||
/**
|
||||
* 视频测试记录沿用后端权限摘要,默认已完成主视频。
|
||||
* @param patch 覆盖字段
|
||||
* @returns 测试视频公开 DTO
|
||||
*/
|
||||
export function videoFixture(patch: Partial<ShotVideo> = {}): ShotVideo {
|
||||
return {
|
||||
motionPlanRevisionId: null,
|
||||
currentMotionPlanRevisionId: null,
|
||||
motionPlanStale: false,
|
||||
qualityTerminalStatus: null,
|
||||
staleReason: null,
|
||||
canValidate: true,
|
||||
canRepair: false,
|
||||
canSetPrimary: false,
|
||||
id: 'video-1',
|
||||
shotId: 'shot-1',
|
||||
provider: 'seedance',
|
||||
|
||||
@@ -78,8 +78,10 @@ export interface VideoReadinessItem {
|
||||
issues: ProductionIssue[]
|
||||
primaryVideoId?: string | null
|
||||
activeVideoId?: string | null
|
||||
/** 当前主视频已基于旧主首帧或旧主体参考图生成。 */
|
||||
/** 当前主视频的首帧、参考资产或动作规划版本已变化。 */
|
||||
primaryVideoStale?: boolean
|
||||
/** 后端给出的当前主视频过期原因。 */
|
||||
primaryVideoStaleReasons?: string[]
|
||||
providerInputRecovery?: ProviderInputRecoveryStatus | null
|
||||
}
|
||||
|
||||
@@ -150,8 +152,28 @@ export interface ShotKeyframe {
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
/** 视频候选独立的动作版本、终态及后端操作权限。 */
|
||||
export interface VideoPermissions {
|
||||
/** 生成时绑定的人工动作版本。 */
|
||||
motionPlanRevisionId: string | null
|
||||
/** 当前镜头生效的人工动作版本。 */
|
||||
currentMotionPlanRevisionId: string | null
|
||||
/** 是否已因动作版本变化而过期。 */
|
||||
motionPlanStale: boolean
|
||||
/** 已持久化的质量终态,切回旧版本也不撤销。 */
|
||||
qualityTerminalStatus: string | null
|
||||
/** 后端提供的过期原因。 */
|
||||
staleReason: string | null
|
||||
/** 是否允许视觉校验。 */
|
||||
canValidate: boolean
|
||||
/** 是否允许创建修复候选。 */
|
||||
canRepair: boolean
|
||||
/** 是否允许设为主视频。 */
|
||||
canSetPrimary: boolean
|
||||
}
|
||||
|
||||
/** 视频生成记录;完成后地址指向后端持久化的视频资产。 */
|
||||
export interface ShotVideo {
|
||||
export interface ShotVideo extends VideoPermissions {
|
||||
id: string
|
||||
shotId: string
|
||||
provider: string
|
||||
@@ -400,14 +422,14 @@ export interface ProjectVideoStatus {
|
||||
/** 单镜头严格质量链的持久化状态;读取不会重新调用模型。 */
|
||||
export interface ShotVideoQualityStatus {
|
||||
shotId: string
|
||||
status: 'not_started' | 'generating' | 'validating' | 'repairing' | 'passed' | 'exhausted'
|
||||
status: 'not_started' | 'generating' | 'validating' | 'repairing' | 'passed' | 'exhausted' | 'stale_motion_plan'
|
||||
primaryVideoId: string | null
|
||||
latestVideoId: string | null
|
||||
repairAttempt: number
|
||||
maxRepairAttempts: number | null
|
||||
validationPassed: boolean | null
|
||||
issues: unknown[]
|
||||
chain: {
|
||||
chain: (VideoPermissions & {
|
||||
videoId: string
|
||||
providerStatus: ShotVideo['status']
|
||||
isPrimary: boolean
|
||||
@@ -416,7 +438,7 @@ export interface ShotVideoQualityStatus {
|
||||
validationPassed: boolean | null
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}[]
|
||||
})[]
|
||||
}
|
||||
|
||||
/** 失败视频批量重试回执。 */
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { videoOperationAllowed } from './video-permissions'
|
||||
import { computed, onScopeDispose, watch } from 'vue'
|
||||
import { useWorkflowExecution } from '../workflows/execution'
|
||||
import { isQualityBatchResult } from './quality'
|
||||
@@ -8,11 +9,12 @@ import { productionApi } from './api'
|
||||
import { qualityApi } from './quality-api'
|
||||
import {
|
||||
isVisualValidation,
|
||||
clearVideoQualification,
|
||||
clearVideoConflict,
|
||||
qualityKey,
|
||||
qualitySession,
|
||||
qualityTargets,
|
||||
validQualityInput,
|
||||
sessionVideoValidation
|
||||
validQualityInput
|
||||
} from './quality'
|
||||
import type { QualityAction, QualityInput, QualityReceipt, QualityTarget, RepairAttempt } from './quality.types'
|
||||
|
||||
@@ -212,17 +214,20 @@ export function useQuality(
|
||||
video.durationSeconds <= 0
|
||||
)
|
||||
throw new Error('视频未完成、缺少视频地址或有效时长,不能执行抽样校验。')
|
||||
if (video.motionPlanStale || video.qualityTerminalStatus === 'stale_motion_plan')
|
||||
clearVideoQualification(projectId, target.shotId, target.assetId)
|
||||
if (!videoOperationAllowed(video, action === 'repair' ? 'repair' : 'validate'))
|
||||
throw new Error(video.staleReason || '后端当前不允许此候选执行所选质量操作,请刷新权限。')
|
||||
if (action === 'repair') {
|
||||
if (sessionVideoValidation(projectId, target.shotId, target.assetId)?.passed !== false)
|
||||
throw new Error('请先完成视频质量校验;只有未通过的视频才能创建修复候选。')
|
||||
if (videos.some(item => ['pending', 'queued', 'running'].includes(item.status)))
|
||||
throw new Error('此镜头仍有活动视频任务,请结束后再修复。')
|
||||
if (!stillCurrent()) throw new Error('已离开原操作目标,未提交质量任务。')
|
||||
const result = await qualityApi.repairVideo(
|
||||
target.shotId,
|
||||
target.assetId,
|
||||
input.maxRepairAttempts
|
||||
)
|
||||
const result = await qualityApi
|
||||
.repairVideo(target.shotId, target.assetId, input.maxRepairAttempts)
|
||||
.catch(cause => {
|
||||
clearVideoConflict(cause, projectId, target.shotId, target.assetId)
|
||||
throw cause
|
||||
})
|
||||
if (
|
||||
!result ||
|
||||
result.shotId !== target.shotId ||
|
||||
@@ -239,11 +244,12 @@ export function useQuality(
|
||||
receipt = { kind: 'video-repair', result }
|
||||
} else {
|
||||
if (!stillCurrent()) throw new Error('已离开原操作目标,未提交质量任务。')
|
||||
const result = await qualityApi.validateVideo(
|
||||
target.shotId,
|
||||
target.assetId,
|
||||
input.allowedTexts ?? []
|
||||
)
|
||||
const result = await qualityApi
|
||||
.validateVideo(target.shotId, target.assetId, input.allowedTexts ?? [])
|
||||
.catch(cause => {
|
||||
clearVideoConflict(cause, projectId, target.shotId, target.assetId)
|
||||
throw cause
|
||||
})
|
||||
if (
|
||||
!isVisualValidation(result) ||
|
||||
result.shotId !== target.shotId ||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { VideoPermissions } from './types'
|
||||
|
||||
/**
|
||||
* 过期终态优先于历史通过和权限标记;缺失权限默认禁用,版本为空不自行判过期。
|
||||
* @param video 当前候选公开摘要
|
||||
* @param action 所选视频操作
|
||||
* @returns 后端是否明确允许此候选执行操作
|
||||
*/
|
||||
export function videoOperationAllowed(
|
||||
video: Partial<VideoPermissions> | null | undefined,
|
||||
action: 'validate' | 'repair' | 'primary'
|
||||
) {
|
||||
if (!video || video.motionPlanStale || video.qualityTerminalStatus === 'stale_motion_plan') return false
|
||||
return (
|
||||
(action === 'validate' ? video.canValidate : action === 'repair' ? video.canRepair : video.canSetPrimary) ===
|
||||
true
|
||||
)
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import BeatShotDirectory from './components/BeatShotDirectory.vue'
|
||||
import SubjectCoverageAudit from './components/SubjectCoverageAudit.vue'
|
||||
import type { SubjectCoverageIssue } from './coverage.types'
|
||||
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||
import { useWorkflowExecution } from '../workflows/execution'
|
||||
import { useStoryboard } from './useStoryboard'
|
||||
import { storyboardApi, type StoryboardDurationAudit } from './api'
|
||||
|
||||
@@ -74,6 +75,8 @@ const {
|
||||
executions,
|
||||
run
|
||||
} = useStoryboard()
|
||||
/** 切换详情标签后仍观察起点视觉任务,重新进入项目时恢复真实终态。 */
|
||||
useWorkflowExecution(id, 'motion-plan-start-state-validation')
|
||||
const productionReady = computed(() => directionComplete.value && visualStateComplete.value)
|
||||
/** 分镜时长审计为只读预警,接口失败不能影响分镜设计。 */
|
||||
const durationAudit = ref<StoryboardDurationAudit | null>(null)
|
||||
@@ -552,11 +555,18 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
||||
><NTab name="design">设计与状态</NTab><NTab name="tools">参考图与提示词</NTab
|
||||
><NTab name="motion">动作与视线</NTab></NTabs
|
||||
>
|
||||
<div v-if="detailTab === 'motion'" class="pt-5 space-y-6">
|
||||
<!-- 以下是统一标签内容起点与模块间距的动作和视线模块 -->
|
||||
<div
|
||||
v-if="detailTab === 'motion'"
|
||||
class="pt-6 workspace-section-stack workspace-section-stack-spacious"
|
||||
>
|
||||
<MotionPlanPanel
|
||||
:key="shot.shotId"
|
||||
:shot-id="shot.shotId"
|
||||
:revision="session.prompts[shot.shotId]?.updatedAt"
|
||||
:project-id="id"
|
||||
:disabled="blocked"
|
||||
@changed="query.refresh"
|
||||
/>
|
||||
<SpatialBindingsPanel
|
||||
:key="shot.shotId"
|
||||
|
||||
@@ -1,12 +1,32 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { computed, ref } from 'vue'
|
||||
import { NButton, NTag, NSpin } from 'naive-ui'
|
||||
import { useQuery } from '../../../composables/useQuery'
|
||||
import { WorkspaceSectionHeading, WorkspaceRefreshButton } from '../../../components/ui'
|
||||
import IssueHint from '../../../components/ui/IssueHint.vue'
|
||||
import { motionApi } from '../motion-api'
|
||||
import MotionRevisionEditor from './MotionRevisionEditor.vue'
|
||||
|
||||
/** 单镜头动作计划嵌入当前位置,切换镜头时取消旧读取。 */
|
||||
const props = defineProps<{ shotId: string; revision?: string }>()
|
||||
const props = defineProps<{
|
||||
/** 正式镜头。 */
|
||||
shotId: string
|
||||
/** 所属项目,旧只读引用可以缺省。 */
|
||||
projectId?: string
|
||||
/** 外层更新标记。 */
|
||||
revision?: string
|
||||
/** 是否阻止修改。 */
|
||||
disabled?: boolean
|
||||
}>()
|
||||
/** 激活后通知外层刷新资产与就绪检查。 */
|
||||
const emit = defineEmits<{ changed: [] }>()
|
||||
/** 人工编辑只在用户明确打开后挂载。 */
|
||||
const editing = ref(false)
|
||||
/** 生效后刷新真实时间轴,不用草稿覆盖预览。 */
|
||||
async function changed() {
|
||||
await query.refresh()
|
||||
emit('changed')
|
||||
}
|
||||
/** 生成提示词后修改 revision,重新读取后端保存的动作时间轴。 */
|
||||
const key = computed(() => JSON.stringify([props.shotId, props.revision ?? '']))
|
||||
const query = useQuery(key, async (value, signal) => {
|
||||
@@ -34,10 +54,25 @@ const savedWarnings = computed(() =>
|
||||
|
||||
<template>
|
||||
<section class="motion-plan-panel" aria-label="镜头动作时间轴">
|
||||
<header class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h3 class="text-sm font-semibold">动作时间轴</h3>
|
||||
<NButton text size="small" :loading="query.loading.value" @click="query.refresh">刷新动作计划</NButton>
|
||||
</header>
|
||||
<!-- 以下是与参考图模块一致的标题、刷新与计划摘要模块 -->
|
||||
<WorkspaceSectionHeading title="动作时间轴">
|
||||
<template #actions>
|
||||
<WorkspaceRefreshButton label="刷新动作计划" :loading="query.loading.value" @refresh="query.refresh" />
|
||||
<NButton v-if="projectId" :disabled="disabled || !!query.error.value" @click="editing = true"
|
||||
>编辑动作修订</NButton
|
||||
>
|
||||
</template>
|
||||
<template v-if="query.data.value" #description>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<span v-if="query.data.value.source">{{
|
||||
query.data.value.source === 'manual' ? '人工生效版本' : 'AI 原始规划'
|
||||
}}</span>
|
||||
<span>{{ query.data.value.durationSeconds }} 秒 · {{ query.data.value.beats.length }} 个阶段</span>
|
||||
<NTag v-if="warnings.length" size="small" type="warning" :bordered="false">需人工复核</NTag>
|
||||
<IssueHint :messages="warnings" label="查看预警与建议" inline />
|
||||
</div>
|
||||
</template>
|
||||
</WorkspaceSectionHeading>
|
||||
<div
|
||||
v-if="query.loading.value && !query.data.value"
|
||||
class="flex items-center gap-2 py-5 text-xs text-muted"
|
||||
@@ -48,12 +83,7 @@ const savedWarnings = computed(() =>
|
||||
<div v-else-if="query.error.value" class="mt-3">
|
||||
<IssueHint :messages="[query.error.value]" type="error" inline />
|
||||
</div>
|
||||
<template v-if="query.data.value">
|
||||
<div class="mt-3 flex flex-wrap items-center gap-3 text-xs text-muted">
|
||||
<span>{{ query.data.value.durationSeconds }} 秒 · {{ query.data.value.beats.length }} 个阶段</span>
|
||||
<NTag v-if="warnings.length" size="small" type="warning" :bordered="false">需人工复核</NTag>
|
||||
<IssueHint :messages="warnings" label="查看预警与建议" inline />
|
||||
</div>
|
||||
<template v-if="query.data.value && !query.error.value">
|
||||
<p v-if="!query.data.value.motionPlanAvailable" class="mt-4 text-xs text-muted">
|
||||
尚无已保存动作计划,生成视频提示词后可在此查看。
|
||||
</p>
|
||||
@@ -96,13 +126,23 @@ const savedWarnings = computed(() =>
|
||||
<IssueHint :messages="savedWarnings" label="查看历史预警" inline />
|
||||
</div>
|
||||
</template>
|
||||
<!-- 以下是同一镜头的版本化动作编辑模块 -->
|
||||
<MotionRevisionEditor
|
||||
v-if="projectId"
|
||||
v-model:open="editing"
|
||||
:project-id="projectId"
|
||||
:shot-id="shotId"
|
||||
:disabled="disabled"
|
||||
@changed="changed"
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
@reference "../../../styles/styles.css";
|
||||
.motion-beats {
|
||||
@apply grid gap-3 list-none p-0;
|
||||
@apply grid list-none p-0;
|
||||
gap: var(--app-content-gap);
|
||||
}
|
||||
.motion-beat {
|
||||
@apply grid grid-cols-[104px_minmax(0,1fr)] gap-4 p-4 bg-(--app-subtle);
|
||||
|
||||
@@ -0,0 +1,510 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { NButton, NCheckbox, NInput, NInputNumber, NSelect, NTag } from 'naive-ui'
|
||||
import { AppDialog, AssetImage } from '../../../components/ui'
|
||||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
import { useMotionRevision } from '../useMotionRevision'
|
||||
import { formatDate } from '../../../lib/format'
|
||||
|
||||
/** 完整动作修订表单在分镜与生产工作区共用。 */
|
||||
const props = defineProps<{
|
||||
/** 所属项目。 */
|
||||
projectId: string
|
||||
/** 正式镜头。 */
|
||||
shotId: string
|
||||
/** 上游请求是否阻断。 */
|
||||
disabled?: boolean
|
||||
}>()
|
||||
/** 关闭不取消已启动的后台视觉任务。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 生效后通知外层刷新,不自动生成视频提示词。 */
|
||||
const emit = defineEmits<{ changed: [] }>()
|
||||
/** 修订状态与显式请求入口。 */
|
||||
const state = useMotionRevision(props, open, () => emit('changed'))
|
||||
/** 模板直接使用草稿和交互状态。 */
|
||||
const {
|
||||
draft,
|
||||
reason,
|
||||
acknowledged,
|
||||
selectedId,
|
||||
preview,
|
||||
error,
|
||||
notice,
|
||||
saved,
|
||||
pending,
|
||||
blocked,
|
||||
formBlocked,
|
||||
canActivate,
|
||||
invalidated,
|
||||
record
|
||||
} = state
|
||||
/** 版本选项包含来源、创建时间及真实生效标记。 */
|
||||
const options = computed(() =>
|
||||
(state.context.data.value?.history.revisions ?? []).map(item => ({
|
||||
label: `${item.isActive ? '生效 · ' : ''}${item.source === 'manual' ? '人工修订' : 'AI 原始'} · ${formatDate(item.createdAt)} · ${item.revisionId}`,
|
||||
value: item.revisionId
|
||||
}))
|
||||
)
|
||||
/** 结构错误与非阻断预警分别展示,不将预警当作通过资格。 */
|
||||
const previewMessages = computed(() => [
|
||||
...(preview.value?.schemaIssues ?? []).map(item => `${item.path}:${item.message}`),
|
||||
...(preview.value?.timelineIssues ?? []).map(item => item.message),
|
||||
...(preview.value?.actionDensityIssues ?? []).map(item => item.message)
|
||||
])
|
||||
/** 任务返回问题可能是视觉问题或门禁说明,按实际描述展示。 */
|
||||
const taskIssues = computed(() =>
|
||||
Array.isArray(record.value?.result?.issues)
|
||||
? record.value!.result!.issues.flatMap(item => {
|
||||
if (typeof item === 'string') return [item]
|
||||
if (item && typeof item === 'object' && 'description' in item && typeof item.description === 'string')
|
||||
return [item.description]
|
||||
return []
|
||||
})
|
||||
: []
|
||||
)
|
||||
/** 完成状态与通过语义分别显示。 */
|
||||
const taskLabel = computed(() =>
|
||||
!record.value
|
||||
? ''
|
||||
: record.value.status === 'failed'
|
||||
? '视觉任务失败'
|
||||
: record.value.status !== 'completed'
|
||||
? '正在执行起点视觉校验'
|
||||
: canActivate.value
|
||||
? '视觉校验通过,证据有效'
|
||||
: record.value.result?.passed === true
|
||||
? '历史校验通过,当前证据不可用'
|
||||
: '视觉校验未通过'
|
||||
)
|
||||
/**
|
||||
* 增加用户主动填写的完整阶段,最多五段。
|
||||
* @returns 是否已新增
|
||||
*/
|
||||
function addBeat() {
|
||||
if (blocked.value || draft.value.beats.length >= 5) return false
|
||||
draft.value.beats.push({
|
||||
startSecond: draft.value.beats.at(-1)?.endSecond ?? 0,
|
||||
endSecond: state.context.data.value?.preview.durationSeconds ?? 1,
|
||||
action: '',
|
||||
cameraMotion: '',
|
||||
physicalContinuity: '',
|
||||
subjectRefs: [],
|
||||
closingState: ''
|
||||
})
|
||||
return true
|
||||
}
|
||||
/**
|
||||
* 主体引用只按用户输入拆分,不推导其它主体。
|
||||
* @param index 阶段位置
|
||||
* @param value 逗号或换行分隔的引用
|
||||
*/
|
||||
function updateRefs(index: number, value: string) {
|
||||
const beat = draft.value.beats[index]
|
||||
if (beat)
|
||||
beat.subjectRefs = value
|
||||
.split(/[,,\n]/)
|
||||
.map(item => item.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是完整动作规划与历史版本编辑模块 -->
|
||||
<AppDialog
|
||||
v-model:open="open"
|
||||
title="人工动作修订"
|
||||
description="免费预检查并保存后,确认模型费用、执行起点视觉校验,再激活修订。"
|
||||
wide
|
||||
>
|
||||
<div class="motion-revision-layout">
|
||||
<ContextNotice v-if="state.context.error.value || error" type="error" :show-icon="false">{{
|
||||
state.context.error.value || error
|
||||
}}</ContextNotice>
|
||||
<!-- 以下是集中展示版本与本次主首帧的上下文模块 -->
|
||||
<section class="motion-revision-context" aria-label="修订版本与主首帧">
|
||||
<div class="motion-revision-section-heading">
|
||||
<div>
|
||||
<h3>修订版本</h3>
|
||||
<p class="motion-revision-description">
|
||||
{{ state.context.data.value?.preview.durationSeconds ?? '—' }} 秒 · 保存不生效、不调用模型
|
||||
</p>
|
||||
</div>
|
||||
<NButton :loading="state.context.loading.value" @click="state.context.refresh"
|
||||
>刷新版本与主首帧</NButton
|
||||
>
|
||||
</div>
|
||||
<label v-if="options.length" class="motion-revision-field">
|
||||
<span>编辑来源</span>
|
||||
<NSelect
|
||||
:value="selectedId || null"
|
||||
:options="options"
|
||||
:disabled="formBlocked"
|
||||
aria-label="动作修订版本"
|
||||
@update:value="state.select($event)"
|
||||
/>
|
||||
</label>
|
||||
<p v-else class="motion-revision-description">尚未初始化版本历史,首次保存会封存原始 AI 规划。</p>
|
||||
<div class="motion-revision-source">
|
||||
<div v-if="state.context.data.value?.primary?.imageUrl" class="motion-revision-thumbnail">
|
||||
<AssetImage
|
||||
:src="state.context.data.value.primary.imageUrl"
|
||||
alt="本次起点视觉校验的主首帧"
|
||||
object-fit="contain"
|
||||
:preview="true"
|
||||
/>
|
||||
</div>
|
||||
<dl class="motion-revision-source-details">
|
||||
<div>
|
||||
<dt>当前主首帧</dt>
|
||||
<dd>{{ state.context.data.value?.primary?.id ?? '尚无有效主首帧' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>当前生效版本</dt>
|
||||
<dd>{{ state.context.data.value?.history.activeRevisionId ?? 'AI 原始规划' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</section>
|
||||
<!-- 以下是完整阶段表单模块,长文本独占一行,短字段共用两列 -->
|
||||
<section
|
||||
v-for="(beat, index) in draft.beats"
|
||||
:key="index"
|
||||
class="workspace-panel motion-revision-section"
|
||||
:aria-label="`动作阶段 ${index + 1}`"
|
||||
>
|
||||
<div class="motion-revision-section-heading">
|
||||
<h3>阶段 {{ index + 1 }}</h3>
|
||||
<NButton
|
||||
quaternary
|
||||
:disabled="blocked || draft.beats.length <= 1"
|
||||
@click="draft.beats.splice(index, 1)"
|
||||
>删除阶段</NButton
|
||||
>
|
||||
</div>
|
||||
<div class="motion-revision-fields">
|
||||
<label class="motion-revision-field"
|
||||
><span>开始秒数</span>
|
||||
<NInputNumber
|
||||
v-model:value="beat.startSecond"
|
||||
:disabled="formBlocked"
|
||||
:min="0"
|
||||
:input-props="{ 'aria-label': `阶段 ${index + 1} 开始秒数` }"
|
||||
/>
|
||||
</label>
|
||||
<label class="motion-revision-field"
|
||||
><span>结束秒数</span>
|
||||
<NInputNumber
|
||||
v-model:value="beat.endSecond"
|
||||
:disabled="formBlocked"
|
||||
:min="0"
|
||||
:input-props="{ 'aria-label': `阶段 ${index + 1} 结束秒数` }"
|
||||
/>
|
||||
</label>
|
||||
<label class="motion-revision-field motion-revision-field-wide"
|
||||
><span>动作</span>
|
||||
<NInput
|
||||
v-model:value="beat.action"
|
||||
:disabled="formBlocked"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 6 }"
|
||||
:aria-label="`阶段 ${index + 1} 动作`"
|
||||
/>
|
||||
</label>
|
||||
<label class="motion-revision-field"
|
||||
><span>运镜</span>
|
||||
<NInput
|
||||
v-model:value="beat.cameraMotion"
|
||||
:disabled="formBlocked"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 4 }"
|
||||
:aria-label="`阶段 ${index + 1} 运镜`"
|
||||
/>
|
||||
</label>
|
||||
<label class="motion-revision-field"
|
||||
><span>主体引用(逗号分隔)</span>
|
||||
<NInput
|
||||
:value="beat.subjectRefs.join(', ')"
|
||||
:disabled="formBlocked"
|
||||
:aria-label="`阶段 ${index + 1} 主体引用`"
|
||||
@update:value="updateRefs(index, $event)"
|
||||
/>
|
||||
</label>
|
||||
<label class="motion-revision-field motion-revision-field-wide"
|
||||
><span>物理连续性</span>
|
||||
<NInput
|
||||
v-model:value="beat.physicalContinuity"
|
||||
:disabled="formBlocked"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 6 }"
|
||||
:aria-label="`阶段 ${index + 1} 连续性`"
|
||||
/>
|
||||
</label>
|
||||
<label class="motion-revision-field motion-revision-field-wide"
|
||||
><span>收尾状态</span>
|
||||
<NInput
|
||||
v-model:value="beat.closingState"
|
||||
:disabled="formBlocked"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 6 }"
|
||||
:aria-label="`阶段 ${index + 1} 收尾状态`"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
<div class="motion-revision-section-action">
|
||||
<NButton :disabled="blocked || draft.beats.length >= 5" @click="addBeat">添加动作阶段</NButton>
|
||||
<span class="motion-revision-description">{{ draft.beats.length }} / 5 个阶段</span>
|
||||
</div>
|
||||
<!-- 以下是整体约束与修改原因模块,标签和删除按钮分别对齐 -->
|
||||
<section class="workspace-panel motion-revision-section" aria-label="整体动作约束">
|
||||
<div class="motion-revision-section-heading">
|
||||
<h3>整体约束</h3>
|
||||
<span class="motion-revision-description">{{ draft.globalMotionConstraints.length }} / 8 项</span>
|
||||
</div>
|
||||
<div class="motion-revision-constraints">
|
||||
<div
|
||||
v-for="(_, index) in draft.globalMotionConstraints"
|
||||
:key="index"
|
||||
class="motion-revision-constraint-row"
|
||||
>
|
||||
<label class="motion-revision-field"
|
||||
><span>约束 {{ index + 1 }}</span>
|
||||
<NInput
|
||||
v-model:value="draft.globalMotionConstraints[index]"
|
||||
:disabled="formBlocked"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 1, maxRows: 4 }"
|
||||
:aria-label="`整体约束 ${index + 1}`"
|
||||
/>
|
||||
</label>
|
||||
<NButton
|
||||
quaternary
|
||||
:disabled="blocked || draft.globalMotionConstraints.length <= 1"
|
||||
@click="draft.globalMotionConstraints.splice(index, 1)"
|
||||
>删除</NButton
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<NButton
|
||||
:disabled="blocked || draft.globalMotionConstraints.length >= 8"
|
||||
@click="draft.globalMotionConstraints.push('')"
|
||||
>添加整体约束</NButton
|
||||
>
|
||||
</div>
|
||||
<label class="motion-revision-field"
|
||||
><span>修改原因</span>
|
||||
<NInput v-model:value="reason" :disabled="formBlocked" aria-label="动作修订原因" />
|
||||
</label>
|
||||
</section>
|
||||
<!-- 以下是免费预检查结果模块,与收费校验证据分开 -->
|
||||
<section v-if="preview" class="motion-revision-feedback" aria-label="免费预检查结果">
|
||||
<h3>预检查结果</h3>
|
||||
<p>{{ preview.valid ? '结构检查通过,仍须视觉校验;尚不可激活。' : '结构检查未通过,请修改草稿。' }}</p>
|
||||
<p v-for="(message, index) in previewMessages" :key="index">{{ message }}</p>
|
||||
</section>
|
||||
<!-- 以下是收费视觉校验与激活模块,费用说明和操作成组排列 -->
|
||||
<section class="workspace-panel motion-revision-section" aria-label="动作起点视觉校验">
|
||||
<h3>起点视觉校验</h3>
|
||||
<p class="motion-revision-description">
|
||||
起点视觉校验会调用服务端已配置的视觉模型并消耗额度。仅校验所选已保存修订与当前主首帧,不生成图片或视频。
|
||||
</p>
|
||||
<NCheckbox v-model:checked="acknowledged" :disabled="blocked || !saved"
|
||||
>我已确认本次起点视觉校验的模型费用和修订范围。</NCheckbox
|
||||
>
|
||||
<div class="motion-revision-validation-actions">
|
||||
<NButton
|
||||
:disabled="blocked || !saved || !acknowledged || !state.context.data.value?.primary"
|
||||
@click="state.validate"
|
||||
>启动起点视觉校验</NButton
|
||||
>
|
||||
<NButton
|
||||
v-if="record"
|
||||
:loading="state.execution.query.loading.value"
|
||||
@click="state.execution.query.refresh"
|
||||
>刷新视觉任务</NButton
|
||||
>
|
||||
<NButton type="primary" :disabled="!canActivate" @click="state.activate">激活此修订</NButton>
|
||||
</div>
|
||||
<div v-if="record || state.execution.query.error.value" class="motion-revision-feedback">
|
||||
<p v-if="record" role="status">{{ taskLabel }} · {{ record.id }}</p>
|
||||
<p v-if="state.execution.query.error.value" class="text-danger">
|
||||
{{ state.execution.query.error.value }}
|
||||
</p>
|
||||
<p v-if="record?.error" class="text-danger">{{ record.error }}</p>
|
||||
<p v-if="record?.result?.summary">{{ record.result.summary }}</p>
|
||||
<p v-for="(issue, index) in taskIssues" :key="index">{{ issue }}</p>
|
||||
<NTag v-if="invalidated && record" type="warning" :bordered="false"
|
||||
>草稿或输入已变化,请重新校验</NTag
|
||||
>
|
||||
</div>
|
||||
</section>
|
||||
<ContextNotice v-if="notice" type="info" :show-icon="false">{{ notice }}</ContextNotice>
|
||||
</div>
|
||||
<!-- 以下是固定底栏的免费操作与关闭入口模块 -->
|
||||
<template #footer>
|
||||
<div class="motion-revision-footer">
|
||||
<div class="motion-revision-save-actions">
|
||||
<NButton :disabled="blocked" :loading="pending" @click="state.precheck">免费预检查</NButton>
|
||||
<NButton :disabled="blocked || preview?.valid !== true" @click="state.save">保存为新修订</NButton>
|
||||
</div>
|
||||
<NButton @click="open = false">关闭</NButton>
|
||||
</div>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 弹窗内独立控制字段与区块间距,不影响其它页面的公共面板。 */
|
||||
.motion-revision-layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: calc(var(--app-content-gap) * 2);
|
||||
}
|
||||
.motion-revision-layout > .workspace-panel {
|
||||
margin: 0;
|
||||
}
|
||||
.motion-revision-context,
|
||||
.motion-revision-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
min-width: 0;
|
||||
}
|
||||
.motion-revision-section-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
.motion-revision-layout h3 {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.motion-revision-description {
|
||||
margin: 0;
|
||||
color: var(--app-muted);
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.motion-revision-section-heading .motion-revision-description {
|
||||
margin-top: 4px;
|
||||
}
|
||||
.motion-revision-source {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
min-width: 0;
|
||||
}
|
||||
.motion-revision-thumbnail {
|
||||
width: 88px;
|
||||
flex: 0 0 88px;
|
||||
}
|
||||
.motion-revision-thumbnail :deep(.asset-image) {
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
.motion-revision-source-details {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.motion-revision-source-details dt {
|
||||
color: var(--app-muted);
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.motion-revision-source-details dd {
|
||||
margin: 4px 0 0;
|
||||
overflow-wrap: anywhere;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.motion-revision-fields {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
.motion-revision-field {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
align-content: start;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.motion-revision-field-wide {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.motion-revision-field :deep(.n-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
.motion-revision-constraints {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
}
|
||||
.motion-revision-constraint-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
align-items: end;
|
||||
gap: 12px;
|
||||
}
|
||||
.motion-revision-section-action,
|
||||
.motion-revision-validation-actions,
|
||||
.motion-revision-save-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
.motion-revision-feedback {
|
||||
display: grid;
|
||||
justify-items: start;
|
||||
gap: 8px;
|
||||
overflow-wrap: anywhere;
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.motion-revision-feedback p {
|
||||
margin: 0;
|
||||
}
|
||||
.motion-revision-footer {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
/* 仅此弹窗的底栏铺满宽度,使免费操作和关闭按钮分别对齐两侧。 */
|
||||
:global(.app-dialog .dialog-footer:has(> .motion-revision-footer)) {
|
||||
width: 100%;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
.motion-revision-fields {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
.motion-revision-layout > .workspace-panel {
|
||||
padding: 16px;
|
||||
}
|
||||
.motion-revision-source {
|
||||
align-items: flex-start;
|
||||
}
|
||||
.motion-revision-thumbnail {
|
||||
width: 64px;
|
||||
flex-basis: 64px;
|
||||
}
|
||||
.motion-revision-footer {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.motion-revision-save-actions {
|
||||
flex: 1;
|
||||
}
|
||||
.motion-revision-validation-actions {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { WorkspaceSectionHeading } from '../../../components/ui'
|
||||
import { NTag } from 'naive-ui'
|
||||
import { directionLabel } from '../model'
|
||||
import type { DesignedShot } from '../types'
|
||||
@@ -8,11 +9,12 @@ defineProps<{ shot: DesignedShot }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-7">
|
||||
<div class="workspace-section-stack workspace-section-stack-spacious">
|
||||
<section>
|
||||
<h3 class="mb-4 text-sm font-semibold">导演摄影设计</h3>
|
||||
<!-- 以下是统一的导演设计模块标题 -->
|
||||
<WorkspaceSectionHeading title="导演摄影设计" />
|
||||
<template v-if="shot.direction"
|
||||
><div class="mb-5 flex flex-wrap gap-2">
|
||||
><div class="mt-4 mb-5 flex flex-wrap gap-2">
|
||||
<NTag
|
||||
v-for="field in [
|
||||
{ key: 'shotSize', label: '景别' },
|
||||
@@ -36,12 +38,13 @@ defineProps<{ shot: DesignedShot }>()
|
||||
<dd>{{ shot.direction.visualIntent }}</dd>
|
||||
</dl></template
|
||||
>
|
||||
<p v-else class="text-sm text-muted">此镜头尚无已保存的导演设计。</p>
|
||||
<p v-else class="mt-4 text-sm text-muted">此镜头尚无已保存的导演设计。</p>
|
||||
</section>
|
||||
<section class="pt-6">
|
||||
<h3 class="mb-4 text-sm font-semibold">画面状态</h3>
|
||||
<section>
|
||||
<!-- 以下是统一的画面状态模块标题 -->
|
||||
<WorkspaceSectionHeading title="画面状态" />
|
||||
<template v-if="shot.visualState"
|
||||
><dl class="detail-grid">
|
||||
><dl class="detail-grid mt-4">
|
||||
<dt>时间</dt>
|
||||
<dd>{{ shot.visualState.timeOfDay || '未指定' }}</dd>
|
||||
<dt>天气</dt>
|
||||
@@ -78,7 +81,7 @@ defineProps<{ shot: DesignedShot }>()
|
||||
</dl>
|
||||
</article></template
|
||||
>
|
||||
<p v-else class="text-sm leading-6 text-muted">此镜头还没有画面状态,请先完成镜头设计。</p>
|
||||
<p v-else class="mt-4 text-sm leading-6 text-muted">此镜头还没有画面状态,请先完成镜头设计。</p>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
@@ -3,9 +3,9 @@ import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
|
||||
|
||||
import { NScrollbar, NButton, NCheckbox } from 'naive-ui'
|
||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||
import { Download, ExternalLink, RefreshCw } from '@lucide/vue'
|
||||
import { Download, ExternalLink } from '@lucide/vue'
|
||||
import IssueHint from '../../../components/ui/IssueHint.vue'
|
||||
import { AssetImage } from '../../../components/ui'
|
||||
import { AssetImage, WorkspaceSectionHeading, WorkspaceRefreshButton } from '../../../components/ui'
|
||||
import { storyboardApi } from '../api'
|
||||
import { getStoryboardSession, referenceImageUrl } from '../model'
|
||||
import type { DesignedShot, ShotReferences } from '../types'
|
||||
@@ -130,17 +130,22 @@ function exportResult(kind: 'spec' | 'prompt') {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-7">
|
||||
<div class="workspace-section-stack workspace-section-stack-spacious">
|
||||
<section>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h3 class="text-sm font-semibold">主体参考图</h3>
|
||||
<NButton :disabled="busy.references || locked" :loading="busy.references" @click="load('references')"
|
||||
><RefreshCw :size="13" :class="{ 'animate-spin': busy.references }" />刷新参考图</NButton
|
||||
>
|
||||
</div>
|
||||
<p class="mt-2 text-xs leading-6 text-muted">
|
||||
自动读取镜头当前绑定形态的主参考图,不生成新图。切换镜头会同步刷新,参考图缺失会影响后续生成。
|
||||
</p>
|
||||
<!-- 以下是统一的参考图模块标题、说明与刷新操作模块 -->
|
||||
<WorkspaceSectionHeading
|
||||
title="主体参考图"
|
||||
description="自动读取镜头当前绑定形态的主参考图,不生成新图。切换镜头会同步刷新,参考图缺失会影响后续生成。"
|
||||
>
|
||||
<template #actions>
|
||||
<WorkspaceRefreshButton
|
||||
label="刷新参考图"
|
||||
:disabled="busy.references || locked"
|
||||
:loading="busy.references"
|
||||
@refresh="load('references')"
|
||||
/>
|
||||
</template>
|
||||
</WorkspaceSectionHeading>
|
||||
<FeedbackMessage v-if="errors.references" :message="errors.references" />
|
||||
<template v-if="references">
|
||||
<div class="reference-grid mt-4">
|
||||
@@ -182,20 +187,21 @@ function exportResult(kind: 'spec' | 'prompt') {
|
||||
</p>
|
||||
</template>
|
||||
</section>
|
||||
<section class="pt-6">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h3 class="text-sm font-semibold">镜头生成规格</h3>
|
||||
<NButton
|
||||
:disabled="locked || busy.spec || !shot.direction || !shot.visualState"
|
||||
:loading="busy.spec"
|
||||
@click="load('spec')"
|
||||
>{{ busy.spec ? '编译中…' : '读取生成规格' }}</NButton
|
||||
>
|
||||
</div>
|
||||
<p class="mt-2 text-xs leading-6 text-muted">
|
||||
后端合并主体稳定身份、具体形态、摄影设计与即时状态,编译为 GenerationSpec,不调用模型。需要本镜头已有
|
||||
Direction 和 VisualState。
|
||||
</p>
|
||||
<section>
|
||||
<!-- 以下是统一的生成规格模块标题与读取操作模块 -->
|
||||
<WorkspaceSectionHeading
|
||||
title="镜头生成规格"
|
||||
description="后端合并主体稳定身份、具体形态、摄影设计与即时状态,编译为 GenerationSpec,不调用模型。需要本镜头已有 Direction 和 VisualState。"
|
||||
>
|
||||
<template #actions>
|
||||
<NButton
|
||||
:disabled="locked || busy.spec || !shot.direction || !shot.visualState"
|
||||
:loading="busy.spec"
|
||||
@click="load('spec')"
|
||||
>{{ busy.spec ? '编译中…' : '读取生成规格' }}</NButton
|
||||
>
|
||||
</template>
|
||||
</WorkspaceSectionHeading>
|
||||
<FeedbackMessage v-if="errors.spec" :message="errors.spec" />
|
||||
<template v-if="spec"
|
||||
><div class="mt-4 flex items-center justify-between">
|
||||
@@ -208,12 +214,12 @@ function exportResult(kind: 'spec' | 'prompt') {
|
||||
</NScrollbar>
|
||||
</template>
|
||||
</section>
|
||||
<section class="pt-6">
|
||||
<h3 class="text-sm font-semibold">视频提示词</h3>
|
||||
<p class="mt-2 text-xs leading-6 text-muted">
|
||||
已有提示词可直接复用,没有则依据 GenerationSpec 与参考图调用模型生成。此处只处理
|
||||
Prompt;首帧和实际视频任务请到“镜头生产”。
|
||||
</p>
|
||||
<section>
|
||||
<!-- 以下是统一的视频提示词模块标题与说明模块 -->
|
||||
<WorkspaceSectionHeading
|
||||
title="视频提示词"
|
||||
description="已有提示词可直接复用,没有则依据 GenerationSpec 与参考图调用模型生成。此处只处理 Prompt;首帧和实际视频任务请到“镜头生产”。"
|
||||
/>
|
||||
<div class="mt-4 flex flex-wrap items-center gap-4">
|
||||
<ConfirmAction
|
||||
:label="force ? '重新生成提示词' : '生成提示词'"
|
||||
@@ -256,7 +262,8 @@ function exportResult(kind: 'spec' | 'prompt') {
|
||||
@apply py-3 px-[15px] rounded-none bg-(--app-subtle) text-ink text-xs leading-[1.8] wrap-anywhere;
|
||||
}
|
||||
.reference-grid {
|
||||
@apply grid grid-cols-[repeat(auto-fill,_minmax(150px,_1fr))] gap-3.5;
|
||||
@apply grid grid-cols-[repeat(auto-fill,_minmax(150px,_1fr))];
|
||||
gap: var(--app-content-gap);
|
||||
}
|
||||
.reference-card {
|
||||
@apply bg-(--app-subtle) rounded-none overflow-hidden;
|
||||
|
||||
@@ -4,6 +4,7 @@ import { NButton, NInput, NSelect, NPopconfirm } from 'naive-ui'
|
||||
import { useQuery } from '../../../composables/useQuery'
|
||||
import { useFeedbackMessage } from '../../../composables/useFeedbackMessage'
|
||||
import { useActionMessage } from '../../../components/ui/useActionMessage'
|
||||
import { WorkspaceSectionHeading, WorkspaceRefreshButton } from '../../../components/ui'
|
||||
import IssueHint from '../../../components/ui/IssueHint.vue'
|
||||
import { runOperation, getOperation } from '../../workflows/operations'
|
||||
import { storyboardApi } from '../api'
|
||||
@@ -181,15 +182,20 @@ async function inspectGaze() {
|
||||
|
||||
<template>
|
||||
<section class="spatial-bindings-panel" aria-label="人工确认视线目标">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h3 class="text-sm font-semibold">视线目标</h3>
|
||||
<NButton text size="small" :loading="query.loading.value" :disabled="dirty || saving" @click="query.refresh"
|
||||
>刷新绑定</NButton
|
||||
>
|
||||
</div>
|
||||
<p class="mt-2 text-xs leading-6 text-muted">
|
||||
明确“朝向目标方向”或“注视具体目标”,保存后重新核对相关提示词和首帧。
|
||||
</p>
|
||||
<!-- 以下是统一的视线模块标题、说明与刷新操作模块 -->
|
||||
<WorkspaceSectionHeading
|
||||
title="视线目标"
|
||||
description="明确“朝向目标方向”或“注视具体目标”,保存后重新核对相关提示词和首帧。"
|
||||
>
|
||||
<template #actions>
|
||||
<WorkspaceRefreshButton
|
||||
label="刷新绑定"
|
||||
:loading="query.loading.value"
|
||||
:disabled="dirty || saving"
|
||||
@refresh="query.refresh"
|
||||
/>
|
||||
</template>
|
||||
</WorkspaceSectionHeading>
|
||||
<IssueHint :messages="query.error.value ? [query.error.value] : []" type="error" />
|
||||
<div class="mt-4 grid gap-4">
|
||||
<section v-for="(binding, index) in draft" :key="index" class="spatial-binding-row">
|
||||
|
||||
@@ -1,8 +1,84 @@
|
||||
import type { MotionPlan, MotionRevision, MotionRevisionHistory, MotionRevisionPreview } from './motion-revision'
|
||||
import type { WorkflowExecutionStart } from '../workflows/execution.types'
|
||||
import { request } from '../../lib/http'
|
||||
import type { MotionPlanAudit, MotionPlanPreview } from './motion.types'
|
||||
|
||||
/** 动作时间轴入口只读,不生成提示词,也不改变镜头时长。 */
|
||||
/** 动作查询与修订入口;只有明确启动视觉校验会调用模型。 */
|
||||
export const motionApi = {
|
||||
/**
|
||||
* 查询真实修订历史。
|
||||
* @param shotId 镜头 ID
|
||||
* @param signal 取消信号
|
||||
* @returns 版本历史与生效指针
|
||||
*/
|
||||
revisions: (shotId: string, signal?: AbortSignal) =>
|
||||
request<MotionRevisionHistory>(`/storyboard-shots/${encodeURIComponent(shotId)}/motion-plan/revisions`, {
|
||||
signal
|
||||
}),
|
||||
/**
|
||||
* 免费检查完整草稿,不激活版本。
|
||||
* @param shotId 镜头 ID
|
||||
* @param motionPlan 完整规划
|
||||
* @returns 结构检查与预警
|
||||
*/
|
||||
previewRevision: (shotId: string, motionPlan: MotionPlan) =>
|
||||
request<MotionRevisionPreview>(
|
||||
`/storyboard-shots/${encodeURIComponent(shotId)}/motion-plan/revisions/preview`,
|
||||
{ method: 'POST', body: { motionPlan } }
|
||||
),
|
||||
/**
|
||||
* 保存不可变修订,不调用模型。
|
||||
* @param shotId 镜头 ID
|
||||
* @param input 完整规划、父版本与原因
|
||||
* @returns 未生效修订
|
||||
*/
|
||||
saveRevision: (
|
||||
shotId: string,
|
||||
input: { motionPlan: MotionPlan; parentRevisionId: string | null; reason: string | null }
|
||||
) =>
|
||||
request<MotionRevision>(`/storyboard-shots/${encodeURIComponent(shotId)}/motion-plan/revisions`, {
|
||||
method: 'POST',
|
||||
body: input
|
||||
}),
|
||||
/**
|
||||
* 明确确认费用后启动服务端视觉模型,不接收请求级模型配置。
|
||||
* @param shotId 镜头 ID
|
||||
* @param revisionId 校验版本
|
||||
* @param input 当前主首帧及当前生效指针
|
||||
* @returns 持久化任务句柄
|
||||
*/
|
||||
validateRevision: (
|
||||
shotId: string,
|
||||
revisionId: string,
|
||||
input: { primaryKeyframeId: string; expectedRevisionId: string | null }
|
||||
) =>
|
||||
request<WorkflowExecutionStart & { willCallModel: true }>(
|
||||
`/storyboard-shots/${encodeURIComponent(shotId)}/motion-plan/revisions/${encodeURIComponent(revisionId)}/start-state-validation/start`,
|
||||
{ method: 'POST', body: input }
|
||||
),
|
||||
/**
|
||||
* 使用当前有效视觉证据激活已保存版本。
|
||||
* @param shotId 镜头 ID
|
||||
* @param revisionId 目标版本
|
||||
* @param input 当前指针与校验任务 ID
|
||||
* @returns 生效状态及提示词失效标记
|
||||
*/
|
||||
activateRevision: (
|
||||
shotId: string,
|
||||
revisionId: string,
|
||||
input: { expectedRevisionId: string | null; validationExecutionId: string }
|
||||
) =>
|
||||
request<{
|
||||
shotId: string
|
||||
activeRevisionId: string
|
||||
motionPlanFingerprint: string
|
||||
changed: boolean
|
||||
videoPromptStale: boolean
|
||||
}>(
|
||||
`/storyboard-shots/${encodeURIComponent(shotId)}/motion-plan/revisions/${encodeURIComponent(revisionId)}/active`,
|
||||
{ method: 'PUT', body: input }
|
||||
),
|
||||
|
||||
/**
|
||||
* 读取单镜头已保存的动作计划和实时复核建议。
|
||||
* @param shotId 正式镜头 ID
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
import type { MotionBeat, MotionIssue } from './motion.types'
|
||||
import type { ShotKeyframe } from '../production/types'
|
||||
import type { WorkflowExecution } from '../workflows/execution.types'
|
||||
|
||||
/** 可编辑的完整动作规划,与后端 schema 一致。 */
|
||||
export interface MotionPlan {
|
||||
/** 一至五个动作阶段。 */
|
||||
beats: MotionBeat[]
|
||||
/** 一至八条整体运动约束。 */
|
||||
globalMotionConstraints: string[]
|
||||
}
|
||||
/** 不可变动作修订,生效状态由后端返回。 */
|
||||
export interface MotionRevision {
|
||||
/** 修订 ID。 */
|
||||
revisionId: string
|
||||
/** 所属镜头。 */
|
||||
shotId: string
|
||||
/** 修订来源。 */
|
||||
source: 'ai_original' | 'manual'
|
||||
/** 实际父版本。 */
|
||||
parentRevisionId: string | null
|
||||
/** 修改原因。 */
|
||||
reason: string | null
|
||||
/** 完整规划快照。 */
|
||||
motionPlan: MotionPlan
|
||||
/** 镜头时长。 */
|
||||
durationSeconds: number
|
||||
/** 服务端内容指纹。 */
|
||||
fingerprint: string
|
||||
/** ISO 创建时间。 */
|
||||
createdAt: string
|
||||
/** 是否生效。 */
|
||||
isActive: boolean
|
||||
}
|
||||
/** 空历史与空生效指针均为合法状态。 */
|
||||
export interface MotionRevisionHistory {
|
||||
/** 镜头 ID。 */
|
||||
shotId: string
|
||||
/** 原始封存版本。 */
|
||||
originalRevisionId: string | null
|
||||
/** 当前生效版本。 */
|
||||
activeRevisionId: string | null
|
||||
/** 所有版本。 */
|
||||
revisions: MotionRevision[]
|
||||
}
|
||||
/** 免费预检查不授予激活权限。 */
|
||||
export interface MotionRevisionPreview {
|
||||
/** 镜头 ID。 */
|
||||
shotId: string
|
||||
/** 仅结构合法。 */
|
||||
valid: boolean
|
||||
/** 通过结构检查后的指纹。 */
|
||||
motionPlanFingerprint: string | null
|
||||
/** 结构错误位置与原因。 */
|
||||
schemaIssues: { path: string; message: string }[]
|
||||
/** 时间预警。 */
|
||||
timelineIssues: MotionIssue[]
|
||||
/** 密度预警。 */
|
||||
actionDensityIssues: MotionIssue[]
|
||||
/** 必须进一步视觉校验。 */
|
||||
requiresStartStateValidation: true
|
||||
/** 预检查不能激活。 */
|
||||
canActivate: false
|
||||
/** 不调用模型。 */
|
||||
willCallModel: false
|
||||
/** 不修改资产。 */
|
||||
willModifyAssets: false
|
||||
}
|
||||
/** 起点视觉校验的实际问题结构。 */
|
||||
export interface MotionValidationIssue {
|
||||
/** 起点冲突种类。 */
|
||||
type: 'state_replay' | 'keyframe_conflict' | 'subject_spawn_risk'
|
||||
/** 警告或错误。 */
|
||||
severity: 'warning' | 'error'
|
||||
/** 问题说明。 */
|
||||
description: string
|
||||
/** 涉及主体。 */
|
||||
subjectRef?: string
|
||||
}
|
||||
/** 任务完成后的视觉证据;完成不代表通过。 */
|
||||
export interface MotionValidationResult {
|
||||
/** 镜头 ID。 */
|
||||
shotId: string
|
||||
/** 被校验版本。 */
|
||||
revisionId: string
|
||||
/** 被校验内容指纹。 */
|
||||
fingerprint: string
|
||||
/** 主首帧 ID。 */
|
||||
primaryKeyframeId: string
|
||||
/** 主首帧图片地址。 */
|
||||
primaryKeyframeImageUrl: string
|
||||
/** 校验启动时的生效指针。 */
|
||||
expectedRevisionId: string | null
|
||||
/** 后端最终通过标记。 */
|
||||
passed: boolean
|
||||
/** 是否失效。 */
|
||||
stale: boolean
|
||||
/** 汇总问题。 */
|
||||
issues: MotionValidationIssue[]
|
||||
/** 汇总说明。 */
|
||||
summary: string
|
||||
/** 模型校验结论。 */
|
||||
validation: {
|
||||
/** 是否通过视觉检查。 */
|
||||
passed: boolean
|
||||
/** 是否重演首帧状态。 */
|
||||
stateReplayDetected: boolean
|
||||
/** 模型问题。 */
|
||||
issues: MotionValidationIssue[]
|
||||
/** 模型说明。 */
|
||||
summary: string
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 只接受完整且仍绑定当前修订、主首帧和生效版本的已通过证据。
|
||||
* @param execution 持久化任务
|
||||
* @param revision 已保存修订
|
||||
* @param primary 当前主首帧
|
||||
* @param activeRevisionId 当前生效版本
|
||||
* @returns 是否允许请求激活
|
||||
*/
|
||||
export function motionEvidenceCurrent(
|
||||
execution: WorkflowExecution | null,
|
||||
revision: MotionRevision | null,
|
||||
primary: ShotKeyframe | null,
|
||||
activeRevisionId: string | null
|
||||
): boolean {
|
||||
const result = execution?.result
|
||||
const validation = result?.validation as MotionValidationResult['validation'] | undefined
|
||||
return !!(
|
||||
execution?.status === 'completed' &&
|
||||
execution.workflowName === 'motion-plan-start-state-validation' &&
|
||||
revision &&
|
||||
primary?.imageUrl &&
|
||||
primary.status === 'completed' &&
|
||||
primary.isPrimary &&
|
||||
primary.source !== 'provider_variant' &&
|
||||
result?.passed === true &&
|
||||
result.stale === false &&
|
||||
validation?.passed === true &&
|
||||
result.shotId === revision.shotId &&
|
||||
result.revisionId === revision.revisionId &&
|
||||
result.fingerprint === revision.fingerprint &&
|
||||
result.primaryKeyframeId === primary.id &&
|
||||
result.primaryKeyframeImageUrl === primary.imageUrl &&
|
||||
result.expectedRevisionId === activeRevisionId
|
||||
)
|
||||
}
|
||||
@@ -19,6 +19,12 @@ export interface MotionBeat {
|
||||
|
||||
/** 单镜头动作时间轴详情,实时审计与历史生成记录分别保存。 */
|
||||
export interface MotionPlanPreview {
|
||||
/** 当前生效规划来源。 */
|
||||
source?: 'ai_original' | 'manual' | null
|
||||
/** 当前生效修订,历史镜头可为空。 */
|
||||
activeRevisionId?: string | null
|
||||
/** 生效规划内容指纹。 */
|
||||
motionPlanFingerprint?: string | null
|
||||
shotId: string
|
||||
episodeNo: number
|
||||
beatNo: number
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
import { computed, ref, watch, onScopeDispose, type Ref } from 'vue'
|
||||
import { usePolling } from '../../composables/usePolling'
|
||||
import { motionApi } from './motion-api'
|
||||
import { productionApi } from '../production/api'
|
||||
import { useWorkflowExecution } from '../workflows/execution'
|
||||
import { getOperation, runOperation } from '../workflows/operations'
|
||||
import { ApiError, errorMessage } from '../../lib/http'
|
||||
import { motionEvidenceCurrent, type MotionPlan, type MotionRevisionPreview } from './motion-revision'
|
||||
|
||||
/**
|
||||
* 管理一个镜头的完整草稿、免费预检、保存和付费视觉任务;切镜后丢弃迟到 UI 更新。
|
||||
* @param props 当前镜头与项目
|
||||
* @param open 编辑面板可见状态
|
||||
* @param changed 激活成功后通知外层刷新资产和就绪状态
|
||||
* @returns 表单状态与明确操作入口
|
||||
*/
|
||||
export function useMotionRevision(
|
||||
props: { projectId: string; shotId: string; disabled?: boolean },
|
||||
open: Ref<boolean>,
|
||||
changed: () => void
|
||||
) {
|
||||
/** 任务观察按项目隔离,真实状态来自持久化接口。 */
|
||||
const project = computed(() => props.projectId)
|
||||
const execution = useWorkflowExecution(project, 'motion-plan-start-state-validation')
|
||||
/** 原目标身份同时用于废弃迟到响应。 */
|
||||
const identity = computed(() => JSON.stringify([props.projectId, props.shotId]))
|
||||
/** 面板关闭后不发起普通查询;活动任务仍由任务观察器恢复。 */
|
||||
const key = computed(() => (open.value ? identity.value : ''))
|
||||
/** 查询期间显示已有后端数据,但出错时禁用所有写入。 */
|
||||
const context = usePolling(
|
||||
key,
|
||||
async (value, signal) => {
|
||||
if (!value) return null
|
||||
const [, shotId] = JSON.parse(value) as [string, string]
|
||||
const [history, preview, keyframes] = await Promise.all([
|
||||
motionApi.revisions(shotId, signal),
|
||||
motionApi.preview(shotId, signal),
|
||||
productionApi.listKeyframes(shotId, signal)
|
||||
])
|
||||
if (
|
||||
history.shotId !== shotId ||
|
||||
preview.shotId !== shotId ||
|
||||
keyframes.some(item => item.shotId !== shotId)
|
||||
)
|
||||
throw new Error('动作修订或首帧与当前镜头不匹配。')
|
||||
return {
|
||||
history,
|
||||
preview,
|
||||
primary:
|
||||
keyframes.find(
|
||||
item => item.isPrimary && item.status === 'completed' && item.source !== 'provider_variant'
|
||||
) ?? null
|
||||
}
|
||||
},
|
||||
computed(() => (open.value ? 5000 : false))
|
||||
)
|
||||
/** 当前选择的已保存版本;空值表示从历史 AI 预览开始。 */
|
||||
const selectedId = ref('')
|
||||
/** 全字段动作草稿,不允许自动生成占位阶段。 */
|
||||
const draft = ref<MotionPlan>({ beats: [], globalMotionConstraints: [] })
|
||||
/** 人工修改原因。 */
|
||||
const reason = ref('')
|
||||
/** 只保留当前草稿的免费预检查。 */
|
||||
const preview = ref<MotionRevisionPreview | null>(null)
|
||||
/** 明确确认视觉模型费用。 */
|
||||
const acknowledged = ref(false)
|
||||
/** 草稿或输入变化后不再认可旧视觉证据。 */
|
||||
const invalidated = ref(false)
|
||||
/** 本次请求错误独立于只读查询。 */
|
||||
const error = ref('')
|
||||
/** 激活成功的提示词更新说明。 */
|
||||
const notice = ref('')
|
||||
/** 拷贝历史时不误判为用户修改。 */
|
||||
let copying = false
|
||||
/** 卸载后不更新当前界面。 */
|
||||
let disposed = false
|
||||
onScopeDispose(() => {
|
||||
disposed = true
|
||||
})
|
||||
/** 当前后端保存版本,不以草稿代替不可变修订。 */
|
||||
const revision = computed(
|
||||
() => context.data.value?.history.revisions.find(item => item.revisionId === selectedId.value) ?? null
|
||||
)
|
||||
/** 草稿与所选修订内容保持一致才可校验或激活。 */
|
||||
const saved = computed(
|
||||
() => !!revision.value && JSON.stringify(draft.value) === JSON.stringify(revision.value.motionPlan)
|
||||
)
|
||||
/** 项目已有请求或后台任务时禁止重复发起。 */
|
||||
const pending = computed(() => getOperation(props.projectId).pending)
|
||||
/** 自动核对输入期间允许继续填写草稿,不让定时查询打断输入焦点。 */
|
||||
const formBlocked = computed(
|
||||
() => !!props.disabled || pending.value || !!context.error.value || !context.data.value
|
||||
)
|
||||
/** 后端查询缺失或失败时不使用旧数据提交。 */
|
||||
const blocked = computed(
|
||||
() => !!props.disabled || pending.value || context.loading.value || !!context.error.value || !context.data.value
|
||||
)
|
||||
/** 当前任务只展示本镜头记录,其他镜头任务不充当证据。 */
|
||||
const record = computed(() => {
|
||||
const item = execution.query.data.value
|
||||
return item?.metadata?.shotId === props.shotId || item?.result?.shotId === props.shotId ? item : null
|
||||
})
|
||||
/** 完成、通过、未失效且所有绑定匹配才开放激活。 */
|
||||
const evidenceValid = computed(
|
||||
() =>
|
||||
saved.value &&
|
||||
!invalidated.value &&
|
||||
motionEvidenceCurrent(
|
||||
record.value,
|
||||
revision.value,
|
||||
context.data.value?.primary ?? null,
|
||||
context.data.value?.history.activeRevisionId ?? null
|
||||
)
|
||||
)
|
||||
/** 查询与请求进行中临时禁用提交,不把有效证据误显示为失效。 */
|
||||
const canActivate = computed(() => !blocked.value && evidenceValid.value)
|
||||
/** 当前版本和主首帧输入变化也撤销费用确认及旧证据。 */
|
||||
const binding = computed(() =>
|
||||
JSON.stringify([
|
||||
context.data.value?.history.activeRevisionId ?? null,
|
||||
context.data.value?.primary?.id ?? null,
|
||||
context.data.value?.primary?.imageUrl ?? null
|
||||
])
|
||||
)
|
||||
watch(binding, (_value, old) => {
|
||||
if (old && old !== '[null,null,null]') invalidated.value = true
|
||||
acknowledged.value = false
|
||||
})
|
||||
watch(
|
||||
draft,
|
||||
() => {
|
||||
preview.value = null
|
||||
acknowledged.value = false
|
||||
if (!copying) invalidated.value = true
|
||||
},
|
||||
{ deep: true, flush: 'sync' }
|
||||
)
|
||||
watch([identity, open], () => {
|
||||
selectedId.value = ''
|
||||
draft.value = { beats: [], globalMotionConstraints: [] }
|
||||
preview.value = null
|
||||
reason.value = ''
|
||||
error.value = ''
|
||||
notice.value = ''
|
||||
acknowledged.value = false
|
||||
})
|
||||
/**
|
||||
* 复制所选版本或真实 AI 规划;改变来源后须重新取得视觉证据。
|
||||
* @param id 所选版本 ID,空值使用预览
|
||||
* @param initial 首次恢复允许核对已持久化任务
|
||||
*/
|
||||
function select(id: string, initial = false) {
|
||||
const value = context.data.value
|
||||
if (!value) return
|
||||
const source =
|
||||
value.history.revisions.find(item => item.revisionId === id)?.motionPlan ??
|
||||
(id ? null : { beats: value.preview.beats, globalMotionConstraints: value.preview.globalMotionConstraints })
|
||||
if (!source) return
|
||||
copying = true
|
||||
selectedId.value = id
|
||||
draft.value = JSON.parse(JSON.stringify(source)) as MotionPlan
|
||||
copying = false
|
||||
preview.value = null
|
||||
reason.value = ''
|
||||
acknowledged.value = false
|
||||
invalidated.value = !initial
|
||||
notice.value = ''
|
||||
}
|
||||
watch(
|
||||
() => context.data.value,
|
||||
value => {
|
||||
if (value && !selectedId.value && draft.value.beats.length === 0)
|
||||
select(
|
||||
value.history.activeRevisionId ??
|
||||
value.history.originalRevisionId ??
|
||||
value.history.revisions.at(-1)?.revisionId ??
|
||||
'',
|
||||
true
|
||||
)
|
||||
}
|
||||
)
|
||||
/** 刷新或重开时恢复同镜头的真实任务版本;用户修改后不恢复旧资格。 */
|
||||
watch([() => context.data.value, record], ([value, task]) => {
|
||||
const id = task?.metadata?.revisionId
|
||||
if (
|
||||
value &&
|
||||
typeof id === 'string' &&
|
||||
!invalidated.value &&
|
||||
!preview.value &&
|
||||
value.history.revisions.some(item => item.revisionId === id) &&
|
||||
selectedId.value !== id &&
|
||||
(saved.value || draft.value.beats.length === 0)
|
||||
)
|
||||
select(id, true)
|
||||
})
|
||||
/**
|
||||
* 发起一次明确操作;冲突后刷新绑定,成功也校验响应目标。
|
||||
* @param label 操作说明
|
||||
* @param action 固定原镜头操作
|
||||
*/
|
||||
async function perform(label: string, action: () => Promise<void>) {
|
||||
if (blocked.value) return
|
||||
const target = identity.value
|
||||
error.value = ''
|
||||
notice.value = ''
|
||||
await runOperation(props.projectId, label, async () => {
|
||||
try {
|
||||
await action()
|
||||
} catch (cause) {
|
||||
if (!disposed && identity.value === target) {
|
||||
error.value = errorMessage(cause)
|
||||
if (cause instanceof ApiError && cause.status === 409) {
|
||||
invalidated.value = true
|
||||
acknowledged.value = false
|
||||
await context.refresh()
|
||||
changed()
|
||||
}
|
||||
}
|
||||
throw cause
|
||||
}
|
||||
})
|
||||
}
|
||||
/** 免费检查本次完整草稿;编辑或切镜后丢弃迟到回执。 */
|
||||
async function precheck() {
|
||||
const shotId = props.shotId
|
||||
const plan = JSON.parse(JSON.stringify(draft.value)) as MotionPlan
|
||||
const signature = JSON.stringify(plan)
|
||||
await perform('免费检查动作修订', async () => {
|
||||
const result = await motionApi.previewRevision(shotId, plan)
|
||||
if (!disposed && props.shotId === shotId && signature === JSON.stringify(draft.value)) {
|
||||
if (result.shotId !== shotId) throw new Error('预检查回执与镜头不匹配。')
|
||||
preview.value = result
|
||||
}
|
||||
})
|
||||
}
|
||||
/** 保存必须先获得当前草稿的结构通过结果,不激活或调用模型。 */
|
||||
async function save() {
|
||||
if (preview.value?.valid !== true) return
|
||||
const target = identity.value
|
||||
const shotId = props.shotId
|
||||
const plan = JSON.parse(JSON.stringify(draft.value)) as MotionPlan
|
||||
const parentRevisionId = selectedId.value || null
|
||||
await perform('保存动作修订', async () => {
|
||||
const result = await motionApi.saveRevision(shotId, {
|
||||
motionPlan: plan,
|
||||
parentRevisionId,
|
||||
reason: reason.value.trim() || null
|
||||
})
|
||||
if (result.shotId !== shotId || result.source !== 'manual' || result.isActive || !result.revisionId)
|
||||
throw new Error('保存回执不是当前镜头的未生效人工版本。')
|
||||
if (disposed || identity.value !== target) return
|
||||
await context.refresh()
|
||||
select(result.revisionId)
|
||||
notice.value = '修订已保存,尚未生效;请确认模型费用后校验。'
|
||||
})
|
||||
}
|
||||
/** 用户确认费用后重新读取首帧与生效指针,再启动视觉模型。 */
|
||||
async function validate() {
|
||||
if (!acknowledged.value || !saved.value || !revision.value || !context.data.value?.primary) return
|
||||
const target = identity.value
|
||||
const selected = revision.value
|
||||
const originalProjectId = props.projectId
|
||||
const expectedBinding = binding.value
|
||||
acknowledged.value = false
|
||||
await perform('校验动作修订起点', async () => {
|
||||
await context.refresh()
|
||||
if (
|
||||
disposed ||
|
||||
identity.value !== target ||
|
||||
context.error.value ||
|
||||
expectedBinding !== binding.value ||
|
||||
!saved.value
|
||||
)
|
||||
throw new Error('主首帧或生效版本已变化,请刷新并重新确认费用。')
|
||||
const primary = context.data.value?.primary
|
||||
if (!primary?.imageUrl) throw new Error('尚无有效主首帧,不能启动视觉校验。')
|
||||
const result = await motionApi.validateRevision(selected.shotId, selected.revisionId, {
|
||||
primaryKeyframeId: primary.id,
|
||||
expectedRevisionId: context.data.value!.history.activeRevisionId
|
||||
})
|
||||
if (!result.executionId || result.willCallModel !== true)
|
||||
throw new Error('未返回有效视觉校验任务,请刷新,勿重复提交。')
|
||||
if (!disposed && identity.value === target) invalidated.value = false
|
||||
await execution.track(result.executionId, originalProjectId)
|
||||
})
|
||||
}
|
||||
/** 激活前再次刷新并核对全部证据,成功后通知两个工作区同步。 */
|
||||
async function activate() {
|
||||
if (!canActivate.value || !revision.value || !record.value) return
|
||||
const target = identity.value
|
||||
const selected = revision.value
|
||||
const taskId = record.value.id
|
||||
await perform('激活动作修订', async () => {
|
||||
await context.refresh()
|
||||
if (
|
||||
disposed ||
|
||||
identity.value !== target ||
|
||||
context.error.value ||
|
||||
!saved.value ||
|
||||
invalidated.value ||
|
||||
!motionEvidenceCurrent(
|
||||
record.value,
|
||||
selected,
|
||||
context.data.value?.primary ?? null,
|
||||
context.data.value?.history.activeRevisionId ?? null
|
||||
)
|
||||
)
|
||||
throw new Error('视觉证据已失效,请重新校验当前修订。')
|
||||
const result = await motionApi.activateRevision(props.shotId, selected.revisionId, {
|
||||
expectedRevisionId: context.data.value!.history.activeRevisionId,
|
||||
validationExecutionId: taskId
|
||||
})
|
||||
if (
|
||||
result.shotId !== selected.shotId ||
|
||||
result.activeRevisionId !== selected.revisionId ||
|
||||
result.motionPlanFingerprint !== selected.fingerprint
|
||||
)
|
||||
throw new Error('激活回执与目标版本不匹配,请刷新核对。')
|
||||
if (disposed || identity.value !== target) return
|
||||
await context.refresh()
|
||||
changed()
|
||||
notice.value = result.videoPromptStale
|
||||
? '修订已生效。请重新生成视频提示词;旧视频候选仍保留,未自动提交生成任务。'
|
||||
: '此版本已生效。'
|
||||
})
|
||||
}
|
||||
return {
|
||||
context,
|
||||
selectedId,
|
||||
draft,
|
||||
reason,
|
||||
preview,
|
||||
acknowledged,
|
||||
error,
|
||||
notice,
|
||||
revision,
|
||||
saved,
|
||||
pending,
|
||||
blocked,
|
||||
formBlocked,
|
||||
record,
|
||||
execution,
|
||||
canActivate,
|
||||
evidenceValid,
|
||||
invalidated,
|
||||
select,
|
||||
precheck,
|
||||
save,
|
||||
validate,
|
||||
activate
|
||||
}
|
||||
}
|
||||
@@ -32,13 +32,46 @@ const statusLabel = computed(() => {
|
||||
const labels = { pending: '等待开始', running: '执行中', completed: '已完成', failed: '失败' }
|
||||
return props.execution ? labels[props.execution.status] : ''
|
||||
})
|
||||
const statusType = computed(() =>
|
||||
props.execution?.status === 'completed' ? 'success' : props.execution?.status === 'failed' ? 'error' : 'warning'
|
||||
)
|
||||
const finished = computed(() => ['completed', 'failed'].includes(props.execution?.status ?? ''))
|
||||
/** 是否为剧本创作任务,避免使用镜头素材的提示文案。 */
|
||||
const scriptCreation = computed(() => props.execution?.workflowName === 'create-drama')
|
||||
/** 视频质量任务使用后端聚合后的候选终态统计。 */
|
||||
const videoQuality = computed(() => props.execution?.workflowName === 'video-quality')
|
||||
/** 旧任务没有版本过期计数时按零展示,仅接受后端非负整数计数。 */
|
||||
const staleMotionPlanCount = computed(() => {
|
||||
const count =
|
||||
props.execution?.status === 'completed'
|
||||
? result.value.staleMotionPlan
|
||||
: props.execution?.metadata?.staleMotionPlan
|
||||
return typeof count === 'number' && Number.isSafeInteger(count) && count >= 0 ? count : 0
|
||||
})
|
||||
/** 视频流程结束但含过期候选时使用警告标签,不显示全成功的绿色状态。 */
|
||||
const statusType = computed(() =>
|
||||
props.execution?.status === 'completed'
|
||||
? videoQuality.value && staleMotionPlanCount.value > 0
|
||||
? 'warning'
|
||||
: 'success'
|
||||
: props.execution?.status === 'failed'
|
||||
? 'error'
|
||||
: 'warning'
|
||||
)
|
||||
/** 逐镜终态从运行 metadata 或完成 result 读取,不根据历史通过猜测状态。 */
|
||||
const settledItems = computed(() => {
|
||||
const settled = props.execution?.status === 'completed' ? result.value.settled : props.execution?.metadata?.settled
|
||||
if (!settled || typeof settled !== 'object' || Array.isArray(settled)) return []
|
||||
return Object.entries(settled).flatMap(([shotId, item]) => {
|
||||
if (
|
||||
!item ||
|
||||
typeof item !== 'object' ||
|
||||
!('status' in item) ||
|
||||
!('videoId' in item) ||
|
||||
typeof item.status !== 'string' ||
|
||||
typeof item.videoId !== 'string'
|
||||
)
|
||||
return []
|
||||
return [{ shotId, status: item.status, videoId: item.videoId }]
|
||||
})
|
||||
})
|
||||
/** 首帧质量后台任务使用独立的通过与修复失败统计,不套用普通生图字段。 */
|
||||
const keyframeQuality = computed(() => props.execution?.workflowName === 'keyframe-quality')
|
||||
/** 首帧编辑复用质量工作流,最终回执不属于批量质量统计。 */
|
||||
@@ -156,10 +189,12 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
: result.validationSkipped === true
|
||||
? 'info'
|
||||
: 'warning'
|
||||
: keyframeQuality &&
|
||||
(!keyframeCounts || keyframeCounts.repairFailed + keyframeCounts.failed > 0)
|
||||
: videoQuality && staleMotionPlanCount > 0
|
||||
? 'warning'
|
||||
: 'success'
|
||||
: keyframeQuality &&
|
||||
(!keyframeCounts || keyframeCounts.repairFailed + keyframeCounts.failed > 0)
|
||||
? 'warning'
|
||||
: 'success'
|
||||
"
|
||||
:show-icon="false"
|
||||
class="mt-3"
|
||||
@@ -174,7 +209,12 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
<p v-if="videoQuality" class="mt-2 text-xs">
|
||||
目标 {{ result.targetCount ?? execution.total }} · 通过 {{ result.passed ?? 0 }} · 修复耗尽
|
||||
{{ result.exhausted ?? 0 }} · 模型失败 {{ result.providerFailed ?? 0 }} · 提交失败
|
||||
{{ result.submissionFailed ?? 0 }}
|
||||
{{ result.submissionFailed ?? 0 }} · 动作版本过期 {{ staleMotionPlanCount }}
|
||||
</p>
|
||||
<!-- 以下是动作版本变化后停止质量流程的候选说明模块 -->
|
||||
<p v-if="videoQuality && staleMotionPlanCount > 0" class="mt-2 text-xs">
|
||||
{{ staleMotionPlanCount }}
|
||||
个镜头的候选因动作规划版本变化已停止质量流程。请先更新视频提示词,再按当前动作规划重新生成视频。
|
||||
</p>
|
||||
<p v-if="videoQuality && inputPlanCounts" class="mt-2 text-xs">
|
||||
输入规划:首帧模式 {{ inputPlanCounts.firstFrame }} · 全模态参考
|
||||
@@ -215,8 +255,27 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
<details class="mt-3 text-[10px] text-muted">
|
||||
<summary class="cursor-pointer">任务详情</summary>
|
||||
<p class="mt-2 break-all font-mono">任务编号 · {{ execution.id }}</p>
|
||||
<!-- 以下是逐镜已结束质量任务的持久化状态模块 -->
|
||||
<ul v-if="videoQuality && settledItems.length" class="mt-2 space-y-2">
|
||||
<li v-for="item in settledItems" :key="item.shotId" class="break-all">
|
||||
<a
|
||||
:href="`/projects/${encodeURIComponent(execution.projectId)}/production?shotId=${encodeURIComponent(item.shotId)}`"
|
||||
class="text-button"
|
||||
>查看镜头</a
|
||||
>
|
||||
· {{ executionStageLabel(item.status) }} · 视频 {{ item.videoId }}
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
</template>
|
||||
<!-- 以下是运行期间已经终止的过期候选统计模块 -->
|
||||
<p
|
||||
v-if="videoQuality && execution?.status === 'running' && staleMotionPlanCount > 0"
|
||||
class="mt-3 text-xs"
|
||||
role="status"
|
||||
>
|
||||
动作版本过期 {{ staleMotionPlanCount }} · 这些候选已停止质量流程,其余镜头继续处理。
|
||||
</p>
|
||||
<ContextNotice v-if="error" type="error" :show-icon="false" class="mt-3">
|
||||
{{ error }}。任务可能仍在运行,请先重新读取状态;不要直接重复提交。
|
||||
<NButton text class="ml-3" :loading="loading" @click="emit('refresh')">重试读取</NButton>
|
||||
|
||||
@@ -76,6 +76,7 @@ export function executionStageLabel(stage: string | null) {
|
||||
provider_failed: '模型生成失败',
|
||||
submission_failed: '任务提交失败',
|
||||
completed: '执行完成',
|
||||
stale_motion_plan: '动作版本过期,质量流程已停止',
|
||||
failed: '执行失败'
|
||||
}
|
||||
return labels[stage] ?? stage
|
||||
@@ -193,9 +194,24 @@ export function useWorkflowExecution(projectId: Ref<string>, workflowName: strin
|
||||
)
|
||||
return
|
||||
}
|
||||
const failures = ['failed', 'repairFailed', 'exhausted', 'providerFailed', 'submissionFailed'].some(
|
||||
field => typeof result[field] === 'number' && Number(result[field]) > 0
|
||||
)
|
||||
if (record.workflowName === 'motion-plan-start-state-validation') {
|
||||
const passed = result.passed === true && result.stale === false
|
||||
message[passed ? 'info' : 'warning'](
|
||||
passed
|
||||
? '动作起点视觉校验通过,请核对证据后手动激活。'
|
||||
: '动作起点校验未通过或证据已失效,请查看任务结果。',
|
||||
{ duration: 6000, closable: true }
|
||||
)
|
||||
return
|
||||
}
|
||||
const failures = [
|
||||
'staleMotionPlan',
|
||||
'failed',
|
||||
'repairFailed',
|
||||
'exhausted',
|
||||
'providerFailed',
|
||||
'submissionFailed'
|
||||
].some(field => typeof result[field] === 'number' && Number(result[field]) > 0)
|
||||
message[failures ? 'warning' : 'info'](
|
||||
failures
|
||||
? '本轮任务已结束,部分结果未通过或执行失败,请查看任务记录。'
|
||||
|
||||
+11
-3
@@ -3,7 +3,9 @@ export class ApiError extends Error {
|
||||
constructor(
|
||||
message: string,
|
||||
public readonly status: number,
|
||||
public readonly details?: unknown
|
||||
public readonly details?: unknown,
|
||||
/** 同步接口的顶层业务错误码;普通 400 或网络错误可缺省。 */
|
||||
public readonly code?: string
|
||||
) {
|
||||
super(message)
|
||||
this.name = 'ApiError'
|
||||
@@ -23,7 +25,12 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
||||
}
|
||||
|
||||
/** 兼容普通 {data} 响应,以及 POST /projects 的顶层 202 响应。 */
|
||||
/**
|
||||
* 解析公开响应及顶层同步错误码,不自动重试写入。
|
||||
* @param path 不含统一 API 前缀的正式路径
|
||||
* @param options 方法、请求体及取消信号
|
||||
* @returns 解包后的公开响应
|
||||
*/
|
||||
export async function request<T>(path: string, options: RequestOptions = {}): Promise<T> {
|
||||
const base = (import.meta.env.VITE_API_BASE_URL || '/api').replace(/\/$/, '')
|
||||
const multipart = typeof FormData !== 'undefined' && options.body instanceof FormData
|
||||
@@ -58,7 +65,8 @@ export async function request<T>(path: string, options: RequestOptions = {}): Pr
|
||||
throw new ApiError(
|
||||
message,
|
||||
response.status,
|
||||
isRecord(data) ? (data.details ?? data.issues ?? data.error) : data
|
||||
isRecord(data) ? (data.details ?? data.issues ?? data.error) : data,
|
||||
isRecord(data) && typeof data.code === 'string' ? data.code : undefined
|
||||
)
|
||||
}
|
||||
return (isRecord(data) && 'data' in data ? data.data : data) as T
|
||||
|
||||
@@ -193,6 +193,10 @@ body {
|
||||
.workspace-section-stack > * {
|
||||
margin-block: 0 !important;
|
||||
}
|
||||
/* 独立详情模块采用两倍全局间距,避免 gap 与模块顶部留白叠加。 */
|
||||
.workspace-section-stack.workspace-section-stack-spacious {
|
||||
gap: calc(var(--app-content-gap) * 2);
|
||||
}
|
||||
.workspace-panel {
|
||||
padding: 20px;
|
||||
background: var(--app-subtle);
|
||||
|
||||
Reference in new issue
Block a user