🔧 fix: Correct Properties Passed to getResponseSender, Catch OpenAI Errors (#1244)

* fix: attempt to catch more errors, especially when generation started

* fix: pass the right properties to getResponseSender

* chore: Update .eslintrc.js and fix sendEmail.js linting errors
This commit is contained in:
Danny Avila 2023-11-29 13:40:16 -05:00 committed by GitHub
parent ae03267d9b
commit e13b146d6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 22 additions and 15 deletions

View file

@ -829,9 +829,12 @@ ${convo}
return '';
}
if (
err?.message?.includes('stream ended') ||
err?.message?.includes('The server had an error processing your request') ||
err?.message?.includes('missing finish_reason') ||
(err instanceof OpenAI.OpenAIError && err?.message?.includes('missing finish_reason'))
) {
console.error(err);
await abortController.abortCompletion();
return intermediateReply;
} else if (err instanceof OpenAI.APIError) {