mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-29 05:51:26 +08:00
feat(hooks): add getAgent function to useAgents hook
This commit is contained in:
parent
3b0995c8ef
commit
3b5b1986e6
@ -55,12 +55,20 @@ export const useAgents = () => {
|
||||
[client, mutate, t]
|
||||
)
|
||||
|
||||
const getAgent = useCallback(
|
||||
(id: string) => {
|
||||
return data?.agents.find((agent) => agent.id === id)
|
||||
},
|
||||
[data?.agents]
|
||||
)
|
||||
|
||||
return {
|
||||
agents: data?.agents ?? [],
|
||||
error,
|
||||
isLoading,
|
||||
addAgent,
|
||||
updateAgent,
|
||||
deleteAgent
|
||||
deleteAgent,
|
||||
getAgent
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user