A clean, feature-rich AI chatbot built with React and powered by Google Gemini. Supports rich markdown rendering, math expressions, code execution, chat history, dark/light mode, and a built-in music player.
- Gemini AI Integration: Powered by Google Gemini API for intelligent, context-aware responses
- Quick-Start Prompts: Pre-built suggestion cards on the home screen (Tell me something fun, Help me brainstorm, Write something creative, Explain something simply)
- Time-Aware Greeting: Dynamic welcome message based on the time of day (Good morning / afternoon / evening)
- Markdown Rendering: Full markdown support in AI responses via react-markdown — bold, italics, lists, headings, and more
- Math Rendering: LaTeX math expressions rendered beautifully using KaTeX
- Copy Button: One-click copy on any AI response message
- Voice Input: Microphone button in the input bar for voice-to-text messaging
- Chat History: Persistent sidebar listing all past conversations with timestamps
- New Chat: Start a fresh conversation at any time via the
+button - Collapsible Sidebar: Toggle sidebar open/closed for a focused chat view
- Code Runner: Dedicated
CodeRunnercomponent for syntax-highlighted code blocks in responses - Music Player: Built-in
/playcommand to trigger a lofi music player mid-conversation - Dark / Light Mode: Theme toggle accessible from the header
- Export Chat: Download button to save conversation history
- Responsive Layout: Adapts cleanly across mobile, tablet, and desktop viewports
| Technology | Purpose |
|---|---|
| React 19 | Core UI framework |
| Vite | Build tool and development server |
| @google/generative-ai | Google Gemini API client |
| react-markdown | Markdown rendering in chat responses |
| KaTeX | LaTeX math expression rendering |
Ensure you have the following installed:
- Node.js (v18 or higher)
- npm or yarn
- A Google Gemini API key (get one here)
- Clone the repository
git clone https://github.com/Asmit-64bit/Basic-ChatBot.git
cd Basic-ChatBot- Install dependencies
npm install- Set up your API key
Create a .env file in the root directory:
VITE_GEMINI_API_KEY=your_gemini_api_key_here- Start the development server
npm run devOpen http://localhost:5173 to view the application in your browser.
npm run buildBasic-ChatBot/
├── public/ # Static assets served directly
├── src/
│ ├── assets/ # Images and media files
│ │ ├── IMG-20251118-WA0030.jpg # User avatar
│ │ ├── loading-spinner.gif # Loading animation
│ │ ├── react.svg # React logo
│ │ ├── robot.png # Bot avatar
│ │ └── user.png # User avatar fallback
│ ├── components/ # Reusable UI components
│ │ ├── ChatInput.jsx # Message input bar with mic and send button
│ │ ├── ChatInput.css
│ │ ├── ChatMessage.jsx # Single message bubble (user or bot)
│ │ ├── ChatMessage.css
│ │ ├── ChatMessages.jsx # Scrollable list of all chat messages
│ │ ├── ChatMessages.css
│ │ ├── CodeRunner.jsx # Syntax-highlighted code block renderer
│ │ ├── CodeRunner.css
│ │ ├── Header.jsx # Top bar with title, theme toggle, export button
│ │ ├── Header.css
│ │ ├── MusicPlayer.jsx # Lofi music player triggered by /play command
│ │ ├── MusicPlayer.css
│ │ ├── Sidebar.jsx # Collapsible chat history sidebar
│ │ └── Sidebar.css
│ ├── services/ # API and data services
│ │ ├── gemini.js # Gemini API client and request handler
│ │ └── chatHistory.js # Chat history persistence logic
│ ├── App.jsx # Root component — layout and state management
│ ├── App.css # Global app styles
│ ├── index.css # Base styles and CSS variables
│ └── main.jsx # React DOM entry point
├── index.html
├── vite.config.js
└── package.json
This project uses the Google Gemini API. A free API key is available via Google AI Studio.
Note: Keep your API key in
.envand never commit it to version control. The.gitignoreis already configured to exclude.env.
This project is open source and available under the MIT License.



