LoopBack is an AI-powered IT Support Helpdesk system that acts as a first line of defense for support teams. It intelligently handles user inquiries using a Knowledge Base (KB) and escalates complex issues to human agents when necessary. Crucially, it learns from every resolved ticket to improve its future responses.
- Intelligent Chat Interface: Users converse naturally with the AI to troubleshoot issues.
- Automatic Escalation: If the AI cannot resolve an issue (or if hardware/admin intervention is required), it automatically drafts a ticket with a summary of the problem and the full conversation history.
- Knowledge Base Integration:
- Retrieval: Uses fuzzy search logic to find relevant solutions from a CSV database (
knowledge_base/Workplace_IT_Support_Database.csv). - Robust Search: Matches against "Issue", "Question", and "Tags", ignoring punctuation and case.
- Duplicate Prevention: Automatically blocks duplicate or highly similar questions from being added to the KB to keep it clean.
- Retrieval: Uses fuzzy search logic to find relevant solutions from a CSV database (
- Self-Learning: When an admin marks a ticket as "Resolved" with a quality answer, the system automatically adds that solution to the Knowledge Base for future use.
- Admin Dashboard: View and manage tickets, see AI-drafted solutions, and monitor KB updates.
- Multi-Channel Support:
- Discord Bot: Users can open tickets directly from Discord. The bot creates dedicated threads (private/public) for each issue to keep channels clean.
- Web Portal: A responsive React application for tracking and managing tickets.
- Backend: Python (FastAPI)
- Frontend: React (Vite + Tailwind CSS + Lucide Icons)
- AI Model: Google Gemini-3-Pro
- Database: JSON file (
tickets_db.json) for tickets, CSV file for Knowledge Base. - Integration: Discord.py (Bot)
graph TD
User([User]) <--> Frontend[React Frontend]
User([User]) <--> Discord[Discord Bot]
Frontend <--> API[FastAPI Backend]
Discord <--> API
subgraph Backend Services
API <--> AI[Google Gemini AI]
API <--> KB[(Knowledge Base CSV)]
API <--> DB[(Tickets DB JSON)]
end
Admin([Admin]) <--> Frontend
sequenceDiagram
participant U as User
participant F as Frontend
participant B as Backend
participant AI as Gemini AI
participant K as Knowledge Base
participant A as Admin
U->>F: Asks Question
U->>Discord: Asks Question
F->>B: Sends Query
Discord ->> B: Sends Query
B->>K: Search for existing solutions
K-->>B: Returns context
B->>AI: Analyze query + Context
AI-->>B: Returns Draft Response & Metadata
alt Solution Found
B-->>F: Returns AI Solution
F-->>U: Displays Solution
else Issue Unresolved
B->>B: Creates Ticket (Status: Pending)
B-->>F: Returns Ticket Created
F-->>U: Notify Ticket Created
end
opt Admin Resolution
A->>F: Reviews Ticket
A->>B: Submits Final Answer
B->>AI: Standardize Resolution
AI-->>B: Returns Cleaned Text
B->>K: Updates Knowledge Base
end
- Python 3.9+
- Node.js & npm
- Google Gemini API Key
-
Navigate to the project root:
cd LoopBack -
Install dependencies:
pip install -r requirements.txt
-
Set up your environment variables:
-
Create a
.envfile in the root directory. -
GOOGLE_API_KEY=your_api_key_here -
DISCORD_BOT_TOKEN=<bot-token> -
DISCORD_GUILD_ID=<server-id>(The server ID where you want the bot to operate) -
DISCORD_CHANNEL_ID=<channel-id>(The channel ID where you want the bot to operate) -
If you wish to use Langsmith services, add
LANGSMITH_TRACING=trueLANGSMITH_ENDPOINT=https://api.smith.langchain.comLANGSMITH_API_KEY=<your-api-key>LANGSMITH_PROJECT=<your-project-name> -
If you wish to use Langsmith services, add
LANGSMITH_TRACING=trueLANGSMITH_ENDPOINT=https://api.smith.langchain.comLANGSMITH_API_KEY=<your-api-key>LANGSMITH_PROJECT=<your-project-name> -
Else, simply add the line
LANGSMITH_TRACING=true
-
-
Start the backend server:
python3 server.py
The server will run on
http://localhost:8000.
- Navigate to the frontend directory:
cd frontend - Install dependencies:
npm install
- Start the development server:
The application will be available at
npm run dev
http://localhost:5173. - Run the discord bot
python3 discord_bot.py
- User Portal: Users open the app and type their IT issue. The AI attempts to solve it using the Knowledge Base.
- Ticket Creation: If unresolved, a ticket is created.
- Admin Resolution: An admin reviews the ticket via the dashboard (or simulates resolution via API) and provides a final answer.
- Learning: The system detects the high-quality resolution and adds it to the Knowledge Base for next time.
server.py: Main backend logic (App, API endpoints, AI integration).discord_bot.py: Discord bot logic.tickets_db.json: Stores all ticket data.knowledge_base/: Contains the CSV database used for RAG (Retrieval-Augmented Generation).frontend/: React source code.src/UserPortal.jsx: The chat interface for end-users.src/AdminDashboard.jsx: Interface for support agents.