Skip to content

Commit

Permalink
Merge pull request #137 from lappis-unb/devel
Browse files Browse the repository at this point in the history
1.1.0
  • Loading branch information
arthurTemporim authored Jul 2, 2020
2 parents 0dead99 + ed4a67f commit 6c20bdd
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 138 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ master ]
pull_request:
branches: [ master, devel ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# Added "gast=0.2.2" as a workarround because of a Tensorflow issue, should be removed soon
python -m pip install --upgrade pip gast==0.2.2
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test Rasa version
run: |
rasa --version
- name: Rasa train
run: |
cd bot/
make train
- name: Test Rasa bot
run: |
cd bot/
make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Rasa ###
bot/models
bot/results*

### Rasa X ###
events.db
Expand Down
105 changes: 0 additions & 105 deletions .gitlab-ci.yml

This file was deleted.

61 changes: 37 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
current_dir := $(shell pwd)

clean:
sudo docker-compose down
docker-compose down

############################## BOILERPLATE ##############################
stop:
docker-compose stop

############################## BOILERPLATE ##############################
first-run:
make build
make train
Expand All @@ -19,56 +22,66 @@ build-requirements:

build-bot:
docker-compose build --no-cache bot

build-coach:
docker-compose build --no-cache coach

build-analytics:
sudo docker-compose up -d elasticsearch
sudo docker-compose up -d rabbitmq
sudo docker-compose up -d rabbitmq-consumer
sudo docker-compose up -d kibana
docker-compose up -d elasticsearch
docker-compose up -d rabbitmq
docker-compose up -d rabbitmq-consumer
docker-compose up -d kibana
# This sleep time is a work arround the main objetive is run the following command when elasticsearch is ready
# The following command is needed just once for project. It's just a setup onfiguration script.
sleep 30
sudo docker-compose run --rm -v $(current_dir)/modules/analytics/setup_elastic.py:/analytics/setup_elastic.py bot python /analytics/setup_elastic.py
sudo docker-compose run --rm -v $(current_dir)/modules/analytics/:/analytics/ bot python /analytics/import_dashboards.py
echo "Não se esqueça de atualizar o arquivo endpoints.yml"
docker-compose run --rm -v $(current_dir)/modules/analytics/setup_elastic.py:/analytics/setup_elastic.py bot python /analytics/setup_elastic.py
docker-compose run --rm -v $(current_dir)/modules/analytics/:/analytics/ bot python /analytics/import_dashboards.py
$(info )
$(info Não se esqueça de atualizar o arquivo endpoints.yml)
$(info )
sensible-browser --no-sandbox http://localhost:5601

run-analytics:
sudo docker-compose up -d rabbitmq
sudo docker-compose up -d rabbitmq-consumer
sudo docker-compose up -d elasticsearch
sudo docker-compose up -d kibana
docker-compose up -d rabbitmq
docker-compose up -d rabbitmq-consumer
docker-compose up -d elasticsearch
docker-compose up -d kibana
sensible-browser --no-sandbox http://localhost:5601

run-shell:
sudo docker-compose run --rm --service-ports bot make shell
docker-compose run --rm --service-ports bot make shell

run-x:
sudo docker-compose run --rm --service-ports bot make x
docker-compose run --rm --service-ports bot make x

run-webchat:
sudo docker-compose run -d --rm --service-ports bot-webchat
$(info )
$(info Executando Bot com Webchat. Caso seu navegador não seja iniciado automáticamente, abra o seguinte arquivo com seu navegador: modules/webchat/index.html)
$(info )
docker-compose run -d --rm --service-ports bot-webchat
sensible-browser modules/webchat/index.html

run-telegram:
sudo docker-compose run -d --rm --service-ports bot_telegram make telegram
docker-compose run -d --rm --service-ports bot_telegram make telegram

run-notebooks:
sudo docker-compose up -d notebooks
docker-compose up -d notebooks
sensible-browser --no-sandbox http://localhost:8888

train:
mkdir -p bot/models
sudo chmod -R 755 bot/models
docker-compose up coach
sudo chmod -R 644 bot/models/*
docker-compose up --build coach

############################## TESTS ##############################
run-test-nlu:
docker-compose run --rm bot make test-nlu

run-test-core:
docker-compose run --rm bot make test-core

validate:
sudo docker-compose run --rm coach rasa data validate --domain domain.yml --data data/ -vv
docker-compose run --rm coach rasa data validate --domain domain.yml --data data/ -vv

visualize:
sudo docker-compose run --rm -v $(current_dir)/bot:/coach coach rasa visualize --domain domain.yml --stories data/stories.md --config config.yml --nlu data/nlu.md --out ./graph.html -vv
docker-compose run --rm -v $(current_dir)/bot:/coach coach rasa visualize --domain domain.yml --stories data/stories.md --config config.yml --nlu data/nlu.md --out ./graph.html -vv
sensible-browser --no-sandbox bot/graph.html
21 changes: 18 additions & 3 deletions bot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,39 @@
clean:
rm -rf graph.html results/ models/* *.db*

############################## BOT ##############################
install:
pip install --upgrade pip && \
pip install -r ../requirements.txt && \
pip install -r ../x-requirements.txt

# RASA X
x:
rasa x

# NLU
train-nlu:
rasa train nlu -vv
rasa train nlu -vv

# CORE
train:
rasa train -vv

# TESTS
validate:
rasa data validate -vv

test:
rasa test -vv
rasa test --out results/

test-nlu:
rasa test nlu --out results/results-nlu-test

test-core:
rasa test core --fail-on-prediction-errors --out results/results-core-test

# VALIDACAO
validate:
rasa data validate

# MENSAGEIROS
shell:
Expand Down
2 changes: 1 addition & 1 deletion bot/actions/actions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## This files contains your custom actions which can be used to run
# This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
Expand Down
5 changes: 5 additions & 0 deletions bot/tests/conversation_tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## me_ajuda
* cumprimentar: oi
- utter_cumprimentar
* o_que_sei_falar: #meajuda
- utter_o_que_sei_falar
2 changes: 2 additions & 0 deletions docker/requirements.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM python:3.7-slim

COPY ./requirements.txt /tmp
COPY ./x-requirements.txt /tmp

RUN apt-get update && \
apt-get install -y gcc make build-essential && \
python -m pip install --upgrade pip && \
pip install --no-cache-dir -r /tmp/requirements.txt && \
pip install --no-cache-dir -r /tmp/x-requirements.txt && \
python -c "import nltk; nltk.download('stopwords');" && \
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf && \
apt-get clean && \
Expand Down
6 changes: 1 addition & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
rasa==1.8.0
rasa==1.10.0
nltk==3.4.5
elasticsearch==7.0.4
flake8==3.7.8

--extra-index-url https://pypi.rasa.com/simple
rasa-x==0.26.0
2 changes: 2 additions & 0 deletions x-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--extra-index-url https://pypi.rasa.com/simple
rasa-x==0.28.0

0 comments on commit 6c20bdd

Please sign in to comment.