Add automated audit link column and reconcile divergence metrics

This commit is contained in:
gitea committed 2026-10-15 16:06:29 +08:00
1 parent 16f3f252c0
commit 7df5feb7b7
2 files changed
+69 -49

No files matched your search

+39 -19
View File
@@ -267,7 +267,7 @@ function fillInline(text: string, data: ReportData, ctx: FillContext): string {
const divergedBlocks = allDiverged.slice(0, 10);
if (allDiverged.length > 0) {
const totalDiverged = allDiverged.length;
const correctDiverged = allDiverged.filter((b) => b.verdict === "ai_correct" || (!b.verdict && b.agreement === "diverged")).length;
const correctDiverged = allDiverged.filter((b) => b.verdict === "ai_correct" || b.verdict === "both_correct" || (!b.verdict && b.agreement === "diverged")).length;
const missedDiverged = totalDiverged - correctDiverged;
const correctShare = ((correctDiverged / totalDiverged) * 100).toFixed(1);
@@ -292,7 +292,7 @@ function fillInline(text: string, data: ReportData, ctx: FillContext): string {
// 历史模板模式(逐单明细模式)
if (divergedBlocks.length > 0) {
const sampleCount = divergedBlocks.length;
const sampleCorrect = divergedBlocks.filter((b) => b.verdict === "ai_correct" || (!b.verdict && b.agreement === "diverged")).length;
const sampleCorrect = divergedBlocks.filter((b) => b.verdict === "ai_correct" || b.verdict === "both_correct" || (!b.verdict && b.agreement === "diverged")).length;
const sampleMissed = sampleCount - sampleCorrect;
const sampleShare = ((sampleCorrect / sampleCount) * 100).toFixed(1);
result = result.replace(/在上述 \*\*\d+ 笔\*\*单据中:/g, `在上述 **${sampleCount} 笔**单据中:`);
@@ -527,7 +527,7 @@ function replacementRows(
];
}
const totalSample = diverged.length;
const correctSample = diverged.filter((b) => b.verdict === "ai_correct" || (!b.verdict && b.agreement === "diverged")).length;
const correctSample = diverged.filter((b) => b.verdict === "ai_correct" || b.verdict === "both_correct" || (!b.verdict && b.agreement === "diverged")).length;
const missedSample = totalSample - correctSample;
const p1 = Number(((correctSample / totalSample) * 100).toFixed(1));
const p2 = Number((100 - p1).toFixed(1));
@@ -544,7 +544,7 @@ function replacementRows(
const diverged = data.blocks.filter((block) => block.agreement === "diverged").slice(0, 10);
if (!diverged.length) return null;
return diverged.map((block) => {
const isAiRight = block.verdict === "ai_correct" || (!block.verdict && block.agreement === "diverged");
const isAiRight = block.verdict === "ai_correct" || block.verdict === "both_correct" || (!block.verdict && block.agreement === "diverged");
const category = isAiRight ? "**依规正确(计入 D4)**" : "**AI 失准(不计入分子)**";
const reviewNote = data.reviews.get(block.sn)?.note;
const conclusion = (!isAiRight && reviewNote)
@@ -667,28 +667,39 @@ function replacementRows(
});
}
// §3 潜在风险明细表(2 列:单号 | 问题描述)
if (columns.length === 2 && columns.includes("单号") && columns.includes("问题描述") && heading.includes("3.")) {
// §3 潜在风险明细表(支持 2 列:单号 | 问题描述 或 3 列:单号 | 问题描述 | 审核详情)
if (columns.includes("单号") && columns.includes("问题描述") && heading.includes("3.")) {
if (!data.blocks.length) return null;
let picks: ReportBlock[] = [];
if (heading.includes("3.2") || heading.includes("TOP 1")) {
const matches = data.blocks.filter((b) => /招待|餐费|标准|超标|人均|酒水/i.test(b.aiSummary || ""));
const picks = matches.length >= 3 ? matches.slice(0, 3) : data.blocks.filter((b) => b.agreement === "diverged").slice(0, 3);
if (picks.length) return picks.map((b) => [b.sn, b.aiSummary || "业务招待人均消费超标或缺少事前申请"]);
}
if (heading.includes("3.3") || heading.includes("TOP 2")) {
picks = matches.length >= 3 ? matches.slice(0, 3) : data.blocks.filter((b) => b.agreement === "diverged").slice(0, 3);
} else if (heading.includes("3.3") || heading.includes("TOP 2")) {
const matches = data.blocks.filter((b) => /比价|询价|合同|采购|订单|对账单|签章|未签署/i.test(b.aiSummary || ""));
const picks = matches.length >= 3 ? matches.slice(0, 3) : data.blocks.filter((b) => b.agreement === "diverged").slice(3, 6);
if (picks.length) return picks.map((b) => [b.sn, b.aiSummary || "大额采购未提供询价记录或合同未完成签署"]);
}
if (heading.includes("3.4") || heading.includes("TOP 3")) {
picks = matches.length >= 3 ? matches.slice(0, 3) : data.blocks.filter((b) => b.agreement === "diverged").slice(3, 6);
} else if (heading.includes("3.4") || heading.includes("TOP 3")) {
const matches = data.blocks.filter((b) => /超期|跨季度|时效|发票日期|过期|出差申请/i.test(b.aiSummary || ""));
const picks = matches.length >= 3 ? matches.slice(0, 3) : data.blocks.filter((b) => b.agreement === "diverged").slice(6, 9);
if (picks.length) return picks.map((b) => [b.sn, b.aiSummary || "发票开票日期已跨季度超期,违反提交时效"]);
picks = matches.length >= 3 ? matches.slice(0, 3) : data.blocks.filter((b) => b.agreement === "diverged").slice(6, 9);
}
if (!picks.length) return null;
const hasLinkCol = columns.length >= 3 && columns.some((c) => /链接|详情|直达|查看/i.test(c));
const sealBaseUrl = `https://${data.corp.id.toLowerCase()}.sealai.cc`;
return picks.map((b) => {
const desc = b.aiSummary || "业务招待人均消费超标或缺少事前申请";
const recordId = b.recordId || (b as Record<string, unknown>).id;
const sealUrl = recordId ? `${sealBaseUrl}/approval-result/${recordId}` : undefined;
const linkText = sealUrl ? `[👉 查看详情](${sealUrl})` : "—";
if (hasLinkCol) {
return [b.sn, desc, linkText];
}
return [sealUrl ? `[${b.sn}](${sealUrl})` : b.sn, desc];
});
}
// §2 失准与复核分析明细表(2 列:单号 | 问题描述)
if (columns.length === 2 && columns.includes("单号") && columns.includes("问题描述") && heading.includes("2.")) {
// §2 失准与复核分析明细表(支持 2 列:单号 | 问题描述 或 3 列:单号 | 问题描述 | 审核详情)
if (columns.includes("单号") && columns.includes("问题描述") && heading.includes("2.")) {
if (!data.blocks.length) return null;
const humanCorrectBlocks = data.blocks.filter((b) => b.verdict === "human_correct");
const candidates = humanCorrectBlocks.length >= 3
@@ -704,9 +715,18 @@ function replacementRows(
const picks = candidates.slice(start, start + 3);
if (!picks.length) return null;
const hasLinkCol = columns.length >= 3 && columns.some((c) => /链接|详情|直达|查看/i.test(c));
const sealBaseUrl = `https://${data.corp.id.toLowerCase()}.sealai.cc`;
return picks.map((b) => {
const issue = b.reviewNote || b.aiSummary || b.humanComment || b.conditions?.[0] || "规则执行与判定偏差";
return [b.sn, issue];
const recordId = b.recordId || (b as Record<string, unknown>).id;
const sealUrl = recordId ? `${sealBaseUrl}/approval-result/${recordId}` : undefined;
const linkText = sealUrl ? `[👉 查看详情](${sealUrl})` : "—";
if (hasLinkCol) {
return [b.sn, issue, linkText];
}
return [sealUrl ? `[${b.sn}](${sealUrl})` : b.sn, issue];
});
}
+30 -30
View File
@@ -59,11 +59,11 @@ $$ \text{AI 审核准确率} = \frac{\text{依规判定正确单数}}{\text{样
**解决方案**:严格校准规则触发后动作,按规则执行。
| 单号 | 问题描述 |
| --- | --- |
| FP260001 | 规则仅核验支付凭证金额一致性,不要求个人代垫的收款方必须是公司,AI 误要求 |
| CD260002 | 连续三日均为工作日(周一至周三),AI 误认为有周末未扣减问题 |
| FP260003 | 费用承担主体命中豁免白名单,AI 未执行豁免逻辑导致驳回 |
| 单号 | 问题描述 | 审核详情 |
| --- | --- | --- |
| FP260001 | 规则仅核验支付凭证金额一致性,不要求个人代垫的收款方必须是公司,AI 误要求 | [👉 查看详情](https://example.sealai.cc/approval-result/run-1) |
| CD260002 | 连续三日均为工作日(周一至周三),AI 误认为有周末未扣减问题 | [👉 查看详情](https://example.sealai.cc/approval-result/run-2) |
| FP260003 | 费用承担主体命中豁免白名单,AI 未执行豁免逻辑导致驳回 | [👉 查看详情](https://example.sealai.cc/approval-result/run-3) |
*(节选 3 例,全量 9 张)*
@@ -71,11 +71,11 @@ $$ \text{AI 审核准确率} = \frac{\text{依规判定正确单数}}{\text{样
**解决方案**:持续优化识别模型,提升多附件文字解析稳定性。
| 单号 | 问题描述 |
| --- | --- |
| SJ260004 | 手写收据金额 243 元被 OCR 误识别为 2433 元,导致金额不符误驳回 |
| FP260005 | 微信红包支付记录清晰完整,AI 误判定为无关凭据导致误驳回 |
| SG260006 | 已完整包含福利品发放人员统计表 Excel 文件,AI 因多附件漏提取误判缺件驳回 |
| 单号 | 问题描述 | 审核详情 |
| --- | --- | --- |
| SJ260004 | 手写收据金额 243 元被 OCR 误识别为 2433 元,导致金额不符误驳回 | [👉 查看详情](https://example.sealai.cc/approval-result/run-4) |
| FP260005 | 微信红包支付记录清晰完整,AI 误判定为无关凭据导致误驳回 | [👉 查看详情](https://example.sealai.cc/approval-result/run-5) |
| SG260006 | 已完整包含福利品发放人员统计表 Excel 文件,AI 因多附件漏提取误判缺件驳回 | [👉 查看详情](https://example.sealai.cc/approval-result/run-6) |
*(节选 3 例,全量 5 张)*
@@ -83,11 +83,11 @@ $$ \text{AI 审核准确率} = \frac{\text{依规判定正确单数}}{\text{样
**解决方案**:已去掉跨批次相似费用冲突的默认判定,可按需配置此功能。
| 单号 | 问题描述 |
| --- | --- |
| CGD260007 | 跨批次存在历史同类辅料费用,提示疑似冲突转人工 |
| FP260008 | 跨批次云产品疑似同类费用冲突转人工 |
| FP260009 | 发票金额 180 元(1% 普票),远未达到 500 元专票强制门槛,AI 过度怀疑是否存在专票协议转人工 |
| 单号 | 问题描述 | 审核详情 |
| --- | --- | --- |
| CGD260007 | 跨批次存在历史同类辅料费用,提示疑似冲突转人工 | [👉 查看详情](https://example.sealai.cc/approval-result/run-7) |
| FP260008 | 跨批次云产品疑似同类费用冲突转人工 | [👉 查看详情](https://example.sealai.cc/approval-result/run-8) |
| FP260009 | 发票金额 180 元(1% 普票),远未达到 500 元专票强制门槛,AI 过度怀疑是否存在专票协议转人工 | [👉 查看详情](https://example.sealai.cc/approval-result/run-9) |
*(节选 3 例,全量 5 张)*
@@ -108,31 +108,31 @@ $$ \text{AI 审核准确率} = \frac{\text{依规判定正确单数}}{\text{样
### 3.2 TOP 1 · 缺失要求凭证(23 张 / 57.5%)
| 单号 | 问题描述 |
| --- | --- |
| FP260011 | 改衣费未附改衣明细表 |
| FP260012 | 咨询费报销资料不全 |
| FP260013 | 专利代理费未列明发明名称且缺少缴费通知书 |
| 单号 | 问题描述 | 审核详情 |
| --- | --- | --- |
| FP260011 | 改衣费未附改衣明细表 | [👉 查看详情](https://example.sealai.cc/approval-result/run-11) |
| FP260012 | 咨询费报销资料不全 | [👉 查看详情](https://example.sealai.cc/approval-result/run-12) |
| FP260013 | 专利代理费未列明发明名称且缺少缴费通知书 | [👉 查看详情](https://example.sealai.cc/approval-result/run-13) |
*(节选 3 例,全量 23 张)*
### 3.3 TOP 2 · 大额预付与采购口径偏差(9 张 / 22.5%)
| 单号 | 问题描述 |
| --- | --- |
| YF260014 | 大额预付款单未关联申购单 / 申请单 |
| CGA260015 | 采购预付款单明细采购订单号与合同号不一致 |
| CGD260016 | 采购付款单品类为上装类但发票明细为服装加工费,业务勾稽不符 |
| 单号 | 问题描述 | 审核详情 |
| --- | --- | --- |
| YF260014 | 大额预付款单未关联申购单 / 申请单 | [👉 查看详情](https://example.sealai.cc/approval-result/run-14) |
| CGA260015 | 采购预付款单明细采购订单号与合同号不一致 | [👉 查看详情](https://example.sealai.cc/approval-result/run-15) |
| CGD260016 | 采购付款单品类为上装类但发票明细为服装加工费,业务勾稽不符 | [👉 查看详情](https://example.sealai.cc/approval-result/run-16) |
*(节选 3 例,全量 9 张)*
### 3.4 TOP 3 · 票据合规与专票强制违规(8 张 / 20.0%)
| 单号 | 问题描述 |
| --- | --- |
| FP260017 / FP260018 / FP260019 | 发票类对外支付模板未上传正规发票,上传非正规微信截图或洗衣取衣单据 |
| FP260020 | 高税率业务金额超 500 元未开具增值税专用发票且无免专票佐证 |
| FP260021 | 完税证明纳税人名称与费用承担公司主体不一致 |
| 单号 | 问题描述 | 审核详情 |
| --- | --- | --- |
| FP260017 / FP260018 / FP260019 | 发票类对外支付模板未上传正规发票,上传非正规微信截图或洗衣取衣单据 | [👉 查看详情](https://example.sealai.cc/approval-result/run-17) |
| FP260020 | 高税率业务金额超 500 元未开具增值税专用发票且无免专票佐证 | [👉 查看详情](https://example.sealai.cc/approval-result/run-20) |
| FP260021 | 完税证明纳税人名称与费用承担公司主体不一致 | [👉 查看详情](https://example.sealai.cc/approval-result/run-21) |
*(节选 3 条,全量 8 张)*