Skip to content

Commit 6c20bdd

Browse files
Merge pull request #137 from lappis-unb/devel
1.1.0
2 parents 0dead99 + ed4a67f commit 6c20bdd

File tree

10 files changed

+115
-138
lines changed

10 files changed

+115
-138
lines changed

.github/workflows/python.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master, devel ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: [3.6, 3.7]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v1
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
- name: Install dependencies
27+
run: |
28+
# Added "gast=0.2.2" as a workarround because of a Tensorflow issue, should be removed soon
29+
python -m pip install --upgrade pip gast==0.2.2
30+
pip install flake8 pytest
31+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32+
- name: Lint with flake8
33+
run: |
34+
# stop the build if there are Python syntax errors or undefined names
35+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38+
- name: Test Rasa version
39+
run: |
40+
rasa --version
41+
- name: Rasa train
42+
run: |
43+
cd bot/
44+
make train
45+
- name: Test Rasa bot
46+
run: |
47+
cd bot/
48+
make test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Rasa ###
22
bot/models
3+
bot/results*
34

45
### Rasa X ###
56
events.db

.gitlab-ci.yml

Lines changed: 0 additions & 105 deletions
This file was deleted.

Makefile

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
current_dir := $(shell pwd)
22

33
clean:
4-
sudo docker-compose down
4+
docker-compose down
55

6-
############################## BOILERPLATE ##############################
6+
stop:
7+
docker-compose stop
8+
9+
############################## BOILERPLATE ##############################
710
first-run:
811
make build
912
make train
@@ -19,56 +22,66 @@ build-requirements:
1922

2023
build-bot:
2124
docker-compose build --no-cache bot
22-
25+
2326
build-coach:
2427
docker-compose build --no-cache coach
2528

2629
build-analytics:
27-
sudo docker-compose up -d elasticsearch
28-
sudo docker-compose up -d rabbitmq
29-
sudo docker-compose up -d rabbitmq-consumer
30-
sudo docker-compose up -d kibana
30+
docker-compose up -d elasticsearch
31+
docker-compose up -d rabbitmq
32+
docker-compose up -d rabbitmq-consumer
33+
docker-compose up -d kibana
3134
# This sleep time is a work arround the main objetive is run the following command when elasticsearch is ready
3235
# The following command is needed just once for project. It's just a setup onfiguration script.
3336
sleep 30
34-
sudo docker-compose run --rm -v $(current_dir)/modules/analytics/setup_elastic.py:/analytics/setup_elastic.py bot python /analytics/setup_elastic.py
35-
sudo docker-compose run --rm -v $(current_dir)/modules/analytics/:/analytics/ bot python /analytics/import_dashboards.py
36-
echo "Não se esqueça de atualizar o arquivo endpoints.yml"
37+
docker-compose run --rm -v $(current_dir)/modules/analytics/setup_elastic.py:/analytics/setup_elastic.py bot python /analytics/setup_elastic.py
38+
docker-compose run --rm -v $(current_dir)/modules/analytics/:/analytics/ bot python /analytics/import_dashboards.py
39+
$(info )
40+
$(info Não se esqueça de atualizar o arquivo endpoints.yml)
41+
$(info )
3742
sensible-browser --no-sandbox http://localhost:5601
3843

3944
run-analytics:
40-
sudo docker-compose up -d rabbitmq
41-
sudo docker-compose up -d rabbitmq-consumer
42-
sudo docker-compose up -d elasticsearch
43-
sudo docker-compose up -d kibana
45+
docker-compose up -d rabbitmq
46+
docker-compose up -d rabbitmq-consumer
47+
docker-compose up -d elasticsearch
48+
docker-compose up -d kibana
4449
sensible-browser --no-sandbox http://localhost:5601
4550

4651
run-shell:
47-
sudo docker-compose run --rm --service-ports bot make shell
52+
docker-compose run --rm --service-ports bot make shell
4853

4954
run-x:
50-
sudo docker-compose run --rm --service-ports bot make x
55+
docker-compose run --rm --service-ports bot make x
5156

5257
run-webchat:
53-
sudo docker-compose run -d --rm --service-ports bot-webchat
58+
$(info )
59+
$(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)
60+
$(info )
61+
docker-compose run -d --rm --service-ports bot-webchat
5462
sensible-browser modules/webchat/index.html
5563

5664
run-telegram:
57-
sudo docker-compose run -d --rm --service-ports bot_telegram make telegram
65+
docker-compose run -d --rm --service-ports bot_telegram make telegram
5866

5967
run-notebooks:
60-
sudo docker-compose up -d notebooks
68+
docker-compose up -d notebooks
6169
sensible-browser --no-sandbox http://localhost:8888
6270

6371
train:
6472
mkdir -p bot/models
65-
sudo chmod -R 755 bot/models
66-
docker-compose up coach
67-
sudo chmod -R 644 bot/models/*
73+
docker-compose up --build coach
74+
75+
############################## TESTS ##############################
76+
run-test-nlu:
77+
docker-compose run --rm bot make test-nlu
78+
79+
run-test-core:
80+
docker-compose run --rm bot make test-core
6881

6982
validate:
70-
sudo docker-compose run --rm coach rasa data validate --domain domain.yml --data data/ -vv
83+
docker-compose run --rm coach rasa data validate --domain domain.yml --data data/ -vv
7184

7285
visualize:
73-
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
86+
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
7487
sensible-browser --no-sandbox bot/graph.html

bot/Makefile

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,39 @@
33
clean:
44
rm -rf graph.html results/ models/* *.db*
55

6-
############################## BOT ##############################
6+
install:
7+
pip install --upgrade pip && \
8+
pip install -r ../requirements.txt && \
9+
pip install -r ../x-requirements.txt
10+
711
# RASA X
812
x:
913
rasa x
1014

1115
# NLU
1216
train-nlu:
13-
rasa train nlu -vv
17+
rasa train nlu -vv
1418

1519
# CORE
1620
train:
1721
rasa train -vv
1822

23+
# TESTS
1924
validate:
2025
rasa data validate -vv
2126

2227
test:
23-
rasa test -vv
28+
rasa test --out results/
29+
30+
test-nlu:
31+
rasa test nlu --out results/results-nlu-test
32+
33+
test-core:
34+
rasa test core --fail-on-prediction-errors --out results/results-core-test
35+
36+
# VALIDACAO
37+
validate:
38+
rasa data validate
2439

2540
# MENSAGEIROS
2641
shell:

bot/actions/actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## This files contains your custom actions which can be used to run
1+
# This files contains your custom actions which can be used to run
22
# custom Python code.
33
#
44
# See this guide on how to implement these action:

bot/tests/conversation_tests.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## me_ajuda
2+
* cumprimentar: oi
3+
- utter_cumprimentar
4+
* o_que_sei_falar: #meajuda
5+
- utter_o_que_sei_falar

docker/requirements.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
FROM python:3.7-slim
22

33
COPY ./requirements.txt /tmp
4+
COPY ./x-requirements.txt /tmp
45

56
RUN apt-get update && \
67
apt-get install -y gcc make build-essential && \
78
python -m pip install --upgrade pip && \
89
pip install --no-cache-dir -r /tmp/requirements.txt && \
10+
pip install --no-cache-dir -r /tmp/x-requirements.txt && \
911
python -c "import nltk; nltk.download('stopwords');" && \
1012
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf && \
1113
apt-get clean && \

requirements.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
rasa==1.8.0
1+
rasa==1.10.0
22
nltk==3.4.5
33
elasticsearch==7.0.4
4-
flake8==3.7.8
5-
6-
--extra-index-url https://pypi.rasa.com/simple
7-
rasa-x==0.26.0

x-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--extra-index-url https://pypi.rasa.com/simple
2+
rasa-x==0.28.0

0 commit comments

Comments
 (0)