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:
parent
faa09bd2bf
commit
540999c441
@ -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}
|
||||
|
||||
@ -36,7 +36,7 @@ export const presetConfiguration: Record<string, SettingComponentProps> = {
|
||||
min: 128,
|
||||
max: 4096,
|
||||
step: 128,
|
||||
value: 2048,
|
||||
value: 4096,
|
||||
},
|
||||
requireModelReload: true,
|
||||
configType: 'setting',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user