mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
OpenAI to not speak out whole errors (#126409)
* OpenAI to not speak out whole errors * Update snapshot
This commit is contained in:
parent
c759512c70
commit
ba48a86156
@ -148,7 +148,7 @@ class OpenAIConversationEntity(
|
|||||||
LOGGER.error("Error getting LLM API: %s", err)
|
LOGGER.error("Error getting LLM API: %s", err)
|
||||||
intent_response.async_set_error(
|
intent_response.async_set_error(
|
||||||
intent.IntentResponseErrorCode.UNKNOWN,
|
intent.IntentResponseErrorCode.UNKNOWN,
|
||||||
f"Error preparing LLM API: {err}",
|
"Error preparing LLM API",
|
||||||
)
|
)
|
||||||
return conversation.ConversationResult(
|
return conversation.ConversationResult(
|
||||||
response=intent_response, conversation_id=user_input.conversation_id
|
response=intent_response, conversation_id=user_input.conversation_id
|
||||||
@ -208,7 +208,7 @@ class OpenAIConversationEntity(
|
|||||||
intent_response = intent.IntentResponse(language=user_input.language)
|
intent_response = intent.IntentResponse(language=user_input.language)
|
||||||
intent_response.async_set_error(
|
intent_response.async_set_error(
|
||||||
intent.IntentResponseErrorCode.UNKNOWN,
|
intent.IntentResponseErrorCode.UNKNOWN,
|
||||||
f"Sorry, I had a problem with my template: {err}",
|
"Sorry, I had a problem with my template",
|
||||||
)
|
)
|
||||||
return conversation.ConversationResult(
|
return conversation.ConversationResult(
|
||||||
response=intent_response, conversation_id=conversation_id
|
response=intent_response, conversation_id=conversation_id
|
||||||
@ -248,10 +248,11 @@ class OpenAIConversationEntity(
|
|||||||
user=conversation_id,
|
user=conversation_id,
|
||||||
)
|
)
|
||||||
except openai.OpenAIError as err:
|
except openai.OpenAIError as err:
|
||||||
|
LOGGER.error("Error talking to OpenAI: %s", err)
|
||||||
intent_response = intent.IntentResponse(language=user_input.language)
|
intent_response = intent.IntentResponse(language=user_input.language)
|
||||||
intent_response.async_set_error(
|
intent_response.async_set_error(
|
||||||
intent.IntentResponseErrorCode.UNKNOWN,
|
intent.IntentResponseErrorCode.UNKNOWN,
|
||||||
f"Sorry, I had a problem talking to OpenAI: {err}",
|
"Sorry, I had a problem talking to OpenAI",
|
||||||
)
|
)
|
||||||
return conversation.ConversationResult(
|
return conversation.ConversationResult(
|
||||||
response=intent_response, conversation_id=conversation_id
|
response=intent_response, conversation_id=conversation_id
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
speech=dict({
|
speech=dict({
|
||||||
'plain': dict({
|
'plain': dict({
|
||||||
'extra_data': None,
|
'extra_data': None,
|
||||||
'speech': 'Error preparing LLM API: API non-existing not found',
|
'speech': 'Error preparing LLM API',
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
speech_slots=dict({
|
speech_slots=dict({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user