A modern AI-powered chatbot built with React and Vite, integrated with Google's Gemini AI API. Get instant intelligent responses to any question with a beautiful, responsive interface.
- π§ AI-Powered - Integrated with Google Gemini 2.0 Flash API
- π¬ Conversational Interface - Natural chat experience
- π¨ Modern UI/UX - Beautiful gradient design with smooth animations
- π± Responsive Design - Works perfectly on all devices
- π£ Floating Widget - Non-intrusive corner chatbot
- π Text Formatting - Supports markdown-like formatting (bold, bullets, lists)
- β‘ Fast Performance - Built with Vite for lightning-fast development
- π Secure - Environment variables for API key protection
- Node.js 16+
- npm or yarn
- Google Gemini API Key
git clone <your-repo-url>
cd chatBotnpm installCreate a .env file in the root directory:
VITE_GEMINI_API_KEY=your_gemini_api_key_hereGet your API key from: Google AI Studio
npm run devOpen http://localhost:5173 in your browser.
npm run buildThis creates an optimized build in the dist/ folder.
Upload the dist/ folder contents to any static hosting service:
- Vercel:
vercel --prod - Netlify: Drag & drop the
distfolder - GitHub Pages: Upload to gh-pages branch
chatBot/
βββ src/
β βββ components/
β β βββ ChatMessage.jsx # Message formatting component
β β βββ ChatForm.jsx # Input form component
β β βββ ChatbotIcon.jsx # Bot icon component
β βββ App.jsx # Main application
β βββ index.css # Global styles
β βββ main.jsx # App entry point
βββ public/
βββ .env # Environment variables
βββ package.json
- Welcome Message: Edit the welcome text in
App.jsx - Styling: Modify colors and layout in
index.css - AI Responses: Adjust API parameters in the
generateBotResponsefunction
// In App.jsx - generateBotResponse function
generationConfig: {
temperature: 0.7, // Creativity (0-1)
topK: 40, // Response variety
topP: 0.95, // Response precision
maxOutputTokens: 1024 // Response length
}- Click the purple chat button in the bottom-right corner
- Type your question in the input field
- Press Enter or click send to get AI responses
- Close by clicking the X or chat button again
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
- React 18+ - UI framework
- Vite - Build tool and dev server
- Axios - HTTP client for API calls
- Google Gemini API - AI responses
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- API Key Error: Make sure your
.envfile has the correctVITE_GEMINI_API_KEY - Build Fails: Run
npm installto ensure all dependencies are installed - Chatbot Not Responding: Check browser console for API errors
If you encounter issues, please open an issue on GitHub with:
- Error message
- Browser and version
- Steps to reproduce
Made with β€οΈ using React + Vite + Gemini AI