From 38eb3ece2d619422f22da49ccae47157fcdc0c35 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 31 Aug 2025 16:01:51 -0700 Subject: [PATCH] fix: clean up --- extensions/cli/src/ui/hooks/useChat.stream.helpers.ts | 1 - extensions/cli/src/ui/hooks/useChat.ts | 5 +---- packages/openai-adapters/package-lock.json | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/extensions/cli/src/ui/hooks/useChat.stream.helpers.ts b/extensions/cli/src/ui/hooks/useChat.stream.helpers.ts index d8b15aab3..aa2c19579 100644 --- a/extensions/cli/src/ui/hooks/useChat.stream.helpers.ts +++ b/extensions/cli/src/ui/hooks/useChat.stream.helpers.ts @@ -232,7 +232,6 @@ export async function executeStreaming({ chatHistory, currentCompactionIndex, ); - const _originalLength = historyForLLM.length; await streamChatResponse( historyForLLM, diff --git a/extensions/cli/src/ui/hooks/useChat.ts b/extensions/cli/src/ui/hooks/useChat.ts index 6d3e032a4..d360635e3 100644 --- a/extensions/cli/src/ui/hooks/useChat.ts +++ b/extensions/cli/src/ui/hooks/useChat.ts @@ -221,9 +221,6 @@ export function useChat({ // Save the updated session with the latest chat history that includes the assistant's reply // The streamCallbacks update setChatHistory during streaming, so we need to get the current state setChatHistory((currentHistory) => { - logger.debug("Saving session", { - historyLength: currentHistory.length, - }); const updatedSession: Session = { ...currentSession, history: currentHistory, @@ -407,7 +404,7 @@ export function useChat({ // Remove the last message if it's from assistant (partial response) setChatHistory((current) => { const lastMessage = current[current.length - 1]; - if (lastMessage?.message.role === "assistant") { + if (lastMessage?.message.role === "assistant" && !lastMessage.toolCallStates?.length) { return current.slice(0, -1); } return current; diff --git a/packages/openai-adapters/package-lock.json b/packages/openai-adapters/package-lock.json index 806a98f2a..046b1dc37 100644 --- a/packages/openai-adapters/package-lock.json +++ b/packages/openai-adapters/package-lock.json @@ -12528,7 +12528,6 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dev": true, - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver"