groqAudioChat
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
index.ts
https://arfan--904211e24c534ba493e58ff0ffef4121.web.val.run
A web-based chat application powered by Groq's LLM API with audio transcription and text-to-speech capabilities.
- Chat with the Llama-3.3-70b-versatile model through Groq API
- Multiple ways to record audio input:
- Hold spacebar to record audio (keyboard shortcut)
- Press Cmd+Space (Mac) or Ctrl+Space (Windows/Linux) to toggle locked recording
- Hold the "Hold to Record" button
- Click the "Lock Recording" button for hands-free recording
- Text-to-speech output for AI responses with multiple voice options:
- Choose from 19 different voices via dropdown
- Random voice selection option
- Concise mode for shorter responses
- Toggle TTS on/off
/
βββ index.ts # Main entry point
βββ handlers/ # API endpoint handlers
β βββ index.ts # Exports all handlers
β βββ audio.ts # Audio transcription handler
β βββ chat.ts # Chat completion handler
β βββ tts.ts # Text-to-speech handler
βββ ui/ # UI components
βββ index.ts # Exports all UI components
βββ html.ts # HTML template
βββ styles.ts # CSS styles
βββ tailwind.ts # Tailwind configuration
βββ alpine.ts # Alpine.js code
GET /- Main web interfacePOST /transcribe-audio- Transcribe audio recordingsPOST /chat- Send chat messages to Groq LLMPOST /text-to-speech- Convert text to speech
The application features 19 different PlayHT voices through Groq's API:
- Arista-PlayAI
- Atlas-PlayAI
- Basil-PlayAI
- Briggs-PlayAI
- Calum-PlayAI
- Celeste-PlayAI
- Cheyenne-PlayAI
- Chip-PlayAI
- Cillian-PlayAI
- Deedee-PlayAI
- Fritz-PlayAI
- Gail-PlayAI
- Indigo-PlayAI
- Mamaw-PlayAI
- Mason-PlayAI
- Mikail-PlayAI
- Mitch-PlayAI
- Quinn-PlayAI
- Thunder-PlayAI
GROQ_API_KEY- Your Groq API key
- Hono - Lightweight web framework
- Alpine.js - Front-end JavaScript framework
- Tailwind CSS - Utility-first CSS framework
- Groq API - LLM provider with Llama-3.3-70b-versatile model
- Groq Whisper API - Audio transcription
- PlayHT (via Groq) - Text-to-speech synthesis
This project is based on the original Val Town project by yawnxyz/groqAudioChat, with additional features and improvements including:
- Refactored code structure
- Enhanced recording options with keyboard shortcuts
- Multiple voice selection options
- Improved UI and visual feedback