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: 4 additions & 4 deletions frontend/src/components/chat/ChatInterface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function ChatInterface() {
const [input, setInput] = useState("")
const [error, setError] = useState<string | null>(null)
const [client, setClient] = useState<AgentCoreClient | null>(null)
const [sessionId] = useState(() => crypto.randomUUID())
const [sessionId, setSessionId] = useState(() => crypto.randomUUID())

const { isLoading, setIsLoading } = useGlobal()
const auth = useAuth()
Expand Down Expand Up @@ -245,13 +245,13 @@ export default function ChatInterface() {
}
}

// Start a new chat (generates new session ID)
// Start a new chat by clearing messages and generating a fresh session ID.
// A new UUID is required so the backend treats this as a distinct conversation context.
const startNewChat = () => {
setMessages([])
setInput("")
setError(null)
// Note: sessionId stays the same for the component lifecycle
// If you want a new session ID, you'd need to remount the component
setSessionId(crypto.randomUUID())
}

// Check if this is the initial state (no messages)
Expand Down
Loading