feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码

This commit is contained in:
hugo committed 2026-08-23 00:27:18 +08:00
1 parent 935bf26fa6
commit 7cfd5d167e
230 files changed
+9337 -10989

No files matched your search

@@ -6,7 +6,6 @@
* 单票覆盖仍经 replace_notice Turn;库存文件先成为私有临时资产再进 Dify 分析分支。
*/
import { computed } from 'vue';
import type { ShippingTaskSummary } from '@/features/chat/api/shipping.api';
import { uploadFileAsset } from '@/shared/api/file-assets.api';
import { extractExt } from '../constants/shipping';
import { buildShippingReplaceNoticeTurn, buildShippingTurnRefs } from './shippingTurnActions';
@@ -18,25 +17,6 @@ import type { ComputedRef, Ref } from 'vue';
let noticeBatchSubmitting = false;
/**
* 显式清理待重试建批幂等状态(co8 后建批已下线,保留空实现供会话切换调用方兼容)。
*/
export function clearPendingNoticeBatchRetry(): void {
/* no-op: shipping_batches 已 DROP */
}
/**
* 用户主动切换会话时的钩子(co8 后无幂等键可清)。
* @param _nextId - 新会话 ID
* @param _prevId - 旧会话 ID
*/
export function onNoticeBatchConversationChanging(
_nextId: string,
_prevId?: string | null,
): void {
/* no-op */
}
/**
* 查询发货通知建批是否正在提交中(供发送拦截器消费重复点击)。
*/
@@ -47,7 +27,6 @@ export function isShippingNoticeBatchSubmitting(): boolean {
/** 单测重置模块级建批提交状态。 */
export function resetShippingNoticeBatchSubmitStateForTests(): void {
noticeBatchSubmitting = false;
clearPendingNoticeBatchRetry();
}
export interface ShippingUploadHandlerContext {
@@ -62,9 +41,6 @@ export interface ShippingUploadHandlerContext {
pendingShippingNoticeTaskId: Ref<string>;
pendingShippingInventoryFile: Ref<File | null>;
resolvedShippingTaskId: Ref<string>;
resolvedShippingBatchNo: Ref<string>;
shippingBatchSummary: Ref<unknown | null>;
shippingBatchTasks: Ref<ShippingTaskSummary[]>;
shippingInventorySelectionActive: Ref<boolean>;
shippingInventorySelectionTaskId: Ref<string>;
getActiveShippingTaskId: () => string;
@@ -160,11 +136,9 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
const syncBatchContextFromTurnMessage = (assistantMsg: ChatMessage) => {
const payload = assistantMsg.payload && typeof assistantMsg.payload === 'object'
? assistantMsg.payload as { batch_no?: string; task_no?: string; orchestrator_started?: boolean }
? assistantMsg.payload as { task_no?: string; orchestrator_started?: boolean }
: {};
const batchNo = String(payload.batch_no || assistantMsg.shipping_ui_state?.batch_no || '').trim();
const taskId = String(payload.task_no || assistantMsg.shipping_ui_state?.task_no || '').trim();
if (batchNo) ctx.resolvedShippingBatchNo.value = batchNo;
if (taskId) ctx.resolvedShippingTaskId.value = taskId;
};