File size: 497 Bytes
b59aa07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { useQuery } from "@tanstack/react-query";
import OpenHands from "#/api/open-hands";

const fetchAiConfigOptions = async () => ({
  models: await OpenHands.getModels(),
  agents: await OpenHands.getAgents(),
  securityAnalyzers: await OpenHands.getSecurityAnalyzers(),
});

export const useAIConfigOptions = () =>
  useQuery({
    queryKey: ["ai-config-options"],
    queryFn: fetchAiConfigOptions,
    staleTime: 1000 * 60 * 5, // 5 minutes
    gcTime: 1000 * 60 * 15, // 15 minutes
  });