mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-26 11:44:28 +08:00
feat(设置): 添加 Groq 服务层级选项并更新相关翻译
为 Groq 提供商添加特定的服务层级选项(on_demand 和 performance),同时更新中文翻译文件以包含新的选项
This commit is contained in:
parent
8b2c0d9fb3
commit
e4b74e1dbd
@ -3054,6 +3054,8 @@
|
||||
"auto": "自动",
|
||||
"default": "默认",
|
||||
"flex": "灵活",
|
||||
"on_demand": "按需",
|
||||
"performance": "性能",
|
||||
"priority": "优先",
|
||||
"tip": "指定用于处理请求的延迟层级",
|
||||
"title": "服务层级"
|
||||
|
||||
@ -5,7 +5,7 @@ import { SettingDivider, SettingRow } from '@renderer/pages/settings'
|
||||
import { CollapsibleSettingGroup } from '@renderer/pages/settings/SettingGroup'
|
||||
import { RootState, useAppDispatch } from '@renderer/store'
|
||||
import { setOpenAISummaryText } from '@renderer/store/settings'
|
||||
import { Model, OpenAIServiceTier, OpenAISummaryText } from '@renderer/types'
|
||||
import { Model, OpenAIServiceTier, OpenAISummaryText, ServiceTier, SystemProviderIds } from '@renderer/types'
|
||||
import { Tooltip } from 'antd'
|
||||
import { CircleHelp } from 'lucide-react'
|
||||
import { FC, useCallback, useEffect, useMemo } from 'react'
|
||||
@ -70,31 +70,54 @@ const OpenAISettingsGroup: FC<Props> = ({ model, providerId, SettingGroup, Setti
|
||||
]
|
||||
|
||||
const serviceTierOptions = useMemo(() => {
|
||||
const baseOptions: { value: OpenAIServiceTier; label: string }[] = [
|
||||
{
|
||||
value: 'auto',
|
||||
label: t('settings.openai.service_tier.auto')
|
||||
},
|
||||
{
|
||||
value: 'default',
|
||||
label: t('settings.openai.service_tier.default')
|
||||
},
|
||||
{
|
||||
value: 'flex',
|
||||
label: t('settings.openai.service_tier.flex')
|
||||
},
|
||||
{
|
||||
value: 'priority',
|
||||
label: t('settings.openai.service_tier.priority')
|
||||
}
|
||||
]
|
||||
let baseOptions: { value: ServiceTier; label: string }[]
|
||||
if (provider.id === SystemProviderIds.groq) {
|
||||
baseOptions = [
|
||||
{
|
||||
value: 'auto',
|
||||
label: t('settings.openai.service_tier.auto')
|
||||
},
|
||||
{
|
||||
value: 'on_demand',
|
||||
label: t('settings.openai.service_tier.on_demand')
|
||||
},
|
||||
{
|
||||
value: 'flex',
|
||||
label: t('settings.openai.service_tier.flex')
|
||||
},
|
||||
{
|
||||
value: 'performance',
|
||||
label: t('settings.openai.service_tier.performance')
|
||||
}
|
||||
]
|
||||
} else {
|
||||
// 其他情况默认是和 OpenAI 相同
|
||||
baseOptions = [
|
||||
{
|
||||
value: 'auto',
|
||||
label: t('settings.openai.service_tier.auto')
|
||||
},
|
||||
{
|
||||
value: 'default',
|
||||
label: t('settings.openai.service_tier.default')
|
||||
},
|
||||
{
|
||||
value: 'flex',
|
||||
label: t('settings.openai.service_tier.flex')
|
||||
},
|
||||
{
|
||||
value: 'priority',
|
||||
label: t('settings.openai.service_tier.priority')
|
||||
}
|
||||
]
|
||||
}
|
||||
return baseOptions.filter((option) => {
|
||||
if (option.value === 'flex') {
|
||||
return isSupportedFlexServiceTier
|
||||
}
|
||||
return true
|
||||
})
|
||||
}, [isSupportedFlexServiceTier, t])
|
||||
}, [isSupportedFlexServiceTier, provider.id, t])
|
||||
|
||||
useEffect(() => {
|
||||
if (serviceTierMode && !serviceTierOptions.some((option) => option.value === serviceTierMode)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user