From 49ff60026c736be6c8b8958d5228e4d0c2ccbd94 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 5 Aug 2025 10:32:22 -0400 Subject: [PATCH] fix: address feedback --- src/ui/hooks/useChat.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/hooks/useChat.ts b/src/ui/hooks/useChat.ts index b9a099329..af47e19ee 100644 --- a/src/ui/hooks/useChat.ts +++ b/src/ui/hooks/useChat.ts @@ -494,8 +494,12 @@ export function useChat({ ]); try { + if (!llmApi) { + throw new Error("LLM API is not available for auto-compaction"); + } + // Compact the history WITHOUT the current user message - const result = await compactChatHistory(chatHistory, model, llmApi!); + const result = await compactChatHistory(chatHistory, model, llmApi); // Update local variables immediately currentChatHistory = result.compactedHistory;