feat(shipping-notice): 添加识别定义和规则集管理功能,支持客户和站点的可配置识别规则
This commit is contained in:
1 parent
88408490d7
commit
34d489a2d1
167 files changed
+10365
-7978
No files matched your search
@@ -37,13 +37,23 @@ const ACTIVE_ORDER_EXTRACTION = new Set(['extracting']);
|
||||
/**
|
||||
* 判断服务端 Intake 是否应恢复到输入栏。
|
||||
* AI 触发时机:无;页面刷新或重新打开会话时调用。
|
||||
* 已解析文件已作为用户消息附件固化在对话气泡中,不能再次显示在输入栏;仅恢复仍在处理中的文件和可手动重试的解析失败文件。
|
||||
* @param parseStatus - 服务端返回的预解析状态
|
||||
* 已解析文件已作为用户消息附件固化在对话气泡中,不能再次显示在输入栏;但存在待审核
|
||||
* Candidate 的部分完成 Intake 必须恢复,否则用户无法补充字段并继续建单。
|
||||
* @param parseStatus - 服务端返回的预解析状态。
|
||||
* @param orderExtractionStatus - 服务端返回的订单抽取状态。
|
||||
* @param candidateCount - 当前仍可审核的订单 Candidate 数量。
|
||||
* @returns 是否恢复为待发送附件卡片
|
||||
*/
|
||||
export function shouldRestoreShippingNoticeIntake(parseStatus: string | null | undefined): boolean {
|
||||
export function shouldRestoreShippingNoticeIntake(
|
||||
parseStatus: string | null | undefined,
|
||||
orderExtractionStatus?: string | null,
|
||||
candidateCount = 0,
|
||||
): boolean {
|
||||
const status = String(parseStatus || '').trim().toLowerCase();
|
||||
return ACTIVE_PARSE.has(status) || status === 'parse_failed';
|
||||
const extractionStatus = String(orderExtractionStatus || '').trim().toLowerCase();
|
||||
return ACTIVE_PARSE.has(status)
|
||||
|| status === 'parse_failed'
|
||||
|| (extractionStatus === 'partially_completed' && candidateCount > 0);
|
||||
}
|
||||
|
||||
/** 判断 Intake 是否仍需轮询上传预处理或订单抽取状态。 */
|
||||
@@ -437,7 +447,11 @@ export function useShippingNoticeIntakes(options: UseShippingNoticeIntakesOption
|
||||
const restoreForConversation = async (conversationId?: string | null) => {
|
||||
const { items } = await listActiveShippingNoticeIntakes(conversationId);
|
||||
const restored: ShippingNoticePendingAttachment[] = items
|
||||
.filter((item) => shouldRestoreShippingNoticeIntake(item.parse_status))
|
||||
.filter((item) => shouldRestoreShippingNoticeIntake(
|
||||
item.parse_status,
|
||||
item.order_extraction_status,
|
||||
item.candidates?.length || 0,
|
||||
))
|
||||
.map((item) => ({
|
||||
id: `restored_${item.intake_no}`,
|
||||
kind: 'shipping_notice' as const,
|
||||
|
||||
Reference in new issue
Block a user