From 23fd0e9804d627de7d62bf7f59d08a46c56c1375 Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Sun, 22 Feb 2026 12:39:32 -0600 Subject: [PATCH] Auto-rebuild taste profile on every new listen event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The taste profile is just a weighted average of 512-dim vectors — trivially cheap even with thousands of tracks. Rebuilding on every listen event keeps recommendations always up to date. Co-Authored-By: Claude Opus 4.6 --- src/haunt_fm/api/history.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/haunt_fm/api/history.py b/src/haunt_fm/api/history.py index 2ce2a08..4ff2a9e 100644 --- a/src/haunt_fm/api/history.py +++ b/src/haunt_fm/api/history.py @@ -6,6 +6,7 @@ from sqlalchemy.ext.asyncio import AsyncSession from haunt_fm.db import get_session from haunt_fm.services.history_ingest import ingest_listen_event +from haunt_fm.services.taste_profile import build_taste_profile router = APIRouter(prefix="/api/history") @@ -38,4 +39,8 @@ async def receive_webhook(payload: WebhookPayload, session: AsyncSession = Depen ) if event is None: return {"ok": True, "duplicate": True} + + # Rebuild taste profile on every new listen event (cheap: just a weighted average) + await build_taste_profile(session) + return {"ok": True, "track_id": event.track_id, "event_id": event.id}