@assistant-ui/mcp-docs-server 0.1.1
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/local-ollama.md +1135 -0
- package/.docs/organized/code-examples/search-agent-for-e-commerce.md +1721 -0
- package/.docs/organized/code-examples/with-ai-sdk.md +1081 -0
- package/.docs/organized/code-examples/with-cloud.md +1164 -0
- package/.docs/organized/code-examples/with-external-store.md +1064 -0
- package/.docs/organized/code-examples/with-ffmpeg.md +1305 -0
- package/.docs/organized/code-examples/with-langgraph.md +1819 -0
- package/.docs/organized/code-examples/with-openai-assistants.md +1175 -0
- package/.docs/organized/code-examples/with-react-hook-form.md +1727 -0
- package/.docs/organized/code-examples/with-vercel-ai-rsc.md +1157 -0
- package/.docs/raw/blog/2024-07-29-hello/index.mdx +65 -0
- package/.docs/raw/blog/2024-09-11/index.mdx +10 -0
- package/.docs/raw/blog/2024-12-15/index.mdx +10 -0
- package/.docs/raw/blog/2025-01-31-changelog/index.mdx +129 -0
- package/.docs/raw/docs/about-assistantui.mdx +44 -0
- package/.docs/raw/docs/api-reference/context-providers/AssistantRuntimeProvider.mdx +30 -0
- package/.docs/raw/docs/api-reference/context-providers/TextContentPartProvider.mdx +26 -0
- package/.docs/raw/docs/api-reference/integrations/react-hook-form.mdx +103 -0
- package/.docs/raw/docs/api-reference/integrations/vercel-ai-sdk.mdx +145 -0
- package/.docs/raw/docs/api-reference/overview.mdx +583 -0
- package/.docs/raw/docs/api-reference/primitives/ActionBar.mdx +264 -0
- package/.docs/raw/docs/api-reference/primitives/AssistantModal.mdx +129 -0
- package/.docs/raw/docs/api-reference/primitives/Attachment.mdx +96 -0
- package/.docs/raw/docs/api-reference/primitives/BranchPicker.mdx +87 -0
- package/.docs/raw/docs/api-reference/primitives/Composer.mdx +204 -0
- package/.docs/raw/docs/api-reference/primitives/ContentPart.mdx +173 -0
- package/.docs/raw/docs/api-reference/primitives/Error.mdx +70 -0
- package/.docs/raw/docs/api-reference/primitives/Message.mdx +181 -0
- package/.docs/raw/docs/api-reference/primitives/Thread.mdx +197 -0
- package/.docs/raw/docs/api-reference/primitives/composition.mdx +21 -0
- package/.docs/raw/docs/api-reference/runtimes/AssistantRuntime.mdx +33 -0
- package/.docs/raw/docs/api-reference/runtimes/AttachmentRuntime.mdx +46 -0
- package/.docs/raw/docs/api-reference/runtimes/ComposerRuntime.mdx +69 -0
- package/.docs/raw/docs/api-reference/runtimes/ContentPartRuntime.mdx +22 -0
- package/.docs/raw/docs/api-reference/runtimes/MessageRuntime.mdx +49 -0
- package/.docs/raw/docs/api-reference/runtimes/ThreadListItemRuntime.mdx +32 -0
- package/.docs/raw/docs/api-reference/runtimes/ThreadListRuntime.mdx +31 -0
- package/.docs/raw/docs/api-reference/runtimes/ThreadRuntime.mdx +48 -0
- package/.docs/raw/docs/architecture.mdx +92 -0
- package/.docs/raw/docs/cloud/authorization.mdx +152 -0
- package/.docs/raw/docs/cloud/overview.mdx +55 -0
- package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +54 -0
- package/.docs/raw/docs/cloud/persistence/langgraph.mdx +123 -0
- package/.docs/raw/docs/concepts/architecture.mdx +19 -0
- package/.docs/raw/docs/concepts/runtime-layer.mdx +163 -0
- package/.docs/raw/docs/concepts/why.mdx +9 -0
- package/.docs/raw/docs/copilots/make-assistant-readable.mdx +71 -0
- package/.docs/raw/docs/copilots/make-assistant-tool-ui.mdx +76 -0
- package/.docs/raw/docs/copilots/make-assistant-tool.mdx +117 -0
- package/.docs/raw/docs/copilots/model-context.mdx +135 -0
- package/.docs/raw/docs/copilots/motivation.mdx +191 -0
- package/.docs/raw/docs/copilots/use-assistant-instructions.mdx +62 -0
- package/.docs/raw/docs/getting-started.mdx +1133 -0
- package/.docs/raw/docs/guides/Attachments.mdx +640 -0
- package/.docs/raw/docs/guides/Branching.mdx +59 -0
- package/.docs/raw/docs/guides/Editing.mdx +56 -0
- package/.docs/raw/docs/guides/Speech.mdx +43 -0
- package/.docs/raw/docs/guides/ToolUI.mdx +663 -0
- package/.docs/raw/docs/guides/Tools.mdx +496 -0
- package/.docs/raw/docs/index.mdx +7 -0
- package/.docs/raw/docs/legacy/styled/AssistantModal.mdx +85 -0
- package/.docs/raw/docs/legacy/styled/Decomposition.mdx +633 -0
- package/.docs/raw/docs/legacy/styled/Markdown.mdx +86 -0
- package/.docs/raw/docs/legacy/styled/Scrollbar.mdx +71 -0
- package/.docs/raw/docs/legacy/styled/Thread.mdx +84 -0
- package/.docs/raw/docs/legacy/styled/ThreadWidth.mdx +21 -0
- package/.docs/raw/docs/mcp-docs-server.mdx +324 -0
- package/.docs/raw/docs/migrations/deprecation-policy.mdx +41 -0
- package/.docs/raw/docs/migrations/v0-7.mdx +188 -0
- package/.docs/raw/docs/migrations/v0-8.mdx +160 -0
- package/.docs/raw/docs/migrations/v0-9.mdx +75 -0
- package/.docs/raw/docs/react-compatibility.mdx +208 -0
- package/.docs/raw/docs/runtimes/ai-sdk/rsc.mdx +226 -0
- package/.docs/raw/docs/runtimes/ai-sdk/use-assistant-hook.mdx +195 -0
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat-hook.mdx +138 -0
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +136 -0
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +1624 -0
- package/.docs/raw/docs/runtimes/custom/local.mdx +1185 -0
- package/.docs/raw/docs/runtimes/helicone.mdx +60 -0
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +320 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +11 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +28 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +120 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +336 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +385 -0
- package/.docs/raw/docs/runtimes/langserve.mdx +126 -0
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +218 -0
- package/.docs/raw/docs/runtimes/mastra/overview.mdx +17 -0
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +196 -0
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +222 -0
- package/.docs/raw/docs/ui/AssistantModal.mdx +46 -0
- package/.docs/raw/docs/ui/AssistantSidebar.mdx +42 -0
- package/.docs/raw/docs/ui/Attachment.mdx +82 -0
- package/.docs/raw/docs/ui/Markdown.mdx +72 -0
- package/.docs/raw/docs/ui/Mermaid.mdx +79 -0
- package/.docs/raw/docs/ui/Scrollbar.mdx +59 -0
- package/.docs/raw/docs/ui/SyntaxHighlighting.mdx +253 -0
- package/.docs/raw/docs/ui/Thread.mdx +47 -0
- package/.docs/raw/docs/ui/ThreadList.mdx +49 -0
- package/.docs/raw/docs/ui/ToolFallback.mdx +64 -0
- package/.docs/raw/docs/ui/primitives/Thread.mdx +197 -0
- package/LICENSE +21 -0
- package/README.md +128 -0
- package/dist/chunk-C7O7EFKU.js +38 -0
- package/dist/chunk-CZCDQ3YH.js +420 -0
- package/dist/index.js +1 -0
- package/dist/prepare-docs/prepare.js +199 -0
- package/dist/stdio.js +8 -0
- package/package.json +43 -0
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Decomposition
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Styled Components can be decomposed into smaller components. At each level, you can swap out a specific component with your own custom component.
|
|
8
|
+
|
|
9
|
+
## Thread
|
|
10
|
+
|
|
11
|
+
Renders an entire conversation thread.
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import {
|
|
15
|
+
Thread,
|
|
16
|
+
ThreadWelcome,
|
|
17
|
+
Composer,
|
|
18
|
+
type ThreadConfig,
|
|
19
|
+
} from "@assistant-ui/react-ui";
|
|
20
|
+
|
|
21
|
+
const MyThread: FC<ThreadConfig> = (config) => {
|
|
22
|
+
return (
|
|
23
|
+
<Thread.Root config={config}>
|
|
24
|
+
<Thread.Viewport>
|
|
25
|
+
<ThreadWelcome />
|
|
26
|
+
<Thread.Messages />
|
|
27
|
+
<Thread.FollowupSuggestions />
|
|
28
|
+
<Thread.ViewportFooter>
|
|
29
|
+
<Thread.ScrollToBottom />
|
|
30
|
+
<Composer />
|
|
31
|
+
</Thread.ViewportFooter>
|
|
32
|
+
</Thread.Viewport>
|
|
33
|
+
</Thread.Root>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Usage:**
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
<MyThread />
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Thread.Root
|
|
45
|
+
|
|
46
|
+
Contains all parts of the thread. Accepts a `config` prop which is used by many other styled components.
|
|
47
|
+
|
|
48
|
+
### Thread.Viewport
|
|
49
|
+
|
|
50
|
+
The scrollable area containing all messages. Anchors scroll to the bottom as new messages are added.
|
|
51
|
+
|
|
52
|
+
### Thread.Messages
|
|
53
|
+
|
|
54
|
+
Renders all messages. This renders a separate component for each message (passed to the `components` prop).
|
|
55
|
+
|
|
56
|
+
### Thread.ViewportFooter
|
|
57
|
+
|
|
58
|
+
Renders the footer of the thread viewport. This is the sticky footer that does not scroll with the messages.
|
|
59
|
+
|
|
60
|
+
### Thread.ScrollToBottom
|
|
61
|
+
|
|
62
|
+
A button to scroll the viewport to the bottom. Hidden when the viewport is already at bottom.
|
|
63
|
+
|
|
64
|
+
## ThreadWelcome
|
|
65
|
+
|
|
66
|
+
Renders the welcome message when no messages are present.
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
import { ThreadWelcome } from "@assistant-ui/react-ui";
|
|
70
|
+
|
|
71
|
+
const MyThreadWelcome: FC = () => {
|
|
72
|
+
return (
|
|
73
|
+
<ThreadWelcome.Root>
|
|
74
|
+
<ThreadWelcome.Center>
|
|
75
|
+
<ThreadWelcome.Avatar />
|
|
76
|
+
<ThreadWelcome.Message />
|
|
77
|
+
</ThreadWelcome.Center>
|
|
78
|
+
<ThreadWelcome.Suggestions />
|
|
79
|
+
</ThreadWelcome.Root>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Usage:**
|
|
85
|
+
|
|
86
|
+
Decompose `Thread` into `MyThread` and use `MyThreadWelcome` instead of `ThreadWelcome`.
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
const MyThread: FC<ThreadConfig> = (config) => {
|
|
90
|
+
...
|
|
91
|
+
<MyThreadWelcome />
|
|
92
|
+
...
|
|
93
|
+
};
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### ThreadWelcome.Root
|
|
97
|
+
|
|
98
|
+
Contains all parts of the welcome message.
|
|
99
|
+
|
|
100
|
+
### ThreadWelcome.Center
|
|
101
|
+
|
|
102
|
+
The centered content of the welcome message.
|
|
103
|
+
|
|
104
|
+
### ThreadWelcome.Avatar
|
|
105
|
+
|
|
106
|
+
The avatar of the assistant.
|
|
107
|
+
|
|
108
|
+
### ThreadWelcome.Message
|
|
109
|
+
|
|
110
|
+
The welcome message.
|
|
111
|
+
|
|
112
|
+
### ThreadWelcome.Suggestions
|
|
113
|
+
|
|
114
|
+
Conversation starter suggestions.
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { ThreadWelcome } from "@assistant-ui/react-ui";
|
|
118
|
+
|
|
119
|
+
const MyThreadWelcomeSuggestions: FC = () => {
|
|
120
|
+
return (
|
|
121
|
+
<div className="aui-thread-welcome-suggestions">
|
|
122
|
+
<ThreadWelcome.Suggestion prompt="Write me a poem about the weather" />
|
|
123
|
+
<ThreadWelcome.Suggestion prompt="What is assistant-ui?" />
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### ThreadWelcome.Suggestion
|
|
130
|
+
|
|
131
|
+
A conversation starter suggestion.
|
|
132
|
+
|
|
133
|
+
## Composer
|
|
134
|
+
|
|
135
|
+
Renders the composer.
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import { Composer } from "@assistant-ui/react-ui";
|
|
139
|
+
|
|
140
|
+
const MyComposer: FC = () => {
|
|
141
|
+
return (
|
|
142
|
+
<Composer.Root>
|
|
143
|
+
<Composer.Attachments />
|
|
144
|
+
<Composer.AddAttachment />
|
|
145
|
+
<Composer.Input autoFocus />
|
|
146
|
+
<Composer.Action />
|
|
147
|
+
</Composer.Root>
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Usage:**
|
|
153
|
+
|
|
154
|
+
Decompose `Thread` into `MyThread` and use `MyComposer` instead of `Composer`.
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
const MyThread: FC<ThreadConfig> = (config) => {
|
|
158
|
+
...
|
|
159
|
+
<MyComposer />
|
|
160
|
+
...
|
|
161
|
+
};
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Composer.Root
|
|
165
|
+
|
|
166
|
+
Contains all parts of the composer.
|
|
167
|
+
|
|
168
|
+
### Composer.Input
|
|
169
|
+
|
|
170
|
+
The text input field for the user to type a new message.
|
|
171
|
+
|
|
172
|
+
### Composer.Action
|
|
173
|
+
|
|
174
|
+
The button to send or cancel the message.
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
import { Composer, ThreadPrimitive } from "@assistant-ui/react-ui";
|
|
178
|
+
|
|
179
|
+
const MyComposerAction: FC = () => {
|
|
180
|
+
return (
|
|
181
|
+
<>
|
|
182
|
+
<ThreadPrimitive.If running={false}>
|
|
183
|
+
<Composer.Send />
|
|
184
|
+
</ThreadPrimitive.If>
|
|
185
|
+
<ThreadPrimitive.If running>
|
|
186
|
+
<Composer.Cancel />
|
|
187
|
+
</ThreadPrimitive.If>
|
|
188
|
+
</>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Composer.Send
|
|
194
|
+
|
|
195
|
+
The button to send the message.
|
|
196
|
+
|
|
197
|
+
### Composer.Cancel
|
|
198
|
+
|
|
199
|
+
Sends a cancel action.
|
|
200
|
+
|
|
201
|
+
### Composer.Attachments
|
|
202
|
+
|
|
203
|
+
Renders attachments.
|
|
204
|
+
|
|
205
|
+
### Composer.AddAttachment
|
|
206
|
+
|
|
207
|
+
Renders an add attachment button.
|
|
208
|
+
|
|
209
|
+
## AttachmentUI
|
|
210
|
+
|
|
211
|
+
<Callout type="info" emoji="💡">
|
|
212
|
+
`AttachmentUI` is still experimental.
|
|
213
|
+
</Callout>
|
|
214
|
+
|
|
215
|
+
Renders an attachment.
|
|
216
|
+
|
|
217
|
+
```tsx
|
|
218
|
+
import { AttachmentUI } from "@assistant-ui/react-ui";
|
|
219
|
+
|
|
220
|
+
const MyAttachmentUI: FC = () => {
|
|
221
|
+
return (
|
|
222
|
+
<AttachmentUI.Root>
|
|
223
|
+
attachment
|
|
224
|
+
<AttachmentUI.Remove />
|
|
225
|
+
</AttachmentUI.Root>
|
|
226
|
+
);
|
|
227
|
+
};
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### AttachmentUI.Root
|
|
231
|
+
|
|
232
|
+
Contains all parts of the composer attachment.
|
|
233
|
+
|
|
234
|
+
### AttachmentUI.Remove
|
|
235
|
+
|
|
236
|
+
Renders a remove attachment button.
|
|
237
|
+
|
|
238
|
+
## AssistantMessage
|
|
239
|
+
|
|
240
|
+
Renders an assistant message.
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
import { AssistantMessage } from "@assistant-ui/react-ui";
|
|
244
|
+
|
|
245
|
+
const MyAssistantMessage: FC = () => {
|
|
246
|
+
return (
|
|
247
|
+
<AssistantMessage.Root>
|
|
248
|
+
<AssistantMessage.Avatar />
|
|
249
|
+
<AssistantMessage.Content />
|
|
250
|
+
<BranchPicker />
|
|
251
|
+
<AssistantActionBar />
|
|
252
|
+
</AssistantMessage.Root>
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Usage:**
|
|
258
|
+
|
|
259
|
+
Decompose `Thread` into `MyThread` and pass `MyAssistantMessage` to Thread.MEssages
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
const MyThread: FC<ThreadConfig> = (config) => {
|
|
263
|
+
...
|
|
264
|
+
<Thread.Messages components={{ AssistantMessage: MyAssistantMessage }} />
|
|
265
|
+
...
|
|
266
|
+
};
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### AssistantMessage.Root
|
|
270
|
+
|
|
271
|
+
Contains all parts of the assistant message.
|
|
272
|
+
|
|
273
|
+
### AssistantMessage.Avatar
|
|
274
|
+
|
|
275
|
+
The avatar of the assistant.
|
|
276
|
+
|
|
277
|
+
### AssistantMessage.Content
|
|
278
|
+
|
|
279
|
+
The content of the assistant message.
|
|
280
|
+
|
|
281
|
+
## AssistantActionBar
|
|
282
|
+
|
|
283
|
+
Renders the action bar for the assistant message.
|
|
284
|
+
|
|
285
|
+
```tsx
|
|
286
|
+
import { AssistantActionBar } from "@assistant-ui/react-ui";
|
|
287
|
+
|
|
288
|
+
const MyAssistantActionBar: FC = () => {
|
|
289
|
+
return (
|
|
290
|
+
<AssistantActionBar.Root
|
|
291
|
+
hideWhenRunning
|
|
292
|
+
autohide="not-last"
|
|
293
|
+
autohideFloat="single-branch"
|
|
294
|
+
>
|
|
295
|
+
<AssistantActionBar.SpeechControl />
|
|
296
|
+
<AssistantActionBar.Copy />
|
|
297
|
+
<AssistantActionBar.Reload />
|
|
298
|
+
<AssistantActionBar.FeedbackPositive />
|
|
299
|
+
<AssistantActionBar.FeedbackNegative />
|
|
300
|
+
</AssistantActionBar.Root>
|
|
301
|
+
);
|
|
302
|
+
};
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Usage:**
|
|
306
|
+
|
|
307
|
+
Decompose `AssistantMessage` into `MyAssistantMessage` and use `MyAssistantActionBar` instead of `AssistantActionBar`.
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
const MyAssistantMessage: FC = () => {
|
|
311
|
+
...
|
|
312
|
+
<MyAssistantActionBar />
|
|
313
|
+
...
|
|
314
|
+
};
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### AssistantActionBar.Root
|
|
318
|
+
|
|
319
|
+
Contains all parts of the assistant action bar.
|
|
320
|
+
|
|
321
|
+
### AssistantActionBar.Reload
|
|
322
|
+
|
|
323
|
+
Shows a reload button.
|
|
324
|
+
|
|
325
|
+
### AssistantActionBar.Copy
|
|
326
|
+
|
|
327
|
+
Shows a copy button.
|
|
328
|
+
|
|
329
|
+
### AssistantActionBar.SpeechControl
|
|
330
|
+
|
|
331
|
+
Shows a speech control button (either Speak or StopSpeaking).
|
|
332
|
+
|
|
333
|
+
### AssistantActionBar.Speak
|
|
334
|
+
|
|
335
|
+
Shows a speak button.
|
|
336
|
+
|
|
337
|
+
### AssistantActionBar.StopSpeaking
|
|
338
|
+
|
|
339
|
+
Shows a stop speaking button.
|
|
340
|
+
|
|
341
|
+
### AssistantActionBar.FeedbackPositive
|
|
342
|
+
|
|
343
|
+
Shows a positive feedback button.
|
|
344
|
+
|
|
345
|
+
### AssistantActionBar.FeedbackNegative
|
|
346
|
+
|
|
347
|
+
Shows a negative feedback button.
|
|
348
|
+
|
|
349
|
+
## BranchPicker
|
|
350
|
+
|
|
351
|
+
Renders the branch picker.
|
|
352
|
+
|
|
353
|
+
```tsx
|
|
354
|
+
import { BranchPicker } from "@assistant-ui/react-ui";
|
|
355
|
+
|
|
356
|
+
const MyBranchPicker: FC = () => {
|
|
357
|
+
return (
|
|
358
|
+
<BranchPicker.Root hideWhenSingleBranch>
|
|
359
|
+
<BranchPicker.Previous />
|
|
360
|
+
<BranchPicker.State />
|
|
361
|
+
<BranchPicker.Next />
|
|
362
|
+
</BranchPicker.Root>
|
|
363
|
+
);
|
|
364
|
+
};
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**Usage:**
|
|
368
|
+
|
|
369
|
+
Decompose `AssistantMessage` and `UserMessage` and use `MyBranchPicker` instead of `BranchPicker`.
|
|
370
|
+
|
|
371
|
+
```ts
|
|
372
|
+
const MyAssistantMessage: FC = () => {
|
|
373
|
+
...
|
|
374
|
+
<MyBranchPicker />
|
|
375
|
+
...
|
|
376
|
+
};
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
```ts
|
|
380
|
+
const MyUserMessage: FC = () => {
|
|
381
|
+
...
|
|
382
|
+
<MyBranchPicker />
|
|
383
|
+
...
|
|
384
|
+
};
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### BranchPicker.Root
|
|
388
|
+
|
|
389
|
+
Contains all parts of the branch picker.
|
|
390
|
+
|
|
391
|
+
### BranchPicker.Previous
|
|
392
|
+
|
|
393
|
+
Shows a previous button.
|
|
394
|
+
|
|
395
|
+
### BranchPicker.Next
|
|
396
|
+
|
|
397
|
+
Shows a next button.
|
|
398
|
+
|
|
399
|
+
### BranchPicker.State
|
|
400
|
+
|
|
401
|
+
Shows the current branch number and total number of branches.
|
|
402
|
+
|
|
403
|
+
```tsx
|
|
404
|
+
import { BranchPicker } from "@assistant-ui/react-ui";
|
|
405
|
+
|
|
406
|
+
const MyBranchPickerState: FC = () => {
|
|
407
|
+
return (
|
|
408
|
+
<span className="aui-branch-picker-state">
|
|
409
|
+
<BranchPicker.Number /> / <BranchPicker.Count />
|
|
410
|
+
</span>
|
|
411
|
+
);
|
|
412
|
+
};
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### BranchPicker.Number
|
|
416
|
+
|
|
417
|
+
The current branch number.
|
|
418
|
+
|
|
419
|
+
### BranchPicker.Count
|
|
420
|
+
|
|
421
|
+
The total number of branches.
|
|
422
|
+
|
|
423
|
+
## UserMessage
|
|
424
|
+
|
|
425
|
+
Renders a user message.
|
|
426
|
+
|
|
427
|
+
```tsx
|
|
428
|
+
import { UserMessage } from "@assistant-ui/react-ui";
|
|
429
|
+
|
|
430
|
+
const MyUserMessage: FC = () => {
|
|
431
|
+
return (
|
|
432
|
+
<UserMessage.Root>
|
|
433
|
+
<UserMessage.Attachments />
|
|
434
|
+
<UserMessage.Content />
|
|
435
|
+
<UserActionBar />
|
|
436
|
+
<BranchPicker />
|
|
437
|
+
</UserMessage.Root>
|
|
438
|
+
);
|
|
439
|
+
};
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
**Usage:**
|
|
443
|
+
|
|
444
|
+
Decompose `Thread` into `MyThread` and pass `MyUserMessage` to Thread.Messages
|
|
445
|
+
|
|
446
|
+
```ts
|
|
447
|
+
const MyThread: FC<ThreadConfig> = (config) => {
|
|
448
|
+
...
|
|
449
|
+
<Thread.Messages components={{ UserMessage: MyUserMessage }} />
|
|
450
|
+
...
|
|
451
|
+
};
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### UserMessage.Root
|
|
455
|
+
|
|
456
|
+
Contains all parts of the user message.
|
|
457
|
+
|
|
458
|
+
### UserMessage.Content
|
|
459
|
+
|
|
460
|
+
The content of the user message.
|
|
461
|
+
|
|
462
|
+
### UserMessage.Attachments
|
|
463
|
+
|
|
464
|
+
Renders attachments.
|
|
465
|
+
|
|
466
|
+
## UserActionBar
|
|
467
|
+
|
|
468
|
+
Renders the action bar for the user message.
|
|
469
|
+
|
|
470
|
+
```tsx
|
|
471
|
+
import { UserActionBar } from "@assistant-ui/react-ui";
|
|
472
|
+
|
|
473
|
+
const MyUserActionBar: FC = () => {
|
|
474
|
+
return (
|
|
475
|
+
<UserActionBar.Root hideWhenRunning autohide="not-last">
|
|
476
|
+
<UserActionBar.Edit />
|
|
477
|
+
</UserActionBar.Root>
|
|
478
|
+
);
|
|
479
|
+
};
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
**Usage:**
|
|
483
|
+
|
|
484
|
+
Decompose `UserMessage` into `MyUserMessage` and use `MyUserActionBar` instead of `UserActionBar`.
|
|
485
|
+
|
|
486
|
+
```ts
|
|
487
|
+
const MyUserMessage: FC = () => {
|
|
488
|
+
...
|
|
489
|
+
<MyUserActionBar />
|
|
490
|
+
...
|
|
491
|
+
};
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### UserActionBar.Root
|
|
495
|
+
|
|
496
|
+
Contains all parts of the user action bar.
|
|
497
|
+
|
|
498
|
+
### UserActionBar.Edit
|
|
499
|
+
|
|
500
|
+
Shows an edit button.
|
|
501
|
+
|
|
502
|
+
## UserAttachment
|
|
503
|
+
|
|
504
|
+
Renders an attachment.
|
|
505
|
+
|
|
506
|
+
```tsx
|
|
507
|
+
import { UserAttachment } from "@assistant-ui/react-ui";
|
|
508
|
+
|
|
509
|
+
const MyUserAttachment: FC = () => {
|
|
510
|
+
return <UserAttachment.Root>attachment</UserAttachment.Root>;
|
|
511
|
+
};
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### UserAttachment.Root
|
|
515
|
+
|
|
516
|
+
Contains all parts of the user attachment.
|
|
517
|
+
|
|
518
|
+
## EditComposer
|
|
519
|
+
|
|
520
|
+
Renders a user message being edited.
|
|
521
|
+
|
|
522
|
+
```tsx
|
|
523
|
+
import { EditComposer } from "@assistant-ui/react-ui";
|
|
524
|
+
|
|
525
|
+
const MyEditComposer: FC = () => {
|
|
526
|
+
return (
|
|
527
|
+
<EditComposer.Root>
|
|
528
|
+
<EditComposer.Input />
|
|
529
|
+
<EditComposer.Footer>
|
|
530
|
+
<EditComposer.Cancel />
|
|
531
|
+
<EditComposer.Send />
|
|
532
|
+
</EditComposer.Footer>
|
|
533
|
+
</EditComposer.Root>
|
|
534
|
+
);
|
|
535
|
+
};
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
**Usage:**
|
|
539
|
+
|
|
540
|
+
Decompose `Thread` into `MyThread` and pass `MyEditComposer` to `Thread.Messages`.
|
|
541
|
+
|
|
542
|
+
```ts
|
|
543
|
+
const MyThread: FC<ThreadConfig> = (config) => {
|
|
544
|
+
...
|
|
545
|
+
<Thread.Messages components={{ EditComposer: MyEditComposer }} />
|
|
546
|
+
...
|
|
547
|
+
};
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
### EditComposer.Root
|
|
551
|
+
|
|
552
|
+
Contains all parts of the edit composer.
|
|
553
|
+
|
|
554
|
+
### EditComposer.Input
|
|
555
|
+
|
|
556
|
+
The text input field for the user to type a new message.
|
|
557
|
+
|
|
558
|
+
### EditComposer.Footer
|
|
559
|
+
|
|
560
|
+
The footer of the edit composer.
|
|
561
|
+
|
|
562
|
+
### EditComposer.Cancel
|
|
563
|
+
|
|
564
|
+
Sends a cancel action.
|
|
565
|
+
|
|
566
|
+
### EditComposer.Send
|
|
567
|
+
|
|
568
|
+
Sends the message.
|
|
569
|
+
|
|
570
|
+
## AssistantModal
|
|
571
|
+
|
|
572
|
+
Renders the assistant modal.
|
|
573
|
+
|
|
574
|
+
```tsx
|
|
575
|
+
import {
|
|
576
|
+
AssistantModal,
|
|
577
|
+
Thread,
|
|
578
|
+
type ThreadConfig,
|
|
579
|
+
} from "@assistant-ui/react-ui";
|
|
580
|
+
|
|
581
|
+
const MyAssistantModal: FC<ThreadConfig> = (config) => {
|
|
582
|
+
return (
|
|
583
|
+
<AssistantModal.Root config={config}>
|
|
584
|
+
<AssistantModal.Trigger />
|
|
585
|
+
<AssistantModal.Content>
|
|
586
|
+
<Thread />
|
|
587
|
+
</AssistantModal.Content>
|
|
588
|
+
</AssistantModal.Root>
|
|
589
|
+
);
|
|
590
|
+
};
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
**Usage:**
|
|
594
|
+
|
|
595
|
+
```ts
|
|
596
|
+
<MyAssistantModal />
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
## ThreadList
|
|
600
|
+
|
|
601
|
+
Renders a thread list.
|
|
602
|
+
|
|
603
|
+
```tsx
|
|
604
|
+
import { ThreadList, ThreadListItem } from "@assistant-ui/react-ui";
|
|
605
|
+
|
|
606
|
+
const MyThreadList = () => {
|
|
607
|
+
return (
|
|
608
|
+
<ThreadList.Root>
|
|
609
|
+
<ThreadList.New />
|
|
610
|
+
<ThreadList.Items />
|
|
611
|
+
</ThreadList.Root>
|
|
612
|
+
);
|
|
613
|
+
};
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
### ThreadListItem
|
|
617
|
+
|
|
618
|
+
Renders a thread list item.
|
|
619
|
+
|
|
620
|
+
```tsx
|
|
621
|
+
import { ThreadListItem, ThreadListItemPrimitive } from "@assistant-ui/react-ui";
|
|
622
|
+
|
|
623
|
+
const MyThreadListItem = () => {
|
|
624
|
+
return (
|
|
625
|
+
<ThreadListItem.Root>
|
|
626
|
+
<ThreadListItemTrigger>
|
|
627
|
+
<ThreadListItemTitle />
|
|
628
|
+
</ThreadListItemTrigger>
|
|
629
|
+
<ThreadListItem.Archive />
|
|
630
|
+
</ThreadListItem.Root>
|
|
631
|
+
);
|
|
632
|
+
};
|
|
633
|
+
```
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Markdown
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Allow the assistant to display rich text using markdown.
|
|
6
|
+
|
|
7
|
+
import { Step, Steps } from "fumadocs-ui/components/steps";
|
|
8
|
+
import { Callout } from "fumadocs-ui/components/callout";
|
|
9
|
+
import { Tabs } from "fumadocs-ui/components/tabs";
|
|
10
|
+
|
|
11
|
+
## Enabling markdown support
|
|
12
|
+
|
|
13
|
+
<Steps>
|
|
14
|
+
|
|
15
|
+
<Step>
|
|
16
|
+
### Install `@assistant-ui/react-markdown`
|
|
17
|
+
|
|
18
|
+
```sh npm2yarn
|
|
19
|
+
npm install @assistant-ui/react-markdown
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
</Step>
|
|
23
|
+
<Step>
|
|
24
|
+
|
|
25
|
+
### Setup styles
|
|
26
|
+
|
|
27
|
+
<Tabs items={["Tailwind", "Tailwind + shadcn-ui", "Not using Tailwind"]}>
|
|
28
|
+
|
|
29
|
+
```ts {3} title="/tailwind.config.ts" tab="Tailwind"
|
|
30
|
+
{
|
|
31
|
+
plugins: [
|
|
32
|
+
require("tailwindcss-animate"),
|
|
33
|
+
require("@assistant-ui/react-ui/tailwindcss")
|
|
34
|
+
],
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```ts title="/tailwind.config.ts" tab="Tailwind + shadcn-ui"
|
|
39
|
+
{
|
|
40
|
+
plugins: [
|
|
41
|
+
require("tailwindcss-animate"),
|
|
42
|
+
require("@assistant-ui/react-ui/tailwindcss")({ shadcn: true })
|
|
43
|
+
],
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```ts title="/app/layout.tsx" tab="Not using Tailwind"
|
|
48
|
+
import "@assistant-ui/react-ui/styles/index.css";
|
|
49
|
+
import "@assistant-ui/react-ui/styles/markdown.css";
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
</Tabs>
|
|
53
|
+
|
|
54
|
+
</Step>
|
|
55
|
+
|
|
56
|
+
<Step>
|
|
57
|
+
|
|
58
|
+
### Define a `MarkdownText` component
|
|
59
|
+
|
|
60
|
+
```tsx {1} title="@/components/markdown-text.tsx"
|
|
61
|
+
import { makeMarkdownText } from "@assistant-ui/react-ui";
|
|
62
|
+
|
|
63
|
+
export const MarkdownText = makeMarkdownText();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
</Step>
|
|
67
|
+
|
|
68
|
+
<Step>
|
|
69
|
+
|
|
70
|
+
### Use it with `Thread`
|
|
71
|
+
|
|
72
|
+
Pass the `MarkdownText` component to your `Thread` component.
|
|
73
|
+
|
|
74
|
+
```tsx {1, 7}
|
|
75
|
+
import { MarkdownText } from "@/components/markdown-text";
|
|
76
|
+
|
|
77
|
+
const Home = () => {
|
|
78
|
+
return (
|
|
79
|
+
<Thread assistantMessage={{ components: { Text: MarkdownText } }}>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
</Step>
|
|
85
|
+
|
|
86
|
+
</Steps>
|