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

@@ -2,7 +2,7 @@
* features/chat/shipping/shippingUploadPrompt.ts
* 用途:通知上传后提示语构建、文件格式识别与临时库存声明判断。
* 依赖:无;useChatShippingUploadHandler 在上传成功后调用。
* 逻辑:按 checkpoint 生成不同 follow-up 提示;通知建批后触发 Dify 完整动态订单抽取。
* 逻辑:按提交结果生成 follow-up 提示;通知进入 Intake 后触发完整动态订单抽取。
*/
import i18n from '@/i18n';
@@ -10,17 +10,12 @@ import i18n from '@/i18n';
* 根据上传 API 响应 checkpoint 生成发给 Agent 的 follow-up 提示语。
*/
/**
* 根据通知建批 API 响应生成发给 Dify 的 follow-up 提示语(触发完整订单抽取链)。
* 根据通知提交 API 响应生成发给 Dify 的 follow-up 提示语(触发完整订单抽取链)。
*/
export function buildShippingNoticeUploadPrompt(
result: Record<string, unknown> | null | undefined,
options?: { fileCount?: number; fileName?: string },
): string {
const batchNo = String(
(result?.batch_no as string | undefined)
|| ((result?.data as { batch?: { batch_no?: string } } | undefined)?.batch?.batch_no)
|| '',
).trim();
const taskId = String(
((result?.data as { focus_task?: { task_no?: string } } | undefined)?.focus_task?.task_no)
|| (result?.task_id as string | undefined)
@@ -39,9 +34,6 @@ export function buildShippingNoticeUploadPrompt(
? String(i18n.global.t('chat.shippingNoticePrompt.notice.fileLabelMulti', { fileCount }))
: String(i18n.global.t('chat.shippingNoticePrompt.notice.fileLabelDefault')));
const parts = [String(i18n.global.t('chat.shippingNoticePrompt.notice.uploadedPrefix', { fileLabel }))];
if (batchNo) {
parts.push(String(i18n.global.t('chat.shippingNoticePrompt.notice.batchLabel', { batchNo })));
}
if (taskId) {
parts.push(String(i18n.global.t('chat.shippingNoticePrompt.notice.taskLabel', { taskId })));
}