chore: add invalid all built in tools

This commit is contained in:
Joel 2024-11-13 15:17:22 +08:00
parent 5c98d80fdf
commit edbfe27eb1

View File

@ -12,13 +12,24 @@ import {
const NAME_SPACE = 'tools'
const useAllBuiltInToolsKey = [NAME_SPACE, 'builtIn']
export const useAllBuiltInTools = () => {
return useQuery<ToolWithProvider[]>({
queryKey: [NAME_SPACE, 'builtIn'],
queryKey: useAllBuiltInToolsKey,
queryFn: () => get<ToolWithProvider[]>('/workspaces/current/tools/builtin'),
})
}
export const useInvalidateAllBuiltInTools = () => {
const queryClient = useQueryClient()
return () => {
queryClient.invalidateQueries(
{
queryKey: useAllBuiltInToolsKey,
})
}
}
const useAllCustomToolsKey = [NAME_SPACE, 'customTools']
export const useAllCustomTools = () => {
return useQuery<ToolWithProvider[]>({