=======
4fc6336e3550c3506cc661364d3fc18e361c6db9
A full-stack AI-powered chatbot built using MERN Stack + LangChain + Ollama + FAISS. This project runs completely locally without relying on paid APIs like OpenAI/Gemini. It can understand user questions and retrieve answers from your custom documents using local LLMs.
- ✅ Full MERN Stack app (React + Express + MongoDB)
- ✅ AI-powered chat with local LLMs using Ollama
- ✅ RAG: Retrieve answers from your uploaded documents
- ✅ Embeddings using
nomic-embed-text - ✅ Local vector store with FAISS for fast document similarity search
- ✅ Clerk authentication (for demo purpose)
- Node.js + Express
- LangChain (for embedding + retrieval)
- FAISS (vector DB)
- Ollama (runs local models like Mistral)
- nomic-embed-text (for document embeddings)
- React.js
- Tailwind CSS
Ollama is a tool to run AI models locally on your system. It supports models like Mistral, LLaMA, Phi-2, etc.
Mistral is a small but powerful open-source LLM. It's used to generate responses in the chat.
This service reads the uploaded documents and converts them into vector form using nomic-embed-text, so the model can understand and search through them.
FAISS is used to store and search document vectors locally. It's fast and reliable for similarity search.
Instead of answering from memory, the LLM retrieves relevant documents first, then uses them to generate accurate answers.
text START │ ├── User selects mode: │ ├── General Mode ➔ Normal chat │ └── Regulations Mode ➔ Show document list │ ├── User can: │ ├── Upload image (General Mode) │ ├── Select documents (Regulations Mode) │ └── Type question │ ├── When user sends message: │ ├── If General Mode: │ │ └── Send to general chat API │ ├── If Regulations Mode: │ │ └── Send to regulations API with selected docs │ ├── Show loading spinner │ ├── Get response from API │ └── Display answer with sources (if any)
📦 chatgpt-clone
├── frontend
│ ├── src
│ │ ├── lib
│ │ │ └── Ollama.js <-- Handles frontend requests to backend
│ │ └── ...
│ └── ...
├── backend
│ ├── embeddingService.js <-- Embeds and stores documents in FAISS
│ ├── index.js <-- Main Express server
│ ├── routes
│ ├──
│ └── ...
Download and install Ollama: https://ollama.com/download
Then run your models:
ollama run mistral
ollama run nomic-embed-text//backend is in backend folder
cd backend
npm install
# Set environment variables (optional for FAISS)
node embeddingService.js # This will embed your docs and create FAISS index
npm start # Start the backend server//frontend is just inside the folder
npm install
npm run dev- You upload documents → Backend embeds them using nomic-embed-text.
- Embeddings are stored in FAISS vector database.
- When you ask a question → It converts your query into vector form.
- Finds the most relevant docs from FAISS.
- Sends docs to Mistral model via Ollama.
- Mistral responds using both your query and the context from docs.
In my newprompt.js type base search is happening which when click to general chat gives general question answer and when you click to regulation mode the it shows two text_v1 and text_v2 button when you clock them it will give you only related info to them
This project is open-source and free to use for learning and research.
2a675aa7c3baf99282c37a1413d6beb39923e8c9
