refactor(agent, shipping): 简化代理模型并完善订单抽取业务
- 移除 Agent 的 exposure_mode 与 internal_executor 相关逻辑,清理关联的过滤、序列化代码 - 删除废弃的 AgentRuntimeBinding 模型及其依赖 - 新增订单抽取上传批次、请求快照等数据库迁移与业务逻辑 - 修复附件完整性检测、订单抽取状态映射问题 - 更新多语言错误文案与前端单元测试配置 - 清理平台配置中不再使用的暴露模式配置
This commit is contained in:
1 parent
1f3ecb87b7
commit
61ac6403c4
159 files changed
+12883
-5099
No files matched your search
@@ -71,8 +71,11 @@ describe('attachment card utils', () => {
|
||||
|
||||
it('preserves shipping parsing, failure and duplicate attention states', () => {
|
||||
expect(getAttachmentCardStatus(shippingAttachment({ parseStatus: 'parsing' })).state).toBe('processing');
|
||||
expect(getAttachmentCardStatus(shippingAttachment({ layoutStatus: 'processing' }))).toEqual({
|
||||
state: 'processing', labelKey: 'chat.attachment.layoutProcessing',
|
||||
expect(getAttachmentCardStatus(shippingAttachment({
|
||||
layoutStatus: 'processing',
|
||||
parseSummary: { preview_status: 'ready_for_extraction', ready_for_extraction: true },
|
||||
}))).toEqual({
|
||||
state: 'ready', labelKey: 'chat.shippingNoticeReady',
|
||||
});
|
||||
expect(getAttachmentCardStatus(shippingAttachment({ parseStatus: 'failed' }))).toEqual({
|
||||
state: 'failed', labelKey: 'chat.attachment.parseFailed',
|
||||
@@ -89,6 +92,29 @@ describe('attachment card utils', () => {
|
||||
expect(getAttachmentCardStatus(shippingAttachment()).state).toBe('ready');
|
||||
});
|
||||
|
||||
it('surfaces preview directory issues without falling back to fake processing', () => {
|
||||
expect(getAttachmentCardStatus(shippingAttachment({
|
||||
parseSummary: {
|
||||
preview_status: 'directory_incomplete',
|
||||
ready_for_extraction: false,
|
||||
attachment_directory_complete: false,
|
||||
},
|
||||
}))).toEqual({
|
||||
state: 'attention',
|
||||
labelKey: 'chat.shippingNoticeAttachmentIncompleteWarn',
|
||||
});
|
||||
expect(getAttachmentCardStatus(shippingAttachment({
|
||||
parseSummary: {
|
||||
preview_status: 'technical_failed',
|
||||
technical_failure: true,
|
||||
ready_for_extraction: false,
|
||||
},
|
||||
}))).toEqual({
|
||||
state: 'failed',
|
||||
labelKey: 'chat.attachment.parseFailed',
|
||||
});
|
||||
});
|
||||
|
||||
it('shows the order extraction lifecycle separately from attachment parsing', () => {
|
||||
expect(getAttachmentCardStatus(shippingAttachment({ orderExtractionStatus: 'extracting' }))).toEqual({
|
||||
state: 'processing', labelKey: 'chat.shippingOrderExtractionProcessing',
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
import type { ChatMessageAttachment } from '../types/chat.types';
|
||||
import type { AttachmentUiStatus, PendingAttachment } from '../types/shipping.types';
|
||||
import { isShippingNoticeAttachmentParseIncomplete } from '../shipping/shippingNoticeAttachmentIntegrity';
|
||||
|
||||
export interface AttachmentCardStatus {
|
||||
state: AttachmentUiStatus;
|
||||
@@ -70,9 +71,6 @@ export function getAttachmentCardStatus(attachment: PendingAttachment): Attachme
|
||||
return { state: 'processing', labelKey: 'chat.attachment.processing' };
|
||||
}
|
||||
if (attachment.parseStatus === 'failed') return { state: 'failed', labelKey: 'chat.attachment.parseFailed' };
|
||||
if (attachment.layoutStatus === 'processing') {
|
||||
return { state: 'processing', labelKey: 'chat.attachment.layoutProcessing' };
|
||||
}
|
||||
const extractionStatus = String(attachment.orderExtractionStatus || '').trim().toLowerCase();
|
||||
if (extractionStatus === 'extracting') {
|
||||
return { state: 'processing', labelKey: 'chat.shippingOrderExtractionProcessing' };
|
||||
@@ -87,6 +85,13 @@ export function getAttachmentCardStatus(attachment: PendingAttachment): Attachme
|
||||
return { state: 'ready', labelKey: 'chat.shippingOrderExtractionCompleted' };
|
||||
}
|
||||
if (attachment.parseStatus === 'parsed' && !attachment.duplicateResolution?.action) {
|
||||
if (isShippingNoticeAttachmentParseIncomplete(attachment.parseSummary)) {
|
||||
const previewStatus = String(attachment.parseSummary?.preview_status || '').trim().toLowerCase();
|
||||
if (attachment.parseSummary?.technical_failure || previewStatus === 'technical_failed') {
|
||||
return { state: 'failed', labelKey: 'chat.attachment.parseFailed' };
|
||||
}
|
||||
return { state: 'attention', labelKey: 'chat.shippingNoticeAttachmentIncompleteWarn' };
|
||||
}
|
||||
if (attachment.duplicate?.blocking) {
|
||||
return { state: 'attention', labelKey: 'chat.shippingNoticeDuplicateBlockingBadge' };
|
||||
}
|
||||
@@ -95,7 +100,7 @@ export function getAttachmentCardStatus(attachment: PendingAttachment): Attachme
|
||||
}
|
||||
}
|
||||
if (attachment.parseStatus === 'parsed' || attachment.parseStatus === 'consumed') {
|
||||
return { state: 'ready', labelKey: 'chat.attachment.ready' };
|
||||
return { state: 'ready', labelKey: 'chat.shippingNoticeReady' };
|
||||
}
|
||||
return { state: 'pending', labelKey: 'chat.attachment.pending' };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user