Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Error Handling for createChatCompletion #35

Open
your-highness opened this issue May 25, 2023 · 1 comment · May be fixed by #40
Open

Introduce Error Handling for createChatCompletion #35

your-highness opened this issue May 25, 2023 · 1 comment · May be fixed by #40

Comments

@your-highness
Copy link
Contributor

Recently, we are getting errors from OpenAI API which result in non gracefully exited threads. IMO it would be great to introduce some simple error handling like described in https://www.npmjs.com/package/openai?activeTab=readme#Usage

Working on this right now. Pull request will follow.

@your-highness
Copy link
Contributor Author

It's been done in processGraphResponse() already:

try {
const sanitized = JSON.parse(graphContent)
const fileId = await jsonToFileId(JSON.stringify(sanitized), channelId)
const pre = content.substring(0, replaceStart)
const post = content.substring(replaceEnd)
if (post.trim().length < 1){
result.message = pre
} else {
result.message = `${pre} [see attached image] ${post}`
}
result.props = {originalMessage: content}
result.fileId = fileId
} catch (e) {
log.error(e)
log.error(`The input was:\n\n${graphContent}`)
}
}

But thread completion still needs some error handling. PR will cover this.

your-highness added a commit to LaborBerlin/chatgpt-mattermost-bot that referenced this issue May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant