perf(ai-moderation): drop personal user-profile descriptions from context
User insight: personal profile summaries bloat the prompt (less room per request) and add a per-user DB/Redis round-trip for little moderation signal. Only the behavioural <user_reputation> history is kept. - textBatchProcessor: stop fetching getUserProfile; remove <user_profiles> block + <user_profile_ref> from message tags. Keep <user_reputation>. - mediaBatchProcessor + visionAnalyzer: same removal (profile fetch + ref). - prompts/system.ts + prompts/output.ts: drop stale <user_profiles>/ <user_profile_ref> instructions; point LLM at <user_reputation> instead. - aiAnalyzer: gate userProfileLearner behind AI_USER_PROFILE_LEARNING_ENABLED (default false) — generates profiles nobody reads, pure LLM/DB waste. - Add AI_USER_PROFILE_LEARNING_ENABLED config knob. Net: smaller prompts (more messages fit per request), fewer DB round-trips per sub-batch, and no background LLM calls learning unused profiles. tsc, biome, vitest (129) all clean.
This commit is contained in:
@@ -136,9 +136,11 @@ export function startPendingAIAnalysisWorker(
|
||||
import("./cultureLearner.js")
|
||||
.then((m) => m.startCultureLearnerWorker())
|
||||
.catch(console.error);
|
||||
import("./userProfileLearner.js")
|
||||
.then((m) => m.startUserProfileLearnerWorker())
|
||||
.catch(console.error);
|
||||
if (config.AI_USER_PROFILE_LEARNING_ENABLED) {
|
||||
import("./userProfileLearner.js")
|
||||
.then((m) => m.startUserProfileLearnerWorker())
|
||||
.catch(console.error);
|
||||
}
|
||||
|
||||
setInterval(() => {
|
||||
// [D] Periodic cache hygiene: purge expired moderation verdicts from
|
||||
|
||||
Reference in New Issue
Block a user