mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-05 12:29:44 +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]
|
[client, mutate, t]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const getAgent = useCallback(
|
||||||
|
(id: string) => {
|
||||||
|
return data?.agents.find((agent) => agent.id === id)
|
||||||
|
},
|
||||||
|
[data?.agents]
|
||||||
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
agents: data?.agents ?? [],
|
agents: data?.agents ?? [],
|
||||||
error,
|
error,
|
||||||
isLoading,
|
isLoading,
|
||||||
addAgent,
|
addAgent,
|
||||||
updateAgent,
|
updateAgent,
|
||||||
deleteAgent
|
deleteAgent,
|
||||||
|
getAgent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user