Download src/hooks/query/use-config.ts from SaylorTwift/openhands: direct link, hf CLI and curl.
- Browser
- Download file 748 Bytes
-
https://huggingface.co/SaylorTwift/openhands/resolve/main/src/hooks/query/use-config.ts
- Command line
-
hf download hf://SaylorTwift/openhands/src/hooks/query/use-config.ts
-
curl -L -o use-config.ts https://huggingface.co/SaylorTwift/openhands/resolve/main/src/hooks/query/use-config.ts
748 Bytes
| import { useQuery } from "@tanstack/react-query"; | |
| import { | |
| isAgentServerUnavailableError, | |
| isAgentServerAuthError, | |
| } from "#/api/agent-server-compatibility"; | |
| import OptionService from "#/api/option-service/option-service.api"; | |
| import { QUERY_KEYS, CONFIG_CACHE_OPTIONS } from "./query-keys"; | |
| interface UseConfigOptions { | |
| enabled?: boolean; | |
| } | |
| export const useConfig = (options?: UseConfigOptions) => | |
| useQuery({ | |
| queryKey: QUERY_KEYS.WEB_CLIENT_CONFIG, | |
| queryFn: OptionService.getConfig, | |
| retry: (failureCount, error) => | |
| !isAgentServerUnavailableError(error) && | |
| !isAgentServerAuthError(error) && | |
| failureCount < 3, | |
| meta: { disableToast: true }, | |
| ...CONFIG_CACHE_OPTIONS, | |
| enabled: options?.enabled, | |
| }); | |