Move default response out of sentence trigger registration and into agent (#109317)

* Move default response out of trigger and into agent

* Add test
This commit is contained in:
Michael Hansen 2024-02-01 13:40:29 -06:00 committed by GitHub
parent ed726db974
commit c2c98bd04c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 69 additions and 3 deletions

View file

@ -238,7 +238,10 @@ class DefaultAgent(AbstractConversationAgent):
)
)
# Use last non-empty result as response
# Use last non-empty result as response.
#
# There may be multiple copies of a trigger running when editing in
# the UI, so it's critical that we filter out empty responses here.
response_text: str | None = None
for trigger_response in trigger_responses:
response_text = response_text or trigger_response
@ -246,7 +249,7 @@ class DefaultAgent(AbstractConversationAgent):
# Convert to conversation result
response = intent.IntentResponse(language=language)
response.response_type = intent.IntentResponseType.ACTION_DONE
response.async_set_speech(response_text or "")
response.async_set_speech(response_text or "Done")
return ConversationResult(response=response)