Skip to content

Improve LastFM mood analysis robustness and efficiency#6

Open
err53 wants to merge 3 commits into
mainfrom
codex/improve-lastfm-music-mood-feature
Open

Improve LastFM mood analysis robustness and efficiency#6
err53 wants to merge 3 commits into
mainfrom
codex/improve-lastfm-music-mood-feature

Conversation

@err53

@err53 err53 commented May 27, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Make the LastFM mood feature resilient to partial metadata failures so one failing track-info lookup doesn't break the entire mood result.
  • Reduce LLM payload size and noise to lower latency/cost and improve mood signal quality.
  • Reduce frontend/network load from overly aggressive polling for the latest track.

Description

  • Replace Promise.all with Promise.allSettled when fetching per-track details and fall back to recent-track fields for any failed lookups to ensure a complete, best-effort payload.
  • Build a compact per-track payload (name, artist, album, tags, trimmed wikiSummary) and pass that to the LLM instead of full Last.fm objects to reduce tokens and noise.
  • Update the system/user prompt schema to document and reference the new CompactTrack shape and simplified cue names.
  • Add cache options (revalidate and tags) to the unstable_cache call and change the call-site to analyzeRecentMood(input.user, input.user); reduce client polling interval in LastFM component from 1*1000 to 5*1000.

Testing

  • Ran pnpm -s lint, which could not complete in this environment due to missing required environment variables (LASTFM_API_KEY, OPENROUTER_API_KEY, NEXT_PUBLIC_POSTHOG_KEY), so automated lint checks did not finish successfully.

Codex Task

@vercel

vercel Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
personal-site Ready Ready Preview, Comment May 27, 2026 11:07pm

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant