diff --git a/web/src/app/chat/modal/SetDefaultModelModal.tsx b/web/src/app/chat/modal/SetDefaultModelModal.tsx index d8d75679d28d..a54507ee2a0e 100644 --- a/web/src/app/chat/modal/SetDefaultModelModal.tsx +++ b/web/src/app/chat/modal/SetDefaultModelModal.tsx @@ -1,4 +1,4 @@ -import { Dispatch, SetStateAction } from "react"; +import { Dispatch, SetStateAction, useEffect, useRef } from "react"; import { ModalWrapper } from "./ModalWrapper"; import { Badge, Text } from "@tremor/react"; import { getDisplayNameForModel, LlmOverride } from "@/lib/hooks"; @@ -21,6 +21,26 @@ export function SetDefaultModelModal({ defaultModel: string | null; }) { const { popup, setPopup } = usePopup(); + const containerRef = useRef(null); + const messageRef = useRef(null); + + useEffect(() => { + const container = containerRef.current; + const message = messageRef.current; + + if (container && message) { + const checkScrollable = () => { + if (container.scrollHeight > container.clientHeight) { + message.style.display = "block"; + } else { + message.style.display = "none"; + } + }; + checkScrollable(); + window.addEventListener("resize", checkScrollable); + return () => window.removeEventListener("resize", checkScrollable); + } + }, []); const defaultModelDestructured = defaultModel ? destructureValue(defaultModel) @@ -101,7 +121,7 @@ export function SetDefaultModelModal({ return ( <> {popup} @@ -116,56 +136,68 @@ export function SetDefaultModelModal({ assistants that don't have a default model assigned. {defaultModel == null && " No default model has been selected!"} -
+
- { - e.preventDefault(); - handleChangedefaultModel(null); - }} - className="form-radio ml-4 h-4 w-4 text-blue-600 transition duration-150 ease-in-out" - /> - { - - System default{" "} - {defaultProvider?.default_model_name && - `(${getDisplayNameForModel(defaultProvider?.default_model_name)})`} - - } + Scroll to see all options
- - {llmOptions.map(({ name, value }, index) => { - return ( -
- { - e.preventDefault(); - handleChangedefaultModel(value); - }} - className="form-radio ml-4 h-4 w-4 text-blue-600 transition duration-150 ease-in-out" - /> - +
+
+ { + e.preventDefault(); + handleChangedefaultModel(null); + }} + className="form-radio ml-4 h-4 w-4 text-blue-600 transition duration-150 ease-in-out" + /> + { - {getDisplayNameForModel(name)}{" "} - {defaultModelDestructured && - defaultModelDestructured.name == name && - "(selected)"} + System default{" "} + {defaultProvider?.default_model_name && + `(${getDisplayNameForModel(defaultProvider?.default_model_name)})`} -
- ); - })} + } +
+ + {llmOptions.map(({ name, value }, index) => { + return ( +
+ { + e.preventDefault(); + handleChangedefaultModel(value); + }} + className="form-radio ml-4 h-4 w-4 text-blue-600 transition duration-150 ease-in-out" + /> + + + {getDisplayNameForModel(name)}{" "} + {defaultModelDestructured && + defaultModelDestructured.name == name && + "(selected)"} + +
+ ); + })} +