I am using rasa x. And access rasa using nodejs APIs.
I have to fill a form so shows list of cities to choose, User has to select a number assigned to each city. This is how i have written an action
class CityRequirementForm(FormAction):
def name(self):
return "city_form"
@staticmethod
def required_slots(tracker: Tracker):
return ["area"]
def slot_mappings(self):
return {
"area": self.from_text()
}
# method to validate the user entered information in the slot
def validate_retailer(
self,
value,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain):
# extract the store lists from the slot
area_list = tracker.get_slot('area_list')
try:
if isinstance(int(value),int):
if int(value) > len(retailer_detail_list):
dispatcher.utter_message(template='utter_invalid_area')
return {'area': None}
else:
return {'area': value}
except Exception as err:
dispatcher.utter_message(template='utter_invalid_area')
return {'area': None}
I return the area as None
of user does not select the number from the given list or type something else.
This works on Rasa X ui perfectly. If I check the response of rasa in network tab, there are list of 2 messages. First one is actual message utter_invalid_area
and second is the slot message that form is realted with (“Choose the city… list of cities”).
In NOdejs Apis I am appending the responses for a certain reason, but in this case second message is use less to me,
Is there any way to trim the second message? Or any other approach to achieve the same?