Skip to content

feat(phase-3): implement react frontend and realtime audio hooks#18

Merged
PyDevDeep merged 1 commit into
mainfrom
fix/n8n-routing-and-stub
Jun 30, 2026
Merged

feat(phase-3): implement react frontend and realtime audio hooks#18
PyDevDeep merged 1 commit into
mainfrom
fix/n8n-routing-and-stub

Conversation

@PyDevDeep

Copy link
Copy Markdown
Owner

Title: feat(phase-3): Implement React frontend and real-time audio hooks

Description
Completed Phase 3 (Frontend) of the project roadmap. Implemented the Vite + React client application using Tailwind CSS for styling and native Web Audio API for PCM16 audio processing.

Changelog

  1. React Setup & Configuration
  • frontend/package.json & vite.config.js: Initialized Vite React project. Configured dev server proxy to bypass CORS and route /api and /ws requests to the FastAPI backend running on port 8000.
  • frontend/tailwind.config.js & globals.css: Configured Tailwind CSS utility classes.
  1. Real-time Audio Processing
  • frontend/src/hooks/useVoiceSession.js: Built a custom hook utilizing the Web Audio API (AudioContext, ScriptProcessor) to capture raw microphone input, convert Float32 arrays to 16-bit PCM at 24kHz, and stream binary chunks to the OpenAI Realtime API via FastAPI WebSockets. Implemented interrupt handling and binary audio playback for OpenAI responses.
  • frontend/src/components/AudioWaveform.jsx: Implemented a native HTML5 Canvas visualizer driven by an AnalyserNode to render a real-time waveform of the user's voice input.
  • frontend/src/components/VoiceWidget.jsx: Integrated the audio session hook and waveform visualizer into the primary user interface.
  1. Admin Dashboard & WebSockets
  • frontend/src/hooks/useAdminSocket.js: Implemented a resilient WebSocket client hook for the admin dashboard featuring an exponential backoff reconnection algorithm (up to 5 retries) to handle backend restarts.
  • frontend/src/components/BookingTable.jsx: Extracted the booking table into a reusable component with strict color-coded statuses (Confirmed, On Hold, Cancelled).
  • frontend/src/components/AdminDashboard.jsx: Integrated the admin socket to render live, zero-latency booking updates broadcasted by n8n and FastAPI.

Acceptance Criteria Checklist
[x] Frontend dependencies compile securely without ENOENT errors.
[x] useVoiceSession successfully converts Float32 to PCM16 and multiplexes binary streams.
[x] useAdminSocket algorithm enforces exponential backoff upon connection drops.
[x] AudioWaveform canvas accurately visualizes the frequency data from the AnalyserNode.
[x] dist/ and node_modules/ are strictly excluded from source control.

@PyDevDeep PyDevDeep merged commit 747c7c8 into main Jun 30, 2026
4 checks passed
@PyDevDeep PyDevDeep deleted the fix/n8n-routing-and-stub branch June 30, 2026 11:56
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