Hello Gays, I have a problem with slot mapping in forms. here I have two slots in signup form The both slots are storing same values
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)]
def slot_mappings(self):
# type: () -> Dict[Text: Union[Dict, List[Dict]]]
return { "log_emp_id":
[self.from_entity(entity="log_emp_id"),
self.from_intent(intent='log emp id')],
"log_otp":
[self.from_entity(entity="log_otp"),
self.from_intent(intent='log otp')]}
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_show_login_msg")
Emp_Sign_id = tracker.get_slot('log_emp_id')
Log_Otp = tracker.get_slot('log_otp')
stories.yml
story: Leave Application
steps:
-
intent: greet
-
action: utter_greet
-
action: Sign_form
-
active_loop: Sign_form
-
active_loop: null
-
action: action_Sign_submit
forms:
Sign_form:
log_emp_id:
- type: from_entity
entity: log_emp_id
intent: log emp id
- type: from_text
log_otp:
- type: from_entity
entity: log_otp
intent: log otp
- type: from_text