feat(short-drama-agent-front): 接入审核人工确认与延期验证
This commit is contained in:
1 parent
5836b90934
commit
c6ef595a8e
23 files changed
+3923
-67
No files matched your search
@@ -0,0 +1,850 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onScopeDispose, ref, watch } from 'vue'
|
||||
import { NButton, NCheckbox, NCollapse, NCollapseItem, NForm, NScrollbar, NSelect, NTag } from 'naive-ui'
|
||||
import { FileCheck2, FileSearch, Plus } from '@lucide/vue'
|
||||
import { AppDrawer, EmptyState, WorkspaceRefreshButton, WorkspaceSectionHeading } from '../../../components/ui'
|
||||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
import { formatDate } from '../../../lib/format'
|
||||
import { userFacingText } from '../../../lib/user-facing-text'
|
||||
import { useQuery } from '../../../composables/useQuery'
|
||||
import { useProjectContext } from '../../projects/context'
|
||||
import { workflowCheckpoints } from '../../workflows/selectors'
|
||||
import DramaRewriteAction from './DramaRewriteAction.vue'
|
||||
import ManualReviewIssueEditor from './ManualReviewIssueEditor.vue'
|
||||
import ReviewUncertaintyCard from './ReviewUncertaintyCard.vue'
|
||||
import { reviewCategoryOptions, suggestionForUncertainty, savedReviewDecisions } from './model'
|
||||
import { useDramaReview } from './useDramaReview'
|
||||
import { loadDramaRewritePreview } from './api'
|
||||
import type { DramaReviewIssue, DramaReviewPreview, DeferredUncertaintyDraft } from './types'
|
||||
|
||||
/** 审核记录只在用户切到当前标签时挂载,不为其它页面额外查询。 */
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** 当前正式项目。 */ projectId: string
|
||||
/** 项目查询失败等外部限制。 */ disabled?: boolean
|
||||
}>(),
|
||||
{ disabled: false }
|
||||
)
|
||||
/** 正式项目、保存记录与导航状态共用同一个数据源。 */
|
||||
const context = useProjectContext()
|
||||
/** 当前入口绑定的项目,异步响应必须核对归属。 */
|
||||
const projectId = computed(() => props.projectId)
|
||||
/** 外部项目错误只限制写入,仍可只读查看。 */
|
||||
const disabled = computed(() => props.disabled || !!context.error.value)
|
||||
/** 人工确认与稳定原始索引选择。 */
|
||||
const flow = useDramaReview(projectId, context.refresh, disabled)
|
||||
/** 最新正式审核。 */
|
||||
const latest = computed(() => flow.query.data.value?.latest ?? null)
|
||||
/** 当前已核对的处理预检。 */
|
||||
const preview = computed(() => flow.query.data.value?.preview ?? null)
|
||||
/** 当前审核每次重读后同步查询改写范围,不从集号数量推断角色或世界观能否改写。 */
|
||||
const rewriteKey = computed(() =>
|
||||
latest.value?.passed === false
|
||||
? JSON.stringify([projectId.value, latest.value.id, preview.value?.checkpointId, flow.query.updatedAt.value])
|
||||
: ''
|
||||
)
|
||||
/**
|
||||
* 查询当前真实改写范围,并拒绝与人工确认来源不同的保存记录。
|
||||
* @param key 当前审核查询版本,空值时不发送请求
|
||||
* @param signal 取消过期查询
|
||||
* @returns 当前改写预检或空值
|
||||
*/
|
||||
async function readRewriteAvailability(key: string, signal: AbortSignal) {
|
||||
if (!key) return null
|
||||
const id = projectId.value
|
||||
const checkpointId = preview.value?.checkpointId
|
||||
const result = await loadDramaRewritePreview(id, signal)
|
||||
if (checkpointId && result.checkpointId !== checkpointId)
|
||||
throw new Error('审核与改写范围的保存记录已变化,请刷新审核后重新核对。')
|
||||
return result
|
||||
}
|
||||
/** 改写预检只读查询,项目和保存记录变化时自动取消旧结果。 */
|
||||
const rewriteQuery = useQuery(rewriteKey, readRewriteAvailability)
|
||||
/** 只展示与当前项目及当前保存记录一致的真实改写范围。 */
|
||||
const currentRewrite = computed(() => {
|
||||
const result = rewriteQuery.data.value
|
||||
return result?.projectId === projectId.value &&
|
||||
(!preview.value || result.checkpointId === preview.value.checkpointId)
|
||||
? result
|
||||
: null
|
||||
})
|
||||
/** 只在预检确有剩余待处理项时显示人工确认入口,不为已处理完的审核保留空操作。 */
|
||||
const hasManualIssues = computed(
|
||||
() =>
|
||||
latest.value?.passed === false &&
|
||||
!!preview.value &&
|
||||
!!(flow.pendingRows.value.length || flow.uncertaintyRows.value.length)
|
||||
)
|
||||
/** 任一真实改写模块存在时保留入口,支持没有集号的角色或世界观单独改写。 */
|
||||
const hasRewriteTargets = computed(
|
||||
() =>
|
||||
latest.value?.passed === false &&
|
||||
!rewriteQuery.error.value &&
|
||||
!!(
|
||||
currentRewrite.value?.rewriteEpisodes ||
|
||||
currentRewrite.value?.rewriteCharacters ||
|
||||
currentRewrite.value?.rewriteWorld
|
||||
)
|
||||
)
|
||||
/** 当前有效预检只强调一个下一步入口,配色不代替服务端操作权限。 */
|
||||
const primaryAction = computed<'confirm' | 'rewrite' | null>(() => {
|
||||
if (flow.locked.value || rewriteQuery.loading.value || rewriteQuery.error.value || latest.value?.passed !== false)
|
||||
return null
|
||||
if (currentRewrite.value?.status === 'blocked' || currentRewrite.value?.status === 'stale') return null
|
||||
if (hasRewriteTargets.value) return currentRewrite.value?.ready === true ? 'rewrite' : null
|
||||
return hasManualIssues.value ? 'confirm' : null
|
||||
})
|
||||
/** 剧集范围同样读取真实改写预检,设定单独改写不伪造成剧集任务。 */
|
||||
const rewriteEpisodeSummary = computed(() => {
|
||||
const result = currentRewrite.value
|
||||
if (rewriteQuery.loading.value || rewriteQuery.error.value || !result) return '待确认'
|
||||
if (result.rewriteEpisodes && result.episodeNumbers.length) return `第 ${result.episodeNumbers.join('、')} 集`
|
||||
return result.rewriteCharacters || result.rewriteWorld ? '仅涉及设定' : '暂无剧集改写'
|
||||
})
|
||||
/** 下一步说明只读取服务端已有的改写依据,不预先接受问题或启动模型。 */
|
||||
const nextStep = computed(() => {
|
||||
const result = currentRewrite.value
|
||||
const scope = [
|
||||
result?.rewriteEpisodes ? `第 ${result.episodeNumbers.join('、')} 集` : '',
|
||||
result?.rewriteCharacters ? '角色设定' : '',
|
||||
result?.rewriteWorld ? '世界观' : ''
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join('、')
|
||||
return hasRewriteTargets.value
|
||||
? {
|
||||
title: '已有改写依据,请检查改写范围',
|
||||
description: `${scope}已有改写依据。点击“改写预检”核对范围${hasManualIssues.value ? ';待确认问题仍可继续人工处理' : ''}。开始改写前会再次确认费用。`
|
||||
}
|
||||
: {
|
||||
title: '请先核对审核问题',
|
||||
description:
|
||||
'点击“人工确认”对照原文逐项处理。确认后如需改写,会显示“改写预检”入口;所有处理都需要你确认。'
|
||||
}
|
||||
})
|
||||
/** 正式正文的当前阅读集号。 */
|
||||
const sourceEpisode = ref<number | null>(null)
|
||||
/** 原文容器用于抽屉内定位,不切换到另一个主界面。 */
|
||||
const sourceElement = ref<HTMLElement | null>(null)
|
||||
/** 人工补充证据区用于用户主动操作后的抽屉内定位。 */
|
||||
const manualElement = ref<HTMLElement | null>(null)
|
||||
/** 完整正文桌面展开、手机按需展开,避免短屏首次进入被原文占满。 */
|
||||
const sourceMedia = window.matchMedia('(min-width: 1024px)')
|
||||
/** 当前只读正文折叠状态,不影响任何审核选择。 */
|
||||
const sourceExpanded = ref<string[]>(sourceMedia.matches ? ['source'] : [])
|
||||
/**
|
||||
* 屏幕断点变化时同步适合当前尺寸的正文展示方式。
|
||||
* @param event 当前桌面断点
|
||||
*/
|
||||
function syncSourceMedia(event: MediaQueryListEvent) {
|
||||
sourceExpanded.value = event.matches ? ['source'] : []
|
||||
}
|
||||
sourceMedia.addEventListener('change', syncSourceMedia)
|
||||
onScopeDispose(() => sourceMedia.removeEventListener('change', syncSourceMedia))
|
||||
/** 改写预检复用页面上的唯一入口。 */
|
||||
const rewriteAction = ref<InstanceType<typeof DramaRewriteAction> | null>(null)
|
||||
/** 仅记录用户主动的界面交接意图,避免同时叠加抽屉和预检弹窗。 */
|
||||
const queuedRewriteProject = ref('')
|
||||
/** 读取中或失败时不把上次通过结果显示为当前成功。 */
|
||||
const reviewUncertain = computed(() => flow.query.loading.value || !!flow.query.error.value)
|
||||
/** 服务端回执说明下一步,不根据分类计数推断已经通过。 */
|
||||
const receiptSummary = computed(() => {
|
||||
const result = flow.receipt.value
|
||||
if (!result) return ''
|
||||
if (result.finalized) return '本次人工处理已由系统确认完成,请以最新审核与阶段状态为准。'
|
||||
return result.confirmedEpisodes.length
|
||||
? `本次已记录第 ${result.confirmedEpisodes.join('、')} 集的改写依据。请核对改写范围后再决定是否继续。`
|
||||
: '本次人工处理已保存,请继续核对剩余问题和改写范围。'
|
||||
})
|
||||
watch(projectId, () => {
|
||||
queuedRewriteProject.value = ''
|
||||
})
|
||||
/** 待处理正文来自预检,通过后仍可只读查看当前项目已保存的正式正文。 */
|
||||
const sourceEpisodes = computed<DramaReviewPreview['episodes']>(
|
||||
() =>
|
||||
preview.value?.episodes ??
|
||||
(latest.value?.passed && context.project.value?.id === projectId.value
|
||||
? context.project.value.episodes.map(({ episode, content }) => ({ episode, content }))
|
||||
: [])
|
||||
)
|
||||
/** 正文选项来自实际保存的剧集,不根据计划数量补造内容。 */
|
||||
const episodeOptions = computed(() =>
|
||||
sourceEpisodes.value.map(item => ({ label: `第 ${item.episode} 集`, value: item.episode }))
|
||||
)
|
||||
/** 当前完整正文以纯文本展示。 */
|
||||
const sourceContent = computed(
|
||||
() => sourceEpisodes.value.find(item => item.episode === sourceEpisode.value)?.content ?? ''
|
||||
)
|
||||
/** 角色选项沿用正式项目数据,用户不能填写猜测的角色名。 */
|
||||
const characters = computed(() => context.project.value?.characters.map(item => item.name) ?? [])
|
||||
/** 仍待处理的问题按正式集号分组,原始索引不变。 */
|
||||
const groups = computed(() =>
|
||||
[...new Set(flow.pendingRows.value.map(row => row.issue.episode))]
|
||||
.toSorted((a, b) => a - b)
|
||||
.map(episode => ({ episode, rows: flow.pendingRows.value.filter(row => row.issue.episode === episode) }))
|
||||
)
|
||||
/** 原始已记录问题只读展示,不用它覆盖当前剩余裁决。 */
|
||||
const recordedIssues = computed(() => latest.value?.qualityReview?.issues ?? [])
|
||||
/** 现有延期等裁决只作追溯,不能把接受视为已完成后续核验。 */
|
||||
const decisions = computed(() => {
|
||||
const checkpoint = workflowCheckpoints(context.checkpoints.value, 'create-drama').at(-1)
|
||||
return preview.value && checkpoint?.checkpointId === preview.value.checkpointId
|
||||
? (savedReviewDecisions(checkpoint.state.review, preview.value.reviewId) ??
|
||||
latest.value?.manualUncertaintyDecisions ??
|
||||
[])
|
||||
: (latest.value?.manualUncertaintyDecisions ?? [])
|
||||
})
|
||||
watch(sourceEpisodes, value => {
|
||||
if (!value.some(item => item.episode === sourceEpisode.value)) sourceEpisode.value = value[0]?.episode ?? null
|
||||
})
|
||||
/** 其它入口改写结束时,保存记录变化会触发一次重读,不定时查询。 */
|
||||
watch(
|
||||
() => workflowCheckpoints(context.checkpoints.value, 'create-drama').at(-1)?.checkpointId,
|
||||
(id, previous) => {
|
||||
if (id && id !== previous && !flow.writing.value) void flow.query.refresh()
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* 仅切换当前抽屉中的正式正文,不发送写入请求。
|
||||
* @param episode 用户核对的集号
|
||||
*/
|
||||
async function viewEpisode(episode: number | null) {
|
||||
sourceEpisode.value = episode
|
||||
sourceExpanded.value = ['source']
|
||||
await nextTick()
|
||||
sourceElement.value?.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户已创建的延期表单,建议读取不会触发此操作。
|
||||
* @param draft 本次人工编辑的延期草稿
|
||||
*/
|
||||
function updateDeferred(draft: DeferredUncertaintyDraft) {
|
||||
flow.deferredDrafts.value[draft.index] = draft
|
||||
}
|
||||
|
||||
/**
|
||||
* 带入待核对的说明后定位证据表单,仍由用户填写真实原文。
|
||||
* @param index 原始不确定项索引
|
||||
*/
|
||||
async function addUncertaintyEvidence(index: number) {
|
||||
flow.addUncertaintyEvidence(index)
|
||||
await nextTick()
|
||||
manualElement.value?.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
||||
}
|
||||
|
||||
/**
|
||||
* 中文分类只用于展示,原始枚举保留在请求中。
|
||||
* @param issue 当前审核问题
|
||||
* @returns 中文分类名称
|
||||
*/
|
||||
function categoryLabel(issue: DramaReviewIssue) {
|
||||
return reviewCategoryOptions.find(option => option.value === issue.category)?.label ?? '待核对问题'
|
||||
}
|
||||
|
||||
/**
|
||||
* 多种处理方式共用原始索引选择,不使用分组后的页面位置。
|
||||
* @param kind 当前处理方式
|
||||
* @param index 原始审核数组索引
|
||||
* @param checked 用户是否选择
|
||||
*/
|
||||
function toggleChoice(kind: 'error' | 'warning' | 'uncertainty', index: number, checked: boolean) {
|
||||
const target =
|
||||
kind === 'error' ? flow.selectedErrors : kind === 'warning' ? flow.selectedWarnings : flow.selectedUncertainty
|
||||
target.value = checked ? [...new Set([...target.value, index])] : target.value.filter(value => value !== index)
|
||||
}
|
||||
|
||||
/** 用户明确请求下一步时,先关闭核对抽屉。 */
|
||||
function requestRewritePreview() {
|
||||
if (flow.writing.value || disabled.value || !hasRewriteTargets.value) return
|
||||
queuedRewriteProject.value = projectId.value
|
||||
flow.editorOpen.value = false
|
||||
}
|
||||
/** 抽屉离场和焦点约束释放后,再打开预检;不自动启动改写。 */
|
||||
function editorClosed() {
|
||||
const id = queuedRewriteProject.value
|
||||
queuedRewriteProject.value = ''
|
||||
if (id && id === projectId.value) rewriteAction.value?.openPreview()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="drama-review-panel grid gap-6">
|
||||
<!-- 以下是最新审核摘要与只读刷新、处理及改写预检入口 -->
|
||||
<WorkspaceSectionHeading
|
||||
title="审核记录"
|
||||
:description="latest ? `最近审核 · ${formatDate(latest.createdAt)}` : '查看当前正式审核与可处理的问题。'"
|
||||
>
|
||||
<template #actions>
|
||||
<WorkspaceRefreshButton
|
||||
label="刷新审核"
|
||||
:loading="flow.query.loading.value"
|
||||
:disabled="flow.writing.value"
|
||||
@refresh="flow.query.refresh"
|
||||
/>
|
||||
<NButton
|
||||
v-if="hasManualIssues"
|
||||
:class="{ 'workspace-action-button': primaryAction !== 'confirm' }"
|
||||
:type="primaryAction === 'confirm' ? 'primary' : 'default'"
|
||||
aria-label="人工确认"
|
||||
:disabled="!latest || latest.passed || flow.writing.value"
|
||||
@click="flow.openEditor"
|
||||
>
|
||||
<template #icon><FileCheck2 :size="15" aria-hidden="true" /></template>人工确认
|
||||
</NButton>
|
||||
<DramaRewriteAction
|
||||
v-if="hasRewriteTargets"
|
||||
ref="rewriteAction"
|
||||
:project-id="projectId"
|
||||
:primary="primaryAction === 'rewrite'"
|
||||
:disabled="disabled || flow.writing.value || latest?.passed === true"
|
||||
@started="context.refresh"
|
||||
/>
|
||||
</template>
|
||||
</WorkspaceSectionHeading>
|
||||
<ContextNotice v-if="flow.query.error.value" type="error" title="审核读取失败" emphasized>{{
|
||||
flow.query.error.value
|
||||
}}</ContextNotice>
|
||||
<ContextNotice v-if="rewriteQuery.error.value" type="error" title="改写范围读取失败" emphasized>{{
|
||||
rewriteQuery.error.value
|
||||
}}</ContextNotice>
|
||||
<p v-if="flow.query.loading.value && !latest" class="text-sm text-muted">正在读取最新审核…</p>
|
||||
<EmptyState
|
||||
v-else-if="!latest && !flow.query.error.value"
|
||||
title="暂无审核记录"
|
||||
description="正式审核完成后会显示结果;刷新不会重新启动审核。"
|
||||
/>
|
||||
<template v-if="latest">
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<NTag :type="reviewUncertain ? 'default' : latest.passed ? 'success' : 'warning'" :bordered="false">{{
|
||||
reviewUncertain ? '审核状态待核对' : latest.passed ? '当前审核已通过' : '当前审核尚未通过'
|
||||
}}</NTag>
|
||||
</div>
|
||||
<!-- 以下是当前审核的下一步引导,仅在来源有效且读取完成后显示 -->
|
||||
<ContextNotice
|
||||
v-if="
|
||||
(hasManualIssues || hasRewriteTargets) &&
|
||||
!flow.blockedReason.value &&
|
||||
!reviewUncertain &&
|
||||
!rewriteQuery.loading.value &&
|
||||
!rewriteQuery.error.value
|
||||
"
|
||||
type="info"
|
||||
:title="nextStep.title"
|
||||
emphasized
|
||||
>{{ nextStep.description }}</ContextNotice
|
||||
>
|
||||
<ContextNotice
|
||||
v-if="!latest.passed && flow.blockedReason.value"
|
||||
type="warning"
|
||||
title="当前仅可查看"
|
||||
emphasized
|
||||
>{{ flow.blockedReason.value }}</ContextNotice
|
||||
>
|
||||
<ContextNotice
|
||||
v-if="flow.receipt.value && !reviewUncertain"
|
||||
:type="flow.receipt.value.finalized ? 'success' : 'info'"
|
||||
:title="flow.receipt.value.finalized ? '本次处理已完成审核' : '本次处理已保存'"
|
||||
emphasized
|
||||
>{{ receiptSummary }}</ContextNotice
|
||||
>
|
||||
<!-- 以下是当前剩余问题与已记录改写范围,统计不合并为总阻断数 -->
|
||||
<dl v-if="preview && !latest.passed" class="grid gap-5 sm:grid-cols-3">
|
||||
<div>
|
||||
<dt class="text-xs text-muted">待确认问题</dt>
|
||||
<dd class="mt-2 text-sm">
|
||||
{{ preview.remainingPendingQualityIssues?.length ?? '待核对'
|
||||
}}<span v-if="preview.remainingPendingQualityIssues"> 项</span>
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs text-muted">待核对说明</dt>
|
||||
<dd class="mt-2 text-sm">
|
||||
{{ preview.remainingUncertainty?.length ?? '待核对'
|
||||
}}<span v-if="preview.remainingUncertainty"> 项</span>
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs text-muted">待改写剧集</dt>
|
||||
<dd class="mt-2 text-sm">{{ rewriteEpisodeSummary }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<NCollapse>
|
||||
<NCollapseItem
|
||||
v-if="recordedIssues.length"
|
||||
name="recorded-issues"
|
||||
:title="`已记录的审核问题(${recordedIssues.length})`"
|
||||
>
|
||||
<div class="grid gap-5 pt-2">
|
||||
<article v-for="(issue, index) in recordedIssues" :key="index" class="grid gap-2">
|
||||
<h4 class="text-sm font-medium">第 {{ issue.episode }} 集 · {{ categoryLabel(issue) }}</h4>
|
||||
<p class="text-sm leading-7">{{ issue.message }}</p>
|
||||
<blockquote class="review-source-quote">{{ issue.sourceQuote }}</blockquote>
|
||||
<p class="text-xs leading-6 text-muted">修改方向:{{ issue.suggestion }}</p>
|
||||
</article>
|
||||
</div>
|
||||
</NCollapseItem>
|
||||
<NCollapseItem v-if="latest.message" name="review-message" title="审核说明"
|
||||
><p class="whitespace-pre-wrap text-sm leading-7">
|
||||
{{ userFacingText(latest.message) }}
|
||||
</p></NCollapseItem
|
||||
>
|
||||
<NCollapseItem v-if="decisions.length" name="decisions" title="已保存的人工判断"
|
||||
><ul class="space-y-3 text-sm leading-7">
|
||||
<li v-for="(decision, index) in decisions" :key="index">
|
||||
{{
|
||||
decision.disposition === 'accepted'
|
||||
? '已接受'
|
||||
: decision.disposition === 'verified'
|
||||
? '已核验'
|
||||
: '留待后续核验'
|
||||
}}
|
||||
· {{ decision.description }}
|
||||
<p v-if="decision.verificationCriteria" class="text-xs text-muted">
|
||||
<span v-if="decision.episode">第 {{ decision.episode }} 集 · </span>
|
||||
<span v-if="decision.verificationTarget"
|
||||
>{{ decision.verificationTarget === 'breakdown' ? '拆解' : '分镜' }}阶段 · </span
|
||||
>核验标准:{{ decision.verificationCriteria }}
|
||||
</p>
|
||||
</li>
|
||||
</ul></NCollapseItem
|
||||
>
|
||||
<NCollapseItem name="review-details" title="高级详情"
|
||||
><dl class="grid gap-2 text-xs">
|
||||
<dt class="text-muted">审核编号</dt>
|
||||
<dd class="break-all font-mono">{{ latest.id }}</dd>
|
||||
<template v-if="preview"
|
||||
><dt class="mt-2 text-muted">保存记录</dt>
|
||||
<dd class="break-all font-mono">{{ preview.checkpointId }}</dd></template
|
||||
>
|
||||
</dl></NCollapseItem
|
||||
>
|
||||
</NCollapse>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- 以下是全屏人工核对抽屉,正文与表单独立于固定底栏 -->
|
||||
<AppDrawer
|
||||
v-model:open="flow.editorOpen.value"
|
||||
class="review-confirm-drawer"
|
||||
title="审核人工确认"
|
||||
description="对照正式正文逐项核对。本次确认不调用模型,也不会自动改写。"
|
||||
:busy="flow.writing.value"
|
||||
@closed="editorClosed"
|
||||
>
|
||||
<div v-if="flow.editorOpen.value" class="review-editor-content grid gap-6">
|
||||
<ContextNotice v-if="flow.blockedReason.value" type="warning" title="当前仅可查看" emphasized>{{
|
||||
flow.blockedReason.value
|
||||
}}</ContextNotice>
|
||||
<ContextNotice v-if="flow.actionError.value" type="error" title="请核对本次处理" emphasized>{{
|
||||
flow.actionError.value
|
||||
}}</ContextNotice>
|
||||
<!-- 以下是来源变化时保留的只读草稿,不将旧索引套用到新版本 -->
|
||||
<NCollapse v-if="flow.preservedDraft.value">
|
||||
<NCollapseItem name="preserved-draft" title="查看来源变化前的草稿">
|
||||
<div class="grid gap-4 text-sm leading-7">
|
||||
<p class="text-muted">以下选择属于旧审核,仅供重新核对,尚未保存为当前判断。</p>
|
||||
<p
|
||||
v-for="index in flow.preservedDraft.value.acceptedUncertaintyIndexes"
|
||||
:key="`accepted-${index}`"
|
||||
>
|
||||
原选择接受:{{ flow.preservedDraft.value.descriptions[index] }}
|
||||
</p>
|
||||
<div v-for="draft in flow.preservedDraft.value.deferredUncertainties" :key="draft.index">
|
||||
<p>原选择延期:{{ flow.preservedDraft.value.descriptions[draft.index] }}</p>
|
||||
<p class="text-muted">
|
||||
第 {{ draft.episode ?? '未选' }} 集 ·
|
||||
{{
|
||||
draft.verificationTarget === 'breakdown'
|
||||
? '拆解'
|
||||
: draft.verificationTarget === 'storyboard'
|
||||
? '分镜'
|
||||
: '未选阶段'
|
||||
}}
|
||||
· {{ draft.verificationCriteria }}
|
||||
</p>
|
||||
</div>
|
||||
<div v-for="draft in flow.preservedDraft.value.manualIssues" :key="draft.id">
|
||||
<p>{{ draft.message }}</p>
|
||||
<blockquote class="review-source-quote">{{ draft.sourceQuote }}</blockquote>
|
||||
<p>{{ draft.suggestion }}</p>
|
||||
</div>
|
||||
<p
|
||||
v-if="
|
||||
flow.preservedDraft.value.issueIndexes.length ||
|
||||
flow.preservedDraft.value.acceptedWarningIndexes.length
|
||||
"
|
||||
class="text-muted"
|
||||
>
|
||||
原错误与警告选择已撤销,请对照当前问题重新选择。
|
||||
</p>
|
||||
</div>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
<ContextNotice
|
||||
v-if="flow.receipt.value && !reviewUncertain"
|
||||
:type="flow.receipt.value.finalized ? 'success' : 'info'"
|
||||
:title="flow.receipt.value.finalized ? '本次处理已完成审核' : '本次处理已保存'"
|
||||
emphasized
|
||||
>{{ receiptSummary }}</ContextNotice
|
||||
>
|
||||
<div class="review-editor-layout">
|
||||
<!-- 以下是桌面独立滚动的问题区,手机沿用抽屉正文滚动 -->
|
||||
<NScrollbar class="review-issues-scroll">
|
||||
<div class="grid min-w-0 content-start gap-8">
|
||||
<!-- 以下是按剧集分组的待确认问题,原始索引与展示位置分离 -->
|
||||
<section v-if="groups.length || !flow.uncertaintyRows.value.length">
|
||||
<WorkspaceSectionHeading
|
||||
title="待确认问题"
|
||||
description="确认错误用于后续改写;接受警告表示保留当前处理。未选择的条目继续保留。"
|
||||
/>
|
||||
<NCollapse
|
||||
v-if="groups.length"
|
||||
class="mt-4"
|
||||
:default-expanded-names="groups.map(group => group.episode)"
|
||||
>
|
||||
<NCollapseItem
|
||||
v-for="group in groups"
|
||||
:key="group.episode"
|
||||
:name="group.episode"
|
||||
:title="`第 ${group.episode} 集 · ${group.rows.length} 项`"
|
||||
>
|
||||
<div class="grid gap-4">
|
||||
<article
|
||||
v-for="row in group.rows"
|
||||
:key="row.originalIndex"
|
||||
:data-review-issue="row.originalIndex"
|
||||
class="review-issue-card"
|
||||
:class="{
|
||||
'review-issue-error':
|
||||
row.issue.severity === 'error' && !row.issue.policyException
|
||||
}"
|
||||
>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<h4 class="text-sm font-semibold">{{ categoryLabel(row.issue) }}</h4>
|
||||
<NTag size="small" :bordered="false">{{
|
||||
row.issue.policyException
|
||||
? '策略允许'
|
||||
: row.issue.severity === 'error'
|
||||
? '错误待核对'
|
||||
: '警告待核对'
|
||||
}}</NTag>
|
||||
</div>
|
||||
<p class="mt-3 text-sm leading-7">{{ row.issue.message }}</p>
|
||||
<blockquote class="review-source-quote mt-3">
|
||||
{{ row.issue.sourceQuote }}
|
||||
</blockquote>
|
||||
<p class="mt-3 text-xs leading-6 text-muted">
|
||||
修改方向:{{ row.issue.suggestion }}
|
||||
</p>
|
||||
<div class="workspace-action-group mt-4 flex flex-wrap items-center gap-3">
|
||||
<NButton size="small" @click="viewEpisode(row.issue.episode)"
|
||||
><template #icon
|
||||
><FileSearch :size="14" aria-hidden="true" /></template
|
||||
>查看本集原文</NButton
|
||||
>
|
||||
<NButton
|
||||
v-if="!row.issue.policyException"
|
||||
size="small"
|
||||
:disabled="flow.locked.value"
|
||||
@click="flow.addManual(row.issue)"
|
||||
><template #icon><Plus :size="14" aria-hidden="true" /></template
|
||||
>补充原文证据</NButton
|
||||
>
|
||||
</div>
|
||||
<NCheckbox
|
||||
v-if="row.issue.severity === 'error'"
|
||||
class="mt-4"
|
||||
:checked="flow.selectedErrors.value.includes(row.originalIndex)"
|
||||
:disabled="flow.locked.value || flow.issueAction(row) !== 'error'"
|
||||
:aria-disabled="flow.locked.value || flow.issueAction(row) !== 'error'"
|
||||
@update:checked="toggleChoice('error', row.originalIndex, $event)"
|
||||
>已核实错误,记录为改写依据</NCheckbox
|
||||
>
|
||||
<NCheckbox
|
||||
v-else
|
||||
class="mt-4"
|
||||
:checked="flow.selectedWarnings.value.includes(row.originalIndex)"
|
||||
:disabled="flow.locked.value || flow.issueAction(row) !== 'warning'"
|
||||
:aria-disabled="
|
||||
flow.locked.value || flow.issueAction(row) !== 'warning'
|
||||
"
|
||||
@update:checked="toggleChoice('warning', row.originalIndex, $event)"
|
||||
>已核对原文,接受保留此警告</NCheckbox
|
||||
>
|
||||
<p
|
||||
v-if="flow.issueAction(row) === null"
|
||||
class="mt-2 text-xs leading-6 text-muted"
|
||||
>
|
||||
{{
|
||||
row.issue.policyException
|
||||
? '该项属于已允许的表现方式,不能强制确认改写。'
|
||||
: '当前证据尚不能直接确认,可补充经核对的真实原文。'
|
||||
}}
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
<p v-else class="mt-4 text-sm text-muted">
|
||||
{{
|
||||
latest?.passed
|
||||
? '当前审核已通过,无需再次确认问题。'
|
||||
: '当前没有待人工确认的结构化问题。已有审核问题仍需以改写预检为准。'
|
||||
}}
|
||||
</p>
|
||||
</section>
|
||||
<!-- 以下是不确定项,禁止将无效原文或模型格式问题直接接受 -->
|
||||
<section>
|
||||
<WorkspaceSectionHeading
|
||||
title="待核对说明"
|
||||
description="默认保留待处理。可选择标有“建议”的处理方式,也可核对原文后另行决定;确认保存后才会生效。"
|
||||
/>
|
||||
<div v-if="flow.uncertaintyRows.value.length" class="mt-4 grid gap-4">
|
||||
<ReviewUncertaintyCard
|
||||
v-for="row in flow.uncertaintyRows.value"
|
||||
:key="row.originalIndex"
|
||||
:row="row"
|
||||
:suggestion="suggestionForUncertainty(preview, row.originalIndex)"
|
||||
:episodes="preview?.episodes ?? []"
|
||||
:accepted="flow.selectedUncertainty.value.includes(row.originalIndex)"
|
||||
:deferred="flow.deferredDrafts.value[row.originalIndex]"
|
||||
:error="flow.deferredErrors.value[row.originalIndex]"
|
||||
:locked="flow.locked.value"
|
||||
@action="flow.setUncertaintyAction(row.originalIndex, $event)"
|
||||
@update:deferred="updateDeferred"
|
||||
@view="viewEpisode"
|
||||
@evidence="addUncertaintyEvidence(row.originalIndex)"
|
||||
/>
|
||||
</div>
|
||||
<p v-else class="mt-4 text-sm text-muted">当前没有待核对说明。</p>
|
||||
</section>
|
||||
<!-- 以下是人工补充表单,首次打开和新增空行不立即报错 -->
|
||||
<section v-if="!latest?.passed" ref="manualElement">
|
||||
<WorkspaceSectionHeading
|
||||
title="人工补充证据"
|
||||
description="仅补充你已核实的真实错误,不自动将不确定说明转换为错误。"
|
||||
>
|
||||
<template #actions
|
||||
><NButton
|
||||
:disabled="flow.locked.value || !preview?.episodes.length"
|
||||
@click="flow.addManual()"
|
||||
><template #icon><Plus :size="15" aria-hidden="true" /></template
|
||||
>补充原文证据</NButton
|
||||
></template
|
||||
>
|
||||
</WorkspaceSectionHeading>
|
||||
<NForm
|
||||
v-if="flow.manualDrafts.value.length"
|
||||
label-placement="top"
|
||||
class="mt-5 grid gap-8"
|
||||
@submit.prevent
|
||||
>
|
||||
<ManualReviewIssueEditor
|
||||
v-for="(draft, index) in flow.manualDrafts.value"
|
||||
:key="draft.id"
|
||||
:model-value="draft"
|
||||
:order="index + 1"
|
||||
:episodes="preview?.episodes ?? []"
|
||||
:characters="characters"
|
||||
:disabled="flow.locked.value"
|
||||
:error="flow.manualErrors.value[index]"
|
||||
@update:model-value="flow.manualDrafts.value[index] = $event"
|
||||
@remove="flow.removeManual(draft.id)"
|
||||
/>
|
||||
</NForm>
|
||||
</section>
|
||||
</div>
|
||||
</NScrollbar>
|
||||
<!-- 以下是当前正式剧本的纯文本核对区,窄屏先显示原文 -->
|
||||
<section ref="sourceElement" class="review-source-pane">
|
||||
<NCollapse v-model:expanded-names="sourceExpanded">
|
||||
<NCollapseItem name="source" title="正式剧本原文">
|
||||
<div class="review-source-fields grid gap-4">
|
||||
<p class="text-xs leading-6 text-muted">
|
||||
引用必须逐字出现在所选剧集中,不能用事件编号代替。
|
||||
</p>
|
||||
<NSelect
|
||||
v-model:value="sourceEpisode"
|
||||
:options="episodeOptions"
|
||||
aria-label="选择核对剧集"
|
||||
:disabled="!episodeOptions.length"
|
||||
/>
|
||||
<NScrollbar class="review-source-scroll">
|
||||
<pre class="review-source-content">{{
|
||||
sourceContent ||
|
||||
(sourceEpisodes.length
|
||||
? '请选择需要核对的剧集。'
|
||||
: '当前没有可核对的正式正文。')
|
||||
}}</pre>
|
||||
</NScrollbar>
|
||||
</div>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 以下是固定的关闭、只读刷新与明确确认操作,不自动启动改写 -->
|
||||
<template #footer>
|
||||
<div class="review-editor-footer">
|
||||
<NCheckbox
|
||||
v-if="!latest?.passed"
|
||||
v-model:checked="flow.acknowledged.value"
|
||||
:disabled="flow.locked.value || !flow.selectionCount.value"
|
||||
:aria-disabled="flow.locked.value || !flow.selectionCount.value"
|
||||
class="review-confirm-ack"
|
||||
>我已逐项核对所选问题、引用原文和本次处理方式,确认保存人工判断。</NCheckbox
|
||||
>
|
||||
<div class="review-editor-actions">
|
||||
<NButton :disabled="flow.writing.value" @click="flow.editorOpen.value = false">关闭</NButton>
|
||||
<NButton
|
||||
v-if="
|
||||
hasRewriteTargets &&
|
||||
flow.receipt.value?.confirmedEpisodes.length &&
|
||||
!flow.receipt.value.finalized
|
||||
"
|
||||
:disabled="flow.writing.value || disabled"
|
||||
@click="requestRewritePreview"
|
||||
><template #icon><FileSearch :size="15" aria-hidden="true" /></template>查看改写范围</NButton
|
||||
>
|
||||
<WorkspaceRefreshButton
|
||||
label="重新读取"
|
||||
:loading="flow.query.loading.value"
|
||||
:disabled="flow.writing.value"
|
||||
@refresh="flow.query.refresh"
|
||||
/>
|
||||
<NButton
|
||||
v-if="!latest?.passed"
|
||||
type="primary"
|
||||
:loading="flow.writing.value"
|
||||
:disabled="!flow.canConfirm.value"
|
||||
@click="flow.confirm"
|
||||
>确认本次处理</NButton
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</AppDrawer>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
@reference "../../../styles/styles.css";
|
||||
.drama-review-panel {
|
||||
min-width: 0;
|
||||
}
|
||||
/* 审核入口文字在手机保留,限制操作组宽度后自动换行,避免按钮被裁切。 */
|
||||
.drama-review-panel > .workspace-section-heading .workspace-section-heading-actions {
|
||||
max-width: 100%;
|
||||
}
|
||||
/* 此抽屉由固定底栏提供上下留白,正文不再叠加底部内边距。 */
|
||||
.review-confirm-drawer.app-drawer.n-drawer .n-drawer-content .n-drawer-body-content-wrapper {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
.review-editor-layout {
|
||||
@apply grid min-w-0 items-start gap-8 lg:grid-cols-[minmax(0,1.2fr)_minmax(300px,1fr)];
|
||||
}
|
||||
.review-issues-scroll {
|
||||
height: auto;
|
||||
}
|
||||
.review-issue-card {
|
||||
@apply min-w-0;
|
||||
padding: var(--app-content-gap);
|
||||
background: var(--app-subtle);
|
||||
}
|
||||
.review-issue-card.review-issue-error {
|
||||
background: var(--app-danger-soft);
|
||||
}
|
||||
.review-source-quote {
|
||||
@apply whitespace-pre-wrap wrap-anywhere text-sm leading-7;
|
||||
padding: var(--app-content-gap);
|
||||
background: var(--app-control);
|
||||
}
|
||||
.review-source-pane {
|
||||
@apply order-first grid min-w-0 gap-4 lg:sticky lg:top-0 lg:order-last;
|
||||
}
|
||||
.review-source-scroll {
|
||||
height: min(42dvh, 380px);
|
||||
background: var(--app-subtle);
|
||||
}
|
||||
.review-source-content {
|
||||
@apply whitespace-pre-wrap wrap-anywhere text-sm leading-8;
|
||||
padding: var(--app-content-gap);
|
||||
}
|
||||
.review-editor-footer {
|
||||
@apply flex w-full flex-wrap items-center justify-between gap-4;
|
||||
}
|
||||
.review-confirm-ack {
|
||||
@apply min-w-0 text-sm leading-6;
|
||||
flex: 1 1 360px;
|
||||
}
|
||||
.review-editor-actions {
|
||||
@apply ml-auto flex flex-wrap items-center justify-end gap-2;
|
||||
}
|
||||
@media (max-width: 1023px) {
|
||||
/* 窄屏取消内层滚动,桌面继续使用 Naive 滚动容器自身的默认行为。 */
|
||||
.review-issues-scroll,
|
||||
.review-issues-scroll > .n-scrollbar-container {
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
/* 正文按抽屉实际剩余高度分配,两列各自滚动,不以视口比例截断原文。 */
|
||||
.review-confirm-drawer.app-drawer.n-drawer .n-drawer-content .n-drawer-body-content-wrapper {
|
||||
height: 100%;
|
||||
}
|
||||
.review-editor-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
.review-editor-content > :not(.review-editor-layout) {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.review-editor-layout {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
align-items: stretch;
|
||||
overflow: hidden;
|
||||
}
|
||||
.review-issues-scroll {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
.review-source-pane {
|
||||
position: static;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
.review-source-pane > .n-collapse,
|
||||
.review-source-pane > .n-collapse > .n-collapse-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
.review-source-pane .n-collapse-item__header {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.review-source-pane .n-collapse-item__content-wrapper {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
.review-source-pane .n-collapse-item__content-inner {
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
.review-source-fields {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
grid-template-rows: auto auto minmax(0, 1fr);
|
||||
}
|
||||
.review-source-scroll {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user