Skip to content

Gemini-powered, zero-hallucination AI chatbot for Montfort ICSE — semantic search, IUI Engine v2.5, verified school data, and hybrid RAG architecture.

Notifications You must be signed in to change notification settings

thiyo-de/Chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 Montfort ICSE AI Chatbot v3.0

Next-Gen School Assistant with 3D Navigation & RAG Intelligence

Status AI-Engine Database Navigation

Context-Aware Q&A • 3D Virtual Tours • Intelligent Intent Routing


📖 Overview

The Montfort ICSE AI Chatbot is a deeply integrated school assistant that goes beyond simple text answers. It serves as a central guide, capable of:

  1. Answering Queries: Using RAG (Retrieval-Augmented Generation) to find accurate answers from the school's knowledge base.
  2. Navigating the Campus: Intelligently detecting commands like "Show me the library" to take users directly into a 3D Virtual Tour.
  3. Self-Correction: Automatically fixing typos (e.g., "fee stracture") before processing queries to ensure high accuracy.

⚙️ How It Works (The Flow)

graph TD
    %% Nodes
    User(("👤 User"))
    FE["💻 Frontend (Chatbot.js)"]
    Backend["🚀 Node.js Backend"]
    
    subgraph Intelligence Layer
        Router{"🚦 Intent Router"}
        SpellCheck["✨ AI Grammar Fix"]
        VectorDB[("🗄️ Supabase Vector DB")]
    end
    
    subgraph Outcomes
        Nav["🧭 Open 3D Panorama"]
        Answer["💬 Text Response"]
    end

    %% Flow
    User -->|Type: 'Go to Library'| FE
    FE -->|POST /api/chat| Backend
    Backend --> Router
    
    %% Branch 1: Navigation
    Router -- "Navigation Detected" --> Nav
    Nav -.->|JSON Command| FE
    FE -.->|Open Vista Tour| User
    
    %% Branch 2: Q&A
    Router -- "Info Query" --> SpellCheck
    SpellCheck -->|Normalized Text| VectorDB
    VectorDB -->|Semantic Search| Answer
    Answer -.->|JSON Response| FE
    FE -.->|Display Text| User
Loading

🧠 Core Components

  1. Frontend (/frontend):

    • Built with Vanilla JS for maximum speed.
    • vista.js: Manages the 3D 360° environment.
    • chat.js: Handles user input and displays responses.
  2. Backend (/backend):

    • server.js: Express server running on Port 3000.
    • aiIntentRouter.js: The traffic cop. It decides if a user wants to Chat or Travel.
    • chatController.js: The main brain. It orchestrates the spell-check -> search -> respond workflow.
    • aiService.js: Wraps Google Gemini for checking grammar and generating embeddings (text-embedding-004).
  3. Database (Supabase):

    • Stores Questions & Answers.
    • Uses pgvector to perform "Semantic Search" (matching meaning, not just keywords).

✨ Key Features

1. 🧭 Zero-Click 3D Navigation

The bot is aware of the virtual tour active in the background.

  • User: "Take me to the auditorium"
  • Bot: Detects destination -> commands 3D Player to rotate/load the specific scene instantly.

2. 🛡️ RAG (Retrieval-Augmented Generation)

We don't let the AI "hallucinate" answers.

  • Process: User query -> Vector Search in trusted School Database -> Return the exact matched answer.
  • Safety: If the school hasn't published an answer, the bot politely says "I don't know," preventing misinformation.

3. ✍️ AI Spell-Fixer

  • Input: "wht is fee for 11th std??"
  • AI Fix: "What is the fee for 11th standard?"
  • Result: High-accuracy database retrieval even with broken English.

🚀 Installation & Setup

Prerequisites

  • Node.js (v18+)
  • Supabase Account (URL & Public Key)
  • Google Gemini API Key

1. Clone & Install

git clone <repo-url>
cd backend
npm install

2. Configure Environment

Create a .env file in the backend/ folder:

PORT=3000
# Database Connection
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key

# Intelligence
GEMINI_API_KEY=your_gemini_key
GEMINI_MODEL=gemini-pro

3. Start the Server

# In the backend terminal
npm run dev

4. Optimize Frontend

Ensure frontend/js/config.js matches your backend port:

window.ChatbotConfig = {
    API_BASE_URL: "http://localhost:3000"
};

📂 Project Structure

Chatbot/
├── 📂 admin/           # Admin Dashboard (Manage Content)
├── 📂 backend/         # Node.js Server
│   ├── 📂 controllers/ # Logic (Chat, Router)
│   ├── 📂 services/    # Integrations (AI, Supabase)
│   └── server.js       # Entry Point
├── 📂 frontend/        # Client-Side Code
│   ├── 📂 js/          # Logic (Vista, Chat, UI)
│   └── 📂 css/         # Styling
└── README.md           # This file

🔌 API Documentation

POST /api/chat

The main endpoint for all interactions.

Request Body:

{
  "question": "show me the library",
  "panoNames": ["Library", "Office", "Ground"],  // Available 3D Scenes
  "projectNames": []
}

Response (Navigation):

{
  "success": true,
  "intent": "pano",
  "target": "Library",
  "action": "pano"
}

Response (Text Answer):

{
  "answer": "The library is open from 8 AM to 4 PM.",
  "confidence": 0.92,
  "normalizedQuestion": "show me the library"
}

Built with ❤️ for Montfort ICSE

About

Gemini-powered, zero-hallucination AI chatbot for Montfort ICSE — semantic search, IUI Engine v2.5, verified school data, and hybrid RAG architecture.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •