Hello Gays, I have a problem for defining forms inside stories.yml. Last time I was activating forms inside rules.yml. but now I need to active forms inside stories
Stories.yml:
-
story: sign up path
steps:
-
intent: greet
-
action: utter_ask_log_emp_id
-
active_loop: Sign_form
-
intent: log emp id
-
action: utter_show_welcome
-
intent: log otp
-
action: utter_emp_login_msg
-
action: action_deactivate_loop
-
active_loop: null
-
action: action_Sign_submit
-
Action.py :
class ValidateSignForm(Action):
def name(self) -> Text:
return "Sign_form"
def run(
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
) -> List[EventType]:
required_slots = ["log_emp_id", "log_otp"]
for slot_name in required_slots:
if tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
return [SlotSet("requested_slot", slot_name)]
# All slots are filled.
return [SlotSet("requested_slot", None)]
class ActionSignSubmit(Action):
def name(self) -> Text:
return "action_Sign_submit"
def run(
self,
dispatcher,
tracker: Tracker,
domain: "DomainDict",
) -> List[Dict[Text, Any]]:
dispatcher.utter_message(template="utter_emp_login_msg",
Emp_Sign_id = tracker.get_slot('log_emp_id'),
Log_Otp = tracker.get_slot('log_otp'))