Skip to content

Commit

Permalink
Merge pull request #229 from Azure-Samples/gk/autogen-nb
Browse files Browse the repository at this point in the history
fix bug to randomly select chat id on initial page load
  • Loading branch information
thegovind authored May 27, 2024
2 parents acdbabb + c5037bd commit 3130dd1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions ui/typescript/src/components/chat/chat-session-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}));
}
}
Expand Down
2 changes: 1 addition & 1 deletion ui/typescript/src/layouts/sidebar/chat-blade.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default function Sidebar({ className, setSelectedSession, setUserInfoAtom
</span>
<Input
type="text"
placeholder="Ask Miyagi"
placeholder="Chat throttled in demo mode"
className="w-full dark:bg-dark/60 focus:outline-none focus:placeholder-gray-400 text-gray-600 placeholder-gray-600 pl-12 bg-gray-200 rounded-md py-3"
value={userInput}
onChange={handleInputChange}
Expand Down

0 comments on commit 3130dd1

Please sign in to comment.