🐛 fix: Prevent Node Server Crash Due to Unhandled ChatCompletionMessage Error (#1278)

* refactor(addTitle): avoid generating title when a request was aborted

* chore: bump openai to latest

* fix: catch OpenAIError Uncaught error as last resort

* fix: handle final messages excludes role=assistant

* Update OpenAIClient.js

* chore: fix linting errors
This commit is contained in:
Danny Avila 2023-12-04 22:58:23 -05:00 committed by GitHub
parent 076a9b9b9c
commit f1bc711cd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 95 additions and 30 deletions

View file

@ -105,7 +105,7 @@ process.on('uncaughtException', (err) => {
return;
}
if (err.message.includes('OpenAIError')) {
if (err.message.includes('OpenAIError') || err.message.includes('ChatCompletionMessage')) {
console.error(
'\n\nAn Uncaught `OpenAIError` error may be due to your reverse-proxy setup or stream configuration, or a bug in the `openai` node package.',
);