Message before action appears after

Hi all, I have a custom action that takes some time. I want to tell the user to expect to wait so I create an utterance (utter_wait) and then execute the action. However, in rasa x, the utterance action doesn’t execute until after the custom action has completed, which defeats the point. Is there any way to force it to do the first action before the second?

FYI here’s my story:

stories:
- story: analyze my story
  steps:
  - intent: greet
  - action: utter_greet
  - intent: checkanalysis
  - action: utter_articleanalysis
  - intent: help
  - action: utter_gdochelp
  - intent: gdriveurl
  - action: utter_read_aa
  - action: action_check_analysis
  - action: utter_anything_else
2 Likes

Could you break these down into two actions?

The first action_wait would dispatch a message asking the user to wait (something like dispatcher.utter_message(template="utter_wait") and then return a followup action to run using FollowupAction(name="action_that_takes_a_long_time_to_perform") from the rasa_sdk.events.

By the way, why does this action take such a long time to run?

Hi Shorouq, Thanks for the suggestion, I’ll try that. The action reviews a document for spelling and grammar mistakes as well as checking for various components in the document. It just takes about 30 seconds to run. But that’s a long time to stare a bot not talking to you!

1 Like

That makes sense! Good luck and let me know if it worked.

No, sadly that didn’t work. I tried both returning it as a followup action and as just a second action in the story. It still doesn’t seem to output anything until it hits an action_listen. Any other ideas?

Why not just define a response asking the user to wait, and call it before your custom action?

1 Like

I have that, it doesn’t appear until action_listen is called. So it doesn’t come up until after the action has run. The only way I can get it to appear at this point is to say “This will take a long time, continue” and then have two buttons. once the listen action occurs the message appears witing for the affirm intent, the message displays.

That is weird. If you posted your stories and domain files I might be able to help you more. Right now I’m having trouble following. What do you mean by “it doesn’t appear until action_listen is called?”

1 Like

Do you mean that both two actions only run together at the same time, and not one before the other (as they should)? Does that also happen if you try it in Rasa shell?