Strip Google AI text responses (#118593)

* Strip Google AI test responses

* strip each part
This commit is contained in:
tronikos 2024-05-31 21:55:52 -07:00 committed by Paulus Schoutsen
parent 20159d0277
commit 1afbfd687f
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,