116 lines
6.3 KiB
Vue
116 lines
6.3 KiB
Vue
<script setup lang="ts">
|
||
import { userFacingText } from '../../../lib/user-facing-text'
|
||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||
|
||
import { NScrollbar, NButton, NTable } from 'naive-ui'
|
||
import { computed } from 'vue'
|
||
import { Download } from '@lucide/vue'
|
||
import { downloadText } from '../../../lib/format'
|
||
import type { StoryboardReceipt } from '../types'
|
||
|
||
/** 独立展示提交结果,不能将 HTTP 成功或局部成功显示为整批完成。 */
|
||
const props = defineProps<{ receipt: StoryboardReceipt }>()
|
||
/** 部分失败与待人工核对均不表示批次通过。 */
|
||
const failed = computed(() => {
|
||
if (props.receipt.kind === 'shots') return !props.receipt.result.storyboardShotValidation.valid
|
||
if (props.receipt.kind === 'batch')
|
||
return props.receipt.result.failedEpisodes > 0 || props.receipt.result.manualReviewRequired === true
|
||
return props.receipt.result.failed > 0
|
||
})
|
||
|
||
/** 导出原始回执,保留后端提供的完整失败诊断。 */
|
||
function exportReceipt() {
|
||
downloadText('storyboard-generation-receipt.json', JSON.stringify(props.receipt, null, 2), 'application/json')
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<section class="panel mt-5 p-5" aria-label="生成回执">
|
||
<div class="flex items-center justify-between gap-3">
|
||
<h3 class="text-sm font-semibold">{{ receipt.title }} · 本次回执</h3>
|
||
<NButton @click="exportReceipt" text size="small"><Download :size="13" />导出诊断</NButton>
|
||
</div>
|
||
<ContextNotice v-if="failed" role="alert" type="error" :show-icon="false" class="mt-3">
|
||
本次存在失败、校验未通过或未保存项。关闭“批量覆盖已有结果”后再补齐,可跳过已完整保存项。
|
||
</ContextNotice>
|
||
<template v-if="receipt.kind === 'shots'">
|
||
<p class="my-4 text-xs text-muted">
|
||
第 {{ receipt.result.episodeNo }} 集 · {{ receipt.result.storyboardShotSummary.beatCount }} 个剧情段落 ·
|
||
{{ receipt.result.storyboardShotSummary.shotCount }} 个镜头 ·
|
||
{{ receipt.result.storyboardShotSummary.totalDurationSeconds }} 秒 · 形态绑定覆盖率
|
||
{{ Math.round(receipt.result.storyboardShotSummary.bindingCoverage * 100) }}%
|
||
</p>
|
||
<ContextNotice
|
||
v-if="receipt.result.storyboardShotValidation.valid"
|
||
type="success"
|
||
:show-icon="false"
|
||
class="mt-3"
|
||
>
|
||
本集新镜头已保存。该集下游结果已随旧镜头清除,请依次重新生成导演设计、即时状态、首帧、提示词和视频。
|
||
</ContextNotice>
|
||
<ul v-else class="mt-3 space-y-2 text-xs text-danger">
|
||
<li v-for="(issue, index) in receipt.result.storyboardShotValidation.issues" :key="index">
|
||
剧情段落 {{ issue.beatNo ?? '—' }} / 镜头 {{ issue.shotNo ?? '—' }}:{{
|
||
userFacingText(issue.message)
|
||
}}
|
||
</li>
|
||
</ul>
|
||
</template>
|
||
<template v-else-if="receipt.kind === 'batch'">
|
||
<p class="my-4 text-xs text-muted">
|
||
共 {{ receipt.result.episodeCount }} 集 · 完成 {{ receipt.result.completedEpisodes }} · 跳过
|
||
{{ receipt.result.skippedEpisodes }} · 失败 {{ receipt.result.failedEpisodes }}
|
||
</p>
|
||
<NScrollbar x-scrollable class="table-scroll">
|
||
<NTable :bordered="false" :single-line="true" striped class="project-table"
|
||
><thead>
|
||
<tr>
|
||
<th>剧集</th>
|
||
<th>结果</th>
|
||
<th>回执数量 / 镜头</th>
|
||
<th>自动修复</th>
|
||
<th>诊断</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr v-for="item in receipt.result.episodes" :key="item.episodeNo">
|
||
<td>第 {{ item.episodeNo }} 集</td>
|
||
<td :class="item.status === 'failed' ? 'text-danger' : 'text-success'">
|
||
{{ { completed: '完成', skipped: '跳过已有', failed: '失败' }[item.status] }}
|
||
</td>
|
||
<td>{{ item.directionCount ?? item.visualStateCount ?? 0 }} / {{ item.shotCount }}</td>
|
||
<td>
|
||
{{ item.repairAttempts === undefined ? '—' : item.repairAttempts + ' 次'
|
||
}}<span v-if="item.repaired"> · 已修复</span>
|
||
</td>
|
||
<td class="min-w-48 whitespace-pre-wrap text-xs">
|
||
<p>{{ item.error || '—' }}</p>
|
||
<p v-for="(issue, index) in item.remainingIssues" :key="index" class="mt-2 text-danger">
|
||
剧情段落 {{ issue.beatNo ?? '—' }} / 镜头 {{ issue.shotNo ?? '—' }}
|
||
{{ issue.subjectRef }}:{{ userFacingText(issue.message) }}
|
||
</p>
|
||
</td>
|
||
</tr>
|
||
</tbody></NTable
|
||
>
|
||
</NScrollbar>
|
||
</template>
|
||
<template v-else-if="receipt.kind === 'prompts'">
|
||
<p class="mt-4 text-sm">
|
||
共 {{ receipt.result.total }} 个镜头 · 本次目标 {{ receipt.result.targetCount }} · 处理成功
|
||
{{ receipt.result.generated }} · 跳过 {{ receipt.result.skipped }} · 失败 {{ receipt.result.failed }}
|
||
</p>
|
||
<ul class="mt-3 space-y-2 text-xs text-danger">
|
||
<li v-for="item in receipt.result.failures" :key="item.shotId">
|
||
<code>{{ item.shotId }}</code
|
||
>:{{ userFacingText(item.error) }}
|
||
</li>
|
||
</ul>
|
||
<p class="mt-3 text-xs text-muted">
|
||
批量处理完成后,可选择镜头查看完整画面描述;已有描述会直接使用,无需重新生成。
|
||
</p>
|
||
</template>
|
||
<p class="mt-4 text-[11px] text-muted">回执仅保留在当前浏览器会话中。数据库结果是覆盖率和镜头详情的依据。</p>
|
||
</section>
|
||
</template>
|