1
0
mirror of https://github.com/home-assistant/core.git synced 2026-07-15 10:34:19 +01:00

Add to-do list response target for ListAddItemIntent (#121970)

* Add todo list response target for ListAddItemIntent

* Delete .vscode/settings.json

* Fix imports

* Add test

* Formatting

* Fix test

---------

Co-authored-by: Tom Harris <tomharris@harrisnj.net>
Co-authored-by: Michael Hansen <mike@rhasspy.org>
This commit is contained in:
__JosephAbbey
2024-10-11 23:23:20 +01:00
committed by GitHub
parent 9a59cba7f3
commit bd97a0dfe3
2 changed files with 12 additions and 0 deletions
+9
View File
@@ -62,4 +62,13 @@ class ListAddItemIntent(intent.IntentHandler):
response = intent_obj.create_response()
response.response_type = intent.IntentResponseType.ACTION_DONE
response.async_set_results(
[
intent.IntentResponseTarget(
type=intent.IntentResponseTargetType.ENTITY,
name=list_name,
id=match_result.states[0].entity_id,
)
]
)
return response
+3
View File
@@ -1145,6 +1145,9 @@ async def test_add_item_intent(
assistant=conversation.DOMAIN,
)
assert response.response_type == intent.IntentResponseType.ACTION_DONE
assert response.success_results[0].name == "list 1"
assert response.success_results[0].type == intent.IntentResponseTargetType.ENTITY
assert response.success_results[0].id == entity1.entity_id
assert len(entity1.items) == 1
assert len(entity2.items) == 0