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
@@ -106,24 +106,47 @@ const attachmentUrlInput = ref('');
|
||||
|
||||
/**
|
||||
* 汇总 EML 附件解析进度,供输入栏徽标展示。
|
||||
* 核心逻辑:failed/empty/skipped/超限/文本预算耗尽计为问题;duplicate 单独提示,不记为失败。
|
||||
* 核心逻辑:阶段 1 仅展示快览结果;优先说明发现了多少附件,技术失败/目录不完整再退化为问题提示。
|
||||
*/
|
||||
function shippingNoticeAttachmentHint(attachment: ShippingNoticePendingAttachment): string {
|
||||
const summary = attachment.parseSummary;
|
||||
const total = Number(summary?.attachment_count || 0);
|
||||
const rows = summary?.attachments || [];
|
||||
// 兼容旧摘要:早期快览未标记签名图,按内嵌标记、目录原因和图片 MIME 一并排除。
|
||||
const businessRows = rows.filter((item) => {
|
||||
const mimeType = String(item.mime_type || '').toLowerCase();
|
||||
const catalogReason = String(item.catalog_reason || '').toLowerCase();
|
||||
return !item.is_inline_resource
|
||||
&& !mimeType.startsWith('image/')
|
||||
&& catalogReason !== 'signature_or_logo'
|
||||
&& catalogReason !== 'inline_resource';
|
||||
});
|
||||
const inlineCount = rows.length - businessRows.length;
|
||||
const total = Math.max(0, Number(summary?.attachment_count || 0) - inlineCount);
|
||||
const warnings = summary?.warnings || [];
|
||||
const hasBlockingWarning = warnings.some((w) => isBlockingWarning(String(w || '')));
|
||||
if (!total && !hasBlockingWarning && !rows.length) return '';
|
||||
if (!total && !hasBlockingWarning && !businessRows.length) return '';
|
||||
|
||||
const effectiveTotal = total || rows.length;
|
||||
const ok = rows.filter((item) => item.parse_status === 'parsed').length;
|
||||
const problematic = rows.filter((item) =>
|
||||
const effectiveTotal = total || businessRows.length;
|
||||
const ok = Number(summary?.ready_attachment_count || businessRows.filter((item) => item.ready_for_extraction).length);
|
||||
const problematic = businessRows.filter((item) =>
|
||||
['failed', 'empty', 'skipped'].includes(String(item.parse_status || '')),
|
||||
).length;
|
||||
const duplicates = rows.filter((item) => item.parse_status === 'duplicate').length;
|
||||
const overflow = Math.max(0, effectiveTotal - rows.length);
|
||||
const issues = problematic + overflow + (hasBlockingWarning && problematic === 0 && overflow === 0 ? 1 : 0);
|
||||
const duplicates = Number(
|
||||
summary?.duplicate_attachment_count
|
||||
|| businessRows.filter((item) => item.parse_status === 'duplicate').length,
|
||||
);
|
||||
const overflow = Math.max(0, effectiveTotal - businessRows.length);
|
||||
const previewStatus = String(summary?.preview_status || '').trim().toLowerCase();
|
||||
const issues = problematic
|
||||
+ overflow
|
||||
+ (hasBlockingWarning && problematic === 0 && overflow === 0 ? 1 : 0)
|
||||
+ (
|
||||
(summary?.technical_failure || previewStatus === 'technical_failed' || previewStatus === 'directory_incomplete')
|
||||
&& problematic === 0
|
||||
&& overflow === 0
|
||||
? 1
|
||||
: 0
|
||||
);
|
||||
|
||||
if (issues > 0) {
|
||||
return t('chat.shippingNoticeAttachmentHintPartial', {
|
||||
@@ -132,14 +155,11 @@ function shippingNoticeAttachmentHint(attachment: ShippingNoticePendingAttachmen
|
||||
failed: issues,
|
||||
});
|
||||
}
|
||||
if (attachment.layoutStatus === 'processing') {
|
||||
return t('chat.shippingNoticeAttachmentHintLayoutProcessing', { ok, total: effectiveTotal });
|
||||
}
|
||||
if (duplicates > 0) {
|
||||
return t('chat.shippingNoticeAttachmentHintWithDup', { ok, total: effectiveTotal, duplicates });
|
||||
return t('chat.shippingNoticeAttachmentHintDiscoveredWithDup', { total: effectiveTotal, duplicates });
|
||||
}
|
||||
if (!effectiveTotal) return '';
|
||||
return t('chat.shippingNoticeAttachmentHint', { ok, total: effectiveTotal });
|
||||
return t('chat.shippingNoticeAttachmentHintDiscovered', { total: effectiveTotal });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user