Skip to content

Skyquek/milktea-CN_chatbot-nlp

Repository files navigation

Milktea Chinese Chatbot

This project uses the rasa framework to provide a chatbot for ordering boba tea, taking 幸福堂 as a reference.

Live system

You may access a live version of this chatbot via our server at home.

Setting up

System requirements

  • System with support for the x86 instruction set
  • Git
  • Docker
  • NodeJS (with npm)

Scripted setup (Linux systems)

  1. Clone the repo from github
git clone https://github.com/Skyquek/milktea-CN_chatbot-nlp.git
  1. Give exectable permissions
cd milktea-CN_chatbot-nlp
chmod 0777 buildAll.sh
  1. Run the build process
./buildAll.sh
  1. Once everything has finished building, you may access the chatbot service via your browser at:
http://<your-ip>:52288/

Non-scripted setup

  1. Clone the repo from github, then go into the folder
git clone https://github.com/Skyquek/milktea-CN_chatbot-nlp.git
cd milktea-CN_chatbot-nlp

Build the frontend

  1. Go into the folder containing the frontend code
cd ./public
  1. Build the frontend files
npm install
ng build --prod
  1. Build the docker image
docker build -t xingfutang-chatbot-frontend  . --no-cache
  1. Run the docker image (you may change the port number - 52288 to any number you desire)
docker run --name xingfutang-chatbot-frontend  -p 52288:80 -d xingfutang-chatbot-frontend
  1. Done!

Build the backend

  1. Build the docker image
docker build -t nlp-chatbot:latest .
  1. Run the docker image
docker run --name xinfutang -p 5005:5005 -d ai-trademark-frontend
  1. Done!

Building without docker

  1. Start bert-as-service. bert-as-service is a sentence encoding service for mapping a variable-length sentence to a fixed-length vector.
bert-serving-start -model_dir chinese_L-12_H-768_A-12/ -num_worker=1
  1. start action server
rasa run actions
  1. train a model
rasa train
  1. talk to your chatbot

    • API: rasa run

    • CMD: rasa shell

  2. EXPOSE the PORT NUMBER

URL: "http://localhost:5005/webhooks/rest/webhook"
Method: POST
Header: Content-Type: application/json
Body:
{
"sender": "Quek",
"message": “奶茶”
}
Response:
[
  {
      "recipient_id": "Quek",
      "text": "你好"
  },
  {
      "recipient_id": "Quek",
      "text": "想要喝点什么?"
  }
]