feat(shipping-notice): 新增发货通知自动上传功能与候选资格评估

- 在环境配置中新增 SHIPPING_NOTICE_AUTO_UPLOAD_ENABLED 选项,默认关闭,需显式开启以支持自动上传。
- 引入新的 pytest.ini 文件,增加测试标记以支持自动化测试。
- 删除不再使用的 seed_shipping_notice_agents.py 文件,简化代码库。
- 更新相关 API,增强发货通知与候选资格评估功能,支持多种筛选条件。
- 增强文档与代码注释,反映新的业务逻辑与功能要求。
This commit is contained in:
hugo committed 2026-08-02 19:26:35 +08:00
1 parent cef3d5b26a
commit 3a9fbac2fc
226 files changed
+25010 -2098

No files matched your search

@@ -0,0 +1,124 @@
<!--
features/chat/components/shipping-review/ReviewProfileMatchPanel.vue
用途:复核工作台文档模板匹配只读区(选中模板 / 候选分 / 回退原因)。
依赖:vue-i18n、ShippingOrderReviewProfileMatch。
逻辑:A3 只展示;换模板/重抽取仍走 Process Gate 或重新识别 PDF。
-->
<script setup lang="ts">
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import type { ShippingOrderReviewProfileMatch } from '@/features/chat/types/shipping.api.types';
const props = defineProps<{
profileMatch: ShippingOrderReviewProfileMatch | null | undefined;
}>();
const { t, te } = useI18n();
const visible = computed(() => Boolean(props.profileMatch?.available));
const needsReview = computed(() => Boolean(props.profileMatch?.needs_review));
/**
* 匹配状态本地化。
*/
const statusLabel = computed(() => {
const status = String(props.profileMatch?.status || '').trim();
const key = `chat.shippingOrderReview.profileMatch.status.${status}`;
return status && te(key) ? t(key) : (status || '—');
});
/**
* 选中模板展示名。
*/
const selectedLabel = computed(() => {
const selected = props.profileMatch?.selected_profile;
if (!selected?.profile_code) {
return t('chat.shippingOrderReview.profileMatch.noSelected');
}
const name = String(selected.display_name || selected.profile_code).trim();
const version = selected.version != null ? ` v${selected.version}` : '';
return `${name}${version}`;
});
/**
* 回退原因本地化列表。
*/
const fallbackLabels = computed(() =>
(props.profileMatch?.fallback_reason_codes || []).map((code) => {
const key = `chat.shippingOrderReview.profileMatch.reasons.${code}`;
return te(key) ? t(key) : code;
}),
);
</script>
<template>
<section
v-if="visible"
class="rounded-xl border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-800 dark:bg-slate-900"
data-testid="review-profile-match-panel"
>
<header class="flex flex-wrap items-start justify-between gap-2">
<div>
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.profileMatch.title') }}</h2>
<p class="mt-0.5 text-xs text-muted">{{ t('chat.shippingOrderReview.profileMatch.subtitle') }}</p>
</div>
<span
class="rounded-full px-2.5 py-1 text-xs font-medium"
:class="needsReview
? 'bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-100'
: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-100'"
data-testid="review-profile-match-badge"
>
{{ statusLabel }}
</span>
</header>
<dl class="mt-2 space-y-1 text-xs text-secondary">
<div class="flex flex-wrap gap-x-2">
<dt class="text-muted">{{ t('chat.shippingOrderReview.profileMatch.selected') }}</dt>
<dd class="font-medium text-primary" data-testid="review-profile-match-selected">{{ selectedLabel }}</dd>
</div>
<div v-if="profileMatch?.route_type" class="flex flex-wrap gap-x-2">
<dt class="text-muted">{{ t('chat.shippingOrderReview.profileMatch.routeType') }}</dt>
<dd class="font-mono">{{ profileMatch.route_type }}</dd>
</div>
<div v-if="profileMatch?.execution_mode" class="flex flex-wrap gap-x-2">
<dt class="text-muted">{{ t('chat.shippingOrderReview.profileMatch.executionMode') }}</dt>
<dd class="font-mono">{{ profileMatch.execution_mode }}</dd>
</div>
</dl>
<ul
v-if="(profileMatch?.candidates || []).length"
class="mt-2 space-y-1.5"
data-testid="review-profile-match-candidates"
>
<li
v-for="(item, idx) in profileMatch?.candidates || []"
:key="`${item.profile_code}-${item.version}-${idx}`"
class="rounded-lg border border-default bg-surface-soft px-2.5 py-1.5 text-[11px] text-secondary"
>
<div class="flex flex-wrap items-center justify-between gap-2">
<span class="font-medium text-primary">
{{ item.display_name || item.profile_code }}
<span v-if="item.version != null" class="text-muted">v{{ item.version }}</span>
</span>
<span v-if="item.score != null" class="font-mono text-muted">
{{ t('chat.shippingOrderReview.profileMatch.score', { score: Number(item.score).toFixed(2) }) }}
</span>
</div>
<p v-if="item.reason_codes?.length" class="mt-0.5 text-muted">
{{ item.reason_codes.join(', ') }}
</p>
</li>
</ul>
<ul v-if="fallbackLabels.length" class="mt-2 list-disc space-y-0.5 pl-4 text-[11px] text-amber-900 dark:text-amber-100">
<li v-for="label in fallbackLabels" :key="label">{{ label }}</li>
</ul>
<p class="mt-2 text-[11px] text-muted">
{{ t('chat.shippingOrderReview.profileMatch.reselectHint') }}
</p>
</section>
</template>