From 84145fea4b693035f4c775cbb277595c6de5cd25 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 May 2024 13:19:32 +0700 Subject: [PATCH] fix: max_tokens and ctx_len max value will follow model.json Signed-off-by: James --- .../ModelSetting/SettingComponent.tsx | 17 +---------------- web/utils/predefinedComponent.ts | 2 +- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/web/containers/ModelSetting/SettingComponent.tsx b/web/containers/ModelSetting/SettingComponent.tsx index 396043f77a..43df16430d 100644 --- a/web/containers/ModelSetting/SettingComponent.tsx +++ b/web/containers/ModelSetting/SettingComponent.tsx @@ -3,17 +3,12 @@ import { InputComponentProps, CheckboxComponentProps, SliderComponentProps, - InferenceEngine, } from '@janhq/core' -import { useAtomValue } from 'jotai/react' - import Checkbox from '@/containers/Checkbox' import ModelConfigInput from '@/containers/ModelConfigInput' import SliderRightPanel from '@/containers/SliderRightPanel' -import { activeThreadAtom } from '@/helpers/atoms/Thread.atom' - type Props = { componentProps: SettingComponentProps[] disabled?: boolean @@ -25,7 +20,6 @@ const SettingComponent: React.FC = ({ disabled = false, onValueUpdated, }) => { - const activeThread = useAtomValue(activeThreadAtom) const components = componentProps.map((data) => { switch (data.controllerType) { case 'slider': { @@ -37,16 +31,7 @@ const SettingComponent: React.FC = ({ title={data.title} description={data.description} min={min} - max={ - data.key === 'max_tokens' && - activeThread && - activeThread.assistants[0].model.engine === InferenceEngine.nitro - ? Number( - activeThread && - activeThread.assistants[0].model.settings.ctx_len - ) - : max - } + max={max} step={step} value={value} name={data.key} diff --git a/web/utils/predefinedComponent.ts b/web/utils/predefinedComponent.ts index 91c3f71e1e..eeb2274a39 100644 --- a/web/utils/predefinedComponent.ts +++ b/web/utils/predefinedComponent.ts @@ -36,7 +36,7 @@ export const presetConfiguration: Record = { min: 128, max: 4096, step: 128, - value: 2048, + value: 4096, }, requireModelReload: true, configType: 'setting',