A modern, interactive AI chatbot built with React and powered by Groq API. Mojo is a friendly turquoise cat assistant that provides helpful responses with personality and style.
- π€ AI-Powered Responses - Integration with Groq API (Llama 3.3 70B model)
- β¨οΈ Typewriter Effect - Smooth character-by-character message animation
- πΊ Mood Detection - Dynamic avatar changes based on conversation context (10 different moods)
- π¨ Glassmorphism Design - Modern UI with frosted glass effects and gradient animations
- π± Fully Responsive - Optimized for desktop, tablet, and mobile devices
- βΏ Accessibility - ARIA labels and keyboard navigation support
- πΎ Session Persistence - Conversation history maintained during session
- π― Smart Focus Management - Auto-focus on input field for better UX
- β‘ Skip Animation - Click messages to instantly display full text
- React 18.3.1 - UI library
- Vite 6.0.3 - Build tool and dev server
- Groq API - LLM provider (Llama 3.3 70B Versatile)
- React Icons - Icon library (Lucide React)
- CSS3 - Styling with custom properties and animations
- Node.js 18+ and npm/yarn
- Groq API key (get one at console.groq.com)
-
Clone the repository
git clone <your-repo-url> cd mojo-chatbot
-
Install dependencies
npm install
-
Configure API proxy
The project uses a proxy server to handle Groq API calls. Update the API_URL in src/services/groqService.js:
const API_URL = 'https://your-proxy-url.vercel.app/api/chat';Start the development server:
npm run devThe app will be available at http://localhost:5173
Create a production build:
npm run buildPreview the production build:
npm run previewβββ public/
β βββ avatars/ # Mood-based avatar images
β βββ img/ # Background images
βββ src/
β βββ components/
β β βββ Chatbot.jsx # Main chatbot component
β β βββ Chatbot.css # Chatbot styling
β β βββ TypewriterMessage.jsx # Typewriter animation component
β β βββ TypewriterMessage.css # Typewriter styling
β βββ services/
β β βββ groqService.js # Groq API integration
β βββ utils/
β β βββ detectMood.js # Mood detection logic
β βββ App.jsx # Root component
β βββ index.css # Global styles
β βββ main.jsx # Entry point
βββ index.html
βββ vite.config.js
βββ package.json
Modify parameters in src/services/groqService.js:
{
model: 'llama-3.3-70b-versatile',
temperature: 0.9, // Creativity level (0-2)
top_p: 0.95, // Nucleus sampling
max_tokens: 400, // Response length limit
presence_penalty: 0.3, // Topic diversity
frequency_penalty: 0.4 // Repetition penalty
}Adjust typing speed in src/components/Chatbot.jsx:
<TypewriterMessage
cps={18} // Characters per second
startDelay={250} // Initial delay (ms)
showCaret={true} // Show blinking cursor
enableSkip={true} // Allow click to skip
/>Add or modify mood keywords in src/utils/detectMood.js:
const partyKeywords = [
'hurΓ‘', 'oslav', 'gratuluj', 'vΓ½hra', // Add your keywords
];Edit CSS variables in src/index.css:
:root {
--leo-primary: #94d7f1; /* Main accent color */
--leo-secondary: #d5192e; /* Button color */
--leo-bg: #1a1a1a; /* Background */
--leo-text: #e0e0e0; /* Text color */
}Customize the AI personality in src/services/groqService.js:
{
role: 'system',
content: 'You are MOJO, a turquoise cat. You are an AI assistant...'
}- Push your code to GitHub
- Import project in Vercel
- Configure environment variables
- Deploy
For security, API calls go through a proxy server. Here's a basic example:
// api/chat.js (Vercel Serverless Function)
export default async function handler(req, res) {
const response = await fetch('https://api.groq.com/openai/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.GROQ_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(req.body)
});
const data = await response.json();
res.status(200).json(data);
}Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
- Groq for providing the AI infrastructure
- React team for the excellent framework
- Vite team for the blazing fast build tool
For questions or feedback, please open an issue on GitHub.
Made with β€οΈ and React
