@assistant-ui/mcp-docs-server 0.1.19 → 0.1.21

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.
Files changed (108) hide show
  1. package/.docs/organized/code-examples/with-ag-ui.md +172 -1633
  2. package/.docs/organized/code-examples/with-ai-sdk-v6.md +42 -1640
  3. package/.docs/organized/code-examples/with-assistant-transport.md +40 -1743
  4. package/.docs/organized/code-examples/with-cloud.md +71 -1745
  5. package/.docs/organized/code-examples/with-custom-thread-list.md +87 -1723
  6. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +70 -1637
  7. package/.docs/organized/code-examples/with-external-store.md +67 -1624
  8. package/.docs/organized/code-examples/with-ffmpeg.md +71 -1629
  9. package/.docs/organized/code-examples/with-langgraph.md +95 -1893
  10. package/.docs/organized/code-examples/with-parent-id-grouping.md +57 -1654
  11. package/.docs/organized/code-examples/with-react-hook-form.md +220 -2163
  12. package/.docs/organized/code-examples/with-react-router.md +66 -1318
  13. package/.docs/organized/code-examples/with-store.md +31 -31
  14. package/.docs/organized/code-examples/with-tanstack.md +77 -861
  15. package/.docs/organized/code-examples/with-tap-runtime.md +812 -0
  16. package/.docs/raw/docs/(docs)/cli.mdx +66 -0
  17. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +0 -1
  18. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +0 -1
  19. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +4 -4
  20. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +3 -3
  21. package/.docs/raw/docs/(docs)/devtools.mdx +0 -1
  22. package/.docs/raw/docs/(docs)/guides/attachments.mdx +2 -3
  23. package/.docs/raw/docs/(docs)/guides/context-api.mdx +117 -117
  24. package/.docs/raw/docs/(docs)/guides/suggestions.mdx +296 -0
  25. package/.docs/raw/docs/(docs)/guides/tools.mdx +336 -513
  26. package/.docs/raw/docs/(docs)/index.mdx +33 -410
  27. package/.docs/raw/docs/(docs)/installation.mdx +450 -0
  28. package/.docs/raw/docs/(docs)/llm.mdx +209 -0
  29. package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +0 -1
  30. package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +0 -1
  31. package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +48 -3
  32. package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +0 -1
  33. package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +0 -1
  34. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +9 -3
  35. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +20 -52
  36. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +16 -39
  37. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +49 -50
  38. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +3 -11
  39. package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +0 -3
  40. package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +0 -1
  41. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +5 -16
  42. package/.docs/raw/docs/(reference)/api-reference/primitives/composition.mdx +0 -1
  43. package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +0 -1
  44. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +1 -2
  45. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +0 -1
  46. package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +152 -0
  47. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +0 -1
  48. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +1 -2
  49. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +1 -2
  50. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +28 -40
  51. package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +0 -1
  52. package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +1 -2
  53. package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +2 -3
  54. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +1 -2
  55. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +1 -2
  56. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +0 -1
  57. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +0 -1
  58. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +1 -2
  59. package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -1
  60. package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +5 -5
  61. package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -1
  62. package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -1
  63. package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +207 -33
  64. package/.docs/raw/docs/(reference)/react-compatibility.mdx +0 -1
  65. package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +0 -1
  66. package/.docs/raw/docs/cloud/persistence/langgraph.mdx +0 -1
  67. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +0 -1
  68. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +118 -0
  69. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +198 -0
  70. package/.docs/raw/docs/runtimes/assistant-transport.mdx +3 -3
  71. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +5 -6
  72. package/.docs/raw/docs/runtimes/custom/external-store.mdx +9 -11
  73. package/.docs/raw/docs/runtimes/custom/local.mdx +43 -36
  74. package/.docs/raw/docs/runtimes/data-stream.mdx +35 -3
  75. package/.docs/raw/docs/runtimes/langgraph/index.mdx +1 -2
  76. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +0 -1
  77. package/.docs/raw/docs/runtimes/langserve.mdx +0 -1
  78. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -1
  79. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -1
  80. package/.docs/raw/docs/ui/accordion.mdx +259 -0
  81. package/.docs/raw/docs/ui/assistant-modal.mdx +1 -3
  82. package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -3
  83. package/.docs/raw/docs/ui/attachment.mdx +0 -2
  84. package/.docs/raw/docs/ui/badge.mdx +138 -0
  85. package/.docs/raw/docs/ui/diff-viewer.mdx +279 -0
  86. package/.docs/raw/docs/ui/file.mdx +152 -0
  87. package/.docs/raw/docs/ui/image.mdx +100 -0
  88. package/.docs/raw/docs/ui/markdown.mdx +0 -1
  89. package/.docs/raw/docs/ui/mermaid.mdx +0 -1
  90. package/.docs/raw/docs/ui/model-selector.mdx +224 -0
  91. package/.docs/raw/docs/ui/part-grouping.mdx +4 -5
  92. package/.docs/raw/docs/ui/reasoning.mdx +6 -5
  93. package/.docs/raw/docs/ui/scrollbar.mdx +26 -9
  94. package/.docs/raw/docs/ui/select.mdx +245 -0
  95. package/.docs/raw/docs/ui/sources.mdx +6 -5
  96. package/.docs/raw/docs/ui/streamdown.mdx +348 -0
  97. package/.docs/raw/docs/ui/syntax-highlighting.mdx +8 -63
  98. package/.docs/raw/docs/ui/tabs.mdx +259 -0
  99. package/.docs/raw/docs/ui/thread-list.mdx +98 -16
  100. package/.docs/raw/docs/ui/thread.mdx +57 -73
  101. package/.docs/raw/docs/ui/tool-fallback.mdx +0 -1
  102. package/.docs/raw/docs/ui/tool-group.mdx +1 -3
  103. package/README.md +3 -3
  104. package/package.json +4 -4
  105. package/src/tools/tests/examples.test.ts +1 -1
  106. package/.docs/raw/docs/(docs)/about-assistantui.mdx +0 -54
  107. package/.docs/raw/docs/(docs)/mcp-docs-server.mdx +0 -321
  108. package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +0 -219
@@ -5,7 +5,6 @@ description: Hooks for connecting to data stream protocol endpoints and Assistan
5
5
 
6
6
  Data Stream protocol integration for assistant-ui.
7
7
 
8
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
9
8
 
10
9
  ## API Reference
11
10
 
@@ -157,7 +156,12 @@ const MyRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
157
156
 
158
157
  ### `toLanguageModelMessages`
159
158
 
160
- Convert assistant-ui messages to language model format.
159
+ Convert assistant-ui messages to AI SDK's `LanguageModelV2Message` format.
160
+
161
+ <Callout type="info">
162
+ For custom integrations, consider using `toGenericMessages` from `assistant-stream` instead.
163
+ This function is specific to the AI SDK format.
164
+ </Callout>
161
165
 
162
166
  ```tsx
163
167
  import { toLanguageModelMessages } from "@assistant-ui/react-data-stream";
@@ -192,4 +196,45 @@ const languageModelMessages = toLanguageModelMessages(messages, {
192
196
  ],
193
197
  },
194
198
  ]}
195
- />
199
+ />
200
+
201
+ ---
202
+
203
+ ## Framework-Agnostic Utilities
204
+
205
+ For custom integrations that don't use the AI SDK, use these utilities from `assistant-stream`:
206
+
207
+ ### `toGenericMessages`
208
+
209
+ Convert thread messages to a framework-agnostic format.
210
+
211
+ ```tsx
212
+ import { toGenericMessages } from "assistant-stream";
213
+
214
+ const genericMessages = toGenericMessages(messages);
215
+ ```
216
+
217
+ Returns an array of `GenericMessage` which can be one of:
218
+ - `{ role: "system"; content: string }`
219
+ - `{ role: "user"; content: (GenericTextPart | GenericFilePart)[] }`
220
+ - `{ role: "assistant"; content: (GenericTextPart | GenericToolCallPart)[] }`
221
+ - `{ role: "tool"; content: GenericToolResultPart[] }`
222
+
223
+ ### `toToolsJSONSchema`
224
+
225
+ Convert tool definitions to JSON Schema format.
226
+
227
+ ```tsx
228
+ import { toToolsJSONSchema } from "assistant-stream";
229
+
230
+ const toolSchemas = toToolsJSONSchema(tools);
231
+ // Returns: Record<string, { description?: string; parameters: JSONSchema7 }>
232
+ ```
233
+
234
+ By default, filters out disabled tools and backend-only tools. Use the `filter` option to customize:
235
+
236
+ ```tsx
237
+ const allTools = toToolsJSONSchema(tools, {
238
+ filter: () => true, // Include all tools
239
+ });
240
+ ```
@@ -5,7 +5,6 @@ description: React Hook Form integration for AI-assisted form filling.
5
5
 
6
6
  A React Hook Form integration for @assistant-ui.
7
7
 
8
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
9
8
 
10
9
  ## API Reference
11
10
 
@@ -5,7 +5,6 @@ description: Vercel AI SDK v5 integration with chat runtime hooks and transport
5
5
 
6
6
  Vercel AI SDK integration for assistant-ui.
7
7
 
8
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
9
8
 
10
9
  <Callout type="info">
11
10
  This package provides integration with AI SDK v5. For AI SDK v4, see the [AI
@@ -35,7 +35,13 @@ export const contextColors = {
35
35
 
36
36
  - [`useDataStreamRuntime`](#use-data-stream-runtime)
37
37
  - [`useCloudRuntime`](#use-cloud-runtime)
38
- - [`toLanguageModelMessages`](#to-language-model-messages)
38
+ - [`toLanguageModelMessages`](#to-language-model-messages) (AI SDK specific)
39
+
40
+ ### assistant-stream (Framework-Agnostic)
41
+
42
+ - [`toGenericMessages`](#to-generic-messages)
43
+ - [`toToolsJSONSchema`](#to-tools-json-schema)
44
+ - [`GenericMessage`](#generic-message)
39
45
 
40
46
  ### LangGraph
41
47
 
@@ -239,7 +245,7 @@ A conversation thread.
239
245
  tooltip="Displayed when the thread is empty"
240
246
  />
241
247
  <Component
242
- name="AssistantIf"
248
+ name="AuiIf"
243
249
  docsLink="#assistant-if"
244
250
  tooltip="Conditional rendering based on assistant state"
245
251
  />
@@ -383,7 +389,7 @@ Manages the state and actions for individual messages
383
389
  tooltip="Displays attachments in the message"
384
390
  />
385
391
  <Component
386
- name="AssistantIf"
392
+ name="AuiIf"
387
393
  docsLink="#assistant-if"
388
394
  tooltip="Conditional rendering based on assistant state"
389
395
  />
@@ -4,9 +4,6 @@ title: ActionBarMorePrimitive
4
4
 
5
5
  A dropdown menu for additional actions that don't fit in the main action bar.
6
6
 
7
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
8
- import { DataAttributesTable } from "@/components/docs/tables/DataAttributesTable";
9
- import { Code } from "@radix-ui/themes";
10
7
 
11
8
  ## Anatomy
12
9
 
@@ -97,18 +94,10 @@ This primitive renders a `<button>` element unless `asChild` is set.
97
94
  ]}
98
95
  />
99
96
 
100
- <DataAttributesTable
101
- data={[
102
- {
103
- attribute: "[data-state]",
104
- values: <Code>"open" | "closed"</Code>,
105
- },
106
- {
107
- attribute: "[data-disabled]",
108
- values: "Present when disabled",
109
- },
110
- ]}
111
- />
97
+ | Data attribute | Values |
98
+ | --- | --- |
99
+ | `[data-state]` | `"open" \| "closed"` |
100
+ | `[data-disabled]` | Present when disabled |
112
101
 
113
102
  ### Content
114
103
 
@@ -154,22 +143,11 @@ This primitive renders a `<div>` element unless `asChild` is set.
154
143
  ]}
155
144
  />
156
145
 
157
- <DataAttributesTable
158
- data={[
159
- {
160
- attribute: "[data-state]",
161
- values: <Code>"open" | "closed"</Code>,
162
- },
163
- {
164
- attribute: "[data-side]",
165
- values: <Code>"top" | "right" | "bottom" | "left"</Code>,
166
- },
167
- {
168
- attribute: "[data-align]",
169
- values: <Code>"start" | "center" | "end"</Code>,
170
- },
171
- ]}
172
- />
146
+ | Data attribute | Values |
147
+ | --- | --- |
148
+ | `[data-state]` | `"open" \| "closed"` |
149
+ | `[data-side]` | `"top" \| "right" \| "bottom" \| "left"` |
150
+ | `[data-align]` | `"start" \| "center" \| "end"` |
173
151
 
174
152
  Refer to Radix UI's Documentation for [DropdownMenu.Content](https://www.radix-ui.com/primitives/docs/components/dropdown-menu#content) for more details.
175
153
 
@@ -205,18 +183,10 @@ This primitive renders a `<div>` element unless `asChild` is set.
205
183
  ]}
206
184
  />
207
185
 
208
- <DataAttributesTable
209
- data={[
210
- {
211
- attribute: "[data-disabled]",
212
- values: "Present when disabled",
213
- },
214
- {
215
- attribute: "[data-highlighted]",
216
- values: "Present when highlighted",
217
- },
218
- ]}
219
- />
186
+ | Data attribute | Values |
187
+ | --- | --- |
188
+ | `[data-disabled]` | Present when disabled |
189
+ | `[data-highlighted]` | Present when highlighted |
220
190
 
221
191
  Refer to Radix UI's Documentation for [DropdownMenu.Item](https://www.radix-ui.com/primitives/docs/components/dropdown-menu#item) for more details.
222
192
 
@@ -284,22 +254,22 @@ You can combine the dropdown menu items with action hooks from ActionBarPrimitiv
284
254
  import {
285
255
  ActionBarPrimitive,
286
256
  ActionBarMorePrimitive,
287
- useAssistantApi,
288
- useAssistantState,
257
+ useAui,
258
+ useAuiState,
289
259
  } from "@assistant-ui/react";
290
260
  import { useCallback } from "react";
291
261
 
292
262
  const useEditAction = () => {
293
- const api = useAssistantApi();
294
- const disabled = useAssistantState(({ composer }) => composer.isEditing);
295
- const callback = useCallback(() => api.composer().beginEdit(), [api]);
263
+ const aui = useAui();
264
+ const disabled = useAuiState(({ composer }) => composer.isEditing);
265
+ const callback = useCallback(() => aui.composer().beginEdit(), [aui]);
296
266
  if (disabled) return null;
297
267
  return callback;
298
268
  };
299
269
 
300
270
  const useSpeakAction = () => {
301
- const api = useAssistantApi();
302
- return useCallback(() => api.message().speak(), [api]);
271
+ const aui = useAui();
272
+ return useCallback(() => aui.message().speak(), [aui]);
303
273
  };
304
274
 
305
275
  const MoreActionsWithHooks = () => {
@@ -323,5 +293,3 @@ const MoreActionsWithHooks = () => {
323
293
  );
324
294
  };
325
295
  ```
326
-
327
-
@@ -5,9 +5,6 @@ description: Buttons for message actions like copy, edit, reload, speak, and fee
5
5
 
6
6
  Buttons to interact with the message.
7
7
 
8
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
9
- import { DataAttributesTable } from "@/components/docs/tables/DataAttributesTable";
10
- import { Code } from "@radix-ui/themes";
11
8
 
12
9
  ## Anatomy
13
10
 
@@ -93,14 +90,9 @@ This primitive renders a `<div>` element unless `asChild` is set.
93
90
  ]}
94
91
  />
95
92
 
96
- <DataAttributesTable
97
- data={[
98
- {
99
- attribute: "[data-floating]",
100
- values: "Present when floating",
101
- },
102
- ]}
103
- />
93
+ | Data attribute | Values |
94
+ | --- | --- |
95
+ | `[data-floating]` | Present when floating |
104
96
 
105
97
  ### Edit
106
98
 
@@ -154,14 +146,9 @@ This primitive renders a `<button>` element unless `asChild` is set.
154
146
  ]}
155
147
  />
156
148
 
157
- <DataAttributesTable
158
- data={[
159
- {
160
- attribute: "[data-copied]",
161
- values: "Present when the message was recently copied.",
162
- },
163
- ]}
164
- />
149
+ | Data attribute | Values |
150
+ | --- | --- |
151
+ | `[data-copied]` | Present when the message was recently copied. |
165
152
 
166
153
  #### Copied state
167
154
 
@@ -169,12 +156,12 @@ Show a different icon for a few seconds after the message is copied.
169
156
 
170
157
  ```tsx
171
158
  <ActionBarPrimitive.Copy>
172
- <AssistantIf condition={({ message }) => !message.isCopied}>
159
+ <AuiIf condition={({ message }) => !message.isCopied}>
173
160
  <CopyIcon />
174
- </AssistantIf>
175
- <AssistantIf condition={({ message }) => message.isCopied}>
161
+ </AuiIf>
162
+ <AuiIf condition={({ message }) => message.isCopied}>
176
163
  <CopySuccessIcon />
177
- </AssistantIf>
164
+ </AuiIf>
178
165
  </ActionBarPrimitive.Copy>
179
166
  ```
180
167
 
@@ -232,14 +219,9 @@ This primitive renders a `<button>` element unless `asChild` is set.
232
219
  ]}
233
220
  />
234
221
 
235
- <DataAttributesTable
236
- data={[
237
- {
238
- attribute: "[data-submitted]",
239
- values: "Present when positive feedback was submitted.",
240
- },
241
- ]}
242
- />
222
+ | Data attribute | Values |
223
+ | --- | --- |
224
+ | `[data-submitted]` | Present when positive feedback was submitted. |
243
225
 
244
226
  ### Feedback Negative
245
227
 
@@ -256,14 +238,9 @@ This primitive renders a `<button>` element unless `asChild` is set.
256
238
  ]}
257
239
  />
258
240
 
259
- <DataAttributesTable
260
- data={[
261
- {
262
- attribute: "[data-submitted]",
263
- values: "Present when negative feedback was submitted.",
264
- },
265
- ]}
266
- />
241
+ | Data attribute | Values |
242
+ | --- | --- |
243
+ | `[data-submitted]` | Present when negative feedback was submitted. |
267
244
 
268
245
  ### ExportMarkdown
269
246
 
@@ -1,30 +1,29 @@
1
1
  ---
2
- title: AssistantIf
2
+ title: AuiIf
3
3
  description: Conditional rendering component based on thread, message, or composer state.
4
4
  ---
5
5
 
6
6
  Conditionally render children based on assistant state.
7
7
 
8
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
9
8
 
10
9
  ## Anatomy
11
10
 
12
11
  ```tsx
13
- import { AssistantIf } from "@assistant-ui/react";
12
+ import { AuiIf } from "@assistant-ui/react";
14
13
 
15
- <AssistantIf condition={({ thread }) => thread.isEmpty}>
14
+ <AuiIf condition={({ thread }) => thread.isEmpty}>
16
15
  <WelcomeScreen />
17
- </AssistantIf>
16
+ </AuiIf>
18
17
  ```
19
18
 
20
19
  ## Overview
21
20
 
22
- `AssistantIf` is a generic conditional rendering component that provides access to the full assistant state. It replaces the deprecated `ThreadPrimitive.If`, `MessagePrimitive.If`, and `ComposerPrimitive.If` components with a single, flexible API.
21
+ `AuiIf` is a generic conditional rendering component that provides access to the full assistant state. It replaces the deprecated `ThreadPrimitive.If`, `MessagePrimitive.If`, and `ComposerPrimitive.If` components with a single, flexible API.
23
22
 
24
23
  ## API Reference
25
24
 
26
25
  <ParametersTable
27
- type="AssistantIfProps"
26
+ type="AuiIfProps"
28
27
  parameters={[
29
28
  {
30
29
  name: "condition",
@@ -81,120 +80,120 @@ The condition function receives an `AssistantState` object with the following pr
81
80
 
82
81
  ```tsx
83
82
  // Show welcome screen when thread is empty
84
- <AssistantIf condition={({ thread }) => thread.isEmpty}>
83
+ <AuiIf condition={({ thread }) => thread.isEmpty}>
85
84
  <WelcomeScreen />
86
- </AssistantIf>
85
+ </AuiIf>
87
86
 
88
87
  // Show loading indicator while running
89
- <AssistantIf condition={({ thread }) => thread.isRunning}>
88
+ <AuiIf condition={({ thread }) => thread.isRunning}>
90
89
  <LoadingSpinner />
91
- </AssistantIf>
90
+ </AuiIf>
92
91
 
93
92
  // Conditional send/cancel button
94
- <AssistantIf condition={({ thread }) => !thread.isRunning}>
93
+ <AuiIf condition={({ thread }) => !thread.isRunning}>
95
94
  <ComposerPrimitive.Send>Send</ComposerPrimitive.Send>
96
- </AssistantIf>
97
- <AssistantIf condition={({ thread }) => thread.isRunning}>
95
+ </AuiIf>
96
+ <AuiIf condition={({ thread }) => thread.isRunning}>
98
97
  <ComposerPrimitive.Cancel>Cancel</ComposerPrimitive.Cancel>
99
- </AssistantIf>
98
+ </AuiIf>
100
99
  ```
101
100
 
102
101
  ### Message State Conditions
103
102
 
104
103
  ```tsx
105
104
  // Show avatar only for assistant messages
106
- <AssistantIf condition={({ message }) => message.role === "assistant"}>
105
+ <AuiIf condition={({ message }) => message.role === "assistant"}>
107
106
  <AssistantAvatar />
108
- </AssistantIf>
107
+ </AuiIf>
109
108
 
110
109
  // Show disclaimer on last message
111
- <AssistantIf condition={({ message }) => message.isLast}>
110
+ <AuiIf condition={({ message }) => message.isLast}>
112
111
  <Disclaimer />
113
- </AssistantIf>
112
+ </AuiIf>
114
113
 
115
114
  // Toggle copy icon based on copied state
116
115
  <ActionBarPrimitive.Copy>
117
- <AssistantIf condition={({ message }) => !message.isCopied}>
116
+ <AuiIf condition={({ message }) => !message.isCopied}>
118
117
  <CopyIcon />
119
- </AssistantIf>
120
- <AssistantIf condition={({ message }) => message.isCopied}>
118
+ </AuiIf>
119
+ <AuiIf condition={({ message }) => message.isCopied}>
121
120
  <CheckIcon />
122
- </AssistantIf>
121
+ </AuiIf>
123
122
  </ActionBarPrimitive.Copy>
124
123
 
125
124
  // Show speak/stop button based on speech state
126
- <AssistantIf condition={({ message }) => message.speech == null}>
125
+ <AuiIf condition={({ message }) => message.speech == null}>
127
126
  <ActionBarPrimitive.Speak>
128
127
  <SpeakIcon />
129
128
  </ActionBarPrimitive.Speak>
130
- </AssistantIf>
131
- <AssistantIf condition={({ message }) => message.speech != null}>
129
+ </AuiIf>
130
+ <AuiIf condition={({ message }) => message.speech != null}>
132
131
  <ActionBarPrimitive.StopSpeaking>
133
132
  <StopIcon />
134
133
  </ActionBarPrimitive.StopSpeaking>
135
- </AssistantIf>
134
+ </AuiIf>
136
135
  ```
137
136
 
138
137
  ### Composer State Conditions
139
138
 
140
139
  ```tsx
141
140
  // Show placeholder when composer is empty
142
- <AssistantIf condition={({ composer }) => composer.isEmpty}>
141
+ <AuiIf condition={({ composer }) => composer.isEmpty}>
143
142
  <PlaceholderText />
144
- </AssistantIf>
143
+ </AuiIf>
145
144
 
146
145
  // Show attachment preview when editing
147
- <AssistantIf condition={({ composer }) => composer.isEditing}>
146
+ <AuiIf condition={({ composer }) => composer.isEditing}>
148
147
  <EditingIndicator />
149
- </AssistantIf>
148
+ </AuiIf>
150
149
  ```
151
150
 
152
151
  ### Complex Conditions
153
152
 
154
153
  ```tsx
155
154
  // Combine multiple conditions
156
- <AssistantIf condition={({ thread, message }) =>
155
+ <AuiIf condition={({ thread, message }) =>
157
156
  !thread.isRunning && message.role === "assistant"
158
157
  }>
159
158
  <ActionBar />
160
- </AssistantIf>
159
+ </AuiIf>
161
160
 
162
161
  // Custom logic
163
- <AssistantIf condition={({ thread }) =>
162
+ <AuiIf condition={({ thread }) =>
164
163
  thread.messages.length > 0 && !thread.isRunning
165
164
  }>
166
165
  <FollowUpSuggestions />
167
- </AssistantIf>
166
+ </AuiIf>
168
167
  ```
169
168
 
170
169
  ## Type Export
171
170
 
172
- You can import the `AssistantIf.Condition` type for typing your condition functions:
171
+ You can import the `AuiIf.Condition` type for typing your condition functions:
173
172
 
174
173
  ```tsx
175
- import { AssistantIf } from "@assistant-ui/react";
174
+ import { AuiIf } from "@assistant-ui/react";
176
175
 
177
- const isThreadEmpty: AssistantIf.Condition = ({ thread }) => thread.isEmpty;
176
+ const isThreadEmpty: AuiIf.Condition = ({ thread }) => thread.isEmpty;
178
177
 
179
- <AssistantIf condition={isThreadEmpty}>
178
+ <AuiIf condition={isThreadEmpty}>
180
179
  <WelcomeScreen />
181
- </AssistantIf>
180
+ </AuiIf>
182
181
  ```
183
182
 
184
183
  ## Migration from Deprecated Components
185
184
 
186
185
  <Callout type="warn">
187
- `ThreadPrimitive.If`, `MessagePrimitive.If`, and `ComposerPrimitive.If` are deprecated. Use `AssistantIf` instead.
186
+ `ThreadPrimitive.If`, `MessagePrimitive.If`, and `ComposerPrimitive.If` are deprecated. Use `AuiIf` instead.
188
187
  </Callout>
189
188
 
190
189
  | Before | After |
191
190
  |--------|-------|
192
- | `<ThreadPrimitive.If empty>` | `<AssistantIf condition={({ thread }) => thread.isEmpty}>` |
193
- | `<ThreadPrimitive.If running>` | `<AssistantIf condition={({ thread }) => thread.isRunning}>` |
194
- | `<ThreadPrimitive.If running={false}>` | `<AssistantIf condition={({ thread }) => !thread.isRunning}>` |
195
- | `<MessagePrimitive.If user>` | `<AssistantIf condition={({ message }) => message.role === "user"}>` |
196
- | `<MessagePrimitive.If assistant>` | `<AssistantIf condition={({ message }) => message.role === "assistant"}>` |
197
- | `<MessagePrimitive.If copied>` | `<AssistantIf condition={({ message }) => message.isCopied}>` |
198
- | `<MessagePrimitive.If speaking>` | `<AssistantIf condition={({ message }) => message.speech != null}>` |
199
- | `<MessagePrimitive.If last>` | `<AssistantIf condition={({ message }) => message.isLast}>` |
200
- | `<ComposerPrimitive.If editing>` | `<AssistantIf condition={({ composer }) => composer.isEditing}>` |
191
+ | `<ThreadPrimitive.If empty>` | `<AuiIf condition={({ thread }) => thread.isEmpty}>` |
192
+ | `<ThreadPrimitive.If running>` | `<AuiIf condition={({ thread }) => thread.isRunning}>` |
193
+ | `<ThreadPrimitive.If running={false}>` | `<AuiIf condition={({ thread }) => !thread.isRunning}>` |
194
+ | `<MessagePrimitive.If user>` | `<AuiIf condition={({ message }) => message.role === "user"}>` |
195
+ | `<MessagePrimitive.If assistant>` | `<AuiIf condition={({ message }) => message.role === "assistant"}>` |
196
+ | `<MessagePrimitive.If copied>` | `<AuiIf condition={({ message }) => message.isCopied}>` |
197
+ | `<MessagePrimitive.If speaking>` | `<AuiIf condition={({ message }) => message.speech != null}>` |
198
+ | `<MessagePrimitive.If last>` | `<AuiIf condition={({ message }) => message.isLast}>` |
199
+ | `<ComposerPrimitive.If editing>` | `<AuiIf condition={({ composer }) => composer.isEditing}>` |
@@ -5,9 +5,6 @@ description: A popover chat interface for floating assistant UI in the corner of
5
5
 
6
6
  A modal chat UI usually displayed in the bottom right corner of the screen.
7
7
 
8
- import { Code } from "@radix-ui/themes";
9
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
10
- import { DataAttributesTable } from "@/components/docs/tables/DataAttributesTable";
11
8
 
12
9
  ## Anatomy
13
10
 
@@ -79,14 +76,9 @@ This primitive renders a `<button>` element unless `asChild` is set.
79
76
  ]}
80
77
  />
81
78
 
82
- <DataAttributesTable
83
- data={[
84
- {
85
- attribute: "[data-state]",
86
- values: <Code>"open" | "closed"</Code>,
87
- },
88
- ]}
89
- />
79
+ | Data attribute | Values |
80
+ | --- | --- |
81
+ | `[data-state]` | `"open" \| "closed"` |
90
82
 
91
83
  ### Anchor
92
84
 
@@ -5,9 +5,6 @@ description: Components for displaying and managing file attachments in messages
5
5
 
6
6
  Buttons to interact with attachments.
7
7
 
8
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
9
- import { DataAttributesTable } from "@/components/docs/tables/DataAttributesTable";
10
- import { Code } from "@radix-ui/themes";
11
8
 
12
9
  <Callout>
13
10
  **Dual Use!** Attachments can appear in both messages and composers.
@@ -5,7 +5,6 @@ description: Navigate between conversation branches with previous/next controls.
5
5
 
6
6
  View and switch between branches.
7
7
 
8
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
9
8
 
10
9
  ## Anatomy
11
10
 
@@ -6,9 +6,6 @@ description: Primitives for the text input, send button, and attachments.
6
6
  The user interface to add new messages or edit existing ones.
7
7
 
8
8
 
9
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
10
- import { KeyboardTable } from "@/components/docs/tables/KeyboardTable";
11
- import { Code } from "@radix-ui/themes";
12
9
 
13
10
  <Callout>
14
11
  **Dual Use!** A Composer placed directly inside a `Thread` will compose new
@@ -88,18 +85,10 @@ This primitive renders a `<textarea>` element unless `asChild` is set.
88
85
 
89
86
  #### Keyboard Shortcuts
90
87
 
91
- <KeyboardTable
92
- data={[
93
- {
94
- keys: ["Enter"],
95
- description: "Sends the message.",
96
- },
97
- {
98
- keys: ["Escape"],
99
- description: "Sends a cancel action.",
100
- },
101
- ]}
102
- />
88
+ | Key | Description |
89
+ | --- | --- |
90
+ | <Kbd>Enter</Kbd> | Sends the message. |
91
+ | <Kbd>Escape</Kbd> | Sends a cancel action. |
103
92
 
104
93
  ### Send
105
94
 
@@ -126,7 +115,7 @@ This primitive renders a `<button>` element unless `asChild` is set.
126
115
 
127
116
  Sends a cancel action.
128
117
 
129
- In edit composers, this action exits the edit mode.
118
+ In edit composers, this action exits the edit mode.
130
119
  In thread composers, this action stops the current run.
131
120
 
132
121
  This primitive renders a `<button>` element unless `asChild` is set.
@@ -3,7 +3,6 @@ title: Composition
3
3
  description: How to compose primitives with custom components using asChild.
4
4
  ---
5
5
 
6
- import { Code } from "@radix-ui/themes";
7
6
 
8
7
  `assistant-ui` primitives are composable. This means that all props are forwarded, classes are merged, and event handlers are chained.
9
8
 
@@ -5,7 +5,6 @@ description: Components for displaying error messages in the chat interface.
5
5
 
6
6
  A component for displaying error messages in the UI.
7
7
 
8
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
9
8
 
10
9
  ## Anatomy
11
10
 
@@ -3,7 +3,6 @@ title: MessagePartPrimitive
3
3
  description: Primitives for text, images, tool calls, and other message content.
4
4
  ---
5
5
 
6
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
7
6
  import {
8
7
  MessagePartRuntime,
9
8
  TextMessagePartState,
@@ -11,7 +10,7 @@ import {
11
10
  ToolCallMessagePartState,
12
11
  } from "@/generated/typeDocs";
13
12
 
14
- Each message can have any number of message parts.
13
+ Each message can have any number of message parts.
15
14
  Message parts are usually one of text, reasoning, audio or tool-call.
16
15
 
17
16
  ## Message part Types
@@ -5,7 +5,6 @@ description: Components for rendering message content, parts, and attachments.
5
5
 
6
6
  A single message in a conversation. Messages may consist of multiple parts.
7
7
 
8
- import { ParametersTable } from "@/components/docs/tables/ParametersTable";
9
8
 
10
9
  ## Anatomy
11
10