diff --git a/ui/typescript/src/components/chat/chat-session-list.tsx b/ui/typescript/src/components/chat/chat-session-list.tsx index 5ccd3c75..b3657443 100644 --- a/ui/typescript/src/components/chat/chat-session-list.tsx +++ b/ui/typescript/src/components/chat/chat-session-list.tsx @@ -28,9 +28,13 @@ export function ChatSessionList({ className, setSelectedSession: updateSelectedS // Set the first session as selected if (data.length > 0) { - const firstChatSession = data[0]; - setSelectedSession(firstChatSession); - await fetchChatMessages(firstChatSession.id); + const mostRecentChatSession = data[0]; + setSelectedSession(mostRecentChatSession); + await fetchChatMessages(mostRecentChatSession.id); + setUserInfoAtom((prevUserInfo: UserInfoProps) => ({ + ...prevUserInfo, + chatId: mostRecentChatSession.id, + })); } } fetchChatSessions().then(r => console.log(r)); @@ -46,7 +50,7 @@ export function ChatSessionList({ className, setSelectedSession: updateSelectedS } }); const data = await response.json(); - setChatsAtom(data as ChatProps[]); + setChatsAtom(data.reverse() as ChatProps[]); } // New handler for Listbox onChange event diff --git a/ui/typescript/src/layouts/header/header.tsx b/ui/typescript/src/layouts/header/header.tsx index b0cf6696..c85f1dbf 100644 --- a/ui/typescript/src/layouts/header/header.tsx +++ b/ui/typescript/src/layouts/header/header.tsx @@ -66,7 +66,7 @@ export default function Header({ className }: { className?: string }) { Semantic Search, Powered by Azure Cognitive Search + /> Semantic Search, Powered by Azure AI Search