Commit 2820a98
authored
🤖 feat: voice input mode with OpenAI transcription (#836)
Adds voice dictation capability to the chat input using OpenAI's
gpt-4o-transcribe model.
## Features
- **Voice recording** via MediaRecorder API (webm/opus format)
- **OpenAI transcription** via backend IPC (API key stays server-side)
- **Recording overlay** replaces textarea with animated waveform
visualization
- **Multiple shortcuts**:
- Space on empty input → start recording
- Space during recording → stop and send immediately
- Ctrl+D / Cmd+D → toggle recording anytime
- Escape → cancel recording (discard audio)
- **Global keybinds** during recording work regardless of focus
- **User education** when OpenAI key not configured (disabled button
with tooltip)
## UI States
| State | Appearance |
|-------|------------|
| Idle | Subtle gray mic icon in textarea corner |
| Recording | Blue border overlay with animated waveform |
| Transcribing | Amber border overlay, waiting for API |
| No API Key | Disabled mic with explanatory tooltip |
## Implementation
- `useVoiceInput` hook with clean state enum (`idle` / `recording` /
`transcribing`)
- `VoiceInputButton` floating component
- `WaveformBars` reusable animated component
- IPC channel `voice:transcribe` for backend API calls
- Hidden on mobile (native keyboards have built-in dictation)
## Files Changed
- `src/browser/hooks/useVoiceInput.ts` - Core hook
- `src/browser/components/ChatInput/VoiceInputButton.tsx` - Button
component
- `src/browser/components/ChatInput/WaveformBars.tsx` - Animation
component
- `src/browser/components/ChatInput/index.tsx` - Integration
- `src/node/services/ipcMain.ts` - Backend transcription handler
- `src/common/constants/ipc-constants.ts` - IPC channel
- `src/common/types/ipc.ts` - Type definitions
---
_Generated with `mux`_1 parent 372f0d9 commit 2820a98
File tree
20 files changed
+651
-27
lines changed- src
- browser
- components
- ChatInput
- hooks
- stories
- utils
- commands
- ui
- common
- constants
- types
- desktop
- node/services
- tests/e2e/scenarios
20 files changed
+651
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
2688 | 2689 | | |
2689 | 2690 | | |
2690 | 2691 | | |
| 2692 | + | |
| 2693 | + | |
2691 | 2694 | | |
2692 | 2695 | | |
2693 | 2696 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
364 | 367 | | |
365 | 368 | | |
366 | 369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments