@assistant-ui/mcp-docs-server 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/code-examples/with-ai-sdk-v5.md +23 -23
- package/.docs/organized/code-examples/with-assistant-transport.md +26 -26
- package/.docs/organized/code-examples/with-cloud.md +19 -19
- package/.docs/organized/code-examples/with-external-store.md +16 -16
- package/.docs/organized/code-examples/with-ffmpeg.md +20 -20
- package/.docs/organized/code-examples/with-langgraph.md +20 -20
- package/.docs/organized/code-examples/with-parent-id-grouping.md +16 -16
- package/.docs/organized/code-examples/with-react-hook-form.md +25 -25
- package/.docs/raw/docs/cloud/persistence/langgraph.mdx +22 -2
- package/.docs/raw/docs/getting-started.mdx +544 -153
- package/.docs/raw/docs/guides/Attachments.mdx +21 -0
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +2 -2
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +218 -0
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +31 -24
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +8 -3
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +1 -1
- package/.docs/raw/docs/ui/AssistantModal.mdx +21 -0
- package/.docs/raw/docs/ui/AssistantSidebar.mdx +21 -0
- package/.docs/raw/docs/ui/Attachment.mdx +21 -0
- package/.docs/raw/docs/ui/Markdown.mdx +22 -1
- package/.docs/raw/docs/ui/Mermaid.mdx +22 -1
- package/.docs/raw/docs/ui/SyntaxHighlighting.mdx +43 -2
- package/.docs/raw/docs/ui/Thread.mdx +9 -3
- package/.docs/raw/docs/ui/ThreadList.mdx +48 -2
- package/.docs/raw/docs/ui/ToolFallback.mdx +21 -0
- package/package.json +6 -6
|
@@ -5,6 +5,7 @@ title: Attachments
|
|
|
5
5
|
import { AttachmentSample } from "../../../components/samples/attachment-sample";
|
|
6
6
|
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
7
7
|
import { Callout } from "fumadocs-ui/components/callout";
|
|
8
|
+
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
8
9
|
|
|
9
10
|
Enable users to attach files to their messages, enhancing conversations with images, documents, and other content.
|
|
10
11
|
|
|
@@ -27,10 +28,30 @@ The attachment system in assistant-ui provides a flexible framework for handling
|
|
|
27
28
|
|
|
28
29
|
First, add the attachment UI components to your project:
|
|
29
30
|
|
|
31
|
+
<Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
|
|
32
|
+
<Tab>
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npx assistant-ui@latest add attachment
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
</Tab>
|
|
39
|
+
<Tab>
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
npx shadcn@latest add @assistant-ui/attachment
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
</Tab>
|
|
46
|
+
<Tab>
|
|
47
|
+
|
|
30
48
|
```sh
|
|
31
49
|
npx shadcn@latest add "https://r.assistant-ui.com/attachment"
|
|
32
50
|
```
|
|
33
51
|
|
|
52
|
+
</Tab>
|
|
53
|
+
</Tabs>
|
|
54
|
+
|
|
34
55
|
This adds `/components/assistant-ui/attachment.tsx` to your project.
|
|
35
56
|
|
|
36
57
|
<Callout type="tip">
|
|
@@ -41,7 +41,7 @@ npm install @assistant-ui/react @assistant-ui/react-ai-sdk ai @ai-sdk/openai
|
|
|
41
41
|
```tsx
|
|
42
42
|
import { openai } from "@ai-sdk/openai";
|
|
43
43
|
import { streamText, UIMessage, convertToModelMessages, tool } from "ai";
|
|
44
|
-
import { frontendTools } from "@assistant-ui/
|
|
44
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
45
45
|
import { z } from "zod";
|
|
46
46
|
|
|
47
47
|
// Allow streaming responses up to 30 seconds
|
|
@@ -173,7 +173,7 @@ const runtime = useChatRuntime({
|
|
|
173
173
|
When using `AssistantChatTransport`, frontend tools are forwarded to your backend. Use the `frontendTools` helper to properly integrate them:
|
|
174
174
|
|
|
175
175
|
```tsx
|
|
176
|
-
import { frontendTools } from "@assistant-ui/
|
|
176
|
+
import { frontendTools } from "@assistant-ui/react-ai-sdk";
|
|
177
177
|
|
|
178
178
|
export async function POST(req: Request) {
|
|
179
179
|
const { messages, system, tools } = await req.json();
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Custom Thread List
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
import { Callout } from "fumadocs-ui/components/callout";
|
|
6
|
+
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
7
|
+
import { ParametersTable } from "@/components/docs";
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
`useRemoteThreadListRuntime` lets you plug a custom thread database into assistant-ui. It keeps the UI and local runtime logic in sync while you provide persistence, archiving, and metadata for every conversation. The hook is exported as `unstable_useRemoteThreadListRuntime`; we refer to it here as **Custom Thread List**.
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
Use a Custom Thread List when you need to:
|
|
16
|
+
|
|
17
|
+
- Persist conversations in your own database or multitenant backend
|
|
18
|
+
- Share threads across devices, teams, or long-lived sessions
|
|
19
|
+
- Control thread metadata (titles, archived state, external identifiers)
|
|
20
|
+
- Layer additional adapters (history, attachments) around each thread runtime
|
|
21
|
+
|
|
22
|
+
## How It Works
|
|
23
|
+
|
|
24
|
+
Custom Thread List merges two pieces of state:
|
|
25
|
+
|
|
26
|
+
1. **Per-thread runtime** – powered by any runtime hook (for example `useLocalRuntime` or `useAssistantTransportRuntime`).
|
|
27
|
+
2. **Thread list adapter** – your adapter that reads and writes thread metadata in a remote store.
|
|
28
|
+
|
|
29
|
+
When the hook mounts it calls `list()` on your adapter, hydrates existing threads, and uses your runtime hook to spawn a runtime whenever a thread is opened. Creating a new conversation calls `initialize(threadId)` so you can create a record server-side and return the canonical `remoteId`.
|
|
30
|
+
|
|
31
|
+
<Callout type="info">
|
|
32
|
+
The built-in Assistant Cloud runtime is implemented with the same API. Inspect
|
|
33
|
+
`useCloudThreadListAdapter` for a production-ready reference adapter.
|
|
34
|
+
</Callout>
|
|
35
|
+
|
|
36
|
+
## Build a Custom Thread List
|
|
37
|
+
|
|
38
|
+
<Steps>
|
|
39
|
+
<Step>
|
|
40
|
+
### Provide a runtime per thread
|
|
41
|
+
|
|
42
|
+
Use any runtime hook that returns an `AssistantRuntime`. In most custom setups this is `useLocalRuntime(modelAdapter)` or `useAssistantTransportRuntime(...)`.
|
|
43
|
+
|
|
44
|
+
</Step>
|
|
45
|
+
<Step>
|
|
46
|
+
### Implement the adapter contract
|
|
47
|
+
|
|
48
|
+
Your adapter decides how threads are stored. Implement the methods in the table below to connect to your database or API.
|
|
49
|
+
|
|
50
|
+
</Step>
|
|
51
|
+
<Step>
|
|
52
|
+
### Compose the provider
|
|
53
|
+
|
|
54
|
+
Wrap `AssistantRuntimeProvider` with the runtime returned from the Custom Thread List hook.
|
|
55
|
+
|
|
56
|
+
```tsx twoslash title="app/CustomThreadListProvider.tsx"
|
|
57
|
+
// @filename: app/model-adapter.ts
|
|
58
|
+
export const myModelAdapter = {} as any;
|
|
59
|
+
|
|
60
|
+
// @filename: app/CustomThreadListProvider.tsx
|
|
61
|
+
// ---cut---
|
|
62
|
+
"use client";
|
|
63
|
+
|
|
64
|
+
import type { ReactNode } from "react";
|
|
65
|
+
import {
|
|
66
|
+
AssistantRuntimeProvider,
|
|
67
|
+
useLocalRuntime,
|
|
68
|
+
unstable_useRemoteThreadListRuntime as useRemoteThreadListRuntime,
|
|
69
|
+
type unstable_RemoteThreadListAdapter as RemoteThreadListAdapter,
|
|
70
|
+
} from "@assistant-ui/react";
|
|
71
|
+
import { createAssistantStream } from "assistant-stream";
|
|
72
|
+
import { myModelAdapter } from "./model-adapter"; // your chat model adapter
|
|
73
|
+
|
|
74
|
+
const threadListAdapter: RemoteThreadListAdapter = {
|
|
75
|
+
async list() {
|
|
76
|
+
const response = await fetch("/api/threads");
|
|
77
|
+
const threads = await response.json();
|
|
78
|
+
return {
|
|
79
|
+
threads: threads.map((thread: any) => ({
|
|
80
|
+
remoteId: thread.id,
|
|
81
|
+
externalId: thread.external_id ?? undefined,
|
|
82
|
+
status: thread.is_archived ? "archived" : "regular",
|
|
83
|
+
title: thread.title ?? undefined,
|
|
84
|
+
})),
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
async initialize(localId) {
|
|
88
|
+
const response = await fetch("/api/threads", {
|
|
89
|
+
method: "POST",
|
|
90
|
+
headers: { "Content-Type": "application/json" },
|
|
91
|
+
body: JSON.stringify({ localId }),
|
|
92
|
+
});
|
|
93
|
+
const result = await response.json();
|
|
94
|
+
return { remoteId: result.id, externalId: result.external_id };
|
|
95
|
+
},
|
|
96
|
+
async rename(remoteId, title) {
|
|
97
|
+
await fetch(`/api/threads/${remoteId}`, {
|
|
98
|
+
method: "PATCH",
|
|
99
|
+
headers: { "Content-Type": "application/json" },
|
|
100
|
+
body: JSON.stringify({ title }),
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
async archive(remoteId) {
|
|
104
|
+
await fetch(`/api/threads/${remoteId}/archive`, { method: "POST" });
|
|
105
|
+
},
|
|
106
|
+
async unarchive(remoteId) {
|
|
107
|
+
await fetch(`/api/threads/${remoteId}/unarchive`, { method: "POST" });
|
|
108
|
+
},
|
|
109
|
+
async delete(remoteId) {
|
|
110
|
+
await fetch(`/api/threads/${remoteId}`, { method: "DELETE" });
|
|
111
|
+
},
|
|
112
|
+
async generateTitle(remoteId, messages) {
|
|
113
|
+
return createAssistantStream(async (controller) => {
|
|
114
|
+
const response = await fetch(`/api/threads/${remoteId}/title`, {
|
|
115
|
+
method: "POST",
|
|
116
|
+
headers: { "Content-Type": "application/json" },
|
|
117
|
+
body: JSON.stringify({ messages }),
|
|
118
|
+
});
|
|
119
|
+
const { title } = await response.json();
|
|
120
|
+
controller.appendText(title);
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export function CustomThreadListProvider({
|
|
126
|
+
children,
|
|
127
|
+
}: Readonly<{ children: ReactNode }>) {
|
|
128
|
+
const runtime = useRemoteThreadListRuntime({
|
|
129
|
+
runtimeHook: () => useLocalRuntime(myModelAdapter),
|
|
130
|
+
adapter: threadListAdapter,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<AssistantRuntimeProvider runtime={runtime}>
|
|
135
|
+
{children}
|
|
136
|
+
</AssistantRuntimeProvider>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
</Step>
|
|
142
|
+
</Steps>
|
|
143
|
+
|
|
144
|
+
## Adapter Responsibilities
|
|
145
|
+
|
|
146
|
+
<ParametersTable
|
|
147
|
+
type="RemoteThreadListAdapter"
|
|
148
|
+
parameters={[
|
|
149
|
+
{
|
|
150
|
+
name: "list",
|
|
151
|
+
type: "() => Promise<{ threads: RemoteThreadMetadata[] }>",
|
|
152
|
+
description:
|
|
153
|
+
"Return the current threads. Each thread must include status, remoteId, and any metadata you want to show immediately.",
|
|
154
|
+
required: true,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "initialize",
|
|
158
|
+
type: "(localId: string) => Promise<{ remoteId: string; externalId?: string }>",
|
|
159
|
+
description:
|
|
160
|
+
"Create a new remote record when the user starts a conversation. Return the canonical ids so later operations target the right thread.",
|
|
161
|
+
required: true,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: "rename",
|
|
165
|
+
type: "(remoteId: string, title: string) => Promise<void>",
|
|
166
|
+
description: "Persist title changes triggered from the UI.",
|
|
167
|
+
required: true,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "archive",
|
|
171
|
+
type: "(remoteId: string) => Promise<void>",
|
|
172
|
+
description: "Mark the thread as archived in your system.",
|
|
173
|
+
required: true,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "unarchive",
|
|
177
|
+
type: "(remoteId: string) => Promise<void>",
|
|
178
|
+
description: "Restore an archived thread to the active list.",
|
|
179
|
+
required: true,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "delete",
|
|
183
|
+
type: "(remoteId: string) => Promise<void>",
|
|
184
|
+
description: "Permanently remove the thread and stop rendering it.",
|
|
185
|
+
required: true,
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: "generateTitle",
|
|
189
|
+
type: "(remoteId: string, unstable_messages: readonly ThreadMessage[]) => Promise<AssistantStream>",
|
|
190
|
+
description:
|
|
191
|
+
"Return a streaming title generator. You can reuse your model endpoint or queue a background job.",
|
|
192
|
+
required: true,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "unstable_Provider",
|
|
196
|
+
type: "ComponentType<PropsWithChildren>",
|
|
197
|
+
description:
|
|
198
|
+
"Optional wrapper rendered around all thread runtimes. Use it to inject adapters such as history or attachments (see the Cloud adapter).",
|
|
199
|
+
},
|
|
200
|
+
]}
|
|
201
|
+
/>
|
|
202
|
+
|
|
203
|
+
## Thread Lifecycle Cheatsheet
|
|
204
|
+
|
|
205
|
+
- `list()` hydrates threads on mount and during refreshes.
|
|
206
|
+
- Creating a new conversation calls `initialize()` once the user sends the first message.
|
|
207
|
+
- `archive`, `unarchive`, and `delete` are called optimistically; throw to revert the UI.
|
|
208
|
+
- `generateTitle()` powers the automatic title button and expects an `AssistantStream`.
|
|
209
|
+
- Provide a `runtimeHook` that always returns a fresh runtime instance per active thread.
|
|
210
|
+
|
|
211
|
+
## Optional Adapters
|
|
212
|
+
|
|
213
|
+
If you need history or attachment support, expose them via `unstable_Provider`. The cloud implementation wraps each thread runtime with `RuntimeAdapterProvider` to inject:
|
|
214
|
+
|
|
215
|
+
- `history` – e.g. `useAssistantCloudThreadHistoryAdapter`
|
|
216
|
+
- `attachments` – e.g. `CloudFileAttachmentAdapter`
|
|
217
|
+
|
|
218
|
+
Reuse that pattern to register any capability your runtime requires.
|
|
@@ -164,45 +164,52 @@ graph TD
|
|
|
164
164
|
```tsx title="app/MyRuntimeProvider.tsx"
|
|
165
165
|
"use client";
|
|
166
166
|
|
|
167
|
-
import {
|
|
167
|
+
import { ThreadMessageLike } from "@assistant-ui/react";
|
|
168
|
+
import { AppendMessage } from "@assistant-ui/react";
|
|
168
169
|
import {
|
|
169
|
-
useExternalStoreRuntime,
|
|
170
|
-
ThreadMessageLike,
|
|
171
|
-
AppendMessage,
|
|
172
170
|
AssistantRuntimeProvider,
|
|
171
|
+
useExternalStoreRuntime,
|
|
173
172
|
} from "@assistant-ui/react";
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
173
|
+
import { useState } from "react";
|
|
174
|
+
|
|
175
|
+
const convertMessage = (message: ThreadMessageLike) => {
|
|
176
|
+
return message;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export function MyRuntimeProvider({
|
|
180
|
+
children,
|
|
181
|
+
}: Readonly<{
|
|
182
|
+
children: React.ReactNode;
|
|
183
|
+
}>) {
|
|
184
|
+
const [messages, setMessages] = useState<readonly ThreadMessageLike[]>([]);
|
|
185
|
+
|
|
179
186
|
const onNew = async (message: AppendMessage) => {
|
|
180
|
-
|
|
187
|
+
if (message.content.length !== 1 || message.content[0]?.type !== "text")
|
|
188
|
+
throw new Error("Only text content is supported");
|
|
189
|
+
|
|
181
190
|
const userMessage: ThreadMessageLike = {
|
|
182
191
|
role: "user",
|
|
183
|
-
content: message.content,
|
|
192
|
+
content: [{ type: "text", text: message.content[0].text }],
|
|
184
193
|
};
|
|
185
|
-
setMessages(
|
|
186
|
-
|
|
187
|
-
//
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
194
|
+
setMessages((currentMessages) => [...currentMessages, userMessage]);
|
|
195
|
+
|
|
196
|
+
// normally you would perform an API call here to get the assistant response
|
|
197
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
198
|
+
|
|
191
199
|
const assistantMessage: ThreadMessageLike = {
|
|
192
200
|
role: "assistant",
|
|
193
|
-
content:
|
|
201
|
+
content: [{ type: "text", text: "Hello, world!" }],
|
|
194
202
|
};
|
|
195
|
-
setMessages(
|
|
196
|
-
setIsRunning(false);
|
|
203
|
+
setMessages((currentMessages) => [...currentMessages, assistantMessage]);
|
|
197
204
|
};
|
|
198
|
-
|
|
199
|
-
const runtime = useExternalStoreRuntime({
|
|
205
|
+
|
|
206
|
+
const runtime = useExternalStoreRuntime<ThreadMessageLike>({
|
|
200
207
|
messages,
|
|
201
208
|
setMessages,
|
|
202
|
-
isRunning,
|
|
203
209
|
onNew,
|
|
210
|
+
convertMessage,
|
|
204
211
|
});
|
|
205
|
-
|
|
212
|
+
|
|
206
213
|
return (
|
|
207
214
|
<AssistantRuntimeProvider runtime={runtime}>
|
|
208
215
|
{children}
|
|
@@ -140,14 +140,19 @@ Open the main page file in your assistant-ui frontend project (usually `app/page
|
|
|
140
140
|
```tsx {10} title="app/page.tsx"
|
|
141
141
|
"use client";
|
|
142
142
|
import { Thread } from "@/components/assistant-ui/thread";
|
|
143
|
-
import {
|
|
143
|
+
import {
|
|
144
|
+
useChatRuntime,
|
|
145
|
+
AssistantChatTransport,
|
|
146
|
+
} from "@assistant-ui/react-ai-sdk";
|
|
144
147
|
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
145
148
|
import { ThreadList } from "@/components/assistant-ui/thread-list";
|
|
146
149
|
|
|
147
150
|
export default function Home() {
|
|
148
151
|
// Point the runtime to the Mastra server endpoint
|
|
149
|
-
const runtime =
|
|
150
|
-
|
|
152
|
+
const runtime = useChatRuntime({
|
|
153
|
+
transport: new AssistantChatTransport({
|
|
154
|
+
api: "MASTRA_ENDPOINT",
|
|
155
|
+
}),
|
|
151
156
|
});
|
|
152
157
|
|
|
153
158
|
return (
|
|
@@ -223,5 +223,5 @@ Explore our implementation examples:
|
|
|
223
223
|
5. **Consider Assistant Cloud** for production persistence
|
|
224
224
|
|
|
225
225
|
<Callout type="info">
|
|
226
|
-
Need help? Join our [Discord community](https://discord.gg/
|
|
226
|
+
Need help? Join our [Discord community](https://discord.gg/S9dwgCNEFs) or check the [GitHub](https://github.com/assistant-ui/assistant-ui).
|
|
227
227
|
</Callout>
|
|
@@ -3,6 +3,7 @@ title: AssistantModal
|
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
6
|
+
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
6
7
|
import { AssistantModalSample } from "../../../components/samples/assistant-modal-sample";
|
|
7
8
|
|
|
8
9
|
## Overview
|
|
@@ -19,10 +20,30 @@ A chat bubble shown in the bottom right corner of the screen. Useful for support
|
|
|
19
20
|
|
|
20
21
|
### Add `assistant-modal`
|
|
21
22
|
|
|
23
|
+
<Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
|
|
24
|
+
<Tab>
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npx assistant-ui@latest add assistant-modal
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
</Tab>
|
|
31
|
+
<Tab>
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npx shadcn@latest add @assistant-ui/assistant-modal
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
</Tab>
|
|
38
|
+
<Tab>
|
|
39
|
+
|
|
22
40
|
```sh
|
|
23
41
|
npx shadcn@latest add "https://r.assistant-ui.com/assistant-modal"
|
|
24
42
|
```
|
|
25
43
|
|
|
44
|
+
</Tab>
|
|
45
|
+
</Tabs>
|
|
46
|
+
|
|
26
47
|
This adds `/components/assistant-ui/assistant-modal.tsx` to your project, which you can adjust as needed.
|
|
27
48
|
|
|
28
49
|
</Step>
|
|
@@ -3,6 +3,7 @@ title: AssistantSidebar
|
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
6
|
+
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
6
7
|
|
|
7
8
|
## Overview
|
|
8
9
|
|
|
@@ -15,10 +16,30 @@ A chat sidebar show on the right side of the screen. Useful for co-pilot use cas
|
|
|
15
16
|
|
|
16
17
|
### Add `assistant-sidebar`
|
|
17
18
|
|
|
19
|
+
<Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
|
|
20
|
+
<Tab>
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npx assistant-ui@latest add assistant-sidebar
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
</Tab>
|
|
27
|
+
<Tab>
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npx shadcn@latest add @assistant-ui/assistant-sidebar
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
</Tab>
|
|
34
|
+
<Tab>
|
|
35
|
+
|
|
18
36
|
```sh
|
|
19
37
|
npx shadcn@latest add "https://r.assistant-ui.com/assistant-sidebar"
|
|
20
38
|
```
|
|
21
39
|
|
|
40
|
+
</Tab>
|
|
41
|
+
</Tabs>
|
|
42
|
+
|
|
22
43
|
This adds `/components/assistant-ui/assistant-sidebar.tsx` to your project, which you can adjust as needed.
|
|
23
44
|
|
|
24
45
|
</Step>
|
|
@@ -5,6 +5,7 @@ title: Attachment
|
|
|
5
5
|
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
6
6
|
import { AttachmentSample } from "../../../components/samples/attachment-sample";
|
|
7
7
|
import { Callout } from "fumadocs-ui/components/callout";
|
|
8
|
+
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
8
9
|
|
|
9
10
|
## Overview
|
|
10
11
|
|
|
@@ -26,10 +27,30 @@ The Attachment components let the user attach files and view the attachments.
|
|
|
26
27
|
|
|
27
28
|
### Add `attachment`
|
|
28
29
|
|
|
30
|
+
<Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
|
|
31
|
+
<Tab>
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npx assistant-ui@latest add attachment
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
</Tab>
|
|
38
|
+
<Tab>
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npx shadcn@latest add @assistant-ui/attachment
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
</Tab>
|
|
45
|
+
<Tab>
|
|
46
|
+
|
|
29
47
|
```sh
|
|
30
48
|
npx shadcn@latest add "https://r.assistant-ui.com/attachment"
|
|
31
49
|
```
|
|
32
50
|
|
|
51
|
+
</Tab>
|
|
52
|
+
</Tabs>
|
|
53
|
+
|
|
33
54
|
This adds a `/components/assistant-ui/attachment.tsx` file to your project, which you can adjust as needed.
|
|
34
55
|
|
|
35
56
|
</Step>
|
|
@@ -6,6 +6,7 @@ Allow the assistant to display rich text using markdown.
|
|
|
6
6
|
|
|
7
7
|
import { Step, Steps } from "fumadocs-ui/components/steps";
|
|
8
8
|
import { Callout } from "fumadocs-ui/components/callout";
|
|
9
|
+
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
9
10
|
|
|
10
11
|
<Callout>
|
|
11
12
|
Markdown support is already included by default in the `Thread` component.
|
|
@@ -18,10 +19,30 @@ import { Callout } from "fumadocs-ui/components/callout";
|
|
|
18
19
|
<Step>
|
|
19
20
|
### Add `markdown-text`
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
<Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
|
|
23
|
+
<Tab>
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npx assistant-ui@latest add markdown-text
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
</Tab>
|
|
30
|
+
<Tab>
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
npx shadcn@latest add @assistant-ui/markdown-text
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
</Tab>
|
|
37
|
+
<Tab>
|
|
38
|
+
|
|
39
|
+
```sh
|
|
22
40
|
npx shadcn@latest add "https://r.assistant-ui.com/markdown-text"
|
|
23
41
|
```
|
|
24
42
|
|
|
43
|
+
</Tab>
|
|
44
|
+
</Tabs>
|
|
45
|
+
|
|
25
46
|
This adds a `/components/assistant-ui/markdown-text.tsx` file to your project, which you can adjust as needed.
|
|
26
47
|
|
|
27
48
|
</Step>
|
|
@@ -4,6 +4,7 @@ title: "Mermaid Diagrams"
|
|
|
4
4
|
|
|
5
5
|
import { Callout } from "fumadocs-ui/components/callout";
|
|
6
6
|
import { Step, Steps } from "fumadocs-ui/components/steps";
|
|
7
|
+
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
7
8
|
|
|
8
9
|
Render Mermaid diagrams in chat messages with the `mermaid-diagram` component.
|
|
9
10
|
|
|
@@ -12,10 +13,30 @@ Render Mermaid diagrams in chat messages with the `mermaid-diagram` component.
|
|
|
12
13
|
|
|
13
14
|
### Add `mermaid-diagram` component
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
<Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
|
|
17
|
+
<Tab>
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npx assistant-ui@latest add mermaid-diagram
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
</Tab>
|
|
24
|
+
<Tab>
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npx shadcn@latest add @assistant-ui/mermaid-diagram
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
</Tab>
|
|
31
|
+
<Tab>
|
|
32
|
+
|
|
33
|
+
```sh
|
|
16
34
|
npx shadcn@latest add "https://r.assistant-ui.com/mermaid-diagram"
|
|
17
35
|
```
|
|
18
36
|
|
|
37
|
+
</Tab>
|
|
38
|
+
</Tabs>
|
|
39
|
+
|
|
19
40
|
This will install the required dependencies and add the component to your project.
|
|
20
41
|
|
|
21
42
|
</Step>
|
|
@@ -5,6 +5,7 @@ title: Syntax Highlighting
|
|
|
5
5
|
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
6
6
|
import { Callout } from "fumadocs-ui/components/callout";
|
|
7
7
|
import { TypeTable } from "fumadocs-ui/components/type-table";
|
|
8
|
+
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
8
9
|
|
|
9
10
|
Syntax highlighting for code blocks in markdown.
|
|
10
11
|
|
|
@@ -25,10 +26,30 @@ Syntax highlighting for code blocks in markdown.
|
|
|
25
26
|
|
|
26
27
|
#### Add `shiki-highlighter`
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
<Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
|
|
30
|
+
<Tab>
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
npx assistant-ui@latest add shiki-highlighter
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
</Tab>
|
|
37
|
+
<Tab>
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npx shadcn@latest add @assistant-ui/shiki-highlighter
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
</Tab>
|
|
44
|
+
<Tab>
|
|
45
|
+
|
|
46
|
+
```sh
|
|
29
47
|
npx shadcn@latest add "https://r.assistant-ui.com/shiki-highlighter"
|
|
30
48
|
```
|
|
31
49
|
|
|
50
|
+
</Tab>
|
|
51
|
+
</Tabs>
|
|
52
|
+
|
|
32
53
|
This adds a `/components/assistant-ui/shiki-highlighter.tsx` file to your project and
|
|
33
54
|
installs the `react-shiki` dependency. The highlighter can be customized by editing
|
|
34
55
|
the config in the `shiki-highlighter.tsx` file.
|
|
@@ -216,10 +237,30 @@ For more information, see [Shiki's documentation on dual and multi themes](https
|
|
|
216
237
|
|
|
217
238
|
#### Add `syntax-highlighter`
|
|
218
239
|
|
|
219
|
-
|
|
240
|
+
<Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
|
|
241
|
+
<Tab>
|
|
242
|
+
|
|
243
|
+
```sh
|
|
244
|
+
npx assistant-ui@latest add syntax-highlighter
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
</Tab>
|
|
248
|
+
<Tab>
|
|
249
|
+
|
|
250
|
+
```sh
|
|
251
|
+
npx shadcn@latest add @assistant-ui/syntax-highlighter
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
</Tab>
|
|
255
|
+
<Tab>
|
|
256
|
+
|
|
257
|
+
```sh
|
|
220
258
|
npx shadcn@latest add "https://r.assistant-ui.com/syntax-highlighter"
|
|
221
259
|
```
|
|
222
260
|
|
|
261
|
+
</Tab>
|
|
262
|
+
</Tabs>
|
|
263
|
+
|
|
223
264
|
Adds a `/components/assistant-ui/syntax-highlighter.tsx` file to your project and installs the `react-syntax-highlighter` dependency.
|
|
224
265
|
|
|
225
266
|
</Step>
|
|
@@ -45,7 +45,7 @@ import { ThreadPrimitive } from "@assistant-ui/react";
|
|
|
45
45
|
|
|
46
46
|
### Add the component
|
|
47
47
|
|
|
48
|
-
<Tabs items={["assistant-ui", "shadcn"]}>
|
|
48
|
+
<Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
|
|
49
49
|
<Tab>
|
|
50
50
|
|
|
51
51
|
```sh
|
|
@@ -55,6 +55,13 @@ npx assistant-ui@latest add thread
|
|
|
55
55
|
</Tab>
|
|
56
56
|
<Tab>
|
|
57
57
|
|
|
58
|
+
```sh
|
|
59
|
+
npx shadcn@latest add @assistant-ui/thread
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
</Tab>
|
|
63
|
+
<Tab>
|
|
64
|
+
|
|
58
65
|
```sh
|
|
59
66
|
npx shadcn@latest add "https://r.assistant-ui.com/thread"
|
|
60
67
|
```
|
|
@@ -406,5 +413,4 @@ Multiple conditions can be combined on `ThreadPrimitive.If` - all specified cond
|
|
|
406
413
|
|
|
407
414
|
## Related Components
|
|
408
415
|
|
|
409
|
-
- [ThreadList](/docs/ui/ThreadList) - List of threads
|
|
410
|
-
- [ThreadListSidebar](/docs/ui/ThreadListSidebar) - Sidebar with thread list
|
|
416
|
+
- [ThreadList](/docs/ui/ThreadList) - List of threads, with or without sidebar
|