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, InputComponentProps,
CheckboxComponentProps, CheckboxComponentProps,
SliderComponentProps, SliderComponentProps,
InferenceEngine,
} from '@janhq/core' } from '@janhq/core'
import { useAtomValue } from 'jotai/react'
import Checkbox from '@/containers/Checkbox' import Checkbox from '@/containers/Checkbox'
import ModelConfigInput from '@/containers/ModelConfigInput' import ModelConfigInput from '@/containers/ModelConfigInput'
import SliderRightPanel from '@/containers/SliderRightPanel' import SliderRightPanel from '@/containers/SliderRightPanel'
import { activeThreadAtom } from '@/helpers/atoms/Thread.atom'
type Props = { type Props = {
componentProps: SettingComponentProps[] componentProps: SettingComponentProps[]
disabled?: boolean disabled?: boolean
@ -25,7 +20,6 @@ const SettingComponent: React.FC<Props> = ({
disabled = false, disabled = false,
onValueUpdated, onValueUpdated,
}) => { }) => {
const activeThread = useAtomValue(activeThreadAtom)
const components = componentProps.map((data) => { const components = componentProps.map((data) => {
switch (data.controllerType) { switch (data.controllerType) {
case 'slider': { case 'slider': {
@ -37,16 +31,7 @@ const SettingComponent: React.FC<Props> = ({
title={data.title} title={data.title}
description={data.description} description={data.description}
min={min} min={min}
max={ max={max}
data.key === 'max_tokens' &&
activeThread &&
activeThread.assistants[0].model.engine === InferenceEngine.nitro
? Number(
activeThread &&
activeThread.assistants[0].model.settings.ctx_len
)
: max
}
step={step} step={step}
value={value} value={value}
name={data.key} name={data.key}

View File

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