Skip to content
This repository was archived by the owner on Apr 22, 2026. It is now read-only.

akariwill/Chatbot-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

58 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

logo

WhatsApp AI Chatbot

An intelligent WhatsApp chatbot powered by an AI backend to provide relevant and contextual responses. This project uses a two-part architecture: a WhatsApp bot frontend built with Node.js and an AI backend built with Python and FastAPI.


πŸ“„ Tugas Akhir (Skripsi)

Repositori ini juga berisi tugas akhir dengan judul:

Pengembangan Chatbot AI Berbasis Large Language Model (LLM) LangChain dengan Retrieval-Augmented Generation (RAG) pada Customer Service di PT. Telemedia Prima Nusantara

Penulis Moh Wildan Haikhal
Institusi Politeknik Negeri Sriwijaya
Program D-IV Manajemen Informatika
Tahun 2025

πŸ€– Architecture

This project consists of two main services working together:

  1. WhatsApp Bot (Node.js):

    • Located in the whatsapp-bot/ directory.
    • Uses the Baileys library to connect to WhatsApp.
    • It's responsible for receiving incoming messages, sending replies, and handling basic interactions like greetings or static info.
    • For complex questions, the bot forwards them to the AI backend via an API request.
  2. AI Backend (Python):

    • Located in the root directory.
    • Built with FastAPI to provide an API endpoint (/chat).
    • Uses LangChain and models from OpenAI to understand and process natural language questions.
    • Leverages FAISS CPU as a vector store for relevant information retrieval (Retrieval-Augmented Generation - RAG) from available data.

Architecture Diagram


✨ Key Features

  • Quick Greeting Responses: Handles common greetings directly at the bot level for efficiency.
  • Static Info: Provides quick answers for common questions like addresses or technician contacts.
  • AI Processing (RAG): Forwards complex questions to the Python backend for context-aware, data-driven answers.
  • History Logging: Saves conversation history for each user.
  • Media Handling: Saves media files sent by users.

πŸ› οΈ Tech Stack

Component Technology
WhatsApp Bot Node.js JavaScript Baileys, Axios, Pino
AI Backend Python FastAPI LangChain, OpenAI, FAISS, Uvicorn
Deployment Docker

πŸš€ Installation & Usage

1. AI Backend (Python)

Ensure you have Python 3.8+ installed.

  1. Clone the repository:

    git clone https://github.com/akariwill/Chatbot-AI.git
    cd chatbot-ai
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
  3. Install Python dependencies:

    pip install -r requirements.txt
  4. Set up environment variables:

    • Create a .env file in the root directory.
    • Add your OPENAI_API_KEY to this file:
    OPENAI_API_KEY="sk-..."
    
  5. Run the FastAPI server:

    uvicorn app:app --host 0.0.0.0 --port 8000

    The AI server is now running at http://localhost:8000.

2. WhatsApp Bot (Node.js)

Ensure you have Node.js v16+ installed.

  1. Navigate to the bot directory:

    cd whatsapp-bot
  2. Install Node.js dependencies:

    npm install
  3. Run the bot:

    npm start
    • A QR code will appear in the terminal.
    • Scan the QR code with your WhatsApp mobile app (Link a device).

Once both services are running, your bot will be active and ready to respond to messages on WhatsApp.


πŸ“‚ Project Structure

chatbot-ai/
β”œβ”€β”€ index.html              # Website tugas akhir (isi skripsi dalam HTML)
β”œβ”€β”€ Research.pdf            # Dokumen lengkap skripsi (PDF)
β”œβ”€β”€ extract_images_from_pdf.py website
β”œβ”€β”€ website/               
β”‚   β”œβ”€β”€ css/
β”‚   β”œβ”€β”€ javascript/
β”‚   └── img/
β”‚       └── research/       
β”œβ”€β”€ whatsapp-bot/           # WhatsApp Bot Frontend (Node.js)
β”‚   β”œβ”€β”€ index.js
β”‚   β”œβ”€β”€ package.json
β”‚   └── auth_info/         # (Auto-generated, ignored by Git)
β”œβ”€β”€ app.py                  # Entry point for the AI server (FastAPI)
β”œβ”€β”€ main.py                 # Core chatbot logic (LangChain)
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ Dockerfile              # Configuration for containerization
β”œβ”€β”€ assets/
β”‚   └── Data/               # Data for RAG
└── ...

πŸ“„ License

This project is licensed under the MIT License.

πŸ“ž Contact

If you have any questions or feedback, feel free to contact me on Discord wildanjr_ or Instagram akariwill.

About

Repositori ini merupakan tugas akhir dengan judul: Pengembangan Chatbot AI Berbasis Large Language Model (LLM) LangChain dengan Retrieval-Augmented Generation (RAG) pada Customer Service di PT. Telemedia Prima Nusantara

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors