Skip to content

Commit

Permalink
fix: validate context length (#2871)
Browse files Browse the repository at this point in the history
* fix: adjust context_length min and conditional for remote model

* fix: remove console
  • Loading branch information
urmauur authored May 6, 2024
1 parent 1e3e5a8 commit 9effb6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion web/screens/Chat/ModelSetting/SettingComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
InputComponentProps,
CheckboxComponentProps,
SliderComponentProps,
InferenceEngine,
} from '@janhq/core'

import { useAtomValue } from 'jotai/react'
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion web/screens/Chat/ModelSetting/predefinedComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9effb6a

Please sign in to comment.