Strip Google AI text responses (#118593)

* Strip Google AI test responses

* strip each part
pull/118597/head
tronikos 2024-05-31 21:55:52 -07:00 committed by GitHub
parent f3b20d30ae
commit 7af469f81e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -355,7 +355,7 @@ class GoogleGenerativeAIConversationEntity(
chat_request = glm.Content(parts=tool_responses)
intent_response.async_set_speech(
" ".join([part.text for part in chat_response.parts if part.text])
" ".join([part.text.strip() for part in chat_response.parts if part.text])
)
return conversation.ConversationResult(
response=intent_response, conversation_id=conversation_id

View File

@ -80,7 +80,7 @@ async def test_default_prompt(
mock_chat.send_message_async.return_value = chat_response
mock_part = MagicMock()
mock_part.function_call = None
mock_part.text = "Hi there!"
mock_part.text = "Hi there!\n"
chat_response.parts = [mock_part]
result = await conversation.async_converse(
hass,