refactor(agents): remove unused useRemoveAgent hook and use deleteAgent from useAgents

This commit is contained in:
icarus 2025-09-19 13:30:50 +08:00
parent 5850e5da66
commit eaa5ec5545
2 changed files with 2 additions and 16 deletions

View File

@ -1,12 +0,0 @@
// import { useSWRConfig } from 'swr'
export const useRemoveAgent = () => {
// const { mutate } = useSWRConfig()
return {
removeAgent: () => {
// not implemented
window.toast.info('Not implemented')
},
status: {}
}
}

View File

@ -1,7 +1,6 @@
import { Button } from '@heroui/react'
import { AgentModal } from '@renderer/components/Popups/AgentModal'
import { useAgents } from '@renderer/hooks/agents/useAgents'
import { useRemoveAgent } from '@renderer/hooks/agents/useRemoveAgent'
import { useRuntime } from '@renderer/hooks/useRuntime'
import { useAppDispatch } from '@renderer/store'
import { setActiveAgentId as setActiveAgentIdAction } from '@renderer/store/runtime'
@ -14,8 +13,7 @@ import AgentItem from './components/AgentItem'
interface AssistantsTabProps {}
export const AgentsTab: FC<AssistantsTabProps> = () => {
const { agents } = useAgents()
const { removeAgent } = useRemoveAgent()
const { agents, deleteAgent } = useAgents()
const { t } = useTranslation()
const { chat } = useRuntime()
const { activeAgentId } = chat
@ -35,7 +33,7 @@ export const AgentsTab: FC<AssistantsTabProps> = () => {
key={agent.id}
agent={agent}
isActive={agent.id === activeAgentId}
onDelete={removeAgent}
onDelete={() => deleteAgent(agent.id)}
onPress={() => setActiveAgentId(agent.id)}
/>
))}