diff --git a/services/core/src/main/kotlin/pl/kvgx12/wiertarbot/commands/ai/AIService.kt b/services/core/src/main/kotlin/pl/kvgx12/wiertarbot/commands/ai/AIService.kt index 7c9524f..c4579a6 100644 --- a/services/core/src/main/kotlin/pl/kvgx12/wiertarbot/commands/ai/AIService.kt +++ b/services/core/src/main/kotlin/pl/kvgx12/wiertarbot/commands/ai/AIService.kt @@ -131,10 +131,14 @@ class AIService( val messages = Prompt(getMessages(event, finalConversationId), options) val response = withContext(Dispatchers.IO) { - chatClient.prompt(messages) - .call() - .chatClientResponse() - .chatResponse + try { + chatClient.prompt(messages) + .call() + .chatClientResponse() + .chatResponse + } catch (e: NullPointerException) { + null + } } ?: run { log.error("Failed to get response from chat client") if (failed) {