In the forms, after filling in all the entities, end the dialogue, ask again how to make the entities empty and fill in again.
like this:
user: i want to order a hotel.
bot: please input the location.
user: *****
bot: please confirm the location : *****
user: Yes
bot: Finish!
user: i want to order a hotel.
bot: please confirm the location: ***** (Now it’s like this)
bot: please input the location. (i hope so)
when using the SlotSet(“location”,None),the bot responds to me “please confirm the location: None”. I don’t hope the reply is None. How can I edit the custom formaction, please?
you can create a custom action that checks the value of slot (None or others) and based on it calls the next action i.e. if None is slot value then call ask location details, else ask to confirm.
def required_slots(tracker):
if getSlot(‘location’) and getSlot(‘affirm’):
setSlot(‘location’,None)
setSlot(‘affirm’,None)
return [‘location’,‘affirm’]
Step 1:- First it checks the condition, that is whether the location and affirm slots are filled or not, if not it requests the user to fill location slot.
Step 2:- Checks the condition, that is whether the location and affirm slots are filled or not, location slot already filled in the above step, now bot requests the user to fill affirm slot.
Step 3:- This time it went through the condition because all slots filled and inside the condition, we are again assigning all slots values to none, because all slot values are None again it bot will request the user to fill slot values again.
This is my Formaction:
class FormActionBookHotel(FormAction):
def name(self):
return “form_action_book_hotel”
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
"""A list of required slots that the form has to fill"""
return ["location", "date"]
def submit(self, dispatcher: CollectingDispatcher, tracker: Tracker,
domain: Dict[Text, Any], ) -> List[Dict]:
return []
Thanks everyone.
return [AllSlotsReset()],
return{“location”: None , “affirm”: None}
I tried the above ways.
e.g.
request two slots: location,time
utter_confirm_values: please confirm the values: location:{location} time:{time}
def submit():
dispatcher.utter_template(“utter_confirm_values”, tracker)
return[AllSlotReset()]
the result: please confirm the values: location:*** time:None
the reply I want: please confirm the values: location:*** time:***
this way is well: dispatcher.message(“please confirm the values: location:{} time:{}”.format(tracker.get_slot……))
I don’t know the reason.
@MagicMoGua that seems like your time slot is not filled. This information is not clear to identify the error. If you have given the time for asked question and still it is not identifying the time you can refer the log file to see whether the entity and slot has been identified correctly. If so that is something wrong with your formaction class. I suggest to refer logs and understand what is happening inside.