rasa/core/training/interactive.py
async def _undo_latest(sender_id: Text,
                       endpoint: EndpointConfig) -> None:
    """Undo either the latest bot action or user message, whatever is last."""

    tracker = await retrieve_tracker(endpoint, sender_id, EventVerbosity.ALL)

    cutoff_index = None
    for i, e in enumerate(reversed(tracker.get("events", []))):
        if e.get("event") in {ActionExecuted.type_name, UserUttered.type_name}:
            cutoff_index = i
            break
        elif e.get("event") == Restarted.type_name:
            break

    if cutoff_index is not None:
        events_to_keep = tracker["events"][:-(cutoff_index + 1)]

        # reset the events of the conversation to the events before
        # the most recent bot or user event
        await replace_events(endpoint, sender_id, events_to_keep)
Undo either the latest bot action or user message, whatever is last.
Undo either the latest bot action or user message, whatever is last.
Undo either the latest bot action or user message whatever is last .
async def _undo_latest(sender_id: Text,
                       endpoint: EndpointConfig) -> None:
    tracker = await retrieve_tracker(endpoint, sender_id, EventVerbosity.ALL)
    cutoff_index = None
    for i, e in enumerate(reversed(tracker.get("events", []))):
        if e.get("event") in {ActionExecuted.type_name, UserUttered.type_name}:
            cutoff_index = i
            break
        elif e.get("event") == Restarted.type_name:
            break
    if cutoff_index is not None:
        events_to_keep = tracker["events"][:-(cutoff_index + 1)]
        await replace_events(endpoint, sender_id, events_to_keep)
async def _undo_latest ( sender_id : Text , endpoint : EndpointConfig ) -> None : tracker = await retrieve_tracker ( endpoint , sender_id , EventVerbosity . ALL ) cutoff_index = None for i , e in enumerate ( reversed ( tracker . get ( "events" , [ ] ) ) ) : if e . get ( "event" ) in { ActionExecuted . type_name , UserUttered . type_name } : cutoff_index = i break elif e . get ( "event" ) == Restarted . type_name : break if cutoff_index is not None : events_to_keep = tracker [ "events" ] [ : - ( cutoff_index + 1 ) ] await replace_events ( endpoint , sender_id , events_to_keep )
Undo either the latest bot action or user message, whatever is last.
Undo either the latest bot action or user message whatever is last .
"""Undo either the latest bot action or user message, whatever is last.""" # reset the events of the conversation to the events before # the most recent bot or user event
sender_id
Text
endpoint
EndpointConfig