A slack chatbot that can recommend citation.
As this bot needs tens of GBs RAM for computing, we only recommended to running it in a cluster.
You need a MongoDB database service to manage the datasets.
Download the AMiner dataset (current version: v13) at first, here you should note that the json
file was build as JsonArray
.
Then import the json data to the mongdb with database name CitRec
and collection nameAMiner
.
To import, please use following shell command in citrec_mongodb
container:
mongoimport --db CitRec --collection AMiner --jsonArray --legacy --file <path>/dblpv13.json
Download the DBLP datset (dblp.dtd and dblp.xml.gz).
In Citavi, create an archive copy (File > This project > Archive project).
This will create a file with the file extension .ctv6archive
, change the filename extension tozip
and unzip it.
Inside is the project database with the file extension .ctv6
. Rename the file extension to .db
.
The .db
(SQLite) is what we need
-
Enter the training directory.
-
In a Python in environment, using the following command to install required packages:
pip install -r requirements.txt
-
Run the training process using the following command:
python3 __init__.py --year_AMiner <year in which AMIner dataset was publised (e.g. 2021)> --dblp_dtd <path to .dtd> --dblp_xml <path to .xml> --citavi_sqlite <path to .db> --server_address <server address of MongoDB, e.g. localhost:27017> --batch_size_1 <defaut as 16> --batch_size_2 <default as 100000>
Now the training process begins and might last tens of hours.
If it run out of the GPU's memory, decrease the number filled in batch_size_1. If it run out of CPU's memory, decrease the number filled in batch_size_2
-
las2peer-social-bot-manager-service and las2peer-CitRec-Handler-Service need to work with this bot together.
To check if they are working, visit the following addresses:
localhost:8080/SBFManager/swagger.json
localhost:8080/CitRecHandler/swagger.json
-
A rasa-nlu server is needed. Install the rasa package in a Python environment with command:
conda install rasa
Start rasa server using the command:
rasa run --enable-api
Now, the rasa can be visited using address
localhost:5005
Creating a classic bot app is possible here. (Wait for the app creation window to pop up, do not click on the green "Create New App" button). Since the las2peersocial-bot-manager-service uses RTM, a classic app, instead of a new app, is needed.
- Inside the app settings, create a bot user (on the left side Features: App Home, and then "Add Legacy Bot User")
- Add the following oauth scopes under OAuth & Permissons:
- channels:read
- chat:write:bot
- bot
- users:read.email (users:read included)
- Please do not update scopes!
Now install the app to your workspace. After this a token will be generated which is used in the redirect url.
-
Find the bot token: On the left side: OAuth and Permissons, the bot user oauth token (starting with xoxb).
-
Activate interactive components (on the left side: Basic Information: Add features and functionality, Interactive Components. After activating this feature, a Request URL is needed.)
-
Configuring the request url:
The ip address and port where slack posts the request (the address from the sbfmanager), slack app token, the bot name from the frontend, the instance name from the frontend and the buttonintent text are needed.
http://<ipAddress:port>/SBFManager/bots/<botName>/appRequestURL/<instanceName>/buttonIntent/<token>
For the model provided in this repository (directory bot_model), set the url to
http://<ipAddress:port>/SBFManager/bots/CitBot/appRequestURL/Group1/buttonIntent/<instanceName>/buttonIntent/<token>
Model the bot using this url:
https://sbf.tech4comp.dbis.rwth-aachen.de/bot-modeling
In the website:
- Select a JSON file: select model.json
- Import/Export/Delete a (Meta- or Guidance-)Model: click the "Import" button
- In the Social bot manager endpoint: fill with
http://localhost:8080/SBFManager
- In the Instance metamodel: fill the address with
http://localhost:8080
- In the NLU Knowledge metamodel: fill the address with
http://localhost:5005
- In the Bot metamodel: fill the name with
CitBot
- Click Submit button, now the bot can response on messages.
-
Enter the citbot directory.
-
In a Python in environment, using the following command to install required packages:
pip install -r requirements.txt
-
Start the service using the following command:
python3 -m flask run --host=0.0.0.0
Now the service is running at
http://localhost:5000
.And all the functionalities of the bot are available.