File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
frontend/src/components/chat Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export default function ChatInterface() {
1919 const [ input , setInput ] = useState ( "" )
2020 const [ error , setError ] = useState < string | null > ( null )
2121 const [ client , setClient ] = useState < AgentCoreClient | null > ( null )
22- const [ sessionId ] = useState ( ( ) => crypto . randomUUID ( ) )
22+ const [ sessionId , setSessionId ] = useState ( ( ) => crypto . randomUUID ( ) )
2323
2424 const { isLoading, setIsLoading } = useGlobal ( )
2525 const auth = useAuth ( )
@@ -245,13 +245,13 @@ export default function ChatInterface() {
245245 }
246246 }
247247
248- // Start a new chat (generates new session ID)
248+ // Start a new chat by clearing messages and generating a fresh session ID.
249+ // A new UUID is required so the backend treats this as a distinct conversation context.
249250 const startNewChat = ( ) => {
250251 setMessages ( [ ] )
251252 setInput ( "" )
252253 setError ( null )
253- // Note: sessionId stays the same for the component lifecycle
254- // If you want a new session ID, you'd need to remount the component
254+ setSessionId ( crypto . randomUUID ( ) )
255255 }
256256
257257 // Check if this is the initial state (no messages)
You can’t perform that action at this time.
0 commit comments