A comprehensive PDF study platform with AI-powered question answering using Cohere embeddings and Google Gemini for image analysis.
- AI-Powered Q&A: Ask questions about PDF documents and get intelligent answers
- Multi-Image Analysis: Analyzes multiple relevant pages for comprehensive answers
- Thai Language Support: Optimized for Thai educational content with TA Tohtoh personality
- Modern UI: Responsive design with dark theme
- Real-time Chat: Interactive chat interface for document queries
- Node.js with Express
- Cohere AI for embeddings
- Google Gemini for image analysis
- CORS enabled for frontend communication
- Vanilla HTML, CSS, JavaScript
- Responsive design
- Real-time chat interface
cd backend
npm installCreate a .env file in the backend directory:
cp env.example .envEdit .env and add your API keys:
CO_API_KEY=your_cohere_api_key_here
GEMINI_API_KEY=your_gemini_api_key_here
# Start the backend server
cd backend
npm start
# The application will be available at http://localhost:3000POST /search-and-answer- Main endpoint for asking questionsPOST /search- Search for relevant imagesPOST /answer- Answer questions about specific imagesGET /- Serves the frontend
- Open your browser and go to
http://localhost:3000 - Ask questions about the PDF documents in Thai or English
- The AI will analyze relevant pages and provide comprehensive answers
├── backend/
│ ├── api.js # Main server file
│ ├── package.json # Backend dependencies
│ ├── pdf_images/ # Processed PDF images
│ ├── pdf_image_embeddings.json # Pre-computed embeddings
│ └── processed_image_paths.txt # Image paths mapping
├── frontend/
│ ├── index.html # Main frontend file
│ └── styles.css # Styling
└── README.md # This file
The platform is designed to work with pre-processed PDF images and embeddings. The backend loads these on startup and uses them for semantic search and question answering.
This project is part of a CEDT Final Project.