Skip to content

Commit bc70dd9

Browse files
authored
fix(ui): accumulate streaming content instead of replacing it (#860)
when a non-final status update comes with text content we currently replace the streaming content with the current text content. This results in scenarios where only the agent's latest text content would be streamed. Ideally before the final status update we want to stream all of the text content instead of the latest text content so the agents thinking process is streamed in its entirety. This PR fixes this issue by accumulating the streaming content prior to a final status update. resolves #852 Below are two short recordings demonstrating the issue and the results after the fix [before-fix.zip](https://github.com/user-attachments/files/22145256/before-fix.zip) [after-fix.mov.zip](https://github.com/user-attachments/files/22145278/after-fix.mov.zip) Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
1 parent e6d129c commit bc70dd9

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

ui/src/components/chat/ChatInterface.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export default function ChatInterface({ selectedAgentName, selectedNamespace, se
141141
setChatStatus("thinking");
142142
setStoredMessages(prev => [...prev, ...streamingMessages]);
143143
setStreamingMessages([]);
144+
setStreamingContent(""); // Reset streaming content for new message
144145

145146
// For new sessions or when no stored messages exist, show the user message immediately
146147
const userMessage: Message = {

ui/src/lib/messageHandlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ export const createMessageHandlers = (handlers: MessageHandlers) => {
241241
}
242242
} else {
243243
handlers.setIsStreaming(true);
244-
handlers.setStreamingContent(() => textContent);
244+
handlers.setStreamingContent(prevContent => prevContent + textContent);
245245
if (handlers.setChatStatus) {
246246
handlers.setChatStatus("generating_response");
247247
}

0 commit comments

Comments
 (0)