// profile.js — 行为画像追踪器(avoidance / engagement / nostalgia) class ProfileTracker { constructor() { this.scores = { avoidance: 0, engagement: 0, nostalgia: 0 }; } add(effects) { if (!effects) return; for (const k of ['avoidance', 'engagement', 'nostalgia']) { if (effects[k]) this.scores[k] += effects[k]; } } // 获取最终画像标签 get label() { const s = this.scores; if (s.engagement > s.avoidance && s.engagement >= s.nostalgia) return 'engagement'; if (s.nostalgia > s.avoidance) return 'nostalgia'; return 'avoidance'; } }