How munazz-a/edutube---study-assistant works
Purpose and Entry Points
EduTube is a study assistant that answers questions over educational-video transcripts through retrieval-augmented generation (RAG). It has three deployable layers:
• Browser UI: Frontend/home.html, Frontend/summary.html
• Node.js API-facing server: Backend/Server.js
• Python/FastAPI AI service: AI-Services/chatbot/app.py
Frontend Interaction Layer
The static frontend provides the user flow for entering a video/transcript-related request and viewing summaries or question-answer results. Client behavior is implemented separately for each page:
• Frontend/home.js
• Frontend/summary.js
• Frontend/home.html
This layer should treat the Node server as its application boundary; it should not directly own embedding, retrieval, or model-provider concerns.
Node.js Request Gateway
Backend/Server.js is the JavaScript server entry point, with its runtime dependencies defined in Backend/package.json. Per the stated design, it handles API requests and bridges browser traffic to the AI-processing service.
This is the likely cross-runtime boundary: JavaScript/Express manages HTTP-facing application routing, while Python owns RAG computation. Any API contract changes must be coordinated across Frontend/*.js, Backend/Server.js, and FastAPI routes.
FastAPI AI Service
AI-Services/chatbot/app.py is the Python service entry point and HTTP boundary for AI operations. It composes the chatbot/RAG modules:
• AI-Services/chatbot/chatbot.py
• AI-Services/chatbot/rag.py
• AI-Services/chatbot/requirements.txt
FastAPI enables concurrent service requests; the application should avoid mutable per-request retrieval/chat state leaking across users.
RAG Retrieval Pipeline
The core answer path is organized around transcript chunk retrieval:
1. Transcript content is split into chunks.
2. Chunks are encoded into vector embeddings.
3. FAISS indexes the vectors for semantic nearest-neighbor lookup.
4. A user question is embedded and matched against relevant transcript chunks.
5. Retrieved context is passed to answer generation.
The embedding and retrieval responsibilities are grounded in:
• AI-Services/chatbot/embeddings.py
• AI-Services/chatbot/rag.py
• AI-Services/chatbot/chatbot.py
Model and External-Service Boundary
Semantic embeddings use the Sentence Transformers all-MiniLM-L6-v2 model; vector search uses FAISS; final natural-language generation uses the OpenAI API. The OpenAI key is supplied through OPENAI_API_KEY, making OpenAI an external dependency and a security boundary.
Python dependencies and model libraries belong to AI-Services/chatbot/requirements.txt; Node runtime dependencies belong to Backend/package.json. The repository root package.json may support root-level JavaScript orchestration, but the server-specific runtime is under Backend/.
End-to-End Control Flow
A browser action from Frontend/home.js or Frontend/summary.js reaches the Node server in Backend/Server.js. That server forwards or coordinates the request with FastAPI in AI-Services/chatbot/app.py. FastAPI invokes embedding/retrieval modules, obtains FAISS-selected transcript context, calls OpenAI for a grounded answer, and returns the result back through Node to the frontend. The key quality boundary is retrieval context: generation accuracy depends on correctly chunked and indexed transcript material rather than on frontend or gateway logic.
Main entry points: Server.js Node API server · app.py FastAPI service · chatbot.py Answer orchestration · rag.py Transcript retrieval
Components 13
Browser UI
- Home page
Frontend/home.html - Summary page
Frontend/summary.html - Home client
Frontend/home.js - Summary client
Frontend/summary.js
Application Gateway
- Node API server · Routes browser API requests to the Python service.
Backend/Server.js - Node dependencies
Backend/package.json
AI Service
- FastAPI service · Owns concurrent AI request handling.
AI-Services/chatbot/app.py - Answer orchestration · Builds grounded prompts and produces answers.
AI-Services/chatbot/chatbot.py - Python dependencies
AI-Services/chatbot/requirements.txt
RAG Pipeline
- Transcript retrieval · Chunks transcripts and retrieves relevant context.
AI-Services/chatbot/rag.py - Embedding encoder · Uses all-MiniLM-L6-v2 for transcript and question vectors.
AI-Services/chatbot/embeddings.py - FAISS index · Finds nearest transcript chunks.
Other components
- OpenAI API · Generation is authenticated with OPENAI_API_KEY.
Connections 18
- Home page → Home client: loads
- Summary page → Summary client: loads
- Home client → Node API server: API request
- Summary client → Node API server: API request
- Node dependencies → Node API server: provides runtime
- Node API server → FastAPI service: forwards AI request
- FastAPI service → Answer orchestration: invokes
- Python dependencies → FastAPI service: provides runtime
- Answer orchestration → Transcript retrieval: requests context
- Transcript retrieval → Embedding encoder: encodes chunks and question
- Embedding encoder → FAISS index: indexes and queries vectors
- FAISS index → Transcript retrieval: relevant chunks
- Transcript retrieval → Answer orchestration: retrieved context
- Answer orchestration → OpenAI API: grounded generation
- OpenAI API → FastAPI service: answer result
- FastAPI service → Node API server: AI response
- Node API server → Home client: result
- Node API server → Summary client: result