Fix duplicate function call messages in ChatWindow by removing placeholder message when function call is captured.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andrew Beal 2025-10-07 20:42:42 +01:00
parent 88901ec927
commit 43c31cf18d

View file

@ -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 }