Skip to content

An intelligent chatbot for Thaddeus Stevens College of Technology's Computer Software Engineering Technology (CSET) program, powered by Google Gemini AI with RAG (Retrieval Augmented Generation).

Notifications You must be signed in to change notification settings

fahimshams/CSET-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSET RAG Chatbot - AI-Powered Assistant

An intelligent chatbot for Thaddeus Stevens College of Technology's Computer Software Engineering Technology (CSET) program, powered by Google Gemini AI with RAG (Retrieval Augmented Generation).

Features

  • AI-Powered Responses - Utilizes Google Gemini 2.5 Flash model
  • Smart Context Retrieval - RAG with Pinecone vector database
  • Modern UI - Responsive React interface with dark mode support
  • Secure Backend - Express.js API with environment-based configuration
  • Fast & Lightweight - Built with Vite and TypeScript

Architecture

This application consists of two main parts:

  1. Frontend (React + TypeScript + Vite)

    • Modern, responsive UI
    • Real-time chat interface
    • API client for backend communication
  2. Backend (Node.js + Express + TypeScript)

    • RESTful API endpoints
    • Google Gemini AI integration
    • Pinecone vector database (with mock support)
    • CORS and security middleware

Quick Start

Prerequisites

  • Node.js 18 or higher
  • npm or yarn
  • Google Gemini API key (Get one here)

Setup

For detailed setup instructions, see SETUP.md

Quick setup:

  1. Backend Setup

    cd backend
    npm install
    cp env.example.txt .env
    # Edit .env and add your GEMINI_API_KEY
    npm run dev
  2. Frontend Setup (in a new terminal)

    npm install
    npm run dev
  3. Access the app

Project Structure

CSET-chatbot/
├── backend/                 # Express.js backend
│   ├── src/
│   │   ├── config/         # Environment configuration
│   │   ├── constants/      # System prompts & knowledge base
│   │   ├── controllers/    # Request handlers
│   │   ├── middleware/     # Express middleware
│   │   ├── routes/         # API routes
│   │   ├── services/       # Gemini & Pinecone services
│   │   ├── types/          # TypeScript types
│   │   └── server.ts       # Main server file
│   ├── package.json
│   └── README.md
├── components/             # React components
│   ├── ChatBubble.tsx
│   ├── Header.tsx
│   ├── IconComponents.tsx
│   └── MessageInput.tsx
├── services/              # Frontend services
│   ├── apiService.ts     # Backend API client (current)
│   ├── geminiService.ts  # Legacy direct integration
│   └── pineconeService.ts # Legacy mock service
├── App.tsx               # Main React component
├── types.ts              # TypeScript types
├── constants.ts          # Frontend constants
├── package.json
├── SETUP.md             # Detailed setup guide
└── README.md            # This file

Configuration

Backend Environment Variables

Create backend/.env:

PORT=3001
NODE_ENV=development
FRONTEND_URL=http://localhost:5173
GEMINI_API_KEY=your_gemini_api_key_here
USE_MOCK_PINECONE=true

Frontend Environment Variables

Create .env in root:

VITE_API_URL=http://localhost:3001/api

API Documentation

Endpoints

  • GET /api/health - Health check
  • POST /api/chat/message - Send a message to the chatbot
  • POST /api/chat/reset - Reset the chat session

For detailed API documentation, see backend/README.md

Development

Running in Development Mode

Backend (with hot reload):

cd backend
npm run dev

Frontend (with hot reload):

npm run dev

Building for Production

Backend:

cd backend
npm run build
npm start

Frontend:

npm run build
npm run preview

Testing the API

Using curl:

# Health check
curl http://localhost:3001/api/health

# Send a message
curl -X POST http://localhost:3001/api/chat/message \
  -H "Content-Type: application/json" \
  -d '{"message": "What is CSET?"}'

Customization

Knowledge Base

Edit backend/src/constants/systemInstruction.ts to customize:

  • System instructions
  • Knowledge base content
  • AI personality

UI Theme

Modify Tailwind classes in components to customize the look and feel.

Security

  • API keys stored securely in backend environment variables
  • CORS configured to accept requests only from frontend
  • Helmet.js for security headers
  • Input validation on all endpoints

Tech Stack

Frontend

  • React 19
  • TypeScript 5.8
  • Vite 6
  • Tailwind CSS (via inline styles)

Backend

  • Node.js
  • Express.js
  • TypeScript 5.8
  • Google Gemini AI SDK
  • Pinecone Vector Database
  • Helmet, CORS, Morgan

Troubleshooting

See SETUP.md for common issues and solutions.

License

ISC

Contributing

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

Support

For issues or questions, please create an issue in the repository.

About

An intelligent chatbot for Thaddeus Stevens College of Technology's Computer Software Engineering Technology (CSET) program, powered by Google Gemini AI with RAG (Retrieval Augmented Generation).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published