How to force dispatcher to display utter_message

Hi,

I’v got an issue with a fallback action. In my action.py file Fallback function raise a callback function, and with the dispatcher I try to display a new message, but it seems that rasa stack is in wrong state for that. Do you think there is a way to force rasa stack to process this message ?

class ActionFallback(Action):
 def __init__(self):
    self.dic = {}

def name(self):
    return 'action_fallback'

def process_reply(self,msg_id):
    """
    Callback to use when receiving a reply
    """
    json_reply = self.rpc_client.read_message(msg_id)
    dispatcher = self.dic[msg_id]
    dispatcher.utter_message(json.dumps(json_reply ))
    /..../

   return[]

Mhm, good question! Where does the dispatcher object in process_reply come from or how do you store it?

Things how could handle this:

  • make the call synchronous
  • you can schedule a event (see Events) which gets the answer and then notifies the user