用途
make-integration 用于在用户需要 Make Platform 集成能力时提供支持,尤其是发票、账单、票据等凭证文件的 OCR 识别。当用户要求识别发票、账单、收据、票据或其他凭证文件时,可触发该技能。
主要能力
当前能力包括:
- 通过
makecli integration ocr进行账单与发票 OCR 识别 - 可选的发票真伪校验
- 对 PDF/OFD/PNG/JPG/JPEG 文件进行结构化提取
- 返回发票字段、印章、二维码、坐标,以及可选的裁剪图片
依赖
make-integration 依赖 makecli 技能以及已安装的 makecli 二进制文件。
使用方式
预检查
运行 OCR 之前需要完成以下检查:
- 检查 makecli 是否已安装。若缺失,运行
brew tap qfeius/makecli && brew install makecli。 - 检查 OCR 命令是否存在。运行
makecli integration ocr --help。若命令缺失,运行makecli update或升级 makecli。 - 检查所选 profile。运行
makecli configure verify --profile <profile> --output=json。若未配置,提示用户运行交互式设置:! makecli configure token --profile <profile>。若 token 无效或缺失,停止并请用户配置 makecli 凭据。不要在 makecli 之外识别、提取、推断、纠正或补全发票内容。 - 从 makecli 检查请求基础 URL。运行
makecli configure get server-url --profile <profile>。优先使用 profile 配置的服务器 URL,而不是硬编码环境 URL。若 profile 没有服务器 URL,makecli 使用其自身默认基础 URL。 - 检查输入文件。支持的扩展名:
.pdf、.ofd、.png、.jpg、.jpeg。只上传用户提供或批准的文件。
识别工作流
当用户只需要可读答案时,使用表格输出:
makecli integration ocr -f <file> --profile <profile>
当需要解析字段或将结果输入另一个 Make 操作时,使用 JSON 输出:
makecli integration ocr -f <file> --output=json --profile <profile>
常用选项:
# 识别选定页面
makecli integration ocr -f invoice.pdf --pages "1,3,2"
makecli integration ocr -f invoice.pdf --pages "2-4"
# 绑定业务单据 ID
makecli integration ocr -f invoice.pdf --business-id <business-id>
# 显式关闭发票真伪校验
makecli integration ocr -f invoice.pdf --verify-vat=false
# 可选响应控制
makecli integration ocr -f invoice.pdf --coord-restore-original
makecli integration ocr -f invoice.pdf --crop-complete
makecli integration ocr -f invoice.pdf --crop-value
makecli integration ocr -f invoice.pdf --merge-elec
makecli integration ocr -f invoice.pdf --return-ppi
输出处理
对于 --output=json,从以下字段进行汇总:
data.file_namedata.bill_countdata.processing_duration_msdata.result.pages[].bills[].items[]data.result.pages[].bills[].stamps[]data.result.pages[].bills[].qr_codes[]
向用户报告结果时:
- 在可用时包含文件名、账单数量、页数和处理时长。
- 提取非空的
items[].value字段。 - 在印章和二维码存在且有用时包含它们。
- 正常摘要中不要包含 base64 裁剪载荷。
- 仅报告来自成功的
makecli integration ocr输出的已识别 OCR 值。 - 只将
makecli integration ocr输出视为识别结果。不要使用视觉检查、模型知识、文件解析、替代 OCR 工具、直接 HTTP 调用或用户可见图像内容来识别或填充发票数据。 - 仅在技能文档示例、提交的样本、日志或调试片段中屏蔽或替换特殊及个人信息。
- 如果 OCR 结果将写入 Make 记录,在识别后调用 makecli 技能进行记录操作。
失败处理
API 错误 [990300403]: token验证失败:token 对所选环境无效。请用户配置对该环境有效的 token,然后通过 makecli 重试 OCR。API 错误 [990300404]: 服务不存在:所选 makecli 服务器 URL 可能未部署 OCR 路由。检查 profile 服务器 URL 或确认部署。unsupported file extension:请用户提供受支持的 PDF/OFD/PNG/JPG/JPEG 文件。打开文件失败:检查本地路径和权限。- 任何 makecli OCR 失败:报告 makecli 失败以及下一步 makecli 配置或环境步骤。不要自行继续识别发票内容。
适用场景
适用于需要通过 Make Platform 集成能力识别发票、账单、收据、票据等凭证文件的场景,尤其是需要对 PDF/OFD/PNG/JPG/JPEG 文件进行结构化字段提取、获取印章与二维码信息,或需要可选发票真伪校验的情况。
限制与硬性规则
- 不要将用户提供的 token 写入仓库文件。
- 当用户提供一次性 token 时,优先使用临时配置目录。
- 除非用户要求保留,运行后清理临时凭据和 OCR 结果文件。
- 绝不打印、提交或复制 token。
- 除非用户提供或批准,不要上传本地文件。
- 不要在技能示例中提交真实发票号、纳税人识别号、订单号、电话号码、地址、token、二维码载荷或其他敏感值。
- 不要使用任何非 makecli 路径作为此技能的备用方案。如果 makecli 无法运行或 OCR 失败,先修复 makecli 配置/环境,然后通过 makecli 重试。