alepha@docs:~/docs/.content/release/framework/docs/reference/react-hooks$
cat useAiContext.md | pretty1 min read
Last commit:
#useAiContext
#Import
typescript
1import { useAiContext } from "@alepha/ui/ai";
#Overview
Declare what the current page shows the assistant: a short page name,
the data it displays, and optionally the form the assistant may fill
(never submit). Every turn sent while the page is mounted carries the
current route and the innermost declared context.
#Examples
tsx
1const InvoicePage = (props: InvoicePageProps) => {2 const form = useForm({ schema: invoiceSchema, handler: save });3 useAiContext({ page: "invoice", data: props.invoice, form });4 return <form {...form.props}>...</form>;5};