From cc439a1abe39698118a398fc162c19fdb2677d76 Mon Sep 17 00:00:00 2001 From: Ella Date: Tue, 1 Oct 2019 14:25:17 +0200 Subject: [PATCH] remove kwargs from default channel implementation send methods --- CHANGELOG.rst | 1 + rasa/core/channels/channel.py | 19 +++++++------------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 65595f9de583..c3d7e4bf407c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,7 @@ Fixed ----- - Fixed error ``Object of type 'MaxHistoryTrackerFeaturizer' is not JSON serializable`` when running ``rasa train core`` +- Default channel ``send_`` methods no longer support kwargs as they caused issues in incompatible channelss [1.3.7] - 2019-09-27 ^^^^^^^^^^^^^^^^^^^^ diff --git a/rasa/core/channels/channel.py b/rasa/core/channels/channel.py index 483b94e23ec5..cb9c1b0f5bba 100644 --- a/rasa/core/channels/channel.py +++ b/rasa/core/channels/channel.py @@ -197,16 +197,14 @@ async def send_image_url( ) -> None: """Sends an image. Default will just post the url as a string.""" - await self.send_text_message(recipient_id, "Image: {}".format(image), **kwargs) + await self.send_text_message(recipient_id, "Image: {}".format(image)) async def send_attachment( self, recipient_id: Text, attachment: Text, **kwargs: Any ) -> None: """Sends an attachment. Default will just post as a string.""" - await self.send_text_message( - recipient_id, "Attachment: {}".format(attachment), **kwargs - ) + await self.send_text_message(recipient_id, "Attachment: {}".format(attachment)) async def send_text_with_buttons( self, @@ -219,10 +217,10 @@ async def send_text_with_buttons( Default implementation will just post the buttons as a string.""" - await self.send_text_message(recipient_id, text, **kwargs) + await self.send_text_message(recipient_id, text) for idx, button in enumerate(buttons): button_msg = cli_utils.button_to_string(button, idx) - await self.send_text_message(recipient_id, button_msg, **kwargs) + await self.send_text_message(recipient_id, button_msg) async def send_quick_replies( self, @@ -235,7 +233,7 @@ async def send_quick_replies( Default implementation will just send as buttons.""" - await self.send_text_with_buttons(recipient_id, text, quick_replies, **kwargs) + await self.send_text_with_buttons(recipient_id, text, quick_replies) async def send_elements( self, recipient_id: Text, elements: Iterable[Dict[Text, Any]], **kwargs: Any @@ -244,15 +242,12 @@ async def send_elements( Default implementation will just post the elements as a string.""" - # we can't pass the empty "buttons" key of the message through to send_text_with_buttons() - kwargs.pop("buttons", None) - for element in elements: element_msg = "{title} : {subtitle}".format( title=element.get("title", ""), subtitle=element.get("subtitle", "") ) await self.send_text_with_buttons( - recipient_id, element_msg, element.get("buttons", []), **kwargs + recipient_id, element_msg, element.get("buttons", []) ) async def send_custom_json( @@ -262,7 +257,7 @@ async def send_custom_json( Default implementation will just post the json contents as a string.""" - await self.send_text_message(recipient_id, json.dumps(json_message), **kwargs) + await self.send_text_message(recipient_id, json.dumps(json_message)) class CollectingOutputChannel(OutputChannel):