mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-31 16:49:07 +08:00
feat(AgentSettings): add description field to agent essential settings
This commit is contained in:
parent
63fa70863c
commit
b28fadd02f
@ -1,4 +1,4 @@
|
||||
import { Button, Input, Select, SelectedItems, SelectItem, Tooltip } from '@heroui/react'
|
||||
import { Button, Input, Select, SelectedItems, SelectItem, Textarea, Tooltip } from '@heroui/react'
|
||||
import { loggerService } from '@logger'
|
||||
import { ApiModelLabel } from '@renderer/components/ApiModelLabel'
|
||||
import { useApiModels } from '@renderer/hooks/agents/useModels'
|
||||
@ -20,6 +20,7 @@ interface AgentEssentialSettingsProps {
|
||||
const AgentEssentialSettings: FC<AgentEssentialSettingsProps> = ({ agent, update }) => {
|
||||
const { t } = useTranslation()
|
||||
const [name, setName] = useState<string>((agent?.name ?? '').trim())
|
||||
const [description, setDescription] = useState<string>((agent?.description ?? '').trim())
|
||||
const { models } = useApiModels({ providerType: 'anthropic' })
|
||||
|
||||
const updateName = (name: string) => {
|
||||
@ -40,6 +41,14 @@ const AgentEssentialSettings: FC<AgentEssentialSettingsProps> = ({ agent, update
|
||||
[agent, update]
|
||||
)
|
||||
|
||||
const updateDesc = useCallback(
|
||||
(description: UpdateAgentForm['description']) => {
|
||||
if (!agent) return
|
||||
update({ id: agent.id, description })
|
||||
},
|
||||
[agent, update]
|
||||
)
|
||||
|
||||
const addAccessiblePath = useCallback(async () => {
|
||||
if (!agent) return
|
||||
|
||||
@ -147,6 +156,18 @@ const AgentEssentialSettings: FC<AgentEssentialSettingsProps> = ({ agent, update
|
||||
))}
|
||||
</ul>
|
||||
</SettingsItem>
|
||||
<SettingsItem>
|
||||
<SettingsTitle>{t('common.description')}</SettingsTitle>
|
||||
<Textarea
|
||||
value={description}
|
||||
onValueChange={setDescription}
|
||||
onBlur={() => {
|
||||
if (description !== agent.description) {
|
||||
updateDesc(description)
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</SettingsItem>
|
||||
</SettingsContainer>
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user