From 05dfd0f5bbf78ad72edf2fd99bd0abb55abeb232 Mon Sep 17 00:00:00 2001 From: yunyingk Date: Fri, 16 Oct 2026 12:16:49 +0800 Subject: [PATCH] Clean report templates, drop legacy charts, and refine guidelines --- .../seal-use/references/report-templates.md | 22 +- src/domains/seal/reports/README.md | 4 +- .../reports/charts/duration-histogram.test.ts | 66 ----- .../seal/reports/charts/duration-histogram.ts | 248 ---------------- src/domains/seal/reports/charts/index.ts | 1 - src/domains/seal/reports/export/files.ts | 2 +- src/domains/seal/reports/templates/README.md | 3 +- .../reports/templates/assets/图2-综合效益.svg | 123 -------- .../reports/templates/assets/图3-示例截图.svg | 5 - .../templates/examples/赢家时尚-202608.md | 265 ------------------ .../seal/reports/templates/resources.ts | 6 +- 11 files changed, 17 insertions(+), 728 deletions(-) delete mode 100644 src/domains/seal/reports/charts/duration-histogram.test.ts delete mode 100644 src/domains/seal/reports/charts/duration-histogram.ts delete mode 100644 src/domains/seal/reports/templates/assets/图2-综合效益.svg delete mode 100644 src/domains/seal/reports/templates/assets/图3-示例截图.svg delete mode 100644 src/domains/seal/reports/templates/examples/赢家时尚-202608.md diff --git a/skills/seal-use/references/report-templates.md b/skills/seal-use/references/report-templates.md index 5bf55ed..dc6755b 100644 --- a/skills/seal-use/references/report-templates.md +++ b/skills/seal-use/references/report-templates.md @@ -167,30 +167,33 @@ sequenceDiagram Agent->>CLI: 4. seal-use report validate 报告.md CLI-->>Agent: 门禁通过 (valid: true) - Agent->>CLI: 5. seal-use report render 报告.md --out build/报告/ + Agent->>CLI: 5. seal-use report render 报告.md --out <输出目录>/报告/ CLI-->>User: 交付单文件 HTML、A4 PDF 与长图 PNG ``` #### 具体操作指令: ```bash # 步骤 1:一键拉取指定周期的全量明细台账(含 AI 完整意见与人工批注) -seal-use report ledger --start-date 2026-08-12 --end-date 2026-09-18 --corp --out reports/明细台账.xlsx +seal-use report ledger --start-date 2026-08-12 --end-date 2026-09-18 --corp --out <输出目录>/明细台账.xlsx # 步骤 2:Agent 或用户在 Excel 中自由裁量,增删模板行并填入裁决; # 步骤 3:严格以修改后的台账为唯一事实源,出具报告草稿 -seal-use report generate --ledger reports/明细台账.xlsx --corp --out reports/审核报告.md +seal-use report generate --ledger <输出目录>/明细台账.xlsx --corp --out <输出目录>/审核报告.md # 步骤 4:严格门禁校验(必须通过) -seal-use report validate reports/审核报告.md +seal-use report validate <输出目录>/审核报告.md # 步骤 5:本地全格式编译渲染 -seal-use report render reports/审核报告.md --out build/审核报告/ +seal-use report render <输出目录>/审核报告.md --out <输出目录>/审核报告/ ``` > [!TIP] > **全量取数与分页控制**:`seal-use report ledger`、`report data` 与 `report generate` 默认自动分页拉取所选时间区间内的**全部审批单据**(内置 100,000 笔安全防死循环上限),无任何 500 条的人工截断限制。如需做小样本分析或限定抓取笔数,可传入 `--limit `(别名 `--max-runs ` / `-n `,例如 `--limit 2000`)。 +> [!IMPORTANT] +> **落盘位置红线(代码仓零污染)**:`seal-use` 是全局 CLI,输出目录与执行目录解耦。最终交付物以客户/用户要求为最高准则,放用户指定目录或系统下载目录(如 `~/Downloads/<企业名>-/`),**严禁在代码仓库根目录(如 `Code/seal-use/reports/`)生成或留存业务报告文件**。会话内供 Agent 快速读取的只读快照落在全局缓存 `~/.cache/seal-use/reports///`,缓存天然可丢弃、可随时清理,且不占用 `~/.config/`。 + --- ### 模式 B:CLI 命令行实时研讨驱动 @@ -232,7 +235,7 @@ seal-use report render reports/审核报告.md --out build/审核报告/ 4. **离线台账批量导入**: 若线下已在 Excel 台账中集中批量评审完毕,可一键导入持久化存储: ```bash - seal-use report review import reports/明细台账.xlsx --corp + seal-use report review import <输出目录>/明细台账.xlsx --corp ``` --- @@ -265,6 +268,7 @@ seal-use report render reports/审核报告.md --out build/审核报告/ - **准确率严密计算公式**(必须在正文中由 LaTeX 公式呈现): $$\text{AI 准确率} = \frac{D_1 + D_4}{S} = \frac{\text{双方同向一致通过数} + \text{AI 依规正确拦截数}}{\text{样本总量}}$$ - 动态内嵌维恩图(`图 1:AI 与人工审核准确率对比.svg`),直观呈现两者的交集与重合度。 + - **图表纯粹性**:标准模板只保留这一张数据驱动维恩图;旧版图二(综合效益耗时直方图)与图三(截图占位)已全面废弃并清理,严禁再引入冗余图表或相关死代码。 ### 3. §2 AI 判定误判分析 - **2.1 误判构成总览**:总结在分歧复核中判定为“人工正确 / AI 判定误判”的单据总量及在全样本中的占比。 @@ -322,7 +326,7 @@ seal-use report render reports/审核报告.md --out build/审核报告/ 在执行最终渲染交付前,Agent **必须**执行门禁校验命令: ```bash -seal-use report validate reports/审核报告.md +seal-use report validate <输出目录>/审核报告.md ``` 若存在任何格式或数学勾稽问题,命令将以 **退出码 1** 阻断导出,并输出带有错误代码的 JSON。Agent 必须根据报错信息自主编辑修正。 @@ -351,10 +355,10 @@ seal-use report validate reports/审核报告.md ```bash # 一键编译全套产物(单文件 HTML、A4 PDF、超清拼接长图 PNG) -seal-use report render reports/审核报告.md --out build/审核报告/ --format all +seal-use report render <输出目录>/审核报告.md --out <输出目录>/审核报告/ --format all # 整包打包归档(产出 ZIP / 完整文件夹,自动收拢 Markdown、配图与明细台账) -seal-use report export reports/审核报告.md --out build/交付整包/ +seal-use report export <输出目录>/审核报告.md --out <输出目录>/交付整包/ ``` ### 交付产物技术特性与适用场景: diff --git a/src/domains/seal/reports/README.md b/src/domains/seal/reports/README.md index c4c9d61..edbbafc 100644 --- a/src/domains/seal/reports/README.md +++ b/src/domains/seal/reports/README.md @@ -12,7 +12,6 @@ src/domains/seal/reports/ ├── charts/ # 图表生成子模块(100% 纯 TS 数据驱动矢量计算) │ ├── venn.ts # 图 1:AI 与人工审核准确率对比维恩图 -│ ├── duration-histogram.ts # 图 2:多模板单据审核耗时分布对比堆叠直方图 │ └── index.ts # 图表模块出口 ├── pipeline/ # 取数、推断与组装流水线 │ ├── describe.ts # 解析 Markdown 标题并反推各章节数据需求 @@ -37,8 +36,7 @@ src/domains/seal/reports/ │ ├── monthly.md # 标准月度报告 Markdown 模板 │ ├── report.css # 报告排版与 A4 打印样式表 │ ├── resources.ts # Bun 编译期静态资源嵌入定义 -│ ├── assets/ # 内置图表矢量资产 -│ └── examples/ # 真实脱敏报告示例 +│ └── assets/ # 内置图 1 矢量图表资产 ├── index.ts # 报告域对外统一门面出口 (Barrel) └── README.md # 架构与开发指南 ``` diff --git a/src/domains/seal/reports/charts/duration-histogram.test.ts b/src/domains/seal/reports/charts/duration-histogram.test.ts deleted file mode 100644 index 7141a93..0000000 --- a/src/domains/seal/reports/charts/duration-histogram.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { describe, expect, test } from "bun:test"; -import { renderDurationHistogramPng, renderDurationHistogramSvg, DEFAULT_EEKA_DURATION_SERIES } from "./duration-histogram.js"; -import { pngDimensions } from "../render/png.js"; -import { writeFileSync, unlinkSync } from "node:fs"; -import { join } from "node:path"; -import { tmpdir } from "node:os"; - -describe("renderDurationHistogramSvg", () => { - test("generates valid SVG with default EEKA 240-sample series and average line", () => { - const svg = renderDurationHistogramSvg(); - - expect(svg).toStartWith("\n"); - expect(svg).toContain("各单据模板审核耗时分布对比"); - expect(svg).toContain("总体平均耗时: 445.4秒"); - expect(svg).toContain("审核耗时(秒)"); - expect(svg).toContain("单据数量"); - expect(svg).toContain("采购付款单-月结款 (15单)"); - expect(DEFAULT_EEKA_DURATION_SERIES).toHaveLength(7); - const totalSamples = DEFAULT_EEKA_DURATION_SERIES.reduce((acc, s) => acc + s.count, 0); - expect(totalSamples).toBe(240); - expect(svg).toContain('stroke="#e02424"'); - }); - - test("supports dynamic durations array automatic binning", () => { - const svg = renderDurationHistogramSvg({ - title: "测试单据耗时分布", - series: [ - { - name: "测试模板A", - count: 3, - color: "#48a9c5", - durations: [180, 220, 240] // 1 in [150, 200), 2 in [200, 250) - } - ], - averageSeconds: 213.3, - averageLabel: "平均: 213.3秒" - }); - - expect(svg).toContain("测试单据耗时分布"); - expect(svg).toContain("平均: 213.3秒"); - expect(svg).toContain("测试模板A (3单)"); - expect(svg).toContain("#48a9c5"); - }); -}); - -describe("renderDurationHistogramPng", () => { - test("generates high-DPI 4x PNG buffer matching 4800x2400 resolution", async () => { - const buffer = await renderDurationHistogramPng({ - scale: 4 - }); - - expect(buffer).toBeDefined(); - expect(buffer.length).toBeGreaterThan(50_000); - - const tmpFile = join(tmpdir(), `test-hist-${Date.now()}.png`); - try { - writeFileSync(tmpFile, buffer); - const dims = pngDimensions(tmpFile); - expect(dims.width).toBe(4800); - expect(dims.height).toBe(2400); - } finally { - try { unlinkSync(tmpFile); } catch {} - } - }, 15000); -}); diff --git a/src/domains/seal/reports/charts/duration-histogram.ts b/src/domains/seal/reports/charts/duration-histogram.ts deleted file mode 100644 index 6c29528..0000000 --- a/src/domains/seal/reports/charts/duration-histogram.ts +++ /dev/null @@ -1,248 +0,0 @@ -import { renderHtmlToImageBuffer } from "../render/browser.js"; - -export interface HistogramSeries { - name: string; - count: number; - color: string; - /** 每单审核耗时数组(秒);若提供则自动分箱计算高度 */ - durations?: number[]; - /** 直接提供的各分箱频数数组(长度对应 bins 数量) */ - binCounts?: number[]; -} - -export interface DurationHistogramOptions { - title?: string; - series: HistogramSeries[]; - averageSeconds?: number; - averageLabel?: string; - binWidth?: number; - binStart?: number; - binEnd?: number; - width?: number; - height?: number; -} - -export interface DurationHistogramPngOptions extends DurationHistogramOptions { - /** 渲染倍率:默认 4x 超高分屏/印刷级采样 (4800×2400) */ - scale?: number; - chrome?: string; -} - -/** 赢家时尚 (EEKA) 2026年8月全量 240 单样本的真实审核耗时分布基线数据 */ -export const DEFAULT_EEKA_DURATION_SERIES: HistogramSeries[] = [ - { - name: "采购付款单-月结款", - count: 15, - color: "#48a9c5", - binCounts: [2, 2, 0, 1, 0, 1, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - }, - { - name: "其他报销及业务单据", - count: 12, - color: "#b19cd9", - binCounts: [0, 0, 0, 0, 1, 0, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0] - }, - { - name: "差旅报销单-定额", - count: 22, - color: "#f7a072", - binCounts: [0, 0, 6, 3, 2, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0] - }, - { - name: "采购申请与预付款类单据", - count: 24, - color: "#fed766", - binCounts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0] - }, - { - name: "一般费用报销单【收据】- 个人报销", - count: 33, - color: "#a8d5ba", - binCounts: [0, 0, 0, 0, 0, 0, 2, 1, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0] - }, - { - name: "一般费用报销单【发票】- 对外支付", - count: 64, - color: "#f5a9b8", - binCounts: [0, 0, 1, 1, 2, 2, 2, 0, 4, 3, 4, 0, 0, 0, 1, 3, 0, 1, 1, 0] - }, - { - name: "一般费用报销单【发票】- 个人报销", - count: 70, - color: "#7fe3d7", - binCounts: [0, 2, 2, 5, 5, 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0] - } -]; - -/** - * 自动生成各单据模板审核耗时分布对比的多系列堆叠直方图 (SVG)。 - * 100% 纯代码矢量计算,数据驱动自动分箱,支持 7 组模板色彩层次堆叠与平均值虚线标注。 - */ -export function renderDurationHistogramSvg(options?: Partial): string { - const { - title = "各单据模板审核耗时分布对比 (2026年8月全量240单样本)", - series = DEFAULT_EEKA_DURATION_SERIES, - averageSeconds = 445.4, - averageLabel = "总体平均耗时: 445.4秒 (约7.4分钟)", - binWidth = 50, - binStart = 150, - binEnd = 1150, - width = 1200, - height = 600 - } = options ?? {}; - - const numBins = Math.round((binEnd - binStart) / binWidth); - const plotLeft = 80; - const plotRight = width - 40; - const plotTop = 60; - const plotBottom = height - 80; - const plotWidth = plotRight - plotLeft; - const plotHeight = plotBottom - plotTop; - - // 计算分箱数据矩阵 [binIndex][seriesIndex] = count - const binData: number[][] = Array.from({ length: numBins }, () => Array(series.length).fill(0)); - - series.forEach((s, sIdx) => { - if (s.binCounts && s.binCounts.length >= numBins) { - for (let b = 0; b < numBins; b++) binData[b]![sIdx] = s.binCounts[b] ?? 0; - } else if (s.durations) { - for (const d of s.durations) { - if (d >= binStart && d < binEnd) { - const b = Math.min(numBins - 1, Math.floor((d - binStart) / binWidth)); - binData[b]![sIdx] = (binData[b]![sIdx] ?? 0) + 1; - } - } - } - }); - - // 计算最大 Y 轴高度(默认向上取整到偶数,至少 11) - const maxStack = Math.max(11, ...binData.map((counts) => counts.reduce((acc, c) => acc + c, 0))); - const yDomainMax = Math.ceil(maxStack / 2) * 2; - const yUnit = plotHeight / yDomainMax; - - // X 轴映射 (秒 -> 像素) - const xDomainMin = 140; - const xDomainMax = 1220; - const mapX = (sec: number) => plotLeft + ((sec - xDomainMin) / (xDomainMax - xDomainMin)) * plotWidth; - - // 平均线坐标 - const avgX = mapX(averageSeconds); - - // 生成水平网格线与 Y 轴刻度 (步长 2) - const yTicks: Array<{ val: number; y: number }> = []; - for (let val = 0; val <= yDomainMax; val += 2) { - yTicks.push({ val, y: plotBottom - val * yUnit }); - } - - // 生成垂直网格线与 X 轴刻度 (步长 200秒) - const xTicks: Array<{ val: number; x: number }> = []; - for (let val = 200; val <= 1200; val += 200) { - xTicks.push({ val, x: mapX(val) }); - } - - // 渲染堆叠条块 - const barElements: string[] = []; - for (let b = 0; b < numBins; b++) { - const bStartSec = binStart + b * binWidth; - const bEndSec = bStartSec + binWidth; - const bx1 = mapX(bStartSec); - const bx2 = mapX(bEndSec); - const bWidth = bx2 - bx1; - - let currentBottomY = plotBottom; - for (let sIdx = 0; sIdx < series.length; sIdx++) { - const count = binData[b]![sIdx] ?? 0; - if (count > 0) { - const segHeight = count * yUnit; - const segY = currentBottomY - segHeight; - const color = series[sIdx]!.color; - barElements.push( - `` - ); - currentBottomY = segY; - } - } - } - - // 图例项目(按业务重要性逆序排在右上角图例框中) - const legendItems = [...series].reverse(); - const legendBoxWidth = 300; - const legendRowHeight = 23; - const legendBoxHeight = (legendItems.length + 1) * legendRowHeight + 16; - const legendBoxX = plotRight - legendBoxWidth - 12; - const legendBoxY = plotTop + 12; - - return ` - - - - ${title} - - - - ${yTicks.filter((t) => t.val > 0).map((t) => ``).join("\n ")} - - - - - ${xTicks.map((t) => ``).join("\n ")} - - - - - ${barElements.join("\n ")} - - - - - - - - - - - ${yTicks.map((t) => `${t.val}`).join("\n ")} - - 单据数量 - - - - ${xTicks.map((t) => `${t.val}`).join("\n ")} - - 审核耗时(秒) - - - - - ${legendItems.map((item, idx) => { - const rowY = 12 + idx * legendRowHeight; - return ` - ${item.name} (${item.count}单)`; - }).join("\n ")} - - - ${averageLabel} - - -`; -} - -/** - * 采用本地 Headless Chrome 原生渲染管线输出高清晰度耗时分布直方图 PNG 图片。 - * 默认 4x 超高分采样 (4800×2400),完美匹配 24 寸 4K 屏与高精度 PDF 导出。 - */ -export async function renderDurationHistogramPng(options?: Partial): Promise { - const svg = renderDurationHistogramSvg(options); - const width = options?.width ?? 1200; - const height = options?.height ?? 600; - const scale = options?.scale ?? 4; - const html = `${svg}`; - - return renderHtmlToImageBuffer({ - html, - width, - height, - scale, - chrome: options?.chrome - }); -} diff --git a/src/domains/seal/reports/charts/index.ts b/src/domains/seal/reports/charts/index.ts index c01f6b6..4f4787c 100644 --- a/src/domains/seal/reports/charts/index.ts +++ b/src/domains/seal/reports/charts/index.ts @@ -1,2 +1 @@ export * from "./venn.js"; -export * from "./duration-histogram.js"; diff --git a/src/domains/seal/reports/export/files.ts b/src/domains/seal/reports/export/files.ts index a5abb6e..1eafe54 100644 --- a/src/domains/seal/reports/export/files.ts +++ b/src/domains/seal/reports/export/files.ts @@ -51,7 +51,7 @@ export function saveReportMarkdown( const cleanBase = basename(path).replace(/^\d+-/, ""); target = `${assetDir}/${images.size + 1}-${cleanBase}`; const dynamic = dynamicAssets?.[path] ?? dynamicAssets?.[basename(path)] ?? dynamicAssets?.[cleanBase]; - const bundled = templatePath === BUILTIN_TEMPLATE_PATH ? REPORT_ASSETS[path] : undefined; + const bundled = REPORT_ASSETS[path] ?? (templatePath === BUILTIN_TEMPLATE_PATH ? REPORT_ASSETS[path] : undefined); const data = dynamic ?? bundled ?? readFileSync(inputFile(resolve(dirname(templatePath), path))); files.set(resolve(dirname(file), target), data); images.set(path, target); diff --git a/src/domains/seal/reports/templates/README.md b/src/domains/seal/reports/templates/README.md index 6053cd8..2e5f8ef 100644 --- a/src/domains/seal/reports/templates/README.md +++ b/src/domains/seal/reports/templates/README.md @@ -5,8 +5,7 @@ | 文件 | 用途 | | --- | --- | | `monthly.md` | 模板本体。**可变的皮**:章节标题、表格结构允许增删改名——填充逻辑从标题反推数据需求(`src/domains/seal/reports/describe.ts`),改这里通常不用改代码 | -| `assets/` | 报告配图(图 1 数据图、图 2/3 占位图),相对引用,渲染时随 md 一起解析 | -| `examples/` | 填充真实数据的成品示例(结构参考 + 测试夹具) | +| `assets/` | 报告核心配图(图 1 准确率维恩图),相对引用,渲染时随 md 一起解析 | | `report.css` | HTML、长图和 A4 PDF 共用的版式,随 CLI 内嵌 | 模板纪律见模板仓库 README:不引入 frontmatter/占位符标记(结构即契约)、正文不含 HTML 注释、表格只换数据行。 diff --git a/src/domains/seal/reports/templates/assets/图2-综合效益.svg b/src/domains/seal/reports/templates/assets/图2-综合效益.svg deleted file mode 100644 index 54a26e8..0000000 --- a/src/domains/seal/reports/templates/assets/图2-综合效益.svg +++ /dev/null @@ -1,123 +0,0 @@ - - - - - 各单据模板审核耗时分布对比 (2026年8月全量240单样本) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 2 - 4 - 6 - 8 - 10 - 12 - - 单据数量 - - - - 200 - 400 - 600 - 800 - 1000 - 1200 - - 审核耗时(秒) - - - - - - 一般费用报销单【发票】- 个人报销 (70单) - - 一般费用报销单【发票】- 对外支付 (64单) - - 一般费用报销单【收据】- 个人报销 (33单) - - 采购申请与预付款类单据 (24单) - - 差旅报销单-定额 (22单) - - 其他报销及业务单据 (12单) - - 采购付款单-月结款 (15单) - - - 总体平均耗时: 445.4秒 (约7.4分钟) - - diff --git a/src/domains/seal/reports/templates/assets/图3-示例截图.svg b/src/domains/seal/reports/templates/assets/图3-示例截图.svg deleted file mode 100644 index 3f76029..0000000 --- a/src/domains/seal/reports/templates/assets/图3-示例截图.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - 配图占位:示例单据截图(可多张) - 实际报告替换为正式图表 - diff --git a/src/domains/seal/reports/templates/examples/赢家时尚-202608.md b/src/domains/seal/reports/templates/examples/赢家时尚-202608.md deleted file mode 100644 index fc2c107..0000000 --- a/src/domains/seal/reports/templates/examples/赢家时尚-202608.md +++ /dev/null @@ -1,265 +0,0 @@ -# 【赢家】8月AI审核准确率报告 - -| 报告信息 | 内容 | -| --- | --- | -| 报告编号 | eeka-ai-audit-2026-08 | -| 客户名称 | 赢家时尚 | -| 统计期间 | 2026-08-01 ~ 2026-08-31 | -| 报告状态 | 草稿 | -| 生成日期 | 2026-09-23 | - -> **摘要**:以赢家时尚授权的 **240 笔**历史审批单据(2026-08-01 ~ 2026-08-31)为样本,对合思 AI 审核结论与人工审核结论做全量复核。AI 审核准确率 **92.08%**,人工审核准确率 **83.33%**;系统全月成功审核率近 **90%**,自 8 月 8 日迭代后稳定在 **96.07%**。AI 在人工已同意的单据中额外识别出 **40 笔**存在风险的凭证。 - ---- - -## 1. 审核测试结果 - -### 1.1 数据来源与范围 - -| 项目 | 内容 | -| --- | --- | -| 数据来源 | 赢家时尚授权的已完成历史审批单据 | -| 统计期间 | 2026-08-01 ~ 2026-08-31 期间单据 | -| 单据模板 | 涵盖一般费用报销单【发票】-个人报销、一般费用报销单【发票】-对外支付、一般费用报销单【收据】-个人报销、差旅报销单-定额、采购付款单等 **16 类**业务单据模板 | -| 样本总量 | **240 张**(100 张同意 + 100 张驳回 + 40 张建议复核) | - -### 1.2 核心准确率结论 - -基于已经给定的规则库: - -| 审核方式 | 准确率 | -| --- | --- | -| 合思 AI 审核 | **92.08%** | -| 人工审核 | **83.33%** | - -AI 审核准确率的计算方式: - -$$ \text{AI 审核准确率} = \frac{\text{依规判定正确单数}}{\text{样本总量}} = \frac{221}{240} = 92.08\% $$ - -![AI 与人工审核准确率对比](../assets/图1-准确率对比.svg) - -*图 1 · AI 与人工审核准确率对比* - -### 1.3 系统稳定性 - -| 项目 | 内容 | -| --- | --- | -| 全月成功审核率 | 近 **90%** | -| 迭代影响 | 8 月第一周失败率较高;自 8 月 8 日迭代后,系统稳定性升至 **96.07%** 的稳定运行常态 | - -> **注**:“审核失败”是产品侧的保护机制:当 AI 对单据内容无法形成可靠判断,系统会将该次审核标记为失败,以避免错误影响实际审批。 - ---- - -## 2. AI 失准分析(学习优化空间) - -在全量 **240 单**的深度稽核中,合思 AI 依规综合正确 **221 单(92.08%)**,综合失准共 **19 单(7.92%)**。失准主要由以下三个维度构成。 - -### 2.1 失准构成总览 - -| 维度 | 失准类型 | 占比 | 单数 | -| --- | --- | --- | --- | -| TOP 1 | 规则执行与判定偏差 | 47.4% | 9 张 | -| TOP 2 | 数据与附件识别问题 | 26.3% | 5 张 | -| TOP 3 | 费用明细查重冲突 | 26.3% | 5 张 | -| 合计 | — | 100% | 19 张 | - -### 2.2 TOP 1 · 规则执行与判定偏差(9 张 / 47.4%) - -**解决方案**:严格校准规则触发后动作,按规则执行。 - -| 单号 | 问题描述 | -| --- | --- | -| FP2609671 | rule-125 仅核验支付凭证金额一致性,不要求个人代垫的收款方必须是公司,AI 误要求 | -| CD2625928 | 8 月 3 日至 8 月 5 日均为工作日(周一至周三),AI 误认为有周末未扣减问题 | -| FP2609370 | 费用承担主体命中 rule-40 / rule-99 豁免白名单,AI 未执行豁免逻辑导致驳回 | - -*(节选 3 例,全量 9 张)* - -### 2.3 TOP 2 · 数据与附件识别问题(5 张 / 26.3%) - -**解决方案**:持续优化识别模型,提升多附件文字解析稳定性。 - -| 单号 | 问题描述 | -| --- | --- | -| SJ2661735 | 手写收据金额 243 元被 OCR 误识别为 2433 元,导致金额不符误驳回 | -| FP2611200 | 微信红包支付记录清晰完整,AI 误判定为无关凭据导致误驳回 | -| SG2619081 | 已完整包含中秋节福利品发放人员统计表 Excel 文件,AI 因多附件漏提取误判缺件驳回 | - -*(节选 3 例,全量 5 张)* - -### 2.4 TOP 3 · 费用明细查重冲突(5 张 / 26.3%) - -**解决方案**:已去掉跨批次相似费用冲突的默认判定,客户可按需配置此功能。 - -| 单号 | 问题描述 | -| --- | --- | -| CGD260875 | AI 因跨批次存在历史同类辅料费用提示疑似冲突转人工 | -| FP2607495 | AI 因跨批次云产品疑似同类费用冲突转人工 | -| FP2608432 | 发票金额 180 元(1% 普票),远未达到 500 元专票强制门槛,AI 因过度怀疑是否存在专票协议转人工 | - -*(节选 3 例,全量 5 张)* - ---- - -## 3. AI 发现的潜在风险 - -在人工审核同意的单据中,有部分单据被 AI 发现存在风险,问题 TOP 3 如下。 - -### 3.1 风险构成总览 - -| 维度 | 风险类型 | 占比 | 单数 | -| --- | --- | --- | --- | -| TOP 1 | 缺失要求凭证 | 57.5% | 23 张 | -| TOP 2 | 大额预付与采购口径偏差 | 22.5% | 9 张 | -| TOP 3 | 票据合规与专票强制违规 | 20.0% | 8 张 | -| 合计 | — | 100% | 40 张 | - -### 3.2 TOP 1 · 缺失要求凭证(23 张 / 57.5%) - -| 单号 | 问题描述 | -| --- | --- | -| FP2610941 | 改衣费未附改衣明细表 | -| FP2610735 | 咨询费报销资料不全 | -| FP2608630 | 专利代理费未列明发明名称且缺少缴费通知书 | - -*(节选 3 例,全量 23 张)* - -### 3.3 TOP 2 · 大额预付与采购口径偏差(9 张 / 22.5%) - -| 单号 | 问题描述 | -| --- | --- | -| YF2616524 | 大额预付款单未关联申购单 / 申请单 | -| CGA260211 | 采购预付款单明细采购订单号与合同号不一致 | -| CGD261254 | 采购付款单品类为上装类但发票明细为服装加工费,业务勾稽不符 | - -*(节选 3 例,全量 9 张)* - -### 3.4 TOP 3 · 票据合规与专票强制违规(8 张 / 20.0%) - -| 单号 | 问题描述 | -| --- | --- | -| FP2609850 / FP2610235 / FP2610631 | 发票类对外支付模板未上传正规发票,上传非正规微信截图或洗衣取衣单据 | -| FP2610206 | 高税率业务金额超 500 元未开具增值税专用发票且无免专票佐证 | -| FP2609582 | 完税证明纳税人名称与费用承担公司主体不一致 | - -*(节选 3 条,全量 8 张)* - ---- - -## 4. 综合效益 - -| 维度 | 结论 | 关键数据 | -| --- | --- | --- | -| 准确度 | 除去 AI 无法形成可靠判断而转失败的单据,AI 在既定规则范围内的准确率已赶超人工审批 | **92.08%** | -| 时效 | AI 审核单张单据平均耗时赶超人工处理时效 | 平均 **445.4 秒** | -| 风险拦截 | 在人工审核通过的单据中,合思 AI 有效防堵无票支付、大额无合同预付、税票违规等税务与资金安全隐患 | 40 笔 | -| 工作量 | 协助财务人员弥补遗漏、关注单据重点信息,大幅释放财务人员精力,专注于更有价值的工作 | — | - -![各单据模板审核耗时分布对比](../assets/图2-综合效益.svg) - -*图 2 · 各单据模板审核耗时分布对比* - ---- - -## 5. AI 与人工审核一致性示例 - -| 示例单号 | 单据模板 | 合思 AI 审核驳回意见 | 人工实际退回说明 | 双方一致性 | -| --- | --- | --- | --- | --- | -| **FP2609372** | 一般费用报销单【发票】- 个人报销 | 帕森墨镜发票(776.15元,税率13%)仅开具普通发票,单笔超500元未按规定开具增值税专用发票且无免专票佐证,违反专票管控要求,建议驳回换开专票。 | `4、发票不合规:普票替换成专票` | **专票合规要求100%对齐**:均严格执行超500元13%高税率发票必须开具专票的硬性管控。 | -| **FP2610941** | 一般费用报销单【发票】- 个人报销 | 对应规则129:改衣明细表未上传,必备核心附件缺失,不符合改衣费报销要求,AI建议【驳回单据】。 | `2、附件不合规:未提供改衣费明细表` | **必备明细表缺失一致**:AI 精准拦截缺件,人工直接依据未提供改衣费明细表退回。 | -| **FP2610780** | 一般费用报销单【发票】- 对外支付 | 版布开发费对外支付报销,对账单未上传至专项附件且未检出双方盖章,违反规则69,建议驳回单据、补充合规盖章对账单。 | `2、附件不合规:盖章对账单及送货单没有上传附件` | **公对公盖章凭据一致**:对外支付缺少双方盖章对账单,AI 提前拦截,人工随后同样驳回。 | -| **CD2625843** | 差旅报销单-定额 | 差旅定额补助消费日期(8月10日)与关联出差申请单行程(7月31日)不符,超出合理出差区间,建议驳回。 | `3、表单填写错误:结余补贴时间与出差时间不一致` | **行程时间勾稽一致**:双方均敏锐识别出补贴申请时间与实际行程脱节。 | -| **FP2611220** | 一般费用报销单【发票】- 个人报销 | 费用类型选用错误:报销内容为清洁耗材(鸡毛掸子、刮水器、除尘滚轮等),错选为“门店环保费(仅限清洁人工及绿植)”,建议驳回。 | `3、表单填写错误:费用明细选择办公费` | **科目填报纠错一致**:AI 指出错选环保费,人工直接打回要求改选办公费。 | -| **FP2611191** | 一般费用报销单【发票】- 个人报销 | 活动表格内费用金额与实际报销金额不一致;未按要求上传金额匹配的一一对应支付记录,建议驳回。 | `支付记录与报销金额不一致,请把不相关的支付记录删除只保留与报销单相关的金额。` | **支付凭证与金额一致性**:双方均发现支付凭据与报销金额脱节、混入无关凭据。 | -| **YS2600603** | 预提类非生产物料采购申请 | FS成本中心不符合品推费要求(应选品推组,实选两广事业部),二级费用类型与业务场景不匹配,建议驳回。 | `3、表单填写错误:成本中心、预算项目有误` | **预算与成本中心纠错一致**:AI 与人工退回均直指成本中心与预算项目选错。 | -| **SJ2661686** | 一般费用报销单【收据】- 个人报销 | 存在2项高风险:收据模板错传正规发票;且改衣费报销缺少必备的改衣明细表,建议驳回。 | `未上传改衣费明细表` | **硬性合规项一致**:人工直接依据缺少改衣明细表退回。 | - -![示例单据截图 1](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/1X3lE5wWdYx19lJb/img/5d40a61a-6a16-4754-b871-0ed61e15285c.png) - -![示例单据截图 2](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/1X3lE5wWdYx19lJb/img/823e30d0-ae32-486a-963f-d8687e38b8cd.png) - -![示例单据截图 3](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/1X3lE5wWdYx19lJb/img/567e9648-c071-4a16-b8a4-0c32dbb09be5.png) - -![示例单据截图 4](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/1X3lE5wWdYx19lJb/img/50737e3c-0a1e-4f31-b961-63fd24c324dd.png) - -*图 3 ~ 6 · 上述示例单对应的单据截图* - ---- - -## 6. AI 通过 / 人工驳回单据明细 - -| 单据编号 | 单据模板 | AI 审批决策 | 人工审批参考结论 | 原因分类 | 复核结论 | 截图 | -| --- | --- | --- | --- | --- | --- | --- | -| **FP2608010** | 发票-个人报销 | 同意 | 终止 (改衣费超标) | **依规正确 (计入 D4)** | 单据改衣费发票、支付凭证及Excel改衣明细表齐全且金额均为1195元完全一致,收款人即申请人免营业执照,完全符合rule-129合规要求。人工以口头“改衣费超标”为由终止(规则库中无此超标阻断线),AI依规放行完全正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/4ec8511d-21d0-44c0-b4ac-2b7a6442f25a.png) | -| **FP2608464** | 发票-对外支付 | 同意 | 终止 (2、附件不合规:账单抬头错误) | **AI失准 (不计入分子)** | 附件对账单买方抬头存在错误,未匹配费用承担主体,命中rule-13对账单买方校验风险。人工退单指出账单抬头错误依规有据,AI未能识别出对账单抬头瑕疵直接放行,属于数据/附件识别失误。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/7e24d434-6073-44e3-a8a3-733547071706.png) | -| **YS2600514** | 预提类采购申请 | 同意 | 终止 (请核对“确认采购金额”;请补充附件费用计划。) | **依规正确 (计入 D4)** | 现行规则库中对于该类申请单的检查规则不包含“采购金额/费用计划附件”的强制校验卡口,单据字段与基础凭证合规,AI依既定规则放行正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/bd8d0ea1-a197-4496-ae6a-9fc3ec4fb113.png) | -| **SJ2661226** | 收据-个人报销 | 同意 | 终止 (无理由) | **依规正确 (计入 D4)** | 单据收据、明细表、支付记录及收据袋编码均齐全且金额完全一致,符合rule-129各项规定。单据本身合规,AI依规放行正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/d89b7d6e-3d3b-459f-afc3-b7e5d3b3088c.png) | -| **SJ2661313** | 收据-个人报销 | 同意 | 终止 (无理由) | **AI失准 (不计入分子)** | 单据费用为“商场附加费”,依rule-128必须提供正规发票,本单仅附收据无发票,不符合科目票据规范。AI误判放行,属于规则执行错误。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/5b2b1dd3-82e7-4438-9062-060af35b753a.png) | -| **FP2609210** | 发票-对外支付 | 同意 | 终止 (无理由终止/撤回) | **依规正确 (计入 D4)** | 专柜小额维修费1236元,发票真实合规,依据rule-177区域部门5000元以下免关联申购单,万元以下免合同,单据在线上规则下无违规。AI放行正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/64f14f6f-9151-48d6-af54-7ce234c33267.png) | -| **FP2609105** | 发票-个人报销 | 同意 | 终止 (未提供活动实际销售情况,费用占销比说明) | **依规正确 (计入 D4)** | 单据发票验真一致,电子发票PDF源文件齐全,收款人匹配。人工以“未提供费用占销比说明”退回,但规则库未将占销比设为必填附件,AI依规放行正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/d4a349fe-9e9e-4a2d-9f3f-936a95b29948.png) | -| **SJ2661468** | 收据-个人报销 | 同意 | 终止 | **依规正确 (计入 D4)** | 门店改衣费报销260元,改衣清单与收据袋完整合规,无违规或缺件。AI按既定规则核验通过正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/506f106a-3b02-4ba4-bcfe-cf09b829a4c7.png) | -| **SJ2661540** | 收据-个人报销 | 同意 | 终止 | **依规正确 (计入 D4)** | 单据模板及收据票据核验合规,无拦截风险。AI依规放行判定正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/f594914b-473c-475e-b4f9-945c4cea5cba.png) | -| **FP2610213** | 发票-对外支付 | 同意 | 终止 | **依规正确 (计入 D4)** | 单据各项附件(增值税专票、盖章合同、核销单)齐全完整,金额准确无瑕疵。AI依规放行判定正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/f2c3b6fb-bd46-4f7e-9f29-9836d919db92.png) | -| **FP2610610** | 发票-个人报销 | 同意 | 终止 (电话网络费由人事统一报销) | **依规正确 (计入 D4)** | 门店电话网络费330元,发票及支付记录完全合规。人工以公司内部口头行政口径“人事统一报销”退单,规则库未配置该项排除规则,AI依规放行正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/d9396432-e615-4c1c-80f8-931f0aad4d2e.png) | -| **SJ2661469** | 收据-对外支付 | 同意 | 终止 | **依规正确 (计入 D4)** | 改衣费250元,改衣明细表及票据齐全合规,收款人为合规备案人员。AI依规判定正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/a9cc24da-fd7e-4559-beaa-02d94a29b257.png) | -| **FP2610689** | 发票-对外支付 | 同意 | 终止 (结算单应按公司区分,不能合并一起) | **依规正确 (计入 D4)** | 员工体检福利费,体检合同、发票及人员名单齐全,分摊成本中心同属一区域。人工要求拆分公司结算单退回,规则库未配置该项规则,AI依规放行判定正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/172545b0-e25d-4327-8c2e-9a968d27d513.png) | -| **FP2610431** | 发票-对外支付 | 同意 | 终止 | **依规正确 (计入 D4)** | 单据全维度核验合规,发票、收款主体、成本中心均无风险。AI依规放行判定正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/d18caf73-e1fe-4e0b-ade6-c3803fa7b806.png) | -| **SJ2661828** | 收据-个人报销 | 同意 | 终止 | **依规正确 (计入 D4)** | 收据类单据表单与票据均符合规则要求,无风险项。AI依规放行判定正确。 | ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/mPdnpE56pzR0bqw9/img/c5a17f93-e47a-4cf2-9549-74abbe0280ad.png) | - -在上述 **15 笔**单据中: - -1. **86.7%(13 / 15 笔)属于依规正确(计入 D4)**:单据在线上凭证与 196 条规则库完全合规,退单主要由于经办人撤回、无理由终止,或财务人员在执行尚未纳入线上规则库的其他规则。**AI 线上放行依据规则库正确。** - -2. **仅有 2 笔属于 AI 真实失准(占全量样本 0.83%)**,已如实扣除准确率,未计入分子:`FP2608464`(对账单抬头瑕疵未能检出)、`SJ2661313`(商场附加费无专票放行)。 - ---- - -## 7. 支撑数据与材料 - -### 7.1 分模板准确率与自动审批率 - -全量 N = 240: - -| 单据模板 | AI 准确率 | 人工准确率 | 自动审批率 | 人工同意:驳回 | AI&人工都准确比例 | -| --- | --- | --- | --- | --- | --- | -| 一般费用报销单【发票】- 个人报销 | 92.86% | 87.14% | 45.71% | 70(57:13) | 80.00% | -| 一般费用报销单【发票】- 对外支付 | 92.19% | 75.00% | 42.19% | 64(50:14) | 67.19% | -| 一般费用报销单【收据】- 个人报销 | 93.94% | 93.94% | 48.48% | 33(20:13) | 87.88% | -| 差旅报销单-定额 | 81.82% | 100.00% | 31.82% | 22(19:3) | 81.82% | -| 采购付款单-月结款 | 93.33% | 93.33% | 66.67% | 15(15:0) | 86.67% | -| 预提类非生产物料采购申请 | 85.71% | 100.00% | 28.57% | 7(2:5) | 85.71% | -| 预付款单 | 100.00% | 42.86% | 14.29% | 7(7:0) | 42.86% | -| 一般费用报销单【收据】- 对外支付 | 100.00% | 100.00% | 40.00% | 5(2:3) | 100.00% | -| 一般费用报销单【云账户及银行代扣】- 对外支付 | 100.00% | 50.00% | 25.00% | 4(3:1) | 50.00% | -| 采购付款单-预付款 | 100.00% | 0.00% | 0.00% | 4(4:0) | 0.00% | -| 非生产物料采购申请(不需预提) | 75.00% | 100.00% | 0.00% | 4(2:2) | 75.00% | -| 装修报销单 | 100.00% | 0.00% | 0.00% | 1(1:0) | 0.00% | -| 立项费用报销单 | 100.00% | 0.00% | 0.00% | 1(1:0) | 0.00% | -| 预提类非生产物料采购报销单 | 100.00% | 100.00% | 0.00% | 1(0:1) | 100.00% | -| 一般费用报销单【物流中心-运费专用】 | 100.00% | 100.00% | 100.00% | 1(1:0) | 100.00% | -| 采购付款「负数」单-预付款 | 100.00% | 100.00% | 100.00% | 1(1:0) | 100.00% | -| **全量样本总体 (N=240)** | **92.08%** | **83.33%** | **41.67%** | **240(185:55)** | **75.42%** | - -### 7.2 跑批原始数据 - -[请至钉钉文档查看附件《赢家时尚2026年8月单据审批质量审计报告\_全量看板.xlsx》。](https://alidocs.dingtalk.com/i/nodes/kDnRL6jAJM6GyZPZI99mZ0gX8yMoPYe1?iframeQuery=anchorId%3DX02mu3v6grnsfbr1tvg7m) - -### 7.3 抽样方法与可复现性 - -本次复核共抽取 240 笔样本,抽样规则如下: - -| # | 抽样规则 | -| --- | --- | -| 1 | 时间全月均衡覆盖(8 月 1 日—31 日) | -| 2 | 100 笔 AI 同意 + 100 笔 AI 驳回 + 40 笔 AI 复核 | -| 3 | 保底 30 笔大额采购与预付款单据(上中下旬各 10 笔),其余 170 笔按企业当期各报销模板的实际发生比例加权分配 | -| 4 | 固定随机种子抽样算法基于截止日固定随机种子(Seed: 20260831)自动执行,且全流程清单支持任何第三方精准复现核验 | - -抽样基于账期截止日的固定随机种子执行,全过程可由第三方复现,完整可执行代码随报告附件交付。 - -**抽样算法说明** - -1. **输入数据池**:2026 年 8 月全量 6,573 笔已归档业务单据。 -2. **随机数与排序稳定性**:采用 Python 标准库与 `hashlib.sha256(f"{seed}_{bill_no}")` 双重散列锁死序列,第三方执行该代码,所得出的 240 笔单据清单、顺序及样本编号都会与本数据集完全一致。 -3. **输出样本集**:程序精确生成 240 笔单据,时间分布严格为 **80 : 80 : 80(1:1:1)**,决策分布严格为 **100(同意): 100(驳回): 40(建议复核)**,采购大额单据共 **39 笔(满足 >= 30 笔保底要求)**,达到要求。 diff --git a/src/domains/seal/reports/templates/resources.ts b/src/domains/seal/reports/templates/resources.ts index 6eb6397..b04f7ca 100644 --- a/src/domains/seal/reports/templates/resources.ts +++ b/src/domains/seal/reports/templates/resources.ts @@ -1,8 +1,6 @@ import monthly from "./monthly.md" with { type: "text" }; import css from "./report.css" with { type: "text" }; import accuracy from "./assets/图1-准确率对比.svg" with { type: "text" }; -import benefits from "./assets/图2-综合效益.svg" with { type: "text" }; -import screenshot from "./assets/图3-示例截图.svg" with { type: "text" }; // Git owns the source files; Bun embeds these imports in both developer and release binaries. // Loading the built-in template never depends on cwd, a checkout, or skill installation. @@ -10,7 +8,5 @@ export const BUILTIN_TEMPLATE_PATH = "builtin:reports/templates/monthly.md"; export const BUILTIN_MONTHLY_TEMPLATE = monthly; export const REPORT_CSS = css; export const REPORT_ASSETS: Record = { - "assets/图1-准确率对比.svg": accuracy, - "assets/图2-综合效益.svg": benefits, - "assets/图3-示例截图.svg": screenshot + "assets/图1-准确率对比.svg": accuracy };