Checkpoint: Ajout de la section "Moteur IA" dans les paramètres : sélecteur Mistral/Manus, champs clé API avec affichage masqué, persistance en DB, migration VPS appliquée

This commit is contained in:
Manus
2026-04-15 08:04:54 -04:00
parent 7fbb3d5f2c
commit 62b7a61bf5
10 changed files with 3807 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
import { invokeLLM } from "./_core/llm";
import { invokeLLM, invokeLLMWithUserSettings } from "./_core/llm";
import { PDFDocument } from "pdf-lib";
import { createLlmLog } from "./db";
import PDFParser from "pdf2json";
@@ -143,7 +143,8 @@ export async function extractInvoicesWithMistral(
totalAmount?: string | null;
subscription?: string | null;
recipient?: string | null;
}
},
aiSettings?: { aiProvider?: string | null; mistralApiKey?: string | null; manusForgeApiKey?: string | null; manusForgeApiUrl?: string | null }
): Promise<MultiInvoiceResult> {
// Load user's field configuration
const { getLlmFieldsConfigByUser } = await import("./db");
@@ -240,14 +241,17 @@ Si une information n'est pas trouvée, utilise null. Ne retourne AUCUN texte en
// Call Mistral LLM with extracted text
const fullPrompt = `${prompt}\n\nTexte extrait du PDF:\n${pdfText}`;
const response = await invokeLLM({
messages: [
{
role: "user",
content: fullPrompt,
},
],
});
const response = await invokeLLMWithUserSettings(
{
messages: [
{
role: "user",
content: fullPrompt,
},
],
},
aiSettings
);
const rawResponse = typeof response.choices[0]?.message?.content === "string"
? response.choices[0].message.content