Skip to content

Sona AI Layer#4

Merged
lebuckman merged 5 commits into
mainfrom
dev
Apr 20, 2026
Merged

Sona AI Layer#4
lebuckman merged 5 commits into
mainfrom
dev

Conversation

@lebuckman
Copy link
Copy Markdown
Owner

No description provided.

- Add Anthropic client singleton with model and token limit constants
- Add SonaUserContext builder reading from DB cache (no live API calls)
- Add prompt templates for insight, profile, and chat with Sona voice guidelines
- Add /api/ai/insights route with 24-hour DB cache
- Add /api/ai/profile route with 7-day DB cache
- Add /api/ai/chat route with SSE streaming and multi-turn history
- Add useAiInsights and useAiProfile TanStack Query hooks
- Add InsightCard component with loading skeleton
- Add SonaProfileCard component with loading skeleton
- Add Ask Sona chat page with real-time streaming and suggested prompts
- Wire InsightCard and SonaProfileCard into profile page
- Add Ask Sona nav link from profile to chat
- Wrap contextStr in <listening_data> delimiters to prevent prompt injection
- Add isStreamingRef guard to prevent overlapping stream requests in chat
- Fix SSE frame boundary parsing with proper buffer accumulation
- Add defensive validation and history cap (12 turns, 4k chars) to chat route
- Relax insight/profile empty check to allow partially warmed cache context
- Add server-only guard to Anthropic client
- Cap genreBreakdown to 8 entries in formatContextForPrompt
- Add Ask Sona mobile nav link visible below sm breakpoint
- Correct chat route comment to reflect context-dump implementation not agentic tool use
- Gate useGenreBreakdown on useTopArtists success to prevent race condition
- Note chat as context-dump + SSE streaming, not agentic tool use
- Add agentic tool use to non-goals and post-v1 roadmap
- Update architecture summary to remove tool use from Claude description
- Mark /chat as public route accessible to guests
- Update Sprint 3 feature descriptions to match actual implementation
- Update open questions to reflect deferred agentic tool use decision
feat(ai): add AI layer with insights and profile
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

Warning

Rate limit exceeded

@lebuckman has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 50 minutes and 37 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 50 minutes and 37 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ef482d2c-801a-4415-bc29-62eadb5f9197

📥 Commits

Reviewing files that changed from the base of the PR and between ff56457 and 952839d.

📒 Files selected for processing (13)
  • docs/PRD.md
  • src/app/(protected)/chat/page.tsx
  • src/app/(protected)/profile/page.tsx
  • src/app/api/ai/chat/route.ts
  • src/app/api/ai/insights/route.ts
  • src/app/api/ai/profile/route.ts
  • src/components/sona/insight-card.tsx
  • src/components/sona/sona-profile-card.tsx
  • src/hooks/use-ai-insights.ts
  • src/hooks/use-ai-profile.ts
  • src/lib/ai/client.ts
  • src/lib/ai/context.ts
  • src/lib/ai/prompts.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2026

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

Project Deployment Actions Updated (UTC)
sona Ready Ready Preview, Comment Apr 20, 2026 4:51am

@lebuckman lebuckman merged commit e3f50be into main Apr 20, 2026
5 checks passed
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.

1 participant