Download src/hooks/query/use-llm-profiles.ts from SaylorTwift/openhands: direct link, hf CLI and curl.
- Browser
- Download file 811 Bytes
-
https://huggingface.co/SaylorTwift/openhands/resolve/main/src/hooks/query/use-llm-profiles.ts
- Command line
-
hf download hf://SaylorTwift/openhands/src/hooks/query/use-llm-profiles.ts
-
curl -L -o use-llm-profiles.ts https://huggingface.co/SaylorTwift/openhands/resolve/main/src/hooks/query/use-llm-profiles.ts
811 Bytes
| import { useQuery } from "@tanstack/react-query"; | |
| import ProfilesService from "#/api/profiles-service/profiles-service.api"; | |
| import { useActiveBackend } from "#/contexts/active-backend-context"; | |
| import { CONFIG_CACHE_OPTIONS, LLM_PROFILES_QUERY_KEYS } from "./query-keys"; | |
| export { LLM_PROFILES_QUERY_KEYS }; | |
| interface UseLlmProfilesOptions { | |
| enabled?: boolean; | |
| } | |
| export function useLlmProfiles(options: UseLlmProfilesOptions = {}) { | |
| const { backend, orgId } = useActiveBackend(); | |
| return useQuery({ | |
| // Include backend identity to prevent cache pollution when switching backends | |
| queryKey: [...LLM_PROFILES_QUERY_KEYS.all, backend.id, orgId], | |
| queryFn: ProfilesService.listProfiles, | |
| ...CONFIG_CACHE_OPTIONS, | |
| enabled: options.enabled ?? true, | |
| meta: { disableToast: true }, | |
| }); | |
| } | |