From bd928b9f3c2ace971730ff87aebc11e8a6922996 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Mon, 9 Jun 2025 17:55:07 -0700 Subject: [PATCH] Handle unset agent slug, name. E.g when chat with user created agents --- .../web/app/components/chatSidebar/chatSidebar.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interface/web/app/components/chatSidebar/chatSidebar.tsx b/src/interface/web/app/components/chatSidebar/chatSidebar.tsx index 1d0b4c0d..0dc18bcd 100644 --- a/src/interface/web/app/components/chatSidebar/chatSidebar.tsx +++ b/src/interface/web/app/components/chatSidebar/chatSidebar.tsx @@ -317,7 +317,7 @@ function ChatSidebarInternal({ ...props }: ChatSideBarProps) { const [inputTools, setInputTools] = useState(); const [outputModes, setOutputModes] = useState(); const [hasModified, setHasModified] = useState(false); - const [isDefaultAgent, setIsDefaultAgent] = useState(!agentData || agentData?.slug.toLowerCase() === "khoj"); + const [isDefaultAgent, setIsDefaultAgent] = useState(!agentData || agentData?.slug?.toLowerCase() === "khoj"); const [displayInputTools, setDisplayInputTools] = useState(); const [displayOutputModes, setDisplayOutputModes] = useState(); @@ -338,11 +338,11 @@ function ChatSidebarInternal({ ...props }: ChatSideBarProps) { setDisplayOutputModes(agentConfigurationOptions?.output_modes ? Object.keys(agentConfigurationOptions.output_modes) : []); } - if (agentData.name.toLowerCase() === "khoj" || agentData.is_hidden === true) { + if (agentData.name?.toLowerCase() === "khoj" || agentData.is_hidden === true) { setIsEditable(true); } - if (agentData.slug.toLowerCase() === "khoj") { + if (agentData.slug?.toLowerCase() === "khoj") { setSelectedModel(undefined); setCustomPrompt(undefined); setIsDefaultAgent(true);