How ad-tech1009/sia-chatbot works
Project type and purpose
• From the file tree and README, Sia is a full-stack web application:
• Frontend: React (Vite + Tailwind) for an emotion-aware chat UI
• Backend: Python FastAPI serving an LLM-powered chatbot with RAG
• Vector Database: ChromaDB for retrieval-augmented generation
• LLM Engine: Ollama running Mistral
File structure
• Top level:
• LLM_backend/ – Python FastAPI service
– app.py & server.py (entry points)
– config/ (app settings, model parameters)
– routes/ (FastAPI route handlers: mood, sia_t1, test)
– prompts/ (LLM prompt templates)
– data/ (static text files like chapter_2.txt)
– requirements.txt
• Sia_frontend/ – React UI built with Vite
– src/ (App.jsx, components/, pages/)
– public/, index.html, package.json, vite.config.js
• Patterns:
• Clear frontend/backend separation
• Modular routing on backend
• RAG pattern with prompts + vector DB
README for additional insights
• Features highlight: emotion-aware visuals, context retrieval from sacred texts, LLM offline via Ollama
• Tech stack calls out React, Tailwind, FastAPI, LangChain, ChromaDB, Ollama
Main components & their interactions
a. User’s Browser (React UI)
– ChatInput, ChatWindow, MoodWave components
– Sends user messages to Backend via HTTP (e.g., POST /chat)
– Receives response + emotion metadata
– Renders text + updates animated wave thread
b. Backend (FastAPI)
– API Layer (routes/*.py)
– Prompt Engine (prompts/*.py + LangChain wrappers)
– Vector Retrieval (ChromaDB interface)
– LLM Inference (Ollama Mistral via Python client)
– Configuration (config/app.py, config/models.py)
c. Data Store
– ChromaDB vector store loaded with Bhagavad Gita corpus (data/chapter_2.txt, etc.)
d. External Services
– Ollama daemon running Mistral model
e. (Optionally) Notebook for experimentation (simpletrag.ipynb)
Architectural patterns & design principles
• Layered architecture: Presentation (React), API (FastAPI), Domain (prompt + retrieval), Infrastructure (ChromaDB, Ollama)
• RAG pattern: combine vector retrieval with generative LLM
• Separation of concerns: config, routes, prompts, data modularization