feat(shipping-notice): 新增货代客户管理功能,支持客户导入、识别证据管理与客户确认
This commit is contained in:
1 parent
b595e157e9
commit
4fbaed2b4c
176 files changed
+14011
-994
No files matched your search
@@ -30,7 +30,6 @@ import {
|
||||
createShippingSendHandlers,
|
||||
createShippingUploadHandlers,
|
||||
onNoticeBatchConversationChanging,
|
||||
findHistorySessionForShippingTask,
|
||||
findLatestShippingTaskId,
|
||||
getShippingInventoryMappingPayload,
|
||||
getShippingMatchResultPayload,
|
||||
@@ -48,6 +47,8 @@ import {
|
||||
getWorkspaceShippingConversationBatches,
|
||||
getWorkspaceShippingBatch,
|
||||
getWorkspaceShippingTask,
|
||||
listWorkspaceShippingCustomerOptions,
|
||||
confirmWorkspaceShippingCustomer,
|
||||
switchWorkspaceShippingBatchFocusTask,
|
||||
type ShippingBatchUiState,
|
||||
type ShippingBatchSummary,
|
||||
@@ -55,13 +56,15 @@ import {
|
||||
type ShippingTaskDetail,
|
||||
type ShippingTaskSummary,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
import type { ShippingCustomerOption } from '../types/shipping.api.types';
|
||||
import { buildShippingQueryShortageTurn } from '../shipping/shippingTurnActions';
|
||||
import {
|
||||
hasShortageLines,
|
||||
isShippingShortageQueryIntent,
|
||||
} from '../shipping/shippingShortageDetails';
|
||||
|
||||
import type { ChatMessage, ChatRun, ChatSessionItem } from '../types/chat.types';
|
||||
import type { ChatMessage, ChatRun, ChatSessionItem, ShippingMessageRecoveryPayload } from '../types/chat.types';
|
||||
import type { SendMessageLifecycleHooks } from './useChat';
|
||||
import type { ChatUploadFileSpec, PendingAttachment, ShippingActionButton } from '../types/shipping.types';
|
||||
import type { ChatDeps } from './chat.deps';
|
||||
import { listChatMessages } from '../api/chat.api';
|
||||
@@ -94,8 +97,8 @@ export interface UseChatShippingOptions {
|
||||
kb: string,
|
||||
files: ChatUploadFileSpec[],
|
||||
context?: { task_id?: string; batch_no?: string; shipping_intake_nos?: string[]; display_query?: string },
|
||||
hooks?: { onAssistantMessageFinished?: (message: ChatMessage, runMessages: ChatMessage[]) => void | Promise<void> },
|
||||
) => Promise<void>;
|
||||
hooks?: SendMessageLifecycleHooks,
|
||||
) => Promise<boolean | void>;
|
||||
startChatTurn: (options: import('../types/chat-turn.types').StartChatTurnOptions) => Promise<boolean>;
|
||||
buildFileSpecsForSend: () => Promise<ChatUploadFileSpec[]>;
|
||||
loadConversation: (id: string, options?: { force?: boolean }) => Promise<void>;
|
||||
@@ -130,6 +133,104 @@ export const resolveShippingBatchFocusState = (
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 从会话工作台选择本轮应展示的批次。
|
||||
* 核心逻辑:订单抽取完成后选服务端按创建时间升序返回的最后一个批次;普通续办优先保留当前批次。
|
||||
*/
|
||||
export const selectShippingConversationBatch = <T extends { batch_no: string; focus_task?: unknown }>(
|
||||
batches: T[],
|
||||
currentBatchNo: string,
|
||||
queryBatchNo: string,
|
||||
preferLatest = false,
|
||||
): T | undefined => (
|
||||
(preferLatest ? batches[batches.length - 1] : undefined)
|
||||
|| batches.find((item) => item.batch_no === currentBatchNo)
|
||||
|| (queryBatchNo ? batches.find((item) => item.batch_no === queryBatchNo) : undefined)
|
||||
|| batches.find((item) => Boolean(item.focus_task))
|
||||
|| batches[0]
|
||||
);
|
||||
|
||||
/**
|
||||
* 从消息列表解析最近一次权威批次快照。
|
||||
* 核心逻辑:只接受包含批次号和任务数组的 `shipping_batch_ui_state`,供实时终态与历史会话共用。
|
||||
* @param sourceMessages - 当前会话消息
|
||||
* @returns 最近的合法批次快照;不存在时返回 null
|
||||
*/
|
||||
export const resolveLatestShippingBatchSnapshot = (
|
||||
sourceMessages: ChatMessage[],
|
||||
): ShippingBatchUiState | null => {
|
||||
for (let index = sourceMessages.length - 1; index >= 0; index -= 1) {
|
||||
const message = sourceMessages[index];
|
||||
const payload = message?.payload && typeof message.payload === 'object'
|
||||
? message.payload as Record<string, unknown>
|
||||
: null;
|
||||
const rawSnapshot = payload?.shipping_batch_ui_state;
|
||||
if (!rawSnapshot || typeof rawSnapshot !== 'object') continue;
|
||||
const snapshot = rawSnapshot as ShippingBatchUiState;
|
||||
if (String(snapshot.batch_no || '').trim() && Array.isArray(snapshot.tasks)) {
|
||||
return snapshot;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 从单条助手消息中提取工作台恢复锚点。
|
||||
* 核心逻辑:优先识别合法 `shipping_batch_ui_state`,其次回退到 `task_no / batch_no / shipping_ui_state`;
|
||||
* 供实时终态、历史回放与刷新恢复共用。
|
||||
*/
|
||||
export const resolveShippingMessageRecoveryPayload = (
|
||||
message: ChatMessage | null | undefined,
|
||||
): ShippingMessageRecoveryPayload | null => {
|
||||
const payload = message?.payload && typeof message.payload === 'object'
|
||||
? message.payload as ShippingMessageRecoveryPayload
|
||||
: null;
|
||||
if (!payload) return null;
|
||||
const batchSnapshot = payload.shipping_batch_ui_state;
|
||||
const hasBatchSnapshot = Boolean(
|
||||
batchSnapshot
|
||||
&& String(batchSnapshot.batch_no || '').trim()
|
||||
&& Array.isArray(batchSnapshot.tasks),
|
||||
);
|
||||
const taskNo = String(
|
||||
payload.task_no
|
||||
|| payload.shipping_ui_state?.task_no
|
||||
|| batchSnapshot?.current_focus_task_no
|
||||
|| batchSnapshot?.focus_task?.task_no
|
||||
|| batchSnapshot?.tasks?.[0]?.task_no
|
||||
|| '',
|
||||
).trim();
|
||||
const batchNo = String(
|
||||
payload.batch_no
|
||||
|| payload.shipping_ui_state?.batch_no
|
||||
|| batchSnapshot?.batch_no
|
||||
|| '',
|
||||
).trim();
|
||||
const hasTaskUiState = Boolean(payload.shipping_ui_state && typeof payload.shipping_ui_state === 'object');
|
||||
if (!hasBatchSnapshot && !taskNo && !batchNo && !hasTaskUiState) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
...payload,
|
||||
...(taskNo ? { task_no: taskNo } : {}),
|
||||
...(batchNo ? { batch_no: batchNo } : {}),
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 从消息列表中选择最近一条可恢复工作台的消息载荷。
|
||||
* 核心逻辑:从后往前找最近的权威恢复锚点,允许 `open_existing` 只靠 `task_no/ui_state` 恢复。
|
||||
*/
|
||||
export const resolveLatestShippingMessageRecoveryPayload = (
|
||||
sourceMessages: ChatMessage[],
|
||||
): ShippingMessageRecoveryPayload | null => {
|
||||
for (let index = sourceMessages.length - 1; index >= 0; index -= 1) {
|
||||
const payload = resolveShippingMessageRecoveryPayload(sourceMessages[index]);
|
||||
if (payload) return payload;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 组装发货通知聊天所需的状态、动作处理器与发送拦截逻辑。
|
||||
*
|
||||
@@ -163,7 +264,6 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
sendMessage,
|
||||
startChatTurn,
|
||||
buildFileSpecsForSend,
|
||||
loadConversation,
|
||||
createNewChatView,
|
||||
} = options;
|
||||
|
||||
@@ -280,34 +380,152 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
}
|
||||
};
|
||||
|
||||
const applyConversationWorkspaceFocus = (workspace: ShippingConversationWorkspace) => {
|
||||
const applyConversationWorkspaceFocus = (
|
||||
workspace: ShippingConversationWorkspace,
|
||||
options?: { preferLatest?: boolean },
|
||||
) => {
|
||||
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];
|
||||
const selectedBatch = selectShippingConversationBatch(
|
||||
batches,
|
||||
currentBatchNo,
|
||||
queryBatchNo,
|
||||
Boolean(options?.preferLatest),
|
||||
);
|
||||
if (!selectedBatch) return;
|
||||
if (options?.preferLatest) {
|
||||
activeShippingBatchNo.value = selectedBatch.batch_no;
|
||||
}
|
||||
applyShippingBatchDetail(selectedBatch, selectedBatch.batch_no);
|
||||
};
|
||||
|
||||
const syncShippingConversationWorkspace = async () => {
|
||||
const syncShippingConversationWorkspace = async (
|
||||
options?: { preferLatest?: boolean },
|
||||
): Promise<boolean> => {
|
||||
const localConversationId = String(conversationId.value || '').trim();
|
||||
if (!localConversationId || !isShippingNoticeAgent.value) {
|
||||
shippingConversationWorkspace.value = null;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
const workspace = await getWorkspaceShippingConversationBatches(localConversationId);
|
||||
shippingConversationWorkspace.value = workspace;
|
||||
applyConversationWorkspaceFocus(workspace);
|
||||
applyConversationWorkspaceFocus(workspace, options);
|
||||
return true;
|
||||
} catch {
|
||||
shippingConversationWorkspace.value = null;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 从本轮 SSE 助手消息恢复权威批次快照。
|
||||
*
|
||||
* 核心逻辑:订单识别可能打开属于旧会话的已有任务,此时按当前会话补拉工作台会返回空批次;
|
||||
* 优先应用 `shipping_ui_state` 事件随消息持久化的 `shipping_batch_ui_state`,再由接口刷新后续状态。
|
||||
* @param message - 当前流式回答完成后的助手消息
|
||||
* @returns 是否找到并应用了合法批次快照
|
||||
*/
|
||||
const applyResolvedShippingBatchSnapshot = (snapshot: ShippingBatchUiState | null): boolean => {
|
||||
if (!snapshot) return false;
|
||||
const batchNo = String(snapshot.batch_no || '').trim();
|
||||
applyShippingBatchDetail(snapshot, batchNo);
|
||||
return true;
|
||||
};
|
||||
|
||||
const applyShippingBatchSnapshot = (message: ChatMessage): boolean => (
|
||||
applyResolvedShippingBatchSnapshot(resolveLatestShippingBatchSnapshot([message]))
|
||||
);
|
||||
|
||||
/**
|
||||
* 按“批次快照 -> 任务/批次锚点 -> 会话工作台”顺序恢复聊天工作台。
|
||||
*
|
||||
* 核心逻辑:`open_existing` 可能只携带 `task_no / shipping_ui_state`;此时先恢复任务锚点并补拉任务详情,
|
||||
* 再尝试按任务所属批次加载批次详情,最后才回退到当前会话工作台。
|
||||
* @param payload - 从消息中解析出的恢复载荷
|
||||
* @returns 是否至少恢复出一层任务或批次上下文
|
||||
*/
|
||||
const applyResolvedShippingMessageRecovery = async (
|
||||
payload: ShippingMessageRecoveryPayload | null,
|
||||
): Promise<boolean> => {
|
||||
if (!payload) return false;
|
||||
let recovered = false;
|
||||
const snapshot = payload.shipping_batch_ui_state ?? null;
|
||||
if (applyResolvedShippingBatchSnapshot(snapshot)) {
|
||||
recovered = true;
|
||||
}
|
||||
|
||||
const taskNo = String(
|
||||
payload.task_no
|
||||
|| payload.shipping_ui_state?.task_no
|
||||
|| '',
|
||||
).trim().toUpperCase();
|
||||
let batchNo = String(
|
||||
payload.batch_no
|
||||
|| payload.shipping_ui_state?.batch_no
|
||||
|| snapshot?.batch_no
|
||||
|| '',
|
||||
).trim();
|
||||
|
||||
if (batchNo) {
|
||||
resolvedShippingBatchNo.value = batchNo;
|
||||
activeShippingBatchNo.value = batchNo;
|
||||
}
|
||||
if (taskNo) {
|
||||
resolvedShippingTaskId.value = taskNo;
|
||||
focusedShippingTaskNo.value = taskNo;
|
||||
if (!shippingFocusReason.value) {
|
||||
shippingFocusReason.value = t('chat.shippingNoticeUi.currentFocusDefaultReason');
|
||||
}
|
||||
}
|
||||
if (payload.shipping_ui_state && taskNo) {
|
||||
activeShippingTaskDetail.value = {
|
||||
...(activeShippingTaskDetail.value || {}),
|
||||
task_no: taskNo,
|
||||
batch_no: batchNo || payload.shipping_ui_state.batch_no || null,
|
||||
lines: activeShippingTaskDetail.value?.lines || [],
|
||||
events: activeShippingTaskDetail.value?.events || [],
|
||||
ui_state: payload.shipping_ui_state,
|
||||
} as ShippingTaskDetail;
|
||||
recovered = true;
|
||||
}
|
||||
if (!snapshot && batchNo) {
|
||||
try {
|
||||
const detail = await getWorkspaceShippingBatch(batchNo);
|
||||
applyShippingBatchDetail(detail, batchNo);
|
||||
recovered = true;
|
||||
} catch {
|
||||
// ignore and continue with task-first recovery
|
||||
}
|
||||
}
|
||||
if (taskNo) {
|
||||
await syncActiveShippingTaskDetail(taskNo);
|
||||
const detailBatchNo = String(activeShippingTaskDetail.value?.batch_no || '').trim();
|
||||
if (detailBatchNo) {
|
||||
batchNo = detailBatchNo;
|
||||
resolvedShippingBatchNo.value = detailBatchNo;
|
||||
activeShippingBatchNo.value = detailBatchNo;
|
||||
}
|
||||
if (!snapshot && batchNo && String(shippingBatchSummary.value?.batch_no || '').trim() !== batchNo) {
|
||||
try {
|
||||
const detail = await getWorkspaceShippingBatch(batchNo);
|
||||
applyShippingBatchDetail(detail, batchNo);
|
||||
recovered = true;
|
||||
} catch {
|
||||
// ignore and keep task-only recovery
|
||||
}
|
||||
}
|
||||
recovered = recovered || Boolean(activeShippingTaskDetail.value);
|
||||
}
|
||||
return recovered || Boolean(batchNo);
|
||||
};
|
||||
|
||||
const applyShippingMessageRecovery = async (message: ChatMessage): Promise<boolean> => (
|
||||
applyResolvedShippingMessageRecovery(resolveShippingMessageRecoveryPayload(message))
|
||||
);
|
||||
|
||||
const switchShippingFocusTask = async (taskNo: string) => {
|
||||
const batchNo = getActiveShippingBatchNo();
|
||||
const normalizedTaskNo = String(taskNo || '').trim().toUpperCase();
|
||||
@@ -529,7 +747,6 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
messages,
|
||||
conversationId,
|
||||
isThinking,
|
||||
history,
|
||||
resolvedShippingTaskId,
|
||||
shippingTaskIdFromQuery,
|
||||
getActiveBatchTaskId,
|
||||
@@ -563,6 +780,10 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
const finalizeShippingAssistantMessage = async () => {
|
||||
if (!isShippingNoticeAgent.value) return;
|
||||
await shippingIntakes.refreshStatuses();
|
||||
if (!(await syncShippingConversationWorkspace())) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||
await syncShippingConversationWorkspace();
|
||||
}
|
||||
shippingIntakes.clearConsumedAttachments();
|
||||
await refreshShippingActions();
|
||||
};
|
||||
@@ -672,6 +893,10 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
});
|
||||
|
||||
const showShippingDuplicateDialog = ref(false);
|
||||
const showShippingCustomerDialog = ref(false);
|
||||
const shippingCustomerDialogTaskId = ref('');
|
||||
const shippingCustomerOptions = ref<ShippingCustomerOption[]>([]);
|
||||
const shippingCustomerLoading = ref(false);
|
||||
const shippingDuplicateAttachmentId = ref<string | null>(null);
|
||||
const shippingDuplicateAttachment = computed(() => {
|
||||
const id = shippingDuplicateAttachmentId.value;
|
||||
@@ -733,6 +958,50 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
shippingDuplicateAttachmentId.value = null;
|
||||
};
|
||||
|
||||
/** 打开客户确认对话框并加载启用标准客户。 */
|
||||
const openShippingCustomerDialog = async (taskId: string): Promise<void> => {
|
||||
shippingCustomerDialogTaskId.value = String(taskId || '').trim().toUpperCase();
|
||||
showShippingCustomerDialog.value = true;
|
||||
shippingCustomerLoading.value = true;
|
||||
try {
|
||||
shippingCustomerOptions.value = await listWorkspaceShippingCustomerOptions();
|
||||
} catch (error: unknown) {
|
||||
shippingCustomerOptions.value = [];
|
||||
msg.warning(error instanceof Error ? error.message : t('chat.shippingCustomer.loadFailed'));
|
||||
} finally {
|
||||
shippingCustomerLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 按关键词刷新客户选项。 */
|
||||
const searchShippingCustomers = async (query: string): Promise<void> => {
|
||||
shippingCustomerLoading.value = true;
|
||||
try {
|
||||
shippingCustomerOptions.value = await listWorkspaceShippingCustomerOptions(query);
|
||||
} catch (error: unknown) {
|
||||
msg.warning(error instanceof Error ? error.message : t('chat.shippingCustomer.loadFailed'));
|
||||
} finally {
|
||||
shippingCustomerLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 确认客户后刷新任务详情与动作菜单;业务号仍由后续阶段生成。 */
|
||||
const confirmShippingCustomer = async (customerId: number): Promise<void> => {
|
||||
const taskId = shippingCustomerDialogTaskId.value;
|
||||
if (!taskId) return;
|
||||
shippingCustomerLoading.value = true;
|
||||
try {
|
||||
await confirmWorkspaceShippingCustomer(taskId, customerId);
|
||||
showShippingCustomerDialog.value = false;
|
||||
await Promise.all([syncActiveShippingTaskDetail(taskId), refreshShippingActions()]);
|
||||
msg.success(t('chat.shippingCustomer.confirmed'));
|
||||
} catch (error: unknown) {
|
||||
msg.warning(error instanceof Error ? error.message : t('chat.shippingCustomer.confirmFailed'));
|
||||
} finally {
|
||||
shippingCustomerLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 更新 Candidate 选择状态,并将 API 失败统一反馈给用户。 */
|
||||
const setShippingCandidateSelected = async (candidateNo: string, selected: boolean) => {
|
||||
try {
|
||||
@@ -825,6 +1094,7 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
openShippingInventoryMappingFormForTask,
|
||||
openShippingInventoryPicker,
|
||||
openShippingNoticePicker,
|
||||
openShippingCustomerDialog,
|
||||
executeShippingDecision,
|
||||
executeShippingManualUpload,
|
||||
refreshShippingActions,
|
||||
@@ -870,8 +1140,13 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
hasSelectedNoticeCandidates: () => shippingIntakes.getSelectedCandidateNos().length > 0,
|
||||
openShippingDuplicateDialog,
|
||||
getParsedIntakeNos: shippingIntakes.getParsedIntakeNos,
|
||||
markOrderExtractionStarted: shippingIntakes.markOrderExtractionStarted,
|
||||
rollbackOrderExtractionStarted: shippingIntakes.rollbackOrderExtractionStarted,
|
||||
refreshNoticeIntakeStatuses: shippingIntakes.refreshStatuses,
|
||||
clearConsumedNoticeAttachments: shippingIntakes.clearConsumedAttachments,
|
||||
applyShippingMessageRecovery,
|
||||
applyShippingBatchSnapshot,
|
||||
syncShippingConversationWorkspace,
|
||||
refreshShippingActions,
|
||||
shippingSuggestedPrompt,
|
||||
isShippingShortageQueryIntent,
|
||||
@@ -881,6 +1156,12 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
});
|
||||
|
||||
// ── 路由 / 会话生命周期 ───────────────────────────────────
|
||||
/**
|
||||
* 根据路由中的 `task_id/batch_no` 恢复发货任务上下文。
|
||||
* 核心逻辑:优先同步显式传入的批次摘要;若仍缺少会话,则直接基于 `task_id` 发起一次继续任务请求,
|
||||
* 禁止再按历史标题模糊猜测旧会话,避免多批次/多票场景跳进错误会话。
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
const resumeShippingTaskFromQuery = async () => {
|
||||
const batchNo = shippingBatchNoFromQuery.value;
|
||||
if (batchNo && isShippingNoticeAgent.value) {
|
||||
@@ -894,11 +1175,6 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
if (route.query.conversation_id) return;
|
||||
if (presetQuestion.value) return;
|
||||
if (autoResumedShippingTasks.value[taskId]) return;
|
||||
const existing = findHistorySessionForShippingTask(history.value, taskId);
|
||||
if (existing) {
|
||||
await loadConversation(existing.conversation_id, { force: true });
|
||||
return;
|
||||
}
|
||||
autoResumedShippingTasks.value[taskId] = true;
|
||||
const displayText = t('chat.shippingNoticeUi.retrySingleTaskMessage', { taskId });
|
||||
await sendMessage(
|
||||
@@ -1010,6 +1286,8 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
kind: 'local',
|
||||
file,
|
||||
type: kind === 'inventory' ? 'document' : 'document',
|
||||
uploadStatus: 'waiting',
|
||||
uploadProgress: 0,
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -1089,6 +1367,23 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
String(last?.content || '').slice(-120),
|
||||
].join('|');
|
||||
});
|
||||
const shippingRecoveryWatchKey = computed(() => {
|
||||
const recovery = resolveLatestShippingMessageRecoveryPayload(messages.value);
|
||||
const snapshot = recovery?.shipping_batch_ui_state;
|
||||
const uiState = recovery?.shipping_ui_state;
|
||||
return [
|
||||
String(conversationId.value || ''),
|
||||
String(recovery?.batch_no || snapshot?.batch_no || uiState?.batch_no || ''),
|
||||
String(recovery?.task_no || snapshot?.current_focus_task_no || uiState?.task_no || ''),
|
||||
String(snapshot?.updated_at || ''),
|
||||
String(uiState?.updated_at || ''),
|
||||
String(snapshot?.tasks.length || 0),
|
||||
].join('|');
|
||||
});
|
||||
watch([shippingRecoveryWatchKey, isShippingNoticeAgent], () => {
|
||||
if (!isShippingNoticeAgent.value) return;
|
||||
void applyResolvedShippingMessageRecovery(resolveLatestShippingMessageRecoveryPayload(messages.value));
|
||||
}, { immediate: true });
|
||||
watch([shippingActionsWatchKey, isThinking, isShippingNoticeAgent, () => currentAgent.value?.name], () => {
|
||||
void refreshShippingActions().then(async () => {
|
||||
const taskId = getActiveBatchTaskId() || getActiveShippingTaskId();
|
||||
@@ -1188,6 +1483,14 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
updateShippingCandidateSummary,
|
||||
resolveShippingCandidateDuplicate,
|
||||
showShippingDuplicateDialog,
|
||||
showShippingCustomerDialog,
|
||||
shippingCustomerOptions,
|
||||
shippingCustomerLoading,
|
||||
searchShippingCustomers,
|
||||
confirmShippingCustomer,
|
||||
closeShippingCustomerDialog: () => {
|
||||
showShippingCustomerDialog.value = false;
|
||||
},
|
||||
shippingDuplicateAttachment,
|
||||
canForceCreateShippingDuplicate,
|
||||
openShippingDuplicateDialog,
|
||||
|
||||
Reference in new issue
Block a user