mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-03 19:30:04 +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 { loggerService } from '@logger'
|
||||||
import { ApiModelLabel } from '@renderer/components/ApiModelLabel'
|
import { ApiModelLabel } from '@renderer/components/ApiModelLabel'
|
||||||
import { useApiModels } from '@renderer/hooks/agents/useModels'
|
import { useApiModels } from '@renderer/hooks/agents/useModels'
|
||||||
@ -20,6 +20,7 @@ interface AgentEssentialSettingsProps {
|
|||||||
const AgentEssentialSettings: FC<AgentEssentialSettingsProps> = ({ agent, update }) => {
|
const AgentEssentialSettings: FC<AgentEssentialSettingsProps> = ({ agent, update }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [name, setName] = useState<string>((agent?.name ?? '').trim())
|
const [name, setName] = useState<string>((agent?.name ?? '').trim())
|
||||||
|
const [description, setDescription] = useState<string>((agent?.description ?? '').trim())
|
||||||
const { models } = useApiModels({ providerType: 'anthropic' })
|
const { models } = useApiModels({ providerType: 'anthropic' })
|
||||||
|
|
||||||
const updateName = (name: string) => {
|
const updateName = (name: string) => {
|
||||||
@ -40,6 +41,14 @@ const AgentEssentialSettings: FC<AgentEssentialSettingsProps> = ({ agent, update
|
|||||||
[agent, update]
|
[agent, update]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const updateDesc = useCallback(
|
||||||
|
(description: UpdateAgentForm['description']) => {
|
||||||
|
if (!agent) return
|
||||||
|
update({ id: agent.id, description })
|
||||||
|
},
|
||||||
|
[agent, update]
|
||||||
|
)
|
||||||
|
|
||||||
const addAccessiblePath = useCallback(async () => {
|
const addAccessiblePath = useCallback(async () => {
|
||||||
if (!agent) return
|
if (!agent) return
|
||||||
|
|
||||||
@ -147,6 +156,18 @@ const AgentEssentialSettings: FC<AgentEssentialSettingsProps> = ({ agent, update
|
|||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</SettingsItem>
|
</SettingsItem>
|
||||||
|
<SettingsItem>
|
||||||
|
<SettingsTitle>{t('common.description')}</SettingsTitle>
|
||||||
|
<Textarea
|
||||||
|
value={description}
|
||||||
|
onValueChange={setDescription}
|
||||||
|
onBlur={() => {
|
||||||
|
if (description !== agent.description) {
|
||||||
|
updateDesc(description)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</SettingsItem>
|
||||||
</SettingsContainer>
|
</SettingsContainer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user