MCPcopy Create free account
hub / github.com/TanStack/ai / useChatContext

Function useChatContext

packages/ai-solid-ui/src/chat.tsx:19–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17 * @throws Error if used outside of Chat component
18 */
19export function useChatContext(): UseChatReturn {
20 const context = useContext(ChatContext)
21 if (!context) {
22 throw new Error(
23 "Chat components must be wrapped in <Chat>. Make sure you're using Chat.Messages, Chat.Input, etc. inside a <Chat> component.",
24 )
25 }
26 return context
27}
28
29export interface ChatProps {
30 /** Child components (Chat.Messages, Chat.Input, etc.) */

Callers 3

ChatMessagesFunction · 0.90
ToolApprovalFunction · 0.90
ChatInputFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected