mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Strip Google AI text responses (#118593)
* Strip Google AI test responses * strip each part
This commit is contained in:
parent
20159d0277
commit
1afbfd687f
@ -355,7 +355,7 @@ class GoogleGenerativeAIConversationEntity(
|
|||||||
chat_request = glm.Content(parts=tool_responses)
|
chat_request = glm.Content(parts=tool_responses)
|
||||||
|
|
||||||
intent_response.async_set_speech(
|
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(
|
return conversation.ConversationResult(
|
||||||
response=intent_response, conversation_id=conversation_id
|
response=intent_response, conversation_id=conversation_id
|
||||||
|
@ -80,7 +80,7 @@ async def test_default_prompt(
|
|||||||
mock_chat.send_message_async.return_value = chat_response
|
mock_chat.send_message_async.return_value = chat_response
|
||||||
mock_part = MagicMock()
|
mock_part = MagicMock()
|
||||||
mock_part.function_call = None
|
mock_part.function_call = None
|
||||||
mock_part.text = "Hi there!"
|
mock_part.text = "Hi there!\n"
|
||||||
chat_response.parts = [mock_part]
|
chat_response.parts = [mock_part]
|
||||||
result = await conversation.async_converse(
|
result = await conversation.async_converse(
|
||||||
hass,
|
hass,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user