Remove choice word when Almond has choices (#28725)

This commit is contained in:
Paulus Schoutsen 2019-11-12 09:22:28 -08:00 committed by GitHub
parent 5f177fa42e
commit fc04b3e31c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -243,6 +243,7 @@ class AlmondAgent(conversation.AbstractConversationAgent):
"""Process a sentence.""" """Process a sentence."""
response = await self.api.async_converse_text(text, conversation_id) response = await self.api.async_converse_text(text, conversation_id)
first_choice = True
buffer = "" buffer = ""
for message in response["messages"]: for message in response["messages"]:
if message["type"] == "text": if message["type"] == "text":
@ -257,7 +258,11 @@ class AlmondAgent(conversation.AbstractConversationAgent):
+ message["rdl"]["webCallback"] + message["rdl"]["webCallback"]
) )
elif message["type"] == "choice": 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 = intent.IntentResponse()
intent_result.async_set_speech(buffer.strip()) intent_result.async_set_speech(buffer.strip())