Add mood_energy and mood_valence sliders that inject mood context into AI recommendation prompts. Add "Surprise Me" button that generates recommendations from a creative, unexpected angle without requiring any user input. Includes backend endpoints, schema updates, and full frontend UI integration.
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class RecommendationRequest(BaseModel):
|
|
playlist_id: int | None = None
|
|
query: str | None = None # Manual search/request
|
|
bandcamp_mode: bool = False # Prioritize Bandcamp/indie artists
|
|
mode: str = "discover" # discover, sonic_twin, era_bridge, deep_cuts, rising
|
|
adventurousness: int = 3 # 1-5
|
|
exclude: str | None = None # comma-separated genres to exclude
|
|
count: int = 5 # Number of recommendations (5, 10, 15, 20)
|
|
mood_energy: int | None = None # 1-5, 1=chill, 5=energetic
|
|
mood_valence: int | None = None # 1-5, 1=sad/dark, 5=happy/bright
|
|
|
|
|
|
class RecommendationItem(BaseModel):
|
|
id: int
|
|
title: str
|
|
artist: str
|
|
album: str | None = None
|
|
spotify_id: str | None = None
|
|
preview_url: str | None = None
|
|
image_url: str | None = None
|
|
bandcamp_url: str | None = None
|
|
youtube_url: str | None = None
|
|
reason: str
|
|
score: float | None = None
|
|
saved: bool = False
|
|
disliked: bool = False
|
|
created_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class RecommendationResponse(BaseModel):
|
|
recommendations: list[RecommendationItem]
|
|
remaining_this_week: int | None = None # None = unlimited (pro)
|
|
|
|
|
|
class TasteProfile(BaseModel):
|
|
top_genres: list[dict]
|
|
avg_energy: float
|
|
avg_danceability: float
|
|
avg_valence: float
|
|
avg_tempo: float
|
|
era_preferences: list[str]
|
|
mood_summary: str
|