Add mood scanner and surprise me features to discover page
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.
This commit is contained in:
@@ -31,6 +31,25 @@ async def generate(
|
||||
recs, remaining = await generate_recommendations(
|
||||
db, user, playlist_id=data.playlist_id, query=data.query, bandcamp_mode=data.bandcamp_mode,
|
||||
mode=data.mode, adventurousness=data.adventurousness, exclude=data.exclude, count=data.count,
|
||||
mood_energy=data.mood_energy, mood_valence=data.mood_valence,
|
||||
)
|
||||
|
||||
if not recs and remaining == 0:
|
||||
raise HTTPException(status_code=429, detail="Weekly recommendation limit reached. Upgrade to Premium for unlimited.")
|
||||
|
||||
return RecommendationResponse(
|
||||
recommendations=[RecommendationItem.model_validate(r) for r in recs],
|
||||
remaining_this_week=remaining,
|
||||
)
|
||||
|
||||
|
||||
@router.post("/surprise", response_model=RecommendationResponse)
|
||||
async def surprise(
|
||||
user: User = Depends(get_current_user),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
recs, remaining = await generate_recommendations(
|
||||
db, user, query=None, mode="surprise", count=5
|
||||
)
|
||||
|
||||
if not recs and remaining == 0:
|
||||
|
||||
Reference in New Issue
Block a user