Spaces:
Runtime error
Runtime error
Update actions/actions.py
Browse files- actions/actions.py +60 -1
actions/actions.py
CHANGED
@@ -61,4 +61,63 @@ 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 and last_intent.lower() in ['local chapter', 'local chapters']:
|
81 |
+
dispatcher.utter_message(template="utter_join_chapter")
|
82 |
+
else:
|
83 |
+
dispatcher.utter_message(template=utter_apology_Q_prompt)
|
84 |
+
|
85 |
+
|
86 |
+
class ActionEligibilityClassify(Action):
|
87 |
+
|
88 |
+
def name(self) -> Text:
|
89 |
+
return "action_eligibility_classify"
|
90 |
+
|
91 |
+
def run(self,
|
92 |
+
dispatcher: CollectingDispatcher,
|
93 |
+
tracker: Tracker,
|
94 |
+
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
|
95 |
+
|
96 |
+
# Get the value of the latest intent
|
97 |
+
last_intent = tracker.slots.get("local_chapter", None)
|
98 |
+
|
99 |
+
# Check if the last intent was 'local_chapter'
|
100 |
+
if last_intent and last_intent.lower() in ['local chapter', 'local chapters']:
|
101 |
+
dispatcher.utter_message(template="utter_local_chapter_participation_eligibility")
|
102 |
+
else:
|
103 |
+
dispatcher.utter_message(template=utter_apology_Q_prompt)
|
104 |
+
|
105 |
+
|
106 |
+
class ActionCostClassify(Action):
|
107 |
+
|
108 |
+
def name(self) -> Text:
|
109 |
+
return "action_cost_classify"
|
110 |
+
|
111 |
+
def run(self,
|
112 |
+
dispatcher: CollectingDispatcher,
|
113 |
+
tracker: Tracker,
|
114 |
+
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
|
115 |
+
|
116 |
+
# Get the value of the latest intent
|
117 |
+
last_intent = tracker.slots.get("local_chapter", None)
|
118 |
+
|
119 |
+
# Check if the last intent was 'local_chapter'
|
120 |
+
if last_intent and last_intent.lower() in ['local chapter', 'local chapters']:
|
121 |
+
dispatcher.utter_message(template="utter_local_chapter_cost")
|
122 |
+
else:
|
123 |
+
dispatcher.utter_message(template=utter_apology_Q_prompt)
|