Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ui/src/components/chat/ChatInterface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ export default function ChatInterface({ selectedAgentName, selectedNamespace, se

try {
let currentSessionId = session?.id || sessionId;
// Track whether we just created a session in this invocation. If so, the
// rename block below must be skipped: the title was already set at creation
// time, and session React state hasn't yet re-rendered (so session?.name
// is still null, which would make isPlaceholderSessionTitle return true
// incorrectly and queue a redundant — potentially hanging — POST /sessions).
let justCreatedSession = false;

// If there's no session, create one
if (!currentSessionId) {
Expand Down Expand Up @@ -311,6 +317,7 @@ export default function ChatInterface({ selectedAgentName, selectedNamespace, se
}
});
window.dispatchEvent(newSessionEvent);
justCreatedSession = true;
} catch (error) {
console.error("Error creating session:", error);
toast.error("Error creating session");
Expand All @@ -322,6 +329,7 @@ export default function ChatInterface({ selectedAgentName, selectedNamespace, se
}

if (
!justCreatedSession &&
currentSessionId &&
storedMessages.length === 0 &&
isPlaceholderSessionTitle(session?.name)
Expand Down
Loading