perf(short-drama-agent-front): 优化制作工作台交互与移动端布局

This commit is contained in:
GJ committed 2026-10-10 19:28:47 +08:00
1 parent b5eaed3981
commit 54a381ebd3
37 files changed
+1217 -426

No files matched your search

@@ -1,22 +1,27 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { computed } from 'vue'
import { NAlert, NTag } from 'naive-ui'
import ReadonlyInspection from '../../../components/ui/ReadonlyInspection.vue'
import { useQuery } from '../../../composables/useQuery'
import { formatDate } from '../../../lib/format'
import { videoDiagnosticsApi } from '../diagnostics-api'
import { videoQualityStatusLabel } from '../model'
import type { VideoQualityRollbackTarget } from '../diagnostics.types'
/** 视频诊断始终绑定当前正式镜头。 */
const props = defineProps<{ /** 正式镜头 ID。 */ shotId: string }>()
/** 仅用户展开后查询,关闭后取消旧请求。 */
const open = ref(false)
/** 镜头和展开状态共同决定查询目标。 */
const key = computed(() => (open.value ? props.shotId : ''))
/** 视频诊断绑定正式镜头与用户选中的视频,随弹窗挂载直接读取。 */
const props = defineProps<{
/** 正式镜头 ID。 */
shotId: string
/** 用户选中的视频 ID。 */
videoId: string
/** 当前视频是否因首帧或参考图变化而需要更新。 */
stale: boolean
}>()
/** 查询目标包含镜头和视频,切换目标后取消旧请求。 */
const key = computed(() => (props.shotId && props.videoId ? JSON.stringify([props.shotId, props.videoId]) : ''))
/** 切换镜头时取消查询,先读取链状态,耗尽时再查询独立归因。 */
const query = useQuery(key, async (shotId, signal) => {
if (!shotId) return null
const query = useQuery(key, async (value, signal) => {
if (!value) return null
const [shotId] = JSON.parse(value) as [string, string]
const detail = await videoDiagnosticsApi.qualityDetail(shotId, signal)
if (detail.shotId !== shotId || !Array.isArray(detail.chain)) throw new Error('质量记录与当前镜头不匹配,请刷新。')
const analysis =
@@ -28,6 +33,16 @@ const query = useQuery(key, async (shotId, signal) => {
})
/** 当前请求返回的权威质量链。 */
const detail = computed(() => query.data.value?.detail)
/** 当前视频的独立记录,不能使用其它候选或流程整体结果兜底。 */
const currentRecord = computed(() => detail.value?.chain.find(item => item.videoId === props.videoId))
/** 当前视频优先展示,其它候选明确标识为相关记录。 */
const orderedChain = computed(() => {
const chain = detail.value?.chain ?? []
return [
...chain.filter(item => item.videoId === props.videoId),
...chain.filter(item => item.videoId !== props.videoId)
]
})
/** 当前链对应的后端确定性归因。 */
const analysis = computed(() => query.data.value?.analysis)
@@ -50,23 +65,38 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
</script>
<template>
<!-- 以下是只读视频质量详情与自动修复失败归因模块 -->
<ReadonlyInspection
v-model:open="open"
title="视频质量详情"
description="查看检查结果和修改建议,不收费。"
:loading="query.loading.value"
:error="query.error.value"
@refresh="query.refresh"
>
<template v-if="detail">
<p>
<strong>{{ videoQualityStatusLabel(detail.status) }}</strong> · 修复 {{ detail.repairAttempt }} /
{{ detail.maxRepairAttempts ?? '未设置' }} · 候选 {{ detail.chain.length }}
<!-- 以下是弹窗中的视频已有检查记录模块,无需再次点击查看 -->
<section class="workspace-panel text-xs leading-6" aria-label="当前视频质量记录">
<NAlert v-if="stale" type="warning" :show-icon="false" class="mb-3">
此视频需要更新:首帧或参考图已变化。此前画面检查结果仅供参考,请重新生成视频。
</NAlert>
<NAlert v-if="query.error.value" type="error" :show-icon="false" role="alert">{{ query.error.value }}</NAlert>
<p v-if="query.loading.value" class="text-muted" role="status">正在读取质量记录…</p>
<template v-else-if="detail">
<p v-if="currentRecord" class="font-semibold">
{{
currentRecord.validationPassed === true
? '当前视频此前画面检查通过'
: currentRecord.validationPassed === false
? '当前视频此前画面检查未通过'
: '当前视频尚未完成画面检查'
}}
</p>
<p v-else class="text-muted">此视频暂无自动质量流程记录。</p>
<!-- 以下是镜头质量流程上下文模块,与当前视频的结论区分 -->
<p class="mt-3 text-muted">
本镜头共 {{ detail.chain.length }} 条视频记录;当前视频优先显示,其它候选单独标识。
</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">
当前镜头正在执行:{{ videoQualityStatusLabel(detail.status) }}
</p>
<p v-if="!detail.chain.length" class="mt-2 text-muted">当前镜头尚无质量链记录。</p>
<article v-for="item in detail.chain" :key="item.videoId" class="surface-inset mt-3 p-3">
<article v-for="item in orderedChain" :key="item.videoId" class="surface-inset mt-3 p-3">
<div class="flex flex-wrap items-center gap-2">
<NTag size="small" :bordered="false">{{ item.videoId === videoId ? '当前视频' : '其它候选' }}</NTag>
<code>{{ item.videoId }}</code>
<NTag size="small" :bordered="false">第 {{ item.repairAttempt }} 代</NTag>
<span
@@ -97,6 +127,7 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
:type="analysis.requiresManualReview ? 'warning' : 'info'"
:show-icon="false"
>
<p class="font-semibold">镜头最近一次质量流程的修改建议</p>
{{ analysis.summary }}
<p v-if="analysis.recommendedRollback.length" class="mt-1">
建议检查:{{ analysis.recommendedRollback.map(rollbackLabel).join('、') }}
@@ -110,5 +141,5 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
</ul>
</article>
</template>
</ReadonlyInspection>
</section>
</template>