How pruthakjani5/gtutor works
Project Type & Purpose
• GTUtor is a full-stack web application (though monolithic in nature) with a heavy emphasis on document-based knowledge integration.
• Its purpose is to handle multi-subject tutoring by processing documents (PDFs), managing subjects’ knowledge, and providing context-aware chat responses which sometimes fallback on external AI (Google Gemini Pro).
Main Components
a. Frontend / User Interface:
• Represented by the Streamlit interface. This includes the chat interface, subject selection dropdown, and file upload features.
b. Application Logic / Backend:
• The main application logic is contained in app.py, coordinating requests and responses between different modules.
c. Document Processing Module:
• Uses libraries like pypdf for text extraction and automatic chunking from PDF files.
d. Knowledge Base / Vector Database:
• Built on ChromaDB, this module stores the processed document data across multiple subjects (organized in gtutor_data/dbs). Show the separate directories for each subject (e.g., asd, dcn).
e. AI Integration Component:
• Integration with Google Gemini Pro API for generating intelligent, context-aware responses.
f. Persistence Layer:
• Manages persistent storage such as chat histories (gtutor_data/chat_histories) and subject configurations (gtutor_data/subjects.json). This can be depicted as a file-based storage subsystem.
g. Environment & Configuration:
• The .env file holding the API keys and any configuration (also mention the .devcontainer for development deployment environment).
Relationships & Data Flows
• Users interact with the UI (Streamlit) to select subjects, upload documents, and enter chat messages.
• The UI passes uploaded PDF documents to the Document Processing Module, which extracts and chunks text.
• Processed information is stored in the Vector Database for fast look-up and context retrieval.
• When a chat message is sent, the system first tries to fetch relevant context from the vector DB; if needed, the query is forwarded to the AI Integration component via the Gemini Pro API.
• The resulting responses flow back through the application logic to the UI, where chat histories are recorded in persistent storage.
• Configuration settings (from the .env file) determine access to external services like the Gemini API.
• Additionally, subject management and chat history management are maintained in separate JSON (or file) storage under gtutor_data.
Architectural Patterns and Design Principles
• The system follows a loosely layered architecture where the UI, business logic, and persistence layers are clearly separated.
• It relies on modular design – for example, separating document processing, AI integration, and data storage helps in scaling or modifying individual components as needed.
• The data flow embodies a request-response model with persistent logging (via JSON files) to maintain state and history.