@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.
- package/.docs/organized/code-examples/with-ag-ui.md +172 -1633
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +42 -1640
- package/.docs/organized/code-examples/with-assistant-transport.md +40 -1743
- package/.docs/organized/code-examples/with-cloud.md +71 -1745
- package/.docs/organized/code-examples/with-custom-thread-list.md +87 -1723
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +70 -1637
- package/.docs/organized/code-examples/with-external-store.md +67 -1624
- package/.docs/organized/code-examples/with-ffmpeg.md +71 -1629
- package/.docs/organized/code-examples/with-langgraph.md +95 -1893
- package/.docs/organized/code-examples/with-parent-id-grouping.md +57 -1654
- package/.docs/organized/code-examples/with-react-hook-form.md +220 -2163
- package/.docs/organized/code-examples/with-react-router.md +66 -1318
- package/.docs/organized/code-examples/with-store.md +31 -31
- package/.docs/organized/code-examples/with-tanstack.md +77 -861
- package/.docs/organized/code-examples/with-tap-runtime.md +812 -0
- package/.docs/raw/docs/(docs)/cli.mdx +66 -0
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +0 -1
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +0 -1
- package/.docs/raw/docs/(docs)/copilots/model-context.mdx +4 -4
- package/.docs/raw/docs/(docs)/copilots/motivation.mdx +3 -3
- package/.docs/raw/docs/(docs)/devtools.mdx +0 -1
- package/.docs/raw/docs/(docs)/guides/attachments.mdx +2 -3
- package/.docs/raw/docs/(docs)/guides/context-api.mdx +117 -117
- package/.docs/raw/docs/(docs)/guides/suggestions.mdx +296 -0
- package/.docs/raw/docs/(docs)/guides/tools.mdx +336 -513
- package/.docs/raw/docs/(docs)/index.mdx +33 -410
- package/.docs/raw/docs/(docs)/installation.mdx +450 -0
- package/.docs/raw/docs/(docs)/llm.mdx +209 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +48 -3
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +9 -3
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +20 -52
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +16 -39
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +49 -50
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +3 -11
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +0 -3
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +5 -16
- package/.docs/raw/docs/(reference)/api-reference/primitives/composition.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +152 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +28 -40
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +2 -3
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +1 -2
- package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -1
- package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +5 -5
- package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -1
- package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -1
- package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +207 -33
- package/.docs/raw/docs/(reference)/react-compatibility.mdx +0 -1
- package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +0 -1
- package/.docs/raw/docs/cloud/persistence/langgraph.mdx +0 -1
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +0 -1
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +118 -0
- package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +198 -0
- package/.docs/raw/docs/runtimes/assistant-transport.mdx +3 -3
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +5 -6
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +9 -11
- package/.docs/raw/docs/runtimes/custom/local.mdx +43 -36
- package/.docs/raw/docs/runtimes/data-stream.mdx +35 -3
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +1 -2
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +0 -1
- package/.docs/raw/docs/runtimes/langserve.mdx +0 -1
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -1
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -1
- package/.docs/raw/docs/ui/accordion.mdx +259 -0
- package/.docs/raw/docs/ui/assistant-modal.mdx +1 -3
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -3
- package/.docs/raw/docs/ui/attachment.mdx +0 -2
- package/.docs/raw/docs/ui/badge.mdx +138 -0
- package/.docs/raw/docs/ui/diff-viewer.mdx +279 -0
- package/.docs/raw/docs/ui/file.mdx +152 -0
- package/.docs/raw/docs/ui/image.mdx +100 -0
- package/.docs/raw/docs/ui/markdown.mdx +0 -1
- package/.docs/raw/docs/ui/mermaid.mdx +0 -1
- package/.docs/raw/docs/ui/model-selector.mdx +224 -0
- package/.docs/raw/docs/ui/part-grouping.mdx +4 -5
- package/.docs/raw/docs/ui/reasoning.mdx +6 -5
- package/.docs/raw/docs/ui/scrollbar.mdx +26 -9
- package/.docs/raw/docs/ui/select.mdx +245 -0
- package/.docs/raw/docs/ui/sources.mdx +6 -5
- package/.docs/raw/docs/ui/streamdown.mdx +348 -0
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +8 -63
- package/.docs/raw/docs/ui/tabs.mdx +259 -0
- package/.docs/raw/docs/ui/thread-list.mdx +98 -16
- package/.docs/raw/docs/ui/thread.mdx +57 -73
- package/.docs/raw/docs/ui/tool-fallback.mdx +0 -1
- package/.docs/raw/docs/ui/tool-group.mdx +1 -3
- package/README.md +3 -3
- package/package.json +4 -4
- package/src/tools/tests/examples.test.ts +1 -1
- package/.docs/raw/docs/(docs)/about-assistantui.mdx +0 -54
- package/.docs/raw/docs/(docs)/mcp-docs-server.mdx +0 -321
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +0 -219
|
@@ -3,8 +3,6 @@ title: ExternalStoreRuntime
|
|
|
3
3
|
description: Bring your own Redux, Zustand, or state manager.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
7
|
-
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
8
6
|
|
|
9
7
|
## Overview
|
|
10
8
|
|
|
@@ -154,7 +152,7 @@ graph TD
|
|
|
154
152
|
<InstallCommand npm={["@assistant-ui/react"]} />
|
|
155
153
|
|
|
156
154
|
</Step>
|
|
157
|
-
|
|
155
|
+
|
|
158
156
|
<Step>
|
|
159
157
|
### Create Runtime Provider
|
|
160
158
|
|
|
@@ -168,45 +166,45 @@ graph TD
|
|
|
168
166
|
useExternalStoreRuntime,
|
|
169
167
|
} from "@assistant-ui/react";
|
|
170
168
|
import { useState } from "react";
|
|
171
|
-
|
|
169
|
+
|
|
172
170
|
const convertMessage = (message: ThreadMessageLike) => {
|
|
173
171
|
return message;
|
|
174
172
|
};
|
|
175
|
-
|
|
173
|
+
|
|
176
174
|
export function MyRuntimeProvider({
|
|
177
175
|
children,
|
|
178
176
|
}: Readonly<{
|
|
179
177
|
children: React.ReactNode;
|
|
180
178
|
}>) {
|
|
181
179
|
const [messages, setMessages] = useState<readonly ThreadMessageLike[]>([]);
|
|
182
|
-
|
|
180
|
+
|
|
183
181
|
const onNew = async (message: AppendMessage) => {
|
|
184
182
|
if (message.content.length !== 1 || message.content[0]?.type !== "text")
|
|
185
183
|
throw new Error("Only text content is supported");
|
|
186
|
-
|
|
184
|
+
|
|
187
185
|
const userMessage: ThreadMessageLike = {
|
|
188
186
|
role: "user",
|
|
189
187
|
content: [{ type: "text", text: message.content[0].text }],
|
|
190
188
|
};
|
|
191
189
|
setMessages((currentMessages) => [...currentMessages, userMessage]);
|
|
192
|
-
|
|
190
|
+
|
|
193
191
|
// normally you would perform an API call here to get the assistant response
|
|
194
192
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
195
|
-
|
|
193
|
+
|
|
196
194
|
const assistantMessage: ThreadMessageLike = {
|
|
197
195
|
role: "assistant",
|
|
198
196
|
content: [{ type: "text", text: "Hello, world!" }],
|
|
199
197
|
};
|
|
200
198
|
setMessages((currentMessages) => [...currentMessages, assistantMessage]);
|
|
201
199
|
};
|
|
202
|
-
|
|
200
|
+
|
|
203
201
|
const runtime = useExternalStoreRuntime<ThreadMessageLike>({
|
|
204
202
|
messages,
|
|
205
203
|
setMessages,
|
|
206
204
|
onNew,
|
|
207
205
|
convertMessage,
|
|
208
206
|
});
|
|
209
|
-
|
|
207
|
+
|
|
210
208
|
return (
|
|
211
209
|
<AssistantRuntimeProvider runtime={runtime}>
|
|
212
210
|
{children}
|
|
@@ -3,8 +3,6 @@ title: LocalRuntime
|
|
|
3
3
|
description: Quickest path to a working chat. Handles state while you handle the API.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
7
|
-
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
8
6
|
|
|
9
7
|
## Overview
|
|
10
8
|
|
|
@@ -302,37 +300,46 @@ const MyModelAdapter: ChatModelAdapter = {
|
|
|
302
300
|
|
|
303
301
|
### Basic Tool Definition
|
|
304
302
|
|
|
303
|
+
Tools should be registered using the `Tools()` API with `useAui()`:
|
|
304
|
+
|
|
305
305
|
```tsx
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
type: "string",
|
|
321
|
-
enum: ["celsius", "fahrenheit"],
|
|
322
|
-
},
|
|
323
|
-
},
|
|
324
|
-
required: ["location"],
|
|
325
|
-
},
|
|
306
|
+
import { useAui, Tools, type Toolkit } from "@assistant-ui/react";
|
|
307
|
+
import { z } from "zod";
|
|
308
|
+
|
|
309
|
+
// Define your toolkit
|
|
310
|
+
const myToolkit: Toolkit = {
|
|
311
|
+
getWeather: {
|
|
312
|
+
description: "Get the current weather in a location",
|
|
313
|
+
parameters: z.object({
|
|
314
|
+
location: z.string().describe("The city and state, e.g. San Francisco, CA"),
|
|
315
|
+
unit: z.enum(["celsius", "fahrenheit"]).default("celsius"),
|
|
316
|
+
}),
|
|
317
|
+
execute: async ({ location, unit }) => {
|
|
318
|
+
const weather = await fetchWeatherAPI(location, unit);
|
|
319
|
+
return weather;
|
|
326
320
|
},
|
|
327
321
|
},
|
|
328
|
-
|
|
322
|
+
};
|
|
329
323
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
324
|
+
// Register tools in your runtime provider
|
|
325
|
+
function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
326
|
+
const runtime = useLocalRuntime(MyModelAdapter);
|
|
327
|
+
|
|
328
|
+
// Register all tools
|
|
329
|
+
const aui = useAui({
|
|
330
|
+
tools: Tools({ toolkit: myToolkit }),
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
return (
|
|
334
|
+
<AssistantRuntimeProvider aui={aui} runtime={runtime}>
|
|
335
|
+
{children}
|
|
336
|
+
</AssistantRuntimeProvider>
|
|
337
|
+
);
|
|
338
|
+
}
|
|
334
339
|
```
|
|
335
340
|
|
|
341
|
+
The tools will be available to your adapter via the `context` parameter in the `run` function. See the [Tools guide](/docs/guides/tools) for more details on tool registration and advanced features.
|
|
342
|
+
|
|
336
343
|
### Human-in-the-Loop Approval
|
|
337
344
|
|
|
338
345
|
Require user confirmation before executing certain tools:
|
|
@@ -413,7 +420,7 @@ For custom thread storage, use `useRemoteThreadListRuntime` with your own adapte
|
|
|
413
420
|
```tsx
|
|
414
421
|
import {
|
|
415
422
|
unstable_useRemoteThreadListRuntime as useRemoteThreadListRuntime,
|
|
416
|
-
|
|
423
|
+
useAui,
|
|
417
424
|
RuntimeAdapterProvider,
|
|
418
425
|
AssistantRuntimeProvider,
|
|
419
426
|
type unstable_RemoteThreadListAdapter as RemoteThreadListAdapter,
|
|
@@ -485,13 +492,13 @@ export function MyRuntimeProvider({ children }) {
|
|
|
485
492
|
// The Provider component adds thread-specific adapters
|
|
486
493
|
unstable_Provider: ({ children }) => {
|
|
487
494
|
// This runs in the context of each thread
|
|
488
|
-
const
|
|
495
|
+
const aui = useAui();
|
|
489
496
|
|
|
490
497
|
// Create thread-specific history adapter
|
|
491
498
|
const history = useMemo<ThreadHistoryAdapter>(
|
|
492
499
|
() => ({
|
|
493
500
|
async load() {
|
|
494
|
-
const { remoteId } =
|
|
501
|
+
const { remoteId } = aui.threadListItem().getState();
|
|
495
502
|
if (!remoteId) return { messages: [] };
|
|
496
503
|
|
|
497
504
|
const messages = await db.messages.findByThreadId(remoteId);
|
|
@@ -507,7 +514,7 @@ export function MyRuntimeProvider({ children }) {
|
|
|
507
514
|
|
|
508
515
|
async append(message) {
|
|
509
516
|
// Wait for initialization to get remoteId (safe to call multiple times)
|
|
510
|
-
const { remoteId } = await
|
|
517
|
+
const { remoteId } = await aui.threadListItem().initialize();
|
|
511
518
|
|
|
512
519
|
await db.messages.create({
|
|
513
520
|
threadId: remoteId,
|
|
@@ -518,7 +525,7 @@ export function MyRuntimeProvider({ children }) {
|
|
|
518
525
|
});
|
|
519
526
|
},
|
|
520
527
|
}),
|
|
521
|
-
[
|
|
528
|
+
[aui],
|
|
522
529
|
);
|
|
523
530
|
|
|
524
531
|
const adapters = useMemo(() => ({ history }), [history]);
|
|
@@ -570,21 +577,21 @@ Without the history adapter, threads would have no message persistence, making t
|
|
|
570
577
|
When implementing a history adapter, `append()` may be called before the thread is fully initialized, causing the first message to be lost. Instead of checking `if (!remoteId)`, await initialization to ensure the `remoteId` is available:
|
|
571
578
|
|
|
572
579
|
```tsx
|
|
573
|
-
import {
|
|
580
|
+
import { useAui } from "@assistant-ui/react";
|
|
574
581
|
|
|
575
582
|
// Inside your unstable_Provider component
|
|
576
|
-
const
|
|
583
|
+
const aui = useAui();
|
|
577
584
|
|
|
578
585
|
const history = useMemo<ThreadHistoryAdapter>(
|
|
579
586
|
() => ({
|
|
580
587
|
async append(message) {
|
|
581
588
|
// Wait for initialization - safe to call multiple times
|
|
582
|
-
const { remoteId } = await
|
|
589
|
+
const { remoteId } = await aui.threadListItem().initialize();
|
|
583
590
|
await db.messages.create({ threadId: remoteId, ...message });
|
|
584
591
|
},
|
|
585
592
|
// ...
|
|
586
593
|
}),
|
|
587
|
-
[
|
|
594
|
+
[aui],
|
|
588
595
|
);
|
|
589
596
|
```
|
|
590
597
|
|
|
@@ -3,7 +3,6 @@ title: Data Stream Protocol
|
|
|
3
3
|
description: Integration with data stream protocol endpoints for streaming AI responses.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
7
6
|
|
|
8
7
|
The `@assistant-ui/react-data-stream` package provides integration with data stream protocol endpoints, enabling streaming AI responses with tool support and state management.
|
|
9
8
|
|
|
@@ -229,17 +228,50 @@ The `useCloudRuntime` hook is currently under active development and not yet rea
|
|
|
229
228
|
|
|
230
229
|
## Message Conversion
|
|
231
230
|
|
|
232
|
-
|
|
231
|
+
### Framework-Agnostic Conversion (Recommended)
|
|
232
|
+
|
|
233
|
+
For custom integrations, use the framework-agnostic utilities from `assistant-stream`:
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
import { toGenericMessages, toToolsJSONSchema } from "assistant-stream";
|
|
237
|
+
|
|
238
|
+
// Convert messages to a generic format
|
|
239
|
+
const genericMessages = toGenericMessages(messages);
|
|
240
|
+
|
|
241
|
+
// Convert tools to JSON Schema format
|
|
242
|
+
const toolSchemas = toToolsJSONSchema(tools);
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The `GenericMessage` format can be easily converted to any LLM provider format:
|
|
246
|
+
|
|
247
|
+
```tsx
|
|
248
|
+
import type { GenericMessage } from "assistant-stream";
|
|
249
|
+
|
|
250
|
+
// GenericMessage is a union of:
|
|
251
|
+
// - { role: "system"; content: string }
|
|
252
|
+
// - { role: "user"; content: (GenericTextPart | GenericFilePart)[] }
|
|
253
|
+
// - { role: "assistant"; content: (GenericTextPart | GenericToolCallPart)[] }
|
|
254
|
+
// - { role: "tool"; content: GenericToolResultPart[] }
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### AI SDK Specific Conversion
|
|
258
|
+
|
|
259
|
+
For AI SDK integration, use `toLanguageModelMessages`:
|
|
233
260
|
|
|
234
261
|
```tsx
|
|
235
262
|
import { toLanguageModelMessages } from "@assistant-ui/react-data-stream";
|
|
236
263
|
|
|
237
|
-
// Convert
|
|
264
|
+
// Convert to AI SDK LanguageModelV2Message format
|
|
238
265
|
const languageModelMessages = toLanguageModelMessages(messages, {
|
|
239
266
|
unstable_includeId: true, // Include message IDs
|
|
240
267
|
});
|
|
241
268
|
```
|
|
242
269
|
|
|
270
|
+
<Callout type="info">
|
|
271
|
+
`toLanguageModelMessages` internally uses `toGenericMessages` and adds AI SDK-specific transformations.
|
|
272
|
+
For new custom integrations, prefer using `toGenericMessages` directly.
|
|
273
|
+
</Callout>
|
|
274
|
+
|
|
243
275
|
## Error Handling
|
|
244
276
|
|
|
245
277
|
The runtime automatically handles common error scenarios:
|
|
@@ -36,7 +36,6 @@ NEXT_PUBLIC_LANGGRAPH_ASSISTANT_ID=your_graph_id
|
|
|
36
36
|
</Step>
|
|
37
37
|
</Steps>
|
|
38
38
|
|
|
39
|
-
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
40
39
|
|
|
41
40
|
## Installation in existing React project
|
|
42
41
|
|
|
@@ -232,7 +231,7 @@ export function MyAssistant() {
|
|
|
232
231
|
|
|
233
232
|
### Use the `MyAssistant` component
|
|
234
233
|
|
|
235
|
-
```tsx twoslash title="@/app/page.tsx" {
|
|
234
|
+
```tsx twoslash title="@/app/page.tsx" {1,6}
|
|
236
235
|
// @include: MyAssistant
|
|
237
236
|
// @filename: /app/page.tsx
|
|
238
237
|
// ---cut---
|
|
@@ -6,7 +6,6 @@ description: Add human-in-the-loop approval for tool calls.
|
|
|
6
6
|
## Background: LangGraph implementation details
|
|
7
7
|
|
|
8
8
|
import Image from "next/image";
|
|
9
|
-
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
10
9
|
import approval from "./images/stockbroker-langgraph.png";
|
|
11
10
|
|
|
12
11
|
<Image
|
|
@@ -3,7 +3,6 @@ title: Full-Stack Integration
|
|
|
3
3
|
description: Integrate Mastra directly into Next.js API routes.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
7
6
|
|
|
8
7
|
Integrate Mastra directly into your Next.js application's API routes. This approach keeps your backend and frontend code within the same project.
|
|
9
8
|
|
|
@@ -3,7 +3,6 @@ title: Separate Server Integration
|
|
|
3
3
|
description: Run Mastra as a standalone server connected to your frontend.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
7
6
|
|
|
8
7
|
Run Mastra as a standalone server and connect your Next.js frontend (using assistant-ui) to its API endpoints. This approach separates your AI backend from your frontend application, allowing for independent development and scaling.
|
|
9
8
|
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Accordion
|
|
3
|
+
description: A vertically stacked set of interactive headings that reveal or hide content sections.
|
|
4
|
+
links:
|
|
5
|
+
- label: Radix UI Accordion
|
|
6
|
+
url: https://www.radix-ui.com/primitives/docs/components/accordion
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
import { PreviewCode } from "@/components/docs/preview-code.server";
|
|
10
|
+
import {
|
|
11
|
+
AccordionSample,
|
|
12
|
+
AccordionVariantsSample,
|
|
13
|
+
AccordionMultipleSample,
|
|
14
|
+
AccordionWithIconsSample,
|
|
15
|
+
AccordionControlledSample,
|
|
16
|
+
AccordionFAQSample,
|
|
17
|
+
} from "@/components/docs/samples/accordion";
|
|
18
|
+
|
|
19
|
+
<Callout>
|
|
20
|
+
This is a **standalone component** that does not depend on the assistant-ui runtime. Use it anywhere in your application.
|
|
21
|
+
</Callout>
|
|
22
|
+
|
|
23
|
+
<AccordionSample />
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
<InstallCommand shadcn={["accordion"]} />
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import {
|
|
33
|
+
Accordion,
|
|
34
|
+
AccordionItem,
|
|
35
|
+
AccordionTrigger,
|
|
36
|
+
AccordionContent,
|
|
37
|
+
} from "@/components/assistant-ui/accordion";
|
|
38
|
+
|
|
39
|
+
export function Example() {
|
|
40
|
+
return (
|
|
41
|
+
<Accordion type="single" collapsible>
|
|
42
|
+
<AccordionItem value="item-1">
|
|
43
|
+
<AccordionTrigger>Section 1</AccordionTrigger>
|
|
44
|
+
<AccordionContent>Content for section 1.</AccordionContent>
|
|
45
|
+
</AccordionItem>
|
|
46
|
+
<AccordionItem value="item-2">
|
|
47
|
+
<AccordionTrigger>Section 2</AccordionTrigger>
|
|
48
|
+
<AccordionContent>Content for section 2.</AccordionContent>
|
|
49
|
+
</AccordionItem>
|
|
50
|
+
</Accordion>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Examples
|
|
56
|
+
|
|
57
|
+
### Variants
|
|
58
|
+
|
|
59
|
+
Use the `variant` prop on `Accordion` to change the visual style. Child components inherit the variant automatically.
|
|
60
|
+
|
|
61
|
+
<AccordionVariantsSample />
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
// Default - border-bottom separator
|
|
65
|
+
<Accordion type="single" collapsible variant="default">
|
|
66
|
+
<AccordionItem value="item-1">
|
|
67
|
+
<AccordionTrigger>...</AccordionTrigger>
|
|
68
|
+
<AccordionContent>...</AccordionContent>
|
|
69
|
+
</AccordionItem>
|
|
70
|
+
</Accordion>
|
|
71
|
+
|
|
72
|
+
// Outline - bordered container
|
|
73
|
+
<Accordion type="single" collapsible variant="outline">
|
|
74
|
+
<AccordionItem value="item-1">
|
|
75
|
+
<AccordionTrigger>...</AccordionTrigger>
|
|
76
|
+
<AccordionContent>...</AccordionContent>
|
|
77
|
+
</AccordionItem>
|
|
78
|
+
</Accordion>
|
|
79
|
+
|
|
80
|
+
// Ghost - separated cards
|
|
81
|
+
<Accordion type="single" collapsible variant="ghost">
|
|
82
|
+
<AccordionItem value="item-1">
|
|
83
|
+
<AccordionTrigger>...</AccordionTrigger>
|
|
84
|
+
<AccordionContent>...</AccordionContent>
|
|
85
|
+
</AccordionItem>
|
|
86
|
+
</Accordion>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Multiple Items Open
|
|
90
|
+
|
|
91
|
+
Use `type="multiple"` to allow multiple items to be open simultaneously.
|
|
92
|
+
|
|
93
|
+
<AccordionMultipleSample />
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<Accordion type="multiple">
|
|
97
|
+
<AccordionItem value="item-1">
|
|
98
|
+
<AccordionTrigger>First Section</AccordionTrigger>
|
|
99
|
+
<AccordionContent>Content 1</AccordionContent>
|
|
100
|
+
</AccordionItem>
|
|
101
|
+
<AccordionItem value="item-2">
|
|
102
|
+
<AccordionTrigger>Second Section</AccordionTrigger>
|
|
103
|
+
<AccordionContent>Content 2</AccordionContent>
|
|
104
|
+
</AccordionItem>
|
|
105
|
+
</Accordion>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### With Icons
|
|
109
|
+
|
|
110
|
+
Add icons or custom elements inside the trigger.
|
|
111
|
+
|
|
112
|
+
<PreviewCode file="components/docs/samples/accordion" name="AccordionWithIconsSample">
|
|
113
|
+
<AccordionWithIconsSample />
|
|
114
|
+
</PreviewCode>
|
|
115
|
+
|
|
116
|
+
### Controlled
|
|
117
|
+
|
|
118
|
+
Use `value` and `onValueChange` for controlled accordion state.
|
|
119
|
+
|
|
120
|
+
<PreviewCode file="components/docs/samples/accordion" name="AccordionControlledSample">
|
|
121
|
+
<AccordionControlledSample />
|
|
122
|
+
</PreviewCode>
|
|
123
|
+
|
|
124
|
+
### FAQ Section
|
|
125
|
+
|
|
126
|
+
A practical example of using accordion for a FAQ section.
|
|
127
|
+
|
|
128
|
+
<PreviewCode file="components/docs/samples/accordion" name="AccordionFAQSample">
|
|
129
|
+
<AccordionFAQSample />
|
|
130
|
+
</PreviewCode>
|
|
131
|
+
|
|
132
|
+
## API Reference
|
|
133
|
+
|
|
134
|
+
### Composable API
|
|
135
|
+
|
|
136
|
+
| Component | Description |
|
|
137
|
+
|-----------|-------------|
|
|
138
|
+
| `Accordion` | The root component that manages accordion state and variant. |
|
|
139
|
+
| `AccordionItem` | A single collapsible section container. |
|
|
140
|
+
| `AccordionTrigger` | The clickable header that toggles content visibility. |
|
|
141
|
+
| `AccordionContent` | The collapsible content panel. |
|
|
142
|
+
|
|
143
|
+
### Accordion
|
|
144
|
+
|
|
145
|
+
The root component that manages accordion state. Set `variant` here to style all child components.
|
|
146
|
+
|
|
147
|
+
<ParametersTable
|
|
148
|
+
type="AccordionProps"
|
|
149
|
+
parameters={[
|
|
150
|
+
{
|
|
151
|
+
name: "type",
|
|
152
|
+
type: '"single" | "multiple"',
|
|
153
|
+
required: true,
|
|
154
|
+
description: "Whether only one or multiple items can be open at once.",
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "collapsible",
|
|
158
|
+
type: "boolean",
|
|
159
|
+
default: "false",
|
|
160
|
+
description: "When type is 'single', allows closing the open item by clicking it again.",
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: "defaultValue",
|
|
164
|
+
type: "string | string[]",
|
|
165
|
+
description: "The default open item(s) (uncontrolled).",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "value",
|
|
169
|
+
type: "string | string[]",
|
|
170
|
+
description: "The controlled open item(s).",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: "onValueChange",
|
|
174
|
+
type: "(value: string | string[]) => void",
|
|
175
|
+
description: "Callback when the open item(s) change.",
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "variant",
|
|
179
|
+
type: '"default" | "outline" | "ghost"',
|
|
180
|
+
default: '"default"',
|
|
181
|
+
description: "The visual style of the accordion. Child components inherit this automatically.",
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "className",
|
|
185
|
+
type: "string",
|
|
186
|
+
description: "Additional CSS classes.",
|
|
187
|
+
},
|
|
188
|
+
]}
|
|
189
|
+
/>
|
|
190
|
+
|
|
191
|
+
### AccordionItem
|
|
192
|
+
|
|
193
|
+
A single collapsible section container.
|
|
194
|
+
|
|
195
|
+
<ParametersTable
|
|
196
|
+
type="AccordionItemProps"
|
|
197
|
+
parameters={[
|
|
198
|
+
{
|
|
199
|
+
name: "value",
|
|
200
|
+
type: "string",
|
|
201
|
+
required: true,
|
|
202
|
+
description: "A unique identifier for this item.",
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: "disabled",
|
|
206
|
+
type: "boolean",
|
|
207
|
+
description: "Whether the item is disabled.",
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "className",
|
|
211
|
+
type: "string",
|
|
212
|
+
description: "Additional CSS classes.",
|
|
213
|
+
},
|
|
214
|
+
]}
|
|
215
|
+
/>
|
|
216
|
+
|
|
217
|
+
### AccordionTrigger
|
|
218
|
+
|
|
219
|
+
The clickable header that toggles content visibility.
|
|
220
|
+
|
|
221
|
+
<ParametersTable
|
|
222
|
+
type="AccordionTriggerProps"
|
|
223
|
+
parameters={[
|
|
224
|
+
{
|
|
225
|
+
name: "className",
|
|
226
|
+
type: "string",
|
|
227
|
+
description: "Additional CSS classes.",
|
|
228
|
+
},
|
|
229
|
+
]}
|
|
230
|
+
/>
|
|
231
|
+
|
|
232
|
+
### AccordionContent
|
|
233
|
+
|
|
234
|
+
The collapsible content panel.
|
|
235
|
+
|
|
236
|
+
<ParametersTable
|
|
237
|
+
type="AccordionContentProps"
|
|
238
|
+
parameters={[
|
|
239
|
+
{
|
|
240
|
+
name: "className",
|
|
241
|
+
type: "string",
|
|
242
|
+
description: "Additional CSS classes.",
|
|
243
|
+
},
|
|
244
|
+
]}
|
|
245
|
+
/>
|
|
246
|
+
|
|
247
|
+
### Style Variants (CVA)
|
|
248
|
+
|
|
249
|
+
| Export | Description |
|
|
250
|
+
|--------|-------------|
|
|
251
|
+
| `accordionVariants` | Styles for the accordion container. |
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
import { accordionVariants } from "@/components/assistant-ui/accordion";
|
|
255
|
+
|
|
256
|
+
<div className={accordionVariants({ variant: "outline" })}>
|
|
257
|
+
Custom Accordion Container
|
|
258
|
+
</div>
|
|
259
|
+
```
|
|
@@ -3,8 +3,6 @@ title: AssistantModal
|
|
|
3
3
|
description: Floating chat bubble for support widgets and help desks.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
7
|
-
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
8
6
|
import { AssistantModalSample } from "@/components/docs/samples/assistant-modal";
|
|
9
7
|
|
|
10
8
|
A floating chat modal built on Radix UI Popover. Ideal for support widgets, help desks, and embedded assistants.
|
|
@@ -44,7 +42,7 @@ export default function Home() {
|
|
|
44
42
|
|
|
45
43
|
## Anatomy
|
|
46
44
|
|
|
47
|
-
The AssistantModal component is built with the following primitives:
|
|
45
|
+
The `AssistantModal` component is built with the following primitives:
|
|
48
46
|
|
|
49
47
|
```tsx
|
|
50
48
|
import { AssistantModalPrimitive } from "@assistant-ui/react";
|
|
@@ -3,8 +3,6 @@ title: AssistantSidebar
|
|
|
3
3
|
description: Side panel chat for co-pilot experiences and inline assistance.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
7
|
-
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
8
6
|
import { AssistantSidebarSample } from "@/components/docs/samples/assistant-sidebar";
|
|
9
7
|
|
|
10
8
|
A resizable side panel layout with your main content on the left and a Thread chat interface on the right. Ideal for co-pilot experiences and inline assistance.
|
|
@@ -13,7 +11,7 @@ A resizable side panel layout with your main content on the left and a Thread ch
|
|
|
13
11
|
|
|
14
12
|
## Getting Started
|
|
15
13
|
|
|
16
|
-
<Steps>
|
|
14
|
+
<Steps>
|
|
17
15
|
<Step>
|
|
18
16
|
|
|
19
17
|
### Add `assistant-sidebar`
|
|
@@ -3,9 +3,7 @@ title: Attachment
|
|
|
3
3
|
description: UI components for attaching and viewing files in messages.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
7
6
|
import { AttachmentSample } from "@/components/docs/samples/attachment";
|
|
8
|
-
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
9
7
|
|
|
10
8
|
<AttachmentSample />
|
|
11
9
|
|