From 42a5ba8bf4242a50bafae76742f0cfd41e8eb664 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sun, 20 Oct 2024 01:30:15 -0700 Subject: [PATCH] Show all agents in carousel on home screen agent pane of web app This change wraps the agent pane in a scroll area with all agents shown. It allows selecting an agent to chat with directly from the home screen without breaking flow and having to jump to the agents page. The previous flow was not convenient to quickly and consistently start chat with one of your standard agents. This was because a random subet of agents were shown on the home page. To start chat with an agent not shown on home screen load you had to open the agents page and initiate the conversation from there. --- src/interface/web/app/page.tsx | 93 +++++++++++++++------------------- 1 file changed, 41 insertions(+), 52 deletions(-) diff --git a/src/interface/web/app/page.tsx b/src/interface/web/app/page.tsx index 158b6fb7..45b91ad2 100644 --- a/src/interface/web/app/page.tsx +++ b/src/interface/web/app/page.tsx @@ -23,6 +23,7 @@ import { AgentData } from "@/app/agents/page"; import { createNewConversation } from "./common/chatFunctions"; import { useIsMobileWidth } from "./common/utils"; import { useSearchParams } from "next/navigation"; +import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; interface ChatBodyDataProps { chatOptionsData: ChatOptions | null; @@ -112,7 +113,7 @@ function ChatBodyData(props: ChatBodyDataProps) { const shuffledAgents = agentsData ? [...agentsData].sort(() => 0.5 - Math.random()) : []; const agents = agentsData ? [agentsData[0]] : []; // Always add the first/default agent. - shuffledAgents.slice(0, nSlice - 1).forEach((agent) => { + shuffledAgents.forEach((agent) => { if (!agents.find((a) => a.slug === agent.slug)) { agents.push(agent); } @@ -194,34 +195,29 @@ function ChatBodyData(props: ChatBodyDataProps) { {!props.isMobileWidth && ( -
- {agentIcons.map((icon, index) => ( - - setSelectedAgent(agents[index].slug)} + +
+ {agentIcons.map((icon, index) => ( + - {icon} {agents[index].name} - - - ))} - (window.location.href = "/agents")} - > - - See All → - - -
+ setSelectedAgent(agents[index].slug)} + > + {icon} {agents[index].name} + +
+ ))} +
+ + )}
@@ -285,31 +281,24 @@ function ChatBodyData(props: ChatBodyDataProps) {
-
- {agentIcons.map((icon, index) => ( - - setSelectedAgent(agents[index].slug)} + +
+ {agentIcons.map((icon, index) => ( + - {icon} {agents[index].name} - - - ))} - (window.location.href = "/agents")} - > - - See All → - - -
+ setSelectedAgent(agents[index].slug)} + > + {icon} {agents[index].name} + +
+ ))} +
+ + setMessage(message)}