返回 Skill 列表
extension
分类: 效率与办公无需 API Key

本地发票审核

本地发票审核与异常交接 Skill。支持在 Windows 本机使用 OCR 识别 PDF、图片和收据,提取销售方、发票号码、日期、币种、金额及商品明细,并通过确定性规则校验必填字段、金额关系、重复文件、重复发票号和字段置信度。默认生成完整 JSON/CSV 数据和待人工复核、规则阻断、失败重试清单;用户确认后可将原始文件复制到不同状态文件夹。支持 OpenVINO、Windows Named Pipe 和离线运行。所有发票文件和 OCR 内容均保留在本机,不执行财务审批、付款、ERP 写入或发票真伪验证。

person作者: Fishbone233hubModelScope

Local Invoice Review

Use this skill when a user wants to batch-process local invoices, receipts, or simple billing documents. Keep source files on the local machine. Return the output directory, counts, warnings, and review statuses.

Invocation

Use the fixed entry point:

.\scripts\run.ps1 -InputDir .\data\input -OutputDir .\data\output -Offline

When the user asks to re-check only newly added or changed files, add -OnlyChanged. The previous records.json is read from the output directory unless -PreviousOutputDir is supplied. This is an incremental re-audit, not a comparison of two business periods.

The entry point starts or reuses the local model server, processes the batch, and emits one JSON response on stdout. Human-readable diagnostics go to stderr. Add -IncludeReport only when the user explicitly asks for a report, summary page, Markdown report, or HTML report. Without it, return structured JSON/CSV outputs but do not generate human-readable report pages. Natural requests such as “给我一份审核报告”“生成 HTML 报告”“把结果整理成 报告” count as an explicit request. Requests such as “帮我检查一下”“把发票 整理出来”“哪些有问题” do not request a report page by themselves.

首轮回复规范(WorkBuddy)

当用户第一次提出“帮我看一下这几张发票”“检查一下这些发票”等批量审核请求,且没有明确要求报告时, 调用 scripts\run.ps1,但不要加 -IncludeReport。调用完成后不要把原始 JSON 全部贴给用户, 必须按以下顺序回复:

  1. 先用 summary_zh 展示总处理数量和四种状态数量,状态顺序固定为:规则校验通过待人工确认已阻断处理失败
  2. 再按 preview.展示 展示问题发票。展示顺序固定为“已阻断”“待人工确认”;只有 preview.总数.处理失败 大于 0 时才增加“处理失败”。不要逐条展开“规则校验通过”发票。
  3. 每个问题分类只允许展示 preview.每类最多展示 条(默认 10 条),只能使用 preview.展示 中的数据,不能自行从 records.json 扩展首轮消息。若 preview.是否还有未展示 对应分类为 true,在该分类表格后说明还有未展示记录。
  4. 问题说明使用预览项中的中文 问题 字段;不要向用户展示英文状态码、warning code 或完整结构化 JSON。
  5. 使用 artifacts.invoices_csv.pathartifacts.line_items_csv.path 明确告诉用户: 完整发票表格和完整商品明细表已经生成到哪里。必要时同时提到 artifacts.records_json.path,说明它保存完整记录与证据;同时告知 artifacts.review_queue_csv.pathartifacts.blocked_queue_csv.pathartifacts.retry_queue_csv.path 是后续动作清单。
  6. 在报告问题之前,首轮必须单独询问:需要我按状态将原始发票复制到不同文件夹吗?
  7. 首轮最后再单独询问:是否需要我生成完整审核报告?

首轮回复使用下面的结构(数量和行内容替换为实际结果;没有记录的分类写“无”):

本次共处理 X 张发票。

| 状态 | 数量 |
|---|---:|
| 规则校验通过 | X |
| 待人工确认 | X |
| 已阻断 | X |
| 处理失败 | X |

## 已阻断

| 文件 | 销售方 | 发票号码 | 价税合计 | 问题 |
|---|---|---|---:|---|

## 待人工确认

| 文件 | 销售方 | 发票号码 | 价税合计 | 问题 |
|---|---|---|---:|---|

完整发票表格:`<artifacts.invoices_csv.path>`
完整商品明细表:`<artifacts.line_items_csv.path>`
待人工复核清单:`<artifacts.review_queue_csv.path>`
规则阻断清单:`<artifacts.blocked_queue_csv.path>`
处理失败重试清单:`<artifacts.retry_queue_csv.path>`

需要我按状态将原始发票复制到不同文件夹吗?
是否需要我生成完整审核报告?

只有用户明确同意按状态分类(例如“需要”“按状态分类”“帮我整理文件夹”)时,才调用:

.\scripts\run.ps1 -InputDir .\data\input -OutputDir .\data\output -Offline -OrganizeStatus

该调用读取已有 records.json,不重新执行 OCR;它会把原始文件复制按状态分类\规则校验通过按状态分类\待人工确认按状态分类\已阻断按状态分类\处理失败,绝不移动或删除原件。回复时使用 artifacts.status_folders.pathartifacts.status_classification_csv.pathartifacts.status_classification_json.path 告知目标目录和分类清单路径。 用户未确认时不得自行执行文件复制。

只有用户明确答复需要报告,或提出“给我报告”“生成 HTML 报告”等请求时,才再次调用 scripts\run.ps1 -IncludeReport。报告只展示管理摘要、风险分类、重点异常和处理建议, 不重复展开全部发票;回复中同时返回 artifacts.report_md.pathartifacts.report_html.path,以及完整发票表格和商品明细表路径。

Safety Rules

  • Never upload invoice files or OCR text to a remote service.
  • Never invent invoice numbers, dates, vendors, currency, totals, or tax values.
  • Preserve the source value and add a warning when a field is ambiguous.
  • Treat money fields as high risk. Export only records that pass validation or are explicitly marked needs_review.
  • Do not pay vendors, send emails, or write to an ERP/accounting system.
  • Keep logs free of full invoice contents and personal identifiers.

Result Contract

Return:

  • records.json: one structured record per source file;
  • invoices.csv: one row per invoice;
  • line_items.csv: extracted line items;
  • handoff.json: complete handoff groups for human review, rule blocks, and failed-file retries;
  • review_queue.csv: complete pending-human-review checklist;
  • blocked_queue.csv: complete rule-block checklist;
  • retry_queue.csv: complete failed-file retry checklist;
  • when status classification is requested, 按状态分类/ contains copied originals, and status_classification.csv / status_classification.json record the copy result;
  • report.md: a concise text review report, only when requested;
  • report.html: a local browser-readable management dashboard, only when requested;
  • summary: processed, approved, needs-review, blocked, and failed counts.
  • summary_zh: Chinese labels for the summary shown to users.
  • preview: a bounded Chinese first-response summary for blocked, needs-review, and failed records (at most 10 per category by default).
  • artifacts: paths for the complete records, invoice table, line-item table, summary data, and optional report files. Use these paths in the user-facing reply.
  • report_generated: whether the optional human-readable report was generated.
  • 文件分类: classification result when the user explicitly requested status folders, otherwise null.
  • audit: audit version and the exact validation scope used for this run.

Machine-readable status and warning code values remain stable English identifiers. User-facing outputs also include Chinese status_label, warning label, Chinese warning messages, and Chinese CSV/report headings. When replying to the user, prefer summary_zh and the Chinese labels; expose the English codes only when the user asks for technical diagnostics.

The handoff lists preserve the issue type, suggested handler, required materials, next step, and whether the Skill can automatically handle the issue. The Skill does not approve expenses, release holds, contact suppliers, write to ERP, or pay vendors. Cross-batch comparison is intentionally left to the host Agent using the generated CSV files.

audit.校验详情 explicitly records which checks ran. The current Skill performs local OCR, extraction, deterministic field/amount/duplicate/confidence checks; external invoice authenticity or signature verification and ERP/procurement/ receipt matching are recorded as not executed.

The CSV/JSON files are the complete row-level audit data. The optional Markdown report is a text summary; the HTML report is a local visual dashboard. Both are management summaries and must not repeat every invoice row.

Review Semantics

  • needs_review: extracted but requires human confirmation;
  • approved: rules passed; this does not mean financial approval or permission to pay;
  • blocked: required information is missing or a serious consistency check failed;
  • failed: the file could not be processed.

The current MVP intentionally uses local text/sidecar extraction in tests and a pluggable OCR boundary. A real OpenVINO model adapter must keep the same result schema and evidence contract.