Files
syops/frontend/src/features/chat/components/shipping-review/ReviewLlmEvidenceComparison.vue
T
hugo b352c281d5 feat(shipping-notice): 增强发货通知与订单抽取功能,支持多进程处理与紧急停止
- 移除不再使用的 SHIPPING_NOTICE_LAYOUT_PARSER_REVISION 配置
- 在环境配置中新增 SHIPPING_NOTICE_WORKER_CONCURRENCY 和 SHIPPING_NOTICE_JOB_RUNNING_TIMEOUT_SECONDS
- 实现发货通知 worker 进程,支持并发处理订单抽取任务
- 引入紧急停止功能,允许管理员在运行中控制订单解析状态
- 更新相关 API,支持读取与设置紧急停止状态
- 增强文档与代码注释,反映新的业务逻辑与功能要求
2026-07-31 18:00:49 +08:00

86 lines
3.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
features/chat/components/shipping-review/ReviewLlmEvidenceComparison.vue
用途:三列对比当前草稿、AI 建议与原文证据。
依赖:vue-i18n、ShippingOrderReviewEvidence / LlmSuggestion 类型。
逻辑:嵌入 ReviewLlmSuggestionDialog;逐字失败码与后端 value_not_in_evidence 对齐;只读展示。
-->
<script setup lang="ts">
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import type { ShippingOrderReviewEvidence, ShippingOrderReviewLlmSuggestion } from '../../types/shipping.api.types';
/** 三列对比入参;建议/证据可空,标签缺省为空串。 */
const props = withDefaults(
defineProps<{
draftValue?: unknown;
suggestion?: ShippingOrderReviewLlmSuggestion | null;
evidence?: ShippingOrderReviewEvidence | null;
fieldLabel?: string;
}>(),
{
fieldLabel: '',
},
);
const { t } = useI18n();
const suggestedValue = computed(() => props.suggestion?.suggested_value ?? '-');
const draftDisplay = computed(() => {
const value = props.draftValue;
if (value === null || value === undefined || value === '') return '-';
return String(value);
});
const evidenceQuote = computed(() => props.evidence?.quote || '-');
const evidenceLocation = computed(() => {
const page = props.evidence?.page_no;
const cell = props.evidence?.cell_id;
if (page && cell) return t('chat.shippingOrderReview.llmSuggestion.evidenceAtCell', { page, cell });
if (page) return t('chat.shippingOrderReview.evidenceAt', { page });
return t('chat.shippingOrderReview.llmSuggestion.noEvidenceCoords');
});
/** 与后端 rejection_reason 对齐;含历史别名 suggested_value_not_in_evidence。 */
const VERBATIM_FAIL_CODES = new Set([
'value_not_in_evidence',
'suggested_value_not_in_evidence',
'empty_suggestion',
'field_id_mismatch',
]);
const verbatimOk = computed(() => {
if (String(props.suggestion?.status || '') === 'validation_failed') return false;
const issues = props.suggestion?.validation_issues || [];
return !issues.some((item) => VERBATIM_FAIL_CODES.has(String(item.code || '')));
});
</script>
<template>
<div class="grid gap-3 md:grid-cols-3" data-testid="review-llm-evidence-comparison">
<div class="rounded-lg border border-slate-200 bg-slate-50 p-3">
<p class="text-xs font-medium uppercase tracking-wide text-slate-500">
{{ t('chat.shippingOrderReview.llmSuggestion.currentDraft') }}
</p>
<p class="mt-2 text-sm font-semibold text-slate-900">{{ props.fieldLabel }}</p>
<p class="mt-1 text-sm text-slate-700">{{ draftDisplay }}</p>
</div>
<div class="rounded-lg border border-indigo-200 bg-indigo-50/60 p-3">
<p class="text-xs font-medium uppercase tracking-wide text-indigo-600">
{{ t('chat.shippingOrderReview.llmSuggestion.aiSuggestion') }}
</p>
<p class="mt-2 text-sm font-semibold text-slate-900">{{ suggestedValue }}</p>
<p class="mt-1 text-xs" :class="verbatimOk ? 'text-emerald-700' : 'text-amber-700'">
{{
verbatimOk
? t('chat.shippingOrderReview.llmSuggestion.verbatimOk')
: t('chat.shippingOrderReview.llmSuggestion.verbatimFailed')
}}
</p>
</div>
<div class="rounded-lg border border-slate-200 bg-white p-3">
<p class="text-xs font-medium uppercase tracking-wide text-slate-500">
{{ t('chat.shippingOrderReview.llmSuggestion.sourceEvidence') }}
</p>
<p class="mt-2 text-sm text-slate-800">{{ evidenceQuote }}</p>
<p class="mt-1 text-xs text-slate-500">{{ evidenceLocation }}</p>
</div>
</div>
</template>