mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-28 05:11:24 +08:00
* refactor(AgentModal): simplify agent type handling and update default values - Removed unused agent type options and related logic. - Updated default agent name from 'Claude Code' to 'Agent'. - Adjusted padding in button styles and textarea rows for better UI consistency. - Cleaned up unnecessary imports and code comments for improved readability. * refactor(AgentSettings): clean up and enhance name setting component - Removed unused imports and commented-out code in AgentModal and EssentialSettings. - Updated NameSetting to include an emoji avatar picker for enhanced user experience. - Simplified the logic for updating the agent's name and avatar. - Improved overall readability and maintainability of the code.
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import type { useUpdateAgent } from '@renderer/hooks/agents/useUpdateAgent'
|
|
import type { useUpdateSession } from '@renderer/hooks/agents/useUpdateSession'
|
|
import type { GetAgentResponse, GetAgentSessionResponse } from '@renderer/types'
|
|
import type { FC } from 'react'
|
|
|
|
import { AccessibleDirsSetting } from './AccessibleDirsSetting'
|
|
import { DescriptionSetting } from './DescriptionSetting'
|
|
import { ModelSetting } from './ModelSetting'
|
|
import { NameSetting } from './NameSetting'
|
|
import { SettingsContainer } from './shared'
|
|
|
|
type EssentialSettingsProps =
|
|
| {
|
|
agentBase: GetAgentResponse | undefined | null
|
|
update: ReturnType<typeof useUpdateAgent>['updateAgent']
|
|
showModelSetting?: boolean
|
|
}
|
|
| {
|
|
agentBase: GetAgentSessionResponse | undefined | null
|
|
update: ReturnType<typeof useUpdateSession>['updateSession']
|
|
showModelSetting?: boolean
|
|
}
|
|
|
|
const EssentialSettings: FC<EssentialSettingsProps> = ({ agentBase, update, showModelSetting = true }) => {
|
|
if (!agentBase) return null
|
|
|
|
return (
|
|
<SettingsContainer>
|
|
<NameSetting base={agentBase} update={update} />
|
|
{showModelSetting && <ModelSetting base={agentBase} update={update} />}
|
|
<AccessibleDirsSetting base={agentBase} update={update} />
|
|
<DescriptionSetting base={agentBase} update={update} />
|
|
</SettingsContainer>
|
|
)
|
|
}
|
|
|
|
export default EssentialSettings
|