mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-15 03:08:31 +02:00
feat: add supplier AI context modal and bulk product AI analysis component
This commit is contained in:
1 parent
9d8ef0e4db
commit
174b7fa36c
3 files changed
+32
-2
No files matched your search
@@ -61,6 +61,20 @@ export function BulkAiAnalyzer() {
|
||||
}
|
||||
});
|
||||
|
||||
// 1. Fetch AI Context for the Supplier
|
||||
let supplierContext = "";
|
||||
if (supplierCode) {
|
||||
try {
|
||||
const ctxRes = await fetch(`/api/ai/context?fournisseur=${supplierCode}`);
|
||||
if (ctxRes.ok) {
|
||||
const data = await ctxRes.json();
|
||||
supplierContext = data.context || "";
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load supplier context for AI", err);
|
||||
}
|
||||
}
|
||||
|
||||
const initialPayloads: ProductAnalysisInput[] = rows.map((r) => {
|
||||
const sc = r.workingStores?.length || 1;
|
||||
const weight = sc === 1 ? 2 : 1;
|
||||
@@ -108,6 +122,7 @@ export function BulkAiAnalyzer() {
|
||||
projectedTotalCa: regScore > 0 ? (r.totalCa || 0) * weight * (12 / regScore) : (r.totalCa || 0) * weight,
|
||||
lastMonthWithSale: lastMonth,
|
||||
inactivityMonths: inactivity,
|
||||
supplierContext: supplierContext
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ export function SupplierAiContextModal({ codeFournisseur, nomFournisseur }: Supp
|
||||
Règles IA
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="sm:max-w-[500px]">
|
||||
<DialogContent className="sm:max-w-[500px] bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 shadow-xl">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Contexte IA - {nomFournisseur || codeFournisseur}</DialogTitle>
|
||||
<DialogDescription>
|
||||
|
||||
Reference in new issue
Block a user