mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 07:05:48 +01:00
Clean up unused intent category (#151917)
This commit is contained in:
@@ -75,7 +75,6 @@ class BroadcastIntentHandler(intent.IntentHandler):
|
||||
)
|
||||
|
||||
response = intent_obj.create_response()
|
||||
response.response_type = intent.IntentResponseType.ACTION_DONE
|
||||
response.async_set_results(
|
||||
success_results=[
|
||||
intent.IntentResponseTarget(
|
||||
|
||||
@@ -89,7 +89,6 @@ class SetTemperatureIntent(intent.IntentHandler):
|
||||
)
|
||||
|
||||
response = intent_obj.create_response()
|
||||
response.response_type = intent.IntentResponseType.ACTION_DONE
|
||||
response.async_set_results(
|
||||
success_results=[
|
||||
intent.IntentResponseTarget(
|
||||
|
||||
@@ -371,7 +371,6 @@ class DefaultAgent(ConversationEntity):
|
||||
response = intent.IntentResponse(
|
||||
language=user_input.language or self.hass.config.language
|
||||
)
|
||||
response.response_type = intent.IntentResponseType.ACTION_DONE
|
||||
response.async_set_speech(response_text)
|
||||
|
||||
if response is None:
|
||||
|
||||
@@ -355,7 +355,6 @@ class MediaSearchAndPlayHandler(intent.IntentHandler):
|
||||
# Success
|
||||
response = intent_obj.create_response()
|
||||
response.async_set_speech_slots({"media": first_result.as_dict()})
|
||||
response.response_type = intent.IntentResponseType.ACTION_DONE
|
||||
return response
|
||||
|
||||
|
||||
@@ -471,6 +470,5 @@ class MediaSetVolumeRelativeHandler(intent.IntentHandler):
|
||||
) from err
|
||||
|
||||
response = intent_obj.create_response()
|
||||
response.response_type = intent.IntentResponseType.ACTION_DONE
|
||||
response.async_set_states(match_result.states)
|
||||
return response
|
||||
|
||||
@@ -60,7 +60,6 @@ class CompleteItemIntent(intent.IntentHandler):
|
||||
|
||||
response = intent_obj.create_response()
|
||||
response.async_set_speech_slots({"completed_items": complete_items})
|
||||
response.response_type = intent.IntentResponseType.ACTION_DONE
|
||||
|
||||
return response
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ class ListAddItemIntent(intent.IntentHandler):
|
||||
)
|
||||
|
||||
response: intent.IntentResponse = intent_obj.create_response()
|
||||
response.response_type = intent.IntentResponseType.ACTION_DONE
|
||||
response.async_set_results(
|
||||
[
|
||||
intent.IntentResponseTarget(
|
||||
@@ -141,7 +140,6 @@ class ListCompleteItemIntent(intent.IntentHandler):
|
||||
)
|
||||
|
||||
response: intent.IntentResponse = intent_obj.create_response()
|
||||
response.response_type = intent.IntentResponseType.ACTION_DONE
|
||||
response.async_set_results(
|
||||
[
|
||||
intent.IntentResponseTarget(
|
||||
|
||||
@@ -1264,22 +1264,11 @@ class ServiceIntentHandler(DynamicServiceIntentHandler):
|
||||
return (self.domain, self.service)
|
||||
|
||||
|
||||
class IntentCategory(Enum):
|
||||
"""Category of an intent."""
|
||||
|
||||
ACTION = "action"
|
||||
"""Trigger an action like turning an entity on or off"""
|
||||
|
||||
QUERY = "query"
|
||||
"""Get information about the state of an entity"""
|
||||
|
||||
|
||||
class Intent:
|
||||
"""Hold the intent."""
|
||||
|
||||
__slots__ = [
|
||||
"assistant",
|
||||
"category",
|
||||
"context",
|
||||
"conversation_agent_id",
|
||||
"device_id",
|
||||
@@ -1300,7 +1289,6 @@ class Intent:
|
||||
text_input: str | None,
|
||||
context: Context,
|
||||
language: str,
|
||||
category: IntentCategory | None = None,
|
||||
assistant: str | None = None,
|
||||
device_id: str | None = None,
|
||||
conversation_agent_id: str | None = None,
|
||||
@@ -1313,7 +1301,6 @@ class Intent:
|
||||
self.text_input = text_input
|
||||
self.context = context
|
||||
self.language = language
|
||||
self.category = category
|
||||
self.assistant = assistant
|
||||
self.device_id = device_id
|
||||
self.conversation_agent_id = conversation_agent_id
|
||||
@@ -1398,12 +1385,7 @@ class IntentResponse:
|
||||
self.matched_states: list[State] = []
|
||||
self.unmatched_states: list[State] = []
|
||||
self.speech_slots: dict[str, Any] = {}
|
||||
|
||||
if (self.intent is not None) and (self.intent.category == IntentCategory.QUERY):
|
||||
# speech will be the answer to the query
|
||||
self.response_type = IntentResponseType.QUERY_ANSWER
|
||||
else:
|
||||
self.response_type = IntentResponseType.ACTION_DONE
|
||||
self.response_type = IntentResponseType.ACTION_DONE
|
||||
|
||||
@callback
|
||||
def async_set_speech(
|
||||
|
||||
Reference in New Issue
Block a user