diff --git a/ui/typescript/src/components/chat/chat-session-list.tsx b/ui/typescript/src/components/chat/chat-session-list.tsx index b3657443..072fac14 100644 --- a/ui/typescript/src/components/chat/chat-session-list.tsx +++ b/ui/typescript/src/components/chat/chat-session-list.tsx @@ -28,12 +28,13 @@ export function ChatSessionList({ className, setSelectedSession: updateSelectedS // Set the first session as selected if (data.length > 0) { - const mostRecentChatSession = data[0]; - setSelectedSession(mostRecentChatSession); - await fetchChatMessages(mostRecentChatSession.id); + const randomIndex = Math.floor(Math.random() * data.length); + const randomChatSession = data[randomIndex]; + setSelectedSession(randomChatSession); + await fetchChatMessages(randomChatSession.id); setUserInfoAtom((prevUserInfo: UserInfoProps) => ({ ...prevUserInfo, - chatId: mostRecentChatSession.id, + chatId: randomChatSession.id, })); } } diff --git a/ui/typescript/src/layouts/sidebar/chat-blade.tsx b/ui/typescript/src/layouts/sidebar/chat-blade.tsx index 4ab710e5..93dbf96f 100644 --- a/ui/typescript/src/layouts/sidebar/chat-blade.tsx +++ b/ui/typescript/src/layouts/sidebar/chat-blade.tsx @@ -199,7 +199,7 @@ export default function Sidebar({ className, setSelectedSession, setUserInfoAtom