feat: Conditionally render reasoning effort control for reasoning models
This commit is contained in:
parent
11bd55701c
commit
f91caff7ec
@ -1843,7 +1843,7 @@ export function isOpenAIoSeries(model: Model): boolean {
|
|||||||
return ['o1', 'o1-2024-12-17'].includes(model.id) || model.id.includes('o3')
|
return ['o1', 'o1-2024-12-17'].includes(model.id) || model.id.includes('o3')
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isReasoningModel(model: Model): boolean {
|
export function isReasoningModel(model?: Model): boolean {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import {
|
|||||||
isMac,
|
isMac,
|
||||||
isWindows
|
isWindows
|
||||||
} from '@renderer/config/constant'
|
} from '@renderer/config/constant'
|
||||||
|
import { isReasoningModel } from '@renderer/config/models'
|
||||||
import { codeThemes } from '@renderer/context/SyntaxHighlighterProvider'
|
import { codeThemes } from '@renderer/context/SyntaxHighlighterProvider'
|
||||||
import { useAssistant } from '@renderer/hooks/useAssistant'
|
import { useAssistant } from '@renderer/hooks/useAssistant'
|
||||||
import { useSettings } from '@renderer/hooks/useSettings'
|
import { useSettings } from '@renderer/hooks/useSettings'
|
||||||
@ -231,45 +232,49 @@ const SettingsTab: FC<Props> = (props) => {
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
)}
|
)}
|
||||||
<SettingDivider />
|
{isReasoningModel(assistant?.model) && (
|
||||||
<Row align="middle">
|
<>
|
||||||
<Label>{t('assistants.settings.reasoning_effort')}</Label>
|
<SettingDivider />
|
||||||
<Tooltip title={t('assistants.settings.reasoning_effort.tip')}>
|
<Row align="middle">
|
||||||
<QuestionIcon />
|
<Label>{t('assistants.settings.reasoning_effort')}</Label>
|
||||||
</Tooltip>
|
<Tooltip title={t('assistants.settings.reasoning_effort.tip')}>
|
||||||
</Row>
|
<QuestionIcon />
|
||||||
<Row align="middle" gutter={10}>
|
</Tooltip>
|
||||||
<Col span={24}>
|
</Row>
|
||||||
<SegmentedContainer>
|
<Row align="middle" gutter={10}>
|
||||||
<Segmented<'low' | 'medium' | 'high' | undefined>
|
<Col span={24}>
|
||||||
value={reasoningEffort}
|
<SegmentedContainer>
|
||||||
onChange={(value) => {
|
<Segmented<'low' | 'medium' | 'high' | undefined>
|
||||||
setReasoningEffort(value)
|
value={reasoningEffort}
|
||||||
onReasoningEffortChange(value)
|
onChange={(value) => {
|
||||||
}}
|
setReasoningEffort(value)
|
||||||
options={[
|
onReasoningEffortChange(value)
|
||||||
{
|
}}
|
||||||
value: 'low',
|
options={[
|
||||||
label: t('assistants.settings.reasoning_effort.low')
|
{
|
||||||
},
|
value: 'low',
|
||||||
{
|
label: t('assistants.settings.reasoning_effort.low')
|
||||||
value: 'medium',
|
},
|
||||||
label: t('assistants.settings.reasoning_effort.medium')
|
{
|
||||||
},
|
value: 'medium',
|
||||||
{
|
label: t('assistants.settings.reasoning_effort.medium')
|
||||||
value: 'high',
|
},
|
||||||
label: t('assistants.settings.reasoning_effort.high')
|
{
|
||||||
},
|
value: 'high',
|
||||||
{
|
label: t('assistants.settings.reasoning_effort.high')
|
||||||
value: undefined,
|
},
|
||||||
label: t('assistants.settings.reasoning_effort.off')
|
{
|
||||||
}
|
value: undefined,
|
||||||
]}
|
label: t('assistants.settings.reasoning_effort.off')
|
||||||
block
|
}
|
||||||
/>
|
]}
|
||||||
</SegmentedContainer>
|
block
|
||||||
</Col>
|
/>
|
||||||
</Row>
|
</SegmentedContainer>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</SettingGroup>
|
</SettingGroup>
|
||||||
<SettingGroup>
|
<SettingGroup>
|
||||||
<SettingSubtitle style={{ marginTop: 0 }}>{t('settings.messages.title')}</SettingSubtitle>
|
<SettingSubtitle style={{ marginTop: 0 }}>{t('settings.messages.title')}</SettingSubtitle>
|
||||||
@ -534,6 +539,7 @@ export const SettingGroup = styled.div<{ theme?: ThemeMode }>`
|
|||||||
|
|
||||||
// Define the styled component with hover state styling
|
// Define the styled component with hover state styling
|
||||||
const SegmentedContainer = styled.div`
|
const SegmentedContainer = styled.div`
|
||||||
|
margin-top: 5px;
|
||||||
.ant-segmented-item {
|
.ant-segmented-item {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user