assistant-ui
is a set of React components for AI chat.
npx assistant-ui@latest add modal
"use client";
import { useChat } from "@ai-sdk/react";
import { AssistantRuntimeProvider } from "@assistant-ui/react";
import { useVercelUseChatRuntime } from "@assistant-ui/react-ai-sdk";
import { AssistantModal } from "@/components/ui/assistant-ui/assistant-modal";
export default const MyApp = () => {
const chat = useChat({
api: "/api/chat" // your backend route
});
const runtime = useVercelUseChatRuntime(chat);
return (
<AssistantRuntimeProvider runtime={runtime}>
<AssistantModal />
</AssistantRuntimeProvider>
);
}