fix(ai): cap extract-invoices batch at 20 files
Final review flagged that the multipart limits set only fileSize, so a single /extract-invoices request could carry unbounded PDF parts. The per-batch budget re-check already bounds total spend, but this bounds the work (one vision call per file) of any single request. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,9 @@ import {
|
|||||||
|
|
||||||
export default async function aiRoutes(app: FastifyInstance): Promise<void> {
|
export default async function aiRoutes(app: FastifyInstance): Promise<void> {
|
||||||
await app.register(multipart, {
|
await app.register(multipart, {
|
||||||
limits: { fileSize: config.nas.maxUploadSize },
|
// Cap files per request: the budget re-check already bounds *spend* mid-batch,
|
||||||
|
// but this bounds the work (one vision call per file) of a single request.
|
||||||
|
limits: { fileSize: config.nas.maxUploadSize, files: 20 },
|
||||||
});
|
});
|
||||||
|
|
||||||
// GET /api/admin/ai/usage — current-month spend + budget
|
// GET /api/admin/ai/usage — current-month spend + budget
|
||||||
|
|||||||
Reference in New Issue
Block a user