fix(short-drama-agent-front): 修复拆解进度展示与问题交互
This commit is contained in:
1 parent
3414cc8232
commit
db91a4b871
19 files changed
+870
-150
No files matched your search
@@ -1,32 +1,31 @@
|
||||
<script setup lang="ts">
|
||||
import ContextNotice from '../../components/ui/ContextNotice.vue'
|
||||
|
||||
import AppForm from '../../components/ui/AppForm.vue'
|
||||
import { NFormItem } from 'naive-ui'
|
||||
import { integerRule, fieldRule } from '../../lib/form-rules'
|
||||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||
import WorkspaceExportButton from '../../components/ui/WorkspaceExportButton.vue'
|
||||
import { NScrollbar, NButton, NCheckbox, NInputNumber, NProgress, NTab, NTable, NTabs } from 'naive-ui'
|
||||
import { computed, h, onScopeDispose, ref, watch } from 'vue'
|
||||
import { NScrollbar, NButton, NCheckbox, NInputNumber, NTab, NTable, NTabs } from 'naive-ui'
|
||||
import { computed, h, nextTick, onScopeDispose, ref, watch } from 'vue'
|
||||
import { useActionMessage } from '../../components/ui/useActionMessage'
|
||||
import { Layers, LoaderCircle, Settings2 } from '@lucide/vue'
|
||||
import { EmptyState, StatusBadge, WorkspaceTools } from '../../components/ui'
|
||||
import { useProjectContext } from '../projects/context'
|
||||
import { breakdownApi } from './api'
|
||||
import type { BreakdownAction, BreakdownInput, BreakdownModule, BreakdownPreview } from './types'
|
||||
import type { BreakdownAction, BreakdownInput, BreakdownModule, BreakdownPreview, ShotValidation } from './types'
|
||||
import { breakdownSnapshot, recoveryOptions, workflowCheckpoints } from '../workflows/selectors'
|
||||
import { getOperation, isOperationRunning, runOperation } from '../workflows/operations'
|
||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||
import { useWorkflowExecution } from '../workflows/execution'
|
||||
import { executionStageLabel, useWorkflowExecution } from '../workflows/execution'
|
||||
import SubjectList from './components/SubjectList.vue'
|
||||
import StoryboardList from './components/StoryboardList.vue'
|
||||
import StoryboardDiagnosis from './components/StoryboardDiagnosis.vue'
|
||||
import BreakdownCandidatePanel from './components/BreakdownCandidatePanel.vue'
|
||||
import StoryboardQualityRepair from './components/StoryboardQualityRepair.vue'
|
||||
import BreakdownIssuesDialog from './components/BreakdownIssuesDialog.vue'
|
||||
import type { DiagnosisLocation } from './diagnosis'
|
||||
import { errorMessage } from '../../lib/http'
|
||||
import { downloadText, nodeLabel } from '../../lib/format'
|
||||
import { downloadText } from '../../lib/format'
|
||||
|
||||
/** 拆解工作区:先预览真实分组,再启动;恢复操作根据 checkpoint 分阶段展示。 */
|
||||
const { project, checkpoints, refresh, refreshStageReadiness, stageReadiness, error } = useProjectContext()
|
||||
@@ -38,6 +37,10 @@ const previewBusy = ref(false)
|
||||
const candidateOnly = ref(true)
|
||||
const tab = ref('character')
|
||||
const toolsOpen = ref(false)
|
||||
/** 错误详情使用独立弹窗,不在设置区展开长文本。 */
|
||||
const issuesOpen = ref(false)
|
||||
/** 从设置切换时等待关闭动画结束,避免两层弹窗同时显示。 */
|
||||
const pendingIssues = ref(false)
|
||||
const moduleOptions: { value: BreakdownModule; label: string; description: string }[] = [
|
||||
{ value: 'character', label: '人物', description: '人物身份、外观与形态' },
|
||||
{ value: 'scene', label: '场景', description: '故事空间与环境特征' },
|
||||
@@ -87,6 +90,7 @@ const diagnosisPanel = ref<InstanceType<typeof StoryboardDiagnosis> | null>(null
|
||||
* @param location 当前分镜坐标
|
||||
*/
|
||||
function openShotDiagnosis(location: DiagnosisLocation) {
|
||||
if (breakdownBusy.value || backgroundExecution.discovering.value) return
|
||||
diagnosisPanel.value?.open(location)
|
||||
}
|
||||
/**
|
||||
@@ -98,7 +102,72 @@ function locateDiagnosisShot(location: DiagnosisLocation) {
|
||||
}
|
||||
const backgroundExecution = useWorkflowExecution(projectId, 'breakdown')
|
||||
const recovery = computed(() => recoveryOptions(checkpoints.value))
|
||||
const execution = computed(() => snapshot.value?.workflowExecution)
|
||||
/** 运行状态优先采用持久化任务;历史快照只作没有任务记录时的兼容来源。 */
|
||||
const execution = computed(() => {
|
||||
const record = backgroundExecution.query.data.value
|
||||
return record
|
||||
? {
|
||||
executionId: record.id,
|
||||
status: record.status === 'pending' ? ('running' as const) : record.status,
|
||||
errorMessage: record.error ?? undefined,
|
||||
startedAt: record.startedAt ?? record.createdAt,
|
||||
completedAt: record.completedAt ?? undefined
|
||||
}
|
||||
: snapshot.value?.workflowExecution
|
||||
})
|
||||
/** 拆解运行状态同时控制状态栏、诊断入口及所有恢复写操作。 */
|
||||
const breakdownBusy = computed(
|
||||
() =>
|
||||
backgroundExecution.active.value ||
|
||||
execution.value?.status === 'running' ||
|
||||
(operation.value.pending &&
|
||||
['正在拆解剧本', '正在重试失败抽取', '正在补齐镜头', '正在修复分镜绑定'].includes(operation.value.label))
|
||||
)
|
||||
/** 当前持久化任务对应的后端阶段标签。 */
|
||||
const runningStage = computed(() => executionStageLabel(backgroundExecution.query.data.value?.stage ?? 'breakdown'))
|
||||
/** 新任务尚未保存阶段快照时,已有内容只代表上一轮结果。 */
|
||||
const previousSnapshot = computed(() => {
|
||||
const startedAt = backgroundExecution.query.data.value?.startedAt
|
||||
return (
|
||||
breakdownBusy.value &&
|
||||
!!startedAt &&
|
||||
!!latestCheckpoint.value &&
|
||||
Date.parse(latestCheckpoint.value.createdAt) < Date.parse(startedAt)
|
||||
)
|
||||
})
|
||||
/** 当前保存结果中的具体问题,只显示后端明确返回的校验失败。 */
|
||||
const storyboardIssues = computed(() => (validation.value?.valid === false ? validation.value.issues : []))
|
||||
|
||||
/** 打开独立问题弹窗,从设置进入时先释放原弹窗焦点。 */
|
||||
function openIssues() {
|
||||
if (toolsOpen.value) {
|
||||
pendingIssues.value = true
|
||||
toolsOpen.value = false
|
||||
} else issuesOpen.value = true
|
||||
}
|
||||
/** 设置弹窗离场完成后打开问题详情。 */
|
||||
function finishOpeningIssues() {
|
||||
if (pendingIssues.value) {
|
||||
pendingIssues.value = false
|
||||
issuesOpen.value = true
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 切换到分镜结果并定位后端返回的真实问题坐标。
|
||||
* @param issue 问题所属剧集、节拍和镜头
|
||||
* @returns 分镜切换和定位完成
|
||||
*/
|
||||
async function locateIssue(issue: ShotValidation['issues'][number]) {
|
||||
tab.value = 'storyboard'
|
||||
selectedEpisodeNo.value = issue.episodeNo
|
||||
await nextTick()
|
||||
if (issue.beatNo)
|
||||
await storyboardList.value?.locate({
|
||||
episodeNo: issue.episodeNo,
|
||||
beatNo: issue.beatNo,
|
||||
...(issue.shotNo ? { shotNo: issue.shotNo } : {})
|
||||
})
|
||||
}
|
||||
const taskStopped = computed(() => execution.value?.status === 'failed' || execution.value?.status === 'completed')
|
||||
/** 后台拆解结束后自动刷新项目、Checkpoint 与正式主体/分镜数据。 */
|
||||
watch(
|
||||
@@ -137,6 +206,7 @@ watch(
|
||||
() => {
|
||||
const executionError = execution.value?.errorMessage
|
||||
const invalid = validation.value?.valid === false
|
||||
if (breakdownBusy.value || backgroundExecution.discovering.value) return
|
||||
if (!executionError && !invalid) return
|
||||
actionMessage?.warning(
|
||||
() =>
|
||||
@@ -152,10 +222,10 @@ watch(
|
||||
{
|
||||
text: true,
|
||||
onClick: () => {
|
||||
toolsOpen.value = true
|
||||
openIssues()
|
||||
}
|
||||
},
|
||||
() => '查看详情与恢复操作'
|
||||
() => '查看问题'
|
||||
)
|
||||
]),
|
||||
{ duration: 6000, closable: true }
|
||||
@@ -176,6 +246,8 @@ const canStart = computed(
|
||||
configValid.value &&
|
||||
!operation.value.pending &&
|
||||
!backgroundExecution.active.value &&
|
||||
!backgroundExecution.discovering.value &&
|
||||
!backgroundExecution.discoveryError.value &&
|
||||
!error.value &&
|
||||
(!records.value.length || taskStopped.value)
|
||||
)
|
||||
@@ -230,6 +302,7 @@ async function loadPreview() {
|
||||
*/
|
||||
async function run(action: BreakdownAction) {
|
||||
if (project.value?.status !== 'completed' || operation.value.pending || error.value) return
|
||||
if (breakdownBusy.value || backgroundExecution.discovering.value || backgroundExecution.discoveryError.value) return
|
||||
if (action === 'start' && !canStart.value) return
|
||||
const labels: Record<BreakdownAction, string> = {
|
||||
start: '正在拆解剧本',
|
||||
@@ -279,23 +352,40 @@ const rules = {
|
||||
<!-- 以下是拆解状态与设置 -->
|
||||
<div class="workspace-toolbar">
|
||||
<h2 class="font-semibold">剧本拆解</h2>
|
||||
<div v-if="snapshot" class="toolbar-summary">
|
||||
<div v-if="snapshot || execution || backgroundExecution.discovering.value" class="toolbar-summary">
|
||||
<span v-if="previousSnapshot">上次结果</span>
|
||||
<span v-if="summary"
|
||||
>抽取 {{ summary.completed }} / {{ summary.total }} · 失败 {{ summary.failed }}</span
|
||||
>
|
||||
<span>主体 {{ subjects.length }} · 分镜剧集 {{ shots.length }} / {{ plans.length }}</span>
|
||||
<StatusBadge
|
||||
:status="execution?.status || 'unknown'"
|
||||
:status="
|
||||
breakdownBusy
|
||||
? 'running'
|
||||
: validation?.valid === false
|
||||
? 'blocked'
|
||||
: execution?.status || 'unknown'
|
||||
"
|
||||
:label="
|
||||
execution?.status === 'completed'
|
||||
? latestCheckpoint?.state.candidateOnly && !latestCheckpoint.state.storyboardPersisted
|
||||
? '候选生成已完成'
|
||||
: '工作流已完成'
|
||||
: execution?.status === 'failed'
|
||||
? '工作流失败'
|
||||
: '执行状态待确认'
|
||||
breakdownBusy
|
||||
? '拆解进行中'
|
||||
: backgroundExecution.discovering.value
|
||||
? '正在读取任务状态'
|
||||
: validation?.valid === false
|
||||
? '分镜校验未通过'
|
||||
: execution?.status === 'completed'
|
||||
? latestCheckpoint?.state.candidateOnly &&
|
||||
!latestCheckpoint.state.storyboardPersisted
|
||||
? '候选生成已完成'
|
||||
: '工作流已完成'
|
||||
: execution?.status === 'failed'
|
||||
? '工作流失败'
|
||||
: '执行状态待确认'
|
||||
"
|
||||
/>
|
||||
<span v-if="breakdownBusy" class="flex items-center gap-2" role="status"
|
||||
><LoaderCircle :size="13" class="animate-spin" />最近阶段:{{ runningStage }}</span
|
||||
>
|
||||
</div>
|
||||
<!-- 以下是轻量状态入口,详细问题与恢复操作统一放入弹窗;阶段切换使用侧栏 -->
|
||||
<div v-if="project?.episodes.length" class="toolbar-actions">
|
||||
@@ -303,7 +393,7 @@ const rules = {
|
||||
v-if="execution?.errorMessage || validation?.valid === false"
|
||||
text
|
||||
type="error"
|
||||
@click="toolsOpen = true"
|
||||
@click="openIssues"
|
||||
>查看拆解问题</NButton
|
||||
>
|
||||
|
||||
@@ -313,15 +403,22 @@ const rules = {
|
||||
v-model:open="toolsOpen"
|
||||
title="拆解设置与恢复"
|
||||
label="拆解设置与恢复"
|
||||
@closed="finishOpeningIssues"
|
||||
>
|
||||
<section class="panel workspace-panel breakdown-settings-panel">
|
||||
<p
|
||||
v-if="backgroundExecution.discoveryError.value"
|
||||
class="mb-4 text-xs leading-6 text-danger"
|
||||
role="alert"
|
||||
>
|
||||
{{ backgroundExecution.discoveryError.value }}
|
||||
<NButton text @click="backgroundExecution.discover">重新读取后台状态</NButton>
|
||||
</p>
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<h2 class="flex items-center gap-2 font-semibold"><Layers :size="17" />拆解设置</h2>
|
||||
<p class="mt-2 text-xs leading-5 text-muted">
|
||||
读取已保存的
|
||||
{{ project.episodes.length }}
|
||||
集剧本。每个分组分别抽取所选模块,再生成主体与分镜。
|
||||
按所选模块拆解已保存的 {{ project.episodes.length }} 集剧本。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -401,9 +498,6 @@ const rules = {
|
||||
>
|
||||
仅生成候选,确认后再提交正式结果
|
||||
</NCheckbox>
|
||||
<p class="text-xs leading-6 text-muted">
|
||||
候选不会替换现有主体和分镜。重新拆解使用候选模式,完成后单独审核与提交。
|
||||
</p>
|
||||
</div>
|
||||
<div v-if="preview" class="group-preview">
|
||||
<div class="mb-4 flex flex-wrap items-center justify-between gap-3">
|
||||
@@ -439,8 +533,11 @@ const rules = {
|
||||
<p v-if="project.status === 'generating'" class="mt-4 text-xs text-danger">
|
||||
剧本仍在生成,暂不允许启动拆解,避免读取到不完整的剧集。
|
||||
</p>
|
||||
<p v-if="records.length && !taskStopped" class="mt-4 text-xs leading-5 text-muted">
|
||||
当前任务还没有明确的完成或失败记录。为避免重复执行,已暂停重新拆解;如任务已中断,请先刷新状态,再选择对应恢复操作。
|
||||
<p v-if="breakdownBusy" class="mt-4 text-xs leading-5 text-muted">
|
||||
拆解进行中,结束后自动更新结果。
|
||||
</p>
|
||||
<p v-else-if="records.length && !taskStopped" class="mt-4 text-xs leading-5 text-muted">
|
||||
任务状态尚未确认,请重新读取后台状态后再操作。
|
||||
</p>
|
||||
</section>
|
||||
<BreakdownCandidatePanel
|
||||
@@ -468,76 +565,23 @@ const rules = {
|
||||
@refresh="backgroundExecution.query.refresh"
|
||||
@dismiss="backgroundExecution.dismiss"
|
||||
/>
|
||||
<section v-if="snapshot">
|
||||
<div class="mb-3 flex flex-wrap items-center justify-between gap-3">
|
||||
<h2 class="text-sm font-medium">
|
||||
最近可用拆解快照
|
||||
<span class="ml-2 text-xs font-normal text-muted">{{
|
||||
nodeLabel(records.at(-1)?.metadata?.nodeName)
|
||||
}}</span>
|
||||
</h2>
|
||||
<StatusBadge
|
||||
:status="execution?.status || 'unknown'"
|
||||
:label="
|
||||
execution?.status === 'completed'
|
||||
? '工作流已完成'
|
||||
: execution?.status === 'failed'
|
||||
? '工作流失败'
|
||||
: '阶段快照 · 执行状态待确认'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="summary" class="flex flex-wrap items-center gap-x-6 gap-y-2 text-xs text-muted">
|
||||
<span
|
||||
>抽取完成
|
||||
<strong class="text-ink"
|
||||
>{{ summary.completed }} / {{ summary.total }}</strong
|
||||
></span
|
||||
><span>失败 {{ summary.failed }}</span
|
||||
><span>主体 {{ subjects.length }}</span
|
||||
><span>分镜剧集 {{ shots.length }} / {{ plans.length }}</span>
|
||||
</div>
|
||||
<NProgress
|
||||
v-if="summary?.total"
|
||||
aria-label="已完成抽取任务"
|
||||
type="line"
|
||||
:show-indicator="false"
|
||||
:height="4"
|
||||
:percentage="
|
||||
Math.min(100, Math.max(0, (summary.completed / Math.max(1, summary.total)) * 100))
|
||||
"
|
||||
class="mt-3"
|
||||
></NProgress>
|
||||
<ContextNotice
|
||||
v-if="execution?.errorMessage"
|
||||
role="alert"
|
||||
type="error"
|
||||
:show-icon="false"
|
||||
class="mt-4"
|
||||
>{{ execution.errorMessage }}</ContextNotice
|
||||
<!-- 以下是简洁的问题摘要与恢复操作,详细错误只在独立弹窗展示 -->
|
||||
<section v-if="snapshot" class="space-y-4">
|
||||
<div
|
||||
v-if="execution?.errorMessage || validation?.valid === false"
|
||||
class="workspace-panel problem-surface flex flex-wrap items-center justify-between gap-3"
|
||||
>
|
||||
<ContextNotice
|
||||
v-if="validation && !validation.valid"
|
||||
type="error"
|
||||
:show-icon="false"
|
||||
class="mt-4"
|
||||
><p class="font-medium">分镜校验未通过</p>
|
||||
<ul class="mt-2 list-inside list-disc space-y-1">
|
||||
<li v-for="(issue, index) in validation.issues" :key="index">
|
||||
第 {{ issue.episodeNo }} 集<span v-if="issue.beatNo">
|
||||
/ Beat {{ issue.beatNo }}</span
|
||||
><span v-if="issue.shotNo"> / Shot {{ issue.shotNo }}</span
|
||||
>:{{ issue.message }}
|
||||
</li>
|
||||
</ul></ContextNotice
|
||||
>
|
||||
<div v-if="showRecovery" class="recovery-strip mt-4">
|
||||
<p class="text-sm">
|
||||
{{ execution?.errorMessage ? '拆解执行异常' : '分镜校验未通过'
|
||||
}}<span v-if="storyboardIssues.length" class="ml-2 text-xs text-muted"
|
||||
>{{ storyboardIssues.length }} 项问题</span
|
||||
>
|
||||
</p>
|
||||
<NButton text @click="openIssues">查看问题</NButton>
|
||||
</div>
|
||||
<div v-if="showRecovery" class="recovery-strip">
|
||||
<div>
|
||||
<p class="text-sm font-medium">从中断处继续</p>
|
||||
<p class="mt-1 text-xs leading-5 text-muted">
|
||||
抽取失败、镜头缺失、主体绑定异常分别处理。禁用表示近期 checkpoint
|
||||
不具备所需数据。
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<ConfirmAction
|
||||
@@ -549,6 +593,8 @@ const rules = {
|
||||
project?.status !== 'completed' ||
|
||||
!recovery.retry ||
|
||||
operation.pending ||
|
||||
backgroundExecution.discovering.value ||
|
||||
!!backgroundExecution.discoveryError.value ||
|
||||
!!error
|
||||
"
|
||||
@confirm="run('retry')"
|
||||
@@ -561,6 +607,8 @@ const rules = {
|
||||
project?.status !== 'completed' ||
|
||||
!recovery.shots ||
|
||||
operation.pending ||
|
||||
backgroundExecution.discovering.value ||
|
||||
!!backgroundExecution.discoveryError.value ||
|
||||
!!error
|
||||
"
|
||||
@confirm="run('resume-shots')"
|
||||
@@ -573,6 +621,8 @@ const rules = {
|
||||
project?.status !== 'completed' ||
|
||||
!recovery.storyboard ||
|
||||
operation.pending ||
|
||||
backgroundExecution.discovering.value ||
|
||||
!!backgroundExecution.discoveryError.value ||
|
||||
!!error
|
||||
"
|
||||
@confirm="run('resume-storyboard')"
|
||||
@@ -644,11 +694,13 @@ const rules = {
|
||||
v-model:episode-no="selectedEpisodeNo"
|
||||
:plans="plans"
|
||||
:episodes="shots"
|
||||
:diagnosis-disabled="breakdownBusy || backgroundExecution.discovering.value"
|
||||
@diagnose="openShotDiagnosis"
|
||||
>
|
||||
<!-- 以下是跟随当前剧集的一行诊断摘要,诊断弹窗独立于列表滚动 -->
|
||||
<template #diagnosis>
|
||||
<StoryboardDiagnosis
|
||||
v-if="!breakdownBusy && !backgroundExecution.discovering.value"
|
||||
ref="diagnosisPanel"
|
||||
:project-id="projectId"
|
||||
:episode-no="currentEpisodeNo"
|
||||
@@ -716,12 +768,21 @@ const rules = {
|
||||
</section>
|
||||
</template>
|
||||
</WorkspacePage>
|
||||
<!-- 以下是与拆解设置分离的问题详情弹窗 -->
|
||||
<BreakdownIssuesDialog
|
||||
v-model:open="issuesOpen"
|
||||
:issues="storyboardIssues"
|
||||
:workflow-error="execution?.errorMessage"
|
||||
:locatable="!breakdownBusy && !!shots.length"
|
||||
@locate="locateIssue"
|
||||
@settings="toolsOpen = true"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
||||
@reference "../../styles/styles.css";
|
||||
/* 任务卡片取消二次内缩,与快照、校验详情及设置卡片边缘对齐。 */
|
||||
/* 任务进度与设置面板共用水平边界,避免重复内缩。 */
|
||||
.workspace-tools-body .breakdown-execution-panel {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
@@ -85,11 +85,7 @@ async function commit() {
|
||||
>
|
||||
</div>
|
||||
<p class="text-xs leading-6 text-muted">
|
||||
{{
|
||||
committed
|
||||
? '这份结果已写入正式主体、形态与分镜。'
|
||||
: '候选生成不替换正式数据。确认后由后端核对剧本版本、审核结果和下游资产,再统一提交。已有身份、参考图或镜头生产资产时会拒绝替换。'
|
||||
}}
|
||||
{{ committed ? '这份结果已写入正式主体、形态与分镜。' : '候选不替换正式数据,校验通过后单独提交。' }}
|
||||
</p>
|
||||
<p v-if="!committed && issue" class="text-xs leading-6 text-muted" role="status">{{ issue }}</p>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { NButton } from 'naive-ui'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import type { ShotValidation } from '../types'
|
||||
|
||||
/** 同一剧集、节拍和镜头的校验问题分组。 */
|
||||
interface BreakdownIssueGroup {
|
||||
/** 稳定的位置键。 */
|
||||
key: string
|
||||
/** 后端提供的原始位置。 */
|
||||
location: ShotValidation['issues'][number]
|
||||
/** 去重后的原始错误描述。 */
|
||||
messages: string[]
|
||||
}
|
||||
|
||||
/** 拆解问题单独展示,设置弹窗不承载长错误正文。 */
|
||||
const props = defineProps<{
|
||||
/** 后端分镜校验问题,保留原始描述和位置。 */
|
||||
issues: ShotValidation['issues']
|
||||
/** 工作流执行异常,空值表示没有执行异常。 */
|
||||
workflowError?: string
|
||||
/** 当前结果是否允许定位到分镜正文。 */
|
||||
locatable: boolean
|
||||
}>()
|
||||
/** 独立问题弹窗显隐。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 弹窗关闭后再定位正文或打开设置,避免叠加焦点陷阱。 */
|
||||
const emit = defineEmits<{ locate: [issue: ShotValidation['issues'][number]]; settings: [] }>()
|
||||
/** 相同镜头的问题合并为一组,重复消息不重复显示。 */
|
||||
const groups = computed(() => {
|
||||
const result = new Map<string, BreakdownIssueGroup>()
|
||||
for (const issue of props.issues) {
|
||||
const key = `${issue.episodeNo}:${issue.beatNo ?? ''}:${issue.shotNo ?? ''}`
|
||||
const group = result.get(key) ?? { key, location: issue, messages: [] }
|
||||
if (!group.messages.includes(issue.message)) group.messages.push(issue.message)
|
||||
result.set(key, group)
|
||||
}
|
||||
return [...result.values()]
|
||||
})
|
||||
/** 当前去重后的问题总数,不把多个位置合为一个错误。 */
|
||||
const count = computed(() => groups.value.reduce((total, group) => total + group.messages.length, 0))
|
||||
/** 等待离场后执行的定位。 */
|
||||
const pendingLocation = ref<ShotValidation['issues'][number] | null>(null)
|
||||
/** 等待离场后打开设置。 */
|
||||
const pendingSettings = ref(false)
|
||||
|
||||
/**
|
||||
* 关闭问题弹窗后定位到对应剧集、节拍或镜头。
|
||||
* @param issue 后端提供的问题位置
|
||||
*/
|
||||
function locate(issue: ShotValidation['issues'][number]) {
|
||||
if (!props.locatable) return
|
||||
pendingLocation.value = { ...issue }
|
||||
open.value = false
|
||||
}
|
||||
/** 关闭当前弹窗后打开拆解设置,避免同时显示两个操作弹窗。 */
|
||||
function settings() {
|
||||
pendingSettings.value = true
|
||||
open.value = false
|
||||
}
|
||||
/** 离场动画结束后再交接焦点。 */
|
||||
function finish() {
|
||||
if (pendingLocation.value) {
|
||||
const issue = pendingLocation.value
|
||||
pendingLocation.value = null
|
||||
emit('locate', issue)
|
||||
}
|
||||
if (pendingSettings.value) {
|
||||
pendingSettings.value = false
|
||||
emit('settings')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是独立的拆解执行错误与分镜校验问题模块 -->
|
||||
<AppDialog v-model:open="open" title="拆解问题" wide @closed="finish">
|
||||
<template #description
|
||||
><span v-if="count">{{ count }} 项校验问题 · {{ groups.length }} 个位置</span
|
||||
><span v-else>查看最近保存结果中的问题</span></template
|
||||
>
|
||||
<div class="space-y-4">
|
||||
<section v-if="workflowError" class="workspace-panel problem-surface space-y-3" aria-label="执行异常">
|
||||
<h3 class="text-sm font-medium">执行异常</h3>
|
||||
<p class="whitespace-pre-wrap break-words text-sm leading-6">{{ workflowError }}</p>
|
||||
</section>
|
||||
<article
|
||||
v-for="group in groups"
|
||||
:key="group.key"
|
||||
class="workspace-panel problem-surface breakdown-issue-group space-y-3"
|
||||
>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h3 class="text-sm font-medium">
|
||||
第 {{ group.location.episodeNo }} 集<span v-if="group.location.beatNo">
|
||||
· 节拍 {{ group.location.beatNo }}</span
|
||||
><span v-if="group.location.shotNo"> · 镜头 {{ group.location.shotNo }}</span>
|
||||
</h3>
|
||||
<NButton v-if="locatable" size="small" text @click="locate(group.location)">{{
|
||||
group.location.beatNo ? '定位分镜' : '查看本集'
|
||||
}}</NButton>
|
||||
</div>
|
||||
<p v-for="message in group.messages" :key="message" class="break-words text-sm leading-6">
|
||||
{{ message }}
|
||||
</p>
|
||||
</article>
|
||||
<p v-if="!groups.length && !workflowError" class="py-5 text-sm text-muted">
|
||||
后端尚未返回具体问题,请刷新拆解结果后查看。
|
||||
</p>
|
||||
</div>
|
||||
<template #footer
|
||||
><NButton @click="settings">拆解设置</NButton
|
||||
><NButton type="primary" @click="open = false">关闭</NButton></template
|
||||
>
|
||||
</AppDialog>
|
||||
</template>
|
||||
@@ -14,6 +14,8 @@ const props = defineProps<{
|
||||
plans: EpisodePlan[]
|
||||
/** 正式分集镜头。 */
|
||||
episodes: EpisodeShots[]
|
||||
/** 拆解期间隐藏节拍和镜头诊断入口。 */
|
||||
diagnosisDisabled?: boolean
|
||||
}>()
|
||||
/** 分镜卡片只负责发出诊断定位,确认及模型任务交由页面处理。 */
|
||||
const emit = defineEmits<{ diagnose: [scope: DiagnosisLocation] }>()
|
||||
@@ -114,7 +116,7 @@ defineExpose({ locate })
|
||||
<h3 class="text-sm font-semibold">{{ beat.title }}</h3>
|
||||
<NTag size="small" :bordered="false">{{ purposeLabels[beat.purpose] || beat.purpose }}</NTag>
|
||||
<NButton
|
||||
v-if="plan"
|
||||
v-if="plan && !diagnosisDisabled"
|
||||
size="tiny"
|
||||
text
|
||||
class="diagnose-hover-action ml-auto"
|
||||
@@ -145,7 +147,7 @@ defineExpose({ locate })
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<h4 class="text-sm font-medium">{{ shot.title }}</h4>
|
||||
<NButton
|
||||
v-if="plan"
|
||||
v-if="plan && !diagnosisDisabled"
|
||||
size="tiny"
|
||||
text
|
||||
class="diagnose-hover-action"
|
||||
@@ -188,10 +190,10 @@ defineExpose({ locate })
|
||||
<style>
|
||||
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
||||
@reference "../../../styles/styles.css";
|
||||
/* 问题定位保留轮廓提示,便于关闭弹窗后识别目标。 */
|
||||
.diagnosis-located {
|
||||
outline: 1px solid var(--app-accent);
|
||||
outline-offset: 3px;
|
||||
/* 问题定位使用柔和红色底面,不改变行高和间距;内部控件保留键盘焦点。 */
|
||||
.breakdown-storyboard .diagnosis-located {
|
||||
background: var(--app-danger-soft);
|
||||
outline: none;
|
||||
}
|
||||
.beat-section {
|
||||
@apply mt-[25px] pt-[23px];
|
||||
|
||||
@@ -199,9 +199,7 @@ onScopeDispose(() => {
|
||||
<h3 class="text-sm font-medium">分镜质量修订</h3>
|
||||
<NButton :loading="loading" :disabled="disabled || loading" @click="load">读取修复清单</NButton>
|
||||
</div>
|
||||
<p class="text-xs leading-6 text-muted">
|
||||
用于尚未入库的质量阻断镜头。读取不调用模型;人工修订保存为新快照,通过后再恢复拆解。
|
||||
</p>
|
||||
<p class="text-xs leading-6 text-muted">仅修订尚未入库的镜头,保存后再恢复拆解。</p>
|
||||
<p v-if="error" role="alert" class="text-xs leading-6 text-danger">{{ error }}</p>
|
||||
<p v-if="plan && !plan.repairPlan.length && !error" role="status" class="text-xs text-muted">
|
||||
当前没有可人工修订的质量阻断镜头,不代表未诊断镜头已通过。
|
||||
|
||||
Reference in new issue
Block a user