mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Remove choice word when Almond has choices (#28725)
This commit is contained in:
parent
5f177fa42e
commit
fc04b3e31c
@ -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())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user