feat(server): MinIO/S3 对象存储兼容(F21)
- 新增 storage 抽象:local 与 s3: 前缀兼容(不改 schema) - invoice-pool 上传/预览/ocr 读取适配 S3/MinIO - trialrun compose 增加 minio profile + env 示例与 runbook 指引 - 更新 README 与 v3 CSV 状态推进
这个提交包含在:
@@ -1,8 +1,7 @@
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("node:path");
|
||||
const cron = require("node-cron");
|
||||
|
||||
const { runOcrForInvoice } = require("../services/ocr");
|
||||
const { readFileBuffer } = require("../services/storage");
|
||||
|
||||
const OCR_DUPLICATE_ERROR = "duplicate_invoice_code_number";
|
||||
|
||||
@@ -222,8 +221,10 @@ async function markInvoiceAsFailed(prisma, claimedInvoice, errorMessage, config)
|
||||
|
||||
async function processClaimedInvoice(prisma, config, claimedInvoice, workerId, logger) {
|
||||
try {
|
||||
const absolutePath = path.resolve(config.storageDir, claimedInvoice.storage_path);
|
||||
const fileBuffer = await fs.readFile(absolutePath);
|
||||
const fileBuffer = await readFileBuffer({
|
||||
config,
|
||||
storagePath: claimedInvoice.storage_path,
|
||||
});
|
||||
const imageBase64 = fileBuffer.toString("base64");
|
||||
|
||||
const { ocrResultId, normalized } = await getOrCreateOcrResult(
|
||||
|
||||
在新工单中引用
屏蔽一个用户