fix: validate context length (#2871)

* fix: adjust context_length min and conditional for remote model

* fix: remove console
This commit is contained in:
Faisal Amir 2024-05-06 16:48:53 +07:00 committed by GitHub
parent 1e3e5a83f4
commit 9effb6a3a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import {
InputComponentProps,
CheckboxComponentProps,
SliderComponentProps,
InferenceEngine,
} from '@janhq/core'
import { useAtomValue } from 'jotai/react'
@ -37,7 +38,9 @@ const SettingComponent: React.FC<Props> = ({
description={data.description}
min={min}
max={
data.key === 'max_tokens'
data.key === 'max_tokens' &&
activeThread &&
activeThread.assistants[0].model.engine === InferenceEngine.nitro
? Number(
activeThread &&
activeThread.assistants[0].model.settings.ctx_len

View File

@ -33,7 +33,7 @@ export const presetConfiguration: Record<string, SettingComponentProps> = {
'The context length for model operations varies; the maximum depends on the specific model used.',
controllerType: 'slider',
controllerProps: {
min: 0,
min: 128,
max: 4096,
step: 128,
value: 2048,