refactor(shipping-notice): 重构货代发货通知状态管理,移除废弃的process_status字段

统一货代发货通知的业务阶段为四个标准阶段:接收解析、订单复核、发货准备、上传完成
设置 ui_state 为前端唯一状态数据源,不再依赖 process_status 驱动业务流程
删除 shipping_notices 表的废弃 process_status 列及对应复合索引,新增数据库迁移脚本
替换全栈代码中所有对 process_status 的引用为生命周期、上传状态等领域字段
更新相关文档、测试用例与前端展示逻辑适配新的状态管理规则
This commit is contained in:
hugo committed 2026-08-15 10:19:10 +08:00
1 parent 6684e7181a
commit 5ef8329bd8
178 files changed
+5091 -1734

No files matched your search

@@ -2,7 +2,7 @@
* features/chat/components/shipping/ShippingOrderExtractionCard.vue
* 用途:聊天主区「订单识别任务」摘要卡——标题、文件数+状态、一行 handling 摘要、唯一主 CTA、查看详情。
* 依赖:订单抽取 Run 状态卡 DTO、shipping.api 文档/进度接口、ShippingOrderExtractionDetailsDrawer、vue-router、vue-i18n。
* 逻辑:对话区只做任务摘要;长进度/Gate/刷新取消由右侧栏承接;详情抽屉仅由次要「查看详情」打开。
* 逻辑:对话区默认展示状态-EML 聚合;批次工作台打开后切换为紧凑摘要,长进度/Gate/刷新取消由工作台承接。
*/
<script setup lang="ts">
import { computed, inject, ref, watch } from 'vue';
@@ -38,12 +38,15 @@ const props = defineProps<{
readonlyReason?: string | null;
/** 可选统一投影;摘要卡不再渲染进度,仅保留 prop 兼容宿主。 */
processingProjection?: ShippingProcessingProjection | null;
/** 批次工作台打开时,左侧只保留摘要,避免与工作台重复展示文件明细。 */
compactProgress?: boolean;
}>();
const emit = defineEmits<{
retry: [];
refresh: [];
cancel: [reason?: string];
'open-batch-workbench': [];
}>();
const { t, te } = useI18n();
@@ -52,7 +55,14 @@ const router = useRouter();
const shippingWorkflow = inject(SHIPPING_WORKFLOW_KEY, null);
type ConversationStatusGroups = NonNullable<import('../../types/shipping.api.types').ConversationProcessingProjection['status_groups']>;
const conversationStatusGroups = computed<ConversationStatusGroups | null>(() => ((shippingWorkflow as { processing?: { value?: { status_groups?: ConversationStatusGroups | null } | null } } | null)?.processing?.value?.status_groups || null));
type ConversationProcessing = import('../../types/shipping.api.types').ConversationProcessingProjection;
const conversationProcessing = computed<ConversationProcessing | null>(() => (
(shippingWorkflow as { processing?: { value?: ConversationProcessing | null } | null } | null)?.processing?.value || null
));
const conversationProjectionLoading = computed(() => Boolean(
(shippingWorkflow as { initialLoading?: { value?: boolean } | null } | null)?.initialLoading?.value,
));
const conversationStatusGroups = computed<ConversationStatusGroups | null>(() => conversationProcessing.value?.status_groups || null);
const hasConversationStatusGroups = computed(() => Boolean(conversationStatusGroups.value));
const statusGroupDefs = [
{ key: 'failed', label: 'chat.shippingProcessing.groupFailed' },
@@ -83,6 +93,9 @@ function toggleEmlTask(taskNo: string) {
}
function taskChildren(task: { aggregateChildren?: ShippingProcessingProjection[]; user_task_no?: string | null; aggregateSummary?: { intakeNo?: string | null } | null }) {
if (task.aggregateChildren?.length) return task.aggregateChildren;
// [AUTHORITY] 新会话投影必须自带 EML 子文件;不能从 Run 快照或另一份 work_items 补齐,
// 否则左右面板会出现不同文件数、不同状态的同一封邮件。
if (hasConversationStatusGroups.value) return [];
const projection = statusTaskProjection(task);
if (!projection) return [];
if (projection?.aggregateChildren?.length) return projection.aggregateChildren;
@@ -147,36 +160,55 @@ function taskChildren(task: { aggregateChildren?: ShippingProcessingProjection[]
} as ShippingProcessingProjection));
}
function taskFileCount(task: { aggregateChildren?: ShippingProcessingProjection[]; file_count?: number | null; aggregateSummary?: { intakeNo?: string | null } | null }) {
const children = taskChildren(task);
// EML 是来源容器;统一只计其附件,避免聊天卡与批次中心相差一份 EML 本体。
const children = taskChildren(task).filter((child) => !String(
child.sourceSummary?.filename || '',
).trim().toLowerCase().endsWith('.eml'));
if (children.length) {
const ids = new Set(children.map((child) => String(child.sourceSummary?.documentId || child.workItemNo || '').trim()).filter(Boolean));
return ids.size || children.length;
}
if (hasConversationStatusGroups.value) return Math.max(0, Number(task.file_count || 0));
const projection = statusTaskProjection(task);
const sourceCount = Number(projection?.sourceSummary?.documentCount || 0);
return sourceCount > 0 ? sourceCount : Math.max(0, Number(task.file_count || 0));
}
function childStatusLabel(child: ShippingProcessingProjection) {
const status = String(child.userStatus || child.status || '').toLowerCase();
const status = displayProjectionStatus(child);
if (status === 'completed' && child.facts?.uploadState === 'succeeded') return t('chat.shippingProcessing.aggregate.completed', { count: 1 });
if (status === 'failed' || status === 'retryable') return t('chat.shippingProcessing.aggregate.failed', { count: 1 });
if (status === 'waiting_human') return t('chat.shippingProcessing.aggregate.needsAction', { count: 1 });
return t('chat.shippingProcessing.aggregate.processing', { count: 1 });
}
function userReasonLabel(code?: string | null) {
const key = String(code || '').trim();
const messages: Record<string, string> = {
'SHIPPING_NOTICE.CANDIDATE_REVIEW_REQUIRED': '识别结果需要人工确认,请进入订单处理继续。',
'generic_extraction_disabled': '当前文件暂不支持自动解析,请人工处理或更换文件。',
'SHIPPING_NOTICE.INTAKE_PARSE_FAILED': '邮件或附件解析失败,请检查文件后重试。',
'upload_rpa_failed': '上传货代系统失败,请稍后重试。',
};
return messages[key] || (key ? '文件处理需要人工确认,请进入订单处理查看。' : '');
function displayReason(
reason?: import('../../types/shipping.api.types').ShippingProcessingBlockingReason | null,
) {
if (!reason) return '';
const key = String(reason.i18nKey || '').trim();
if (key && te(key)) return t(key);
return String(reason.code || '').trim();
}
/** 新投影有 ui_state 时严格消费其状态;旧响应才回退 userStatus / status。 */
function displayProjectionStatus(item: ShippingProcessingProjection): string {
return String(item.uiState
? item.uiState.status
: (item.userStatus || item.status || '')).trim().toLowerCase();
}
function isFailedProjection(item: ShippingProcessingProjection): boolean {
const status = displayProjectionStatus(item);
return status === 'failed' || status === 'retryable';
}
function isWaitingProjection(item: ShippingProcessingProjection): boolean {
return displayProjectionStatus(item) === 'waiting_human';
}
function isCompletedProjection(item: ShippingProcessingProjection): boolean {
return displayProjectionStatus(item) === 'completed' && item.facts?.uploadState === 'succeeded';
}
function taskReason(task: { uiState?: { blocking_reason: import('../../types/shipping.api.types').ShippingProcessingBlockingReason | null }; blockingReason?: import('../../types/shipping.api.types').ShippingProcessingBlockingReason | null }) {
return task.uiState ? task.uiState.blocking_reason : task.blockingReason;
}
function childStageLabel(child: ShippingProcessingProjection) {
const stage = String(child.userStage || child.stage || '').trim();
if (stage === 'review_required' || stage === 'waiting_review') return '等待人工复核';
if (stage === 'failed' || stage === 'parse_failed') return '处理失败';
const stage = String(child.uiState?.stage || child.userStage || child.stage || '').trim();
const key = shippingProcessingStageKey(stage);
return te(key) ? t(key) : stage;
}
@@ -229,16 +261,22 @@ const lastMatchedEmlAggregate = ref<ShippingProcessingProjection | null>(null);
watch(matchedEmlAggregate, (item) => {
if (item) lastMatchedEmlAggregate.value = item;
}, { immediate: true });
const emlAggregate = computed(() => matchedEmlAggregate.value || lastMatchedEmlAggregate.value);
const emlAggregate = computed(() => (
// [AUTHORITY] 切换会话时先等待该会话的统一投影,禁止旧聊天消息 Run 快照抢占首屏;
// 请求完成后仍只消费后端 Projection,失败则保留既有兼容摘要。
hasConversationStatusGroups.value || conversationProjectionLoading.value
? null
: (matchedEmlAggregate.value || lastMatchedEmlAggregate.value)
));
const emlAggregateChildren = computed(() => emlAggregate.value?.aggregateChildren || []);
const emlAggregateExpanded = ref(false);
function aggregateStageLabel(item: ShippingProcessingProjection): string {
const stage = String(item.userStage || item.stage || '').trim();
const stage = String(item.uiState ? item.uiState.stage : (item.userStage || item.stage || '')).trim();
const key = shippingProcessingStageKey(stage);
return te(key) ? t(key) : stage;
}
function aggregateChildStatusLabel(item: ShippingProcessingProjection): string {
const status = String(item.userStatus || item.status || '').trim().toLowerCase();
const status = displayProjectionStatus(item);
if (status === 'completed' && item.facts?.uploadState === 'succeeded') return t('chat.shippingProcessing.aggregate.completed', { count: 1 });
if (status === 'failed' || status === 'retryable') return t('chat.shippingProcessing.aggregate.failed', { count: 1 });
if (status === 'waiting_human') return t('chat.shippingProcessing.aggregate.needsAction', { count: 1 });
@@ -315,14 +353,30 @@ const failedRows = computed(() => fileRows.value.filter((row) => (
&& !candidateEmailUnitIds.value.has(row.unitId)
&& !emailRows.value.some((email) => childRows(email).some((child) => child.unitId === row.unitId))
)));
const processedCount = computed(() => emlAggregate.value?.aggregateSummary?.completed
?? (props.state.summary.completedDocuments + props.state.summary.reviewRequiredDocuments));
const processedCount = computed(() => {
if (hasConversationStatusGroups.value) {
const summary = conversationProcessing.value?.summary;
return Math.max(0, Number(summary?.completed_files || 0))
+ Math.max(0, Number(summary?.waiting_human_files || 0))
+ Math.max(0, Number(summary?.failed_files || 0));
}
return emlAggregate.value?.aggregateSummary?.completed
?? (props.state.summary.completedDocuments + props.state.summary.reviewRequiredDocuments);
});
const progressPercent = computed(() => {
const total = Math.max(0, props.state.summary.totalDocuments);
const total = batchFileCount.value;
return total > 0 ? Math.min(100, Math.round((processedCount.value / total) * 100)) : 0;
});
const completedExpanded = ref(false);
/** 新版会话批次的业务文件数由后端汇总;旧 Run 卡仍保留历史兼容计数。 */
const batchFileCount = computed(() => {
if (hasConversationStatusGroups.value) {
return Math.max(0, Number(conversationProcessing.value?.summary.total_files || 0));
}
return Math.max(0, Number(emlAggregate.value?.sourceSummary.documentCount ?? props.state.summary.totalDocuments));
});
/**
* 是否为「仅重复关联已有任务、无需人工复核」终态通知。
*/
@@ -384,6 +438,13 @@ function handlingTitle(item: ShippingOrderExtractionHandlingItemState): string {
* 状态短句:排队/处理中仅「系统处理中」;其余用过程通知,不含文件阶段耗时。
*/
const statusNotice = computed(() => {
if (hasConversationStatusGroups.value) {
const status = String(conversationProcessing.value?.ui_state?.status || '').trim().toLowerCase();
if (status === 'completed') return t('chat.shippingSessionSummary.processNoticeCompleted');
if (status === 'failed' || status === 'retryable') return t('chat.shippingSessionSummary.processNoticeFailed');
if (status === 'waiting_human') return t('chat.shippingSessionSummary.processNoticeNeedsAction');
return t('chat.shippingProcessing.systemProcessing');
}
if (emlAggregate.value) {
const status = String(emlAggregate.value.userStatus || '').trim().toLowerCase();
if (status === 'completed') return t('chat.shippingSessionSummary.processNoticeCompleted');
@@ -612,19 +673,36 @@ async function onPrimaryChatAction() {
<template>
<div
v-if="conversationProjectionLoading"
class="mb-3 animate-pulse overflow-hidden rounded-xl border border-slate-200 bg-white/90 shadow-md dark:border-slate-700 dark:bg-slate-900/90"
data-testid="shipping-order-extraction-projection-loading"
>
<!-- 读取权威 Projection 不是业务状态;只显示结构骨架,避免伪造“系统处理中”。 -->
<div class="border-b border-slate-200 bg-indigo-50/70 px-5 py-4 dark:border-slate-700 dark:bg-indigo-950/30">
<div class="h-6 w-36 rounded bg-slate-200 dark:bg-slate-700" />
<div class="mt-3 h-4 w-2/3 rounded bg-slate-200 dark:bg-slate-700" />
<div class="mt-5 h-2 w-full rounded bg-slate-200 dark:bg-slate-700" />
</div>
<div class="space-y-3 p-4">
<div class="h-12 rounded-lg bg-slate-100 dark:bg-slate-800" />
<div class="h-12 rounded-lg bg-slate-100 dark:bg-slate-800" />
</div>
</div>
<div
v-else
class="mb-3 overflow-hidden rounded-xl border border-slate-200 bg-white/90 text-slate-900 shadow-md backdrop-blur-sm dark:border-slate-700 dark:bg-slate-900/90 dark:text-slate-100"
data-testid="shipping-order-extraction-card"
>
<div class="border-b border-slate-200 bg-indigo-50/70 px-5 py-4 dark:border-slate-700 dark:bg-indigo-950/30">
<div class="flex items-center justify-between gap-3">
<div class="flex items-center gap-2 text-lg font-semibold">
<LoaderCircle v-if="emlAggregate ? emlAggregate.userStatus === 'running' : state.status === 'queued' || state.status === 'processing'" class="h-5 w-5 animate-spin text-blue-600" />
<CheckCircle2 v-else-if="emlAggregate ? emlAggregate.userStatus === 'completed' && emlAggregate.facts?.uploadState === 'succeeded' : state.status === 'completed'" class="h-5 w-5 text-emerald-500" />
<LoaderCircle v-if="hasConversationStatusGroups ? conversationProcessing?.ui_state?.status === 'running' : emlAggregate ? emlAggregate.userStatus === 'running' : state.status === 'queued' || state.status === 'processing'" class="h-5 w-5 animate-spin text-blue-600" />
<CheckCircle2 v-else-if="hasConversationStatusGroups ? conversationProcessing?.ui_state?.status === 'completed' : emlAggregate ? emlAggregate.userStatus === 'completed' && emlAggregate.facts?.uploadState === 'succeeded' : state.status === 'completed'" class="h-5 w-5 text-emerald-500" />
<TriangleAlert v-else class="h-5 w-5 text-amber-500" />
<span>{{ t('chat.shippingProcessing.multiPdfTaskTitle') }}</span>
</div>
<span class="rounded-full bg-slate-200 px-3 py-1 text-xs font-medium text-slate-600 dark:bg-slate-700 dark:text-slate-200">
{{ t('chat.shippingProcessing.batchFilesTotal', { count: emlAggregate?.sourceSummary.documentCount ?? state.summary.totalDocuments }) }}
{{ t('chat.shippingProcessing.batchFilesTotal', { count: batchFileCount }) }}
</span>
</div>
<p class="mt-1 text-sm text-slate-600 dark:text-slate-300">{{ t('chat.shippingProcessing.batchStatusTitle') }} · {{ statusNotice }}</p>
@@ -632,14 +710,14 @@ async function onPrimaryChatAction() {
<div v-if="handlingSummaryLine" class="mt-1 text-sm text-slate-600 dark:text-slate-300">{{ handlingSummaryLine }}</div>
<div class="mt-4 flex items-end justify-between">
<span class="text-lg font-medium text-blue-600">{{ progressPercent }}% {{ t('chat.shippingProcessing.batchComplete') }}</span>
<span class="text-sm text-slate-600 dark:text-slate-300">{{ processedCount }}/{{ emlAggregate?.sourceSummary.documentCount ?? state.summary.totalDocuments }} {{ t('chat.shippingProcessing.batchProcessed') }}</span>
<span class="text-sm text-slate-600 dark:text-slate-300">{{ processedCount }}/{{ batchFileCount }} {{ t('chat.shippingProcessing.batchProcessed') }}</span>
</div>
<div class="mt-3 h-2 overflow-hidden rounded-full bg-slate-200 dark:bg-slate-700">
<div class="h-full rounded-full bg-blue-600 transition-all" :style="{ width: `${progressPercent}%` }" />
</div>
</div>
<div v-if="hasConversationStatusGroups" class="flex flex-col gap-2 bg-slate-50 p-2 dark:bg-slate-950/30" data-testid="shipping-order-extraction-status-groups">
<div v-if="hasConversationStatusGroups && !compactProgress" class="flex flex-col gap-2 bg-slate-50 p-2 dark:bg-slate-950/30" data-testid="shipping-order-extraction-status-groups">
<template v-for="group in statusGroupDefs" :key="group.key">
<section v-if="statusGroupTasks(group.key).length" class="overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-slate-700 dark:bg-slate-900">
<button type="button" class="flex w-full items-center justify-between px-3 py-3 text-left" @click="toggleStatusGroup(group.key)">
@@ -652,19 +730,19 @@ async function onPrimaryChatAction() {
<Mail class="mt-0.5 h-4 w-4 text-blue-600" />
<div class="min-w-0 flex-1">
<button type="button" class="flex w-full items-center justify-between gap-2 text-left" @click="toggleEmlTask(task.user_task_no)">
<span class="truncate text-sm font-medium">{{ statusTaskProjection(task)?.sourceSummary?.filename || task.title || task.user_task_no }}</span>
<span class="truncate text-sm font-medium">{{ task.title || task.user_task_no }}</span>
<ChevronDown class="h-4 w-4 shrink-0 transition-transform" :class="expandedEmlTasks.has(task.user_task_no) ? 'rotate-180' : ''" />
</button>
<div class="mt-1 text-xs text-slate-500">{{ t('chat.shippingProcessing.taskFiles', { count: taskFileCount(task) }) }}<span v-if="task.aggregateSummary"> · {{ aggregateStatusLabelFromSummary(task.aggregateSummary) }}</span></div>
<div v-if="task.blockingReason?.code" class="mt-1 text-xs text-rose-600">{{ userReasonLabel(task.blockingReason.code) }}</div>
<div v-if="taskReason(task)" class="mt-1 text-xs text-rose-600">{{ displayReason(taskReason(task)) }}</div>
<div v-if="expandedEmlTasks.has(task.user_task_no)" class="mt-2 space-y-1 border-t border-slate-200 pt-2 dark:border-slate-700" data-testid="shipping-order-extraction-eml-children">
<div v-for="child in taskChildren(task)" :key="child.workItemNo" class="flex items-start justify-between gap-3 rounded-md bg-white px-2 py-1.5 text-xs dark:bg-slate-900">
<div v-for="child in taskChildren(task).filter((item) => !String(item.sourceSummary?.filename || '').toLowerCase().endsWith('.eml'))" :key="child.workItemNo" class="flex items-start justify-between gap-3 rounded-md bg-white px-2 py-1.5 text-xs dark:bg-slate-900">
<div class="min-w-0">
<div class="truncate font-medium">{{ child.sourceSummary.filename || child.workItemNo }}</div>
<div class="text-[11px] text-slate-500">{{ childStageLabel(child) }}</div>
<div v-if="child.blockingReason?.code || child.sourceSummary?.failureReasonCode" class="text-[11px] text-rose-600">{{ userReasonLabel(child.blockingReason?.code || child.sourceSummary?.failureReasonCode) }}</div>
<div v-if="taskReason(child)" class="text-[11px] text-rose-600">{{ displayReason(taskReason(child)) }}</div>
</div>
<span class="shrink-0" :class="child.userStatus === 'failed' || child.userStatus === 'retryable' ? 'text-rose-600' : child.userStatus === 'waiting_human' ? 'text-amber-700' : child.userStatus === 'completed' && child.facts?.uploadState === 'succeeded' ? 'text-emerald-600' : 'text-blue-600'">{{ childStatusLabel(child) }}</span>
<span :data-testid="`shipping-order-extraction-child-status-${child.workItemNo}`" class="shrink-0" :class="isFailedProjection(child) ? 'text-rose-600' : isWaitingProjection(child) ? 'text-amber-700' : isCompletedProjection(child) ? 'text-emerald-600' : 'text-blue-600'">{{ childStatusLabel(child) }}</span>
</div>
</div>
</div>
@@ -674,7 +752,7 @@ async function onPrimaryChatAction() {
</section>
</template>
</div>
<div v-else-if="emlAggregate" class="flex flex-col gap-2 bg-slate-50 p-2 dark:bg-slate-950/30" data-testid="shipping-order-extraction-eml-aggregate">
<div v-else-if="!compactProgress && emlAggregate" class="flex flex-col gap-2 bg-slate-50 p-2 dark:bg-slate-950/30" data-testid="shipping-order-extraction-eml-aggregate">
<article class="overflow-hidden rounded-lg border border-slate-300 bg-white shadow-sm dark:border-slate-700 dark:bg-slate-900">
<div class="flex items-start gap-3 border-b border-slate-200 bg-blue-50/50 p-3 dark:border-slate-700 dark:bg-blue-950/20">
<Mail class="mt-0.5 h-5 w-5 text-blue-600" />
@@ -686,7 +764,7 @@ async function onPrimaryChatAction() {
</span>
</div>
<div class="mt-1 text-xs text-slate-600 dark:text-slate-300">{{ aggregateSummaryLabel(emlAggregate) }}</div>
<div v-if="emlAggregate.blockingReason?.code" class="mt-1 text-xs text-rose-600">{{ userReasonLabel(emlAggregate.blockingReason.code) }}</div>
<div v-if="taskReason(emlAggregate)" class="mt-1 text-xs text-rose-600">{{ displayReason(taskReason(emlAggregate)) }}</div>
</div>
</div>
<button type="button" class="flex w-full items-center justify-between px-3 py-2 text-left text-sm" @click="emlAggregateExpanded = !emlAggregateExpanded">
@@ -696,12 +774,12 @@ async function onPrimaryChatAction() {
<div v-if="emlAggregateExpanded" class="space-y-1 border-t border-slate-200 px-3 py-2 dark:border-slate-700">
<div v-for="child in emlAggregateChildren" :key="child.workItemNo" class="flex items-center justify-between gap-3 py-1 text-sm">
<span class="min-w-0 truncate">{{ child.sourceSummary.filename || child.workItemNo }}</span>
<span class="shrink-0 text-xs" :class="child.userStatus === 'failed' || child.userStatus === 'retryable' ? 'text-rose-600' : child.userStatus === 'waiting_human' ? 'text-amber-700' : child.userStatus === 'completed' && child.facts?.uploadState === 'succeeded' ? 'text-emerald-600' : 'text-blue-600'">{{ aggregateChildStatusLabel(child) }} · {{ aggregateStageLabel(child) }}</span>
<span class="shrink-0 text-xs" :class="isFailedProjection(child) ? 'text-rose-600' : isWaitingProjection(child) ? 'text-amber-700' : isCompletedProjection(child) ? 'text-emerald-600' : 'text-blue-600'">{{ aggregateChildStatusLabel(child) }} · {{ aggregateStageLabel(child) }}</span>
</div>
</div>
</article>
</div>
<div v-else class="flex flex-col gap-2 bg-slate-50 p-2 dark:bg-slate-950/30">
<div v-else-if="!compactProgress" class="flex flex-col gap-2 bg-slate-50 p-2 dark:bg-slate-950/30">
<button type="button" class="flex items-center justify-between rounded-lg border border-slate-200 bg-white px-3 py-3 text-left dark:border-slate-700 dark:bg-slate-900" @click="completedExpanded = !completedExpanded">
<span class="flex items-center gap-3 text-base font-medium"><span class="flex h-7 w-7 items-center justify-center rounded-full bg-blue-100 text-blue-600"><CheckCircle2 class="h-4 w-4" /></span>{{ t('chat.shippingProcessing.candidateFiles', { count: candidateFileCount }) }}</span>
<ChevronDown class="h-5 w-5 transition-transform" :class="completedExpanded ? 'rotate-180' : ''" />
@@ -726,8 +804,16 @@ async function onPrimaryChatAction() {
<div class="flex justify-end border-t border-slate-200 bg-indigo-50/60 p-3 dark:border-slate-700 dark:bg-indigo-950/20">
<div class="flex items-center gap-3">
<button v-if="primaryChatAction" type="button" class="inline-flex items-center gap-2 rounded-lg bg-blue-600 px-5 py-2.5 text-sm font-medium text-white shadow-sm hover:bg-blue-700 disabled:opacity-50" data-testid="shipping-order-extraction-primary-action" :disabled="primaryChatAction.kind === 'retry' && retrying" @click="onPrimaryChatAction">{{ primaryChatAction.kind === 'retry' && retrying ? t('chat.shippingOrderExtractionRetrying') : primaryChatAction.label }}<ArrowRight class="h-4 w-4" /></button>
<button v-if="String(props.runNo || '').trim()" type="button" class="text-sm font-medium text-blue-600 underline-offset-2 hover:underline" data-testid="shipping-order-extraction-view-details" @click="openDetailsDrawer">{{ t('chat.shippingProcessing.viewTaskDetails') }}</button>
<button
v-if="!compactProgress && (hasConversationStatusGroups || String(props.runNo || '').trim())"
type="button"
class="inline-flex items-center gap-2 rounded-lg bg-blue-600 px-5 py-2.5 text-sm font-medium text-white shadow-sm hover:bg-blue-700"
data-testid="shipping-order-extraction-open-batch-workbench"
@click="emit('open-batch-workbench')"
>
{{ t('chat.shippingProcessing.openBatchWorkbench') }}
<ArrowRight class="h-4 w-4" />
</button>
</div>
</div>
<div v-if="false" class="flex items-start gap-3">