A modern, interactive chatbot application built with React and Vite, featuring multiple AI assistant integrations with real-time streaming responses.
- ๐ฌ Real-time Streaming: Experience smooth, token-by-token message streaming
- ๐ Multiple AI Providers: Support for OpenAI, Google AI, and DeepSeek
- ๐จ Modern UI: Clean and responsive interface with CSS Modules
- โก Fast Development: Built with Vite for blazing-fast HMR
- ๐ Markdown Support: Rich text formatting with react-markdown
- ๐ Type-safe: ESLint configuration for code quality
- Frontend: React 19
- Build Tool: Vite 7
- AI SDKs:
- OpenAI SDK
- Google Generative AI
- DeepSeek (via OpenAI-compatible API)
- Styling: CSS Modules
- Utilities:
- react-markdown for message formatting
- react-textarea-autosize for input field
-
Clone the repository
git clone https://github.com/LucaMimmo05/ai-chatbot.git cd ai-chatbot -
Install dependencies
pnpm install
Or with npm:
npm install
-
Set up environment variables
Create a
.envfile in the root directory:cp .env.example .env
Add your API keys:
VITE_GOOGLE_AI_API_KEY=your_google_ai_api_key_here VITE_OPEN_AI_API_KEY=your_openai_api_key_here VITE_DEEPSEEK_API_KEY=your_deepseek_api_key_here
pnpm devThe app will be available at http://localhost:5173
pnpm buildpnpm previewpnpm lintai-chatbot/
โโโ public/ # Static assets
โโโ src/
โ โโโ assistants/ # AI provider integrations
โ โ โโโ openai.js
โ โ โโโ googleai.js
โ โ โโโ deepseekai.js
โ โโโ components/
โ โ โโโ Chat/ # Main chat interface
โ โ โโโ Controls/ # Input controls
โ โ โโโ Loader/ # Loading indicator
โ โโโ App.jsx # Main app component
โ โโโ main.jsx # App entry point
โโโ .env.example # Environment variables template
โโโ vite.config.js # Vite configuration
To change the AI provider, modify the import in src/App.jsx:
// For OpenAI or DeepSeek
import { Assistant } from "./assistants/openai";
// or
import { Assistant } from "./assistants/deepseekai";
// For Google AI
import { Assistant } from "./assistants/googleai";
โ ๏ธ Important: When switching between OpenAI/DeepSeek and Google AI, you need to update thechatStreammethod call inApp.jsx:
For OpenAI/DeepSeek:
const result = assistant.chatStream(content, messages);For Google AI:
const result = assistant.chatStream(content); // No messages parameterThis is because Google AI maintains conversation history internally through its startChat() method, while OpenAI and DeepSeek require the full message history to be passed with each request.
Each assistant supports custom model selection:
- OpenAI: Default is
gpt-4o-mini - Google AI: Default is
gemini-2.5-flash - DeepSeek: Default is
deepseek-chat
- OpenAI: platform.openai.com
- Google AI: ai.google.dev
- DeepSeek: platform.deepseek.com
This project includes two automated workflows:
Runs on every push and pull request to main and develop branches:
- โ Lints code with ESLint
- ๐จ Builds the project
- ๐ฆ Uploads build artifacts
Automatically deploys to GitHub Pages on push to main:
- ๐จ Builds the project with production settings
- ๐ Deploys to GitHub Pages
For deployment to work, add your API keys as repository secrets:
- Go to your repository โ Settings โ Secrets and variables โ Actions
- Add the following secrets:
VITE_GOOGLE_AI_API_KEYVITE_OPEN_AI_API_KEYVITE_DEEPSEEK_API_KEY
- Go to repository Settings โ Pages
- Under "Source", select "GitHub Actions"
- Save the settings
Your app will be deployed to https://lucamimmo05.github.io/ai-chatbot/
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
Luca Mimmo
- GitHub: @LucaMimmo05
Built with โค๏ธ using React and Vite