fix(recommendation-engine): S4-FIX — opersonliga vyer fungerar utan samtycke via depersonalize(weights)

This commit is contained in:
Sven (AAMOS AI)
2026-08-11 04:02:46 +07:00
parent 05bba93b90
commit 1e18146665
4 changed files with 160 additions and 16 deletions
+4 -6
View File
@@ -11,8 +11,8 @@ import {
type PantryItem,
} from "@app/recipe-engine";
import {
depersonalize,
isEventActive,
NON_PERSONALIZED_WEIGHTS,
parseCraving,
rankAll,
seasonForDate,
@@ -389,10 +389,8 @@ export async function recommendationRoutes(app: FastifyInstance) {
}
const weights = personalizationEnabled
? q.view === "default"
? undefined
: viewWeights(q.view)
: NON_PERSONALIZED_WEIGHTS;
? viewWeights(q.view)
: depersonalize(viewWeights(q.view));
let recommendations = rankAll(scoredCandidates, ctx, weights, q.limit);
// --- 9. AAMOS-omrankning bakom feature flag (aldrig obligatorisk) ---
@@ -457,7 +455,7 @@ export async function recommendationRoutes(app: FastifyInstance) {
remainingKcal: ctx.remainingKcal,
remainingProteinG: ctx.remainingProteinG,
craving: craving ?? null,
view: personalizationEnabled ? q.view : "default",
view: q.view,
},
mealBoxSuggestions,
recommendations,