A framework to model, train and integrate social bots into technology enhanced learning applications of las2peer.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
MetaModel
configs
opt
widgets
.localGruntConfig.json
Dockerfile
LICENSE
README.md
mysql.cnf
mysqld_charset.cnf
runImageStandardConf.sh

README.md

Social-Bot-Framework

Core Components

External Dependencies

Docker

This repository provides a dockerfile with an example setup. The external dependencies and the core components are included. Noracle is used as an example service. The docker container is built automatically and can be obtained with the following command:

docker pull rwthacis/social-bot-framework

To start the container it is important that some ports are opened:

docker run -it --rm -p 1234:1234 -p 8073:8073 -p 8080:8080 -p 3000:3000 -p 9011:9011 -p 4200:4200 -p 8081:8081 --name sbf rwthacis/social-bot-framework

Manual Setup

First of all, the external dependencies must be running. To model the bot you need a ROLE space on which the SyncMeta widgets run. With the debug widget you can then load the vls. To load the model into the network, the model selector widget must be added. The method browser can be used as an assistant. To use the widgets, the urls have to be adapted and the bower dependencies have to be installed. It is important that the location of the ROLE space is set in the Access-Control-Allow-Origin header. The core components must run on the same network as the MobSOS services.

Frontend Integration

Within the service frontend two links must be provided to use the framework.

  1. Post request to add the bot to a unit

JavaScript

function addToUnit(){
    var xhr = new XMLHttpRequest();
    var webConnectorEndpoint = "http://localhost:8080/";
    var url = webConnectorEndpoint + "SBFManager/join";
    xhr.open("POST", url, true);
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4 && xhr.status === 200) {
            console.log("Bot added");
        }
    };
    var data = JSON.stringify({basePath: webConnectorEndpoint + "serviceAlias", joinPath:"serviceFunctionPath"});
    xhr.send(data);
}

HTML

<a onclick="addToUnit()">Add Bot to Unit</a>

You have to adjust the webConnectorEndpoint, the serviceAlias and the serviceFunctionPath. If the service needs any further parameters they can be added to the body of the post request. If the service has no unit separation you can add the following attribut to the body:

"directJoin": true
  1. Url for the training area
<a href="{{urlToWidget}}/train.html?unit={{unit}}">Train Bot</a>

You have to adjust the urlToWidget and the unit. If the service has no unit separation the unit query parameter can then be omitted.

Backend Integration

Trigger

For the bot to be triggered, the service must send an appropriate monitoring message.

{
    "serviceAlias": "",
    "functionName": "",
    "attributes":{}
}

The serviceAlias attribute should contain the alias given by the @ServicePath annotation. The functionNameattribute should contain the name of the function. Any type of attributes (@PathParam/@QueryParam/@BodyParam) should be listed in the attributes attribute. If the service uses PoJo's the developer can make use of the Gson library.

Training data

Training data can be collected using MobSOS. A monitoring message has the following form:

{  
   "unit":"",
   "from":"",
   "to":""
}

The attribute unit contains an id to assign the training data to the respective domain. The from attribute contains the initial text. The toattribute contains the expected output. For classification it is of the type Integer and for text generation it is of the type String.