Rasa Server + Front End with REST API

Hi, I am using @JiteshGaikwad’s UI widget with rasa open-source with REST channel.

In my story, I have a form which

  1. asks 2 details from the user
  2. prints a statement (using dispatcher in the submit part of the form)\
  3. An utterance
  4. A custom action for an API Call (This takes 3-4 seconds)
  5. Display result from API Call.

In the UI, I should be getting statements one after the other but the statements of steps 3 to 6 are displaying at once after the time delay of API Call. I checked the console and I am receiving all messages together at once from the rasa server. How to fix this?

I took a look at the UI widget you’re using - it is using Rasa’s REST API. This means, that it will use an HTTP Post operation to send the user message to the chatbot - and takes a fully compiled list of all the chatbot responses with it. There’s no way for the chatbot to “report back” by itself once a single response is ready.

You can fix this by using Rasa’s WebSocket API instead - unfortunetly, @JiteshGaikwad 's UI widget doesn’t support this. You can use Botfront’s Rasa-Webchat instead.

Hi @sugarshock. Thank you for your time. I was assuming I had to modify the way the incoming messages are parsed in the UI i.e, in script.js. Please correct me if my understanding is wrong. Like you suggested, I will try using sockets and see.

Well, you could add some custom delay time in the parsing of the messages in the script.js. But these will only add on top of the processing of the API call. Your first “please wait” utterance will still only appear once the whole API query has gone through.

As I said, for real time bot message forwarding, you’ll need a more fundamental change - the HTTP/REST just won’t do it.

—> Use the sockets