feat(short-drama-agent-front): 接入人工动作修订与视频版本权限

This commit is contained in:
GJ committed 2026-10-14 13:44:02 +08:00
1 parent 7a60db3ced
commit fa76165960
38 files changed
+2003 -158

No files matched your search

+11 -3
View File
@@ -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
+10 -2
View File
@@ -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"
+2 -1
View File
@@ -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 后端原始说明或错误信息
+24
View File
@@ -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)
}
+13 -1
View File
@@ -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',
+27 -5
View File
@@ -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
}[]
})[]
}
/** 失败视频批量重试回执。 */
+20 -14
View File
@@ -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
)
}