mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-03 02:59:07 +08:00
fix(ThinkingButton): show correct icon when isFixedReasoning (#11825)
This commit is contained in:
parent
fda2287475
commit
03db02d5f7
@ -93,7 +93,7 @@ const ThinkingButton: FC<Props> = ({ quickPanel, model, assistantId }): ReactEle
|
||||
level: option,
|
||||
label: getReasoningEffortOptionsLabel(option),
|
||||
description: '',
|
||||
icon: ThinkingIcon(option),
|
||||
icon: ThinkingIcon({ option }),
|
||||
isSelected: currentReasoningEffort === option,
|
||||
action: () => onThinkingChange(option)
|
||||
}))
|
||||
@ -135,7 +135,7 @@ const ThinkingButton: FC<Props> = ({ quickPanel, model, assistantId }): ReactEle
|
||||
{
|
||||
label: t('assistants.settings.reasoning_effort.label'),
|
||||
description: '',
|
||||
icon: ThinkingIcon(currentReasoningEffort),
|
||||
icon: ThinkingIcon({ option: currentReasoningEffort }),
|
||||
isMenu: true,
|
||||
action: () => openQuickPanel()
|
||||
}
|
||||
@ -163,37 +163,40 @@ const ThinkingButton: FC<Props> = ({ quickPanel, model, assistantId }): ReactEle
|
||||
aria-label={ariaLabel}
|
||||
aria-pressed={currentReasoningEffort !== 'none'}
|
||||
style={isFixedReasoning ? { cursor: 'default' } : undefined}>
|
||||
{ThinkingIcon(currentReasoningEffort)}
|
||||
{ThinkingIcon({ option: currentReasoningEffort, isFixedReasoning })}
|
||||
</ActionIconButton>
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
|
||||
const ThinkingIcon = (option?: ThinkingOption) => {
|
||||
const ThinkingIcon = (props: { option?: ThinkingOption; isFixedReasoning?: boolean }) => {
|
||||
let IconComponent: React.FC<React.SVGProps<SVGSVGElement>> | null = null
|
||||
|
||||
switch (option) {
|
||||
case 'minimal':
|
||||
IconComponent = MdiLightbulbOn30
|
||||
break
|
||||
case 'low':
|
||||
IconComponent = MdiLightbulbOn50
|
||||
break
|
||||
case 'medium':
|
||||
IconComponent = MdiLightbulbOn80
|
||||
break
|
||||
case 'high':
|
||||
IconComponent = MdiLightbulbOn
|
||||
break
|
||||
case 'auto':
|
||||
IconComponent = MdiLightbulbAutoOutline
|
||||
break
|
||||
case 'none':
|
||||
IconComponent = MdiLightbulbOffOutline
|
||||
break
|
||||
default:
|
||||
IconComponent = MdiLightbulbOffOutline
|
||||
break
|
||||
if (props.isFixedReasoning) {
|
||||
IconComponent = MdiLightbulbAutoOutline
|
||||
} else {
|
||||
switch (props.option) {
|
||||
case 'minimal':
|
||||
IconComponent = MdiLightbulbOn30
|
||||
break
|
||||
case 'low':
|
||||
IconComponent = MdiLightbulbOn50
|
||||
break
|
||||
case 'medium':
|
||||
IconComponent = MdiLightbulbOn80
|
||||
break
|
||||
case 'high':
|
||||
IconComponent = MdiLightbulbOn
|
||||
break
|
||||
case 'auto':
|
||||
IconComponent = MdiLightbulbAutoOutline
|
||||
break
|
||||
case 'none':
|
||||
IconComponent = MdiLightbulbOffOutline
|
||||
break
|
||||
default:
|
||||
IconComponent = MdiLightbulbOffOutline
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return <IconComponent className="icon" width={18} height={18} style={{ marginTop: -2 }} />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user