Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend/copilot): hide New Chat button on Autopilot homepage (#12321)

Otto0bbb12d688d8
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
index 065200b3d7..94790edbf0 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
@@ -202,14 +202,16 @@ export function ChatSidebar() {
>
<div className="flex flex-col items-center gap-2">
<SidebarTrigger />
- <Button
- variant="ghost"
- onClick={handleNewChat}
- style={{ minWidth: "auto", width: "auto" }}
- >
- <PlusCircleIcon className="!size-5" />
- <span className="sr-only">New Chat</span>
- </Button>
+ {sessionId ? (
+ <Button
+ variant="ghost"
+ onClick={handleNewChat}
+ style={{ minWidth: "auto", width: "auto" }}
+ >
+ <PlusCircleIcon className="!size-5" />
+ <span className="sr-only">New Chat</span>
+ </Button>
+ ) : null}
</div>
</motion.div>
</SidebarHeader>
@@ -230,15 +232,17 @@ export function ChatSidebar() {
<SidebarTrigger />
</div>
</div>
- <Button
- variant="primary"
- size="small"
- onClick={handleNewChat}
- className="w-full"
- leftIcon={<PlusIcon className="h-4 w-4" weight="bold" />}
- >
- New Chat
- </Button>
+ {sessionId ? (
+ <Button
+ variant="primary"
+ size="small"
+ onClick={handleNewChat}
+ className="w-full"
+ leftIcon={<PlusIcon className="h-4 w-4" weight="bold" />}
+ >
+ New Chat
+ </Button>
+ ) : null}
</motion.div>
</SidebarHeader>
)}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
index 115e201ca9..ce824f9e9a 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
@@ -71,17 +71,19 @@ export function MobileDrawer({
<X width="1rem" height="1rem" />
</Button>
</div>
- <div className="mt-2">
- <Button
- variant="primary"
- size="small"
- onClick={onNewChat}
- className="w-full"
- leftIcon={<PlusIcon width="1rem" height="1rem" />}
- >
- New Chat
- </Button>
- </div>
+ {currentSessionId ? (
+ <div className="mt-2">
+ <Button
+ variant="primary"
+ size="small"
+ onClick={onNewChat}
+ className="w-full"
+ leftIcon={<PlusIcon width="1rem" height="1rem" />}
+ >
+ New Chat
+ </Button>
+ </div>
+ ) : null}
</div>
<div
className={cn(