From fc04b3e31c465348f5242cfebf2776c0d2309301 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 12 Nov 2019 09:22:28 -0800 Subject: [PATCH] Remove choice word when Almond has choices (#28725) --- homeassistant/components/almond/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/almond/__init__.py b/homeassistant/components/almond/__init__.py index 9977d48ae9a..a1983288f92 100644 --- a/homeassistant/components/almond/__init__.py +++ b/homeassistant/components/almond/__init__.py @@ -243,6 +243,7 @@ class AlmondAgent(conversation.AbstractConversationAgent): """Process a sentence.""" response = await self.api.async_converse_text(text, conversation_id) + first_choice = True buffer = "" for message in response["messages"]: if message["type"] == "text": @@ -257,7 +258,11 @@ class AlmondAgent(conversation.AbstractConversationAgent): + message["rdl"]["webCallback"] ) elif message["type"] == "choice": - buffer += "\n Choice: " + message["title"] + if first_choice: + first_choice = False + else: + buffer += "," + buffer += f" {message['title']}" intent_result = intent.IntentResponse() intent_result.async_set_speech(buffer.strip())