From 43c31cf18d4a33c242c38e7f868089731b01627f Mon Sep 17 00:00:00 2001 From: Andrew Beal Date: Tue, 7 Oct 2025 20:42:42 +0100 Subject: [PATCH] Fix duplicate function call messages in ChatWindow by removing placeholder message when function call is captured. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Components/ChatWindow.svelte | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Components/ChatWindow.svelte b/Components/ChatWindow.svelte index 5a614a8..b725874 100644 --- a/Components/ChatWindow.svelte +++ b/Components/ChatWindow.svelte @@ -116,8 +116,11 @@ if (chunk.isComplete) { isStreaming = false; - // Only save the message if it has content or a function call - if (accumulatedContent.trim() !== "" || capturedFunctionCall) { + // If there's a function call, remove the placeholder message + if (capturedFunctionCall) { + conversation.contents = conversation.contents.filter((_, messageIndex) => messageIndex !== aiMessageIndex); + } else if (accumulatedContent.trim() !== "") { + // Only save the message if it has content and no function call conversation.contents = conversation.contents.map((msg, messageIndex) => messageIndex === aiMessageIndex ? { ...msg, content: accumulatedContent }