From 214c9a296e59990670c6dc5f3d82997b7aaa8588 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Fri, 22 Nov 2024 08:53:24 -0800 Subject: [PATCH] llm provider causing re render in effect (#3205) * llm provider causing re render in effect * clean * unused * k --- web/src/app/chat/ChatPage.tsx | 5 +++-- web/src/lib/hooks.ts | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/app/chat/ChatPage.tsx b/web/src/app/chat/ChatPage.tsx index f4f00692c1a..a063ad4b9ae 100644 --- a/web/src/app/chat/ChatPage.tsx +++ b/web/src/app/chat/ChatPage.tsx @@ -52,6 +52,7 @@ import { useLayoutEffect, useRef, useState, + useMemo, } from "react"; import { usePopup } from "@/components/admin/connectors/Popup"; import { SEARCH_PARAM_NAMES, shouldSubmitOnLoad } from "./searchParams"; @@ -266,7 +267,7 @@ export function ChatPage({ availableAssistants[0]; const noAssistants = liveAssistant == null || liveAssistant == undefined; - + // always set the model override for the chat session, when an assistant, llm provider, or user preference exists useEffect(() => { if (!loadedIdSessionRef.current && !currentPersonaId) { return; @@ -285,7 +286,7 @@ export function ChatPage({ ); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [liveAssistant, llmProviders, user?.preferences.default_model]); + }, [liveAssistant, user?.preferences.default_model]); const stopGenerating = () => { const currentSession = currentSessionId(); diff --git a/web/src/lib/hooks.ts b/web/src/lib/hooks.ts index a1c4a0ddb1a..88db800c5fb 100644 --- a/web/src/lib/hooks.ts +++ b/web/src/lib/hooks.ts @@ -160,7 +160,6 @@ export function useLlmOverride( modelName: "", } ); - const [llmOverride, setLlmOverride] = useState( currentChatSession && currentChatSession.current_alternate_model ? destructureValue(currentChatSession.current_alternate_model)