Skip to content

Commit

Permalink
Merge branch 'main' into restart_dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
nelealbers authored May 15, 2023
2 parents e835ac8 + d473c14 commit b85e1ad
Show file tree
Hide file tree
Showing 16 changed files with 3,307 additions and 52 deletions.
37 changes: 0 additions & 37 deletions Rasa_Bot/actions/actions_preparation_dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from rasa_sdk.events import SlotSet
from virtual_coach_db.helper.definitions import Components


### Slot-setting methods called for rasa to store current intervention component


Expand Down Expand Up @@ -44,39 +43,3 @@ def name(self):
async def run(self, dispatcher, tracker, domain):
return [SlotSet("current_intervention_component",
Components.TRACK_BEHAVIOR)]


class SetSlotColdTurkey(Action):
def name(self):
return "action_set_slot_cold_turkey"

async def run(self, dispatcher, tracker, domain):
return [SlotSet("current_intervention_component",
Components.COLD_TURKEY)]


class SetSlotPlanQuitStartDate(Action):
def name(self):
return "action_set_slot_plan_quit_start_date"

async def run(self, dispatcher, tracker, domain):
return [SlotSet("current_intervention_component",
Components.PLAN_QUIT_START_DATE)]


class SetSlotMentalContrasting(Action):
def name(self):
return "action_set_slot_mental_contrasting"

async def run(self, dispatcher, tracker, domain):
return [SlotSet("current_intervention_component",
Components.FUTURE_SELF)]


class SetSlotGoalSetting(Action):
def name(self):
return "action_set_slot_goal_setting"

async def run(self, dispatcher, tracker, domain):
return [SlotSet("current_intervention_component",
Components.GOAL_SETTING)]
56 changes: 56 additions & 0 deletions Rasa_Bot/actions/actions_relapse_dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,62 @@ async def run(self, dispatcher, tracker, domain):
return [SlotSet('one_or_two_slot', None)]


class ActionSetSlotSmokeOrPa1(Action):
def name(self):
return "action_set_slot_smoke_or_pa_1"

async def run(self, dispatcher, tracker, domain):
return [SlotSet('smoke_or_pa', 1)]

class ActionSetSlotSmokeOrPa2(Action):
def name(self):
return "action_set_slot_smoke_or_pa_2"

async def run(self, dispatcher, tracker, domain):
return [SlotSet('smoke_or_pa', 2)]

class ActionSetSlotsCraveLapseRelapse1(Action):
def name(self):
return "action_set_slot_crave_lapse_relapse_1"

async def run(self, dispatcher, tracker, domain):
return [SlotSet('crave_lapse_relapse', 1)]


class ActionSetSlotCraveLapseRelapse2(Action):
def name(self):
return "action_set_slot_crave_lapse_relapse_2"

async def run(self, dispatcher, tracker, domain):
return [SlotSet('crave_lapse_relapse', 2)]

class ActionSetSlotCraveLapseRelapse3(Action):
def name(self):
return "action_set_slot_crave_lapse_relapse_3"

async def run(self, dispatcher, tracker, domain):
return [SlotSet('crave_lapse_relapse', 3)]

class ActionResetSlotCraveLapseRelapse(Action):
def name(self):
return "action_reset_slot_crave_lapse_relapse"

async def run(self, dispatcher, tracker, domain):
return {"crave_lapse_relapse": None}


class ActionSetSlotWeeklyOrRelapse(Action):
def name(self):
return "action_set_slot_weekly_or_relapse"

async def run(self, dispatcher, tracker, domain):
intervention_component = tracker.get_slot('current_intervention_component')

if intervention_component == Components.WEEKLY_REFLECTION:
return [SlotSet('weekly_or_relapse', 2)]

return [SlotSet('weekly_or_relapse', 1)]

class ActionSetSlotRelapseDialog(Action):
def name(self):
return "action_set_slot_relapse_dialog_hrs"
Expand Down
3 changes: 3 additions & 0 deletions Rasa_Bot/actions/actions_watching_a_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,6 @@ async def run(self, dispatcher, tracker, domain):
# resumes the relapse dialog opening the ehbo_me_self_lapse_form.
# The flow will then depend on the chosen option in the form
return [FollowupAction('ehbo_me_self_lapse_form')]
if current_dialog == Components.WEEKLY_REFLECTION:
# resumes weekly reflection from possible_smoking_situations_form.
return [FollowupAction('possible_smoking_situations_form')]
Loading

0 comments on commit b85e1ad

Please sign in to comment.