pass OpenAI error directly to user

This commit is contained in:
Max Kammler 2023-02-08 09:50:24 +01:00 committed by bertybuttface
parent cc344c93d9
commit 11b042a8c3

View File

@ -122,7 +122,12 @@ 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.warn(`OpenAPI Error: ${error}`);
sendError(this.client, "Sorry, there was an error using the OpenAI-API. Details: " + error, roomId, event.event_id);
return;
});
await Promise.all([
this.client.setTyping(roomId, false, 500),
sendReply(this.client, roomId, this.getRootEventId(event), `${result.response}`, MATRIX_THREADS, MATRIX_RICH_TEXT)