fix: max_tokens and ctx_len max value will follow model.json (#2961)

Signed-off-by: James <james@jan.ai>
Co-authored-by: James <james@jan.ai>
This commit is contained in:
NamH 2024-05-29 15:19:27 +07:00 committed by GitHub
parent faa09bd2bf
commit 540999c441
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 17 deletions

View File

@ -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<Props> = ({
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<Props> = ({
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}

View File

@ -36,7 +36,7 @@ export const presetConfiguration: Record<string, SettingComponentProps> = {
min: 128,
max: 4096,
step: 128,
value: 2048,
value: 4096,
},
requireModelReload: true,
configType: 'setting',