feat(shipping-notice): 新增临时库存管理功能,支持创建会话、获取分析结果及字段映射建议

This commit is contained in:
hugo committed 2026-07-18 11:41:02 +08:00
1 parent 46eb63f5bb
commit e9bdd81f1a
320 files changed
+28361 -10487

No files matched your search

@@ -82,6 +82,40 @@ describe('useChatShippingSendHandler', () => {
expect(ctx.msg.info).toHaveBeenCalledWith('chat.shippingNoticeBatchSubmitting');
});
it('keeps a spreadsheet pending until the user explicitly declares it as inventory', async () => {
const attachment = {
id: 'spreadsheet', kind: 'local' as const,
file: new File(['sheet'], 'unknown.xlsx', { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }),
type: 'document' as const, uploadStatus: 'waiting' as const, uploadProgress: 0,
};
const ctx = createContext({ attachments: ref([attachment]) });
const { tryHandleShippingAttachmentAutoFlow } = createShippingSendHandlers(ctx);
const consumed = await tryHandleShippingAttachmentAutoFlow(undefined, '', '');
expect(consumed).toBe(true);
expect(ctx.handleShippingAutoUploadFile).not.toHaveBeenCalled();
expect(ctx.handleShippingAutoUploadNoticeBatch).not.toHaveBeenCalled();
expect(ctx.msg.info).toHaveBeenCalledWith('chat.shippingNoticeSpreadsheetIntentRequired');
expect(ctx.attachments.value).toHaveLength(1);
});
it('routes a declared xls spreadsheet to the isolated temporary inventory path', async () => {
const attachment = {
id: 'legacy-spreadsheet', kind: 'local' as const,
file: new File(['sheet'], 'inventory.xls', { type: 'application/vnd.ms-excel' }),
type: 'document' as const, uploadStatus: 'waiting' as const, uploadProgress: 0,
};
const ctx = createContext({ attachments: ref([attachment]), shippingAutoFlowRequested: ref(false) });
const { tryHandleShippingAttachmentAutoFlow } = createShippingSendHandlers(ctx);
const consumed = await tryHandleShippingAttachmentAutoFlow('这是库存文件,请分析', '这是库存文件,请分析', '这是库存文件,请分析');
expect(consumed).toBe(true);
expect(ctx.handleShippingAutoUploadFile).toHaveBeenCalledWith(attachment.file);
expect(ctx.handleShippingAutoUploadNoticeBatch).not.toHaveBeenCalled();
});
it('sends parsed intakes to the existing Chatflow without requiring upload-time candidates', async () => {
const completionOrder: string[] = [];
const attachment = {