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:
parent
ed726db974
commit
c2c98bd04c
3 changed files with 69 additions and 3 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue