feat: Add user-managed genre preferences with catalog picker#6
Open
feat: Add user-managed genre preferences with catalog picker#6
Conversation
Implement comprehensive genre management system allowing users to customize their top genres beyond Spotify's auto-detected preferences. This enables better control over generation quality and personalized taste profiles. Backend Changes: - Add Genre and UserGenre models with normalized name indexing - Create database migration (f3a4b5c6d7e8) with seed genres catalog - Implement genre catalog service with seeding and get-or-create helpers - Add genre management routes (GET catalog, POST add, DELETE remove) - Update Spotify profile endpoint to load and persist user genres - Refactor taste_analyzer to extract reusable helper functions: - compute_avg_popularity: Calculate average artist popularity - derive_mood_tags: Generate mood tags from genres and popularity - generate_summary: Create taste summary sentence - Update taste_analyzer logic to use user-managed genres when available - Add new schemas for genre catalog and user genre operations - Enforce 20 genre maximum limit per user Database Schema: - genres table: id, name, normalized_name (unique), created_at - user_genres table: id, user_id, genre_id (composite unique), created_at - Unique constraints to prevent duplicates - Cascade delete on user and genre removal - Indexes on foreign keys for query performance Frontend Changes: - Add genre picker UI to TasteDisplay component - Implement add/remove genre functionality with IconButton controls - Add genre catalog dropdown with search/filter - Display genre removal buttons on each tag - Add loading states for catalog and genre actions - Implement optimistic UI updates with profile refresh - Add toast notifications for errors and limits - Add API methods: getGenreCatalog, addUserGenre, deleteUserGenre - Wire up genre updates to profile state management in App.tsx User Experience Improvements: - Users can now curate their top genres list manually - Genre changes automatically refresh taste profile analysis - Mood tags and summary sentence update based on selected genres - Visual feedback for all genre operations - Clear messaging when hitting the 20 genre limit - Persisted preferences across sessions Technical Details: - Genre normalization ensures consistent matching (lowercase, trimmed) - Seed catalog includes 20 starter genres (ambient, art pop, etc.) - Auto-seed user genres from Spotify on first profile load - Parallel genre catalog loading to avoid blocking profile display - Proper error handling with rollback on integrity violations - Type-safe operations with Pydantic schemas and TypeScript interfaces Documentation: - Add generation.md with comprehensive flow documentation - Document input concept, lyrics topic, and full generation flows - Explain single-step vs two-step generation paths - Detail auto-save behavior and instrumental short-circuit logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement comprehensive genre management system allowing users to customize their top genres beyond Spotify's auto-detected preferences. This enables better control over generation quality and personalized taste profiles.
Backend Changes:
Database Schema:
Frontend Changes:
User Experience Improvements:
Technical Details:
Documentation: