mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-30 15:59:09 +08:00
feat(chat): add agent creation button with placeholder implementation
Add a new button for creating agents in the chat interface. The button is currently a placeholder with a "Not implemented" toast message. Includes necessary i18n translations and component props.
This commit is contained in:
parent
0d2dc2c257
commit
ee82b23886
@ -132,7 +132,6 @@
|
||||
},
|
||||
"title": "API 服务器"
|
||||
},
|
||||
|
||||
"assistants": {
|
||||
"abbr": "助手",
|
||||
"clear": {
|
||||
@ -263,6 +262,9 @@
|
||||
},
|
||||
"chat": {
|
||||
"add": {
|
||||
"agent": {
|
||||
"title": "添加 Agent"
|
||||
},
|
||||
"assistant": {
|
||||
"title": "添加助手"
|
||||
},
|
||||
|
||||
@ -18,12 +18,14 @@ interface AssistantsTabProps {
|
||||
activeAssistant: Assistant
|
||||
setActiveAssistant: (assistant: Assistant) => void
|
||||
onCreateAssistant: () => void
|
||||
onCreateAgent: () => void
|
||||
onCreateDefaultAssistant: () => void
|
||||
}
|
||||
const Assistants: FC<AssistantsTabProps> = ({
|
||||
activeAssistant,
|
||||
setActiveAssistant,
|
||||
onCreateAssistant,
|
||||
onCreateAgent,
|
||||
onCreateDefaultAssistant
|
||||
}) => {
|
||||
const { assistants, removeAssistant, copyAssistant, updateAssistants } = useAssistants()
|
||||
@ -83,6 +85,19 @@ const Assistants: FC<AssistantsTabProps> = ({
|
||||
)
|
||||
}, [onCreateAssistant, t])
|
||||
|
||||
const AddAgentButton = useCallback(() => {
|
||||
return (
|
||||
<AssistantAddItem onClick={onCreateAgent}>
|
||||
<AddItemWrapper>
|
||||
<Plus size={16} style={{ marginRight: 4, flexShrink: 0 }} />
|
||||
<Typography.Text style={{ color: 'inherit' }} ellipsis={{ tooltip: t('chat.add.agent.title') }}>
|
||||
{t('chat.add.agent.title')}
|
||||
</Typography.Text>
|
||||
</AddItemWrapper>
|
||||
</AssistantAddItem>
|
||||
)
|
||||
}, [onCreateAgent, t])
|
||||
|
||||
if (assistantsTabSortType === 'tags') {
|
||||
return (
|
||||
<Container className="assistants-tab" ref={containerRef}>
|
||||
@ -132,6 +147,7 @@ const Assistants: FC<AssistantsTabProps> = ({
|
||||
))}
|
||||
</div>
|
||||
{renderAddAssistantButton}
|
||||
<AddAgentButton />
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
@ -159,6 +175,7 @@ const Assistants: FC<AssistantsTabProps> = ({
|
||||
)}
|
||||
</DraggableList>
|
||||
{!dragging && renderAddAssistantButton}
|
||||
{!dragging && <AddAgentButton />}
|
||||
<div style={{ minHeight: 10 }}></div>
|
||||
</Container>
|
||||
)
|
||||
|
||||
@ -62,6 +62,10 @@ const HomeTabs: FC<Props> = ({
|
||||
assistant && setActiveAssistant(assistant)
|
||||
}
|
||||
|
||||
const onCreateAgent = async () => {
|
||||
window.toast.info('Not implemented')
|
||||
}
|
||||
|
||||
const onCreateDefaultAssistant = () => {
|
||||
const assistant = { ...defaultAssistant, id: uuid() }
|
||||
addAssistant(assistant)
|
||||
@ -133,6 +137,7 @@ const HomeTabs: FC<Props> = ({
|
||||
activeAssistant={activeAssistant}
|
||||
setActiveAssistant={setActiveAssistant}
|
||||
onCreateAssistant={onCreateAssistant}
|
||||
onCreateAgent={onCreateAgent}
|
||||
onCreateDefaultAssistant={onCreateDefaultAssistant}
|
||||
/>
|
||||
)}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user