mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-13 18:27:40 +02:00
feat(ai): smarter batch analysis with revenue, history, nomenclature and strict retail rules
This commit is contained in:
1 parent
8ad2894301
commit
816ec6e483
2 files changed
+32
-22
No files matched your search
@@ -47,13 +47,18 @@ export function BulkAiAnalyzer() {
|
||||
for (const chunk of chunks) {
|
||||
setProgress(prev => ({ ...prev, current: completed, total: chunks.length, message: `Analyse du rayon: ${chunk.rayon}` }));
|
||||
|
||||
// Simplify payload to save tokens
|
||||
// Enrich payload with more context to improve AI decision quality
|
||||
const payloadProducts = chunk.items.map(r => ({
|
||||
codein: r.codein,
|
||||
gtin: r.gtin,
|
||||
nom: r.libelle1,
|
||||
ventes: r.totalQuantite,
|
||||
ca: r.totalCa || 0,
|
||||
ventes: r.totalQuantite || 0,
|
||||
marge: r.totalMarge ? parseFloat(((r.totalMarge / (r.totalCa || 1)) * 100).toFixed(1)) : 0,
|
||||
gammeInit: r.codeGammeInit || "N/A",
|
||||
// Simplified history: last 12 values joined (e.g., "5,0,10...")
|
||||
historique: Object.values(r.sales12m || {}).join(","),
|
||||
// Contextual nomenclature
|
||||
nomenclature: `${r.libelleNiveau1 || ""} > ${r.libelleNiveau2 || ""} > ${r.libelle3 || ""}`
|
||||
}));
|
||||
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user