WP Manifestindependent plugin directory
manifest / ai / wp-rag-ollama

WP RAG Ollama

RAG implementation with WordPress/WooCommerce

by Antigravity AI · github.com/ajaychandani003/wp-rag-ollama · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/ajaychandani003/wp-rag-ollama/archive/refs/heads/main.zip

Readme

WP RAG Ollama

Implement a locally hosted Retrieval-Augmented Generation (RAG) chatbot assistant directly in WordPress using Ollama.

This plugin allows you to vectorize your WordPress pages, posts, manual guides, or imported .txt files into a local vector database. When users chat with the AI assistant, the plugin retrieves the most relevant context chunks using cosine similarity calculations in PHP, constructs a RAG prompt, and calls your local Ollama LLM to synthesize a precise, context-aware answer.

No cloud API keys, no monthly fees, and 100% data privacy.


Key Features

  • Local Vector Database: Stores vectorized embeddings in a custom SQL table wp_rag_knowledge.
  • Cosine Similarity in PHP: Retrieves top matching chunks directly in PHP without needing a third-party vector DB service.
  • WordPress Syncing: Index and vectorize your existing pages and posts in bulk.
  • Ingestion Tools: Paste manual policies/FAQs or upload plain-text .txt files.
  • Admin Dashboard:
    • Configuration: Change Ollama endpoint, customize LLM and embedding models, adjust chunk sizes, retrieval limits, and the system prompt instructions.
    • Knowledge Base Manager: Search, paginate, or delete single vector chunks.
    • WP Content Sync Console: Real-time logging of vectorization progress.
    • Chat Playground: Test queries and examine exactly which context chunks are pulled.
  • Public Chat Widget:
    • Floating interactive chat bubble at the bottom right.
    • Sleek, modern glassmorphic design.
    • Custom greeting and suggestion buttons.
  • Inline Mode: Embed the chatbox directly inside any page layout using the [wp_rag_chat] shortcode.

Prerequisites

  1. Ollama Installed: Ensure Ollama is running on the local server or accessible over the network (usually at http://localhost:11434).
  2. Download Models: Pull the default models in your command prompt:
    ollama pull nomic-embed-text
    ollama pull llama3

Installation

  1. Clone or download this repository into your WordPress plugins folder:
    cd wp-content/plugins
    git clone https://github.com/ajaychandani003/wp-rag-ollama.git
  2. Go to the WordPress Admin Dashboard -> Plugins and activate WP RAG Ollama.
  3. Open the RAG Ollama settings page in the WordPress sidebar to test the connection and configure your settings.

Shortcode Usage

To display the chat assistant embedded directly in the content of a page or post (rather than a floating bubble), disable the global chat option in settings and add this shortcode:

[wp_rag_chat]

File Structure

wp-rag-ollama/
├── admin/
│   ├── css/
│   │   └── wp-rag-ollama-admin.css        # Admin panel styling
│   ├── js/
│   │   └── wp-rag-ollama-admin.js         # Tab switches, AJAX sync handlers, & connection test
│   └── partials/
│       └── wp-rag-ollama-admin-display.php# Admin panel HTML template
├── includes/
│   ├── class-wp-rag-ollama-admin.php     # Document chunking & ingestion controller
│   ├── class-wp-rag-ollama-api.php       # REST API endpoints & Ollama client
│   └── class-wp-rag-ollama-db.php        # DB table schema & Cosine Similarity search logic
├── public/
│   ├── css/
│   │   └── wp-rag-ollama-public.css       # Chat widget layout & glassmorphic design
│   ├── js/
│   │   └── wp-rag-ollama-public.js        # Chat interface interactions & REST API client
│   └── partials/
│       └── wp-rag-ollama-public-display.php# Chat widget template (supports inline & floating)
└── wp-rag-ollama.php                      # Main plugin initialization & loader

License

GPLv2 or later.

Read the full README on GitHub →