fix: compacter extraction pour Santino rapide
This commit is contained in:
31
server/santinoCompactExtraction.test.ts
Normal file
31
server/santinoCompactExtraction.test.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
attachLocallyExtractedText,
|
||||
buildInvoiceExtractionPrompt,
|
||||
} from "./invoiceExtractor";
|
||||
|
||||
describe("contrat compact pour les moteurs à sortie limitée", () => {
|
||||
it("ne demande pas au modèle de recopier le texte complet du PDF", () => {
|
||||
const prompt = buildInvoiceExtractionPrompt({
|
||||
pageCount: 1,
|
||||
qualityScoreInstruction: "- qualityScore: score",
|
||||
subscriptionInstruction: "- isSubscription: false",
|
||||
keywordsHint: "",
|
||||
});
|
||||
|
||||
expect(prompt).not.toContain("- extractedText:");
|
||||
expect(prompt).toContain("Ne retourne jamais le texte complet du PDF");
|
||||
});
|
||||
|
||||
it("conserve le texte extrait localement après le JSON métier", () => {
|
||||
const text = "texte extrait localement";
|
||||
const result = attachLocallyExtractedText({
|
||||
pageCount: 1,
|
||||
invoiceCount: 1,
|
||||
invoices: [{ invoiceDate: "2026-08-28", supplierName: "Fournisseur" }],
|
||||
} as any, text);
|
||||
|
||||
expect(result.invoices[0].extractedText).toBe(text);
|
||||
expect(result.invoices[0].invoiceDate).toEqual(new Date("2026-08-28"));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user