Skip to content

Commit

Permalink
llm provider causing re render in effect (#3205)
Browse files Browse the repository at this point in the history
* llm provider causing re render in effect

* clean

* unused

* k
  • Loading branch information
pablonyx committed Nov 26, 2024
1 parent 4e4c482 commit 214c9a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions web/src/app/chat/ChatPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand All @@ -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();
Expand Down
1 change: 0 additions & 1 deletion web/src/lib/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ export function useLlmOverride(
modelName: "",
}
);

const [llmOverride, setLlmOverride] = useState<LlmOverride>(
currentChatSession && currentChatSession.current_alternate_model
? destructureValue(currentChatSession.current_alternate_model)
Expand Down

0 comments on commit 214c9a2

Please sign in to comment.