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,186 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { NButton, NForm, NFormItem, NInput, NRadio, NRadioGroup, NSelect, NTag } from 'naive-ui'
|
||||
import { FileSearch, PencilLine } from '@lucide/vue'
|
||||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
import { uncertaintyAcceptable, type IndexedReviewUncertainty } from './model'
|
||||
import type {
|
||||
DeferredUncertaintyDraft,
|
||||
DramaReviewPreview,
|
||||
ReviewResolutionSuggestion,
|
||||
UncertaintyDisposition
|
||||
} from './types'
|
||||
|
||||
/** 每项人工处理始终绑定原审核索引,推荐内容仅供用户核对。 */
|
||||
const props = defineProps<{
|
||||
/** 原始不确定项。 */ row: IndexedReviewUncertainty
|
||||
/** 当前版本的建议,缺失时不补造。 */ suggestion: ReviewResolutionSuggestion | null
|
||||
/** 正式剧集列表。 */ episodes: DramaReviewPreview['episodes']
|
||||
/** 用户已明确选择接受。 */ accepted: boolean
|
||||
/** 用户已明确选择延期后创建的表单。 */ deferred?: DeferredUncertaintyDraft
|
||||
/** 当前禁止编辑。 */ locked: boolean
|
||||
/** 提交后才显示的字段错误。 */ error?: string
|
||||
}>()
|
||||
/** 显式处理选择、只读定位与补充证据交给统一流程。 */
|
||||
const emit = defineEmits<{
|
||||
/** 用户选择处理方式。 */ action: [action: UncertaintyDisposition]
|
||||
/** 用户修改延期字段。 */ 'update:deferred': [draft: DeferredUncertaintyDraft]
|
||||
/** 查看单集或主动选择多集原文。 */ view: [episode: number | null]
|
||||
/** 补充经原文核实的改写证据。 */ evidence: []
|
||||
}>()
|
||||
/** 选择来源仅为用户操作,不由推荐方式推断。 */
|
||||
const disposition = computed<UncertaintyDisposition>(() =>
|
||||
props.deferred ? 'defer' : props.accepted ? 'accept' : 'pending'
|
||||
)
|
||||
/** 无法核实的原文或格式异常不能直接接受或延期。 */
|
||||
const unavailable = computed(() => props.locked || !uncertaintyAcceptable(props.row.text))
|
||||
/** 候选剧集优先排列,其余真实剧集仍可选择。 */
|
||||
const episodeOptions = computed(() => {
|
||||
const candidates = props.suggestion?.episodeCandidates ?? []
|
||||
return props.episodes
|
||||
.toSorted(
|
||||
(a, b) =>
|
||||
Number(candidates.includes(b.episode)) - Number(candidates.includes(a.episode)) || a.episode - b.episode
|
||||
)
|
||||
.map(item => ({
|
||||
label: `第 ${item.episode} 集${candidates.includes(item.episode) ? '(建议)' : ''}`,
|
||||
value: item.episode
|
||||
}))
|
||||
})
|
||||
/** 建议涉及多集时展示全部候选,不擅自绑定其中一集。 */
|
||||
const candidateLabel = computed(() =>
|
||||
props.suggestion?.episodeCandidates.length
|
||||
? `第 ${props.suggestion.episodeCandidates.join('、')} 集`
|
||||
: '需对照正式正文确认'
|
||||
)
|
||||
/** 后端置信度只展示为中性说明,不代表核对通过。 */
|
||||
const confidenceLabel = computed(() =>
|
||||
props.suggestion?.confidence === 'high'
|
||||
? '依据较明确'
|
||||
: props.suggestion?.confidence === 'low'
|
||||
? '依据有限,需人工核对'
|
||||
: '尚无明确对应,需人工核对'
|
||||
)
|
||||
/** 只提交真实验证阶段枚举。 */
|
||||
const targetOptions = [
|
||||
{ label: '拆解阶段', value: 'breakdown' },
|
||||
{ label: '分镜阶段', value: 'storyboard' }
|
||||
]
|
||||
/**
|
||||
* 修改已有延期草稿,不通过渲染建议创建处理决定。
|
||||
* @param patch 用户修改的字段
|
||||
*/
|
||||
function updateDeferred(patch: Partial<DeferredUncertaintyDraft>) {
|
||||
if (props.deferred && !props.locked) emit('update:deferred', { ...props.deferred, ...patch })
|
||||
}
|
||||
/** 原文定位只使用已选择的集号或唯一明确建议,多集时留给用户选择。 */
|
||||
function viewSource() {
|
||||
const episode =
|
||||
props.deferred?.episode ??
|
||||
(props.suggestion?.confidence === 'high' && !props.suggestion.requiresEpisodeSelection
|
||||
? props.suggestion.episode
|
||||
: null)
|
||||
emit('view', episode ?? null)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<article class="review-issue-card grid gap-5" :data-review-uncertainty="row.originalIndex">
|
||||
<!-- 以下是问题、推荐原因及来源范围,推荐不等于已确认 -->
|
||||
<div class="grid gap-3">
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<h4 class="text-sm font-semibold">问题 {{ row.originalIndex + 1 }}</h4>
|
||||
<NTag :bordered="false" size="small">{{
|
||||
suggestion
|
||||
? suggestion.suggestedAction === 'defer'
|
||||
? '建议延期验证'
|
||||
: '建议人工核对'
|
||||
: '尚无处理建议'
|
||||
}}</NTag>
|
||||
</div>
|
||||
<p class="text-sm leading-7">{{ row.text }}</p>
|
||||
<p v-if="suggestion?.reason" class="text-xs leading-6 text-muted">推荐原因:{{ suggestion.reason }}</p>
|
||||
<div class="grid gap-2 text-xs leading-6 text-muted">
|
||||
<div>涉及剧集:{{ candidateLabel }}</div>
|
||||
<div v-if="suggestion">建议依据:{{ confidenceLabel }}</div>
|
||||
<div v-if="suggestion?.verificationTarget">
|
||||
验证阶段:{{ suggestion.verificationTarget === 'breakdown' ? '拆解' : '分镜' }}
|
||||
</div>
|
||||
<div v-if="suggestion?.verificationCriteria">验证标准:{{ suggestion.verificationCriteria }}</div>
|
||||
</div>
|
||||
<div class="workspace-action-group flex-wrap">
|
||||
<NButton class="workspace-action-button" @click="viewSource"
|
||||
><template #icon><FileSearch :size="15" aria-hidden="true" /></template>查看相关原文</NButton
|
||||
>
|
||||
<NButton class="workspace-action-button" :disabled="locked" @click="emit('evidence')"
|
||||
><template #icon><PencilLine :size="15" aria-hidden="true" /></template>补充改写证据</NButton
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 以下是人工选择,所有项目初始均为保留待处理 -->
|
||||
<NRadioGroup
|
||||
:value="disposition"
|
||||
:disabled="locked"
|
||||
:name="`uncertainty-${row.originalIndex}`"
|
||||
:aria-label="`问题 ${row.originalIndex + 1} 处理方式`"
|
||||
@update:value="emit('action', $event as UncertaintyDisposition)"
|
||||
>
|
||||
<div class="grid gap-3">
|
||||
<NRadio value="pending" data-resolution-action="pending">保留待处理</NRadio>
|
||||
<NRadio value="accept" data-resolution-action="accept" :disabled="unavailable"
|
||||
>接受为合理创作安排</NRadio
|
||||
>
|
||||
<NRadio value="defer" data-resolution-action="defer" :disabled="unavailable"
|
||||
>延期验证<span v-if="suggestion?.suggestedAction === 'defer'" class="ml-2 text-xs text-muted"
|
||||
>(建议)</span
|
||||
></NRadio
|
||||
>
|
||||
</div>
|
||||
</NRadioGroup>
|
||||
<p v-if="!uncertaintyAcceptable(row.text)" class="text-xs text-muted">
|
||||
此项需要补充真实原文证据,不能直接接受或延期。
|
||||
</p>
|
||||
|
||||
<!-- 以下是用户选择延期后展开的可编辑验证要求 -->
|
||||
<NForm v-if="deferred" label-placement="top" :show-feedback="false" class="grid gap-5" @submit.prevent>
|
||||
<p
|
||||
v-if="suggestion?.requiresEpisodeSelection || suggestion?.confidence !== 'high'"
|
||||
class="text-xs leading-6 text-muted"
|
||||
>
|
||||
请明确选择负责验证的剧集;建议候选之外的正式剧集也可选择。
|
||||
</p>
|
||||
<NFormItem label="负责验证的剧集" required>
|
||||
<NSelect
|
||||
:value="deferred.episode"
|
||||
:options="episodeOptions"
|
||||
:disabled="locked"
|
||||
placeholder="请选择正式剧集"
|
||||
:aria-label="`问题 ${row.originalIndex + 1} 负责验证的剧集`"
|
||||
@update:value="updateDeferred({ episode: $event })"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem label="验证阶段" required>
|
||||
<NSelect
|
||||
:value="deferred.verificationTarget"
|
||||
:options="targetOptions"
|
||||
:disabled="locked"
|
||||
:aria-label="`问题 ${row.originalIndex + 1} 验证阶段`"
|
||||
@update:value="updateDeferred({ verificationTarget: $event })"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem label="验证标准" required>
|
||||
<NInput
|
||||
:value="deferred.verificationCriteria"
|
||||
type="textarea"
|
||||
:maxlength="2000"
|
||||
:autosize="{ minRows: 3, maxRows: 8 }"
|
||||
:disabled="locked"
|
||||
:input-props="{ 'aria-label': `问题 ${row.originalIndex + 1} 验证标准` }"
|
||||
@update:value="updateDeferred({ verificationCriteria: $event })"
|
||||
/>
|
||||
</NFormItem>
|
||||
<ContextNotice v-if="error" type="error" title="请完善延期验证">{{ error }}</ContextNotice>
|
||||
</NForm>
|
||||
</article>
|
||||
</template>
|
||||
Reference in new issue
Block a user