From 93e180882b619b4e15687ad2ae1c5a1c7372c7fd Mon Sep 17 00:00:00 2001 From: Philippe Cote-Boucher Date: Thu, 23 Jul 2020 14:30:36 -0400 Subject: [PATCH] use output_channel of externally triggered intent as input_channel --- rasa/core/events/__init__.py | 5 ++++- rasa/core/processor.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/rasa/core/events/__init__.py b/rasa/core/events/__init__.py index 1083562bdfe1..b4fb97fb72d4 100644 --- a/rasa/core/events/__init__.py +++ b/rasa/core/events/__init__.py @@ -340,13 +340,16 @@ def apply_to(self, tracker: "DialogueStateTracker") -> None: @staticmethod def create_external( - intent_name: Text, entity_list: Optional[List[Dict[Text, Any]]] = None + intent_name: Text, + entity_list: Optional[List[Dict[Text, Any]]] = None, + input_channel: Optional[Text] = None, ) -> "UserUttered": return UserUttered( text=f"{EXTERNAL_MESSAGE_PREFIX}{intent_name}", intent={"name": intent_name}, metadata={IS_EXTERNAL: True}, entities=entity_list or [], + input_channel=input_channel, ) diff --git a/rasa/core/processor.py b/rasa/core/processor.py index 7dc842b44b33..caa84c8ad003 100644 --- a/rasa/core/processor.py +++ b/rasa/core/processor.py @@ -408,7 +408,11 @@ async def trigger_external_user_uttered( f"Invalid entity specification: {entities}. Assuming no entities." ) entity_list = [] - tracker.update(UserUttered.create_external(intent_name, entity_list)) + tracker.update( + UserUttered.create_external( + intent_name, entity_list, input_channel=output_channel.name() + ) + ) await self._predict_and_execute_next_action(output_channel, tracker) # save tracker state to continue conversation from this state self._save_tracker(tracker)