Call Google Assistant SDK service using async_add_executor_job (#117325)

This commit is contained in:
tronikos 2024-05-12 19:19:20 -07:00 committed by GitHub
parent 38ce7b15b0
commit 492ef67d02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -169,7 +169,9 @@ class GoogleAssistantConversationAgent(conversation.AbstractConversationAgent):
self.language = user_input.language
self.assistant = TextAssistant(credentials, self.language)
resp = self.assistant.assist(user_input.text)
resp = await self.hass.async_add_executor_job(
self.assistant.assist, user_input.text
)
text_response = resp[0] or "<empty response>"
intent_response = intent.IntentResponse(language=user_input.language)

View file

@ -79,7 +79,7 @@ async def async_send_text_commands(
) as assistant:
command_response_list = []
for command in commands:
resp = assistant.assist(command)
resp = await hass.async_add_executor_job(assistant.assist, command)
text_response = resp[0]
_LOGGER.debug("command: %s\nresponse: %s", command, text_response)
audio_response = resp[2]