How umanggoel21/liquoa-chatbot works
Project Type and Purpose
• Lynqo AI Assistant is a full-stack, voice-enabled AI chatbot.
• It provides both a Streamlit-based web UI and a command-line interface for multilingual, real-time conversation.
File Structure Analysis
• Top-level:
• .devcontainer/ – development container settings
• assets/ – static images or UI assets
• backend/ – all Python modules powering UI, voice/text I/O, AI integration
• requirements.txt – dependency list
• backend/ organizes core functional areas:
• frontend.py – Streamlit web server (UI layer)
• main.py – CLI entry point (UI layer)
• listen.py – microphone capture + speech-to-text (I/O layer)
• detect_language.py – language detection (processing layer)
• translate.py & translate_back.py – bidirectional translation (processing layer)
• groq_chat.py – calls Groq AI API (business logic layer)
• speak.py – text-to-speech (I/O layer)
• saved_audio/ – temporary audio files (storage layer)
External Dependencies (from README & requirements.txt)
• groq API for AI chat processing
• gTTS for TTS
• SpeechRecognition (and PyAudio) for speech input
• langdetect for language ID
• googletrans for translation
• Streamlit for web UI
Main Components and Their Relationships
a. User Interfaces
• Browser (Streamlit UI)
• Terminal (CLI)
b. I/O Layer
• listen.py → produces text transcription
• speak.py ← consumes AI response text, outputs audio
c. Processing Layer
• detect_language.py → language code
• translate.py → normalize non-English input to English
• groq_chat.py → sends English prompt to AI, returns English reply
• translate_back.py → convert English reply to user’s language
d. Storage Layer
• saved_audio/ for intermediary WAV/MP3 files
e. External Services
• Groq AI API
• Google Translate API (via googletrans)
• gTTS service
User → [listen.py] → raw_text → [detect_language.py] → lang_code
raw_text + lang_code → [translate.py] → english_text → [groq_chat.py] → response_en
response_en + lang_code → [translate_back.py] → response_user_lang → [speak.py] → audio
UI ← text + audio
Architectural Patterns and Principles
• Layered architecture: separate I/O, processing, business logic
• Single-process monolith with clear module boundaries
• Stateless modules except for temporary audio storage
• External-service façade modules (groq_chat, translate, speak)