feat(categories): add new categories for Kondis & fika and Kaffebröd, and Te & choklad
This commit is contained in:
@@ -120,6 +120,24 @@ Regler:
|
||||
? (parsed.confidence as 'high' | 'medium' | 'low')
|
||||
: 'medium';
|
||||
|
||||
// Guardrail: för låg/medel konfidenspoäng, remmappa till L1-föräldern
|
||||
if (confidence === 'low' || confidence === 'medium') {
|
||||
const l1Name = matchedCategory.path.split(' > ')[0];
|
||||
const l1 = categories.find((c) => c.path === l1Name);
|
||||
if (l1 && l1.id !== matchedCategory.id) {
|
||||
this.logger.log(
|
||||
`AI-guardrail: ${confidence} konfidenspoäng → remappar "${matchedCategory.path}" → L1 "${l1.path}"`,
|
||||
);
|
||||
return {
|
||||
categoryId: l1.id,
|
||||
categoryName: l1.name,
|
||||
path: l1.path,
|
||||
confidence,
|
||||
usedFallback: true,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
categoryId: matchedCategory.id,
|
||||
categoryName: matchedCategory.name,
|
||||
|
||||
Reference in New Issue
Block a user