Giter Club home page Giter Club logo

sunbird-bot's Introduction

Chatbot-core

Core dialogue engine for chatbots

Getting the chatbot running on docker locally (docker-compose)

  • Install Docker
  • Clone this repo and cd to the cloned repo
  • Execute the following command docker-compose -f stack.yml up This command would build the bot and the router images and run them along with redis as a container.

Run the below curl to check if the bot is up and running. A successful setup would return the following response 'Hi there! Please press 0 for menu.'.

    curl -X POST \
        http://localhost:4000/bot \
        -H 'content-type: application/json' \
        -d '{
            "Body": "Hi",
            "From": "123"
        }'

Getting the chatbot running on docker swarm in production (assumes SSL)

  • Install Docker and initialise a docker swarm by running docker swarm init
  • Clone this repo and cd to the cloned repo
  • cd clonedrepo/bot
  • docker build --tag rasachatbot:0.0.1 . This would build a docker image for the rasa bot
  • cd clonedrepo/router
  • docker build --tag rasachatrouter:0.0.1 . This would build a docker image for the router that will integrate with Rasa bot
  • Push these images to a public repo so that you can reference the images from the prod.yml. You can test locally without this step, but it is mandatory to push to a public repo if you have a multi-node swarm
  • Make the below changes in prod.yml
    • Update the bot and router to images that you built above
    • Update the path to the site.key, crt and cabundle.
  • Execute docker stack deploy --compose-file prod.yml bot and this will deploy all the services to the docker swarm. Run docker swarm leave --force to purge the swarm and services

Run the below curl to check if the bot is up and running. A successful setup would return the following response 'Hi there! Please press 0 for menu.'.

    curl -X POST \
        http://IP:4000/bot \
        -H 'content-type: application/json' \
        -d '{
            "Body": "Hi",
            "From": "123"
        }'

Getting the chatbot running on a VM

Router Module (A node js application to interface between the chat client and bot server)

  • Installation:

    • install node and npm
    • npm install to install dependencies
  • configuration:

    • "config/config.js" can be modified if needed to change ports and other parameters
  • Starting the services:

    • node appRest to start the REST endpoint
    • node appSocket to start Socket endpoint

Bot module

  • Installation:

    • install latest anaconda environment
    • run conda env create -f environment.yml to install python dependencies. This step creates a virtual environment named rasa with python 3.6 and all dependencies
    • activate the environment conda activate rasa.
    • conda deactivate to de-activate the environment
  • configuration:

    • modify config.yml if needed to change NLU components for training or change policies
    • modify endpoints.yml if needed to change action server endpoint
  • Starting the services:

    • start RASA core server by running make bot or rasa run -p 5005 --enable-api --cors "*" -vv
    • start RASA action endpoint server by running make action or rasa run actions -vv -p 5056

Integration Instructions

  • REST integration Method: Post Endpoint: http://<IP>:<PORT>/bot Body: { "Body": "Hi", "From": "AC6436e7066283ef84c88a05392cc0fcd6" } Header: {'content-type': 'application/json'}

    *Body - User message *From - session id (uuid or some Session/ User identifier)

    • Response: Text based response

    • Curl request for the same:

       curl -X POST \
       http://<IP>:<PORT>/bot \
       -H 'content-type: application/json' \
       -d '{
           "Body": "Hi",
           "From": "AC6436e7066283ef84c88a05392cc0fcd6"
       }'
      
  • Socket Integration

    • Socket message body sample(using socket.io):
    • Request: Url: http://52.173.240.27:4005 Body: ["user_uttered",{"message":"what are the timelines for portal?","customData":{"userId":"123"}}]
    • Response: ["bot_uttered",{"text":"please choose from CBSE or State Board, other bords are not handled as of yet. 1. CBSE \n 2. State Board","intent":"template_ans_demo","type":"response"}]

sunbird-bot's People

Contributors

g33tha avatar mathewjpallan avatar vinukumar-vs avatar coolbung avatar nik720 avatar jineshks avatar manojlondhe avatar gandham-santhosh avatar sudhir-j-sapkal avatar harshavardhanc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.