Skip to content

tanmaykumarchaki/NoteBot-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NoteBot.AI

An AI-powered study assistant that ingests documents, generates flashcards, answers questions, and helps you study smarter — all from a clean web interface.


Features

  • Document Upload — PDF, DOCX, TXT, images (OCR), audio/video (Gemini transcription), URLs
  • AI Chat — Ask questions about your uploaded documents, get cited answers
  • Flashcards — Auto-generated, flippable, exportable as JSON or CSV
  • Study Tools — Study guide, briefing doc, FAQ, timeline, practice questions with answer checking
  • Important Points — Extracted key points with Wikipedia verification
  • Calendar — Weekly planner with conflict detection and weekend summaries
  • Web Mode — Summarise any URL and browse your web history

Tech Stack

Layer Technology
Backend FastAPI + SQLAlchemy (SQLite)
AI Engine Google Gemini 2.5 Flash
Parser pypdf, python-docx, Pillow, pytesseract, Gemini vision
Frontend Vanilla HTML/CSS/JS (dark theme SPA)
Testing pytest + Hypothesis (property-based)

Project Structure

NoteBot-AI/
├── app/
│   ├── db/
│   │   ├── database.py       # SQLAlchemy engine + session
│   │   └── init_db.py        # Table creation on startup
│   ├── models/
│   │   └── models.py         # ORM models (7 tables)
│   ├── routers/
│   │   ├── upload.py         # POST /api/upload/file|url
│   │   ├── chat.py           # POST /api/chat/query
│   │   ├── flashcards.py     # GET/POST /api/flashcards/
│   │   ├── important_points.py
│   │   ├── study_tools.py    # study guide, FAQ, timeline, Q&A
│   │   ├── calendar.py       # weekly planner
│   │   └── web_mode.py       # URL summariser
│   ├── services/
│   │   ├── parser.py         # multi-format document parser
│   │   └── ai_engine.py      # Gemini AI wrapper
│   └── main.py               # FastAPI app + error handlers
├── frontend/
│   ├── index.html
│   ├── style.css
│   └── app.js
├── tests/
│   ├── test_db_properties.py
│   └── test_parser_properties.py
├── .env
├── .gitignore
└── requirements.txt

Setup

1. Clone and create virtual environment

git clone <repo-url>
cd NoteBot-AI
python -m venv venv
venv\Scripts\activate        # Windows
# source venv/bin/activate   # Mac/Linux

2. Install dependencies

pip install fastapi uvicorn sqlalchemy pypdf python-docx Pillow pytesseract \
            hypothesis pytest python-multipart pydantic google-genai python-dotenv

3. Get a free Gemini API key

  1. Go to aistudio.google.com/apikey
  2. Sign in with any Google account
  3. Click Create API key in new project
  4. Copy the key

4. Configure environment

Create a .env file in the project root:

GEMINI_API_KEY=your_key_here

5. Run the server

venv\Scripts\uvicorn.exe app.main:app --reload

Open http://localhost:8000 in your browser.


API Reference

The full interactive API docs are available at http://localhost:8000/docs.

Method Endpoint Description
POST /api/upload/file Upload a file
POST /api/upload/url Ingest a URL or YouTube link
GET /api/upload/documents List all documents
DELETE /api/upload/documents/{id} Delete a document
POST /api/chat/query Ask a question
GET /api/chat/history Chat history
GET /api/flashcards/{doc_id} Get/generate flashcards
POST /api/flashcards/{doc_id}/regenerate Regenerate flashcards
GET /api/flashcards/{doc_id}/export Export JSON or CSV
POST /api/study/study-guide Generate study guide
POST /api/study/faq Generate FAQ
POST /api/study/timeline Extract timeline
POST /api/study/questions Generate practice questions
POST /api/study/answer-check Evaluate an answer
GET /api/calendar/week Get week entries
POST /api/calendar/entry Add calendar entry
POST /api/web/summarise Summarise a URL
GET /api/web/history Web browsing history
DELETE /api/web/history Clear web history

Running Tests

venv\Scripts\pytest.exe tests/ -v

3 property-based tests using Hypothesis:

  • Document metadata round trip (100 examples)
  • Parser TXT round trip (25 examples)
  • Unsupported format error (25 examples)

Supported File Formats

Format Method
.txt stdlib
.pdf pypdf
.docx python-docx
.png .jpg .jpeg .webp .bmp .tiff pytesseract OCR + Gemini vision fallback
.mp3 .wav .mp4 Gemini Files API transcription
URLs httpx + BeautifulSoup
YouTube youtube-transcript-api

Note: pytesseract requires the Tesseract binary installed on your system.


Notes

  • The Gemini free tier allows ~20 requests/day on gemini-2.5-flash. Quota resets daily at midnight Pacific time.
  • Never commit your .env file — it's in .gitignore.
  • Switch DATABASE_URL env var to a PostgreSQL connection string for production.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors