Skip to content

Commit

Permalink
fix: max_tokens and ctx_len max value will follow model.json
Browse files Browse the repository at this point in the history
Signed-off-by: James <[email protected]>
  • Loading branch information
James committed May 29, 2024
1 parent 611a361 commit a2bafb1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
17 changes: 1 addition & 16 deletions web/screens/Chat/ModelSetting/SettingComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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': {
Expand All @@ -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}
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 @@ -36,7 +36,7 @@ export const presetConfiguration: Record<string, SettingComponentProps> = {
min: 128,
max: 4096,
step: 128,
value: 2048,
value: 4096,
},
requireModelReload: true,
configType: 'setting',
Expand Down

0 comments on commit a2bafb1

Please sign in to comment.