Files
blind/game/js/profile.js
T
2026-05-24 12:35:35 +08:00

23 lines
608 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 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';
}
}