Hello all,
I have a custom action that have access to a rasa.core.agent.Agent object. This agent is used like this:
async def run(self, dispatcher: CollectingDispatcher, tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
user_message = tracker.latest_message['text']
responses = await bot.handle_text(text_message=user_message, sender_id=tracker.sender_id)
The responses are then manually handled because the handle_text method uses its default CollectingOutputChannel
. The thing is I don’t want to handle these responses manually, I want to pass a specific output_channel to handle_text method. This OutputChannel should be the same as the one that would be used if I did a simple dispatcher.utter_message() inside the run(…) method of my custom action. How can I get the OutputChannel of my custom action for passing it to the handle_text method?
The perfect scenario for me would be to use something like the following run() template:
async def run(
self,
output_channel: "OutputChannel",
nlg: "NaturalLanguageGenerator",
tracker: "DialogueStateTracker",
domain: "Domain",
) -> List[Event]:
Because then I could solve my issue like this:
async def run(
self,
output_channel: "OutputChannel",
nlg: "NaturalLanguageGenerator",
tracker: "DialogueStateTracker",
domain: "Domain",
) -> List[Event]:
user_message = tracker.latest_message['text']
responses = await bot.handle_text(text_message=user_message,
output_channel=output_channel,
sender_id=tracker.sender_id)
return
However, I can’t use that run() template including the output_channel parameter because of the same issue reported here: Are 2.0 docs obsolete for customising 'action_session_start'?
Does anyone know how could I solve this?
Btw, I’m using the rasa-webchat widget from botfront, which connects with my rasa backend on :5005/webhook.