{"id":29244278,"url":"https://github.com/donpotts/localragchat","last_synced_at":"2026-05-01T08:31:04.894Z","repository":{"id":302348081,"uuid":"1012110553","full_name":"donpotts/LocalRAGChat","owner":"donpotts","description":"Local RAG (Retrieval-Augmented Generation) Chat using Semantic Kernel and Ollama","archived":false,"fork":false,"pushed_at":"2025-08-29T21:46:33.000Z","size":1667,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-29T23:32:16.608Z","etag":null,"topics":["ai","asp-net-core","blazor-webassembly","ef-core","ollama","rag","rag-chatbot","semantic-kernel","sqlite"],"latest_commit_sha":null,"homepage":"","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/donpotts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-01T20:37:54.000Z","updated_at":"2025-08-29T21:46:36.000Z","dependencies_parsed_at":"2025-07-01T22:42:01.631Z","dependency_job_id":null,"html_url":"https://github.com/donpotts/LocalRAGChat","commit_stats":null,"previous_names":["donpotts/localragchat"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/donpotts/LocalRAGChat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donpotts%2FLocalRAGChat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donpotts%2FLocalRAGChat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donpotts%2FLocalRAGChat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donpotts%2FLocalRAGChat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/donpotts","download_url":"https://codeload.github.com/donpotts/LocalRAGChat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donpotts%2FLocalRAGChat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32490810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","asp-net-core","blazor-webassembly","ef-core","ollama","rag","rag-chatbot","semantic-kernel","sqlite"],"created_at":"2025-07-03T21:42:45.384Z","updated_at":"2026-05-01T08:31:04.888Z","avatar_url":"https://github.com/donpotts.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Local RAG Chat with C# Semantic Kernel and Ollama\n\n**Local RAG Chat** is a fully self-contained, offline-first RAG (Retrieval-Augmented Generation) application that lets you chat with your PDF and text documents locally. No data ever leaves your machine.\n\nIt features a clean, modern Blazor WASM frontend styled with Tailwind CSS and a robust ASP.NET Core backend powered by Microsoft Semantic Kernel. All AI processing for embeddings and chat is handled by a local [Ollama](https://ollama.com) instance, ensuring 100% privacy and control.\n\n\n![Local RAG Chat Logo](./LocalRAGChat.Client/Assets/LocalRAGChat.png)\n\n## ✨ Core Features\n\n*   **100% Local \u0026 Offline**: Your documents and conversations never touch the internet.\n*   **Ingest PDF \u0026 TXT Files**: Upload your documents through the web UI for processing.\n*   **Retrieval-Augmented Generation (RAG)**: The app finds the most relevant parts of your document to provide accurate, context-aware answers.\n*   **Modern Web UI**: A responsive and intuitive chat interface built with Blazor WASM and Tailwind CSS.\n*   **Powered by Ollama**: Leverages local LLMs for both generating vector embeddings and chat completions.\n*   **Dynamic Model Selection**: Easily switch between multiple local chat models (e.g., Llama 3, Mistral, Phi-3) directly from the UI.\n*   **Persistent Storage**: Uses EF Core and a local SQLite database to store document metadata and text chunks.\n\n## 🏛️ Architecture\n\nThe project is architected with a clean separation between the frontend client and the backend API, enabling scalability and maintainability.\n\n```mermaid\ngraph TD\n    subgraph Your Computer\n        subgraph \"Browser\"\n            A[User] \u003c--\u003e B[Blazor WASM Client];\n        end\n\n        subgraph \"Backend\"\n            C[ASP.NET Core API];\n            D[SQLite Database];\n            E[Ollama];\n        end\n    end\n\n    B -- HTTP API Requests --\u003e C;\n    C -- Ingest/Store/Retrieve --\u003e D[localrag.db];\n    C -- Generate Embeddings \u0026 Chat Completions --\u003e E[\"Ollama (nomic-embed-text, llama3, etc.)\"];\n```\n\n## 🛠️ Technology Stack\n\n| Area | Technology | Purpose |\n| :--- | :--- | :--- |\n| **Frontend** | Blazor WebAssembly | Rich, interactive C#-based web UI. |\n| | Tailwind CSS | Utility-first CSS framework for rapid UI development. |\n| **Backend** | ASP.NET Core 9 Web API | High-performance API for handling business logic. |\n| | C# 12 | Modern, powerful language for the entire stack. |\n| **AI/Orchestration** | Semantic Kernel | Microsoft's SDK for orchestrating AI plugins and memory. |\n| | Ollama | Runs open-source LLMs locally for embeddings and chat. |\n| **Database** | Entity Framework Core 9 | ORM for interacting with the database. |\n| | SQLite | Lightweight, serverless, file-based database for local storage. |\n| **Data Parsing**| PdfPig | Extracts text from PDF documents. |\n| | CsvHelper | Parses CSV files for initial database seeding. |\n\n\n## ✅ Prerequisites\n\nBefore you begin, ensure you have the following installed:\n\n1.  **.NET 9 SDK**: [Download here](https://dotnet.microsoft.com/download/dotnet/9.0)\n2.  **Node.js and npm**: [Download here](https://nodejs.org/) (Required for Tailwind CSS)\n3.  **Ollama**: [Install from ollama.com](https://ollama.com)\n\nAfter installing Ollama, pull the necessary models from your terminal:\n\n```bash\n# A model for generating embeddings\nollama pull nomic-embed-text\n\n# A few chat models for the selector\nollama pull phi3\nollama pull mistral\nollama pull llama3:8b\n```\n\n## ⚙️ Setup and Running Instructions\n\nFollow these steps to get the application running locally.\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/donpotts/LocalRAGChat.git\ncd LocalRAGChat\n```\n\n### 2. Start Ollama\n\nEnsure the Ollama desktop application is running on your machine.\n\n### 3. Run the Backend Server (`LocalRAGChat.Server`)\n\nThe backend must be running before you start the frontend.\n\n```bash\n# Navigate to the server project directory\ncd LocalRAGChat.Server\n\n# Restore dependencies\ndotnet restore\n\n# Apply database migrations. This creates and seeds the localragchat.db file.\ndotnet ef database update\n\n# Run the server\ndotnet run\n```\nThe API will now be running, typically at `https://localhost:7216`.\n\n### 4. Run the Frontend Client (`LocalRAGChat.Client`)\n\nOpen a **new terminal window** for this step.\n\n```bash\n# Navigate to the client project directory\ncd LocalRAGChat.Client\n\n# Install Node.js dependencies for Tailwind CSS\nnpm install\n\n# Run the Tailwind CSS compiler in watch mode\n# This will automatically rebuild your CSS as you make changes\nnpm run build:css\n\n# Keep the Tailwind process running. In another terminal, run the Blazor app:\ndotnet run\n```\nYour default browser should open to the application, typically at `https://localhost:7054`.\n\n## 📖 How to Use\n\n1.  **Launch the App**: Once the client and server are running, the web UI will load.\n2.  **Select a Document**: The sidebar will be pre-populated with documents from the seed data. Click one to start a chat session.\n3.  **Select a Model**: Use the dropdown menu in the sidebar to choose which Ollama model you want to chat with.\n4.  **Ask a Question**: Type your question about the selected document in the input box and press Enter. The AI will respond with information retrieved from the document.\n5.  **Upload New Documents**: Use the \"Upload\" button to ingest new PDF or TXT files. They will appear in the document list, ready for you to chat with.\n\n## 📂 Project Structure\n\nThe solution is organized into three distinct projects for a clean separation of concerns:\n\n```\n/\n├── LocalRAGChat.Client/     # The Blazor WASM frontend project and all UI components.\n├── LocalRAGChat.Server/     # The ASP.NET Core Web API, services, data models, and database logic.\n└── LocalRAGChat.Shared/     # A class library for DTOs shared between the client and server.\n```\n\n---\n\n**NOTE: This project is designed to run entirely on your local machine. The AI Models require a fast and powerful computer for quick responses. It does not require any cloud services or external APIs, ensuring complete data privacy and control.**\n\n## 📞 Contact\n\nFor any questions, feedback, or inquiries, please feel free to reach out.\n\n**Don Potts** - [Don.Potts@DonPotts.com](mailto:Don.Potts@DonPotts.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonpotts%2Flocalragchat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdonpotts%2Flocalragchat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonpotts%2Flocalragchat/lists"}