Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #91 from max298/feature/send-error
Browse files Browse the repository at this point in the history
Show errors from OpenAI
  • Loading branch information
bertybuttface authored Feb 8, 2023
2 parents cc344c9 + acd5e24 commit 43dc126
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ export default class CommandHandler {
return;
}

const result = await sendChatGPTMessage(this.chatGPT, await bodyWithoutPrefix, storedConversation);
const result = await sendChatGPTMessage(this.chatGPT, await bodyWithoutPrefix, storedConversation)
.catch((error) => {
LogService.error(`OpenAI-API Error: ${error}`);
sendError(this.client, "The bot has encountered an error, please contact your administrator.", roomId, event.event_id);
});
await Promise.all([
this.client.setTyping(roomId, false, 500),
sendReply(this.client, roomId, this.getRootEventId(event), `${result.response}`, MATRIX_THREADS, MATRIX_RICH_TEXT)
Expand Down

0 comments on commit 43dc126

Please sign in to comment.