feat(shipping-notice): 新增临时库存管理功能,支持创建会话、获取分析结果及字段映射建议
This commit is contained in:
1 parent
46eb63f5bb
commit
e9bdd81f1a
320 files changed
+28361
-10487
No files matched your search
@@ -2,7 +2,7 @@
|
||||
* features/chat/shipping/shippingDecisionFormat.ts
|
||||
* 用途:决策 API 响应格式化为助手 Markdown 消息。
|
||||
* 依赖:无;useChatShippingDecision 在 submit_decision 成功后调用。
|
||||
* 逻辑:按 decision 类型追加映射提示、下一步指引与任务编号尾注。
|
||||
* 逻辑:按 decision 类型追加业务提示与任务编号尾注。
|
||||
*/
|
||||
/**
|
||||
* 将 submit_decision 结果格式化为本地 assistant 消息 Markdown。
|
||||
@@ -14,34 +14,8 @@ export function formatShippingDecisionAssistantMessage(
|
||||
fallbackDoneMessage: string,
|
||||
): string {
|
||||
const lines: string[] = [result.message || fallbackDoneMessage];
|
||||
if (decision === 'correct_inventory_mapping') {
|
||||
const preview = (result.data?.schema_preview || {}) as Record<string, unknown>;
|
||||
const headers = Array.isArray(preview.headers) ? (preview.headers as unknown[]).filter(Boolean) : [];
|
||||
const suggested = (preview.suggested_mapping || {}) as Record<string, string>;
|
||||
if (preview.header_row_index) {
|
||||
lines.push('', `表头在第 ${preview.header_row_index} 行:${headers.join(' | ')}`);
|
||||
} else if (headers.length) {
|
||||
lines.push('', `当前表头:${headers.join(' | ')}`);
|
||||
}
|
||||
const mappingLines = [
|
||||
suggested.part_number ? `- part_number → ${suggested.part_number}` : null,
|
||||
suggested.reservation_id ? `- reservation_id → ${suggested.reservation_id}` : null,
|
||||
suggested.available_qty ? `- available_qty → ${suggested.available_qty}` : null,
|
||||
].filter((line): line is string => Boolean(line));
|
||||
if (mappingLines.length) {
|
||||
lines.push('', '建议列映射:', ...mappingLines);
|
||||
}
|
||||
lines.push(
|
||||
'',
|
||||
'如需调整,请说明要改的列(例如:available_qty 改用 Qty Available)。',
|
||||
'也可点击「选择库存文件」重新上传。',
|
||||
);
|
||||
} else if (decision === 'confirm_inventory_mapping') {
|
||||
if (String(result.checkpoint || '').trim() === 'map_ok') {
|
||||
lines.push('', '下一步:匹配库存与发货需求。');
|
||||
}
|
||||
} else if (decision === 'reparse_inventory') {
|
||||
lines.push('', '请重新上传或粘贴库存 Excel。');
|
||||
if (decision === 'reparse_inventory') {
|
||||
lines.push('', '请点击「选择库存文件」重新上传。');
|
||||
}
|
||||
lines.push('', `任务编号:${taskId}`);
|
||||
return lines.join('\n');
|
||||
|
||||
Reference in new issue
Block a user