This commit is contained in:
Andrew 2024-10-17 16:46:52 -07:00
parent 0f3a79ab54
commit 5415f1e3cb

View file

@ -68,7 +68,7 @@ const sendAnthropicMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFi
stream.on('error', (error) => {
// the most common error will be invalid API key (401), so we handle this with a nice message
if (error instanceof Anthropic.APIError && error.status === 401) {
onError('Unauthorized: Invalid API key.')
onError('Invalid API key.')
}
else {
onError(error.message)
@ -145,7 +145,7 @@ const sendOpenAIMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinal
.catch(error => {
if (error instanceof OpenAI.APIError) {
if (error.status === 401) {
onError('Unauthorized: Invalid API key.');
onError('Invalid API key.');
}
else {
onError(error.message);