I’m new to the Rasa community and I’ve been practicing the development of a chatbot. I’ve come across an issue regarding the handling of repeated requests. I would like the bot to automatically check the user’s input intents, and if 3 requests refer to the same intent, along with the response, a predefined message like “For further information, contact me at email…” would be added. Is it possible to implement a similar functionality?
Thank you for the response, I’m conducting tests using the guide you sent me, and everything seems to be working. While researching online, I also found the option to manage everything through actions. Which one do you recommend using?
this is the action:
class CheckLastIntentsAction(Action):
def name(self) → Text:
return “action_check_last_intents”
def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
all_user_intents = [event['parse_data']['intent']['name'] for event in tracker.events if event['event'] == 'user']
last_three_intents = all_user_intents[-3:]
if len(last_three_intents) == 3 and len(set(last_three_intents)) == 1:
print("repeated.")
response = """
"""
dispatcher.utter_message(response)
else:
print(" OK.")
return []