mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(frontend): Prevent duplicate tool response UI elements
- Replace all local messages with just completed assistant message on stream_end - This prevents tool responses from showing twice when initialMessages updates - Remove unused withFeatureFlag import from chat page
This commit is contained in:
@@ -414,7 +414,13 @@ export function useChatContainer({
|
||||
content: completedContent,
|
||||
timestamp: new Date(),
|
||||
};
|
||||
setMessages((prev) => [...prev, assistantMessage]);
|
||||
|
||||
// Replace ALL local messages with just the completed message
|
||||
// This prevents duplicates when initialMessages updates from backend
|
||||
setMessages([assistantMessage]);
|
||||
} else {
|
||||
// No text content, just clear all local messages
|
||||
setMessages([]);
|
||||
}
|
||||
|
||||
// Clear streaming state immediately now that we have the message
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useChatPage } from "./useChatPage";
|
||||
import { ChatContainer } from "./components/ChatContainer/ChatContainer";
|
||||
import { ChatErrorState } from "./components/ChatErrorState/ChatErrorState";
|
||||
import { ChatLoadingState } from "./components/ChatLoadingState/ChatLoadingState";
|
||||
import { withFeatureFlag } from "@/services/feature-flags/with-feature-flag";
|
||||
|
||||
function ChatPage() {
|
||||
const {
|
||||
@@ -69,4 +68,4 @@ function ChatPage() {
|
||||
);
|
||||
}
|
||||
|
||||
export default withFeatureFlag(ChatPage, "chat");
|
||||
export default ChatPage;
|
||||
|
||||
Reference in New Issue
Block a user