feat(chat): 更新发货任务处理逻辑和界面文本
- 移除不必要的状态引用 - 更新上传处理提示文本,使用国际化支持 - 扩展发货任务摘要接口,增加错误信息和短缺信息 - 更新多语言支持的文本,改善用户体验 - 增加批次工作区的汇总信息和操作提示
This commit is contained in:
1 parent
0b083cfdbd
commit
1fc9976ca3
60 files changed
+3876
-639
No files matched your search
@@ -8,6 +8,7 @@ import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import type {
|
||||
ShippingBatchSummary,
|
||||
ShippingChatActionsResponse,
|
||||
ShippingConversationWorkspace,
|
||||
ShippingDecisionResponse,
|
||||
ShippingInventoryUploadResponse,
|
||||
ShippingNoticeHeader,
|
||||
@@ -50,6 +51,12 @@ export const getWorkspaceShippingBatch = (batchNo: string) =>
|
||||
`/api/workspace/shipping-batches/${encodeURIComponent(batchNo)}`,
|
||||
);
|
||||
|
||||
/** 获取一个 Agent 会话下的多批次执行工作台快照。 */
|
||||
export const getWorkspaceShippingConversationBatches = (conversationId: string) =>
|
||||
getJson<ShippingConversationWorkspace>(
|
||||
`/api/workspace/shipping-conversations/${encodeURIComponent(conversationId)}/batch-workspace`,
|
||||
);
|
||||
|
||||
/** 获取指定批次当前焦点任务。 */
|
||||
export const getWorkspaceShippingBatchFocusTask = (batchNo: string) =>
|
||||
getJson<ShippingTaskSummary>(
|
||||
@@ -476,6 +483,27 @@ export async function markWorkspaceShippingManualUploaded(taskNo: string) {
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* 重试将发货 Excel 上传至货代系统。
|
||||
* @param taskNo - 发货任务编号
|
||||
* @returns RPA 上传触发或等待结果
|
||||
*/
|
||||
export async function retryWorkspaceShippingUpload(taskNo: string) {
|
||||
const res = await fetch(
|
||||
`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/retry-upload`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { ...getAuthHeaders(), 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({}),
|
||||
},
|
||||
);
|
||||
const body = (await res.json().catch(() => ({}))) as ShippingDecisionResponse & { error?: string };
|
||||
if (!res.ok || body.status === 'failed') {
|
||||
throw new Error(body.error || body.message || res.statusText);
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成发货 Excel。
|
||||
* @param taskNo - 发货任务编号
|
||||
@@ -504,6 +532,9 @@ export type {
|
||||
ShippingBatchSummary,
|
||||
ShippingChatAction,
|
||||
ShippingChatActionsResponse,
|
||||
ShippingConversationBatch,
|
||||
ShippingConversationWorkspace,
|
||||
ShippingConversationWorkspaceSummary,
|
||||
ShippingCurrentStepProgress,
|
||||
ShippingDecisionResponse,
|
||||
ShippingInventoryUploadResponse,
|
||||
|
||||
@@ -40,6 +40,8 @@ const props = defineProps<{
|
||||
canSendMessage: boolean;
|
||||
isShippingNoticeAgent: boolean;
|
||||
shippingSuggestedPrompt: string;
|
||||
shippingFocusTaskNo?: string;
|
||||
shippingFocusReason?: string;
|
||||
/** 用对象包裹 Ref,避免 template 自动解包 */
|
||||
shippingPickerRefHolder: { pickerRef: Ref<HTMLInputElement | null> };
|
||||
getKbLabel: (kb: string) => string;
|
||||
@@ -53,6 +55,7 @@ const emit = defineEmits<{
|
||||
'add-remote-url': [url: string];
|
||||
'shipping-inventory-selected': [event: Event];
|
||||
'use-shipping-suggested-prompt': [];
|
||||
'clear-shipping-focus': [];
|
||||
}>();
|
||||
|
||||
const filePickerRef = ref<HTMLInputElement | null>(null);
|
||||
@@ -144,10 +147,26 @@ onBeforeUnmount(() => {
|
||||
<footer class="safe-bottom sticky bottom-0 z-20 bg-transparent p-3 md:p-6">
|
||||
<div class="relative mx-auto max-w-4xl">
|
||||
<div class="flex flex-col rounded-2xl bg-surface p-2 shadow-[0_0_15px_rgba(0,0,0,0.05)] transition-all">
|
||||
<div
|
||||
v-if="isShippingNoticeAgent && shippingFocusTaskNo"
|
||||
class="mb-2 flex items-center gap-2 rounded-xl bg-brand-500 px-3 py-2 text-xs font-medium text-white"
|
||||
>
|
||||
<span class="shrink-0">{{ $t('chat.shippingNoticeUi.currentFocus') }}</span>
|
||||
<span class="rounded-md bg-white/15 px-2 py-0.5 font-mono">{{ shippingFocusTaskNo }}</span>
|
||||
<span class="min-w-0 flex-1 truncate text-white/85">{{ shippingFocusReason || $t('chat.shippingNoticeUi.currentFocusDefaultReason') }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full p-1 text-white/80 transition hover:bg-white/15 hover:text-white"
|
||||
:title="$t('chat.shippingNoticeUi.clearFocus')"
|
||||
@click="emit('clear-shipping-focus')"
|
||||
>
|
||||
<X class="h-3.5 w-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
<textarea
|
||||
v-model="inputValue"
|
||||
rows="1"
|
||||
:placeholder="isVoiceTranscribing ? $t('chat.voiceTranscribing') : isVoiceRecording ? $t('chat.voiceListening') : $t('chat.askAnything')"
|
||||
:placeholder="isVoiceTranscribing ? $t('chat.voiceTranscribing') : isVoiceRecording ? $t('chat.voiceListening') : shippingFocusTaskNo ? $t('chat.shippingNoticeUi.focusInputPlaceholder', { taskId: shippingFocusTaskNo }) : $t('chat.askAnything')"
|
||||
class="w-full resize-none border-none bg-transparent px-3 py-2 text-[15px] leading-relaxed text-primary placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-0"
|
||||
style="min-height: 44px; max-height: 220px;"
|
||||
:disabled="isThinking || isVoiceTranscribing"
|
||||
|
||||
@@ -38,6 +38,7 @@ const {
|
||||
isMessageRunProgressLoading: (msg: ChatMessage) => boolean;
|
||||
toolRunProgress: ToolRunProgress | null;
|
||||
toolRunProgressTitle: string;
|
||||
showScrollToBottom: boolean;
|
||||
/** 供父级滚动逻辑绑定 main 元素 */
|
||||
scrollContainerHolder: { el: Ref<HTMLElement | null> };
|
||||
}>();
|
||||
@@ -49,6 +50,7 @@ const emit = defineEmits<{
|
||||
regenerate: [];
|
||||
'open-feedback': [index: number];
|
||||
'select-question': [question: string];
|
||||
'scroll-to-bottom': [];
|
||||
}>();
|
||||
|
||||
const bindScrollContainer = (node: unknown) => {
|
||||
@@ -57,52 +59,64 @@ const bindScrollContainer = (node: unknown) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main
|
||||
:ref="bindScrollContainer"
|
||||
class="flex-1 p-3 md:p-8"
|
||||
:class="messages.length === 0 ? 'overflow-hidden md:overflow-y-auto' : 'overflow-y-auto scrollbar-thin'"
|
||||
>
|
||||
<div :class="messages.length === 0 ? 'h-full' : 'flex min-h-full flex-col justify-end'">
|
||||
<ChatWelcomePanel
|
||||
v-if="messages.length === 0"
|
||||
:agent-name="agentName"
|
||||
:suggested-questions-style="suggestedQuestionsStyle"
|
||||
:styled-sections="styledSections"
|
||||
:suggested-questions="suggestedQuestions"
|
||||
@select-question="emit('select-question', $event)"
|
||||
/>
|
||||
|
||||
<template v-for="(msg, index) in messages" :key="index">
|
||||
<ChatMessageBubble
|
||||
v-if="shouldRenderMessage(msg)"
|
||||
:message="msg"
|
||||
:index="index"
|
||||
:message-count="messages.length"
|
||||
:is-thinking="isThinking"
|
||||
:show-chat-rating="showChatRating"
|
||||
:copied-index="copiedIndex"
|
||||
:is-shipping-notice-agent="isShippingNoticeAgent"
|
||||
:handlers="handlers"
|
||||
:leave-handlers="leaveHandlers"
|
||||
:shipping-handlers="shippingHandlers"
|
||||
@copy="emit('copy', { message: msg, index })"
|
||||
@edit="emit('edit', $event)"
|
||||
@resend="emit('resend', $event)"
|
||||
@regenerate="emit('regenerate')"
|
||||
@open-feedback="emit('open-feedback', index)"
|
||||
<main class="relative min-h-0 flex-1">
|
||||
<div
|
||||
:ref="bindScrollContainer"
|
||||
class="h-full p-3 md:p-8"
|
||||
:class="messages.length === 0 ? 'overflow-hidden md:overflow-y-auto' : 'overflow-y-auto scrollbar-thin'"
|
||||
>
|
||||
<div :class="messages.length === 0 ? 'h-full' : 'flex min-h-full flex-col justify-end'">
|
||||
<ChatWelcomePanel
|
||||
v-if="messages.length === 0"
|
||||
:agent-name="agentName"
|
||||
:suggested-questions-style="suggestedQuestionsStyle"
|
||||
:styled-sections="styledSections"
|
||||
:suggested-questions="suggestedQuestions"
|
||||
@select-question="emit('select-question', $event)"
|
||||
/>
|
||||
<ToolRunProgressCard
|
||||
v-if="shouldRenderMessage(msg) && shouldShowToolRunProgressAfterMessage(msg, index)"
|
||||
:run="getMessageRunProgress(msg)"
|
||||
:loading="isMessageRunProgressLoading(msg)"
|
||||
:waiting="false"
|
||||
:error="getMessageRunProgressError(msg)"
|
||||
:fallback-title="toolRunProgressTitle"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<ChatThinkingBubble v-if="showThinkingBubble" />
|
||||
<div v-if="messages.length > 0" class="h-2 md:h-3" />
|
||||
<template v-for="(msg, index) in messages" :key="index">
|
||||
<ChatMessageBubble
|
||||
v-if="shouldRenderMessage(msg)"
|
||||
:message="msg"
|
||||
:index="index"
|
||||
:message-count="messages.length"
|
||||
:is-thinking="isThinking"
|
||||
:show-chat-rating="showChatRating"
|
||||
:copied-index="copiedIndex"
|
||||
:is-shipping-notice-agent="isShippingNoticeAgent"
|
||||
:handlers="handlers"
|
||||
:leave-handlers="leaveHandlers"
|
||||
:shipping-handlers="shippingHandlers"
|
||||
@copy="emit('copy', { message: msg, index })"
|
||||
@edit="emit('edit', $event)"
|
||||
@resend="emit('resend', $event)"
|
||||
@regenerate="emit('regenerate')"
|
||||
@open-feedback="emit('open-feedback', index)"
|
||||
/>
|
||||
<ToolRunProgressCard
|
||||
v-if="shouldRenderMessage(msg) && shouldShowToolRunProgressAfterMessage(msg, index)"
|
||||
:run="getMessageRunProgress(msg)"
|
||||
:loading="isMessageRunProgressLoading(msg)"
|
||||
:waiting="false"
|
||||
:error="getMessageRunProgressError(msg)"
|
||||
:fallback-title="toolRunProgressTitle"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<ChatThinkingBubble v-if="showThinkingBubble" />
|
||||
<div v-if="messages.length > 0" class="h-2 md:h-3" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
v-if="showScrollToBottom"
|
||||
type="button"
|
||||
class="absolute bottom-4 left-1/2 z-10 flex h-10 w-10 -translate-x-1/2 items-center justify-center rounded-full border border-slate-100 bg-white text-[28px] font-light leading-none text-slate-500 shadow-[0_10px_28px_rgba(15,23,42,0.16)] transition hover:-translate-y-0.5 hover:border-slate-200 hover:text-slate-700 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300 dark:shadow-black/30 md:bottom-5"
|
||||
:title="$t('chat.scrollToLatest')"
|
||||
@click="emit('scroll-to-bottom')"
|
||||
>
|
||||
<span aria-hidden="true" class="-mt-1">↓</span>
|
||||
</button>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* features/chat/components/ChatViewContent.vue
|
||||
* 用途:对话页主区域,组合侧栏、发货批次进度区、消息列表、输入栏与内置浏览器。
|
||||
* 依赖:ChatSidebar、ChatMessageList、ChatInputBar、ShippingBatchProgressPanel、chat.context。
|
||||
* 依赖:ChatSidebar、ChatMessageList、ChatInputBar、ShippingBatchProgressPanel、ShippingBatchWorkspaceDrawer、chat.context。
|
||||
* 逻辑:本文件只做页面结构编排;发货批次进度样式与任务续办交互下沉到独立面板组件。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
@@ -13,6 +13,7 @@ import ChatMessageList from '@/features/chat/components/ChatMessageList.vue';
|
||||
import ChatMobileHeader from '@/features/chat/components/ChatMobileHeader.vue';
|
||||
import ChatBrowserPanel from '@/features/chat/components/ChatBrowserPanel.vue';
|
||||
import ShippingBatchProgressPanel from '@/features/chat/components/ShippingBatchProgressPanel.vue';
|
||||
import ShippingBatchWorkspaceDrawer from '@/features/chat/components/ShippingBatchWorkspaceDrawer.vue';
|
||||
import { useChatPageContext } from '@/features/chat/composables/chat.context';
|
||||
|
||||
const page = useChatPageContext();
|
||||
@@ -85,14 +86,14 @@ const page = useChatPageContext();
|
||||
<div class="flex min-h-0 flex-1 flex-col">
|
||||
<ShippingBatchProgressPanel
|
||||
v-if="page.isShippingNoticeAgent && (page.shippingBatchSummary || page.activeShippingTaskDetail)"
|
||||
:conversation-workspace="page.shippingConversationWorkspace"
|
||||
:active-batch-no="page.activeShippingBatchNo"
|
||||
:batch-summary="page.shippingBatchSummary"
|
||||
:batch-tasks="page.shippingBatchTasks"
|
||||
:active-task-detail="page.activeShippingTaskDetail"
|
||||
:tasks-expanded="page.shippingBatchTasksExpanded"
|
||||
:inventory-selection-active="page.shippingInventorySelectionActive && page.shippingBatchTasks?.length > 1"
|
||||
@update:tasks-expanded="page.shippingBatchTasksExpanded = $event"
|
||||
@focus-task="page.switchShippingFocusTask"
|
||||
@resume-task="page.resumeShippingTask"
|
||||
:workspace-open="page.shippingWorkspaceOpen"
|
||||
@switch-batch="page.switchShippingBatch"
|
||||
@toggle-workspace="page.shippingWorkspaceOpen = !page.shippingWorkspaceOpen"
|
||||
/>
|
||||
|
||||
<ChatMessageList
|
||||
@@ -116,6 +117,7 @@ const page = useChatPageContext();
|
||||
:is-message-run-progress-loading="page.isMessageRunProgressLoading"
|
||||
:tool-run-progress="page.toolRunProgress"
|
||||
:tool-run-progress-title="page.toolRunProgressTitle"
|
||||
:show-scroll-to-bottom="page.showScrollToBottom"
|
||||
:scroll-container-holder="page.scrollContainerHolder"
|
||||
@copy="page.copyToClipboard($event.message, $event.index)"
|
||||
@edit="page.input = $event"
|
||||
@@ -123,6 +125,7 @@ const page = useChatPageContext();
|
||||
@regenerate="page.regenerate"
|
||||
@open-feedback="page.handleOpenFeedback($event)"
|
||||
@select-question="page.handleSend"
|
||||
@scroll-to-bottom="page.scrollToBottom"
|
||||
/>
|
||||
|
||||
<ChatInputBar
|
||||
@@ -139,6 +142,8 @@ const page = useChatPageContext();
|
||||
:can-send-message="page.canSendMessage"
|
||||
:is-shipping-notice-agent="page.isShippingNoticeAgent"
|
||||
:shipping-suggested-prompt="page.shippingSuggestedPrompt"
|
||||
:shipping-focus-task-no="page.focusedShippingTaskNo"
|
||||
:shipping-focus-reason="page.shippingFocusReason"
|
||||
:shipping-picker-ref-holder="page.shippingPickerRefHolder"
|
||||
:get-kb-label="page.getKbLabel"
|
||||
@send="page.handleSend()"
|
||||
@@ -148,6 +153,7 @@ const page = useChatPageContext();
|
||||
@add-remote-url="page.addRemoteUrlAttachment"
|
||||
@shipping-inventory-selected="page.handleShippingInventorySelected"
|
||||
@use-shipping-suggested-prompt="page.useShippingSuggestedPrompt"
|
||||
@clear-shipping-focus="page.clearShippingFocus"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -165,6 +171,23 @@ const page = useChatPageContext();
|
||||
@start-resize="page.browser.startResize"
|
||||
@close="page.browser.close"
|
||||
/>
|
||||
|
||||
<ShippingBatchWorkspaceDrawer
|
||||
v-if="page.isShippingNoticeAgent && (page.shippingConversationWorkspace || page.shippingBatchSummary)"
|
||||
v-model:open="page.shippingWorkspaceOpen"
|
||||
:conversation-workspace="page.shippingConversationWorkspace"
|
||||
:active-batch-no="page.activeShippingBatchNo"
|
||||
:focused-task-no="page.focusedShippingTaskNo"
|
||||
:batch-summary="page.shippingBatchSummary"
|
||||
:batch-tasks="page.shippingBatchTasks"
|
||||
:active-task-detail="page.activeShippingTaskDetail"
|
||||
:retrying-pending="page.retryingShippingPendingTasks"
|
||||
@switch-batch="page.switchShippingBatch"
|
||||
@focus-task="page.switchShippingFocusTask"
|
||||
@resume-task="page.resumeShippingTask"
|
||||
@query-shortage="page.queryShippingShortageDetails"
|
||||
@retry-pending="page.retryCurrentShippingBatchPendingTasks"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</ChatShell>
|
||||
|
||||
@@ -1,43 +1,45 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/chat/components/ShippingBatchProgressPanel.vue
|
||||
* 用途:发货通知聊天顶部批次进度卡片,按原型方案 C 展示批次概览、任务切换列表、七步进度与续办弹层。
|
||||
* 依赖:shippingStepper、shipping.api.types、vue-i18n、lucide-vue-next。
|
||||
* 逻辑:上游由 ChatViewContent 传入批次/任务状态;本组件只负责展示与抛出 focus/resume 事件,不直接请求后端。
|
||||
* 用途:发货通知聊天顶部轻量批次状态条,展示当前批次进度与工作台入口。
|
||||
* 依赖:shipping.api.types、vue-i18n、批次 retry API。
|
||||
* 逻辑:生成式执行摘要由聊天消息流承载;本组件只提供固定状态 chrome 和明确范围的批次操作。
|
||||
*/
|
||||
import { computed, ref } from 'vue';
|
||||
import { List, PlayCircle, X } from 'lucide-vue-next';
|
||||
import { List, RefreshCw } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { buildShippingWorkflowSteps, type ShippingWorkflowStepItem } from '@/features/chat/shipping';
|
||||
import { retryWorkspaceShippingBatchPending } from '@/features/chat/api/shipping.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type {
|
||||
ShippingBatchSummary,
|
||||
ShippingConversationWorkspace,
|
||||
ShippingTaskDetail,
|
||||
ShippingTaskSummary,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
|
||||
const props = defineProps<{
|
||||
conversationWorkspace: ShippingConversationWorkspace | null;
|
||||
activeBatchNo: string;
|
||||
batchSummary: ShippingBatchSummary | null;
|
||||
batchTasks: ShippingTaskSummary[];
|
||||
activeTaskDetail: ShippingTaskDetail | null;
|
||||
tasksExpanded: boolean;
|
||||
inventorySelectionActive: boolean;
|
||||
workspaceOpen: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:tasksExpanded': [value: boolean];
|
||||
'focus-task': [taskNo: string];
|
||||
'resume-task': [taskNo: string];
|
||||
'switch-batch': [batchNo: string];
|
||||
'toggle-workspace': [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
const showTaskDialog = ref(false);
|
||||
const retryingPending = ref(false);
|
||||
|
||||
const COMPLETED_PROCESS_STATUSES = new Set(['uploaded', 'closed']);
|
||||
const CIRCLED_NUMBERS = ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨'];
|
||||
const workspaceBatches = computed(() => props.conversationWorkspace?.batches || []);
|
||||
const activeBatchNo = computed(() =>
|
||||
String(props.activeBatchNo || props.batchSummary?.batch_no || workspaceBatches.value[0]?.batch_no || '').trim(),
|
||||
);
|
||||
|
||||
const processSummary = computed(() => {
|
||||
const summary = props.batchSummary?.process_summary || null;
|
||||
@@ -55,121 +57,36 @@ const processSummary = computed(() => {
|
||||
return { total, completed, running, pending };
|
||||
});
|
||||
|
||||
const currentTask = computed<ShippingTaskSummary | ShippingTaskDetail | null>(() => {
|
||||
const focusTaskNo = String(props.batchSummary?.current_focus_task_no || '').trim().toUpperCase();
|
||||
if (focusTaskNo) {
|
||||
return props.batchTasks.find((task) => String(task.task_no || '').trim().toUpperCase() === focusTaskNo)
|
||||
|| props.activeTaskDetail
|
||||
|| null;
|
||||
}
|
||||
return props.activeTaskDetail || props.batchTasks[0] || null;
|
||||
const abnormalCount = computed(() => {
|
||||
const batchSummary = props.batchSummary?.process_summary || {};
|
||||
return Number(batchSummary.failed || 0) + Number((batchSummary as { needs_human?: number }).needs_human || 0);
|
||||
});
|
||||
|
||||
const currentTaskNo = computed(() => String(currentTask.value?.task_no || '').trim().toUpperCase());
|
||||
const currentTaskName = computed(() =>
|
||||
String(
|
||||
currentTask.value?.source_file_name
|
||||
|| currentTask.value?.customer_name
|
||||
|| t('chat.shippingNoticeUi.currentNotice'),
|
||||
).trim(),
|
||||
const progressPercent = computed(() =>
|
||||
processSummary.value.total
|
||||
? Math.round((processSummary.value.completed / processSummary.value.total) * 100)
|
||||
: 0,
|
||||
);
|
||||
const currentTaskIndex = computed(() =>
|
||||
Number(
|
||||
currentTask.value?.batch_index
|
||||
|| props.batchSummary?.process_summary?.current_index
|
||||
|| 0,
|
||||
),
|
||||
);
|
||||
const currentTaskTotal = computed(() =>
|
||||
Number(
|
||||
currentTask.value?.batch_total
|
||||
|| props.batchSummary?.file_count
|
||||
|| processSummary.value.total
|
||||
|| 0,
|
||||
),
|
||||
);
|
||||
const currentSteps = computed(() => buildShippingWorkflowSteps(currentTask.value));
|
||||
|
||||
const resolveActiveStep = (steps: ShippingWorkflowStepItem[]) =>
|
||||
steps.findIndex((step) => step.status === 'current' || step.status === 'blocked');
|
||||
|
||||
const currentStepMeta = computed(() => {
|
||||
const steps = currentSteps.value;
|
||||
if (!steps.length) return { index: 0, label: t('chat.shippingNoticeUi.processing') };
|
||||
const activeIndex = resolveActiveStep(steps);
|
||||
const safeIndex = activeIndex >= 0 ? activeIndex : steps.length - 1;
|
||||
const executionStateMeta = computed(() => {
|
||||
if (abnormalCount.value > 0) {
|
||||
return {
|
||||
text: t('chat.shippingNoticeUi.needsIntervention'),
|
||||
className: 'border-amber-100 bg-amber-50 text-amber-700',
|
||||
};
|
||||
}
|
||||
if (processSummary.value.running > 0 || processSummary.value.pending > 0) {
|
||||
return {
|
||||
text: t('chat.shippingNoticeUi.runningState'),
|
||||
className: 'border-sky-100 bg-sky-50 text-brand-700',
|
||||
};
|
||||
}
|
||||
return {
|
||||
index: safeIndex + 1,
|
||||
label: t(steps[safeIndex]?.label || 'chat.shippingNoticeUi.processing'),
|
||||
text: t('chat.shippingNoticeUi.completedState'),
|
||||
className: 'border-emerald-100 bg-emerald-50 text-emerald-700',
|
||||
};
|
||||
});
|
||||
|
||||
const summaryLine = computed(() => t('chat.shippingNoticeUi.batchSummaryLine', {
|
||||
total: processSummary.value.total,
|
||||
completed: processSummary.value.completed,
|
||||
running: processSummary.value.running,
|
||||
pending: processSummary.value.pending,
|
||||
}));
|
||||
|
||||
/**
|
||||
* 将任务状态映射为原型中列表右侧的紧凑状态文案。
|
||||
*
|
||||
* 核心逻辑:完成态显示“已完成”,阻塞态显示“步骤 X 待确认”,运行态显示“步骤 X/Y”,
|
||||
* 其余回退到“排队中”,以匹配原型中批次队列的短标签风格。
|
||||
* @param task - 任务摘要或详情
|
||||
* @returns 原型列表使用的短文案与颜色类
|
||||
*/
|
||||
const resolveTaskStateMeta = (task: ShippingTaskSummary | ShippingTaskDetail | null) => {
|
||||
if (!task) {
|
||||
return { text: t('chat.shippingNoticeUi.queuedState'), tone: 'text-muted' };
|
||||
}
|
||||
if (COMPLETED_PROCESS_STATUSES.has(String(task.process_status || '').trim())) {
|
||||
return { text: t('chat.shippingNoticeUi.completedState'), tone: 'text-emerald-700' };
|
||||
}
|
||||
|
||||
const steps = buildShippingWorkflowSteps(task);
|
||||
const blockedIndex = steps.findIndex((step) => step.status === 'blocked');
|
||||
if (blockedIndex >= 0) {
|
||||
return {
|
||||
text: t('chat.shippingNoticeUi.stepNeedsConfirm', { step: blockedIndex + 1 }),
|
||||
tone: 'text-amber-700',
|
||||
};
|
||||
}
|
||||
|
||||
const activeIndex = resolveActiveStep(steps);
|
||||
if (activeIndex >= 0) {
|
||||
return {
|
||||
text: t('chat.shippingNoticeUi.stepFraction', { current: activeIndex + 1, total: steps.length }),
|
||||
tone: 'text-brand-600',
|
||||
};
|
||||
}
|
||||
|
||||
return { text: t('chat.shippingNoticeUi.queuedState'), tone: 'text-muted' };
|
||||
};
|
||||
|
||||
const shortTaskNo = (taskNo?: string | null) => {
|
||||
const value = String(taskNo || '').trim();
|
||||
if (value.length <= 10) return value || '--';
|
||||
return `${value.slice(0, 5)}...${value.slice(-3)}`;
|
||||
};
|
||||
|
||||
const isCurrentTask = (taskNo?: string | null) =>
|
||||
String(taskNo || '').trim().toUpperCase() === currentTaskNo.value;
|
||||
|
||||
const openTaskDialog = () => {
|
||||
if (!props.batchTasks.length) return;
|
||||
showTaskDialog.value = true;
|
||||
};
|
||||
|
||||
const handleFocusTask = (taskNo: string) => {
|
||||
emit('focus-task', taskNo);
|
||||
};
|
||||
|
||||
const handleResumeTask = (taskNo: string) => {
|
||||
showTaskDialog.value = false;
|
||||
emit('resume-task', taskNo);
|
||||
};
|
||||
|
||||
const handleRetryPending = async () => {
|
||||
const batchNo = String(props.batchSummary?.batch_no || '').trim();
|
||||
if (!batchNo || retryingPending.value) return;
|
||||
@@ -186,15 +103,37 @@ const handleRetryPending = async () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section
|
||||
class="mx-auto mt-4 w-full max-w-4xl overflow-hidden rounded-2xl border border-sky-100 bg-gradient-to-br from-sky-50 via-white to-emerald-50 shadow-sm"
|
||||
>
|
||||
<div class="border-b border-sky-100/80 px-4 py-3">
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<div class="text-xs text-slate-500">
|
||||
{{ summaryLine }}
|
||||
<section class="w-full px-3 pt-3 md:px-8 md:pr-10">
|
||||
<div
|
||||
class="mx-auto w-full max-w-4xl rounded-2xl border border-default bg-gradient-to-r from-sky-50 via-white to-emerald-50 px-6 py-4 shadow-sm"
|
||||
>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="flex flex-wrap items-center gap-2 text-xs text-slate-500">
|
||||
<span class="font-mono font-semibold text-brand-700">{{ activeBatchNo || '--' }}</span>
|
||||
<span>
|
||||
{{ t('chat.shippingNoticeUi.batchChromeSummary', {
|
||||
total: processSummary.total,
|
||||
completed: processSummary.completed,
|
||||
running: processSummary.running,
|
||||
abnormal: abnormalCount,
|
||||
}) }}
|
||||
</span>
|
||||
<span
|
||||
class="rounded-full border px-2 py-0.5 text-[11px] font-semibold"
|
||||
:class="executionStateMeta.className"
|
||||
>
|
||||
{{ executionStateMeta.text }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt-2 h-1.5 max-w-md overflow-hidden rounded-full bg-slate-200">
|
||||
<div
|
||||
class="h-full rounded-full bg-brand-500 transition-all"
|
||||
:style="{ width: `${progressPercent}%` }"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="flex shrink-0 items-center gap-2">
|
||||
<button
|
||||
v-if="batchSummary?.batch_no"
|
||||
type="button"
|
||||
@@ -202,242 +141,20 @@ const handleRetryPending = async () => {
|
||||
:disabled="retryingPending"
|
||||
@click="handleRetryPending"
|
||||
>
|
||||
<RefreshCw class="h-3.5 w-3.5" :class="retryingPending ? 'animate-spin' : ''" />
|
||||
{{ retryingPending ? t('chat.shippingNoticeUi.retrying') : t('chat.shippingNoticeUi.retryPendingTasks') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-lg border border-default bg-white/80 px-2.5 py-1 text-xs font-medium text-secondary transition hover:border-brand-300 hover:bg-brand-50 hover:text-brand-700"
|
||||
@click="openTaskDialog"
|
||||
@click="emit('toggle-workspace')"
|
||||
>
|
||||
<List class="h-3.5 w-3.5" />
|
||||
{{ t('chat.shippingNoticeUi.taskListResume') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="batchTasks.length > 1"
|
||||
type="button"
|
||||
class="text-xs font-medium text-brand-600 transition hover:text-brand-700"
|
||||
@click="emit('update:tasksExpanded', !tasksExpanded)"
|
||||
>
|
||||
{{ tasksExpanded ? `${t('chat.shippingNoticeUi.collapseTaskList')} ▲` : `${t('chat.shippingNoticeUi.expandTaskList')} ▼` }}
|
||||
{{ workspaceOpen ? t('chat.shippingNoticeUi.collapseTaskList') : t('chat.shippingNoticeUi.expandTaskList') }}
|
||||
<span class="text-brand-600">{{ workspaceOpen ? '▲' : '▼' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="tasksExpanded && batchTasks.length"
|
||||
class="mt-2 space-y-1 border-t border-dashed border-sky-100 pt-2"
|
||||
>
|
||||
<button
|
||||
v-for="(task, index) in batchTasks"
|
||||
:key="task.task_no"
|
||||
type="button"
|
||||
class="flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-xs transition hover:bg-white/70"
|
||||
:class="isCurrentTask(task.task_no) ? 'bg-white/80 ring-1 ring-brand-200' : ''"
|
||||
@click="handleFocusTask(task.task_no)"
|
||||
>
|
||||
<span class="text-muted">{{ CIRCLED_NUMBERS[index] || `${index + 1}` }}</span>
|
||||
<span class="flex-1 truncate" :class="isCurrentTask(task.task_no) ? 'font-medium text-secondary' : ''">
|
||||
{{ task.source_file_name || task.customer_name || t('chat.shippingNoticeUi.currentNotice') }}
|
||||
</span>
|
||||
<span class="font-mono text-brand-600">{{ shortTaskNo(task.task_no) }}</span>
|
||||
<span
|
||||
class="rounded-full px-1.5 py-0.5"
|
||||
:class="isCurrentTask(task.task_no) ? 'text-brand-600' : resolveTaskStateMeta(task).tone"
|
||||
>
|
||||
{{ resolveTaskStateMeta(task).text }}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3 px-4 py-4">
|
||||
<div class="flex flex-wrap items-baseline justify-between gap-2">
|
||||
<div>
|
||||
<div class="font-mono text-sm font-semibold text-brand-700">
|
||||
{{ currentTaskNo || batchSummary?.batch_no || '--' }}
|
||||
</div>
|
||||
<div class="mt-0.5 text-xs text-muted">
|
||||
当前 · 第 {{ currentTaskIndex || 0 }}/{{ currentTaskTotal || 0 }} 笔 ·
|
||||
<em class="not-italic text-secondary">{{ currentTaskName }}</em>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-xs text-muted">
|
||||
步骤 <strong class="text-secondary">{{ currentStepMeta.index }}</strong>/{{ currentSteps.length || 7 }} · {{ currentStepMeta.label }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="scheme-stepper">
|
||||
<template v-for="(step, index) in currentSteps" :key="step.id">
|
||||
<div
|
||||
class="scheme-step-node"
|
||||
:class="{
|
||||
done: step.status === 'completed',
|
||||
active: step.status === 'current' || step.status === 'blocked',
|
||||
}"
|
||||
>
|
||||
<div class="scheme-step-dot">
|
||||
{{ step.status === 'completed' ? '✓' : index + 1 }}
|
||||
</div>
|
||||
<div class="scheme-step-label">{{ t(step.label) }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="inventorySelectionActive"
|
||||
class="rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.inventoryTaskPickHint') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="showTaskDialog"
|
||||
class="fixed inset-0 z-[120] flex items-center justify-center bg-slate-900/30 px-4"
|
||||
@click.self="showTaskDialog = false"
|
||||
>
|
||||
<div class="w-full max-w-[620px] rounded-[28px] bg-white p-5 shadow-[0_24px_80px_rgba(15,23,42,0.22)]">
|
||||
<div class="flex items-start justify-between gap-4">
|
||||
<div>
|
||||
<div class="text-[32px] font-semibold tracking-tight text-slate-800">
|
||||
{{ t('chat.shippingNoticeUi.taskListTitle') }}
|
||||
</div>
|
||||
<div class="mt-1 text-sm text-slate-500">
|
||||
{{ t('chat.shippingNoticeUi.taskListHint') }}
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full p-2 text-slate-400 transition hover:bg-slate-100 hover:text-slate-600"
|
||||
@click="showTaskDialog = false"
|
||||
>
|
||||
<X class="h-5 w-5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 space-y-3">
|
||||
<button
|
||||
v-for="task in batchTasks"
|
||||
:key="task.task_no"
|
||||
type="button"
|
||||
class="w-full rounded-3xl border px-4 py-4 text-left transition hover:border-[#8bc8f5] hover:bg-[#f8fbff]"
|
||||
:class="isCurrentTask(task.task_no) ? 'border-[#8bc8f5] bg-[#f5fbff]' : 'border-[#e5edf5] bg-white'"
|
||||
@click="handleResumeTask(task.task_no)"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="min-w-0">
|
||||
<div class="font-mono text-lg font-semibold text-[#1277c8]">
|
||||
{{ task.task_no }}
|
||||
</div>
|
||||
<div class="mt-1 truncate text-[15px] text-slate-700">
|
||||
{{ task.source_file_name || task.customer_name || t('chat.shippingNoticeUi.currentNotice') }}
|
||||
</div>
|
||||
<div class="mt-1 text-sm text-slate-500">
|
||||
{{ resolveTaskStateMeta(task).text }}
|
||||
</div>
|
||||
<div
|
||||
v-if="isCurrentTask(task.task_no)"
|
||||
class="mt-2 inline-flex items-center gap-1 text-sm font-medium text-[#1277c8]"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.currentFocus') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex shrink-0 items-center gap-2">
|
||||
<span
|
||||
class="rounded-full px-3 py-1 text-sm font-medium"
|
||||
:class="COMPLETED_PROCESS_STATUSES.has(String(task.process_status || '').trim())
|
||||
? 'bg-emerald-100 text-emerald-700'
|
||||
: isCurrentTask(task.task_no)
|
||||
? 'bg-sky-100 text-sky-700'
|
||||
: 'bg-amber-100 text-amber-700'"
|
||||
>
|
||||
{{ COMPLETED_PROCESS_STATUSES.has(String(task.process_status || '').trim())
|
||||
? t('chat.shippingNoticeUi.completedState')
|
||||
: isCurrentTask(task.task_no)
|
||||
? t('chat.shippingNoticeUi.runningState')
|
||||
: t('chat.shippingNoticeUi.pendingState') }}
|
||||
</span>
|
||||
<PlayCircle class="h-5 w-5 text-[#1492df]" />
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.scheme-stepper {
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.scheme-step-node {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
min-width: 52px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.scheme-step-node:not(:last-child)::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: calc(50% + 11px);
|
||||
width: calc(100% - 22px);
|
||||
height: 2px;
|
||||
background: #e2e8f0;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.scheme-step-node.done:not(:last-child)::after {
|
||||
background: #0284c7;
|
||||
}
|
||||
|
||||
.scheme-step-node.active:not(:last-child)::after {
|
||||
background: linear-gradient(90deg, #0284c7 50%, #e2e8f0 50%);
|
||||
}
|
||||
|
||||
.scheme-step-dot {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin: 0 auto 0.25rem;
|
||||
border: 2px solid #e2e8f0;
|
||||
border-radius: 9999px;
|
||||
background: #fff;
|
||||
color: #64748b;
|
||||
font-size: 0.55rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.scheme-step-node.done .scheme-step-dot {
|
||||
border-color: #0284c7;
|
||||
background: #0284c7;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.scheme-step-node.active .scheme-step-dot {
|
||||
border-color: #0284c7;
|
||||
box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
|
||||
color: #0284c7;
|
||||
}
|
||||
|
||||
.scheme-step-label {
|
||||
color: #64748b;
|
||||
font-size: 0.58rem;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.scheme-step-node.active .scheme-step-label {
|
||||
color: #0284c7;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,509 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/chat/components/ShippingBatchWorkspaceDrawer.vue
|
||||
* 用途:发货通知 Agent 的右侧批次工作台抽屉,承载多批次切换、任务筛选、步骤诊断与恢复动作。
|
||||
* 依赖:shippingStepper、shipping.api.types、vue-i18n、lucide-vue-next。
|
||||
* 逻辑:上游传入会话级 workspace 与当前批次任务;本组件只做展示、筛选和事件抛出,执行动作仍由 useChatShipping 接管。
|
||||
*/
|
||||
import { computed, ref } from 'vue';
|
||||
import { RefreshCw, Target, X } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { buildShippingWorkflowSteps, type ShippingWorkflowStepItem } from '@/features/chat/shipping';
|
||||
import { hasShortageLines } from '@/features/chat/shipping/shippingShortageDetails';
|
||||
import type {
|
||||
ShippingBatchSummary,
|
||||
ShippingConversationWorkspace,
|
||||
ShippingTaskDetail,
|
||||
ShippingTaskSummary,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean;
|
||||
conversationWorkspace: ShippingConversationWorkspace | null;
|
||||
activeBatchNo: string;
|
||||
focusedTaskNo: string;
|
||||
batchSummary: ShippingBatchSummary | null;
|
||||
batchTasks: ShippingTaskSummary[];
|
||||
activeTaskDetail: ShippingTaskDetail | null;
|
||||
retryingPending?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:open': [value: boolean];
|
||||
'switch-batch': [batchNo: string];
|
||||
'focus-task': [taskNo: string];
|
||||
'resume-task': [taskNo: string];
|
||||
'query-shortage': [taskNo: string];
|
||||
'retry-pending': [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const activeFilter = ref<'all' | 'abnormal' | 'completed'>('all');
|
||||
|
||||
const COMPLETED_PROCESS_STATUSES = new Set(['uploaded', 'completed', 'closed']);
|
||||
|
||||
const workspaceBatches = computed(() => props.conversationWorkspace?.batches || []);
|
||||
const activeBatchNo = computed(() =>
|
||||
String(props.activeBatchNo || props.batchSummary?.batch_no || workspaceBatches.value[0]?.batch_no || '').trim(),
|
||||
);
|
||||
|
||||
const isFailedTask = (task: ShippingTaskSummary | ShippingTaskDetail) =>
|
||||
task.upload_status === 'failed' || String(task.process_status || '').trim() === 'upload_failed';
|
||||
|
||||
const isCompletedTask = (task: ShippingTaskSummary | ShippingTaskDetail) =>
|
||||
COMPLETED_PROCESS_STATUSES.has(String(task.process_status || '').trim());
|
||||
|
||||
const isAbnormalTask = (task: ShippingTaskSummary | ShippingTaskDetail) =>
|
||||
!isCompletedTask(task)
|
||||
&& (isFailedTask(task)
|
||||
|| Boolean(task.review_status || task.pending_human_reason)
|
||||
|| String(task.process_status || '').trim() === 'waiting_inventory');
|
||||
|
||||
const batchAbnormalCount = (batch: ShippingBatchSummary) => {
|
||||
const summary = batch.process_summary || {};
|
||||
return Number(summary.failed || 0) + Number((summary as { needs_human?: number }).needs_human || 0);
|
||||
};
|
||||
|
||||
const batchCompletedCount = (batch: ShippingBatchSummary) =>
|
||||
Number(batch.process_summary?.completed || 0);
|
||||
|
||||
const batchTotalCount = (batch: ShippingBatchSummary) =>
|
||||
Number(batch.process_summary?.total || batch.file_count || 0);
|
||||
|
||||
const taskCounts = computed(() => {
|
||||
const tasks = props.batchTasks || [];
|
||||
const completed = tasks.filter(isCompletedTask).length;
|
||||
const abnormal = tasks.filter(isAbnormalTask).length;
|
||||
return {
|
||||
total: tasks.length,
|
||||
abnormal,
|
||||
completed,
|
||||
};
|
||||
});
|
||||
|
||||
const filteredTasks = computed(() => {
|
||||
const tasks = props.batchTasks || [];
|
||||
if (activeFilter.value === 'abnormal') return tasks.filter(isAbnormalTask);
|
||||
if (activeFilter.value === 'completed') return tasks.filter(isCompletedTask);
|
||||
return tasks;
|
||||
});
|
||||
|
||||
const isCurrentTask = (taskNo?: string | null) =>
|
||||
String(taskNo || '').trim().toUpperCase() === String(props.focusedTaskNo || props.activeTaskDetail?.task_no || '').trim().toUpperCase();
|
||||
|
||||
const resolveTaskStateMeta = (task: ShippingTaskSummary | ShippingTaskDetail) => {
|
||||
if (isCompletedTask(task)) {
|
||||
return { text: t('chat.shippingNoticeUi.completedState'), className: 'border-emerald-100 bg-emerald-50 text-emerald-700' };
|
||||
}
|
||||
if (isFailedTask(task)) {
|
||||
return { text: t('chat.shippingNoticeUi.status.uploadFailed'), className: 'border-rose-100 bg-rose-50 text-rose-700' };
|
||||
}
|
||||
if (isAbnormalTask(task)) {
|
||||
return { text: t('chat.shippingNoticeUi.pendingState'), className: 'border-amber-100 bg-amber-50 text-amber-700' };
|
||||
}
|
||||
return { text: t('chat.shippingNoticeUi.runningState'), className: 'border-sky-100 bg-sky-50 text-brand-700' };
|
||||
};
|
||||
|
||||
const taskStepNumber = (task: ShippingTaskSummary | ShippingTaskDetail) =>
|
||||
resolveActiveStep(buildShippingWorkflowSteps(task)) + 1;
|
||||
|
||||
const currentStepProgress = (task: ShippingTaskSummary | ShippingTaskDetail) =>
|
||||
task.step_payload?.current_step_progress || null;
|
||||
|
||||
const resolveTaskDiagnosis = (task: ShippingTaskSummary | ShippingTaskDetail) => {
|
||||
const reason = String(task.pending_human_reason || '').trim();
|
||||
const reviewStatus = String(task.review_status || '').trim();
|
||||
const processStatus = String(task.process_status || '').trim();
|
||||
const explicitError = String(task.error_message || '').trim();
|
||||
const progress = currentStepProgress(task);
|
||||
const progressMessage = String(progress?.message || '').trim();
|
||||
const progressDetail = String(progress?.detail || '').trim();
|
||||
const step = taskStepNumber(task);
|
||||
|
||||
if (isCompletedTask(task)) {
|
||||
return {
|
||||
title: t('chat.shippingNoticeUi.diagnosisCompletedTitle'),
|
||||
advice: t('chat.shippingNoticeUi.diagnosisCompletedAdvice'),
|
||||
};
|
||||
}
|
||||
if (progressMessage && reason === 'rpa_pending') {
|
||||
return {
|
||||
title: progressMessage,
|
||||
advice: progressDetail || t('chat.shippingNoticeUi.diagnosisInventoryRpaAdvice'),
|
||||
};
|
||||
}
|
||||
if (explicitError) {
|
||||
return {
|
||||
title: explicitError,
|
||||
advice: progressDetail || t('chat.shippingNoticeUi.diagnosisAdviceRetryOrFocus'),
|
||||
};
|
||||
}
|
||||
if (progressMessage && (isAbnormalTask(task) || progress?.status === 'needs_human')) {
|
||||
return {
|
||||
title: progressMessage,
|
||||
advice: progressDetail || t('chat.shippingNoticeUi.diagnosisStepWaitingAdvice'),
|
||||
};
|
||||
}
|
||||
if (isFailedTask(task) || reason === 'upload_rpa_failed') {
|
||||
return {
|
||||
title: t('chat.shippingNoticeUi.diagnosisUploadFailedTitle'),
|
||||
advice: t('chat.shippingNoticeUi.diagnosisUploadFailedAdvice'),
|
||||
};
|
||||
}
|
||||
if (reason === 'shortage' || reason === 'shortage_review' || reviewStatus === 'shortage_review') {
|
||||
return {
|
||||
title: t('chat.shippingNoticeUi.diagnosisShortageTitle'),
|
||||
advice: t('chat.shippingNoticeUi.diagnosisShortageAdvice'),
|
||||
};
|
||||
}
|
||||
if (reason === 'rpa_exhausted' || reason === 'rpa_pending' || reason === 'inv_unavail') {
|
||||
return {
|
||||
title: t('chat.shippingNoticeUi.diagnosisInventoryRpaTitle'),
|
||||
advice: t('chat.shippingNoticeUi.diagnosisInventoryRpaAdvice'),
|
||||
};
|
||||
}
|
||||
if (reason === 'align_review' || reviewStatus === 'align_review') {
|
||||
return {
|
||||
title: t('chat.shippingNoticeUi.diagnosisAlignReviewTitle'),
|
||||
advice: t('chat.shippingNoticeUi.diagnosisAlignReviewAdvice'),
|
||||
};
|
||||
}
|
||||
if (reason === 'low_confidence' || reviewStatus === 'parse_review') {
|
||||
return {
|
||||
title: t('chat.shippingNoticeUi.diagnosisParseReviewTitle'),
|
||||
advice: t('chat.shippingNoticeUi.diagnosisParseReviewAdvice'),
|
||||
};
|
||||
}
|
||||
if (reason === 'rsv_required' || reviewStatus === 'rsv_required') {
|
||||
return {
|
||||
title: t('chat.shippingNoticeUi.diagnosisReservationRequiredTitle'),
|
||||
advice: t('chat.shippingNoticeUi.diagnosisReservationRequiredAdvice'),
|
||||
};
|
||||
}
|
||||
if (reason === 'map_infer' || processStatus === 'waiting_inventory') {
|
||||
return {
|
||||
title: t('chat.shippingNoticeUi.diagnosisInventoryWaitingTitle'),
|
||||
advice: t('chat.shippingNoticeUi.diagnosisInventoryWaitingAdvice'),
|
||||
};
|
||||
}
|
||||
return {
|
||||
title: t('chat.shippingNoticeUi.diagnosisStepWaitingTitle', { step }),
|
||||
advice: t('chat.shippingNoticeUi.diagnosisStepWaitingAdvice'),
|
||||
};
|
||||
};
|
||||
|
||||
const resolveActiveStep = (steps: ShippingWorkflowStepItem[]) => {
|
||||
const activeIndex = steps.findIndex((step) => step.status === 'current' || step.status === 'blocked');
|
||||
return activeIndex >= 0 ? activeIndex : Math.max(0, steps.length - 1);
|
||||
};
|
||||
|
||||
const handleSwitchBatch = (batchNo: string) => {
|
||||
if (!batchNo || batchNo === activeBatchNo.value) return;
|
||||
activeFilter.value = 'all';
|
||||
emit('switch-batch', batchNo);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside
|
||||
v-if="open"
|
||||
class="hidden h-full w-[520px] shrink-0 flex-col border-l border-default bg-surface shadow-[-12px_0_40px_rgba(15,23,42,0.08)] xl:flex"
|
||||
>
|
||||
<header class="flex h-[92px] shrink-0 items-center justify-between border-b border-default px-6">
|
||||
<div>
|
||||
<div class="flex items-center gap-2 text-lg font-bold text-primary">
|
||||
<span class="grid h-5 w-5 grid-cols-2 gap-0.5 text-brand-500">
|
||||
<span class="rounded-sm bg-current"></span>
|
||||
<span class="rounded-sm border border-current"></span>
|
||||
<span class="rounded-sm border border-current"></span>
|
||||
<span class="rounded-sm bg-current"></span>
|
||||
</span>
|
||||
{{ t('chat.shippingNoticeUi.batchWorkspaceTitle') }}
|
||||
</div>
|
||||
<p class="mt-1 text-[11px] text-muted">{{ t('chat.shippingNoticeUi.batchWorkspaceSubtitle') }}</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="flex h-9 w-9 items-center justify-center rounded-full text-muted transition hover:bg-surface-soft hover:text-primary"
|
||||
@click="emit('update:open', false)"
|
||||
>
|
||||
<X class="h-5 w-5" />
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="border-b border-default px-6 py-5">
|
||||
<div class="flex gap-3 overflow-x-auto pb-1">
|
||||
<button
|
||||
v-for="batch in workspaceBatches"
|
||||
:key="batch.batch_no"
|
||||
type="button"
|
||||
class="relative w-44 shrink-0 overflow-hidden rounded-xl border p-3 text-left transition-colors"
|
||||
:class="batch.batch_no === activeBatchNo ? 'border-brand-300 bg-surface shadow-sm ring-1 ring-brand-100' : 'border-default bg-transparent hover:bg-surface-soft'"
|
||||
@click="handleSwitchBatch(batch.batch_no)"
|
||||
>
|
||||
<div
|
||||
v-if="batch.batch_no === activeBatchNo"
|
||||
class="absolute left-0 top-0 h-1 w-full bg-brand-500"
|
||||
></div>
|
||||
<div class="mb-1 truncate font-mono text-xs font-bold text-primary">{{ batch.batch_no }}</div>
|
||||
<div class="text-[10px] font-medium text-muted">
|
||||
{{
|
||||
batchAbnormalCount(batch) > 0
|
||||
? t('chat.shippingNoticeUi.batchTabAbnormal', { completed: batchCompletedCount(batch), abnormal: batchAbnormalCount(batch) })
|
||||
: t('chat.shippingNoticeUi.batchTabNormal', { total: batchTotalCount(batch) })
|
||||
}}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 overflow-y-auto px-6 py-6">
|
||||
<section class="rounded-2xl border border-default bg-surface p-4 shadow-sm">
|
||||
<h3 class="text-sm font-bold text-primary">{{ t('chat.shippingNoticeUi.batchActionsTitle') }}</h3>
|
||||
<div class="mt-4">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex w-full items-center justify-center gap-2 rounded-lg border border-default bg-white py-2 text-xs font-medium text-secondary transition hover:border-brand-300 hover:bg-brand-50 hover:text-brand-700 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="retryingPending"
|
||||
@click="emit('retry-pending')"
|
||||
>
|
||||
<RefreshCw class="h-3.5 w-3.5" :class="retryingPending ? 'animate-spin' : ''" />
|
||||
{{ retryingPending ? t('chat.shippingNoticeUi.retrying') : t('chat.shippingNoticeUi.retryFailedTasks') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="mt-3 rounded-lg border border-indigo-100 bg-indigo-50 p-3 text-xs leading-5 text-indigo-900/80">
|
||||
{{ t('chat.shippingNoticeUi.batchActionSafetyNotice') }}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="mt-6">
|
||||
<div class="mb-3 flex items-center justify-between gap-3">
|
||||
<h3 class="text-sm font-bold text-primary">
|
||||
{{ t('chat.shippingNoticeUi.taskDetailCount', { count: filteredTasks.length }) }}
|
||||
</h3>
|
||||
<div class="flex rounded-lg bg-slate-100 p-1 text-xs">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded px-3 py-1 transition-colors"
|
||||
:class="activeFilter === 'all' ? 'bg-white text-primary shadow-sm' : 'text-muted hover:text-secondary'"
|
||||
@click="activeFilter = 'all'"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.filterAll') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded px-3 py-1 transition-colors"
|
||||
:class="activeFilter === 'abnormal' ? 'bg-white text-primary shadow-sm' : 'text-muted hover:text-secondary'"
|
||||
@click="activeFilter = 'abnormal'"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.filterAbnormal', { count: taskCounts.abnormal }) }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded px-3 py-1 transition-colors"
|
||||
:class="activeFilter === 'completed' ? 'bg-white text-primary shadow-sm' : 'text-muted hover:text-secondary'"
|
||||
@click="activeFilter = 'completed'"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.filterCompleted', { count: taskCounts.completed }) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="!filteredTasks.length" class="py-10 text-center text-sm text-muted">
|
||||
{{ t('chat.shippingNoticeUi.emptyFilteredTasks') }}
|
||||
</div>
|
||||
|
||||
<div v-else class="space-y-4">
|
||||
<article
|
||||
v-for="task in filteredTasks"
|
||||
:key="task.task_no"
|
||||
class="relative overflow-hidden rounded-2xl border bg-white p-4 shadow-sm transition-colors"
|
||||
:class="[
|
||||
isFailedTask(task) ? 'border-rose-100' : isAbnormalTask(task) ? 'border-amber-100' : 'border-default',
|
||||
isCurrentTask(task.task_no) ? 'ring-1 ring-brand-200' : '',
|
||||
]"
|
||||
>
|
||||
<div
|
||||
class="absolute left-0 top-0 h-full w-1"
|
||||
:class="isFailedTask(task) ? 'bg-rose-500' : isAbnormalTask(task) ? 'bg-amber-500' : 'bg-emerald-500'"
|
||||
></div>
|
||||
<div class="mb-4 flex items-start justify-between gap-3">
|
||||
<div class="min-w-0">
|
||||
<div class="truncate font-mono text-sm font-bold text-primary">{{ task.task_no }}</div>
|
||||
<div class="mt-0.5 truncate text-xs text-muted">
|
||||
{{ task.source_file_name || task.customer_name || t('chat.shippingNoticeUi.currentNotice') }}
|
||||
</div>
|
||||
</div>
|
||||
<span class="rounded border px-2 py-1 text-[10px] font-bold" :class="resolveTaskStateMeta(task).className">
|
||||
{{ resolveTaskStateMeta(task).text }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="mb-5 mt-4">
|
||||
<div class="scheme-stepper">
|
||||
<template v-for="(step, index) in buildShippingWorkflowSteps(task)" :key="step.id">
|
||||
<div
|
||||
class="scheme-step-node"
|
||||
:class="{
|
||||
done: step.status === 'completed',
|
||||
active: step.status === 'current',
|
||||
blocked: step.status === 'blocked',
|
||||
}"
|
||||
>
|
||||
<div class="scheme-step-dot">
|
||||
<span v-if="step.status === 'completed'">✓</span>
|
||||
<X v-else-if="step.status === 'blocked' && isFailedTask(task)" class="h-3 w-3" />
|
||||
<span v-else-if="step.status === 'blocked'">!</span>
|
||||
<span v-else>{{ index + 1 }}</span>
|
||||
</div>
|
||||
<div class="scheme-step-label">{{ t(step.label) }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mb-3 rounded-lg border p-2.5 text-xs font-medium leading-5"
|
||||
:class="isFailedTask(task) ? 'border-rose-100 bg-rose-50 text-rose-700' : isAbnormalTask(task) ? 'border-amber-100 bg-amber-50 text-amber-700' : 'border-emerald-100 bg-emerald-50 text-emerald-700'"
|
||||
>
|
||||
<div class="font-semibold">{{ resolveTaskDiagnosis(task).title }}</div>
|
||||
<div class="mt-1 font-normal text-slate-600">{{ resolveTaskDiagnosis(task).advice }}</div>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2">
|
||||
<button
|
||||
v-if="hasShortageLines(task)"
|
||||
type="button"
|
||||
class="flex flex-1 items-center justify-center gap-1.5 rounded-lg border border-amber-100 bg-amber-50 py-1.5 text-xs font-medium text-amber-700 transition-colors hover:bg-amber-100"
|
||||
@click="emit('query-shortage', task.task_no)"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.queryShortageDetails') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="flex flex-1 items-center justify-center gap-1.5 rounded-lg border border-transparent bg-surface-soft py-1.5 text-xs font-medium text-secondary transition-colors hover:border-brand-200 hover:bg-brand-50 hover:text-brand-600"
|
||||
@click="emit('focus-task', task.task_no)"
|
||||
>
|
||||
<Target class="h-3.5 w-3.5" />
|
||||
{{ t('chat.shippingNoticeUi.focusRepair') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="flex-1 rounded-lg border border-default bg-white py-1.5 text-xs font-medium text-secondary transition-colors hover:border-brand-300 hover:text-brand-700"
|
||||
@click="emit('resume-task', task.task_no)"
|
||||
>
|
||||
{{ isCompletedTask(task) ? t('chat.shippingNoticeUi.viewDetail') : t('chat.shippingNoticeUi.retrySingleTask') }}
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div
|
||||
v-if="open"
|
||||
class="fixed inset-0 z-[90] bg-slate-900/30 backdrop-blur-sm xl:hidden"
|
||||
@click="emit('update:open', false)"
|
||||
>
|
||||
<aside
|
||||
class="ml-auto flex h-full w-[min(92vw,520px)] flex-col border-l border-default bg-surface shadow-2xl"
|
||||
@click.stop
|
||||
>
|
||||
<header class="flex h-16 shrink-0 items-center justify-between border-b border-default px-4">
|
||||
<div class="font-bold text-primary">{{ t('chat.shippingNoticeUi.batchWorkspaceTitle') }}</div>
|
||||
<button type="button" class="rounded-full p-2 text-muted hover:bg-surface-soft" @click="emit('update:open', false)">
|
||||
<X class="h-5 w-5" />
|
||||
</button>
|
||||
</header>
|
||||
<div class="flex-1 overflow-y-auto p-4 text-sm text-muted">
|
||||
{{ t('chat.shippingNoticeUi.mobileWorkspaceHint') }}
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.scheme-stepper {
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.scheme-step-node {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
min-width: 52px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.scheme-step-node:not(:last-child)::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: calc(50% + 11px);
|
||||
width: calc(100% - 22px);
|
||||
height: 2px;
|
||||
background: #e2e8f0;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.scheme-step-node.done:not(:last-child)::after {
|
||||
background: #0284c7;
|
||||
}
|
||||
|
||||
.scheme-step-node.active:not(:last-child)::after {
|
||||
background: linear-gradient(90deg, #0284c7 50%, #e2e8f0 50%);
|
||||
}
|
||||
|
||||
.scheme-step-dot {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin: 0 auto 0.25rem;
|
||||
border: 2px solid #e2e8f0;
|
||||
border-radius: 9999px;
|
||||
background: #fff;
|
||||
color: #64748b;
|
||||
font-size: 0.55rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.scheme-step-node.done .scheme-step-dot {
|
||||
border-color: #0284c7;
|
||||
background: #0284c7;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.scheme-step-node.active .scheme-step-dot {
|
||||
border-color: #0284c7;
|
||||
box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
|
||||
color: #0284c7;
|
||||
}
|
||||
|
||||
.scheme-step-node.blocked .scheme-step-dot {
|
||||
border-color: #f59e0b;
|
||||
background: #fff;
|
||||
color: #f59e0b;
|
||||
box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
|
||||
}
|
||||
|
||||
.scheme-step-node.blocked .scheme-step-label {
|
||||
color: #d97706;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.scheme-step-label {
|
||||
color: #64748b;
|
||||
font-size: 0.58rem;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.scheme-step-node.active .scheme-step-label {
|
||||
color: #0284c7;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
@@ -8,6 +8,10 @@ import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import { applyStreamErrorToMessage, type StreamErrorLabels } from '../utils/streamErrorMessage';
|
||||
import type { ChatMessage, ChatRun, RetrieverResource } from '../types/chat.types';
|
||||
|
||||
export interface SendMessageLifecycleHooks {
|
||||
onAssistantMessageFinished?: (message: ChatMessage, runMessages: ChatMessage[]) => void | Promise<void>;
|
||||
}
|
||||
|
||||
const normalizeResources = (resources: unknown) => {
|
||||
if (!resources) return [];
|
||||
if (Array.isArray(resources)) return resources;
|
||||
@@ -191,15 +195,17 @@ export function useChat() {
|
||||
| { type: 'image' | 'document' | 'audio' | 'video' | 'custom'; transfer_method: 'local_file'; upload_file_id: string }
|
||||
| { type: 'image' | 'document' | 'audio' | 'video' | 'custom'; transfer_method: 'remote_url'; url: string }
|
||||
>,
|
||||
context?: { task_id?: string; batch_no?: string },
|
||||
context?: { task_id?: string; batch_no?: string; display_query?: string },
|
||||
hooks?: SendMessageLifecycleHooks,
|
||||
) => {
|
||||
const displayQuery = String(context?.display_query || query || '').trim();
|
||||
const runViewId = viewId.value;
|
||||
const runMessages = messages.value;
|
||||
const run: ChatRun = {
|
||||
runId: ++runSeq,
|
||||
agentId,
|
||||
viewId: runViewId,
|
||||
query,
|
||||
query: displayQuery,
|
||||
messages: runMessages,
|
||||
conversationId: conversationId.value,
|
||||
status: 'running',
|
||||
@@ -209,7 +215,7 @@ export function useChat() {
|
||||
if (runs.value.length > 30) runs.value = runs.value.slice(0, 30);
|
||||
activeRunId.value = run.runId;
|
||||
|
||||
runMessages.push({ role: 'user', content: query });
|
||||
runMessages.push({ role: 'user', content: displayQuery });
|
||||
let botMsgIndex: number | null = null;
|
||||
let hasAssistantContent = false;
|
||||
let hasTerminalEvent = false;
|
||||
@@ -239,6 +245,7 @@ export function useChat() {
|
||||
files: files && files.length > 0 ? files : undefined,
|
||||
task_id: context?.task_id || undefined,
|
||||
batch_no: context?.batch_no || undefined,
|
||||
display_query: context?.display_query || undefined,
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -359,6 +366,12 @@ export function useChat() {
|
||||
if (messages.value === runMessages) {
|
||||
isThinking.value = false;
|
||||
}
|
||||
if (run.status === 'done' && botMsgIndex !== null) {
|
||||
const botMsg = runMessages[botMsgIndex];
|
||||
if (botMsg) {
|
||||
await hooks?.onAssistantMessageFinished?.(botMsg, runMessages);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -289,6 +289,7 @@ export function useChatPage() {
|
||||
clearAttachments: attachmentApi.clearAttachments,
|
||||
sendMessage,
|
||||
getChatContext: shipping.isShippingNoticeAgent ? shipping.getCurrentShippingChatContext : undefined,
|
||||
onAssistantMessageFinished: shipping.finalizeShippingAssistantMessage,
|
||||
refreshHistoryAfterSend,
|
||||
tryHandleShippingAttachmentAutoFlow: shipping.tryHandleShippingAttachmentAutoFlow,
|
||||
tryHandleLeaveSend: leave.tryHandleLeaveSend,
|
||||
@@ -354,6 +355,8 @@ export function useChatPage() {
|
||||
currentUser,
|
||||
chatScrollContainer,
|
||||
scrollContainerHolder,
|
||||
showScrollToBottom: scroll.showScrollToBottom,
|
||||
scrollToBottom: scroll.scrollToBottomSmooth,
|
||||
messages,
|
||||
isThinking,
|
||||
conversationId,
|
||||
@@ -414,13 +417,22 @@ export function useChatPage() {
|
||||
showChatRating,
|
||||
isShippingNoticeAgent: shipping.isShippingNoticeAgent,
|
||||
shippingBatchSummary: shipping.shippingBatchSummary,
|
||||
shippingConversationWorkspace: shipping.shippingConversationWorkspace,
|
||||
activeShippingBatchNo: shipping.activeShippingBatchNo,
|
||||
focusedShippingTaskNo: shipping.focusedShippingTaskNo,
|
||||
shippingFocusReason: shipping.shippingFocusReason,
|
||||
shippingBatchTasks: shipping.shippingBatchTasks,
|
||||
activeShippingTaskDetail: shipping.activeShippingTaskDetail,
|
||||
shippingBatchTasksExpanded: shipping.shippingBatchTasksExpanded,
|
||||
shippingWorkspaceOpen: shipping.shippingWorkspaceOpen,
|
||||
retryingShippingPendingTasks: shipping.retryingShippingPendingTasks,
|
||||
shippingInventorySelectionActive: shipping.shippingInventorySelectionActive,
|
||||
shippingInventorySelectionTaskId: shipping.shippingInventorySelectionTaskId,
|
||||
switchShippingBatch: shipping.switchShippingBatch,
|
||||
switchShippingFocusTask: shipping.switchShippingFocusTask,
|
||||
clearShippingFocus: shipping.clearShippingFocus,
|
||||
resumeShippingTask: shipping.resumeShippingTask,
|
||||
retryCurrentShippingBatchPendingTasks: shipping.retryCurrentShippingBatchPendingTasks,
|
||||
queryShippingShortageDetails: shipping.queryShippingShortageDetails,
|
||||
selectShippingInventoryUploadTask: shipping.selectShippingInventoryUploadTask,
|
||||
cancelShippingInventoryTaskSelection: shipping.cancelShippingInventoryTaskSelection,
|
||||
shippingSuggestedPrompt: shipping.shippingSuggestedPrompt,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* features/chat/composables/useChatScroll.ts
|
||||
* 聊天主区域滚动:贴底、滚到最新用户问题与思考态切换时的滚动策略。
|
||||
* 聊天主区域滚动:贴底、滚到最新用户问题、悬浮跳底按钮与思考态切换时的滚动策略。
|
||||
*/
|
||||
import { nextTick, watch, type Ref } from 'vue';
|
||||
import { computed, nextTick, onBeforeUnmount, ref, watch, type Ref } from 'vue';
|
||||
import type { ChatMessage } from '../types/chat.types';
|
||||
|
||||
export interface UseChatScrollOptions {
|
||||
@@ -13,6 +13,37 @@ export interface UseChatScrollOptions {
|
||||
export function useChatScroll(options: UseChatScrollOptions) {
|
||||
const { container, messages } = options;
|
||||
let scrollToBottomFrame: number | null = null;
|
||||
let observedContainer: HTMLElement | null = null;
|
||||
const isNearBottom = ref(true);
|
||||
|
||||
const updateNearBottomState = () => {
|
||||
const el = container.value;
|
||||
if (!el) {
|
||||
isNearBottom.value = true;
|
||||
return;
|
||||
}
|
||||
const remaining = el.scrollHeight - el.scrollTop - el.clientHeight;
|
||||
isNearBottom.value = remaining <= 96;
|
||||
};
|
||||
|
||||
/** 绑定当前滚动容器,容器引用变化时同步换绑监听器。 */
|
||||
const syncScrollListener = () => {
|
||||
const nextContainer = container.value;
|
||||
if (observedContainer === nextContainer) {
|
||||
updateNearBottomState();
|
||||
return;
|
||||
}
|
||||
observedContainer?.removeEventListener('scroll', updateNearBottomState);
|
||||
observedContainer = nextContainer;
|
||||
observedContainer?.addEventListener('scroll', updateNearBottomState, { passive: true });
|
||||
updateNearBottomState();
|
||||
};
|
||||
|
||||
const stopContainerWatch = watch(container, syncScrollListener, { immediate: true });
|
||||
|
||||
const showScrollToBottom = computed(() =>
|
||||
messages.value.length >= 4 && !isNearBottom.value,
|
||||
);
|
||||
|
||||
const scrollToBottom = async () => {
|
||||
await nextTick();
|
||||
@@ -22,6 +53,17 @@ export function useChatScroll(options: UseChatScrollOptions) {
|
||||
top: el.scrollHeight,
|
||||
behavior: 'auto',
|
||||
});
|
||||
updateNearBottomState();
|
||||
};
|
||||
|
||||
const scrollToBottomSmooth = async () => {
|
||||
await nextTick();
|
||||
const el = container.value;
|
||||
if (!el) return;
|
||||
el.scrollTo({
|
||||
top: el.scrollHeight,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
};
|
||||
|
||||
const scrollToUserQuestion = async () => {
|
||||
@@ -60,6 +102,9 @@ export function useChatScroll(options: UseChatScrollOptions) {
|
||||
window.cancelAnimationFrame(scrollToBottomFrame);
|
||||
scrollToBottomFrame = null;
|
||||
}
|
||||
observedContainer?.removeEventListener('scroll', updateNearBottomState);
|
||||
observedContainer = null;
|
||||
stopContainerWatch();
|
||||
};
|
||||
|
||||
/** 消息/思考态变化时自动滚动(思考结束滚到用户问题,否则贴底) */
|
||||
@@ -79,15 +124,21 @@ export function useChatScroll(options: UseChatScrollOptions) {
|
||||
void scrollToUserQuestion();
|
||||
} else {
|
||||
if (isThinking.value) wasThinking = true;
|
||||
scheduleScrollToBottom();
|
||||
if (isNearBottom.value) scheduleScrollToBottom();
|
||||
else window.requestAnimationFrame(updateNearBottomState);
|
||||
}
|
||||
},
|
||||
{ deep: false },
|
||||
);
|
||||
};
|
||||
|
||||
onBeforeUnmount(dispose);
|
||||
|
||||
return {
|
||||
isNearBottom,
|
||||
showScrollToBottom,
|
||||
scrollToBottom,
|
||||
scrollToBottomSmooth,
|
||||
scrollToUserQuestion,
|
||||
scheduleScrollToBottom,
|
||||
setupThinkingScrollWatch,
|
||||
|
||||
@@ -38,13 +38,20 @@ import {
|
||||
shippingActionButtonClass,
|
||||
} from '../shipping';
|
||||
import {
|
||||
getWorkspaceShippingConversationBatches,
|
||||
getWorkspaceShippingBatch,
|
||||
getWorkspaceShippingTask,
|
||||
switchWorkspaceShippingBatchFocusTask,
|
||||
type ShippingBatchSummary,
|
||||
type ShippingConversationWorkspace,
|
||||
type ShippingTaskDetail,
|
||||
type ShippingTaskSummary,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
import {
|
||||
buildShortageDetailsMessage,
|
||||
hasShortageLines,
|
||||
isShippingShortageQueryIntent,
|
||||
} from '../shipping/shippingShortageDetails';
|
||||
|
||||
import type { ChatMessage, ChatSessionItem } from '../types/chat.types';
|
||||
import type { ChatUploadFileSpec, PendingAttachment } from '../types/shipping.types';
|
||||
@@ -75,6 +82,8 @@ export interface UseChatShippingOptions {
|
||||
agentId: number,
|
||||
kb: string,
|
||||
files: ChatUploadFileSpec[],
|
||||
context?: { task_id?: string; batch_no?: string; display_query?: string },
|
||||
hooks?: { onAssistantMessageFinished?: (message: ChatMessage, runMessages: ChatMessage[]) => void | Promise<void> },
|
||||
) => Promise<void>;
|
||||
buildFileSpecsForSend: () => Promise<ChatUploadFileSpec[]>;
|
||||
loadConversation: (id: string, options?: { force?: boolean }) => Promise<void>;
|
||||
@@ -114,9 +123,9 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
createNewChatView,
|
||||
} = options;
|
||||
|
||||
let invokeHandleSend: (() => Promise<void>) | null = null;
|
||||
const shippingBindSend = (fn: () => Promise<void>) => {
|
||||
invokeHandleSend = fn;
|
||||
const shippingBindSend = (_fn: () => Promise<void>) => {
|
||||
void _fn;
|
||||
// 保留旧绑定入口,续办链路已改为直接调用 sendMessage 以支持 display_query 上下文。
|
||||
};
|
||||
|
||||
// ── 功能开关与 UI refs ────────────────────────────────────
|
||||
@@ -147,16 +156,52 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
});
|
||||
const resolvedShippingTaskId = ref('');
|
||||
const resolvedShippingBatchNo = ref('');
|
||||
const activeShippingBatchNo = ref('');
|
||||
const focusedShippingTaskNo = ref('');
|
||||
const shippingConversationWorkspace = ref<ShippingConversationWorkspace | null>(null);
|
||||
const shippingBatchSummary = ref<ShippingBatchSummary | null>(null);
|
||||
const shippingBatchTasks = ref<ShippingTaskSummary[]>([]);
|
||||
const shippingBatchTasksExpanded = ref(false);
|
||||
const shippingWorkspaceOpen = ref(false);
|
||||
const retryingShippingPendingTasks = ref(false);
|
||||
const activeShippingTaskDetail = ref<ShippingTaskDetail | null>(null);
|
||||
const shippingFocusReason = ref('');
|
||||
const shippingConversationTaskIdCache = ref<Record<string, string>>({});
|
||||
const shippingInventorySchemaPreviewCache = ref<Record<string, unknown>>({});
|
||||
const autoResumedShippingTasks = ref<Record<string, boolean>>({});
|
||||
const lastConversationSyncKey = ref('');
|
||||
let shippingStatusPollTimer: ReturnType<typeof setInterval> | null = null;
|
||||
|
||||
const applyShippingBatchDetail = (
|
||||
detail: ShippingBatchSummary & { tasks?: ShippingTaskSummary[]; focus_task?: ShippingTaskSummary | null },
|
||||
fallbackBatchNo: string,
|
||||
) => {
|
||||
const normalizedBatchNo = detail.batch_no || fallbackBatchNo;
|
||||
resolvedShippingBatchNo.value = normalizedBatchNo;
|
||||
if (!activeShippingBatchNo.value || activeShippingBatchNo.value === fallbackBatchNo) {
|
||||
activeShippingBatchNo.value = normalizedBatchNo;
|
||||
}
|
||||
shippingBatchTasks.value = Array.isArray(detail.tasks) ? detail.tasks : [];
|
||||
shippingBatchSummary.value = {
|
||||
id: detail.id,
|
||||
batch_no: detail.batch_no,
|
||||
conversation_id: detail.conversation_id,
|
||||
current_focus_task_no: detail.focus_task?.task_no || detail.current_focus_task_no || null,
|
||||
file_count: detail.file_count,
|
||||
process_summary: detail.process_summary || null,
|
||||
created_at: detail.created_at,
|
||||
updated_at: detail.updated_at,
|
||||
};
|
||||
const preferredTaskNo = String(
|
||||
detail.focus_task?.task_no
|
||||
|| detail.process_summary?.current_task_no
|
||||
|| detail.current_focus_task_no
|
||||
|| '',
|
||||
).trim();
|
||||
if (preferredTaskNo) {
|
||||
resolvedShippingTaskId.value = preferredTaskNo;
|
||||
}
|
||||
};
|
||||
|
||||
const syncShippingBatchSummary = async (batchNo: string) => {
|
||||
const normalized = String(batchNo || '').trim();
|
||||
if (!normalized) {
|
||||
@@ -166,38 +211,48 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
}
|
||||
try {
|
||||
const detail = await getWorkspaceShippingBatch(normalized);
|
||||
resolvedShippingBatchNo.value = detail.batch_no || normalized;
|
||||
shippingBatchTasks.value = Array.isArray(detail.tasks) ? detail.tasks : [];
|
||||
shippingBatchSummary.value = {
|
||||
id: detail.id,
|
||||
batch_no: detail.batch_no,
|
||||
conversation_id: detail.conversation_id,
|
||||
current_focus_task_no: detail.focus_task?.task_no || detail.current_focus_task_no || null,
|
||||
file_count: detail.file_count,
|
||||
process_summary: detail.process_summary || null,
|
||||
created_at: detail.created_at,
|
||||
updated_at: detail.updated_at,
|
||||
};
|
||||
const preferredTaskNo = String(
|
||||
detail.focus_task?.task_no
|
||||
|| detail.process_summary?.current_task_no
|
||||
|| detail.current_focus_task_no
|
||||
|| '',
|
||||
).trim();
|
||||
if (preferredTaskNo) {
|
||||
resolvedShippingTaskId.value = preferredTaskNo;
|
||||
}
|
||||
applyShippingBatchDetail(detail, normalized);
|
||||
} catch {
|
||||
// ignore summary refresh failure in chat flow
|
||||
}
|
||||
};
|
||||
|
||||
const applyConversationWorkspaceFocus = (workspace: ShippingConversationWorkspace) => {
|
||||
const batches = Array.isArray(workspace.batches) ? workspace.batches : [];
|
||||
if (!batches.length) return;
|
||||
const queryBatchNo = String(shippingBatchNoFromQuery.value || '').trim();
|
||||
const currentBatchNo = String(activeShippingBatchNo.value || resolvedShippingBatchNo.value || queryBatchNo || '').trim();
|
||||
const selectedBatch = batches.find((item) => item.batch_no === currentBatchNo)
|
||||
|| (queryBatchNo ? batches.find((item) => item.batch_no === queryBatchNo) : null)
|
||||
|| batches.find((item) => item.focus_task?.task_no)
|
||||
|| batches[0];
|
||||
if (!selectedBatch) return;
|
||||
applyShippingBatchDetail(selectedBatch, selectedBatch.batch_no);
|
||||
};
|
||||
|
||||
const syncShippingConversationWorkspace = async () => {
|
||||
const localConversationId = String(conversationId.value || '').trim();
|
||||
if (!localConversationId || !isShippingNoticeAgent.value) {
|
||||
shippingConversationWorkspace.value = null;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const workspace = await getWorkspaceShippingConversationBatches(localConversationId);
|
||||
shippingConversationWorkspace.value = workspace;
|
||||
applyConversationWorkspaceFocus(workspace);
|
||||
} catch {
|
||||
shippingConversationWorkspace.value = null;
|
||||
}
|
||||
};
|
||||
|
||||
const switchShippingFocusTask = async (taskNo: string) => {
|
||||
const batchNo = getActiveShippingBatchNo();
|
||||
const normalizedTaskNo = String(taskNo || '').trim().toUpperCase();
|
||||
if (!batchNo || !normalizedTaskNo) return false;
|
||||
await switchWorkspaceShippingBatchFocusTask(batchNo, normalizedTaskNo);
|
||||
resolvedShippingTaskId.value = normalizedTaskNo;
|
||||
focusedShippingTaskNo.value = normalizedTaskNo;
|
||||
shippingFocusReason.value = t('chat.shippingNoticeUi.currentFocusDefaultReason');
|
||||
if (shippingBatchSummary.value) {
|
||||
shippingBatchSummary.value = {
|
||||
...shippingBatchSummary.value,
|
||||
@@ -205,11 +260,42 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
};
|
||||
}
|
||||
await syncShippingBatchSummary(batchNo);
|
||||
await syncShippingConversationWorkspace();
|
||||
await syncActiveShippingTaskDetail(normalizedTaskNo);
|
||||
await refreshShippingActions();
|
||||
return true;
|
||||
};
|
||||
|
||||
const clearShippingFocus = () => {
|
||||
focusedShippingTaskNo.value = '';
|
||||
shippingFocusReason.value = '';
|
||||
};
|
||||
|
||||
const switchShippingBatch = async (batchNo: string) => {
|
||||
const normalizedBatchNo = String(batchNo || '').trim();
|
||||
if (!normalizedBatchNo) return false;
|
||||
activeShippingBatchNo.value = normalizedBatchNo;
|
||||
resolvedShippingBatchNo.value = normalizedBatchNo;
|
||||
const workspaceBatch = shippingConversationWorkspace.value?.batches.find((item) => item.batch_no === normalizedBatchNo);
|
||||
if (workspaceBatch) {
|
||||
applyShippingBatchDetail(workspaceBatch, normalizedBatchNo);
|
||||
} else {
|
||||
await syncShippingBatchSummary(normalizedBatchNo);
|
||||
}
|
||||
const nextTaskNo = String(
|
||||
shippingBatchSummary.value?.current_focus_task_no
|
||||
|| shippingBatchSummary.value?.process_summary?.current_task_no
|
||||
|| shippingBatchTasks.value[0]?.task_no
|
||||
|| '',
|
||||
).trim();
|
||||
if (nextTaskNo) {
|
||||
resolvedShippingTaskId.value = nextTaskNo;
|
||||
await syncActiveShippingTaskDetail(nextTaskNo);
|
||||
}
|
||||
await refreshShippingActions();
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 清空当前聊天页绑定的发货任务上下文。
|
||||
*
|
||||
@@ -224,9 +310,14 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
shippingInventorySelectionTaskId.value = '';
|
||||
resolvedShippingTaskId.value = '';
|
||||
resolvedShippingBatchNo.value = '';
|
||||
activeShippingBatchNo.value = '';
|
||||
focusedShippingTaskNo.value = '';
|
||||
shippingFocusReason.value = '';
|
||||
shippingConversationWorkspace.value = null;
|
||||
shippingBatchSummary.value = null;
|
||||
shippingBatchTasks.value = [];
|
||||
shippingBatchTasksExpanded.value = false;
|
||||
shippingWorkspaceOpen.value = false;
|
||||
retryingShippingPendingTasks.value = false;
|
||||
activeShippingTaskDetail.value = null;
|
||||
shippingConversationTaskIdCache.value = {};
|
||||
shippingInventorySchemaPreviewCache.value = {};
|
||||
@@ -240,16 +331,31 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
|| '';
|
||||
|
||||
const getActiveShippingBatchNo = () =>
|
||||
resolvedShippingBatchNo.value
|
||||
activeShippingBatchNo.value
|
||||
|| resolvedShippingBatchNo.value
|
||||
|| shippingBatchNoFromQuery.value
|
||||
|| String(shippingBatchSummary.value?.batch_no || '').trim()
|
||||
|| '';
|
||||
|
||||
const getCurrentShippingChatContext = () => ({
|
||||
task_id: getActiveShippingTaskId(),
|
||||
task_id: getActiveBatchTaskId() || getActiveShippingTaskId(),
|
||||
batch_no: getActiveShippingBatchNo(),
|
||||
});
|
||||
|
||||
const getCurrentShippingChatContextWithDisplay = (displayQuery: string) => ({
|
||||
...getCurrentShippingChatContext(),
|
||||
display_query: displayQuery,
|
||||
});
|
||||
|
||||
const getActiveBatchTaskId = () => String(
|
||||
shippingBatchSummary.value?.current_focus_task_no
|
||||
|| shippingBatchSummary.value?.process_summary?.current_task_no
|
||||
|| shippingBatchTasks.value[0]?.task_no
|
||||
|| focusedShippingTaskNo.value
|
||||
|| resolvedShippingTaskId.value
|
||||
|| '',
|
||||
).trim();
|
||||
|
||||
const hasRunningShippingBatchTasks = () =>
|
||||
shippingBatchTasks.value.some(
|
||||
(task) => !['uploaded', 'completed', 'closed', 'rejected'].includes(String(task.process_status || '').trim()),
|
||||
@@ -269,10 +375,15 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
}
|
||||
try {
|
||||
const detail = await getWorkspaceShippingTask(normalized);
|
||||
const detailBatchNo = String(detail.batch_no || '').trim();
|
||||
const activeBatchNo = String(activeShippingBatchNo.value || '').trim();
|
||||
if (activeBatchNo && detailBatchNo && detailBatchNo !== activeBatchNo) {
|
||||
return;
|
||||
}
|
||||
activeShippingTaskDetail.value = detail;
|
||||
const batchNo = String(detail.batch_no || '').trim();
|
||||
if (batchNo && resolvedShippingBatchNo.value !== batchNo) {
|
||||
resolvedShippingBatchNo.value = batchNo;
|
||||
if (detailBatchNo && resolvedShippingBatchNo.value !== detailBatchNo) {
|
||||
resolvedShippingBatchNo.value = detailBatchNo;
|
||||
activeShippingBatchNo.value = activeShippingBatchNo.value || detailBatchNo;
|
||||
}
|
||||
} catch {
|
||||
activeShippingTaskDetail.value = null;
|
||||
@@ -313,6 +424,16 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
return '';
|
||||
};
|
||||
|
||||
const lastAssistantShippingActions = () => {
|
||||
for (let i = messages.value.length - 1; i >= 0; i -= 1) {
|
||||
const item = messages.value[i];
|
||||
if (item?.role === 'assistant' && Array.isArray(item.shipping_actions)) {
|
||||
return item.shipping_actions;
|
||||
}
|
||||
}
|
||||
return [];
|
||||
};
|
||||
|
||||
const { refreshShippingActions } = createShippingActionsRefresher({
|
||||
isShippingNoticeAgent,
|
||||
messages,
|
||||
@@ -330,6 +451,64 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
saveLocalMessageToBackend,
|
||||
});
|
||||
|
||||
/**
|
||||
* Dify SSE 完成后立即净化最后一条回复,并同步后端动作按钮。
|
||||
*
|
||||
* 核心逻辑:流式过程中只做展示层净化;终态事件到达后消息对象已经完整,
|
||||
* 此时调用统一 refreshShippingActions,把 action_buttons 回写到当前 assistant 气泡。
|
||||
*/
|
||||
const finalizeShippingAssistantMessage = async () => {
|
||||
if (!isShippingNoticeAgent.value) return;
|
||||
await refreshShippingActions();
|
||||
};
|
||||
|
||||
/**
|
||||
* 为“查询缺口明细”定位任务事实来源。
|
||||
*
|
||||
* 核心逻辑:优先使用显式任务号或当前聚焦任务,再从批次摘要/当前详情中读取;
|
||||
* 摘要缺少逐行缺口时补拉既有任务详情接口,确保聊天回复只基于后端事实数据。
|
||||
*/
|
||||
const resolveShippingTaskForShortageQuery = async (taskNo?: string) => {
|
||||
const normalizedTaskNo = String(
|
||||
taskNo
|
||||
|| focusedShippingTaskNo.value
|
||||
|| getActiveBatchTaskId()
|
||||
|| getActiveShippingTaskId()
|
||||
|| '',
|
||||
).trim().toUpperCase();
|
||||
if (!normalizedTaskNo) return null;
|
||||
const summaryTask = shippingBatchTasks.value.find(
|
||||
(item) => String(item.task_no || '').trim().toUpperCase() === normalizedTaskNo,
|
||||
);
|
||||
if (summaryTask && hasShortageLines(summaryTask)) return summaryTask;
|
||||
const detail = activeShippingTaskDetail.value;
|
||||
if (String(detail?.task_no || '').trim().toUpperCase() === normalizedTaskNo && hasShortageLines(detail)) {
|
||||
return detail;
|
||||
}
|
||||
try {
|
||||
return await getWorkspaceShippingTask(normalizedTaskNo);
|
||||
} catch {
|
||||
return summaryTask || null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 在聊天流中输出确定性的缺口明细。
|
||||
*
|
||||
* 核心逻辑:追加一条本地用户意图消息和一条本地助手事实回复,不转发给 Dify,
|
||||
* 避免大模型复述或重新计算预订单、料号与缺口数量。
|
||||
*/
|
||||
const queryShippingShortageDetails = async (taskNo?: string, displayText?: string) => {
|
||||
const task = await resolveShippingTaskForShortageQuery(taskNo);
|
||||
if (!task) {
|
||||
msg.warning(t('chat.shippingNoticeMissingTaskId'));
|
||||
return true;
|
||||
}
|
||||
await pushShippingLocalUserMessage(displayText || t('chat.shippingNoticeUi.queryShortageDetails'));
|
||||
await pushShippingLocalAssistantMessage(buildShortageDetailsMessage(task, t));
|
||||
return true;
|
||||
};
|
||||
|
||||
const { sendShippingMenuMessage } = createShippingConversationHelpers({
|
||||
conversationId,
|
||||
history,
|
||||
@@ -410,7 +589,6 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
resolvedShippingBatchNo,
|
||||
shippingBatchSummary,
|
||||
shippingBatchTasks,
|
||||
shippingBatchTasksExpanded,
|
||||
shippingInventorySelectionActive,
|
||||
shippingInventorySelectionTaskId,
|
||||
shippingInventorySchemaPreviewCache,
|
||||
@@ -422,7 +600,7 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
t,
|
||||
});
|
||||
|
||||
const { handleShippingActionClick } = createShippingMenuHandlers({
|
||||
const { handleShippingMenuAction, handleShippingActionClick } = createShippingMenuHandlers({
|
||||
isThinking,
|
||||
getActiveShippingTaskId,
|
||||
messages,
|
||||
@@ -455,6 +633,7 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
attachmentPolicy,
|
||||
getActiveShippingTaskId,
|
||||
lastAssistantMessageContent,
|
||||
lastAssistantShippingActions,
|
||||
sendMessage,
|
||||
buildFileSpecsForSend,
|
||||
loadHistory,
|
||||
@@ -464,10 +643,13 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
openShippingInventoryPicker,
|
||||
executeShippingDecision,
|
||||
executeShippingManualUpload,
|
||||
handleShippingMenuAction,
|
||||
handleShippingAutoUploadFile,
|
||||
handleShippingAutoUploadNoticeBatch,
|
||||
refreshShippingActions,
|
||||
shippingSuggestedPrompt,
|
||||
isShippingShortageQueryIntent,
|
||||
queryShippingShortageDetails,
|
||||
msg,
|
||||
t,
|
||||
});
|
||||
@@ -492,8 +674,15 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
return;
|
||||
}
|
||||
autoResumedShippingTasks.value[taskId] = true;
|
||||
input.value = t('chat.shippingNoticeContinue', { taskId });
|
||||
await invokeHandleSend?.();
|
||||
const displayText = t('chat.shippingNoticeUi.retrySingleTaskMessage', { taskId });
|
||||
await sendMessage(
|
||||
t('chat.shippingNoticeContinue', { taskId }),
|
||||
currentAgentId.value,
|
||||
selectedKb.value,
|
||||
[],
|
||||
getCurrentShippingChatContextWithDisplay(displayText),
|
||||
);
|
||||
await loadHistory();
|
||||
};
|
||||
|
||||
const onConversationIdChanging = (nextId: string, prevId: string | null | undefined) => {
|
||||
@@ -510,8 +699,8 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
/**
|
||||
* 续办指定任务,并把聊天上下文切到该任务继续推进。
|
||||
*
|
||||
* 核心逻辑:先切换批次焦点任务,再复用既有“请继续处理发货任务”提示词触发一次发送,
|
||||
* 让 Agent 基于最新 task_id/batch_no 返回下一步动作。
|
||||
* 核心逻辑:先切换批次焦点任务,再把内部续办指令发给 Agent;
|
||||
* 前端和历史只展示业务端可理解的简短重试话术,避免暴露工具名。
|
||||
* @param taskNo - 需要续办的任务编号
|
||||
* @returns 是否已成功触发续办
|
||||
*/
|
||||
@@ -520,11 +709,39 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
if (!normalizedTaskNo || !isShippingNoticeAgent.value || isThinking.value) return false;
|
||||
const switched = await switchShippingFocusTask(normalizedTaskNo);
|
||||
if (!switched) return false;
|
||||
input.value = t('chat.shippingNoticeContinue', { taskId: normalizedTaskNo });
|
||||
await invokeHandleSend?.();
|
||||
const displayText = t('chat.shippingNoticeUi.retrySingleTaskMessage', { taskId: normalizedTaskNo });
|
||||
await sendMessage(
|
||||
t('chat.shippingNoticeContinue', { taskId: normalizedTaskNo }),
|
||||
currentAgentId.value,
|
||||
selectedKb.value,
|
||||
[],
|
||||
getCurrentShippingChatContextWithDisplay(displayText),
|
||||
);
|
||||
await loadHistory();
|
||||
await refreshShippingActions();
|
||||
return true;
|
||||
};
|
||||
|
||||
const retryCurrentShippingBatchPendingTasks = async () => {
|
||||
const batchNo = getActiveShippingBatchNo();
|
||||
if (!batchNo || retryingShippingPendingTasks.value) return false;
|
||||
retryingShippingPendingTasks.value = true;
|
||||
try {
|
||||
const { retryWorkspaceShippingBatchPending } = await import('@/features/chat/api/shipping.api');
|
||||
const result = await retryWorkspaceShippingBatchPending(batchNo);
|
||||
msg.success(result.message || t('chat.shippingNoticeUi.retryPendingDone'));
|
||||
await syncShippingConversationWorkspace();
|
||||
await syncShippingBatchSummary(batchNo);
|
||||
await refreshShippingActions();
|
||||
return true;
|
||||
} catch (error) {
|
||||
msg.error(error instanceof Error ? error.message : t('chat.shippingNoticeUi.retryFailed'));
|
||||
return false;
|
||||
} finally {
|
||||
retryingShippingPendingTasks.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const onConversationLoadedEmpty = async () => {
|
||||
if (!isShippingNoticeAgent.value || !shippingTaskIdFromQuery.value || isThinking.value) return;
|
||||
const nextQuery: Record<string, string> = { task_id: shippingTaskIdFromQuery.value };
|
||||
@@ -538,8 +755,15 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
const nextQuery: Record<string, string> = { task_id: shippingTaskIdFromQuery.value };
|
||||
if (shippingBatchNoFromQuery.value) nextQuery.batch_no = shippingBatchNoFromQuery.value;
|
||||
void router.replace({ path: route.path, query: nextQuery });
|
||||
input.value = t('chat.shippingNoticeContinue', { taskId: shippingTaskIdFromQuery.value });
|
||||
await invokeHandleSend?.();
|
||||
const displayText = t('chat.shippingNoticeUi.retrySingleTaskMessage', { taskId: shippingTaskIdFromQuery.value });
|
||||
await sendMessage(
|
||||
t('chat.shippingNoticeContinue', { taskId: shippingTaskIdFromQuery.value }),
|
||||
currentAgentId.value,
|
||||
selectedKb.value,
|
||||
[],
|
||||
getCurrentShippingChatContextWithDisplay(displayText),
|
||||
);
|
||||
await loadHistory();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -555,15 +779,16 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
}
|
||||
if (!isShippingNoticeAgent.value) return;
|
||||
const batchNo = getActiveShippingBatchNo();
|
||||
const taskId = getActiveShippingTaskId();
|
||||
const taskId = getActiveBatchTaskId();
|
||||
if (!batchNo && !taskId) return;
|
||||
|
||||
shippingStatusPollTimer = setInterval(() => {
|
||||
if (!isShippingNoticeAgent.value) return;
|
||||
const nextBatchNo = getActiveShippingBatchNo();
|
||||
const nextTaskId = getActiveShippingTaskId();
|
||||
const nextTaskId = getActiveBatchTaskId();
|
||||
if (!nextBatchNo && !nextTaskId) return;
|
||||
void (async () => {
|
||||
await syncShippingConversationWorkspace();
|
||||
if (nextBatchNo) await syncShippingBatchSummary(nextBatchNo);
|
||||
if (nextTaskId) {
|
||||
await syncActiveShippingTaskDetail(nextTaskId);
|
||||
@@ -591,7 +816,7 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
});
|
||||
watch([shippingActionsWatchKey, isThinking, isShippingNoticeAgent, () => currentAgent.value?.name], () => {
|
||||
void refreshShippingActions().then(async () => {
|
||||
const taskId = getActiveShippingTaskId();
|
||||
const taskId = getActiveBatchTaskId() || getActiveShippingTaskId();
|
||||
await Promise.all([
|
||||
syncShippingParseReviewCard(taskId),
|
||||
syncActiveShippingTaskDetail(taskId),
|
||||
@@ -599,14 +824,17 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
await syncConversationMessagesIfNeeded(taskId);
|
||||
});
|
||||
});
|
||||
watch([resolvedShippingBatchNo, shippingBatchNoFromQuery], ([batchNo, queryBatchNo]) => {
|
||||
const nextBatchNo = String(batchNo || queryBatchNo || '').trim();
|
||||
watch([activeShippingBatchNo, shippingBatchNoFromQuery, resolvedShippingBatchNo], ([activeBatchNo, queryBatchNo, batchNo]) => {
|
||||
const nextBatchNo = String(activeBatchNo || queryBatchNo || batchNo || '').trim();
|
||||
if (!nextBatchNo) {
|
||||
shippingBatchSummary.value = null;
|
||||
return;
|
||||
}
|
||||
void syncShippingBatchSummary(nextBatchNo);
|
||||
}, { immediate: true });
|
||||
watch([conversationId, isShippingNoticeAgent], () => {
|
||||
void syncShippingConversationWorkspace();
|
||||
}, { immediate: true });
|
||||
watch(
|
||||
[isShippingNoticeAgent, conversationId, resolvedShippingBatchNo, shippingBatchNoFromQuery, resolvedShippingTaskId, shippingTaskIdFromQuery, isThinking],
|
||||
() => {
|
||||
@@ -634,14 +862,23 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
shippingTaskIdFromQuery,
|
||||
shippingBatchNoFromQuery,
|
||||
resolvedShippingBatchNo,
|
||||
activeShippingBatchNo,
|
||||
focusedShippingTaskNo,
|
||||
shippingFocusReason,
|
||||
shippingConversationWorkspace,
|
||||
shippingBatchSummary,
|
||||
shippingBatchTasks,
|
||||
shippingBatchTasksExpanded,
|
||||
shippingWorkspaceOpen,
|
||||
retryingShippingPendingTasks,
|
||||
activeShippingTaskDetail,
|
||||
getCurrentShippingChatContext,
|
||||
getActiveShippingBatchNo,
|
||||
switchShippingBatch,
|
||||
switchShippingFocusTask,
|
||||
clearShippingFocus,
|
||||
resumeShippingTask,
|
||||
retryCurrentShippingBatchPendingTasks,
|
||||
queryShippingShortageDetails,
|
||||
resetShippingConversationState,
|
||||
resumeShippingTaskFromQuery,
|
||||
normalizeShippingHeaderForDisplay,
|
||||
@@ -658,6 +895,7 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
removeShippingParseReviewLine,
|
||||
handleShippingActionClick,
|
||||
handleShippingInventorySelected,
|
||||
finalizeShippingAssistantMessage,
|
||||
selectShippingInventoryUploadTask,
|
||||
cancelShippingInventoryTaskSelection,
|
||||
shippingActionButtonClass,
|
||||
|
||||
@@ -26,6 +26,7 @@ export const SHIPPING_DECISION_ACTIONS = new Set([
|
||||
'confirm_inventory_mapping',
|
||||
'correct_inventory_mapping',
|
||||
'reparse_inventory',
|
||||
'retry_rpa',
|
||||
'reject',
|
||||
'reparse',
|
||||
'rematch',
|
||||
|
||||
@@ -22,6 +22,7 @@ export function createLeaveLocalMessageApi(ctx: LeaveLocalMessageContext) {
|
||||
try {
|
||||
const data = await saveLocalChatMessage({
|
||||
conversation_id: ctx.conversationId.value,
|
||||
role: chatMsg.role,
|
||||
type: chatMsg.type,
|
||||
content: chatMsg.content,
|
||||
payload: chatMsg.payload,
|
||||
|
||||
@@ -22,6 +22,7 @@ export function createChatPageLocalMessageApi(ctx: ChatPageLocalMessageContext)
|
||||
try {
|
||||
const data = await saveLocalChatMessage({
|
||||
conversation_id: ctx.conversationId.value,
|
||||
role: localMsg.role,
|
||||
type: localMsg.type,
|
||||
content: localMsg.content,
|
||||
payload: localMsg.payload,
|
||||
|
||||
@@ -25,7 +25,8 @@ export interface ChatPageSendContext {
|
||||
agentId: number,
|
||||
kb: string,
|
||||
files: ChatUploadFileSpec[],
|
||||
context?: { task_id?: string; batch_no?: string },
|
||||
context?: { task_id?: string; batch_no?: string; display_query?: string },
|
||||
hooks?: { onAssistantMessageFinished?: (message: ChatMessage, runMessages: ChatMessage[]) => void | Promise<void> },
|
||||
) => Promise<void>;
|
||||
refreshHistoryAfterSend: () => Promise<void>;
|
||||
tryHandleShippingAttachmentAutoFlow: (
|
||||
@@ -44,7 +45,8 @@ export interface ChatPageSendContext {
|
||||
msg: { warning: (text: string) => void; info: (text: string) => void };
|
||||
t: (key: string) => string;
|
||||
copiedIndex: Ref<number | null>;
|
||||
getChatContext?: () => { task_id?: string; batch_no?: string };
|
||||
getChatContext?: () => { task_id?: string; batch_no?: string; display_query?: string };
|
||||
onAssistantMessageFinished?: (message: ChatMessage, runMessages: ChatMessage[]) => void | Promise<void>;
|
||||
}
|
||||
|
||||
export function createChatPageSendApi(ctx: ChatPageSendContext) {
|
||||
@@ -98,6 +100,7 @@ export function createChatPageSendApi(ctx: ChatPageSendContext) {
|
||||
ctx.selectedKb.value,
|
||||
files,
|
||||
ctx.getChatContext?.(),
|
||||
{ onAssistantMessageFinished: ctx.onAssistantMessageFinished },
|
||||
);
|
||||
await ctx.refreshHistoryAfterSend();
|
||||
await ctx.refreshToolRunProgressAfterSend();
|
||||
|
||||
@@ -20,6 +20,7 @@ export interface ShippingConversationContext {
|
||||
agentId: number,
|
||||
kb: string,
|
||||
files: ChatUploadFileSpec[],
|
||||
context?: { task_id?: string; batch_no?: string; display_query?: string },
|
||||
) => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -40,7 +41,10 @@ export function createShippingConversationHelpers(ctx: ShippingConversationConte
|
||||
const sendShippingMenuMessage = async (message: string) => {
|
||||
const taskId = ctx.getActiveShippingTaskId();
|
||||
const text = taskId ? `${message}\n任务编号:${taskId}` : message;
|
||||
await ctx.sendMessage(text, ctx.currentAgentId.value, ctx.selectedKb.value, []);
|
||||
await ctx.sendMessage(text, ctx.currentAgentId.value, ctx.selectedKb.value, [], {
|
||||
task_id: taskId || undefined,
|
||||
display_query: message,
|
||||
});
|
||||
await ensureShippingHistorySynced(ctx);
|
||||
};
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export function formatShippingDecisionAssistantMessage(
|
||||
);
|
||||
} else if (decision === 'confirm_inventory_mapping') {
|
||||
if (String(result.checkpoint || '').trim() === 'map_ok') {
|
||||
lines.push('', '下一步:匹配库存与发货需求(match_inventory)。');
|
||||
lines.push('', '下一步:匹配库存与发货需求。');
|
||||
}
|
||||
} else if (decision === 'reparse_inventory') {
|
||||
lines.push('', '请重新上传或粘贴库存 Excel。');
|
||||
|
||||
@@ -87,14 +87,20 @@ export function isShippingGenerateExcelIntent(text: string): boolean {
|
||||
].some((pattern) => pattern.test(normalized));
|
||||
}
|
||||
|
||||
function normalizeShippingCommandText(text: string): string {
|
||||
return String(text || '')
|
||||
.trim()
|
||||
.replace(/\s+/g, '')
|
||||
.replace(/[,。!?、,.!?]/g, '')
|
||||
.toLowerCase();
|
||||
}
|
||||
|
||||
export function isShippingDownloadExcelIntent(text: string): boolean {
|
||||
const normalized = text.trim();
|
||||
const normalized = normalizeShippingCommandText(text);
|
||||
if (!normalized) return false;
|
||||
return [
|
||||
/^下载excel$/i,
|
||||
/^下载发货excel$/i,
|
||||
/下载.*excel/i,
|
||||
].some((pattern) => pattern.test(normalized));
|
||||
if (!/(excel|xlsx|表格|发货文件|发货单)/i.test(normalized)) return false;
|
||||
if (/(生成|创建|制作|重新生成|重生成)/.test(normalized)) return false;
|
||||
return /(下载|获取|取得|拿|打开|查看|导出)/.test(normalized);
|
||||
}
|
||||
|
||||
export function parseShippingTaskSwitchIntent(text: string): ShippingTaskSwitchIntent | null {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
* features/chat/shipping/shippingMenu.ts
|
||||
* 用途:发货聊天数字菜单解析、动作按钮合并与决策文本识别(纯函数)。
|
||||
* 依赖:shippingText.extractShippingActionsDirective、types/shipping.types。
|
||||
* 逻辑:useChatShippingSendHandler 在发送前调用;优先 API 按钮,其次 HTML 指令,最后内容推断。
|
||||
* 逻辑:useChatShippingSendHandler 在发送前调用;按钮只来自 API 或结构化 HTML 指令,不从自然语言正文猜测。
|
||||
*/
|
||||
import { extractShippingActionsDirective } from './shippingText';
|
||||
import { extractShippingActionsDirective, stripShippingActionListByButtons } from './shippingText';
|
||||
import type { ShippingActionButton, ShippingMenuAction } from '../types/shipping.types';
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ export function normalizeApiShippingButtons(
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并 API 按钮、HTML 指令与内容推断,得到最终 action_buttons 与 cleanedText。
|
||||
* 合并 API 按钮与 HTML 指令,得到最终 action_buttons 与 cleanedText。
|
||||
*/
|
||||
export function resolveShippingActionButtons(
|
||||
content: string,
|
||||
@@ -86,9 +86,10 @@ export function resolveShippingActionButtons(
|
||||
) {
|
||||
const directive = extractShippingActionsDirective(String(content || ''));
|
||||
if (opts?.apiResolved) {
|
||||
const buttons = normalizeApiShippingButtons(apiButtons);
|
||||
return {
|
||||
buttons: normalizeApiShippingButtons(apiButtons),
|
||||
cleanedText: directive.cleanedText,
|
||||
buttons,
|
||||
cleanedText: stripShippingActionListByButtons(directive.cleanedText, buttons),
|
||||
fromDirective: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* features/chat/shipping/shippingShortageDetails.ts
|
||||
* 用途:发货通知缺口明细的确定性格式化与查询意图识别。
|
||||
* 依赖:shipping.api 类型。
|
||||
* 逻辑:工作台按钮与聊天输入拦截共用本文件,避免把缺口数量交给 LLM 重新推理。
|
||||
*/
|
||||
import type {
|
||||
ShippingMatchLineResult,
|
||||
ShippingTaskDetail,
|
||||
ShippingTaskSummary,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
|
||||
export const isShippingShortageQueryIntent = (text: string) => {
|
||||
const value = String(text || '').trim().toLowerCase();
|
||||
if (!value) return false;
|
||||
return [
|
||||
'查询缺口',
|
||||
'缺口明细',
|
||||
'缺哪些',
|
||||
'哪个单缺',
|
||||
'哪些料缺',
|
||||
'库存缺口',
|
||||
'shortage',
|
||||
'shortages',
|
||||
].some((keyword) => value.includes(keyword));
|
||||
};
|
||||
|
||||
export const shortageLinesForTask = (task: ShippingTaskSummary | ShippingTaskDetail | null | undefined) => {
|
||||
if (!task) return [];
|
||||
if (Array.isArray(task.shortage?.lines) && task.shortage.lines.length) {
|
||||
return task.shortage.lines;
|
||||
}
|
||||
if (Array.isArray(task.line_results)) {
|
||||
return task.line_results.filter((line) => Number(line.shortage_qty || 0) > 0);
|
||||
}
|
||||
return [];
|
||||
};
|
||||
|
||||
export const hasShortageLines = (task: ShippingTaskSummary | ShippingTaskDetail | null | undefined) =>
|
||||
shortageLinesForTask(task).length > 0;
|
||||
|
||||
export const formatShippingQty = (value: unknown) => {
|
||||
const num = Number(value || 0);
|
||||
return Number.isFinite(num) ? num.toLocaleString(undefined, { maximumFractionDigits: 3 }) : '-';
|
||||
};
|
||||
|
||||
export const formatShortageLine = (
|
||||
line: ShippingMatchLineResult,
|
||||
index: number,
|
||||
t: (key: string, params?: Record<string, unknown>) => string,
|
||||
) => t('chat.shippingNoticeUi.diagnosisShortageLine', {
|
||||
index: index + 1,
|
||||
sku: line.sku || '-',
|
||||
reservationId: line.reservation_id || '-',
|
||||
required: formatShippingQty(line.required_qty),
|
||||
available: formatShippingQty(line.available_qty),
|
||||
shortage: formatShippingQty(line.shortage_qty),
|
||||
});
|
||||
|
||||
export const buildShortageDetailsMessage = (
|
||||
task: ShippingTaskSummary | ShippingTaskDetail,
|
||||
t: (key: string, params?: Record<string, unknown>) => string,
|
||||
) => {
|
||||
const lines = shortageLinesForTask(task);
|
||||
if (!lines.length) {
|
||||
return t('chat.shippingNoticeUi.shortageNoDetails', { taskId: task.task_no });
|
||||
}
|
||||
return [
|
||||
t('chat.shippingNoticeUi.shortageDetailsMessageTitle', {
|
||||
taskId: task.task_no,
|
||||
file: task.source_file_name || task.customer_name || '-',
|
||||
}),
|
||||
...lines.map((line, index) => formatShortageLine(line, index, t)),
|
||||
].join('\n');
|
||||
};
|
||||
@@ -7,14 +7,115 @@
|
||||
import { SHIPPING_INTERNAL_STATUS_TOKENS, SHIPPING_KNOWN_ACTION_ID_SET } from '@/constants/shippingNoticeActions';
|
||||
import type { ShippingActionButton, ShippingActionVariant } from '../types/shipping.types';
|
||||
|
||||
/**
|
||||
* 文本归一化用于判断 Agent 正文编号项是否重复描述了结构化按钮。
|
||||
*/
|
||||
const normalizeActionComparableText = (value: string) =>
|
||||
String(value || '')
|
||||
.toLowerCase()
|
||||
.replace(/[\s`"'“”‘’《》〈〉()()[\]{}【】|::,,.。;;、\-—_!?!?/\\]+/g, '');
|
||||
|
||||
const isNumberedActionLine = (line: string) =>
|
||||
/^\s*(?:[-*]\s*)?[1-91-9][\.\、\)::]\s*/.test(line);
|
||||
|
||||
const isActionListContextLine = (line: string) =>
|
||||
/(?:请选择操作|选择操作|操作选项|按钮)/.test(line);
|
||||
|
||||
const isActionListTailLine = (line: string) =>
|
||||
/(?:选择哪|希望.*(?:处理|执行|操作)|要.*哪一项|点击.*按钮)/.test(line);
|
||||
|
||||
/**
|
||||
* 根据后端 action_buttons 移除 Agent 正文中重复生成的编号操作列表。
|
||||
*
|
||||
* 核心逻辑:不写死具体按钮文案;只在编号行命中当前 action_buttons 的 label/message 时移除,
|
||||
* 并顺带移除相邻的“请选择操作”类上下文行。正常新链路不应依赖本兜底。
|
||||
*/
|
||||
export function stripShippingActionListByButtons(
|
||||
text: string,
|
||||
buttons: Array<Pick<ShippingActionButton, 'label' | 'message'>> | null | undefined,
|
||||
): string {
|
||||
const source = String(text || '');
|
||||
const normalizedActions = (buttons || [])
|
||||
.flatMap((button) => [button.label, button.message])
|
||||
.map((item) => normalizeActionComparableText(String(item || '')))
|
||||
.filter((item) => item.length >= 2);
|
||||
if (!normalizedActions.length) return source;
|
||||
|
||||
const lines = source.split('\n');
|
||||
const remove = new Set<number>();
|
||||
lines.forEach((line, index) => {
|
||||
if (!isNumberedActionLine(line)) return;
|
||||
const normalizedLine = normalizeActionComparableText(line);
|
||||
if (normalizedActions.some((action) => normalizedLine.includes(action) || action.includes(normalizedLine))) {
|
||||
remove.add(index);
|
||||
}
|
||||
});
|
||||
if (!remove.size) return source;
|
||||
|
||||
for (const index of Array.from(remove)) {
|
||||
for (let cursor = index - 1; cursor >= 0 && cursor >= index - 3; cursor -= 1) {
|
||||
const line = lines[cursor] || '';
|
||||
if (!line.trim()) {
|
||||
remove.add(cursor);
|
||||
continue;
|
||||
}
|
||||
if (isActionListContextLine(line)) {
|
||||
remove.add(cursor);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
for (let cursor = index + 1; cursor < lines.length && cursor <= index + 3; cursor += 1) {
|
||||
const line = lines[cursor] || '';
|
||||
if (!line.trim()) {
|
||||
remove.add(cursor);
|
||||
continue;
|
||||
}
|
||||
if (isNumberedActionLine(line)) continue;
|
||||
if (isActionListTailLine(line)) {
|
||||
remove.add(cursor);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return lines
|
||||
.filter((_, index) => !remove.has(index))
|
||||
.join('\n')
|
||||
.replace(/\n{3,}/g, '\n\n')
|
||||
.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏 Agent 回复中的内部状态 token,并将 task_id 统一为「任务编号」展示。
|
||||
*/
|
||||
export function sanitizeShippingConversationText(text: string, enabled: boolean): string {
|
||||
if (!enabled) return text;
|
||||
let result = String(text || '')
|
||||
.replace(/通过\s*(?:Hxops|HXOPS|hxops)\s*聊天区上传/gi, '在当前对话中上传')
|
||||
.replace(/在\s*(?:Hxops|HXOPS|hxops)\s*聊天区上传/gi, '在当前对话中上传')
|
||||
.replace(/(?:Hxops|HXOPS|hxops)\s*聊天区/gi, '当前对话')
|
||||
.replace(/(?:Hxops|HXOPS|hxops)\s*Chat/gi, '当前对话')
|
||||
.replace(/到\s*(?:Hxops|HXOPS|hxops)(\s*[??])?/gi, '到当前对话$1')
|
||||
.replace(/\b(?:Hxops|HXOPS|hxops)\b/g, '当前系统')
|
||||
.replace(/\btask_id\s*[::]/gi, '任务编号:')
|
||||
.replace(/\btask_id\b/gi, '任务编号');
|
||||
result = result
|
||||
.replace(/\bcreate_task\b/gi, '新建任务')
|
||||
.replace(/\bget_task_status\b/gi, '查询任务状态')
|
||||
.replace(/\bparse_notice\b/gi, '解析发货通知')
|
||||
.replace(/\bsubmit_decision\b/gi, '提交处理结果')
|
||||
.replace(/\bmatch_inventory\b/gi, '匹配库存')
|
||||
.replace(/\bgenerate_excel\b/gi, '生成发货 Excel')
|
||||
.replace(/\bgenerate_shipment_excel\b/gi, '生成发货 Excel')
|
||||
.replace(/\bupload_to_freight\b/gi, '上传货代系统')
|
||||
.replace(/\bapply_inventory_mapping\b/gi, '应用库存字段映射')
|
||||
.replace(/\bget_inventory_schema_preview\b/gi, '读取库存表头预览')
|
||||
.replace(/\bretry_rpa\b/gi, '重试库存抓取')
|
||||
.replace(/\bretry_upload\b/gi, '重试上传货代')
|
||||
.replace(/\bstructured\b/gi, '结构化内容')
|
||||
.replace(/\braw_text\b/gi, '通知原文');
|
||||
result = result.replace(/[((]\s*显示\s*[「"'`][^"'`]+[」"'`]\s*[))]/g, '');
|
||||
result = result.replace(
|
||||
/\b(process_status|pending_human_reason|review_status|checkpoint|match_status|human_options)\s*[::=]\s*[「"'`]?[\w.-]+[「"'`]?/gi,
|
||||
|
||||
@@ -37,6 +37,8 @@ export interface ShippingDecisionContext {
|
||||
* @returns 人工决策与手工上传确认处理函数
|
||||
*/
|
||||
export function createShippingDecisionHandlers(ctx: ShippingDecisionContext) {
|
||||
const manualUploadInFlightTaskIds = new Set<string>();
|
||||
|
||||
const syncHistoryIfNeeded = async () => {
|
||||
if (!ctx.conversationId.value && ctx.history.value.length === 0) {
|
||||
await ctx.loadHistory();
|
||||
@@ -108,17 +110,21 @@ export function createShippingDecisionHandlers(ctx: ShippingDecisionContext) {
|
||||
};
|
||||
|
||||
const executeShippingManualUpload = async (taskId: string, displayText?: string) => {
|
||||
const normalizedTaskId = String(taskId || '').trim().toUpperCase();
|
||||
if (!normalizedTaskId || manualUploadInFlightTaskIds.has(normalizedTaskId)) return false;
|
||||
manualUploadInFlightTaskIds.add(normalizedTaskId);
|
||||
try {
|
||||
const result = await markWorkspaceShippingManualUploaded(taskId);
|
||||
const userText = (displayText || '已在货代系统手工上传完成').trim();
|
||||
const assistantContent = [
|
||||
String(result.message || '已标记为手工上传货代系统完成。').trim(),
|
||||
`任务编号:${taskId}`,
|
||||
].join('\n');
|
||||
const result = await markWorkspaceShippingManualUploaded(normalizedTaskId);
|
||||
const userText = (displayText || '我已在货代系统完成上传').trim();
|
||||
const assistantContent = String(
|
||||
result.message || `好的,任务 ${normalizedTaskId} 已确认完成,无需再处理。`,
|
||||
).trim();
|
||||
const lastUserMessage = [...ctx.messages.value].reverse().find((item) => item.role === 'user');
|
||||
const shouldAppendUser = String(lastUserMessage?.content || '').trim() !== userText;
|
||||
const userMsg: ChatMessage = {
|
||||
role: 'user',
|
||||
type: 'text',
|
||||
content: `${userText}\n任务编号:${taskId}`,
|
||||
content: userText,
|
||||
local_id: ctx.newLocalMessageId('shipping-user'),
|
||||
local_only: true,
|
||||
};
|
||||
@@ -130,14 +136,19 @@ export function createShippingDecisionHandlers(ctx: ShippingDecisionContext) {
|
||||
local_only: true,
|
||||
shipping_actions_used: true,
|
||||
};
|
||||
ctx.messages.value.push(userMsg, assistantMsg);
|
||||
if (shouldAppendUser) {
|
||||
ctx.messages.value.push(userMsg);
|
||||
}
|
||||
ctx.messages.value.push(assistantMsg);
|
||||
ctx.messages.value.forEach((rawMsg) => {
|
||||
const m = rawMsg as ChatMessage & { shipping_actions?: unknown };
|
||||
if (m.role === 'assistant') {
|
||||
m.shipping_actions = undefined;
|
||||
}
|
||||
});
|
||||
await ctx.saveLocalMessageToBackend(userMsg, userText);
|
||||
if (shouldAppendUser) {
|
||||
await ctx.saveLocalMessageToBackend(userMsg, userText);
|
||||
}
|
||||
await ctx.saveLocalMessageToBackend(assistantMsg, userText);
|
||||
void ctx.refreshShippingActions();
|
||||
return true;
|
||||
@@ -145,6 +156,8 @@ export function createShippingDecisionHandlers(ctx: ShippingDecisionContext) {
|
||||
const errorMessage = e instanceof Error ? e.message : '标记手工上传失败';
|
||||
ctx.msg.warning(errorMessage);
|
||||
return false;
|
||||
} finally {
|
||||
manualUploadInFlightTaskIds.delete(normalizedTaskId);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import {
|
||||
generateWorkspaceShippingExcel,
|
||||
matchWorkspaceShippingInventory,
|
||||
retryWorkspaceShippingUpload,
|
||||
type ShippingDecisionResponse,
|
||||
type ShippingMatchLineResult,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
@@ -71,7 +72,8 @@ export function createShippingMenuHandlers(ctx: ShippingMenuHandlerContext) {
|
||||
) => {
|
||||
if (ctx.isThinking.value) return;
|
||||
if (action.id === 'refresh') {
|
||||
await ctx.sendShippingMenuMessage(action.message || '刷新');
|
||||
await ctx.refreshShippingActions();
|
||||
ctx.msg.info(ctx.t('chat.shippingNoticeRefreshDone'));
|
||||
return;
|
||||
}
|
||||
if (action.id === 'download_excel') {
|
||||
@@ -125,6 +127,41 @@ export function createShippingMenuHandlers(ctx: ShippingMenuHandlerContext) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (action.id === 'retry_upload') {
|
||||
if (chatMsg?.shipping_actions_used) return;
|
||||
if (chatMsg) chatMsg.shipping_actions_used = true;
|
||||
const taskId = ctx.getActiveShippingTaskId();
|
||||
if (!taskId) {
|
||||
ctx.msg.warning(ctx.t('chat.shippingNoticeMissingTaskId'));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const result = await retryWorkspaceShippingUpload(taskId);
|
||||
const userText = action.message || ctx.t('chat.shippingNoticeRetryUploadAction');
|
||||
const userMsg: ChatMessage = {
|
||||
role: 'user',
|
||||
type: 'text',
|
||||
content: `${userText}\n任务编号:${taskId}`,
|
||||
local_id: ctx.newLocalMessageId('shipping-user'),
|
||||
local_only: true,
|
||||
};
|
||||
const assistantMsg: ChatMessage = {
|
||||
role: 'assistant',
|
||||
type: 'text',
|
||||
content: String(result.message || ctx.t('chat.shippingNoticeRetryUploadQueued')).trim(),
|
||||
local_id: ctx.newLocalMessageId('shipping-assistant'),
|
||||
local_only: true,
|
||||
};
|
||||
ctx.messages.value.push(userMsg, assistantMsg);
|
||||
await ctx.saveLocalMessageToBackend(userMsg, userText);
|
||||
await ctx.saveLocalMessageToBackend(assistantMsg, userText);
|
||||
void ctx.refreshShippingActions();
|
||||
} catch (e: unknown) {
|
||||
const errorMessage = e instanceof Error ? e.message : ctx.t('chat.shippingNoticeRetryUploadFailed');
|
||||
ctx.msg.warning(errorMessage);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (action.id === 'edit_inventory_mapping') {
|
||||
const taskId = ctx.getActiveShippingTaskId();
|
||||
if (!taskId) {
|
||||
@@ -175,13 +212,16 @@ export function createShippingMenuHandlers(ctx: ShippingMenuHandlerContext) {
|
||||
}
|
||||
if (action.id === 'mark_manual_uploaded') {
|
||||
if (chatMsg?.shipping_actions_used) return;
|
||||
if (chatMsg) chatMsg.shipping_actions_used = true;
|
||||
if (chatMsg) {
|
||||
chatMsg.shipping_actions_used = true;
|
||||
chatMsg.shipping_actions = undefined;
|
||||
}
|
||||
const taskId = ctx.getActiveShippingTaskId();
|
||||
if (!taskId) {
|
||||
ctx.msg.warning(ctx.t('chat.shippingNoticeMissingTaskId'));
|
||||
return;
|
||||
}
|
||||
await ctx.executeShippingManualUpload(taskId, action.message || '已在货代系统手工上传完成');
|
||||
await ctx.executeShippingManualUpload(taskId, '我已在货代系统完成上传');
|
||||
return;
|
||||
}
|
||||
if (action.id === 'paste_inventory_json') {
|
||||
|
||||
@@ -77,36 +77,11 @@ export function createShippingActionsRefresher(ctx: ShippingRefreshContext) {
|
||||
taskId = taskNo;
|
||||
}
|
||||
} catch {
|
||||
// fall back to content-based buttons
|
||||
// fall back to structured directive buttons embedded in the message
|
||||
}
|
||||
}
|
||||
}
|
||||
if (taskId) ctx.resolvedShippingTaskId.value = taskId;
|
||||
let apiButtons: Array<{ id: string; label: string; message: string; variant?: string }> | null = null;
|
||||
let apiCheckpoint: string | null = null;
|
||||
let apiResolved = false;
|
||||
if (taskId && !ctx.isThinking.value) {
|
||||
const seq = ++shippingActionsRequestSeq;
|
||||
try {
|
||||
const data = await getShippingChatActions(taskId);
|
||||
if (seq === shippingActionsRequestSeq) {
|
||||
apiResolved = true;
|
||||
apiCheckpoint = data.checkpoint ? String(data.checkpoint) : null;
|
||||
apiButtons = data.action_buttons?.length ? data.action_buttons : null;
|
||||
}
|
||||
} catch {
|
||||
// fall back to content-based buttons
|
||||
}
|
||||
}
|
||||
if (apiResolved && apiCheckpoint && SHIPPING_TERMINAL_CHECKPOINTS.has(apiCheckpoint)) {
|
||||
msgs.forEach((rawMsg) => {
|
||||
const m = rawMsg as ChatMessage & { shipping_actions?: unknown };
|
||||
if (m.role === 'assistant') {
|
||||
m.shipping_actions = undefined;
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
let lastOpenAssistantIndex = -1;
|
||||
for (let i = msgs.length - 1; i >= 0; i -= 1) {
|
||||
const item = msgs[i];
|
||||
@@ -124,6 +99,42 @@ export function createShippingActionsRefresher(ctx: ShippingRefreshContext) {
|
||||
}
|
||||
}
|
||||
const targetAssistantIndex = lastOpenAssistantIndex >= 0 ? lastOpenAssistantIndex : lastAssistantIndex;
|
||||
if (targetAssistantIndex >= 0) {
|
||||
const target = msgs[targetAssistantIndex] as ChatMessage & { shipping_actions?: ShippingActionButton[] };
|
||||
const resolved = resolveShippingActionButtons(String(target.content || ''), null);
|
||||
if (resolved.cleanedText !== String(target.content || '').trim()) {
|
||||
target.content = resolved.cleanedText;
|
||||
}
|
||||
if (resolved.buttons.length && !target.shipping_actions?.length) {
|
||||
target.shipping_actions = resolved.buttons;
|
||||
}
|
||||
}
|
||||
|
||||
let apiButtons: Array<{ id: string; label: string; message: string; variant?: string }> | null = null;
|
||||
let apiCheckpoint: string | null = null;
|
||||
let apiResolved = false;
|
||||
if (taskId) {
|
||||
const seq = ++shippingActionsRequestSeq;
|
||||
try {
|
||||
const data = await getShippingChatActions(taskId);
|
||||
if (seq === shippingActionsRequestSeq) {
|
||||
apiResolved = true;
|
||||
apiCheckpoint = data.checkpoint ? String(data.checkpoint) : null;
|
||||
apiButtons = data.action_buttons?.length ? data.action_buttons : null;
|
||||
}
|
||||
} catch {
|
||||
// keep structured directive buttons if present
|
||||
}
|
||||
}
|
||||
if (apiResolved && apiCheckpoint && SHIPPING_TERMINAL_CHECKPOINTS.has(apiCheckpoint)) {
|
||||
msgs.forEach((rawMsg) => {
|
||||
const m = rawMsg as ChatMessage & { shipping_actions?: unknown };
|
||||
if (m.role === 'assistant') {
|
||||
m.shipping_actions = undefined;
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
msgs.forEach((rawMsg, index) => {
|
||||
const chatMsg = rawMsg as ChatMessage & {
|
||||
shipping_actions_used?: boolean;
|
||||
@@ -147,7 +158,7 @@ export function createShippingActionsRefresher(ctx: ShippingRefreshContext) {
|
||||
apiResolved ? (apiButtons ?? []) : null,
|
||||
{ apiResolved },
|
||||
);
|
||||
if (resolved.fromDirective) {
|
||||
if (resolved.fromDirective || resolved.cleanedText !== String(chatMsg.content || '').trim()) {
|
||||
chatMsg.content = resolved.cleanedText;
|
||||
}
|
||||
buttons = resolved.buttons;
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
getWorkspaceShippingBatch,
|
||||
switchWorkspaceShippingBatchFocusTask,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
import { SHIPPING_MENU_ACTION_SPECS } from '../constants/shipping';
|
||||
import { SHIPPING_DECISION_ACTIONS, SHIPPING_MENU_ACTION_SPECS } from '../constants/shipping';
|
||||
import { buildShippingFieldAlignmentText } from './shippingMapping';
|
||||
import { downloadWorkspaceShippingExcelFile } from './shippingDownload';
|
||||
import {
|
||||
@@ -45,6 +45,7 @@ export interface ShippingSendHandlerContext {
|
||||
attachmentPolicy: ComputedRef<{ anyEnabled: boolean }>;
|
||||
getActiveShippingTaskId: () => string;
|
||||
lastAssistantMessageContent: () => string;
|
||||
lastAssistantShippingActions: () => ChatMessage['shipping_actions'];
|
||||
sendMessage: (
|
||||
content: string,
|
||||
agentId: number,
|
||||
@@ -59,10 +60,13 @@ export interface ShippingSendHandlerContext {
|
||||
openShippingInventoryPicker: () => boolean;
|
||||
executeShippingDecision: (decision: string, displayText?: string) => Promise<boolean>;
|
||||
executeShippingManualUpload: (taskId: string, displayText?: string) => Promise<boolean>;
|
||||
handleShippingMenuAction: (action: { id?: string; message: string }) => Promise<void>;
|
||||
handleShippingAutoUploadFile: (file: File) => Promise<void>;
|
||||
handleShippingAutoUploadNoticeBatch: (files: File[]) => Promise<void>;
|
||||
refreshShippingActions: () => Promise<void>;
|
||||
shippingSuggestedPrompt: ComputedRef<string>;
|
||||
isShippingShortageQueryIntent: (text: string) => boolean;
|
||||
queryShippingShortageDetails: (taskNo?: string, displayText?: string) => Promise<boolean>;
|
||||
msg: { warning: (text: string) => void; info: (text: string) => void };
|
||||
t: (key: string) => string;
|
||||
}
|
||||
@@ -128,6 +132,7 @@ export function createShippingSendHandlers(ctx: ShippingSendHandlerContext) {
|
||||
if (!(ctx.shippingAutoFlowRequested.value || !trimmed)) return false;
|
||||
if (!ctx.isShippingNoticeAgent.value || ctx.attachments.value.length === 0) return false;
|
||||
if (ctx.isThinking.value || ctx.isUploadingAttachments.value) return false;
|
||||
const requestedAutoFlow = ctx.shippingAutoFlowRequested.value;
|
||||
ctx.shippingAutoFlowRequested.value = false;
|
||||
const localFiles = ctx.attachments.value.filter((a) => a.kind === 'local') as Array<Extract<PendingAttachment, { kind: 'local' }>>;
|
||||
const first = localFiles[0];
|
||||
@@ -152,12 +157,10 @@ export function createShippingSendHandlers(ctx: ShippingSendHandlerContext) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!trimmed) {
|
||||
if (!trimmed || requestedAutoFlow) {
|
||||
if (typeof textOrEvent !== 'string') ctx.input.value = '';
|
||||
ctx.attachments.value = [];
|
||||
try {
|
||||
const prompt = ctx.shippingSuggestedPrompt.value || '解析发货通知并创建任务';
|
||||
await ctx.pushShippingLocalUserMessage(prompt);
|
||||
await ctx.handleShippingAutoUploadNoticeBatch(localFiles.map((item) => item.file));
|
||||
} catch (e: unknown) {
|
||||
const errorMessage = e instanceof Error ? e.message : '文件处理失败';
|
||||
@@ -174,12 +177,31 @@ export function createShippingSendHandlers(ctx: ShippingSendHandlerContext) {
|
||||
_trimmed: string,
|
||||
): Promise<boolean> => {
|
||||
if (!ctx.isShippingNoticeAgent.value) return false;
|
||||
if (ctx.isShippingShortageQueryIntent(content)) {
|
||||
if (typeof textOrEvent !== 'string') ctx.input.value = '';
|
||||
ctx.attachments.value = [];
|
||||
return ctx.queryShippingShortageDetails(undefined, content.trim());
|
||||
}
|
||||
if (await trySwitchShippingTask(content)) {
|
||||
if (typeof textOrEvent !== 'string') ctx.input.value = '';
|
||||
ctx.attachments.value = [];
|
||||
return true;
|
||||
}
|
||||
const assistantCtx = ctx.lastAssistantMessageContent();
|
||||
const numericText = content.trim();
|
||||
if (/^[1-91-9](?:[\.\、\)::]?)$/.test(numericText)) {
|
||||
const num = Number.isFinite(Number(numericText.charAt(0)))
|
||||
? Number(numericText.charAt(0))
|
||||
: '0123456789'.indexOf(numericText.charAt(0));
|
||||
const actions = ctx.lastAssistantShippingActions() || [];
|
||||
const action = num >= 1 ? actions[num - 1] : undefined;
|
||||
if (action) {
|
||||
if (typeof textOrEvent !== 'string') ctx.input.value = '';
|
||||
ctx.attachments.value = [];
|
||||
await ctx.handleShippingMenuAction(action);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const menuChoice = resolveShippingNumericChoice(content, assistantCtx);
|
||||
if (menuChoice) {
|
||||
if (typeof textOrEvent !== 'string') ctx.input.value = '';
|
||||
@@ -188,6 +210,10 @@ export function createShippingSendHandlers(ctx: ShippingSendHandlerContext) {
|
||||
} else if (menuChoice === 'paste') {
|
||||
ctx.msg.info(ctx.t('chat.shippingNoticePasteHint'));
|
||||
return true;
|
||||
} else if (SHIPPING_DECISION_ACTIONS.has(menuChoice)) {
|
||||
const spec = SHIPPING_MENU_ACTION_SPECS[menuChoice];
|
||||
await ctx.executeShippingDecision(menuChoice, spec?.label || spec?.message || menuChoice);
|
||||
return true;
|
||||
} else {
|
||||
await ctx.sendShippingMenuMessage(SHIPPING_MENU_ACTION_SPECS[menuChoice].message);
|
||||
return true;
|
||||
|
||||
@@ -28,7 +28,6 @@ export interface ShippingUploadHandlerContext {
|
||||
resolvedShippingBatchNo: Ref<string>;
|
||||
shippingBatchSummary: Ref<unknown | null>;
|
||||
shippingBatchTasks: Ref<ShippingTaskSummary[]>;
|
||||
shippingBatchTasksExpanded: Ref<boolean>;
|
||||
shippingInventorySelectionActive: Ref<boolean>;
|
||||
shippingInventorySelectionTaskId: Ref<string>;
|
||||
shippingInventorySchemaPreviewCache: Ref<Record<string, unknown>>;
|
||||
@@ -270,8 +269,8 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
|
||||
| undefined;
|
||||
if (!first) return '';
|
||||
const kind = classifyShippingUploadFile(first.file, extractExt);
|
||||
if (kind === 'inventory') return '上传库存并进入字段对齐';
|
||||
return '解析发货通知并创建任务';
|
||||
if (kind === 'inventory') return ctx.t('chat.shippingNoticePrompt.notice.autoInventoryAction');
|
||||
return ctx.t('chat.shippingNoticePrompt.notice.autoNoticeAction');
|
||||
});
|
||||
|
||||
const useShippingSuggestedPrompt = () => {
|
||||
|
||||
@@ -22,9 +22,12 @@ export interface ShippingTaskSummary {
|
||||
upload_mode?: string | null;
|
||||
upload_attempt?: number | null;
|
||||
pending_human_reason?: string | null;
|
||||
error_message?: string | null;
|
||||
conversation_id?: string | null;
|
||||
export_file_name?: string | null;
|
||||
freight_ref_no?: string | null;
|
||||
shortage?: ShippingShortageSummary | null;
|
||||
line_results?: ShippingMatchLineResult[];
|
||||
step_payload?: Record<string, unknown> & {
|
||||
current_step_progress?: ShippingCurrentStepProgress;
|
||||
};
|
||||
@@ -131,6 +134,27 @@ export interface ShippingBatchSummary {
|
||||
updated_at?: string | null;
|
||||
}
|
||||
|
||||
export interface ShippingConversationWorkspaceSummary {
|
||||
batch_count: number;
|
||||
total: number;
|
||||
completed: number;
|
||||
running: number;
|
||||
failed: number;
|
||||
needs_human: number;
|
||||
pending: number;
|
||||
}
|
||||
|
||||
export interface ShippingConversationBatch extends ShippingBatchSummary {
|
||||
tasks: ShippingTaskSummary[];
|
||||
focus_task?: ShippingTaskSummary | null;
|
||||
}
|
||||
|
||||
export interface ShippingConversationWorkspace {
|
||||
conversation_id: string;
|
||||
summary: ShippingConversationWorkspaceSummary;
|
||||
batches: ShippingConversationBatch[];
|
||||
}
|
||||
|
||||
export interface ShippingInventoryUploadResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"defaultTitle": "Chat",
|
||||
"assistantLabel": "HXOPS AI Assistant",
|
||||
"assistantLabel": "AI Assistant",
|
||||
"placeholder": "Ask anything...",
|
||||
"history": "Chat History",
|
||||
"noHistory": "No history",
|
||||
@@ -13,13 +13,18 @@
|
||||
"loadingAgent": "Loading agent...",
|
||||
"thinking": "Generating response...",
|
||||
"disclaimer": "AI can make mistakes. Please verify important information.",
|
||||
"scrollToLatest": "Scroll to latest message",
|
||||
"createNewChat": "New Chat",
|
||||
"shippingNoticeContinue": "Please continue shipping task {taskId}. Call get_task_status first and tell me the next step.",
|
||||
"shippingNoticeContinue": "Please continue shipping task {taskId}. Read the current task status first; if it still needs parsing, parse the shipping notice and save the result; otherwise explain the current progress and next step.",
|
||||
"shippingNoticeActionsHint": "Choose an action:",
|
||||
"shippingNoticeMissingTaskId": "Task ID not found. Complete shipping notice parsing first.",
|
||||
"shippingNoticeUploadDone": "Inventory file uploaded: {fileName}.",
|
||||
"shippingNoticeUploadOk": "Upload succeeded.",
|
||||
"shippingNoticeUploadFailed": "Inventory upload failed.",
|
||||
"shippingNoticeRefreshDone": "Current task status refreshed.",
|
||||
"shippingNoticeRetryUploadAction": "Retry freight upload",
|
||||
"shippingNoticeRetryUploadQueued": "Upload has been triggered again. Refresh later to check the result.",
|
||||
"shippingNoticeRetryUploadFailed": "Retry upload failed.",
|
||||
"shippingNoticePasteHint": "Paste inventory rows in the input box, then send.",
|
||||
"shippingNoticeDecisionDone": "Action completed.",
|
||||
"shippingNoticePrompt": {
|
||||
@@ -41,8 +46,10 @@
|
||||
"batchLabel": "batch {batchNo}",
|
||||
"taskLabel": "current task {taskId}",
|
||||
"taskList": "Task list: {taskIds}.",
|
||||
"multiTask": "{summary}. {taskListText}Please only handle the current focus task. First call get_task_status to read the current task status; if the current task is still pending parsing, read raw_text, use the LLM to extract structured fields, then call parse_notice(structured=...) to persist them. If the task is already in a later step, directly explain the current status and guide me on the next step for this task. Do not ask me again whether parsing should start, and do not loop through other tasks in the batch.",
|
||||
"singleTask": "{summary}. Please first call get_task_status to read the current task status; if the current task is still pending parsing, read raw_text, use the LLM to extract structured fields, and directly call parse_notice(structured=...) to persist them. If the task is already in a later step, directly explain the current status and guide me on the next step. Do not ask me again whether parsing should start now."
|
||||
"autoInventoryAction": "Upload inventory and align columns",
|
||||
"autoNoticeAction": "Create tasks and parse shipping notices",
|
||||
"multiTask": "{summary}. {taskListText}Please only handle the current focus task. Read the current task status first; if it still needs parsing, parse the shipping notice and save the result. If it is already in a later step, explain the current progress and next step directly. Do not ask me again whether parsing should start, and do not loop through other tasks in the batch.",
|
||||
"singleTask": "{summary}. Read the current task status first; if it still needs parsing, parse the shipping notice and save the result. If it is already in a later step, explain the current progress and next step directly. Do not ask me again whether parsing should start."
|
||||
}
|
||||
},
|
||||
"shippingNoticeMapping": {
|
||||
@@ -104,17 +111,79 @@
|
||||
"batchProgress": "Item {index}/{total}",
|
||||
"batchCurrentIndex": "Currently processing item {index}/{total}",
|
||||
"batchSummaryLine": "Batch {total} items · Completed {completed} · In progress {running} · Pending {pending}",
|
||||
"conversationWorkspaceTitle": "Agent session execution summary",
|
||||
"conversationSummaryLine": "{batches} batches · {total} tasks · {completed} completed · {running} running · {abnormal} need intervention",
|
||||
"batchChromeSummary": "{total} tasks, {completed} done, {running} running, {abnormal} need intervention",
|
||||
"agentExecutionSummary": "Agent execution summary",
|
||||
"workspaceSubtitle": "{batches} batches · {total} tasks, {completed} completed, {abnormal} need intervention",
|
||||
"noBlockingTasks": "No blocking tasks in the current batch. It is completed or being archived automatically.",
|
||||
"focusTaskRecommendation": "Focus this task first, confirm the blocker, then continue recovery within the batch.",
|
||||
"focusThisTask": "Fix this task",
|
||||
"showWorkspace": "Batch workspace",
|
||||
"hideWorkspace": "Hide workspace",
|
||||
"batchWorkspaceTitle": "Batch workspace",
|
||||
"batchWorkspaceSubtitle": "Switch batches, filter tasks, and diagnose steps",
|
||||
"batchActionsTitle": "Batch actions",
|
||||
"retryFailedTasks": "Retry all failed",
|
||||
"batchActionSafetyNotice": "Human-review tasks are not retried in bulk; completed tasks are not uploaded again. Batch recovery only handles failed or queued tasks.",
|
||||
"taskDetailCount": "Task details ({count})",
|
||||
"filterAll": "All",
|
||||
"filterAbnormal": "Abnormal ({count})",
|
||||
"filterCompleted": "Done ({count})",
|
||||
"emptyFilteredTasks": "No matching tasks",
|
||||
"focusRepair": "Focus repair",
|
||||
"queryShortageDetails": "Query shortage details",
|
||||
"retrySingleTask": "Retry single task",
|
||||
"retrySingleTaskMessage": "Retry current task {taskId}",
|
||||
"viewDetail": "View details",
|
||||
"mobileWorkspaceHint": "The workspace is open on mobile. Pick a task from the list to continue.",
|
||||
"diagnosisAdviceRetryOrFocus": "Focus this task first to inspect context; retry only if it is a transient external-system failure.",
|
||||
"diagnosisUploadFailedTitle": "Freight-system upload failed and no success receipt was returned.",
|
||||
"diagnosisUploadFailedAdvice": "Retry this task. If it keeps failing, check freight login state, field formats, or upload manually.",
|
||||
"diagnosisShortageTitle": "Inventory matching found a shortage, so full shipment cannot continue directly.",
|
||||
"diagnosisShortageAdvice": "Shipment is blocked. Replenish inventory or correct the notice, then match inventory again.",
|
||||
"diagnosisShortageLine": "Line {index}: reservation {reservationId}, SKU {sku}, required {required}, available {available}, shortage {shortage}",
|
||||
"diagnosisShortageAdviceWithLines": "Shortage details: {lines}. Replenish inventory or correct the notice, then match again.",
|
||||
"shortageDetailsMessageTitle": "Inventory shortage details for task {taskId} ({file}):",
|
||||
"shortageNoDetails": "No inventory shortage was found for task {taskId}.",
|
||||
"diagnosisInventoryRpaTitle": "Inventory RPA did not return an available inventory snapshot.",
|
||||
"diagnosisInventoryRpaAdvice": "Retry inventory capture first; if the external system is unavailable, upload an inventory file manually.",
|
||||
"diagnosisAlignReviewTitle": "Inventory column mapping needs manual confirmation.",
|
||||
"diagnosisAlignReviewAdvice": "Confirm SKU, Reservation ID, and available-quantity mappings to avoid matching the wrong item.",
|
||||
"diagnosisParseReviewTitle": "Notice parsing confidence is low and needs review.",
|
||||
"diagnosisParseReviewAdvice": "Check customer, PO, required date, and order lines before continuing.",
|
||||
"diagnosisReservationRequiredTitle": "Reservation ID is missing, so inventory cannot be locked by reservation.",
|
||||
"diagnosisReservationRequiredAdvice": "Add the Reservation ID, or confirm this customer can proceed without one.",
|
||||
"diagnosisInventoryWaitingTitle": "Waiting for inventory file or inventory entry confirmation.",
|
||||
"diagnosisInventoryWaitingAdvice": "Upload the batch inventory snapshot or confirm the automatic capture entry.",
|
||||
"diagnosisCompletedTitle": "Task is completed and archived.",
|
||||
"diagnosisCompletedAdvice": "No action required; review export files or upload receipts if needed.",
|
||||
"diagnosisStepWaitingTitle": "Step {step} is waiting for a prerequisite.",
|
||||
"diagnosisStepWaitingAdvice": "Monitor it in the workspace, or focus this task to inspect context.",
|
||||
"currentTaskDiagnosis": "Current task diagnosis",
|
||||
"currentTaskPosition": "Item {index}/{total}",
|
||||
"batchTabAbnormal": "{completed} completed · {abnormal} abnormal",
|
||||
"batchTabNormal": "{total} tasks normal",
|
||||
"interventionQueue": "Needs intervention",
|
||||
"needsIntervention": "Needs intervention",
|
||||
"currentNotice": "Current notice",
|
||||
"currentStepLabel": "Current",
|
||||
"stepHeadline": "Step {current}/{total} · {label}",
|
||||
"stepFraction": "Step {current}/{total}",
|
||||
"stepNeedsConfirm": "Step {step} needs confirmation",
|
||||
"taskListResume": "Task List / Resume",
|
||||
"retryPendingTasks": "Retry recoverable tasks in current batch",
|
||||
"retryPendingDone": "Recoverable tasks have been resubmitted",
|
||||
"retryFailed": "Retry failed",
|
||||
"retrying": "Retrying...",
|
||||
"taskListTitle": "Task List",
|
||||
"taskListHint": "Switching tasks also updates the top Stepper and available actions",
|
||||
"expandTaskList": "Expand list",
|
||||
"collapseTaskList": "Collapse list",
|
||||
"currentFocus": "Current focus →",
|
||||
"expandTaskList": "Expand task list",
|
||||
"collapseTaskList": "Collapse task list",
|
||||
"currentFocus": "Current focus:",
|
||||
"currentFocusDefaultReason": "Input will apply to this task",
|
||||
"focusInputPlaceholder": "Handling {taskId}. Type an instruction...",
|
||||
"clearFocus": "Clear focus",
|
||||
"runningState": "In progress",
|
||||
"pendingState": "Pending",
|
||||
"completedState": "Completed",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"defaultTitle": "แชท",
|
||||
"assistantLabel": "ผู้ช่วย AI ของ HXOPS",
|
||||
"assistantLabel": "ผู้ช่วย AI",
|
||||
"placeholder": "ถามอะไรก็ได้...",
|
||||
"history": "ประวัติการแชท",
|
||||
"noHistory": "ไม่มีประวัติ",
|
||||
@@ -13,13 +13,18 @@
|
||||
"loadingAgent": "กำลังโหลดตัวแทน...",
|
||||
"thinking": "กำลังสร้างคำตอบ...",
|
||||
"disclaimer": "AI อาจทำผิดพลาดได้ โปรดตรวจสอบข้อมูลสำคัญ",
|
||||
"scrollToLatest": "เลื่อนไปยังข้อความล่าสุด",
|
||||
"createNewChat": "แชทใหม่",
|
||||
"shippingNoticeContinue": "กรุณาดำเนินการงานจัดส่งต่อ {taskId} โปรดเรียก get_task_status ก่อนและบอกขั้นตอนถัดไป",
|
||||
"shippingNoticeContinue": "กรุณาดำเนินการงานจัดส่งต่อ {taskId} โปรดอ่านสถานะงานปัจจุบันก่อน หากยังต้องแยกข้อมูล ให้แยกใบแจ้งส่งสินค้าและบันทึกผลลัพธ์ มิฉะนั้นให้สรุปความคืบหน้าและขั้นตอนถัดไป",
|
||||
"shippingNoticeActionsHint": "เลือกการทำงาน:",
|
||||
"shippingNoticeMissingTaskId": "ไม่พบรหัสงาน โปรดแยกใบแจ้งส่งสินค้าก่อน",
|
||||
"shippingNoticeUploadDone": "อัปโหลดไฟล์สต็อกแล้ว: {fileName}",
|
||||
"shippingNoticeUploadOk": "อัปโหลดสำเร็จ",
|
||||
"shippingNoticeUploadFailed": "อัปโหลดไฟล์สต็อกล้มเหลว",
|
||||
"shippingNoticeRefreshDone": "รีเฟรชสถานะงานปัจจุบันแล้ว",
|
||||
"shippingNoticeRetryUploadAction": "ลองอัปโหลดไปยังระบบขนส่งอีกครั้ง",
|
||||
"shippingNoticeRetryUploadQueued": "เริ่มอัปโหลดอีกครั้งแล้ว โปรดรีเฟรชภายหลังเพื่อตรวจสอบผลลัพธ์",
|
||||
"shippingNoticeRetryUploadFailed": "ลองอัปโหลดอีกครั้งไม่สำเร็จ",
|
||||
"shippingNoticePasteHint": "วางข้อมูลสต็อกในช่องข้อความแล้วส่ง",
|
||||
"shippingNoticeDecisionDone": "ดำเนินการเสร็จแล้ว",
|
||||
"shippingNoticePrompt": {
|
||||
@@ -41,8 +46,10 @@
|
||||
"batchLabel": "ชุดงาน {batchNo}",
|
||||
"taskLabel": "งานปัจจุบัน {taskId}",
|
||||
"taskList": "รายการงาน: {taskIds}",
|
||||
"multiTask": "{summary} {taskListText}กรุณาจัดการเฉพาะงานที่โฟกัสอยู่ในขณะนี้ก่อน เรียก get_task_status เพื่ออ่านสถานะงานปัจจุบันก่อน หากงานปัจจุบันยังรอการแยกข้อมูล ให้读取 raw_text ใช้ LLM แยกฟิลด์แบบมีโครงสร้าง แล้วเรียก parse_notice(structured=...) เพื่อบันทึก หากงานเข้าสู่ขั้นตอนถัดไปแล้ว ให้สรุปสถานะปัจจุบันและแนะนำขั้นตอนถัดไปของงานนี้โดยตรง ห้ามถามฉันซ้ำว่าจะเริ่มแยกข้อมูลหรือไม่ และไม่ต้องวนประมวลผลงานอื่นทั้งชุด",
|
||||
"singleTask": "{summary} กรุณาเรียก get_task_status เพื่ออ่านสถานะงานปัจจุบันก่อน หากงานปัจจุบันยังรอการแยกข้อมูล ให้读取 raw_text ใช้ LLM แยกฟิลด์แบบมีโครงสร้าง แล้วเรียก parse_notice(structured=...) โดยตรงเพื่อบันทึก หากงานเข้าสู่ขั้นตอนถัดไปแล้ว ให้สรุปสถานะปัจจุบันและแนะนำขั้นตอนถัดไปโดยตรง ห้ามถามฉันซ้ำว่าจะเริ่มแยกข้อมูลตอนนี้หรือไม่"
|
||||
"autoInventoryAction": "อัปโหลดสต็อกและจับคู่คอลัมน์",
|
||||
"autoNoticeAction": "สร้างงานและแยกข้อมูลใบแจ้งจัดส่ง",
|
||||
"multiTask": "{summary} {taskListText}กรุณาจัดการเฉพาะงานที่โฟกัสอยู่ในขณะนี้ก่อน อ่านสถานะงานปัจจุบันก่อน หากยังต้องแยกข้อมูล ให้แยกใบแจ้งส่งสินค้าและบันทึกผลลัพธ์ หากเข้าสู่ขั้นตอนถัดไปแล้ว ให้สรุปความคืบหน้าและขั้นตอนถัดไปโดยตรง อย่าถามซ้ำว่าจะเริ่มแยกข้อมูลหรือไม่ และไม่ต้องวนประมวลผลงานอื่นทั้งชุด",
|
||||
"singleTask": "{summary} กรุณาอ่านสถานะงานปัจจุบันก่อน หากยังต้องแยกข้อมูล ให้แยกใบแจ้งส่งสินค้าและบันทึกผลลัพธ์ หากเข้าสู่ขั้นตอนถัดไปแล้ว ให้สรุปความคืบหน้าและขั้นตอนถัดไปโดยตรง อย่าถามซ้ำว่าจะเริ่มแยกข้อมูลหรือไม่"
|
||||
}
|
||||
},
|
||||
"shippingNoticeMapping": {
|
||||
@@ -104,17 +111,79 @@
|
||||
"batchProgress": "รายการ {index}/{total}",
|
||||
"batchCurrentIndex": "กำลังประมวลผลรายการที่ {index}/{total}",
|
||||
"batchSummaryLine": "ชุดนี้ {total} รายการ · เสร็จแล้ว {completed} · กำลังดำเนินการ {running} · รอดำเนินการ {pending}",
|
||||
"conversationWorkspaceTitle": "สรุปการดำเนินงานของเซสชัน Agent",
|
||||
"conversationSummaryLine": "{batches} ชุดงาน · {total} งาน · เสร็จแล้ว {completed} · กำลังดำเนินการ {running} · ต้องแทรกแซง {abnormal}",
|
||||
"batchChromeSummary": "{total} งาน, เสร็จแล้ว {completed}, กำลังทำ {running}, ต้องแทรกแซง {abnormal}",
|
||||
"agentExecutionSummary": "สรุปการดำเนินงานของ Agent",
|
||||
"workspaceSubtitle": "{batches} ชุดงาน · {total} งาน, เสร็จแล้ว {completed}, ต้องแทรกแซง {abnormal}",
|
||||
"noBlockingTasks": "ชุดงานปัจจุบันไม่มีงานที่บล็อกอยู่ เสร็จแล้วหรือกำลังจัดเก็บอัตโนมัติ",
|
||||
"focusTaskRecommendation": "แนะนำให้โฟกัสงานนี้ก่อน ตรวจสอบสาเหตุที่บล็อก แล้วค่อยดำเนินการกู้คืนในชุดงานต่อ",
|
||||
"focusThisTask": "แก้งานนี้",
|
||||
"showWorkspace": "เวิร์กสเปซชุดงาน",
|
||||
"hideWorkspace": "ซ่อนเวิร์กสเปซ",
|
||||
"batchWorkspaceTitle": "เวิร์กสเปซชุดงาน",
|
||||
"batchWorkspaceSubtitle": "สลับชุดงาน กรองงาน และวิเคราะห์ขั้นตอน",
|
||||
"batchActionsTitle": "การทำงานแบบชุด",
|
||||
"retryFailedTasks": "ลองงานที่ล้มเหลวทั้งหมดอีกครั้ง",
|
||||
"batchActionSafetyNotice": "งานที่ต้องให้คนตรวจจะไม่ถูกลองใหม่แบบชุด งานที่เสร็จแล้วจะไม่ถูกอัปโหลดซ้ำ การกู้คืนแบบชุดจะจัดการเฉพาะงานที่ล้มเหลวหรืออยู่ในคิว",
|
||||
"taskDetailCount": "รายละเอียดงาน ({count})",
|
||||
"filterAll": "ทั้งหมด",
|
||||
"filterAbnormal": "ผิดปกติ ({count})",
|
||||
"filterCompleted": "เสร็จแล้ว ({count})",
|
||||
"emptyFilteredTasks": "ไม่มีงานที่ตรงเงื่อนไข",
|
||||
"focusRepair": "โฟกัสแก้ไข",
|
||||
"queryShortageDetails": "ดูรายละเอียดส่วนขาด",
|
||||
"retrySingleTask": "ลองงานเดียวอีกครั้ง",
|
||||
"retrySingleTaskMessage": "ลองงานปัจจุบัน {taskId} อีกครั้ง",
|
||||
"viewDetail": "ดูรายละเอียด",
|
||||
"mobileWorkspaceHint": "เปิดเวิร์กสเปซบนมือถือแล้ว โปรดเลือกงานจากรายการเพื่อดำเนินการต่อ",
|
||||
"diagnosisAdviceRetryOrFocus": "ควรโฟกัสงานนี้เพื่อตรวจบริบทก่อน หากเป็นปัญหาระบบภายนอกชั่วคราวจึงค่อยลองใหม่",
|
||||
"diagnosisUploadFailedTitle": "อัปโหลดไปยังระบบขนส่งล้มเหลว และยังไม่ได้รับใบตอบรับสำเร็จ",
|
||||
"diagnosisUploadFailedAdvice": "ลองงานนี้ใหม่ หากยังล้มเหลวให้ตรวจสถานะล็อกอิน รูปแบบฟิลด์ หรืออัปโหลดด้วยตนเอง",
|
||||
"diagnosisShortageTitle": "การจับคู่สต็อกพบจำนวนขาด จึงยังดำเนินการส่งเต็มจำนวนไม่ได้",
|
||||
"diagnosisShortageAdvice": "ระบบบล็อกการจัดส่งต่อ โปรดเติมสต็อกหรือแก้ไขใบแจ้ง แล้วจับคู่สต็อกใหม่",
|
||||
"diagnosisShortageLine": "แถว {index}: Reservation {reservationId}, SKU {sku}, ต้องการ {required}, มี {available}, ขาด {shortage}",
|
||||
"diagnosisShortageAdviceWithLines": "รายละเอียดส่วนขาด: {lines} โปรดเติมสต็อกหรือแก้ไขใบแจ้ง แล้วจับคู่ใหม่",
|
||||
"shortageDetailsMessageTitle": "รายละเอียดสต็อกขาดของงาน {taskId} ({file}):",
|
||||
"shortageNoDetails": "ไม่พบสต็อกขาดสำหรับงาน {taskId}",
|
||||
"diagnosisInventoryRpaTitle": "Inventory RPA ยังไม่ส่งคืนสแนปช็อตสต็อกที่ใช้ได้",
|
||||
"diagnosisInventoryRpaAdvice": "ลองดึงสต็อกใหม่ก่อน หากระบบภายนอกใช้ไม่ได้ ให้อัปโหลดไฟล์สต็อกด้วยตนเอง",
|
||||
"diagnosisAlignReviewTitle": "ต้องยืนยันการแมปคอลัมน์สต็อกด้วยตนเอง",
|
||||
"diagnosisAlignReviewAdvice": "ยืนยันการแมป SKU, Reservation ID และจำนวนที่ใช้ได้ เพื่อป้องกันการจับคู่ผิดรายการ",
|
||||
"diagnosisParseReviewTitle": "ความมั่นใจในการอ่านใบแจ้งต่ำ ต้องตรวจทานข้อมูล",
|
||||
"diagnosisParseReviewAdvice": "ตรวจลูกค้า PO วันที่ต้องการ และรายการคำสั่งซื้อก่อนดำเนินการต่อ",
|
||||
"diagnosisReservationRequiredTitle": "ไม่มี Reservation ID จึงล็อกสต็อกตามใบจองไม่ได้",
|
||||
"diagnosisReservationRequiredAdvice": "เพิ่ม Reservation ID หรือยืนยันว่าลูกค้ารายนี้ดำเนินการได้โดยไม่ต้องมีใบจอง",
|
||||
"diagnosisInventoryWaitingTitle": "กำลังรอไฟล์สต็อกหรือการยืนยันช่องทางสต็อก",
|
||||
"diagnosisInventoryWaitingAdvice": "อัปโหลดสแนปช็อตสต็อกของชุดงาน หรือยืนยันช่องทางดึงอัตโนมัติ",
|
||||
"diagnosisCompletedTitle": "งานเสร็จแล้วและถูกจัดเก็บแล้ว",
|
||||
"diagnosisCompletedAdvice": "ไม่ต้องดำเนินการ หากต้องการตรวจสอบให้ดูไฟล์ส่งออกหรือใบตอบรับ",
|
||||
"diagnosisStepWaitingTitle": "ขั้นตอน {step} กำลังรอเงื่อนไขก่อนหน้า",
|
||||
"diagnosisStepWaitingAdvice": "ติดตามในเวิร์กสเปซ หรือโฟกัสงานนี้เพื่อตรวจบริบท",
|
||||
"currentTaskDiagnosis": "การวิเคราะห์งานปัจจุบัน",
|
||||
"currentTaskPosition": "รายการ {index}/{total}",
|
||||
"batchTabAbnormal": "เสร็จแล้ว {completed} · ผิดปกติ {abnormal}",
|
||||
"batchTabNormal": "{total} งานปกติทั้งหมด",
|
||||
"interventionQueue": "งานที่ต้องแทรกแซง",
|
||||
"needsIntervention": "ต้องแทรกแซง",
|
||||
"currentNotice": "ใบแจ้งปัจจุบัน",
|
||||
"currentStepLabel": "ปัจจุบัน",
|
||||
"stepHeadline": "ขั้นตอน {current}/{total} · {label}",
|
||||
"stepFraction": "ขั้นตอน {current}/{total}",
|
||||
"stepNeedsConfirm": "ขั้นตอน {step} รอยืนยัน",
|
||||
"taskListResume": "รายการงาน / ดำเนินการต่อ",
|
||||
"retryPendingTasks": "ลองงานที่กู้คืนได้ในชุดงานปัจจุบันอีกครั้ง",
|
||||
"retryPendingDone": "ส่งงานที่กู้คืนได้ใหม่แล้ว",
|
||||
"retryFailed": "ลองใหม่ไม่สำเร็จ",
|
||||
"retrying": "กำลังลองใหม่...",
|
||||
"taskListTitle": "รายการงาน",
|
||||
"taskListHint": "เมื่อสลับงาน Stepper ด้านบนและการดำเนินการจะอัปเดตพร้อมกัน",
|
||||
"expandTaskList": "ขยายรายการ",
|
||||
"collapseTaskList": "ย่อรายการ",
|
||||
"currentFocus": "โฟกัสปัจจุบัน →",
|
||||
"expandTaskList": "ขยายรายการงาน",
|
||||
"collapseTaskList": "ย่อรายการงาน",
|
||||
"currentFocus": "โฟกัสปัจจุบัน:",
|
||||
"currentFocusDefaultReason": "ข้อความที่ป้อนจะมีผลกับงานนี้",
|
||||
"focusInputPlaceholder": "กำลังจัดการ {taskId} พิมพ์คำสั่ง...",
|
||||
"clearFocus": "ยกเลิกโฟกัส",
|
||||
"runningState": "กำลังดำเนินการ",
|
||||
"pendingState": "รอยืนยัน",
|
||||
"completedState": "เสร็จแล้ว",
|
||||
|
||||
@@ -13,13 +13,18 @@
|
||||
"loadingAgent": "正在加载应用...",
|
||||
"thinking": "正在生成回答...",
|
||||
"disclaimer": "AI 可能会犯错,请核实重要信息。",
|
||||
"scrollToLatest": "滚动到最新消息",
|
||||
"createNewChat": "创建新对话",
|
||||
"shippingNoticeContinue": "请继续处理发货任务 {taskId}。该任务已存在,禁止调用 create_task。请先调用 get_task_status(task_id={taskId})查询当前状态并告知我下一步。",
|
||||
"shippingNoticeContinue": "请继续处理发货任务 {taskId}。先读取当前任务状态;如果仍待解析,请解析发货通知并保存结果;如果已进入后续步骤,请直接说明当前进度和下一步。",
|
||||
"shippingNoticeActionsHint": "请选择操作:",
|
||||
"shippingNoticeMissingTaskId": "未找到任务编号,请先完成发货通知解析。",
|
||||
"shippingNoticeUploadDone": "库存文件已上传:{fileName}。",
|
||||
"shippingNoticeUploadOk": "上传成功。",
|
||||
"shippingNoticeUploadFailed": "库存文件上传失败。",
|
||||
"shippingNoticeRefreshDone": "已刷新当前任务状态。",
|
||||
"shippingNoticeRetryUploadAction": "重试上传货代",
|
||||
"shippingNoticeRetryUploadQueued": "已重新触发上传,请稍后刷新查看结果。",
|
||||
"shippingNoticeRetryUploadFailed": "重试上传失败。",
|
||||
"shippingNoticePasteHint": "请在输入框粘贴库存小表内容后发送。",
|
||||
"shippingNoticeDecisionDone": "操作已完成。",
|
||||
"shippingNoticePrompt": {
|
||||
@@ -42,9 +47,9 @@
|
||||
"taskLabel": "当前任务 {taskId}",
|
||||
"taskList": "任务列表:{taskIds}。",
|
||||
"autoInventoryAction": "上传库存并进入字段对齐",
|
||||
"autoNoticeAction": "解析发货通知并创建任务",
|
||||
"multiTask": "{summary}。{taskListText}请只处理当前焦点任务。先调用 get_task_status 读取当前任务状态;如果当前任务仍待解析,请读取 raw_text,用 LLM 抽取结构化字段后调用 parse_notice(structured=...) 落库;如果已经进入后续步骤,请直接解释当前状态并给出本任务下一步引导。禁止再次询问我“是否开始解析”,也不要整批循环处理其他任务。",
|
||||
"singleTask": "{summary}。请先调用 get_task_status 读取当前任务状态;如果当前任务仍待解析,请读取 raw_text,用 LLM 抽取结构化字段后直接调用 parse_notice(structured=...) 落库;若已进入后续步骤,请直接解释当前状态并给出下一步引导。禁止再次询问我“是否开始解析”或“是否现在开始解析”。"
|
||||
"autoNoticeAction": "创建任务并解析发货通知",
|
||||
"multiTask": "{summary}。{taskListText}请只处理当前焦点任务。先读取当前任务状态;如果仍待解析,请解析发货通知并保存结果;如果已进入后续步骤,请直接说明当前进度和下一步。不要再次询问我是否开始解析,也不要整批循环处理其他任务。",
|
||||
"singleTask": "{summary}。请先读取当前任务状态;如果仍待解析,请解析发货通知并保存结果;如果已进入后续步骤,请直接说明当前进度和下一步。不要再次询问我是否开始解析。"
|
||||
}
|
||||
},
|
||||
"shippingNoticeMapping": {
|
||||
@@ -106,21 +111,79 @@
|
||||
"batchProgress": "第 {index}/{total} 票",
|
||||
"batchCurrentIndex": "当前处理第 {index}/{total} 票",
|
||||
"batchSummaryLine": "本批 {total} 笔 · 已完成 {completed} · 进行中 {running} · 待处理 {pending}",
|
||||
"conversationWorkspaceTitle": "Agent 会话执行摘要",
|
||||
"conversationSummaryLine": "{batches} 个批次 · {total} 票任务 · {completed} 完成 · {running} 执行中 · {abnormal} 需介入",
|
||||
"batchChromeSummary": "{total} 票任务,{completed} 完成,{running} 执行中,{abnormal} 需介入",
|
||||
"agentExecutionSummary": "Agent 执行摘要",
|
||||
"workspaceSubtitle": "{batches} 个批次 · {total} 票任务,{completed} 已完成,{abnormal} 需要介入",
|
||||
"noBlockingTasks": "当前批次没有阻断任务,已完成或正在自动归档。",
|
||||
"focusTaskRecommendation": "建议先聚焦此单,确认阻断原因后再继续批次内恢复。",
|
||||
"focusThisTask": "修正此单",
|
||||
"showWorkspace": "批次工作台",
|
||||
"hideWorkspace": "隐藏工作台",
|
||||
"batchWorkspaceTitle": "批次工作台",
|
||||
"batchWorkspaceSubtitle": "多批次切换、筛选与步骤诊断",
|
||||
"batchActionsTitle": "批量操作",
|
||||
"retryFailedTasks": "重试所有失败",
|
||||
"batchActionSafetyNotice": "待人工任务不会被批量重试;已完成任务不会重复上传。批量恢复仅处理失败或排队任务。",
|
||||
"taskDetailCount": "任务明细 ({count})",
|
||||
"filterAll": "全部",
|
||||
"filterAbnormal": "异常 ({count})",
|
||||
"filterCompleted": "完成 ({count})",
|
||||
"emptyFilteredTasks": "暂无相关任务",
|
||||
"focusRepair": "聚焦修正",
|
||||
"queryShortageDetails": "查询缺口明细",
|
||||
"retrySingleTask": "单独重试",
|
||||
"retrySingleTaskMessage": "重试当前任务 {taskId}",
|
||||
"viewDetail": "查看明细",
|
||||
"mobileWorkspaceHint": "移动端工作台已打开,请在任务列表中选择要处理的单票。",
|
||||
"diagnosisAdviceRetryOrFocus": "建议先聚焦此单查看上下文;若属于外部系统临时失败,可单独重试。",
|
||||
"diagnosisUploadFailedTitle": "上传货代系统失败,未收到成功回执。",
|
||||
"diagnosisUploadFailedAdvice": "建议单独重试;若连续失败,请检查货代系统登录状态、字段格式或人工上传。",
|
||||
"diagnosisShortageTitle": "库存匹配存在缺口,当前不能直接生成完整发货。",
|
||||
"diagnosisShortageAdvice": "系统已阻断后续发货,请按下方缺口明细补库存或修正通知单后重新匹配。",
|
||||
"diagnosisShortageLine": "第 {index} 行:预订单号 {reservationId},料号 {sku},需求 {required},可用 {available},缺口 {shortage}",
|
||||
"diagnosisShortageAdviceWithLines": "缺口明细:{lines}。请补库存或修正通知单后重新匹配。",
|
||||
"shortageDetailsMessageTitle": "任务 {taskId}({file})的库存缺口明细:",
|
||||
"shortageNoDetails": "任务 {taskId} 当前未发现库存缺口。",
|
||||
"diagnosisInventoryRpaTitle": "库存 RPA 未返回可用库存快照。",
|
||||
"diagnosisInventoryRpaAdvice": "建议先重试库存抓取;若外部系统不可用,可人工上传库存文件。",
|
||||
"diagnosisAlignReviewTitle": "库存字段映射需要人工确认。",
|
||||
"diagnosisAlignReviewAdvice": "建议确认 SKU、Reservation ID、可用数量等列映射,避免匹配错料。",
|
||||
"diagnosisParseReviewTitle": "通知单解析置信度不足,需要复核单头或明细。",
|
||||
"diagnosisParseReviewAdvice": "建议核对客户、PO、需求日期和订单行后再继续。",
|
||||
"diagnosisReservationRequiredTitle": "缺少 Reservation ID,无法按预订单锁定库存。",
|
||||
"diagnosisReservationRequiredAdvice": "建议补充 Reservation ID,或确认该客户允许不带预订单处理。",
|
||||
"diagnosisInventoryWaitingTitle": "等待库存文件或库存入口确认。",
|
||||
"diagnosisInventoryWaitingAdvice": "建议上传本批库存快照,或确认系统自动抓取入口。",
|
||||
"diagnosisCompletedTitle": "任务已完成并归档。",
|
||||
"diagnosisCompletedAdvice": "无需处理;如需核验可查看导出文件或上传回执。",
|
||||
"diagnosisStepWaitingTitle": "步骤 {step} 正在等待前置条件。",
|
||||
"diagnosisStepWaitingAdvice": "建议保持在工作台观察,必要时聚焦此单查看上下文。",
|
||||
"currentTaskDiagnosis": "当前任务诊断",
|
||||
"currentTaskPosition": "第 {index}/{total} 票",
|
||||
"batchTabAbnormal": "{completed} 完成 · {abnormal} 异常",
|
||||
"batchTabNormal": "{total} 票全部正常",
|
||||
"interventionQueue": "需介入任务",
|
||||
"needsIntervention": "需介入",
|
||||
"currentNotice": "当前通知",
|
||||
"currentStepLabel": "当前",
|
||||
"stepHeadline": "步骤 {current}/{total} · {label}",
|
||||
"stepFraction": "步骤 {current}/{total}",
|
||||
"stepNeedsConfirm": "步骤 {step} 待确认",
|
||||
"taskListResume": "任务列表 / 续办",
|
||||
"retryPendingTasks": "重试未完成票",
|
||||
"retryPendingTasks": "重试当前批次可恢复任务",
|
||||
"retryPendingDone": "已重新提交未完成票",
|
||||
"retryFailed": "重试失败",
|
||||
"retrying": "重试中...",
|
||||
"taskListTitle": "任务列表",
|
||||
"taskListHint": "切换任务后,对话顶部 Stepper 与操作同步更新",
|
||||
"expandTaskList": "展开列表",
|
||||
"collapseTaskList": "收起列表",
|
||||
"currentFocus": "当前聚焦 →",
|
||||
"expandTaskList": "展开任务列表",
|
||||
"collapseTaskList": "收起任务列表",
|
||||
"currentFocus": "当前聚焦:",
|
||||
"currentFocusDefaultReason": "输入内容将作用于该单票任务",
|
||||
"focusInputPlaceholder": "正在处理 {taskId},输入指令...",
|
||||
"clearFocus": "取消聚焦",
|
||||
"runningState": "进行中",
|
||||
"pendingState": "待确认",
|
||||
"completedState": "已完成",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"defaultTitle": "對話",
|
||||
"assistantLabel": "HXOPS AI 助手",
|
||||
"assistantLabel": "AI 助手",
|
||||
"placeholder": "請輸入問題...",
|
||||
"history": "歷史記錄",
|
||||
"noHistory": "暫無歷史記錄",
|
||||
@@ -13,13 +13,18 @@
|
||||
"loadingAgent": "正在加載應用...",
|
||||
"thinking": "正在生成回答...",
|
||||
"disclaimer": "AI 可能會犯錯,請核實重要信息。",
|
||||
"scrollToLatest": "捲動到最新消息",
|
||||
"createNewChat": "建立新對話",
|
||||
"shippingNoticeContinue": "請繼續處理發貨任務 {taskId}。請先呼叫 get_task_status,再告訴我下一步。",
|
||||
"shippingNoticeContinue": "請繼續處理發貨任務 {taskId}。先讀取目前任務狀態;如果仍待解析,請解析發貨通知並儲存結果;如果已進入後續步驟,請直接說明目前進度和下一步。",
|
||||
"shippingNoticeActionsHint": "請選擇操作:",
|
||||
"shippingNoticeMissingTaskId": "找不到任務編號,請先完成發貨通知解析。",
|
||||
"shippingNoticeUploadDone": "庫存檔案已上傳:{fileName}。",
|
||||
"shippingNoticeUploadOk": "上傳成功。",
|
||||
"shippingNoticeUploadFailed": "庫存檔案上傳失敗。",
|
||||
"shippingNoticeRefreshDone": "已重新整理目前任務狀態。",
|
||||
"shippingNoticeRetryUploadAction": "重試上傳貨代",
|
||||
"shippingNoticeRetryUploadQueued": "已重新觸發上傳,請稍後重新整理查看結果。",
|
||||
"shippingNoticeRetryUploadFailed": "重試上傳失敗。",
|
||||
"shippingNoticePasteHint": "請在輸入框貼上庫存小表內容後送出。",
|
||||
"shippingNoticeDecisionDone": "操作已完成。",
|
||||
"shippingNoticePrompt": {
|
||||
@@ -42,9 +47,9 @@
|
||||
"taskLabel": "當前任務 {taskId}",
|
||||
"taskList": "任務列表:{taskIds}。",
|
||||
"autoInventoryAction": "上傳庫存並進入欄位對齊",
|
||||
"autoNoticeAction": "解析發貨通知並建立任務",
|
||||
"multiTask": "{summary}。{taskListText}請只處理目前焦點任務。先呼叫 get_task_status 讀取目前任務狀態;如果目前任務仍待解析,請讀取 raw_text,用 LLM 抽取結構化欄位後呼叫 parse_notice(structured=...) 落庫;如果已進入後續步驟,請直接說明目前狀態並給出本任務下一步引導。禁止再次詢問我「是否開始解析」,也不要整批迴圈處理其他任務。",
|
||||
"singleTask": "{summary}。請先呼叫 get_task_status 讀取目前任務狀態;如果目前任務仍待解析,請讀取 raw_text,用 LLM 抽取結構化欄位後直接呼叫 parse_notice(structured=...) 落庫;若已進入後續步驟,請直接說明目前狀態並給出下一步引導。禁止再次詢問我「是否開始解析」或「是否現在開始解析」。"
|
||||
"autoNoticeAction": "建立任務並解析發貨通知",
|
||||
"multiTask": "{summary}。{taskListText}請只處理目前焦點任務。先讀取目前任務狀態;如果仍待解析,請解析發貨通知並儲存結果;如果已進入後續步驟,請直接說明目前進度和下一步。不要再次詢問我是否開始解析,也不要整批迴圈處理其他任務。",
|
||||
"singleTask": "{summary}。請先讀取目前任務狀態;如果仍待解析,請解析發貨通知並儲存結果;如果已進入後續步驟,請直接說明目前進度和下一步。不要再次詢問我是否開始解析。"
|
||||
}
|
||||
},
|
||||
"shippingNoticeMapping": {
|
||||
@@ -106,17 +111,79 @@
|
||||
"batchProgress": "第 {index}/{total} 票",
|
||||
"batchCurrentIndex": "當前處理第 {index}/{total} 票",
|
||||
"batchSummaryLine": "本批 {total} 筆 · 已完成 {completed} · 進行中 {running} · 待處理 {pending}",
|
||||
"conversationWorkspaceTitle": "Agent 會話執行摘要",
|
||||
"conversationSummaryLine": "{batches} 個批次 · {total} 票任務 · {completed} 完成 · {running} 執行中 · {abnormal} 需介入",
|
||||
"batchChromeSummary": "{total} 票任務,{completed} 完成,{running} 執行中,{abnormal} 需介入",
|
||||
"agentExecutionSummary": "Agent 執行摘要",
|
||||
"workspaceSubtitle": "{batches} 個批次 · {total} 票任務,{completed} 已完成,{abnormal} 需要介入",
|
||||
"noBlockingTasks": "目前批次沒有阻斷任務,已完成或正在自動歸檔。",
|
||||
"focusTaskRecommendation": "建議先聚焦此單,確認阻斷原因後再繼續批次內恢復。",
|
||||
"focusThisTask": "修正此單",
|
||||
"showWorkspace": "批次工作台",
|
||||
"hideWorkspace": "隱藏工作台",
|
||||
"batchWorkspaceTitle": "批次工作台",
|
||||
"batchWorkspaceSubtitle": "多批次切換、篩選與步驟診斷",
|
||||
"batchActionsTitle": "批量操作",
|
||||
"retryFailedTasks": "重試所有失敗",
|
||||
"batchActionSafetyNotice": "待人工任務不會被批量重試;已完成任務不會重複上傳。批量恢復僅處理失敗或排隊任務。",
|
||||
"taskDetailCount": "任務明細 ({count})",
|
||||
"filterAll": "全部",
|
||||
"filterAbnormal": "異常 ({count})",
|
||||
"filterCompleted": "完成 ({count})",
|
||||
"emptyFilteredTasks": "暫無相關任務",
|
||||
"focusRepair": "聚焦修正",
|
||||
"queryShortageDetails": "查詢缺口明細",
|
||||
"retrySingleTask": "單獨重試",
|
||||
"retrySingleTaskMessage": "重試目前任務 {taskId}",
|
||||
"viewDetail": "查看明細",
|
||||
"mobileWorkspaceHint": "行動端工作台已開啟,請在任務列表中選擇要處理的單票。",
|
||||
"diagnosisAdviceRetryOrFocus": "建議先聚焦此單查看上下文;若屬於外部系統暫時失敗,可單獨重試。",
|
||||
"diagnosisUploadFailedTitle": "上傳貨代系統失敗,未收到成功回執。",
|
||||
"diagnosisUploadFailedAdvice": "建議單獨重試;若連續失敗,請檢查貨代系統登入狀態、欄位格式或人工上傳。",
|
||||
"diagnosisShortageTitle": "庫存匹配存在缺口,目前不能直接生成完整發貨。",
|
||||
"diagnosisShortageAdvice": "系統已阻斷後續發貨,請按下方缺口明細補庫存或修正通知單後重新匹配。",
|
||||
"diagnosisShortageLine": "第 {index} 行:預訂單號 {reservationId},料號 {sku},需求 {required},可用 {available},缺口 {shortage}",
|
||||
"diagnosisShortageAdviceWithLines": "缺口明細:{lines}。請補庫存或修正通知單後重新匹配。",
|
||||
"shortageDetailsMessageTitle": "任務 {taskId}({file})的庫存缺口明細:",
|
||||
"shortageNoDetails": "任務 {taskId} 目前未發現庫存缺口。",
|
||||
"diagnosisInventoryRpaTitle": "庫存 RPA 未返回可用庫存快照。",
|
||||
"diagnosisInventoryRpaAdvice": "建議先重試庫存抓取;若外部系統不可用,可人工上傳庫存檔。",
|
||||
"diagnosisAlignReviewTitle": "庫存欄位映射需要人工確認。",
|
||||
"diagnosisAlignReviewAdvice": "建議確認 SKU、Reservation ID、可用數量等欄位映射,避免匹配錯料。",
|
||||
"diagnosisParseReviewTitle": "通知單解析信心不足,需要覆核單頭或明細。",
|
||||
"diagnosisParseReviewAdvice": "建議核對客戶、PO、需求日期和訂單行後再繼續。",
|
||||
"diagnosisReservationRequiredTitle": "缺少 Reservation ID,無法按預訂單鎖定庫存。",
|
||||
"diagnosisReservationRequiredAdvice": "建議補充 Reservation ID,或確認該客戶允許不帶預訂單處理。",
|
||||
"diagnosisInventoryWaitingTitle": "等待庫存檔案或庫存入口確認。",
|
||||
"diagnosisInventoryWaitingAdvice": "建議上傳本批庫存快照,或確認系統自動抓取入口。",
|
||||
"diagnosisCompletedTitle": "任務已完成並歸檔。",
|
||||
"diagnosisCompletedAdvice": "無需處理;如需核驗可查看匯出檔或上傳回執。",
|
||||
"diagnosisStepWaitingTitle": "步驟 {step} 正在等待前置條件。",
|
||||
"diagnosisStepWaitingAdvice": "建議保持在工作台觀察,必要時聚焦此單查看上下文。",
|
||||
"currentTaskDiagnosis": "目前任務診斷",
|
||||
"currentTaskPosition": "第 {index}/{total} 票",
|
||||
"batchTabAbnormal": "{completed} 完成 · {abnormal} 異常",
|
||||
"batchTabNormal": "{total} 票全部正常",
|
||||
"interventionQueue": "需介入任務",
|
||||
"needsIntervention": "需介入",
|
||||
"currentNotice": "當前通知",
|
||||
"currentStepLabel": "目前",
|
||||
"stepHeadline": "步驟 {current}/{total} · {label}",
|
||||
"stepFraction": "步驟 {current}/{total}",
|
||||
"stepNeedsConfirm": "步驟 {step} 待確認",
|
||||
"taskListResume": "任務列表 / 續辦",
|
||||
"retryPendingTasks": "重試目前批次可恢復任務",
|
||||
"retryPendingDone": "已重新提交可恢復任務",
|
||||
"retryFailed": "重試失敗",
|
||||
"retrying": "重試中...",
|
||||
"taskListTitle": "任務列表",
|
||||
"taskListHint": "切換任務後,對話頂部 Stepper 與操作會同步更新",
|
||||
"expandTaskList": "展開列表",
|
||||
"collapseTaskList": "收起列表",
|
||||
"currentFocus": "目前聚焦 →",
|
||||
"expandTaskList": "展開任務列表",
|
||||
"collapseTaskList": "收起任務列表",
|
||||
"currentFocus": "目前聚焦:",
|
||||
"currentFocusDefaultReason": "輸入內容將作用於該單票任務",
|
||||
"focusInputPlaceholder": "正在處理 {taskId},輸入指令...",
|
||||
"clearFocus": "取消聚焦",
|
||||
"runningState": "進行中",
|
||||
"pendingState": "待確認",
|
||||
"completedState": "已完成",
|
||||
|
||||
Reference in new issue
Block a user