Hi am trying to implement feedback from the user in rasa 1.10. Using forms If the user feedback is less than 3 bot will ask for feedback comments. If user feedback is greater than 3 bot will end with thank you note.
How can I capture the dynamic slot of free text if get the rating less than 3 in validation method user comments Below is snippet @Juste
FormGetRating(FormAction): “”" Feedback Rating “”"
def name(self) -> Text: """Unique identifier of the form""" return "feedback_form" @staticmethod def required_slots(tracker: Tracker) -> List[Text]: """A list of required slots that the form has to fill""" return ["rating"] def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]: """A dictionary to map required slots to - an extracted entity - intent: value pairs - a whole message or a list of them, where a first match will be picked""" return { "rating": [ self.from_entity(entity="rating"), self.from_text(intent="rating_value"), ], } def validate_rating(self, value: Text, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any], ) -> Dict[Text, Any]: if value != None: rating = int(value) logger.info("User rating : {}".format(rating)) if (1 <= rating < 3): dispatcher.utter_message(template="utter_feedback_comments") elif(3 <= rating <= 5): dispatcher.utter_message(template="utter_thanks_feedback") else: dispatcher.utter_message(template="utter_invalid_rating") return {"rating": rating} def submit(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any],) -> List[Dict]: """Define what the form has to do after all required slots are filled""" return []