new ai voice assistant
TL;DR
Added a new voice assistant feature to the mail app using ElevenLabs integration.
What changed?
- Created a new voice assistant page at
/mail/voicewith a complete UI for voice interactions - Added a navigation item for the Voice Assistant under a new "AI & Tools" section
- Updated the ElevenLabs package from
@11labs/reactto@elevenlabs/react(version 0.1.5) - Added localization support for the voice assistant feature
- Implemented email context loading to provide the assistant with recent email information
How to test?
- Navigate to
/mail/voicein the mail app - Ensure you're logged in and have granted microphone permissions
- Click "Start Conversation" to begin interacting with the voice assistant
- Test the mute/unmute functionality during conversation
- Verify that recent emails are properly loaded and provided as context
Why make this change?
This change enhances the mail application with voice interaction capabilities, allowing users to interact with their email through natural language. The voice assistant can access recent emails for context, providing a hands-free way to manage email communications. This feature improves accessibility and offers an alternative interface for users who prefer voice commands over traditional input methods.
[!CAUTION]
Review failed
The pull request is closed.
Walkthrough
This update introduces a voice assistant feature to the mail application. It adds context providers, UI components, and keyboard shortcuts for voice interactions, integrates ElevenLabs tools, and updates dependencies accordingly. Additional changes include new alert UI components, localization updates, and SVG icon enhancements.
Changes
| File(s) | Change Summary |
|---|---|
| apps/mail/app/(routes)/layout.tsx, apps/mail/app/(routes)/mail/layout.tsx | Wrapped layout components with VoiceProvider and rendered VoiceButton for voice assistant context and UI. |
| apps/mail/components/create/ai-chat.tsx, apps/mail/components/create/voice.tsx | Updated import statements for useConversation from @11labs/react to @elevenlabs/react; minor whitespace changes. |
| apps/mail/components/icons/icons.tsx | Updated Sparkles SVG icon paths to include fill="var(--icon-color)" and fillOpacity="0.5". |
| apps/mail/components/ui/alert.tsx | Added new exported React components: Alert, AlertTitle, and AlertDescription for styled alert UIs. |
| apps/mail/components/voice-button.tsx | Added new exported VoiceButton component for voice assistant UI and interaction controls. |
| apps/mail/config/shortcuts.ts | Added global shortcut for opening voice assistant (key v). |
| apps/mail/lib/elevenlabs-tools.ts | Introduced new module exporting toolExecutors with async functions for email and AI operations. |
| apps/mail/lib/hotkeys/global-hotkeys.tsx | Added new hotkey handler for voice assistant activation. |
| apps/mail/locales/en.json | Added "voice": "Voice Assistant" to navigation sidebar and updated an error message apostrophe. |
| apps/mail/package.json | Removed @11labs/react, added @ai-sdk/perplexity and @elevenlabs/react; updated react and react-dom versions. |
| apps/mail/providers/client-providers.tsx | Imported VoiceProvider and VoiceButton. |
| apps/mail/providers/voice-provider.tsx | Added new VoiceProvider, useVoice hook, and VoiceContext for managing voice interactions. |
| apps/server/package.json | Changed react version from 19.1.0 to catalog:. |
| pnpm-workspace.yaml | Added react and react-dom (version ^19.1.0) to catalog dependencies. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant VoiceButton
participant VoiceProvider
participant ElevenLabs
participant ToolExecutors
participant MailBackend
User->>VoiceButton: Click microphone / press 'v'
VoiceButton->>VoiceProvider: startConversation(context)
VoiceProvider->>ElevenLabs: Initialize voice session
ElevenLabs-->>VoiceProvider: Session started
VoiceProvider-->>VoiceButton: Update status (listening/speaking)
VoiceProvider->>ToolExecutors: Execute email/AI tools (as needed)
ToolExecutors->>MailBackend: Perform email operations (list, send, etc.)
MailBackend-->>ToolExecutors: Respond with results
ToolExecutors-->>VoiceProvider: Return tool results
VoiceProvider-->>VoiceButton: Update UI with results/status
User->>VoiceButton: End conversation
VoiceButton->>VoiceProvider: endConversation()
VoiceProvider->>ElevenLabs: Terminate session
Poem
π°
A whisper of code, a click, a voice,
Now emails can listen, respond, and rejoice!
With shortcuts and sparkles, alerts shining bright,
The rabbit brings features that work day and night.
So speak to your inbox, let AI assistβ
In this magical update, no detail is missed!
π€β¨
π Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro
π₯ Commits
Reviewing files that changed from the base of the PR and between a3d5790ddae3233f17678c58dd00c226d21c2192 and 4b08fb8391ef0e6e596fa8a9e88eb2bfda129560.
β Files ignored due to path filters (1)
-
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
π Files selected for processing (16)
-
apps/mail/app/(routes)/layout.tsx(1 hunks) -
apps/mail/app/(routes)/mail/layout.tsx(2 hunks) -
apps/mail/components/create/ai-chat.tsx(3 hunks) -
apps/mail/components/create/voice.tsx(1 hunks) -
apps/mail/components/icons/icons.tsx(1 hunks) -
apps/mail/components/ui/alert.tsx(1 hunks) -
apps/mail/components/voice-button.tsx(1 hunks) -
apps/mail/config/shortcuts.ts(1 hunks) -
apps/mail/lib/elevenlabs-tools.ts(1 hunks) -
apps/mail/lib/hotkeys/global-hotkeys.tsx(1 hunks) -
apps/mail/locales/en.json(2 hunks) -
apps/mail/package.json(2 hunks) -
apps/mail/providers/client-providers.tsx(1 hunks) -
apps/mail/providers/voice-provider.tsx(1 hunks) -
apps/server/package.json(1 hunks) -
pnpm-workspace.yaml(1 hunks)
β¨ Finishing Touches
- [ ] π Generate Docstrings
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.
πͺ§ Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Explain this complex logic. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai explain this code block. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and explain its main purpose. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
-
#1163
π (View in Graphite)
-
staging
This stack of pull requests is managed by Graphite. Learn more about stacking.