Fix streaming message disappearing after it finishes

This commit is contained in:
Alex Gleason committed 2025-09-10 12:14:48 -05:00
1 parent c74edebc1b
commit 716bd42c7d
2 files changed
+12 -3

No files matched your search

+1 -1
View File
@@ -372,7 +372,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
/>
);
})}
{streamingMessage && (
{streamingMessage && isLoading && (
streamingMessage.content ? (
<AIMessageItem
key="streaming-message"
+11 -2
View File
@@ -345,9 +345,18 @@ export class SessionManager {
...(accumulatedToolCalls.length > 0 && { tool_calls: accumulatedToolCalls })
};
// Clear streaming message and add final message
// Add final message and clear streaming message atomically
session.messages.push(assistantMessage);
session.streamingMessage = undefined;
await this.addMessage(sessionId, assistantMessage);
session.lastActivity = new Date();
// Save and emit all updates together
await this.saveSessionHistory(sessionId);
this.debouncedPersist();
this.cleanupOldSessions();
this.emit('messageAdded', sessionId, assistantMessage);
this.emit('sessionUpdated', sessionId, session);
conversationMessages.push(assistantMessage);
// Update cost if usage data is available