How open-tutorai/open-tutor-ai-ce works
Project Type and Purpose
• This is a full-stack, educational AI platform (Open TutorAI-CE).
• Frontend: SvelteKit/PWA for web and mobile.
• Backend: Python-based API (FastAPI style routers) serving authentication, chat, RAG, media, admin functions.
• Integrations: Ollama & OpenAI-compatible LLM services, RAG, image generation, voice/video, web search.
Main Components
a. End User & UI Layer
• Students, teachers, admins access via browser or installed PWA.
• UI built in SvelteKit (static assets served by Vite, Caddy or CDN).
b. Frontend Server
• SvelteKit SSR and API proxy.
• Service Worker for offline PWA mode.
c. Backend API Service
• Python application with separated routers (auth, chats, supports, feedback, admin).
• Business logic for RAG (file ingestion, vector store), avatar, voice/video signaling.
d. Data Layer
• Relational database (e.g., PostgreSQL) accessed via SQLAlchemy (backend/models/database.py).
• File storage (attachments, classroom documents) on disk or object store.
• Vector database or in-process vector index for retrieval.
e. Background Workers (optional)
• Pyodide, KokoroWorker, image generation pipelines for heavy tasks.
f. External Services
• Ollama local model server (Docker container).
• OpenAI-compatible endpoints (Mistral, LMStudio, etc.).
• Web search providers (Google PSE, DuckDuckGo) for RAG.
• Image generation APIs (AUTOMATIC1111, DALL-E).
g. Infrastructure & Deployment
• Docker Compose or Kubernetes (Helm charts).
• Reverse proxy (Caddyfile) and environment config.
Relationships & Data Flows
• Users ↔ Browser/PWA UI (HTTP/WebSocket)
• UI → Frontend Server (SSR requests, static asset fetch)
• UI → Backend API (REST over HTTPS)
• Backend API ↔ Database (CRUD, sessions, RBAC)
• Backend API ↔ File Storage / Vector Store (RAG retrieval)
• Backend API ↔ External LLM Services (Ollama, OpenAI)
• Backend API ↔ Web Search / Image‐Gen APIs
• Backend API → Background Workers (via message queue or direct spawn)
• Optionally: UI ↔ Backend for WebRTC signaling (voice/video)
Architectural Patterns & Design Principles
• Separation of concerns: UI vs. API vs. data vs. workers.
• Modular routers in backend (FastAPI “routers” for each domain).
• PWA offline-first via service worker.
• Role-based access control (RBAC) enforced in API layer.
• RAG pattern: ingestion → vector indexing → retrieval during chat.