I am having issues with handling user interruptions the bot will work fine but after it is interrupted it will not go back to where it was interrupted it goes to the next step in the conversation. Here is the action I am using for the interruption. Any help would be most welcome thanks.
def name(self) -> Text:
return "action_handle_interruption"
async def run(
self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
last_user_intent = tracker.latest_message["intent"].get("name")
in_help_flow = tracker.get_slot('in_help_flow')
reversed_events = list(reversed(tracker.events))
response = " Would you like to continue from where you left off?"
elements = create_assistant_response(
tracker=tracker, response=response, route_to_corti=True
)
dispatcher.utter_message(json_message=elements)
if last_user_intent == "user_interruption" and in_help_flow:
last_user_event_index = None
for i, event in enumerate(reversed_events):
if event.get("event") == "user":
last_user_event_index = i
break
if last_user_event_index is not None:
return [UserUtteranceReverted(last_user_event_index + 1), SlotSet("in_help_flow", False)]
dispatcher.utter_message(text="I'm not sure where we left off. How can I assist you?")
return [SlotSet("in_help_flow", False)]
dispatcher.utter_message(text="I'm not sure where we left off. How can I assist you?")
return [SlotSet("in_help_flow", False)]