pvanand commited on
Commit
37fef8c
·
1 Parent(s): 64ec8cd

Update actions/actions.py

Browse files
Files changed (1) hide show
  1. actions/actions.py +65 -1
actions/actions.py CHANGED
@@ -61,4 +61,68 @@ class ResetSlotsAction(Action):
61
  domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
62
  slots_to_reset = ["user_role"] # Add the names of the slots you want to reset
63
  events = [SlotSet(slot, None) for slot in slots_to_reset]
64
- return events
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
62
  slots_to_reset = ["user_role"] # Add the names of the slots you want to reset
63
  events = [SlotSet(slot, None) for slot in slots_to_reset]
64
+ return events
65
+
66
+ class ActionJoinClassify(Action):
67
+
68
+ def name(self) -> Text:
69
+ return "action_join_classify"
70
+
71
+ def run(self,
72
+ dispatcher: CollectingDispatcher,
73
+ tracker: Tracker,
74
+ domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
75
+
76
+ # Get the value of the latest intent
77
+ last_intent = tracker.slots.get("local_chapter", None)
78
+
79
+ # Check if the last intent was 'local_chapter'
80
+ if last_intent == 'local chapter':
81
+ dispatcher.utter_message(template="utter_join_chapter")
82
+ else:
83
+ msg = "I'm sorry, I didnt understand your question, Could you please rephrase?"
84
+ dispatcher.utter_message(text=msg)
85
+
86
+
87
+ class ActionEligibilityClassify(Action):
88
+
89
+ def name(self) -> Text:
90
+ return "action_eligibility_classify"
91
+
92
+ def run(self,
93
+ dispatcher: CollectingDispatcher,
94
+ tracker: Tracker,
95
+ domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
96
+
97
+ # Get the value of the latest intent
98
+ last_intent = tracker.slots.get("local_chapter", None)
99
+
100
+ # Check if the last intent was 'local_chapter'
101
+ if last_intent == 'local chapter':
102
+ dispatcher.utter_message(template="utter_local_chapter_participation_eligibility")
103
+ else:
104
+ msg = "I'm sorry, I didn't understand your question. Could you please rephrase?"
105
+ dispatcher.utter_message(text=msg)
106
+
107
+
108
+ class ActionCostClassify(Action):
109
+
110
+ def name(self) -> Text:
111
+ return "action_cost_classify"
112
+
113
+ def run(self,
114
+ dispatcher: CollectingDispatcher,
115
+ tracker: Tracker,
116
+ domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
117
+
118
+ # Get the value of the latest intent
119
+ last_intent = tracker.slots.get("local_chapter", None)
120
+
121
+ # Check if the last intent was 'local_chapter'
122
+ if last_intent == 'local chapter':
123
+ dispatcher.utter_message(template="utter_local_chapter_cost")
124
+ else:
125
+ msg = "I'm sorry, I didn't understand your question. Could you please rephrase?"
126
+ dispatcher.utter_message(text=msg)
127
+
128
+