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

@@ -1,34 +1,24 @@
/**
* features/chat/shipping/shippingDecisionFormat.spec.ts
* 用途:验证库存映射人工修正摘要使用 v2 系统字段名。
* 用途:验证库存重新上传决策只输出业务引导,不再暴露任务级字段映射。
* 依赖:vitest、shippingDecisionFormat。
* 逻辑:锁死建议映射展示中的 part_number,防止旧 sku 契约回流。
* 逻辑:断言重新上传提示和任务编号完整,同时排除旧技术字段。
*/
import { describe, expect, it } from 'vitest';
import { formatShippingDecisionAssistantMessage } from './shippingDecisionFormat';
describe('formatShippingDecisionAssistantMessage', () => {
it('renders part_number for inventory mapping suggestions', () => {
it('guides inventory reupload without legacy mapping terms', () => {
const text = formatShippingDecisionAssistantMessage(
'correct_inventory_mapping',
{
message: '请修正映射',
data: {
schema_preview: {
headers: ['Supplier Sku', 'COM ID', 'Qty Available'],
suggested_mapping: {
part_number: 'Supplier Sku',
reservation_id: 'COM ID',
available_qty: 'Qty Available',
},
},
},
},
'SN-MAP-001',
'reparse_inventory',
{ message: '当前库存已解除关联。' },
'SN-REUPLOAD-001',
'操作已完成',
);
expect(text).toContain('- part_number → Supplier Sku');
expect(text).not.toContain('- sku →');
expect(text).toContain('选择库存文件');
expect(text).toContain('SN-REUPLOAD-001');
expect(text).not.toContain('schema_preview');
expect(text).not.toContain('map_json');
});
});