Skip to content

feat: Add mood-based ambient playlist mini-player - #1477

Open
arnavgoel17 wants to merge 1 commit into
devanshi14malhotra:mainfrom
arnavgoel17:feat/1404-ambient-music
Open

arnavgoel17 wants to merge 1 commit into
devanshi14malhotra:mainfrom
arnavgoel17:feat/1404-ambient-music

Conversation

@arnavgoel17

@arnavgoel17 arnavgoel17 commented Aug 26, 2026 •

Copy link
Copy Markdown

Summary

Implements AI mood-based music pairing for book discovery:

  • Backend (backend/mood_analysis/ambient_music.py): a lightweight mapper that matches the parsed mood query (moods from MoodQueryParser + raw query keywords) to curated open Spotify reading playlists (Dark Academia Jazz, Cozy Reading Cafe, Whimsical & Light, Classical Reading, and a Lo-Fi default). No extra LLM call or external API — pure keyword matching, so it adds no latency to /api/v1/mood-search.
  • API: /api/v1/mood-search now returns an ambient_music object ({genre, spotify_embed_url}) in both the enhanced-parser path and the fallback path.
  • Frontend (frontend/js/ambient-music.js + app.html + style.css): a minimal glassmorphic floating music panel on the discovery page. Hidden by default (respects Zero UI Noise), appears after the first mood search, and dynamically swaps its Spotify embed src per mood. It is an independent panel that overlays alongside the existing Ambient Sanctuary SFX — SFX and music can be used separately or together.
  • Chat integration (chat.js): Elara chat mood searches also dispatch the ambient-music payload.

Validation

  • New pytest suite tests/test_ambient_music.py: 5 tests covering mood-to-playlist mapping (cozy/dark/fallback) plus an endpoint test asserting the ambient_music payload in /api/v1/mood-search. All pass.
  • Confirmed pre-existing failures on unmodified main are unrelated (test_mood_improvements.py nltk-stub collection error, one test_category_cache.py failure, contributing.css unclosed block breaking vite build) — none are touched by this PR.
  • JS syntax checks pass for new/changed files; style.css parses cleanly with postcss.
  • Spotify embeds reuse the same playlist IDs already shipped in the repo's spotify-playlists.html, keeping the app lightweight with no local audio assets.

Fixes #1404

…#1404)

- Backend: new ambient_music mapper maps parsed mood queries to curated
  open Spotify playlists and includes an ambient_music object in the
  /api/v1/mood-search response.
- Frontend: glassmorphic floating music panel on the discovery page that
  appears after a mood search, updates its Spotify embed src per mood,
  and coexists with the Ambient Sanctuary SFX panel (overlay behavior).
- Tests: unit tests for the mapper plus an endpoint check asserting the
  ambient_music payload shape.

Fixes devanshi14malhotra#1404
@netlify

netlify Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for bibliodrift-dm failed. Why did it fail? →

Name Link
🔨 Latest commit b7c9605
🔍 Latest deploy log https://app.netlify.com/projects/bibliodrift-dm/deploys/6a8ee83a84c21100086d811a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add AI Mood-Based Spotify/Ambient Playlist Integration

1 participant