mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-24 07:28:10 +02:00
feat: introduce BulkAiAnalyzer component for bulk product classification and AI context profiling.
This commit is contained in:
1 parent
c63a60c0cf
commit
86df5d6f29
1 file changed
+14
-13
@@ -55,7 +55,20 @@ export function BulkAiAnalyzer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialPayloads: ProductAnalysisInput[] = rows.map((r) => {
|
// 2a. Produits sans aucune vente → Z direct, sans appel IA (avant de construire les payloads)
|
||||||
|
const zeroSalesRows = rows.filter((r) => (r.totalQuantite || 0) === 0);
|
||||||
|
if (zeroSalesRows.length > 0) {
|
||||||
|
const zChanges: Record<string, GammeCode> = {};
|
||||||
|
zeroSalesRows.forEach(r => { zChanges[r.codein] = "Z"; });
|
||||||
|
batchSetDraftGamme(zChanges);
|
||||||
|
zeroSalesRows.forEach(r => {
|
||||||
|
setInsight(r.codein, "Aucune vente sur 12 mois — produit classé Z automatiquement.");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construire les payloads uniquement pour les produits avec ventes
|
||||||
|
const rowsWithSales = rows.filter((r) => (r.totalQuantite || 0) > 0);
|
||||||
|
const initialPayloads: ProductAnalysisInput[] = rowsWithSales.map((r) => {
|
||||||
const sc = r.workingStores?.length || 1;
|
const sc = r.workingStores?.length || 1;
|
||||||
const weight = sc === 1 ? 2 : 1;
|
const weight = sc === 1 ? 2 : 1;
|
||||||
|
|
||||||
@@ -105,20 +118,8 @@ export function BulkAiAnalyzer() {
|
|||||||
totalFournisseurCa: r.totalFournisseurCa,
|
totalFournisseurCa: r.totalFournisseurCa,
|
||||||
supplierContext: supplierContext,
|
supplierContext: supplierContext,
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 2a. Produits sans aucune vente → Z direct, sans appel IA
|
|
||||||
const zeroSalesRows = rows.filter((r) => (r.totalQuantite || 0) === 0);
|
|
||||||
if (zeroSalesRows.length > 0) {
|
|
||||||
const zChanges: Record<string, GammeCode> = {};
|
|
||||||
zeroSalesRows.forEach(r => { zChanges[r.codein] = "Z"; });
|
|
||||||
batchSetDraftGamme(zChanges);
|
|
||||||
zeroSalesRows.forEach(r => {
|
|
||||||
setInsight(r.codein, "Aucune vente sur 12 mois — produit classé Z automatiquement.");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2b. Stock mort absolu : CA < 100€ ET quantité < 30 → Z direct, sans appel IA
|
// 2b. Stock mort absolu : CA < 100€ ET quantité < 30 → Z direct, sans appel IA
|
||||||
const deadStockRows = rows.filter(r =>
|
const deadStockRows = rows.filter(r =>
|
||||||
(r.totalQuantite || 0) > 0 &&
|
(r.totalQuantite || 0) > 0 &&
|
||||||
|
|||||||
Reference in new issue
Block a user