diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 936588b79..4645f3191 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -21,6 +21,7 @@ import { ALL_MODELS, useUpdateStore, useAccessStore, + ModalConfigValidator, } from "../store"; import { Avatar } from "./chat"; @@ -30,6 +31,7 @@ import Link from "next/link"; import { UPDATE_URL } from "../constant"; import { SearchService, usePromptStore } from "../store/prompt"; import { requestUsage } from "../requests"; +import { ErrorBoundary } from "./error"; function SettingItem(props: { title: string; @@ -57,17 +59,14 @@ function PasswordInput(props: HTMLProps) { } return ( - - +
: } onClick={changeVisibility} + className={styles["password-eye"]} /> - + +
); } @@ -115,11 +114,13 @@ export function Settings(props: { closeSettings: () => void }) { useEffect(() => { checkUpdate(); checkUsage(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const accessStore = useAccessStore(); const enabledAccessControl = useMemo( () => accessStore.enabledAccessControl(), + // eslint-disable-next-line react-hooks/exhaustive-deps [], ); @@ -135,7 +136,7 @@ export function Settings(props: { closeSettings: () => void }) { }, [showUsage]); return ( - <> +
@@ -453,7 +454,9 @@ export function Settings(props: { closeSettings: () => void }) { onChange={(e) => { updateConfig( (config) => - (config.modelConfig.model = e.currentTarget.value), + (config.modelConfig.model = ModalConfigValidator.model( + e.currentTarget.value, + )), ); }} > @@ -470,7 +473,7 @@ export function Settings(props: { closeSettings: () => void }) { > void }) { updateConfig( (config) => (config.modelConfig.temperature = - e.currentTarget.valueAsNumber), + ModalConfigValidator.temperature( + e.currentTarget.valueAsNumber, + )), ); }} > @@ -490,13 +495,15 @@ export function Settings(props: { closeSettings: () => void }) { updateConfig( (config) => (config.modelConfig.max_tokens = - e.currentTarget.valueAsNumber), + ModalConfigValidator.max_tokens( + e.currentTarget.valueAsNumber, + )), ) } > @@ -507,7 +514,7 @@ export function Settings(props: { closeSettings: () => void }) { > void }) { updateConfig( (config) => (config.modelConfig.presence_penalty = - e.currentTarget.valueAsNumber), + ModalConfigValidator.presence_penalty( + e.currentTarget.valueAsNumber, + )), ); }} >
- + ); }