feat: 接入视频输入规划与任务筛选
This commit is contained in:
1 parent
9747a8f0ab
commit
2c3e72ae9a
7 files changed
+264
-96
No files matched your search
@@ -3,7 +3,7 @@ import ProviderInputInspector from './ProviderInputInspector.vue'
|
||||
import { NAlert, NButton, NCollapse, NCollapseItem, NTag } from 'naive-ui'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { ExternalLink, ImagePlus, RefreshCw } from '@lucide/vue'
|
||||
import { AssetImage, StatusBadge } from '../../../components/ui'
|
||||
import { StatusBadge } from '../../../components/ui'
|
||||
import { usePolling } from '../../../composables/usePolling'
|
||||
import { mediaAssetUrl } from '../../../lib/assets'
|
||||
import { errorMessage } from '../../../lib/http'
|
||||
@@ -54,34 +54,37 @@ const key = computed(() => props.shot.shotId)
|
||||
const query = usePolling(
|
||||
key,
|
||||
async (shotId, signal) => {
|
||||
const [keyframes, videos, qualityState] = await Promise.all([
|
||||
const [keyframes, videos, qualityState, inputPlanState] = await Promise.all([
|
||||
productionApi.listKeyframes(shotId, signal),
|
||||
productionApi.listVideos(shotId, signal),
|
||||
productionApi
|
||||
.videoQualityStatus(shotId, signal)
|
||||
.then(data => ({ data, error: '' }))
|
||||
.catch(cause => ({ data: null, error: errorMessage(cause) })),
|
||||
productionApi
|
||||
.videoInputPlan(shotId, signal)
|
||||
.then(data => ({ data, error: '' }))
|
||||
.catch(cause => ({ data: null, error: errorMessage(cause) }))
|
||||
])
|
||||
if (keyframes.some(item => item.shotId !== shotId) || videos.some(item => item.shotId !== shotId))
|
||||
throw new Error('资产记录与当前镜头不匹配,请刷新后重试。')
|
||||
const qualityStatus = qualityState.data?.shotId === shotId ? qualityState.data : null
|
||||
return { keyframes, videos, qualityStatus, qualityStatusError: qualityState.error }
|
||||
const inputPlan = inputPlanState.data?.shotId === shotId ? inputPlanState.data : null
|
||||
return {
|
||||
keyframes,
|
||||
videos,
|
||||
qualityStatus,
|
||||
qualityStatusError: qualityState.error,
|
||||
inputPlan,
|
||||
inputPlanError: inputPlanState.error
|
||||
}
|
||||
},
|
||||
false
|
||||
)
|
||||
/** 单独读取已保存的提示词,查询失败不影响首帧和视频资产展示。 */
|
||||
const promptQuery = usePolling(key, (shotId, signal) => storyboardApi.videoPrompt(shotId, signal), false)
|
||||
const savedPrompt = computed(() =>
|
||||
promptQuery.data.value?.shotId === key.value ? promptQuery.data.value : null
|
||||
)
|
||||
/** 当前视频生成规格的首帧和主体参考图,独立查询避免影响资产列表。 */
|
||||
const videoInputQuery = usePolling(key, (shotId, signal) => productionApi.videoGenerationSpec(shotId, signal), false)
|
||||
const currentVideoInput = computed(() =>
|
||||
videoInputQuery.data.value?.shotId === key.value ? videoInputQuery.data.value : null
|
||||
)
|
||||
const keyframes = computed(() => query.data.value?.keyframes ?? [])
|
||||
const videos = computed(() => query.data.value?.videos ?? [])
|
||||
const videoQualityStatus = computed(() => query.data.value?.qualityStatus ?? null)
|
||||
const videoInputPlan = computed(() => query.data.value?.inputPlan ?? null)
|
||||
const currentKeyframe = computed(() => primaryKeyframe(keyframes.value))
|
||||
const currentVideo = computed(() => primaryVideo(videos.value))
|
||||
const activeVideo = computed(() => videos.value.find(isActiveVideo))
|
||||
@@ -163,7 +166,7 @@ function safeVideoUrl(value: string | null): string | null {
|
||||
|
||||
/** 重新读取单镜头资产,并通知父页刷新项目就绪状态。 */
|
||||
async function refreshAll() {
|
||||
await Promise.all([query.refresh(), promptQuery.refresh(), videoInputQuery.refresh()])
|
||||
await query.refresh()
|
||||
emit('changed')
|
||||
}
|
||||
|
||||
@@ -325,29 +328,6 @@ async function inspectSpecs() {
|
||||
{{ issueLabel(issue.code) }}:{{ issue.reason }}
|
||||
</li>
|
||||
</ul>
|
||||
<div v-if="savedPrompt?.videoPrompt" class="surface-inset mt-4 p-4" aria-label="本镜视频提示词">
|
||||
<p class="text-xs font-medium">本镜视频提示词</p>
|
||||
<p class="mt-3 whitespace-pre-wrap break-words text-sm leading-6">{{ savedPrompt.videoPrompt }}</p>
|
||||
<template v-if="savedPrompt.negativePrompt">
|
||||
<p class="mt-4 text-xs font-medium">负向提示词</p>
|
||||
<p class="mt-2 whitespace-pre-wrap break-words text-xs leading-6 text-muted">
|
||||
{{ savedPrompt.negativePrompt }}
|
||||
</p>
|
||||
</template>
|
||||
<p v-if="promptReadiness?.stalePrompt" class="mt-3 text-xs text-danger">
|
||||
此提示词已过期,请重新生成后再制作视频。
|
||||
</p>
|
||||
</div>
|
||||
<p v-else-if="promptQuery.loading.value" role="status" class="mt-4 text-xs text-muted">
|
||||
正在读取视频提示词…
|
||||
</p>
|
||||
<p v-else-if="!promptQuery.error.value" class="mt-4 text-xs text-muted">
|
||||
尚未生成本镜视频提示词。
|
||||
</p>
|
||||
<NAlert v-if="promptQuery.error.value" role="alert" type="warning" :show-icon="false" class="mt-4 text-xs">
|
||||
提示词读取失败:{{ promptQuery.error.value }}
|
||||
<NButton text size="small" @click="promptQuery.refresh">重试</NButton>
|
||||
</NAlert>
|
||||
<div class="production-stage-actions">
|
||||
<ConfirmAction
|
||||
:label="promptReadiness?.status === 'skipped' ? '重新生成本镜提示词' : '生成本镜提示词'"
|
||||
@@ -430,6 +410,15 @@ async function inspectSpecs() {
|
||||
:label="videoStale ? '主视频已过期' : productionStatusLabel(videoReadiness.status)"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="videoInputPlan" class="mt-3 flex flex-wrap items-center gap-2 text-xs">
|
||||
<NTag size="small" :bordered="false" type="info">
|
||||
{{ videoInputPlan.inputMode === 'omni_reference' ? '全模态参考' : '首帧模式' }}
|
||||
</NTag>
|
||||
<span class="text-muted">{{ videoInputPlan.reasons.join(';') }}</span>
|
||||
</div>
|
||||
<NAlert v-else-if="query.data.value?.inputPlanError" type="warning" :show-icon="false" class="mt-3 text-xs">
|
||||
当前镜头输入规划暂不可用;请先处理视频就绪问题后刷新。
|
||||
</NAlert>
|
||||
<NAlert v-if="videoStale" role="status" type="info" :show-icon="false" class="mt-3 text-xs">
|
||||
当前主视频使用的主首帧或主体参考图已经变化。旧视频仍保留;重新生成完成后,新视频会自动接替过期主视频。
|
||||
</NAlert>
|
||||
@@ -438,47 +427,6 @@ async function inspectSpecs() {
|
||||
{{ issueLabel(issue.code) }}:{{ issue.reason }}
|
||||
</li>
|
||||
</ul>
|
||||
<section class="surface-inset mt-4 p-4" aria-label="当前视频生成素材引用">
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<h6 class="text-xs font-medium">当前视频生成素材引用</h6>
|
||||
<span v-if="currentVideoInput" class="text-[11px] text-muted">
|
||||
主首帧 1 张 · 主体参考图 {{ currentVideoInput.references.length }} 张
|
||||
</span>
|
||||
</div>
|
||||
<p class="mt-2 text-xs text-muted">以下是当前镜头的生成输入;已生成的视频可能使用更早的素材。</p>
|
||||
<div v-if="currentVideoInput" class="video-input-grid mt-4">
|
||||
<article class="min-w-0 bg-(--app-subtle)">
|
||||
<AssetImage :src="currentVideoInput.providerInputKeyframe.imageUrl"
|
||||
:alt="`镜头 ${shot.shotNo} 视频输入首帧`" preview object-fit="contain" />
|
||||
<div class="min-w-0 p-2 text-center text-xs">
|
||||
<p class="font-medium">视频输入首帧</p>
|
||||
<p class="mt-1 text-[11px] text-muted">
|
||||
{{ currentVideoInput.providerInputKeyframe.source === 'provider_variant' ? '模型专用变体' : '当前主首帧' }}
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
<article v-for="reference in currentVideoInput.references"
|
||||
:key="`${reference.subjectId}:${reference.imageId}`" class="min-w-0 bg-(--app-subtle)">
|
||||
<AssetImage :src="reference.imageUrl" :alt="`${reference.subjectName} ${reference.subjectFormName} 参考图`"
|
||||
preview object-fit="contain" />
|
||||
<div class="min-w-0 p-2 text-center text-xs">
|
||||
<p class="truncate font-medium" :title="reference.subjectName">{{ reference.subjectName }}</p>
|
||||
<p class="mt-1 truncate text-[11px] text-muted" :title="reference.subjectFormName">
|
||||
{{ reference.subjectFormName }} · {{ reference.subjectRef }}
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<p v-else-if="videoInputQuery.loading.value" role="status" class="mt-4 text-xs text-muted">
|
||||
正在读取视频生成素材…
|
||||
</p>
|
||||
<div v-else class="mt-4 text-xs text-muted">
|
||||
<p>当前生成规格尚未就绪,请检查视频提示词、主首帧与主体参考图。</p>
|
||||
<p v-if="videoInputQuery.error.value" class="mt-2 break-words">{{ videoInputQuery.error.value }}</p>
|
||||
<NButton v-if="videoInputQuery.error.value" text size="small" class="mt-2"
|
||||
@click="videoInputQuery.refresh">重新读取</NButton>
|
||||
</div>
|
||||
</section>
|
||||
<NAlert
|
||||
v-if="videoQualityStatus && videoQualityStatus.status !== 'not_started'"
|
||||
:type="
|
||||
@@ -499,7 +447,7 @@ async function inspectSpecs() {
|
||||
。请检查候选视频和校验结果,调整提示词或参考资产后再重新生成。
|
||||
</template>
|
||||
</NAlert>
|
||||
<div v-if="videos.length" class="video-grid mt-4">
|
||||
<div v-if="videos.length" class="mt-4 space-y-3">
|
||||
<article v-for="item in videos" :key="item.id" class="video-record">
|
||||
<video
|
||||
v-if="item.status === 'completed' && safeVideoUrl(item.videoUrl)"
|
||||
@@ -508,7 +456,7 @@ async function inspectSpecs() {
|
||||
preload="metadata"
|
||||
class="production-video"
|
||||
></video>
|
||||
<div class="min-w-0 p-3">
|
||||
<div class="min-w-0 flex-1 p-4">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<StatusBadge :status="item.status" :label="productionStatusLabel(item.status)" />
|
||||
<NTag v-if="item.isPrimary" size="small" :bordered="false">主视频</NTag>
|
||||
@@ -721,21 +669,24 @@ async function inspectSpecs() {
|
||||
0 0 0 1px rgb(0 0 0 / 55%),
|
||||
0 2px 8px rgb(0 0 0 / 35%);
|
||||
}
|
||||
.video-input-grid {
|
||||
@apply grid grid-cols-[repeat(auto-fill,_minmax(min(160px,_100%),_1fr))] gap-3;
|
||||
}
|
||||
.video-grid {
|
||||
@apply grid grid-cols-[repeat(auto-fill,_minmax(min(260px,_100%),_1fr))] gap-3;
|
||||
}
|
||||
.video-record {
|
||||
@apply min-w-0 overflow-hidden rounded-none bg-(--app-subtle);
|
||||
@apply flex overflow-hidden rounded-none bg-(--app-subtle);
|
||||
}
|
||||
.production-video {
|
||||
@apply block w-full aspect-square bg-[#080808] object-contain;
|
||||
@apply w-[min(44%,390px)] min-h-[170px] bg-ink object-contain;
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
.keyframe-grid {
|
||||
@apply grid-cols-[repeat(2,_minmax(0,_1fr))];
|
||||
}
|
||||
.video-record {
|
||||
@apply block;
|
||||
}
|
||||
.production-video {
|
||||
@apply w-full;
|
||||
}
|
||||
}
|
||||
.production-video {
|
||||
@apply bg-[#080808];
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user