mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-02-18 00:24:45 +08:00
- Changed imports to use 'type' for type-only imports in various files, improving clarity and potentially optimizing the build process. - Adjusted imports in files related to agents, models, and types to ensure consistency in type usage.
30 lines
968 B
TypeScript
30 lines
968 B
TypeScript
import SelectAgentModelButton from '@renderer/pages/home/components/SelectAgentModelButton'
|
|
import type { AgentBaseWithId, ApiModel, UpdateAgentBaseForm } from '@renderer/types'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { SettingsItem, SettingsTitle } from './shared'
|
|
|
|
export interface ModelSettingProps {
|
|
base: AgentBaseWithId | undefined | null
|
|
update: (form: UpdateAgentBaseForm) => Promise<void>
|
|
isDisabled?: boolean
|
|
}
|
|
|
|
export const ModelSetting: React.FC<ModelSettingProps> = ({ base, update, isDisabled }) => {
|
|
const { t } = useTranslation()
|
|
|
|
const updateModel = async (model: ApiModel) => {
|
|
if (!base) return
|
|
return update({ id: base.id, model: model.id })
|
|
}
|
|
|
|
if (!base) return null
|
|
|
|
return (
|
|
<SettingsItem inline className="gap-8">
|
|
<SettingsTitle id="model">{t('common.model')}</SettingsTitle>
|
|
<SelectAgentModelButton agent={base} onSelect={updateModel} isDisabled={isDisabled} />
|
|
</SettingsItem>
|
|
)
|
|
}
|