diff --git a/app/src/components/settings/options.tsx b/app/src/components/settings/options.tsx index 3fbd3de..783d30f 100644 --- a/app/src/components/settings/options.tsx +++ b/app/src/components/settings/options.tsx @@ -2,9 +2,9 @@ import SettingsTab from "./tab"; import SettingsOption from "./option"; import { Button, Slider, Textarea } from "@mantine/core"; import { useCallback, useMemo } from "react"; -import { defaultSystemPrompt } from "../../openai"; +import { defaultSystemPrompt, defaultModel } from "../../openai"; import { useAppDispatch, useAppSelector } from "../../store"; -import { resetSystemPrompt, selectSystemPrompt, selectTemperature, setSystemPrompt, setTemperature } from "../../store/parameters"; +import { resetModel, setModel, selectModel, resetSystemPrompt, selectSystemPrompt, selectTemperature, setSystemPrompt, setTemperature } from "../../store/parameters"; import { selectSettingsOption } from "../../store/settings-ui"; import { FormattedMessage, useIntl } from "react-intl"; @@ -13,16 +13,22 @@ export default function GenerationOptionsTab(props: any) { const option = useAppSelector(selectSettingsOption); const initialSystemPrompt = useAppSelector(selectSystemPrompt); + const model = useAppSelector(selectModel); const temperature = useAppSelector(selectTemperature); const dispatch = useAppDispatch(); const onSystemPromptChange = useCallback((event: React.ChangeEvent) => dispatch(setSystemPrompt(event.target.value)), [dispatch]); + const onModelChange = useCallback((event: React.ChangeEvent) => dispatch(setModel(event.target.value)), [dispatch]); const onResetSystemPrompt = useCallback(() => dispatch(resetSystemPrompt()), [dispatch]); + const onResetModel = useCallback(() => dispatch(resetModel()), [dispatch]); const onTemperatureChange = useCallback((value: number) => dispatch(setTemperature(value)), [dispatch]); - const resettable = initialSystemPrompt + const resettableSystemPromopt = initialSystemPrompt && (initialSystemPrompt?.trim() !== defaultSystemPrompt.trim()); + const resettableModel = model + && (model?.trim() !== defaultModel.trim()); + const systemPromptOption = useMemo(() => ( @@ -36,11 +42,30 @@ export default function GenerationOptionsTab(props: any) { {chunk} }} />

- {resettable && }
- ), [option, initialSystemPrompt, resettable, onSystemPromptChange, onResetSystemPrompt]); + ), [option, initialSystemPrompt, resettableSystemPromopt, onSystemPromptChange, onResetSystemPrompt]); + + const modelOption = useMemo(() => ( + +