Skip to content

Commit

Permalink
fix: use resumed session id in chat view (#1485)
Browse files Browse the repository at this point in the history
  • Loading branch information
salman1993 authored Mar 3, 2025
1 parent c957bef commit 54201d9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ui/desktop/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ export default function ChatView({
const [sessionId] = useState(() => {
// If resuming a session, use that session ID
if (resumedSession?.session_id) {
// Store the resumed session ID in sessionStorage
window.sessionStorage.setItem('goose-session-id', resumedSession.session_id);
return resumedSession.session_id;
}

const existingId = window.sessionStorage.getItem('goose-session-id');
if (existingId) {
return existingId;
}
// For a new chat, generate a new session ID
const newId = generateSessionId();
window.sessionStorage.setItem('goose-session-id', newId);
return newId;
Expand All @@ -67,7 +66,7 @@ export default function ChatView({

return {
id: Date.now(),
title: resumedSession.description || `Chat ${resumedSession.session_id}`,
title: resumedSession.metadata?.description || `ID: ${resumedSession.session_id}`,
messages: convertedMessages,
};
} catch (e) {
Expand Down

0 comments on commit 54201d9

Please sign in to comment.