Add named taste profiles for per-person recommendations

Named profiles allow each household member to get personalized
recommendations without polluting each other's taste. Includes
profile CRUD API, speaker→profile auto-attribution, recent listen
history endpoint, and profile param on all existing endpoints.
All endpoints backward compatible (no profile param = "default").

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-22 19:14:34 -06:00
parent 1b739fbd20
commit 094621a9a8
14 changed files with 556 additions and 33 deletions

View File

@@ -37,6 +37,9 @@ curl -X POST http://192.168.86.51:8321/api/admin/discover -H "Content-Type: appl
# Get recommendations
curl http://192.168.86.51:8321/api/recommendations?limit=20
# Get recommendations for a specific profile
curl "http://192.168.86.51:8321/api/recommendations?limit=20&profile=antialias"
# Generate and play a playlist
curl -X POST http://192.168.86.51:8321/api/playlists/generate \
-H "Content-Type: application/json" \
@@ -51,6 +54,24 @@ curl -X POST http://192.168.86.51:8321/api/playlists/generate \
curl -X POST http://192.168.86.51:8321/api/playlists/generate \
-H "Content-Type: application/json" \
-d '{"total_tracks":15,"vibe":"upbeat party music","alpha":0.3,"auto_play":true,"speaker_entity":"media_player.living_room_speaker_2"}'
# Generate playlist for a specific profile
curl -X POST http://192.168.86.51:8321/api/playlists/generate \
-H "Content-Type: application/json" \
-d '{"total_tracks":20,"profile":"antialias","speaker_entity":"media_player.study_speaker_2","auto_play":true}'
# Create a profile
curl -X POST http://192.168.86.51:8321/api/profiles \
-H "Content-Type: application/json" \
-d '{"name":"antialias","display_name":"Me"}'
# Map speakers to a profile
curl -X PUT http://192.168.86.51:8321/api/profiles/antialias/speakers \
-H "Content-Type: application/json" \
-d '{"speakers":["Study speaker","Master bathroom speaker"]}'
# Build taste profile for a specific profile
curl -X POST "http://192.168.86.51:8321/api/admin/build-taste-profile?profile=antialias"
```
## Environment Variables
@@ -61,4 +82,14 @@ All prefixed with `HAUNTFM_`. See `.env.example` for full list.
- Alembic migrations in `alembic/versions/`
- Run migrations: `alembic upgrade head`
- Schema: tracks, listen_events, track_embeddings, similarity_links, taste_profiles, playlists, playlist_tracks
- Schema: tracks, listen_events, track_embeddings, similarity_links, taste_profiles, playlists, playlist_tracks, profiles, speaker_profile_mappings
## Named Profiles
Named profiles allow per-person taste tracking. No auth — just named buckets.
- **Default behavior**: All endpoints without `profile` param use the "default" profile (backward compatible)
- **Profile CRUD**: `GET/POST /api/profiles`, `GET/DELETE /api/profiles/{name}`
- **Speaker mappings**: `PUT/GET /api/profiles/{name}/speakers` — auto-attributes listen events from mapped speakers
- **Attribution**: Webhook accepts `"profile": "name"` or auto-resolves from speaker→profile mapping
- **Recommendations/playlists**: Pass `profile=name` to use that profile's taste