Download client/src/hooks/Input/useRequiresKey.ts from Zhitomir/chat: direct link, hf CLI and curl.
- Browser
- Download file 708 Bytes
-
https://huggingface.co/spaces/Zhitomir/chat/resolve/main/client/src/hooks/Input/useRequiresKey.ts
- Command line
-
hf download hf://spaces/Zhitomir/chat/client/src/hooks/Input/useRequiresKey.ts
-
curl -L -o useRequiresKey.ts https://huggingface.co/spaces/Zhitomir/chat/resolve/main/client/src/hooks/Input/useRequiresKey.ts
708 Bytes
| import { useGetEndpointsQuery } from 'librechat-data-provider/react-query'; | |
| import { useChatContext } from '~/Providers/ChatContext'; | |
| import { getEndpointField } from '~/utils'; | |
| import useUserKey from './useUserKey'; | |
| export default function useRequiresKey() { | |
| const { conversation } = useChatContext(); | |
| const { data: endpointsConfig } = useGetEndpointsQuery(); | |
| const { endpoint } = conversation || {}; | |
| const userProvidesKey: boolean | null | undefined = getEndpointField( | |
| endpointsConfig, | |
| endpoint, | |
| 'userProvide', | |
| ); | |
| const { getExpiry } = useUserKey(endpoint ?? ''); | |
| const expiryTime = getExpiry(); | |
| const requiresKey = !expiryTime && userProvidesKey; | |
| return { requiresKey }; | |
| } | |