Project Structure
Core Application
Main App Component
- App.tsx
- routes.ts
Voice Navigator Component
TheVoiceNavigator component integrates NAVAI voice capabilities:
Custom Functions
Add custom voice-triggered functions in thefunctions-modules directory:
- session/logout.fn.ts
- support/open-help.fn.ts
Package Configuration
Environment Variables
Create a.env file:
Running the Application
Prerequisites
- Backend server running on
http://localhost:3000(see Express Backend Example) - Node.js 18+ installed
Development
http://localhost:5173.
Production Build
How It Works
1. Route Definition
Define routes insrc/ai/routes.ts with names, paths, descriptions, and synonyms.
2. Custom Functions
Create.fn.ts files in src/ai/functions-modules/. The generator automatically discovers these.
3. Module Generation
Runnpm run generate:module-loaders to create generated-module-loaders.ts from your custom functions.
4. Voice Agent Setup
Pass the generated loaders and routes touseWebVoiceAgent().
5. Voice Interaction
Users can say:- “llevame a perfil” - Navigate to profile
- “abre ajustes” - Open settings
- “cierra sesion” - Logout (custom function)
- “ayuda” - Open help center
Key Features
- React Router integration
- Type-safe route definitions
- Auto-discovery of custom functions
- Real-time voice status feedback
- Error handling and display
- Accessible UI components
Next Steps
- Add more custom functions
- Learn about route navigation
- Explore voice agent hooks