mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-03 02:59:07 +08:00
fix(AgentEssentialSettings): handle undefined name and description states
Ensure proper handling of undefined values for agent name and description by making state types optional. Also update the updateName function to handle optional name input.
This commit is contained in:
parent
14f14b75b0
commit
5c7784622e
@ -19,13 +19,13 @@ 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 [name, setName] = useState<string | undefined>(agent?.name?.trim())
|
||||
const [description, setDescription] = useState<string | undefined>(agent?.description?.trim())
|
||||
const { models } = useApiModels({ providerType: 'anthropic' })
|
||||
|
||||
const updateName = (name: string) => {
|
||||
const updateName = (name: UpdateAgentForm['name']) => {
|
||||
if (!agent) return
|
||||
update({ id: agent.id, name: name.trim() })
|
||||
update({ id: agent.id, name: name?.trim() })
|
||||
}
|
||||
|
||||
const updateModel = (model: UpdateAgentForm['model']) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user