Skip to content

A 𝐩𝐫𝐒𝐯𝐚𝐜𝐲-𝐟𝐒𝐫𝐬𝐭 𝐑𝐀𝐆 π€πˆ 𝐚𝐬𝐬𝐒𝐬𝐭𝐚𝐧𝐭 𝐟𝐨𝐫 π–π¨π«πππ«πžπ¬π¬

License

Notifications You must be signed in to change notification settings

AbmSourav/ai-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Assistant

A 𝐩𝐫𝐒𝐯𝐚𝐜𝐲-𝐟𝐒𝐫𝐬𝐭 𝐑𝐀𝐆 π€πˆ 𝐚𝐬𝐬𝐒𝐬𝐭𝐚𝐧𝐭 𝐟𝐨𝐫 π–π¨π«πππ«πžπ¬π¬.
The RAG application runs with a 𝐩𝐫𝐒𝐯𝐚𝐭𝐞π₯𝐲 𝐑𝐨𝐬𝐭𝐞𝐝 π‹π‹πŒ, ensuring your data never leaves your infrastructure - no third-party AI APIs, no external data sharing.

🧠 Dynamic data indexing β€” create, update, or delete your AI knowledge base directly from the WordPress admin panel
πŸ“š RAG-powered, only context-aware answers
πŸ” Full data ownership & protection
🧩 Native WordPress UI


Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          User Interface                              β”‚
β”‚                     (WordPress Admin Panel)                          β”‚
β”‚                         http://localhost:8000                        β”‚
β”‚  Provides interactive web interface for document management          β”‚
β”‚  and AI-powered question answering                                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                                 β”‚ User Interaction
                                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              WordPress Plugin (assistant-interface)                  β”‚
β”‚         Location: assistant-interface/wordpress/wp-content/          β”‚
β”‚                      plugins/assistant-interface/                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Frontend Layer (React + Webpack)                             β”‚   β”‚
β”‚  β”‚  β€’ Renders responsive UI components                           β”‚   β”‚
β”‚  β”‚  β€’ Handles user input and form submissions                    β”‚   β”‚
β”‚  β”‚  β€’ Manages client-side state and interactions                 β”‚   β”‚
β”‚  β”‚  β€’ Compiles JSX/CSS into optimized bundles                    β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Backend Layer (PHP)                                          β”‚   β”‚
β”‚  β”‚  β€’ Processes HTTP requests from frontend                      β”‚   β”‚
β”‚  β”‚  β€’ Manages WordPress integration and hooks                    β”‚   β”‚
β”‚  β”‚  β€’ Forwards API calls to semantic-engine                      β”‚   β”‚
β”‚  β”‚  β€’ Handles authentication and authorization                   β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Infrastructure (Docker)                                      β”‚   β”‚
β”‚  β”‚  β€’ Nginx serves static assets and routes requests             β”‚   β”‚
β”‚  β”‚  β€’ PHP-FPM processes WordPress application logic              β”‚   β”‚
β”‚  β”‚  β€’ MySQL stores WordPress data and configurations             β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                                 β”‚ REST API Calls (HTTP/HTTPS)
                                 β”‚
                                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              RAG Backend (semantic-engine)                           β”‚
β”‚              Location: ai-assistant/semantic-engine/                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Indexing Module (app/index/)                                 β”‚   β”‚
β”‚  β”‚  β€’ Dynamically indexes documents in vector database           β”‚   β”‚
β”‚  β”‚  β€’ Processes and chunks documents for embedding               β”‚   β”‚
β”‚  β”‚  β€’ Manages document lifecycle (store/delete/re-index)         β”‚   β”‚
β”‚  β”‚  β€’ Generates vector embeddings using Ollama                   β”‚   β”‚
β”‚  β”‚                                                               β”‚   β”‚
β”‚  β”‚  API Endpoints:                                               β”‚   β”‚
β”‚  β”‚    POST   /index/store     - Index new documents              β”‚   β”‚
β”‚  β”‚    DELETE /index/delete    - Remove indexed documents         β”‚   β”‚
β”‚  β”‚    POST   /index/re-store  - Reindex existing documents       β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Retrieval Module (app/retrieval/)                            β”‚   β”‚
β”‚  β”‚  β€’ Performs semantic search on user queries                   β”‚   β”‚
β”‚  β”‚  β€’ Augments prompts with retrieved context                    β”‚   β”‚
β”‚  β”‚  β€’ Generates AI responses using RAG approach                  β”‚   β”‚
β”‚  β”‚  β€’ Retrieves relevant document chunks and metadata            β”‚   β”‚
β”‚  β”‚                                                               β”‚   β”‚
β”‚  β”‚  API Endpoints:                                               β”‚   β”‚
β”‚  β”‚    POST /retrieval          - Query with RAG                  β”‚   β”‚
β”‚  β”‚    GET  /retrieval/document - Fetch specific document         β”‚   β”‚
β”‚  β”‚    GET  /retrieval/documents- List all documents              β”‚   β”‚
β”‚  β”‚    GET  /retrieval/points   - Get vector points               β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Infrastructure (Docker)                                      β”‚   β”‚
β”‚  β”‚  β€’ Node.js runtime executes application logic                 β”‚   β”‚
β”‚  β”‚  β€’ Nginx reverse proxy with SSL termination                   β”‚   β”‚
β”‚  β”‚  β€’ Ollama integration for embeddings and generation           β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                                 β”‚ Vector Operations
                                 β”‚ (Embedding Storage & Retrieval)
                                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Vector Database (Qdrant)                            β”‚
β”‚                      Storage: qdrant_db/                             β”‚
β”‚  β€’ Stores high-dimensional vector embeddings                         β”‚
β”‚  β€’ Performs fast similarity search using HNSW algorithm              β”‚
β”‚  β€’ Manages document metadata and payloads                            β”‚
β”‚  β€’ Enables semantic retrieval for RAG operations                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β–²
                                 β”‚
                          Powered by Ollama
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚    Ollama (Local AI)       β”‚
                    β”‚  β€’ Generates embeddings    β”‚
                    β”‚  β€’ Produces AI responses   β”‚
                    β”‚  β€’ Runs locally on host    β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Conversation flow

The RAG system maintains conversation context through an intelligent summarization approach that preserves conversation history while optimizing token usage.

Flow Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     First Question (Initial Query)                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                     β”‚
β”‚  User Query                                                         β”‚
β”‚       β”‚                                                             β”‚
β”‚       β”œβ”€β–Ί Semantic Search (Qdrant)                                  β”‚
β”‚       β”‚                                                             β”‚
β”‚       β”œβ”€β–Ί Context Retrieval                                         β”‚
β”‚       β”‚                                                             β”‚
β”‚       β”œβ”€β–Ί Prompt Augmentation                                       β”‚
β”‚       β”‚                                                             β”‚
β”‚       └─► AI Response Generation                                    β”‚
β”‚                                                                     β”‚
β”‚  Output:                                                            β”‚
β”‚    β€’ AI Answer                                                      β”‚
β”‚    β€’ Summary (Initial Context)                                      β”‚
β”‚                                                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Second and Nth Question (Context-Aware Query)          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                     β”‚
β”‚  User Query + Previous Summary                                      β”‚
β”‚       β”‚                                                             β”‚
β”‚       β”œβ”€β–Ί Semantic Search (with conversation context)               β”‚
β”‚       β”‚                                                             β”‚
β”‚       β”œβ”€β–Ί Context Retrieval                                         β”‚
β”‚       β”‚                                                             β”‚
β”‚       β”œβ”€β–Ί Prompt Augmentation                                       β”‚
β”‚       β”‚   (Previous Summary + New Context)                          β”‚
β”‚       β”‚                                                             β”‚
β”‚       └─► AI Response Generation                                    β”‚
β”‚                                                                     β”‚
β”‚  Output:                                                            β”‚
β”‚    β€’ AI Answer                                                      β”‚
β”‚    β€’ Updated Summary                                                β”‚
β”‚                                                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Benefits of This Approach

  1. Context Preservation: Each question builds upon previous interactions
  2. Token Efficiency: Summaries compress conversation history without losing key information
  3. Semantic Continuity: Follow-up questions can reference earlier topics naturally
  4. Scalable Conversations: Long conversations remain manageable through progressive summarization
  5. Enhanced Retrieval: Cumulative context improves relevance of retrieved documents

Project Structure

ai-assistant-services/
β”‚
β”œβ”€β”€ ai-assistant/                          # Main Git Repository
β”‚   β”œβ”€β”€ semantic-engine/                   # RAG Backend Application
β”‚   β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”‚   β”œβ”€β”€ index/                     # Document Indexing Module
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ storeController.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ deleteController.js
β”‚   β”‚   β”‚   β”‚   β”‚   └── reStoreController.js
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ createDocumentService.js
β”‚   β”‚   β”‚   β”‚   β”‚   └── deleteDocumentService.js
β”‚   β”‚   β”‚   β”‚   └── routes.js
β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”œβ”€β”€ retrieval/                 # Query & Retrieval Module
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ retrievalController.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ getDocumentController.js
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ getDocumentsController.js
β”‚   β”‚   β”‚   β”‚   β”‚   └── getPointsController.js
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   β”‚   β”‚   └── prompt-augmentation.js
β”‚   β”‚   β”‚   β”‚   └── routes.js
β”‚   β”‚   β”‚   β”‚
β”‚   β”‚   β”‚   β”œβ”€β”€ helpers/
β”‚   β”‚   β”‚   β”‚   └── utilities.js
β”‚   β”‚   β”‚   └── types/
β”‚   β”‚   β”‚       └── point.js
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ docker-configs/                # Docker Configuration
β”‚   β”‚   β”‚   β”œβ”€β”€ certs/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ cert.pem
β”‚   β”‚   β”‚   β”‚   └── key.pem
β”‚   β”‚   β”‚   β”œβ”€β”€ default.conf
β”‚   β”‚   β”‚   β”œβ”€β”€ nginx.dockerfile
β”‚   β”‚   β”‚   └── node.dockerfile
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ qdrant_db/                     # Vector Database Storage
β”‚   β”‚   β”œβ”€β”€ app.js                         # Main Application Entry
β”‚   β”‚   β”œβ”€β”€ docker-compose.yml
β”‚   β”‚   β”œβ”€β”€ package.json
β”‚   β”‚   β”œβ”€β”€ nodemon.json
β”‚   β”‚   β”œβ”€β”€ .env
β”‚   β”‚   └── .env-example
β”‚   β”‚
β”‚   └── assistant-interface/               # a copy of the plugin
β”‚
└── assistant-interface/                   # WordPress Development Environment
    β”œβ”€β”€ wordpress/                         # WordPress Core
    β”‚   β”œβ”€β”€ wp-content/
    β”‚   β”‚   β”œβ”€β”€ plugins/
    β”‚   β”‚   β”‚   └── assistant-interface/   # Main WordPress Plugin
    β”‚   β”‚   β”‚       β”œβ”€β”€ app/
    β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ Core.php       # Plugin Core
    β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ Lib/           # Library Classes
    β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ Response.php
    β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ Http.php
    β”‚   β”‚   β”‚       β”‚   β”‚   └── SingleTon.php
    β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ Services/      # Business Logic
    β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ KnowledgeBase.php
    β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ AdminInterface.php
    β”‚   β”‚   β”‚       β”‚   β”‚   └── Assets.php
    β”‚   β”‚   β”‚       β”‚   └── Views/
    β”‚   β”‚   β”‚       β”‚       └── admin.php
    β”‚   β”‚   β”‚       β”‚
    β”‚   β”‚   β”‚       β”œβ”€β”€ resources/         # Frontend Assets (Source)
    β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ components/
    β”‚   β”‚   β”‚       β”‚   β”‚   └── IndexForm.jsx
    β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ app.js
    β”‚   β”‚   β”‚       β”‚   └── app.css
    β”‚   β”‚   β”‚       β”‚
    β”‚   β”‚   β”‚       β”œβ”€β”€ build/             # Compiled Frontend Assets
    β”‚   β”‚   β”‚       β”œβ”€β”€ vendor/            # PHP Dependencies (Composer)
    β”‚   β”‚   β”‚       β”œβ”€β”€ node_modules/      # JS Dependencies (npm)
    β”‚   β”‚   β”‚       β”œβ”€β”€ index.php          # Plugin Entry Point
    β”‚   β”‚   β”‚       β”œβ”€β”€ composer.json
    β”‚   β”‚   β”‚       β”œβ”€β”€ package.json
    β”‚   β”‚   β”‚       β”œβ”€β”€ webpack.config.js
    β”‚   β”‚   β”‚       β”œβ”€β”€ postcss.config.js
    β”‚   β”‚   β”‚       └── README.md
    β”‚   β”‚   β”‚
    β”‚   β”‚   β”œβ”€β”€ themes/
    β”‚   β”‚   └── uploads/
    β”‚   β”‚
    β”‚   β”œβ”€β”€ wp-admin/
    β”‚   β”œβ”€β”€ wp-includes/
    β”‚   β”œβ”€β”€ wp-config.php
    β”‚   └── index.php
    β”‚
    β”œβ”€β”€ configs/                           # Server Configurations
    β”‚   └── nginx/
    β”‚
    β”œβ”€β”€ db/                                # MySQL Database Files
    β”‚   β”œβ”€β”€ mysql/
    β”‚   β”œβ”€β”€ performance_schema/
    β”‚   β”œβ”€β”€ sys/
    β”‚   └── wp/
    β”‚
    └── docker-compose.yml                 # WordPress Docker Setup

Technology Stack

semantic-engine (Backend)

  • Runtime: Node.js
  • Web Server: Nginx (Reverse Proxy)
  • Vector Database: Qdrant
  • Container: Docker
  • AI/ML: Ollama (for embeddings and generation)

assistant-interface (Frontend)

  • CMS: WordPress
  • Backend Language: PHP
  • Frontend Framework: React (JSX)
  • Build Tool: Webpack
  • CSS: PostCSS
  • Dependency Management: Composer (PHP), npm (JavaScript)
  • Web Server: Nginx
  • Database: MySQL
  • Container: Docker

Communication Flow

  1. User Input: User interacts with WordPress admin panel
  2. Frontend Processing: React components handle user interactions
  3. API Request: WordPress plugin sends HTTP requests to semantic-engine
  4. Document Indexing: semantic-engine processes and stores documents in Qdrant
  5. Query Processing: User queries are augmented and sent to Qdrant for semantic search
  6. AI Generation: Retrieved context is used for RAG-based response generation
  7. Response Delivery: Results are returned to WordPress and displayed to user

Development Setup

Prerequisites

  • Docker & Docker Compose
  • Node.js & npm
  • Composer
  • Ollama (for AI capabilities)

Getting Started

1. Start WordPress Environment

cd assistant-interface
docker-compose up -d --build

Access WordPress at: http://localhost:8000

2. Install Plugin Dependencies

# Inside the PHP container
cd wordpress/wp-content/plugins/assistant-interface
composer install
npm install
npm run build

3. Start RAG Backend

cd ai-assistant/semantic-engine
docker-compose up -d --build

4. Install Backend Dependencies

# Inside the engine container
npm install

API Endpoints

semantic-engine Endpoints

  • POST /index/store - Index new documents
  • DELETE /index/delete - Delete documents
  • POST /index/re-store - Re-index documents
  • POST /retrieval - Query documents (RAG)
  • GET /retrieval/document - Get specific document
  • GET /retrieval/documents - Get all documents
  • GET /retrieval/points - Get vector points

Key Features

Document Management

  • Upload and index documents
  • Delete and re-index capabilities
  • Vector-based storage in Qdrant

Semantic Search

  • Context-aware query processing
  • Prompt augmentation for better results
  • Vector similarity search

WordPress Integration

  • Native WordPress admin interface
  • React-based interactive UI
  • RESTful API integration

About

A 𝐩𝐫𝐒𝐯𝐚𝐜𝐲-𝐟𝐒𝐫𝐬𝐭 𝐑𝐀𝐆 π€πˆ 𝐚𝐬𝐬𝐒𝐬𝐭𝐚𝐧𝐭 𝐟𝐨𝐫 π–π¨π«πππ«πžπ¬π¬

Topics

Resources

License

Stars

Watchers

Forks