fix: 恢复镜头提示词与视频引用展示

This commit is contained in:
GouJ committed 2026-09-24 17:16:48 +08:00
1 parent 2c3e72ae9a
commit 8cdaf33936
1 file changed
+76 -2
@@ -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 { StatusBadge } from '../../../components/ui'
import { AssetImage, StatusBadge } from '../../../components/ui'
import { usePolling } from '../../../composables/usePolling'
import { mediaAssetUrl } from '../../../lib/assets'
import { errorMessage } from '../../../lib/http'
@@ -81,6 +81,16 @@ const query = usePolling(
},
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)
@@ -166,7 +176,7 @@ function safeVideoUrl(value: string | null): string | null {
/** 重新读取单镜头资产,并通知父页刷新项目就绪状态。 */
async function refreshAll() {
await query.refresh()
await Promise.all([query.refresh(), promptQuery.refresh(), videoInputQuery.refresh()])
emit('changed')
}
@@ -328,6 +338,29 @@ 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' ? '重新生成本镜提示词' : '生成本镜提示词'"
@@ -427,6 +460,47 @@ 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="