Skip to content
Open
9 changes: 9 additions & 0 deletions bot/actions/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM rasa/rasa:1.9.4-full
WORKDIR /app
USER root
RUN python3 -m spacy download en_core_web_sm
RUN python3 -m spacy link -f en_core_web_sm en_core_web_sm

COPY ./ /app/actions
EXPOSE 5055
CMD ["run", "actions"]
Empty file added bot/actions/__init__.py
Empty file.
Binary file added bot/actions/__pycache__/actions.cpython-36.pyc
Binary file not shown.
13 changes: 10 additions & 3 deletions bot/actions.py → bot/actions/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from rasa_sdk.events import SlotSet
import spacy
import json
import os.path
#
#
nlp = spacy.load('en_core_web_sm')
Expand Down Expand Up @@ -83,18 +84,24 @@ def submit(self, dispatcher: CollectingDispatcher,

def get_board_mapped(self, board):
data = ''
with open('resources/boards.json') as boards_values:
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, 'resources/boards.json')
with open(filename) as boards_values:
data = json.load(boards_values)
return data[board]

def get_medium_mapped(self,medium):
data = ''
with open('resources/mediums.json') as mediums_values:
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, 'resources/mediums.json')
with open(filename) as mediums_values:
data = json.load(mediums_values)
return data[medium]

def get_grade_mapped(self, grade):
data = ''
with open('resources/grades.json') as grades_values:
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, 'resources/grades.json')
with open(filename) as grades_values:
data = json.load(grades_values)
return data[grade]
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion bot/endpoints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# https://rasa.com/docs/rasa/core/actions/#custom-actions/

action_endpoint:
url: "http://localhost:5055/webhook"
url: "http://action:5055/webhook"

# Tracker store which is used to store the conversations.
# By default the conversations are stored in memory.
Expand Down
6 changes: 6 additions & 0 deletions stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ services:
- "5005:5005"
environment:
- TMP=TMP
action:
build:
dockerfile: Dockerfile
context: ./bot/actions/.
ports:
- "5055:5055"
router:
build: ./router/.
ports:
Expand Down