mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-23 15:08:12 +02:00
refactor(ai): simplify guardrail - protection is now a strong signal, not mandatory override
This commit is contained in:
1 parent
8b73363550
commit
32164572aa
2 files changed
+8
-17
No files matched your search
@@ -269,25 +269,16 @@ export class ContextProfiler {
|
||||
medianMarge
|
||||
);
|
||||
|
||||
// 8. Gardes-fous
|
||||
// Neutralisation : un produit à CA réseau trivial (< 10€) ou marge ≤ 0%
|
||||
// n'a pas d'activité économique réelle. Le protéger serait absurde.
|
||||
const rawCa = target.totalCa ?? 0;
|
||||
const rawMarge = target.tauxMarge ?? 0;
|
||||
const isEconomicallyViable = rawCa >= 10 && rawMarge > 0;
|
||||
|
||||
const isProtected = isEconomicallyViable && (
|
||||
// 8. Gardes-fous (signaux, pas des verdicts — Mary décide au final)
|
||||
const isProtected =
|
||||
scoring.decision.isRecent ||
|
||||
scoring.decision.isTop30Supplier ||
|
||||
scoring.decision.isLastProduct
|
||||
);
|
||||
scoring.decision.isLastProduct;
|
||||
|
||||
let protectionReason = "";
|
||||
if (isProtected) {
|
||||
if (scoring.decision.isRecent) protectionReason = "Nouveauté (< 3 mois de données)";
|
||||
else if (scoring.decision.isTop30Supplier) protectionReason = "Top 30% CA Fournisseur";
|
||||
else if (scoring.decision.isLastProduct) protectionReason = "Dernière référence du fournisseur";
|
||||
}
|
||||
if (scoring.decision.isRecent) protectionReason = "Nouveauté (< 3 mois de données)";
|
||||
else if (scoring.decision.isTop30Supplier) protectionReason = "Top 30% CA Fournisseur";
|
||||
else if (scoring.decision.isLastProduct) protectionReason = "Dernière référence du fournisseur";
|
||||
|
||||
// 9. Règle absolue
|
||||
const scoreCritique = (target.score ?? 0) < 20;
|
||||
|
||||
Reference in new issue
Block a user