From 4409a587947b2dbbff76eee7fca987b0eb433615 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Mon, 3 Feb 2025 18:17:21 -0800 Subject: [PATCH] set initial model of default state --- .../web/app/components/chatSidebar/chatSidebar.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/interface/web/app/components/chatSidebar/chatSidebar.tsx b/src/interface/web/app/components/chatSidebar/chatSidebar.tsx index a1c1350e..8374b9b7 100644 --- a/src/interface/web/app/components/chatSidebar/chatSidebar.tsx +++ b/src/interface/web/app/components/chatSidebar/chatSidebar.tsx @@ -57,11 +57,11 @@ export function ChatSidebar({ ...props }: ChatSideBarProps) { function ChatSidebarInternal({ ...props }: ChatSideBarProps) { const [isEditable, setIsEditable] = useState(false); - const [isDefaultAgent, setIsDefaultAgent] = useState(false); + const [isDefaultAgent, setIsDefaultAgent] = useState(true); const { data: agentConfigurationOptions, error: agentConfigurationOptionsError } = useSWR("/api/agents/options", fetcher); - const { data: agentData, error: agentDataError } = useSWR(`/api/agents/conversation?conversation_id=${props.conversationId}`, fetcher); + const { data: agentData, isLoading: agentDataLoading, error: agentDataError } = useSWR(`/api/agents/conversation?conversation_id=${props.conversationId}`, fetcher); const { data: authenticatedData, error: authenticationError, @@ -92,10 +92,10 @@ function ChatSidebarInternal({ ...props }: ChatSideBarProps) { } if (agentData.slug.toLowerCase() === "khoj") { - setIsDefaultAgent(true); setSelectedModel(undefined); setCustomPrompt(undefined); } else { + setIsDefaultAgent(false); setCustomPrompt(agentData.persona); setSelectedModel(agentData.chat_model); } @@ -262,11 +262,10 @@ function ChatSidebarInternal({ ...props }: ChatSideBarProps) { - handleModelSelect(model.name, userModification)} - initialModel={agentData?.chat_model} + initialModel={isDefaultAgent ? '' : agentData?.chat_model} selectedModel={selectedModel} />