Spaces:
Sleeping
Sleeping
Download web/src/hooks/ChatProvider.tsx from TBM99/CoverageCheck: direct link, hf CLI and curl.
- Browser
- Download file 825 Bytes
-
https://huggingface.co/spaces/TBM99/CoverageCheck/resolve/main/web/src/hooks/ChatProvider.tsx
- Command line
-
hf download hf://spaces/TBM99/CoverageCheck/web/src/hooks/ChatProvider.tsx
-
curl -L -o ChatProvider.tsx https://huggingface.co/spaces/TBM99/CoverageCheck/resolve/main/web/src/hooks/ChatProvider.tsx
825 Bytes
| import { type ReactNode, useState } from 'react' | |
| import type { SystemId } from '@/lib/types' | |
| import { ChatContext } from './chatContext' | |
| import { useChat } from './useChat' | |
| /** The conversation and the box's settings (system, policy date), held ABOVE the pages: | |
| * a page unmounts when you navigate away, and its state with it (owner: the chat | |
| * disappeared on a visit to Evals). Here it lives as long as the browser tab, and an | |
| * answer still streaming keeps arriving while another page is open. */ | |
| export function ChatProvider({ children }: { children: ReactNode }) { | |
| const chat = useChat() | |
| const [system, setSystem] = useState<SystemId>('c') | |
| const [day, setDay] = useState<string | null>(null) | |
| return <ChatContext.Provider value={{ ...chat, system, setSystem, day, setDay }}>{children}</ChatContext.Provider> | |
| } | |