From 753f79e37eb1c4e7d7853883d87e322a8154749f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Thu, 21 May 2020 12:49:11 +0530 Subject: [PATCH 01/12] Create RASA action server image --- bot/Dockerfile | 10 ++++++++++ bot/actions/__init__.py | 0 bot/{ => actions}/actions.py | 0 bot/actions/requirements-actions.txt | 0 bot/{ => actions}/resources/boards.json | 0 5 files changed, 10 insertions(+) create mode 100644 bot/actions/__init__.py rename bot/{ => actions}/actions.py (100%) create mode 100644 bot/actions/requirements-actions.txt rename bot/{ => actions}/resources/boards.json (100%) diff --git a/bot/Dockerfile b/bot/Dockerfile index 74bf4cc..5d99f02 100644 --- a/bot/Dockerfile +++ b/bot/Dockerfile @@ -2,6 +2,16 @@ FROM rasa/rasa:1.9.4-full as trainer COPY . /app RUN rasa train +# Copy any additional custom requirements, if necessary (uncomment next line) +# COPY actions/requirements-actions.txt ./ + +# Install extra requirements for actions code, if necessary (uncomment next line) +# RUN pip install -r requirements-actions.txt + +# Copy actions folder to working directory +FROM rasa/rasa:1.9.4-full +COPY ./actions /app/actions + FROM rasa/rasa:1.9.4-full COPY --from=trainer /app . EXPOSE 5005 diff --git a/bot/actions/__init__.py b/bot/actions/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bot/actions.py b/bot/actions/actions.py similarity index 100% rename from bot/actions.py rename to bot/actions/actions.py diff --git a/bot/actions/requirements-actions.txt b/bot/actions/requirements-actions.txt new file mode 100644 index 0000000..e69de29 diff --git a/bot/resources/boards.json b/bot/actions/resources/boards.json similarity index 100% rename from bot/resources/boards.json rename to bot/actions/resources/boards.json From 7b14dbab743f2d5ba63a6daa9e880345ea5d73a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Thu, 21 May 2020 12:53:20 +0530 Subject: [PATCH 02/12] Update the port of action --- bot/Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bot/Dockerfile b/bot/Dockerfile index 5d99f02..6bb5056 100644 --- a/bot/Dockerfile +++ b/bot/Dockerfile @@ -8,11 +8,13 @@ RUN rasa train # Install extra requirements for actions code, if necessary (uncomment next line) # RUN pip install -r requirements-actions.txt -# Copy actions folder to working directory -FROM rasa/rasa:1.9.4-full -COPY ./actions /app/actions - FROM rasa/rasa:1.9.4-full COPY --from=trainer /app . EXPOSE 5005 -CMD ["run", "--enable-api"] \ No newline at end of file +CMD ["run", "--enable-api"] + +# Copy actions folder to working directory +FROM rasa/rasa:1.9.4-full +COPY ./actions /app/actions +EXPOSE 5055 +CMD ["run actions"] \ No newline at end of file From 54f209f66818b76fe989ba9a2896812bfb404fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Wed, 27 May 2020 14:59:19 +0530 Subject: [PATCH 03/12] Action server Image file changes --- bot/Dockerfile | 14 +------------- bot/DockerfileActionServer | 14 ++++++++++++++ bot/{ => actions}/resources/grades.json | 0 bot/{ => actions}/resources/mediums.json | 0 4 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 bot/DockerfileActionServer rename bot/{ => actions}/resources/grades.json (100%) rename bot/{ => actions}/resources/mediums.json (100%) diff --git a/bot/Dockerfile b/bot/Dockerfile index 6bb5056..74bf4cc 100644 --- a/bot/Dockerfile +++ b/bot/Dockerfile @@ -2,19 +2,7 @@ FROM rasa/rasa:1.9.4-full as trainer COPY . /app RUN rasa train -# Copy any additional custom requirements, if necessary (uncomment next line) -# COPY actions/requirements-actions.txt ./ - -# Install extra requirements for actions code, if necessary (uncomment next line) -# RUN pip install -r requirements-actions.txt - FROM rasa/rasa:1.9.4-full COPY --from=trainer /app . EXPOSE 5005 -CMD ["run", "--enable-api"] - -# Copy actions folder to working directory -FROM rasa/rasa:1.9.4-full -COPY ./actions /app/actions -EXPOSE 5055 -CMD ["run actions"] \ No newline at end of file +CMD ["run", "--enable-api"] \ No newline at end of file diff --git a/bot/DockerfileActionServer b/bot/DockerfileActionServer new file mode 100644 index 0000000..e415ff8 --- /dev/null +++ b/bot/DockerfileActionServer @@ -0,0 +1,14 @@ +FROM rasa/rasa:1.9.4-full as trainer +COPY . /app + +# Copy any additional custom requirements, if necessary (uncomment next line) +# COPY actions/requirements-actions.txt ./ + +# Change back to root user to install dependencies +# USER root + +# Install extra requirements for actions code, if necessary (uncomment next line) +# RUN pip install -r requirements-actions.txt + +# Copy actions folder to working directory +COPY ./actions /app/actions \ No newline at end of file diff --git a/bot/resources/grades.json b/bot/actions/resources/grades.json similarity index 100% rename from bot/resources/grades.json rename to bot/actions/resources/grades.json diff --git a/bot/resources/mediums.json b/bot/actions/resources/mediums.json similarity index 100% rename from bot/resources/mediums.json rename to bot/actions/resources/mediums.json From 212dd45556dcb48af9c4aaceaf719ebb9132e776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Wed, 27 May 2020 20:19:48 +0530 Subject: [PATCH 04/12] Seprate container for rasa run action server --- bot/DockerfileActionServer | 13 +------------ bot/{actions => }/actions.py | 0 bot/actions/__init__.py | 0 bot/actions/requirements-actions.txt | 0 bot/{actions => }/resources/boards.json | 0 bot/{actions => }/resources/grades.json | 0 bot/{actions => }/resources/mediums.json | 0 7 files changed, 1 insertion(+), 12 deletions(-) rename bot/{actions => }/actions.py (100%) delete mode 100644 bot/actions/__init__.py delete mode 100644 bot/actions/requirements-actions.txt rename bot/{actions => }/resources/boards.json (100%) rename bot/{actions => }/resources/grades.json (100%) rename bot/{actions => }/resources/mediums.json (100%) diff --git a/bot/DockerfileActionServer b/bot/DockerfileActionServer index e415ff8..5a69365 100644 --- a/bot/DockerfileActionServer +++ b/bot/DockerfileActionServer @@ -1,14 +1,3 @@ FROM rasa/rasa:1.9.4-full as trainer COPY . /app - -# Copy any additional custom requirements, if necessary (uncomment next line) -# COPY actions/requirements-actions.txt ./ - -# Change back to root user to install dependencies -# USER root - -# Install extra requirements for actions code, if necessary (uncomment next line) -# RUN pip install -r requirements-actions.txt - -# Copy actions folder to working directory -COPY ./actions /app/actions \ No newline at end of file +CMD ["run", "actions"] \ No newline at end of file diff --git a/bot/actions/actions.py b/bot/actions.py similarity index 100% rename from bot/actions/actions.py rename to bot/actions.py diff --git a/bot/actions/__init__.py b/bot/actions/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/bot/actions/requirements-actions.txt b/bot/actions/requirements-actions.txt deleted file mode 100644 index e69de29..0000000 diff --git a/bot/actions/resources/boards.json b/bot/resources/boards.json similarity index 100% rename from bot/actions/resources/boards.json rename to bot/resources/boards.json diff --git a/bot/actions/resources/grades.json b/bot/resources/grades.json similarity index 100% rename from bot/actions/resources/grades.json rename to bot/resources/grades.json diff --git a/bot/actions/resources/mediums.json b/bot/resources/mediums.json similarity index 100% rename from bot/actions/resources/mediums.json rename to bot/resources/mediums.json From a7bcb55fbbf5539b4accfd7f51663b59b784760c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Wed, 27 May 2020 21:00:30 +0530 Subject: [PATCH 05/12] Wrong Indentation --- bot/actions.py | 98 -------------------------------------------------- 1 file changed, 98 deletions(-) delete mode 100644 bot/actions.py diff --git a/bot/actions.py b/bot/actions.py deleted file mode 100644 index f333630..0000000 --- a/bot/actions.py +++ /dev/null @@ -1,98 +0,0 @@ -# This files contains your custom actions which can be used to run -# custom Python code. -# -# See this guide on how to implement these action: -# https://rasa.com/docs/rasa/core/actions/#custom-actions/ - -from typing import Any, Text, Dict, List -from rasa_sdk import Action, Tracker -from rasa_sdk.executor import CollectingDispatcher -from rasa_sdk.forms import FormAction -from rasa_sdk.events import SlotSet -import spacy -import json -# -# -nlp = spacy.load('en_core_web_sm') - -class ActionSubjectCourses(Action): - def name(self) -> Text: - return "action_subject_courses" - - def run(self, dispatcher: CollectingDispatcher, - tracker: Tracker, - domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: - print('running action_subject_courses') - dispatcher.utter_message(template="utter_fetching_data") - print(tracker.latest_message.get('entities')) - elements = [{"type":"subject_courses","entities":tracker.latest_message.get('entities'), "intent" : "subject_courses"}] - dispatcher.utter_message(json_message=elements) - #dispatcher.utter_custom_message(*elements) - #dispatcher.utter_custom_json(elements) - return [] - - -class FallbackAction(Action): - def name(self): - return "fallback_action" - - def run(self, dispatcher, tracker, domain): - intent_ranking = tracker.latest_message.get('intent_ranking', []) - doc = nlp(tracker.latest_message.get('text')) - nouns = [] - adjs = [] - for token in doc: - if token.pos_ == 'NOUN': - nouns.append(token.text) - if token.pos_ == 'ADJ': - adjs.append(token.text) - if len(intent_ranking) > 0 : - elements = [{"type":"low_confidence","entities":nouns, "adj":adjs, "intent" : "low_confidence"}] - dispatcher.utter_message(json_message=elements) - else : - elements = [{"type":"low_confidence","entities":nouns, "adj":adjs, "intent" : "low_confidence"}] - dispatcher.utter_message(json_message=elements) - -class ActionContentForm(FormAction): - def name(self) -> Text: - return "content_form" - - @staticmethod - def required_slots(tracker: Tracker) -> List[Text]: - return ["board","grade", "medium"] - - def submit(self, dispatcher: CollectingDispatcher, - tracker: Tracker, - domain: Dict[Text, Any]) -> List[Dict]: - base_url = "https://diksha.gov.in/explore" - - board = tracker.get_slot('board') - grade = tracker.get_slot('grade') - medium = tracker.get_slot('medium') - - board_url = "?board=" + self.get_board_mapped(board.lower()) - medium_url = "&medium=" + self.get_medium_mapped(medium.lower()) - grade_url = "&gradeLevel=" + self.get_grade_mapped(medium.lower(grade)) - url = base_url + board_url + medium_url + grade_url - - dispatcher.utter_message(text="Great! I understand that you are looking for content of"+ board +"board, class" +grade + medium +"medium .
" - "Please visit: DIKSHA " + board + "
") - return [SlotSet('board', None),SlotSet('grade', None), SlotSet('medium', None)] - - def get_board_mapped(self, board): - data = '' - with open('resources/boards.json') 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: - data = json.load(mediums_values) - return data[medium] - - def get_grade_mapped(self, grade): - data = '' - with open('resources/grades.json') as grades_values: - data = json.load(grades_values) - return data[grade] \ No newline at end of file From 3a5cefcfe8e79f003d038d80c747c2d1b2bdc6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Thu, 28 May 2020 17:56:42 +0530 Subject: [PATCH 06/12] Rasa action server seprate container --- bot/{DockerfileActionServer => action/Dockerfile} | 3 +++ stack.yml | 4 ++++ 2 files changed, 7 insertions(+) rename bot/{DockerfileActionServer => action/Dockerfile} (56%) diff --git a/bot/DockerfileActionServer b/bot/action/Dockerfile similarity index 56% rename from bot/DockerfileActionServer rename to bot/action/Dockerfile index 5a69365..825d2d9 100644 --- a/bot/DockerfileActionServer +++ b/bot/action/Dockerfile @@ -1,3 +1,6 @@ FROM rasa/rasa:1.9.4-full as trainer COPY . /app + +FROM rasa/rasa:1.9.4-full +COPY --from=trainer /app . CMD ["run", "actions"] \ No newline at end of file diff --git a/stack.yml b/stack.yml index cc71a7c..eea98b7 100644 --- a/stack.yml +++ b/stack.yml @@ -10,6 +10,10 @@ services: - "5005:5005" environment: - TMP=TMP + action: + build: + dockerfile: Dockerfile + context: ./bot/action/. router: build: ./router/. ports: From 3d0da756712077ab3eb0fef9293b4f4704700d17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Thu, 28 May 2020 18:01:21 +0530 Subject: [PATCH 07/12] Rasa action server seprate container --- bot/action/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/action/Dockerfile b/bot/action/Dockerfile index 825d2d9..caf76ef 100644 --- a/bot/action/Dockerfile +++ b/bot/action/Dockerfile @@ -3,4 +3,4 @@ COPY . /app FROM rasa/rasa:1.9.4-full COPY --from=trainer /app . -CMD ["run", "actions"] \ No newline at end of file +CMD ["run", "actions"] From e235c3b6ddc8e64ee10dc7ec0b6369f24479e9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Tue, 2 Jun 2020 16:33:26 +0530 Subject: [PATCH 08/12] Rasa action web server DOCKER Container --- bot/{action => actions}/Dockerfile | 3 ++- bot/actions/__init__.py | 0 bot/actions/__pycache__/actions.cpython-36.pyc | Bin 0 -> 4170 bytes bot/{ => actions}/actions.py | 0 bot/actions/requirements-actions.txt | 4 ++++ bot/{ => actions}/resources/boards.json | 0 bot/{ => actions}/resources/grades.json | 0 bot/{ => actions}/resources/mediums.json | 0 stack.yml | 8 ++++---- 9 files changed, 10 insertions(+), 5 deletions(-) rename bot/{action => actions}/Dockerfile (61%) create mode 100644 bot/actions/__init__.py create mode 100644 bot/actions/__pycache__/actions.cpython-36.pyc rename bot/{ => actions}/actions.py (100%) create mode 100644 bot/actions/requirements-actions.txt rename bot/{ => actions}/resources/boards.json (100%) rename bot/{ => actions}/resources/grades.json (100%) rename bot/{ => actions}/resources/mediums.json (100%) diff --git a/bot/action/Dockerfile b/bot/actions/Dockerfile similarity index 61% rename from bot/action/Dockerfile rename to bot/actions/Dockerfile index caf76ef..f8b4ab7 100644 --- a/bot/action/Dockerfile +++ b/bot/actions/Dockerfile @@ -1,6 +1,7 @@ FROM rasa/rasa:1.9.4-full as trainer COPY . /app +RUN python -m spacy link en_core_web_sm en FROM rasa/rasa:1.9.4-full COPY --from=trainer /app . -CMD ["run", "actions"] +CMD ["run", "actions"] \ No newline at end of file diff --git a/bot/actions/__init__.py b/bot/actions/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bot/actions/__pycache__/actions.cpython-36.pyc b/bot/actions/__pycache__/actions.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..df85071de66e35ae455dd2f726ccacbd7c10a0a2 GIT binary patch literal 4170 zcmb_fTaz0{6`uQyw31f4w%0Z|VUj>x0(<4cDF|lmc;hXbgdiYmDygZ0VOHI%m3A(2 zPs_1Y+NbpsRTS@({{Z|S^3bn5Q2d4Dh41u8d-EEv|Bi|o%uJ2UjLgi6tjvz=%!wS6=B?DtyvWP^$k$^#4YFEP(|sqc zXG_tN?z?FtYer4o_tI9>!d@?3j+S|A)Moyn8Ld1rSiov83|8abp&hMaTxUxdFX{0G zj2o)$ zIM|--jKJfAVj@ajf*((CIT3l^#6|Q`OXUGdN%~?Y_FKJZEzuIkWpx5r*GK%rz#&e_ z(_PU7wXVMTvb$Ggyes86P2~r-yIVznlJQ)Y-N8_HKi}Nm?6Tp0xtH90nk4zK`(Q7T zJB7SS&(TGvJHLw+^tSU+xju$2@+9LIh&KzBVNS1}C)YYrL49?0qzL89N>j>XMV1V6 z(ZK#bNl2fILVYdvr|3userTG;%pB<_|10{^m{}uhWHaYbuQB&{Owaw&9+(FX?U*^t zryT=>9=|tzTTJpCzzENO#OT6AN-pAE4$y!sW{FJju7Tv)I87v10bXw?hrEoI&nTc{ zD@Q&bb8!h=D{q)fkYaCRR2F%h@v=+?^cL<|U`;ivo96SXMW>f?L8t5immOEMaF$r1 zYLzN_aIlbat;AzR3mCYeYzVi8PDw9n*n!zF+vb|tu%}nfRSw8|oh22-F{vqzRXvWg zf=yEDH{$roBuT3kVdFs2rYfL{%tDZw1ZiK8(!|?T9YL?^5nEyj6>(qE*1&ApmT8%K z_LQm7N%x8D8mfhj3IR4Wj|DSh zWX;@>eP|q-myHADM3`}4<%^jbt78Ud9L>~c@C%oXSq-I*Jxj22k1fsI%gC89=b>$) z_0hJ_E}>mUOY3cv6&*8uJTiQe^x;dZ)}dBE`)Y6c)*iBi@=kZ25UdZ1r|ZMK%b$%? zBm?3n5MJD%>L#klc?9i5-fy&WBKKob+0_3?tM2YJc)!xx-D%@}t;WyzQ=ZJdIKCSf9Ym=*=OqYy9*=a3AG-Ei6p^$j<|ewvhJ zIJIts(+|SxvT%K4N8I~e%9E0ZPlx4D-U&C7P$mMQ^zQX|Cxwr@9_|Ugd-wXZe*Ip! z^~tZdf3+D-S3=GIMmM>)(bXKnV8~A)T??>T<4Rn`glf}J^AKm`(126;MlRF}EmVvw zRy3^^e?FrpvB)7Veyb+^+LmM9G8ZYr39qqUZSU(ah%?Ah)KIk7_%S-nJg|_S!4&@1KCq<; zV3RReU*NC9?~TumFA)r9=2Z$cc2618OM;h3R{Oj}ZVAAY>y#Q%-c%qoD2GPMNsENR zEOq8Xs8bFlVNtW%5J62C+hwdVA%5$~r&gK}ED_s$pZ6bipn`A#TMBkv93X?LN; zYgXj1k?uAm`|~T(y+(N_4XW2^pN-oTSak4K4fqu~>}Oo=6|Blwb)LFT6grC~KvxOu z&!|Tj67p8ONv8PD!ZoB*=wtT7kGl!JC~G){{e7c)!CXOeHC4= z0+EzST(W)PVW|01D~q{x{*3o0vJjfVsC6_?@wgOZebMsKB%CV#%4vrZx$s;4=f@Be rKcdqq_13A0=IlI?RIpK{{P!rQFE66HqO+xj*)S=ysax%p_ND&;%zDOY literal 0 HcmV?d00001 diff --git a/bot/actions.py b/bot/actions/actions.py similarity index 100% rename from bot/actions.py rename to bot/actions/actions.py diff --git a/bot/actions/requirements-actions.txt b/bot/actions/requirements-actions.txt new file mode 100644 index 0000000..6aeff98 --- /dev/null +++ b/bot/actions/requirements-actions.txt @@ -0,0 +1,4 @@ +python -m spacy download en_core_web_md +python -m spacy download de_core_news_sm +python -m spacy link en_core_web_md +python -m spacy link de_core_news_sm \ No newline at end of file diff --git a/bot/resources/boards.json b/bot/actions/resources/boards.json similarity index 100% rename from bot/resources/boards.json rename to bot/actions/resources/boards.json diff --git a/bot/resources/grades.json b/bot/actions/resources/grades.json similarity index 100% rename from bot/resources/grades.json rename to bot/actions/resources/grades.json diff --git a/bot/resources/mediums.json b/bot/actions/resources/mediums.json similarity index 100% rename from bot/resources/mediums.json rename to bot/actions/resources/mediums.json diff --git a/stack.yml b/stack.yml index eea98b7..0632281 100644 --- a/stack.yml +++ b/stack.yml @@ -3,7 +3,7 @@ services: redis: image: "redis:alpine" ports: - - "6379:6379" + - "6380:6380" bot: build: ./bot/. ports: @@ -11,9 +11,9 @@ services: environment: - TMP=TMP action: - build: - dockerfile: Dockerfile - context: ./bot/action/. + build: + dockerfile: Dockerfile + context: ./bot/actions/. router: build: ./router/. ports: From 2973cf741ab08661590542782b8522d962880d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Tue, 2 Jun 2020 19:29:32 +0530 Subject: [PATCH 09/12] Updated docker file of actions --- bot/actions/Dockerfile | 12 +++++++----- bot/actions/requirements-actions.txt | 4 ---- bot/endpoints.yml | 2 +- stack.yml | 2 ++ 4 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 bot/actions/requirements-actions.txt diff --git a/bot/actions/Dockerfile b/bot/actions/Dockerfile index f8b4ab7..bfc6c07 100644 --- a/bot/actions/Dockerfile +++ b/bot/actions/Dockerfile @@ -1,7 +1,9 @@ -FROM rasa/rasa:1.9.4-full as trainer -COPY . /app -RUN python -m spacy link en_core_web_sm en - FROM rasa/rasa:1.9.4-full -COPY --from=trainer /app . +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 5056 CMD ["run", "actions"] \ No newline at end of file diff --git a/bot/actions/requirements-actions.txt b/bot/actions/requirements-actions.txt deleted file mode 100644 index 6aeff98..0000000 --- a/bot/actions/requirements-actions.txt +++ /dev/null @@ -1,4 +0,0 @@ -python -m spacy download en_core_web_md -python -m spacy download de_core_news_sm -python -m spacy link en_core_web_md -python -m spacy link de_core_news_sm \ No newline at end of file diff --git a/bot/endpoints.yml b/bot/endpoints.yml index efefd89..4c67135 100644 --- a/bot/endpoints.yml +++ b/bot/endpoints.yml @@ -11,7 +11,7 @@ # https://rasa.com/docs/rasa/core/actions/#custom-actions/ action_endpoint: - url: "http://localhost:5055/webhook" + url: "http://localhost:5056/webhook" # Tracker store which is used to store the conversations. # By default the conversations are stored in memory. diff --git a/stack.yml b/stack.yml index 0632281..a78bb56 100644 --- a/stack.yml +++ b/stack.yml @@ -14,6 +14,8 @@ services: build: dockerfile: Dockerfile context: ./bot/actions/. + ports: + - "5056:5056" router: build: ./router/. ports: From e35fedc1a108482b0c2acfef047205beb278560f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Tue, 2 Jun 2020 19:30:54 +0530 Subject: [PATCH 10/12] Updated docker file of actions --- stack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack.yml b/stack.yml index a78bb56..2d5c949 100644 --- a/stack.yml +++ b/stack.yml @@ -3,7 +3,7 @@ services: redis: image: "redis:alpine" ports: - - "6380:6380" + - "6379:6379" bot: build: ./bot/. ports: From a87e2b4e11e458c2654dbcd8d40248d1400a96f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Tue, 2 Jun 2020 22:24:46 +0530 Subject: [PATCH 11/12] Updated docker file of actions --- bot/actions/Dockerfile | 2 +- bot/actions/actions.py | 13 ++++++++++--- bot/endpoints.yml | 2 +- stack.yml | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/bot/actions/Dockerfile b/bot/actions/Dockerfile index bfc6c07..bcedb9b 100644 --- a/bot/actions/Dockerfile +++ b/bot/actions/Dockerfile @@ -5,5 +5,5 @@ 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 5056 +EXPOSE 5055 CMD ["run", "actions"] \ No newline at end of file diff --git a/bot/actions/actions.py b/bot/actions/actions.py index 4b888e1..0f7e296 100644 --- a/bot/actions/actions.py +++ b/bot/actions/actions.py @@ -11,6 +11,7 @@ from rasa_sdk.events import SlotSet import spacy import json +import os.path # # nlp = spacy.load('en_core_web_sm') @@ -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] \ No newline at end of file diff --git a/bot/endpoints.yml b/bot/endpoints.yml index 4c67135..37852ed 100644 --- a/bot/endpoints.yml +++ b/bot/endpoints.yml @@ -11,7 +11,7 @@ # https://rasa.com/docs/rasa/core/actions/#custom-actions/ action_endpoint: - url: "http://localhost:5056/webhook" + url: "http://action:5055/webhook" # Tracker store which is used to store the conversations. # By default the conversations are stored in memory. diff --git a/stack.yml b/stack.yml index 2d5c949..66e903a 100644 --- a/stack.yml +++ b/stack.yml @@ -15,7 +15,7 @@ services: dockerfile: Dockerfile context: ./bot/actions/. ports: - - "5056:5056" + - "5055:5055" router: build: ./router/. ports: From 4e7fc08a2d777eef87bd3386c6f850285ced0e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Tue, 2 Jun 2020 22:30:19 +0530 Subject: [PATCH 12/12] Updated docker file of actions --- bot/actions/actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/actions/actions.py b/bot/actions/actions.py index 0f7e296..ab6748a 100644 --- a/bot/actions/actions.py +++ b/bot/actions/actions.py @@ -11,7 +11,7 @@ from rasa_sdk.events import SlotSet import spacy import json -import os.path +import os.path # # nlp = spacy.load('en_core_web_sm')