An event-driven AI Chatbot that "thinks" before it speaks. Features a custom RAG knowledge base, asynchronous job queues, and sub-second inference using Groq.
Unlike standard chatbots that just hit an API, QMind uses a Production-Grade Architecture:
-
RAG Engine (Retrieval Augmented Generation):
- Uses Redis to store a custom "Knowledge Base" (documents/business data).
- Before answering, the system scans Redis for relevant context and injects it into the System Prompt.
- Result: The AI answers questions about your specific data, not just general knowledge.
-
Asynchronous Processing (BullMQ):
- Heavy AI requests are offloaded to a Redis Queue (
ai-queue). - A dedicated worker processes requests in the background, preventing server blocking under high load.
- Heavy AI requests are offloaded to a Redis Queue (
-
Real-Time Streaming:
- Socket.io pushes the AI response chunk-by-chunk to the React frontend for a seamless "typing" experience.
- Brain: Llama-3 (via Groq SDK)
- Backend: Node.js, Express
- Orchestration: BullMQ (Redis Queues)
- Memory/Context: Redis (RAG Storage)
- Real-Time: Socket.io
- Frontend: React, TailwindCSS, Lucide
Handles the RAG logic. It retrieves relevant docs from Redis, constructs the prompt with context, and calls the Groq API.
Decouples the request from the execution.
// Example: Adding a job to the queue
export const addAIJob = async (jobData) => {
const job = await aiQueue.add('process-ai-request', jobData);
return job.id;
};Allows users to "feed" the AI new documents. These are stored in Redis and become immediately queryable by the RAG engine.
- Clone & Install
git clone [https://github.com/ImAryanPandey/QMind-AI.git](https://github.com/ImAryanPandey/QMind-AI.git)
cd backend && npm install
cd ../frontend && npm install
- Redis Setup Ensure you have a Redis instance running (Docker or Local).
docker run -d -p 6379:6379 redis
- Environment Variables (.env)
PORT=5000
GROQ_API_KEY=gsk_...
REDIS_HOST=localhost
REDIS_PORT=6379
- Run System
# Terminal 1 (Backend + Worker)
npm run dev
# Terminal 2 (Frontend)
npm run dev