MCPcopy
hub / github.com/TanStack/ai / Chat

Function Chat

packages/ai-solid-ui/src/chat.tsx:70–92  ·  view source on GitHub ↗
(props: ChatProps)

Source from the content-addressed store, hash-verified

68 * ```
69 */
70export function Chat(props: ChatProps) {
71 const chat = useChat({
72 connection: props.connection,
73 ...(props.initialMessages !== undefined && {
74 initialMessages: props.initialMessages,
75 }),
76 ...(props.id !== undefined && { id: props.id }),
77 ...(props.body !== undefined && { body: props.body }),
78 ...(props.onResponse !== undefined && { onResponse: props.onResponse }),
79 ...(props.onChunk !== undefined && { onChunk: props.onChunk }),
80 ...(props.onFinish !== undefined && { onFinish: props.onFinish }),
81 ...(props.onError !== undefined && { onError: props.onError }),
82 ...(props.tools !== undefined && { tools: props.tools }),
83 })
84
85 return (
86 <ChatContext.Provider value={chat}>
87 <div class={props.class} data-chat-root>
88 {props.children}
89 </div>
90 </ChatContext.Provider>
91 )
92}

Callers

nothing calls this directly

Calls 1

useChatFunction · 0.90

Tested by

no test coverage detected