Skip to content

LucaMimmo05/ai-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– AI Chatbot

A modern, interactive chatbot application built with React and Vite, featuring multiple AI assistant integrations with real-time streaming responses.

โœจ Features

  • ๐Ÿ’ฌ 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

๐Ÿš€ Tech Stack

  • 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

๐Ÿ“ฆ Installation

  1. Clone the repository

    git clone https://github.com/LucaMimmo05/ai-chatbot.git
    cd ai-chatbot
  2. Install dependencies

    pnpm install

    Or with npm:

    npm install
  3. Set up environment variables

    Create a .env file 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

๐ŸŽฎ Usage

Development Mode

pnpm dev

The app will be available at http://localhost:5173

Build for Production

pnpm build

Preview Production Build

pnpm preview

Lint Code

pnpm lint

๐Ÿ—๏ธ Project Structure

ai-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

๐Ÿ”ง Configuration

Switching AI Providers

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 the chatStream method call in App.jsx:

For OpenAI/DeepSeek:

const result = assistant.chatStream(content, messages);

For Google AI:

const result = assistant.chatStream(content); // No messages parameter

This 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.

Customizing Models

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

๐Ÿ”‘ Getting API Keys

๐Ÿš€ GitHub Actions Workflows

This project includes two automated workflows:

CI/CD Pipeline (ci.yml)

Runs on every push and pull request to main and develop branches:

  • โœ… Lints code with ESLint
  • ๐Ÿ”จ Builds the project
  • ๐Ÿ“ฆ Uploads build artifacts

Deploy to GitHub Pages (deploy.yml)

Automatically deploys to GitHub Pages on push to main:

  • ๐Ÿ”จ Builds the project with production settings
  • ๐ŸŒ Deploys to GitHub Pages

Setting up GitHub Secrets

For deployment to work, add your API keys as repository secrets:

  1. Go to your repository โ†’ Settings โ†’ Secrets and variables โ†’ Actions
  2. Add the following secrets:
    • VITE_GOOGLE_AI_API_KEY
    • VITE_OPEN_AI_API_KEY
    • VITE_DEEPSEEK_API_KEY

Enabling GitHub Pages

  1. Go to repository Settings โ†’ Pages
  2. Under "Source", select "GitHub Actions"
  3. Save the settings

Your app will be deployed to https://lucamimmo05.github.io/ai-chatbot/

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

This project is open source and available under the MIT License.

๐Ÿ‘ค Author

Luca Mimmo


Built with โค๏ธ using React and Vite

About

๐Ÿค– AI Chatbot - React app with OpenAI & Google AI integration

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors