Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: max_tokens and ctx_len max value will follow model.json #2961

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions web/containers/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/utils/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
Loading