fix(short-drama-agent-front): 优化工作区提示与弹窗布局

This commit is contained in:
GJ committed 2026-10-09 18:31:09 +08:00
1 parent 5b134207b8
commit 72a86171dc
35 files changed
+586 -378

No files matched your search

@@ -1,7 +1,9 @@
<script setup lang="ts">
import IssueHint from '../../../components/ui/IssueHint.vue'
import { useActionMessage } from '../../../components/ui/useActionMessage'
import ProviderInputInspector from './ProviderInputInspector.vue'
import { NAlert, NButton, NCollapse, NCollapseItem, NSelect, NTag } from 'naive-ui'
import { computed, ref, watch } from 'vue'
import { computed, onScopeDispose, ref, watch } from 'vue'
import { ExternalLink, ImagePlus, RefreshCw } from '@lucide/vue'
import { AssetImage, StatusBadge } from '../../../components/ui'
import { usePolling } from '../../../composables/usePolling'
@@ -13,14 +15,8 @@ import { storyboardApi } from '../../storyboard/api'
import ConfirmAction from '../../workflows/ConfirmAction.vue'
import { runOperation } from '../../workflows/operations'
import { productionApi } from '../api'
import {
isActiveVideo,
issueLabel,
primaryKeyframe,
primaryVideo,
productionStatusLabel,
videoQualityStatusLabel
} from '../model'
import { isActiveVideo, primaryKeyframe, primaryVideo, productionStatusLabel, videoQualityStatusLabel } from '../model'
import { productionIssueText, productionMessage } from '../production-messages'
import type {
GenerateKeyframeInput,
KeyframeReadinessItem,
@@ -48,6 +44,14 @@ import type {
} from '../../generation-config/types'
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
/** 当前页面操作反馈使用消息提示,不长期占据正文。 */
const actionMessage = useActionMessage()
/** 离开镜头后忽略迟到的手动读取反馈。 */
let disposed = false
onScopeDispose(() => {
disposed = true
})
/** 单镜头生产面板只负责正式资产,不修改上游导演设计与即时状态。 */
const props = defineProps<{
/** 当前正式项目 ID。 */
@@ -123,6 +127,10 @@ const promptQuery = usePolling(key, (shotId, signal) => storyboardApi.videoPromp
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 videoInputError = computed(() => productionMessage(videoInputQuery.error.value))
/** 视频准备问题按实际含义去重,保留所有不同的处理建议。 */
const videoIssueMessages = computed(() => [...new Set((props.videoReadiness?.issues ?? []).map(productionIssueText))])
const currentVideoInput = computed(() =>
videoInputQuery.data.value?.shotId === key.value ? videoInputQuery.data.value : null
)
@@ -263,6 +271,17 @@ async function refreshAll() {
emit('changed')
}
/** 手动更新素材时才反馈查询结果,切换镜头后不显示旧目标提示。 */
async function refreshVideoInput() {
if (videoInputQuery.loading.value) return
const target = `${props.projectId}:${props.shot.shotId}`
await videoInputQuery.refresh()
if (disposed || target !== `${props.projectId}:${props.shot.shotId}`) return
if (videoInputQuery.error.value)
actionMessage?.warning(productionMessage(videoInputQuery.error.value), { duration: 7000, closable: true })
else actionMessage?.success('视频素材已更新。', { duration: 3000 })
}
/** 单镜头提示词根据现有状态决定是否 force 覆盖。 */
async function generatePrompt() {
if (!canGeneratePrompt.value) return
@@ -413,11 +432,7 @@ async function inspectSpecs() {
:label="productionStatusLabel(promptReadiness.status)"
/>
</div>
<ul v-if="promptReadiness?.issues.length" class="mt-3 space-y-2 text-xs text-danger">
<li v-for="issue in promptReadiness.issues" :key="issue.code">
{{ issueLabel(issue.code) }}:{{ issue.reason }}
</li>
</ul>
<IssueHint :messages="(promptReadiness?.issues ?? []).map(productionIssueText)" />
<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>
@@ -465,14 +480,7 @@ async function inspectSpecs() {
:label="keyframeStale ? '主首帧已过期' : productionStatusLabel(keyframeReadiness.status)"
/>
</div>
<NAlert v-if="keyframeStale" role="status" type="info" :show-icon="false" class="mt-3 text-xs">
当前主首帧使用的主体参考资产已经变化,旧图仍保留但不会继续进入视频生成。请重新生成主首帧。
</NAlert>
<ul v-if="keyframeReadiness?.issues.length" class="mt-3 space-y-2 text-xs text-danger">
<li v-for="issue in keyframeReadiness.issues" :key="issue.code">
{{ issueLabel(issue.code) }}:{{ issue.reason }}
</li>
</ul>
<IssueHint :messages="(keyframeReadiness?.issues ?? []).map(productionIssueText)" />
<div v-if="currentKeyframe" class="keyframe-grid mt-4">
<KeyframeCard
:item="currentKeyframe"
@@ -533,29 +541,18 @@ async function inspectSpecs() {
</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' ? '全模态参考' : '首帧模式' }}
{{ videoInputPlan.inputMode === 'omni_reference' ? '使用多张参考图' : '使用首帧' }}
</NTag>
<span class="text-muted">{{ videoInputPlan.reasons.join(';') }}</span>
<span class="text-muted">{{ videoInputPlan.reasons.map(productionMessage).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>
<ul v-if="videoReadiness?.issues.length" class="mt-3 space-y-2 text-xs text-danger">
<li v-for="issue in videoReadiness.issues" :key="issue.code">
{{ issueLabel(issue.code) }}:{{ issue.reason }}
</li>
</ul>
<IssueHint :messages="videoIssueMessages" />
<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>
<h6 class="text-xs font-medium">视频使用的素材</h6>
<span v-if="currentVideoInput" class="text-[11px] text-muted">
主首帧 1 张 · 主体参考图 {{ currentVideoInput.references.length }} 张
首帧 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="video-input-card">
<div class="video-input-image">
@@ -604,38 +601,38 @@ async function inspectSpecs() {
正在读取视频生成素材…
</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
>
<p>视频素材还未准备好,请先检查视频提示词、首帧和参考图。</p>
<IssueHint v-if="!videoIssueMessages.length" :messages="videoInputError ? [videoInputError] : []" />
<!-- 以下是重新获取素材的操作模块,与上下正文保持间距 -->
<div v-if="videoInputQuery.error.value" class="mt-3 flex pb-1">
<NButton text size="small" :loading="videoInputQuery.loading.value" @click="refreshVideoInput"
>重新获取</NButton
>
</div>
</div>
</section>
<NAlert
<div
v-if="videoQualityStatus && videoQualityStatus.status !== 'not_started'"
:type="
videoQualityStatus.status === 'passed'
? 'success'
: videoQualityStatus.status === 'exhausted'
? 'error'
: 'info'
"
:show-icon="false"
class="mt-3 text-xs"
class="mt-3 flex items-center gap-2"
>
{{ videoQualityStatusLabel(videoQualityStatus.status) }}
<template v-if="videoQualityStatus.maxRepairAttempts !== null">
· 修复 {{ videoQualityStatus.repairAttempt }} / {{ videoQualityStatus.maxRepairAttempts }}
</template>
<template v-if="videoQualityStatus.status === 'exhausted'">
。请检查候选视频和校验结果,调整提示词或参考资产后再重新生成。
</template>
</NAlert>
<NTag
size="small"
:type="
videoQualityStatus.status === 'passed'
? 'success'
: videoQualityStatus.status === 'exhausted'
? 'error'
: 'info'
"
:bordered="false"
>
{{
videoQualityStatus.status === 'passed'
? '视频检查通过'
: videoQualityStatusLabel(videoQualityStatus.status)
}}
</NTag>
</div>
<!-- 以下是当前镜头只读视频质量详情与失败归因模块 -->
<VideoQualityDiagnostics :key="shot.shotId" :shot-id="shot.shotId" class="mt-3" />
<div v-if="videos.length" class="video-grid mt-4">
@@ -739,22 +736,22 @@ async function inspectSpecs() {
@update:options="videoGenerationOptions = $event"
/>
<div class="generation-input-mode">
<p class="generation-input-mode-label">输入模式</p>
<p class="generation-input-mode-label">生成方式</p>
<NSelect
:value="videoInputModeOverride"
:disabled="assetBlocked"
:options="[
{
label: `自动(推荐:${videoInputPlan?.inputMode === 'omni_reference' ? '全模态参考' : '首帧模式'})`,
label: `自动(推荐:${videoInputPlan?.inputMode === 'omni_reference' ? '多张参考图' : '首帧'})`,
value: 'auto'
},
{ label: '首帧模式', value: 'first_frame' },
{ label: '全模态参考', value: 'omni_reference' }
{ label: '多张参考图', value: 'omni_reference' }
]"
@update:value="videoInputModeOverride = $event"
/>
<p class="mt-1.5 text-[11px] leading-5 text-muted">
自动模式遵循后端 Planner;手动选择只影响当前镜头本次生成。
自动选择合适的生成方式;手动选择只影响本次生成。
</p>
</div>
</div>
@@ -785,17 +782,17 @@ async function inspectSpecs() {
</div>
</div>
<AppDialog v-model:open="specsOpen" title="生成规格与模型限制" description="只读检查,不调用生成模型。" wide>
<AppDialog v-model:open="specsOpen" title="生成设置与模型限制" description="查看不收费。" wide>
<NAlert v-if="specError" role="alert" type="error" :show-icon="false" class="mt-4">{{ specError }}</NAlert>
<p v-if="inspecting" role="status" class="mt-4 text-xs text-muted">正在读取生成规格…</p>
<ModelCapabilities :shot-id="shot.shotId" />
<ProviderInputInspector :shot-id="shot.shotId" />
<NCollapse v-if="keyframeSpec || videoSpec" class="mt-5 pt-4 text-xs" :default-expanded-names="['details']"
<NCollapse v-if="keyframeSpec || videoSpec" class="mt-5 pt-4 text-xs"
><NCollapseItem name="details"
><template #header>本镜确定性生成规格</template>
><template #header>查看生成描述</template>
<div class="mt-4 grid gap-5 lg:grid-cols-2">
<div v-if="keyframeSpec">
<h5 class="font-medium">首帧 Prompt · {{ keyframeSpec.references.length }} 张参考图</h5>
<h5 class="font-medium">首帧描述 · {{ keyframeSpec.references.length }} 张参考图</h5>
<p class="mt-3 whitespace-pre-wrap leading-6 text-muted">{{ keyframeSpec.prompt }}</p>
<ul v-if="keyframeSpec.references.length" class="mt-3 space-y-1 text-[11px] text-muted">
<li
@@ -803,27 +800,15 @@ async function inspectSpecs() {
:key="`${reference.role}:${reference.imageId}`"
>
{{ reference.subjectRef }} ·
{{ reference.role === 'identity-anchor' ? '演员身份母版' : '形态主图' }} ·
<code>{{ reference.imageId }}</code>
{{ reference.role === 'identity-anchor' ? '演员身份母版' : '形态主图' }}
</li>
</ul>
</div>
<div v-if="videoSpec">
<h5 class="font-medium">视频 Prompt · {{ videoSpec.durationSeconds }}s</h5>
<h5 class="font-medium">视频描述 · {{ videoSpec.durationSeconds }} 秒</h5>
<p class="mt-3 whitespace-pre-wrap leading-6 text-muted">{{ videoSpec.videoPrompt }}</p>
<p v-if="videoSpec.negativePrompt" class="mt-3 whitespace-pre-wrap leading-6 text-muted">
Negative prompt: {{ videoSpec.negativePrompt }}
</p>
<p class="mt-3 break-all font-mono text-[10px] text-muted">
业务主首帧 ID · {{ videoSpec.keyframe.id }}
</p>
<p v-if="videoSpec.providerInputKeyframe" class="mt-2 break-all text-[10px] text-muted">
通用规格首帧 ID(未指定模型) · {{ videoSpec.providerInputKeyframe.id }}
{{
videoSpec.providerInputKeyframe.source === 'provider_variant'
? '(专用变体)'
: '(业务主首帧)'
}}
不希望出现的内容: {{ videoSpec.negativePrompt }}
</p>
</div>
</div></NCollapseItem
@@ -844,7 +829,11 @@ async function inspectSpecs() {
description="先完成质量检查;只有本会话校验通过的候选才能设为主首帧。"
wide
>
<div v-if="keyframeCandidates.length" class="keyframe-grid mt-4">
<!-- 以下是自适应等宽候选图网格模块,完整行与弹窗正文两侧对齐 -->
<div
v-if="keyframeCandidates.length"
class="mt-4 grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-3 max-[760px]:grid-cols-2"
>
<KeyframeCard
v-for="item in keyframeCandidates"
:key="item.id"