Sleep method not working between utter_greet and action_greet

This is my stories.yml file:

  • story: greet
  • intent: greet
  • action: utter_greet
  • action: action_greet

This is my file:

class ActionGreetUser(Action):
def name(self) -> Text:
    return "action_greet"
async def run(
    dispatcher: CollectingDispatcher,
    tracker: Tracker,
    domain: Dict[Text, Any],
) -> List[EventType]:
    dispatcher.utter_message(text = "Mid way")
    dispatcher.utter_message(template= "utter_func")

    return []

My output flow:

  • Sleep for 5 seconds
  • utter_greet output
  • Mid way
  • utter_func output

Actual output flow:

  • utter_greet output
  • Sleep for 5 seconds
  • Mid way
  • utter_func output

What changes should I make to make this work fine?

@sauravjoshi23 This doesn’t work as the action server is synchronous which means it will return all responses after 5 seconds to Rasa Open Source. In general this won’t work with a synchronous channel like REST as synchronous channels will always collect all answers before coming back to the user. In my opinion the best way would to do this would be in the frontend.

1 Like

Thanks for the reply @Tobias_Wochinger. Yes I made changes to the frontend rendering part and it worked!!!