In form, I write utter_ask_
with button, but when I use interactive learning I have to write my own message. Can anyone help ?
class ConfirmForm(FormAction): “”“Let the user confirm if the captured entities are correct”“”
def name(self) -> Text: return "confirm_form" @staticmethod def required_slots(tracker: Tracker) -> List[Text]: return ["yn_cal_fee", "entities_correct"] def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]: return { "yn_cal_fee": [ self.from_intent(intent = "affirm", value = True), self.from_intent(intent = "deny", value = False), ], "entities_correct": [ self.from_intent(intent = "affirm", value = True), self.from_intent(intent = "deny", value = False), ], } def validate_yn_cal_fee( self, value: Text, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any] ) -> Any: if value == False: return {"yn_cal_fee": value, "entities_correct": False} else: send_address = tracker.get_slot("send_address") receive_address = tracker.get_slot("receive_address") weight = tracker.get_slot("weight") print(send_address, receive_address, weight) if send_address != None or receive_address != None or weight != None: dispatcher.utter_message("Bot đã ghi nhận những thông tin sau:") if send_address != None: dispatcher.utter_message("- Địa chỉ gửi là: {}".format(send_address)) if receive_address != None: dispatcher.utter_message("- Địa chỉ nhận là: {}".format(receive_address)) if weight != None: dispatcher.utter_message("- Khối lượng hàng hóa là: {}kg".format(float(weight/1000))) return {"yn_cal_fee": value} else: return {"yn_cal_fee": value, "entities_correct": False}
with button
utter_ask_yn_cal_fee:
- text: “Nếu quý khách muốn bot giúp tính phí giao hàng ‘mặc định’ một cách chi tiết, vui lòng cung cấp thêm thông tin đơn hàng.” buttons:
- title: “tính chi tiết.” payload: True
- title: “không cần.” payload: False