mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-07 22:10:21 +08:00
refactor(agents): remove unused useRemoveAgent hook and use deleteAgent from useAgents
This commit is contained in:
parent
5850e5da66
commit
eaa5ec5545
@ -1,12 +0,0 @@
|
|||||||
// import { useSWRConfig } from 'swr'
|
|
||||||
|
|
||||||
export const useRemoveAgent = () => {
|
|
||||||
// const { mutate } = useSWRConfig()
|
|
||||||
return {
|
|
||||||
removeAgent: () => {
|
|
||||||
// not implemented
|
|
||||||
window.toast.info('Not implemented')
|
|
||||||
},
|
|
||||||
status: {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,7 +1,6 @@
|
|||||||
import { Button } from '@heroui/react'
|
import { Button } from '@heroui/react'
|
||||||
import { AgentModal } from '@renderer/components/Popups/AgentModal'
|
import { AgentModal } from '@renderer/components/Popups/AgentModal'
|
||||||
import { useAgents } from '@renderer/hooks/agents/useAgents'
|
import { useAgents } from '@renderer/hooks/agents/useAgents'
|
||||||
import { useRemoveAgent } from '@renderer/hooks/agents/useRemoveAgent'
|
|
||||||
import { useRuntime } from '@renderer/hooks/useRuntime'
|
import { useRuntime } from '@renderer/hooks/useRuntime'
|
||||||
import { useAppDispatch } from '@renderer/store'
|
import { useAppDispatch } from '@renderer/store'
|
||||||
import { setActiveAgentId as setActiveAgentIdAction } from '@renderer/store/runtime'
|
import { setActiveAgentId as setActiveAgentIdAction } from '@renderer/store/runtime'
|
||||||
@ -14,8 +13,7 @@ import AgentItem from './components/AgentItem'
|
|||||||
interface AssistantsTabProps {}
|
interface AssistantsTabProps {}
|
||||||
|
|
||||||
export const AgentsTab: FC<AssistantsTabProps> = () => {
|
export const AgentsTab: FC<AssistantsTabProps> = () => {
|
||||||
const { agents } = useAgents()
|
const { agents, deleteAgent } = useAgents()
|
||||||
const { removeAgent } = useRemoveAgent()
|
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { chat } = useRuntime()
|
const { chat } = useRuntime()
|
||||||
const { activeAgentId } = chat
|
const { activeAgentId } = chat
|
||||||
@ -35,7 +33,7 @@ export const AgentsTab: FC<AssistantsTabProps> = () => {
|
|||||||
key={agent.id}
|
key={agent.id}
|
||||||
agent={agent}
|
agent={agent}
|
||||||
isActive={agent.id === activeAgentId}
|
isActive={agent.id === activeAgentId}
|
||||||
onDelete={removeAgent}
|
onDelete={() => deleteAgent(agent.id)}
|
||||||
onPress={() => setActiveAgentId(agent.id)}
|
onPress={() => setActiveAgentId(agent.id)}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user