面向 React 应用的 AI 聊天界面库,目标是把 ChatGPT 式的对话交互搬进自己的产品。接入有两条路径:用 CLI 生成一个 Next.js 项目,或在已有工程里注入带样式的组件;也可以手动安装 @assistant-ui/react 与 @assistant-ui/ai-sdk 两个包。运行时由 AssistantRuntimeProvider 包裹,配合 useChatRuntime 把对话流接进组件树,界面层与 Radix UI、shadcn 的技术选择一致。代码用 TypeScript 书写,界面组件与运行时拆分在不同包里,模型调用和后端仍由使用者自行接上;文档、示例库与 Discord 社区分别维护。适合要在产品中加入 copilot 或聊天机器人、又不想从零处理流式渲染与消息状态的前端团队,也适合需要把现成聊天界面替换成自维护实现的项目。采用 MIT 许可。
Product · Documentation · Examples · Discord · Contact Sales
assistant-ui is an open-source TypeScript/React library to build production-grade AI chat experiences fast.
The fastest path is the CLI, which scaffolds a Next.js app or adds the styled components to an existing project:
npx assistant-ui@latest create # new project
npx assistant-ui@latest init # add to existing project
Or install the packages directly:
npm install @assistant-ui/react @assistant-ui/ai-sdk ai
"use client";
import { AssistantRuntimeProvider } from "@assistant-ui/react";
import { useChatRuntime } from "@assistant-ui/ai-sdk";
import { Thread } from "@/components/assistant-ui/elements/thread.aui";
export function Chat() {
const runtime = useChatRuntime();
return (
<AssistantRuntimeProvider runtime={runtime}>
<Thread />
</AssistantRuntimeProvider>
);
}
useChatRuntime connects to the Vercel AI SDK out of the box. Swap it for useLangGraphRuntime, useDataStreamRuntime, or any custom runtime to integrate with your own backend.
Thread, Message, Composer, ThreadList, ActionBar, and friends. Style every pixel yourself, or start from a polished shadcn/ui theme that the CLI copies into your project.
| Integration | Package |
|---|---|
| Vercel AI SDK | @assistant-ui/ai-sdk |
| LangGraph / LangChain | @assistant-ui/react-langgraph, @assistant-ui/react-langchain |
| AG-UI / A2A protocols | @assistant-ui/react-ag-ui, @assistant-ui/react-a2a |
| Google ADK / OpenCode | @assistant-ui/react-google-adk, @assistant-ui/react-opencode |
| Custom data-stream backend | @assistant-ui/react-data-stream |
| Managed thread history, telemetry, and file storage | assistant-cloud |
Broad model support out of the box (OpenAI, Anthropic, Google Gemini, Mistral, Perplexity, AWS Bedrock, Azure, Fireworks, Ollama) plus community providers via the AI SDK, and easy extension to any custom HTTP backend.
Instead of a single monolithic chat component, you compose primitives and bring your own styles. The CLI ships a great starter in your choice of Base UI (the default) or Radix UI flavor; you control everything else.
…and many more.
|
|
MIT, with optional Assistant Cloud for managed thread persistence and analytics.
Backed by Y Combinator.
| 日期 | 榜单 | 排名 | 周期新增 | 总 STAR |
|---|