@@ -93,7 +93,7 @@ php artisan test --testsuite=Feature
93
93
- ` /app/ ` - Laravel backend logic
94
94
- ` /Http/Controllers/ ` - Request handlers (Conversations, Realtime, Settings)
95
95
- ` /Models/ ` - Eloquent models (Conversation, Transcript, etc.)
96
- - ` /Services/ ` - Business logic (ApiKeyService, RealtimeRelayService, TranscriptionService)
96
+ - ` /Services/ ` - Business logic (ApiKeyService, TranscriptionService)
97
97
- ` /Providers/ ` - Service providers
98
98
- ` /resources/js/ ` - Vue frontend application
99
99
- ` /components/ ` - Reusable Vue components
@@ -191,11 +191,24 @@ Example usage:
191
191
192
192
## Working with Real-time Features
193
193
194
- The application uses OpenAI's Realtime API for live transcription:
195
- - Frontend audio capture: ` /resources/js/services/audioCaptureService.ts `
196
- - WebSocket client: ` /resources/js/services/realtimeClient.ts `
197
- - Backend relay service: ` /app/Services/RealtimeRelayService.php `
198
- - Controllers: ` /app/Http/Controllers/RealtimeController.php `
194
+ The application uses a ** direct frontend WebSocket architecture** for optimal performance:
195
+
196
+ ### Architecture Overview
197
+ - ** Frontend Audio Capture** : ` /resources/js/services/audioCaptureService.ts `
198
+ - ** Direct WebSocket Connections** : ` /resources/js/pages/RealtimeAgent/Main.vue `
199
+ - Native WebSocket implementation connecting directly to OpenAI Realtime API
200
+ - Two separate connections: salesperson transcription + customer coach analysis
201
+ - Uses ` gpt-4o-mini-transcribe ` model for cost-effective transcription
202
+ - ** Backend Ephemeral Key Service** : ` /app/Http/Controllers/RealtimeController.php `
203
+ - Generates secure temporary authentication keys
204
+ - No WebSocket relay - frontend connects directly to OpenAI
205
+
206
+ ### Data Flow
207
+ ```
208
+ Frontend → Backend (ephemeral key) → Frontend → OpenAI (direct WebSocket)
209
+ ```
210
+
211
+ This architecture provides lower latency and better scalability compared to backend relay approaches.
199
212
200
213
## API Key Management
201
214
0 commit comments