@assistant-ui/mcp-docs-server 0.1.18 → 0.1.19
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 +375 -85
- package/.docs/organized/code-examples/{with-ai-sdk-v5.md → with-ai-sdk-v6.md} +386 -94
- package/.docs/organized/code-examples/with-assistant-transport.md +374 -84
- package/.docs/organized/code-examples/with-cloud.md +405 -100
- package/.docs/organized/code-examples/with-custom-thread-list.md +412 -105
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +2241 -0
- package/.docs/organized/code-examples/with-external-store.md +374 -83
- package/.docs/organized/code-examples/with-ffmpeg.md +377 -87
- package/.docs/organized/code-examples/with-langgraph.md +403 -98
- package/.docs/organized/code-examples/with-parent-id-grouping.md +374 -83
- package/.docs/organized/code-examples/with-react-hook-form.md +379 -89
- package/.docs/organized/code-examples/with-react-router.md +2167 -0
- package/.docs/organized/code-examples/with-store.md +5 -5
- package/.docs/organized/code-examples/with-tanstack.md +10 -10
- package/.docs/raw/blog/2025-01-31-changelog/index.mdx +0 -2
- package/.docs/raw/docs/{about-assistantui.mdx → (docs)/about-assistantui.mdx} +2 -1
- package/.docs/raw/docs/{architecture.mdx → (docs)/architecture.mdx} +3 -2
- package/.docs/raw/docs/{cli.mdx → (docs)/cli.mdx} +1 -19
- package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-readable.mdx +1 -0
- package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-tool-ui.mdx +2 -1
- package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-tool.mdx +2 -1
- package/.docs/raw/docs/{copilots → (docs)/copilots}/model-context.mdx +1 -0
- package/.docs/raw/docs/{copilots → (docs)/copilots}/motivation.mdx +1 -0
- package/.docs/raw/docs/{copilots → (docs)/copilots}/use-assistant-instructions.mdx +1 -0
- package/.docs/raw/docs/{devtools.mdx → (docs)/devtools.mdx} +4 -4
- package/.docs/raw/docs/{guides/Attachments.mdx → (docs)/guides/attachments.mdx} +4 -5
- package/.docs/raw/docs/{guides/Branching.mdx → (docs)/guides/branching.mdx} +2 -1
- package/.docs/raw/docs/{guides → (docs)/guides}/context-api.mdx +1 -0
- package/.docs/raw/docs/(docs)/guides/dictation.mdx +370 -0
- package/.docs/raw/docs/{guides/Editing.mdx → (docs)/guides/editing.mdx} +1 -0
- package/.docs/raw/docs/{guides/Latex.mdx → (docs)/guides/latex.mdx} +1 -2
- package/.docs/raw/docs/{guides/Speech.mdx → (docs)/guides/speech.mdx} +9 -10
- package/.docs/raw/docs/{guides/ToolUI.mdx → (docs)/guides/tool-ui.mdx} +15 -14
- package/.docs/raw/docs/{guides/Tools.mdx → (docs)/guides/tools.mdx} +10 -7
- package/.docs/raw/docs/{getting-started.mdx → (docs)/index.mdx} +17 -22
- package/.docs/raw/docs/{mcp-docs-server.mdx → (docs)/mcp-docs-server.mdx} +1 -2
- package/.docs/raw/docs/{api-reference/context-providers/AssistantRuntimeProvider.mdx → (reference)/api-reference/context-providers/assistant-runtime-provider.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/context-providers/TextMessagePartProvider.mdx → (reference)/api-reference/context-providers/text-message-part-provider.mdx} +2 -1
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/react-data-stream.mdx +2 -1
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/react-hook-form.mdx +2 -1
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/vercel-ai-sdk.mdx +2 -2
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/overview.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +327 -0
- package/.docs/raw/docs/{api-reference/primitives/ActionBar.mdx → (reference)/api-reference/primitives/action-bar.mdx} +3 -1
- package/.docs/raw/docs/{api-reference/primitives/AssistantIf.mdx → (reference)/api-reference/primitives/assistant-if.mdx} +2 -2
- package/.docs/raw/docs/{api-reference/primitives/AssistantModal.mdx → (reference)/api-reference/primitives/assistant-modal.mdx} +3 -1
- package/.docs/raw/docs/{api-reference/primitives/Attachment.mdx → (reference)/api-reference/primitives/attachment.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/primitives/BranchPicker.mdx → (reference)/api-reference/primitives/branch-picker.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/Composer.mdx → (reference)/api-reference/primitives/composer.mdx} +101 -2
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/primitives/composition.mdx +1 -0
- package/.docs/raw/docs/{api-reference/primitives/Error.mdx → (reference)/api-reference/primitives/error.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/MessagePart.mdx → (reference)/api-reference/primitives/message-part.mdx} +2 -2
- package/.docs/raw/docs/{api-reference/primitives/Message.mdx → (reference)/api-reference/primitives/message.mdx} +2 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +221 -0
- package/.docs/raw/docs/{api-reference/primitives/ThreadListItem.mdx → (reference)/api-reference/primitives/thread-list-item.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/ThreadList.mdx → (reference)/api-reference/primitives/thread-list.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/Thread.mdx → (reference)/api-reference/primitives/thread.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/AssistantRuntime.mdx → (reference)/api-reference/runtimes/assistant-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/AttachmentRuntime.mdx → (reference)/api-reference/runtimes/attachment-runtime.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/runtimes/ComposerRuntime.mdx → (reference)/api-reference/runtimes/composer-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/MessagePartRuntime.mdx → (reference)/api-reference/runtimes/message-part-runtime.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/runtimes/MessageRuntime.mdx → (reference)/api-reference/runtimes/message-runtime.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/runtimes/ThreadListItemRuntime.mdx → (reference)/api-reference/runtimes/thread-list-item-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/ThreadListRuntime.mdx → (reference)/api-reference/runtimes/thread-list-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/ThreadRuntime.mdx → (reference)/api-reference/runtimes/thread-runtime.mdx} +3 -5
- package/.docs/raw/docs/{legacy/styled/AssistantModal.mdx → (reference)/legacy/styled/assistant-modal.mdx} +2 -3
- package/.docs/raw/docs/{legacy/styled/Decomposition.mdx → (reference)/legacy/styled/decomposition.mdx} +1 -0
- package/.docs/raw/docs/{legacy/styled/Markdown.mdx → (reference)/legacy/styled/markdown.mdx} +2 -4
- package/.docs/raw/docs/{legacy/styled/Scrollbar.mdx → (reference)/legacy/styled/scrollbar.mdx} +2 -1
- package/.docs/raw/docs/{legacy/styled/ThreadWidth.mdx → (reference)/legacy/styled/thread-width.mdx} +1 -0
- package/.docs/raw/docs/{legacy/styled/Thread.mdx → (reference)/legacy/styled/thread.mdx} +2 -3
- package/.docs/raw/docs/{migrations → (reference)/migrations}/deprecation-policy.mdx +1 -0
- package/.docs/raw/docs/{migrations → (reference)/migrations}/react-langgraph-v0-7.mdx +1 -2
- package/.docs/raw/docs/{migrations → (reference)/migrations}/v0-11.mdx +1 -0
- package/.docs/raw/docs/{migrations → (reference)/migrations}/v0-12.mdx +1 -0
- package/.docs/raw/docs/{react-compatibility.mdx → (reference)/react-compatibility.mdx} +2 -3
- package/.docs/raw/docs/cloud/authorization.mdx +1 -0
- package/.docs/raw/docs/cloud/overview.mdx +1 -0
- package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +2 -3
- package/.docs/raw/docs/cloud/persistence/langgraph.mdx +5 -7
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +9 -8
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +2 -3
- package/.docs/raw/docs/runtimes/assistant-transport.mdx +7 -6
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +2 -3
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +6 -8
- package/.docs/raw/docs/runtimes/custom/local.mdx +12 -8
- package/.docs/raw/docs/runtimes/data-stream.mdx +32 -4
- package/.docs/raw/docs/runtimes/helicone.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +3 -3
- package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +2 -1
- package/.docs/raw/docs/runtimes/langserve.mdx +2 -2
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +4 -5
- package/.docs/raw/docs/runtimes/mastra/overview.mdx +1 -0
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +3 -4
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +2 -4
- package/.docs/raw/docs/ui/assistant-modal.mdx +163 -0
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +90 -0
- package/.docs/raw/docs/ui/attachment.mdx +227 -0
- package/.docs/raw/docs/ui/{Markdown.mdx → markdown.mdx} +11 -6
- package/.docs/raw/docs/ui/{Mermaid.mdx → mermaid.mdx} +12 -5
- package/.docs/raw/docs/ui/{PartGrouping.mdx → part-grouping.mdx} +4 -6
- package/.docs/raw/docs/ui/reasoning.mdx +148 -0
- package/.docs/raw/docs/ui/{Scrollbar.mdx → scrollbar.mdx} +9 -1
- package/.docs/raw/docs/ui/sources.mdx +87 -0
- package/.docs/raw/docs/ui/{SyntaxHighlighting.mdx → syntax-highlighting.mdx} +9 -5
- package/.docs/raw/docs/ui/thread-list.mdx +275 -0
- package/.docs/raw/docs/ui/{Thread.mdx → thread.mdx} +5 -6
- package/.docs/raw/docs/ui/tool-fallback.mdx +112 -0
- package/.docs/raw/docs/ui/tool-group.mdx +214 -0
- package/dist/tools/docs.js +1 -1
- package/dist/tools/examples.js +1 -1
- package/dist/tools/examples.js.map +1 -1
- package/package.json +5 -5
- package/src/tools/docs.ts +1 -1
- package/src/tools/examples.ts +1 -1
- package/src/tools/tests/docs.test.ts +18 -16
- package/src/tools/tests/examples.test.ts +5 -5
- package/src/tools/tests/path-traversal.test.ts +3 -3
- package/src/utils/tests/security.test.ts +3 -3
- package/.docs/raw/docs/index.mdx +0 -7
- package/.docs/raw/docs/ui/AssistantModal.mdx +0 -45
- package/.docs/raw/docs/ui/AssistantSidebar.mdx +0 -41
- package/.docs/raw/docs/ui/Attachment.mdx +0 -84
- package/.docs/raw/docs/ui/Reasoning.mdx +0 -152
- package/.docs/raw/docs/ui/ThreadList.mdx +0 -90
- package/.docs/raw/docs/ui/ToolFallback.mdx +0 -63
- package/.docs/raw/docs/ui/ToolGroup.mdx +0 -96
- /package/.docs/raw/docs/{copilots → (docs)/copilots}/assistant-frame.mdx +0 -0
package/src/tools/examples.ts
CHANGED
|
@@ -28,21 +28,21 @@ describe("assistantUIDocs", () => {
|
|
|
28
28
|
expect(result.path).toBe("/");
|
|
29
29
|
expect(result.found).toBe(true);
|
|
30
30
|
expect(result.type).toBe("directory");
|
|
31
|
-
expect(result.directories).toContain("
|
|
32
|
-
expect(result.directories).toContain("
|
|
33
|
-
expect(result.
|
|
31
|
+
expect(result.directories).toContain("(docs)");
|
|
32
|
+
expect(result.directories).toContain("(reference)");
|
|
33
|
+
expect(result.directories).toContain("ui");
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
it("should retrieve specific documentation file", async () => {
|
|
37
37
|
const result = await testContext.callTool("assistantUIDocs", {
|
|
38
|
-
paths: ["
|
|
38
|
+
paths: ["(docs)/index"],
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
expect(result.path).toBe("
|
|
41
|
+
expect(result.path).toBe("(docs)/index");
|
|
42
42
|
expect(result.found).toBe(true);
|
|
43
43
|
expect(result.type).toBe("file");
|
|
44
44
|
expect(result.content).toBeDefined();
|
|
45
|
-
expect(result.content).toContain("
|
|
45
|
+
expect(result.content).toContain("assistant-ui");
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
it("should handle non-existent paths", async () => {
|
|
@@ -57,36 +57,38 @@ describe("assistantUIDocs", () => {
|
|
|
57
57
|
|
|
58
58
|
it("should support multiple path requests", async () => {
|
|
59
59
|
const result = await testContext.callTool("assistantUIDocs", {
|
|
60
|
-
paths: ["
|
|
60
|
+
paths: ["(docs)/index", "(reference)/api-reference/primitives/thread"],
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
expect(result.results).toBeDefined();
|
|
64
64
|
expect(result.results).toHaveLength(2);
|
|
65
|
-
expect(result.results[0].path).toBe("
|
|
66
|
-
expect(result.results[1].path).toBe(
|
|
65
|
+
expect(result.results[0].path).toBe("(docs)/index");
|
|
66
|
+
expect(result.results[1].path).toBe(
|
|
67
|
+
"(reference)/api-reference/primitives/thread",
|
|
68
|
+
);
|
|
67
69
|
});
|
|
68
70
|
|
|
69
71
|
it("should list directory contents with files", async () => {
|
|
70
72
|
const result = await testContext.callTool("assistantUIDocs", {
|
|
71
|
-
paths: ["api-reference/primitives"],
|
|
73
|
+
paths: ["(reference)/api-reference/primitives"],
|
|
72
74
|
});
|
|
73
75
|
|
|
74
|
-
expect(result.path).toBe("api-reference/primitives");
|
|
76
|
+
expect(result.path).toBe("(reference)/api-reference/primitives");
|
|
75
77
|
expect(result.found).toBe(true);
|
|
76
78
|
expect(result.type).toBe("directory");
|
|
77
|
-
expect(result.files).toContain("
|
|
78
|
-
expect(result.files).toContain("
|
|
79
|
-
expect(result.files).toContain("
|
|
79
|
+
expect(result.files).toContain("thread");
|
|
80
|
+
expect(result.files).toContain("message");
|
|
81
|
+
expect(result.files).toContain("composer");
|
|
80
82
|
});
|
|
81
83
|
|
|
82
84
|
it("should parse MDX files with frontmatter", async () => {
|
|
83
85
|
const result = await testContext.callTool("assistantUIDocs", {
|
|
84
|
-
paths: ["
|
|
86
|
+
paths: ["(docs)/index"],
|
|
85
87
|
});
|
|
86
88
|
|
|
87
89
|
expect(result.content).toBeDefined();
|
|
88
90
|
expect(result.content).toContain("title:");
|
|
89
|
-
expect(result.content).toContain("
|
|
91
|
+
expect(result.content).toContain("assistant-ui");
|
|
90
92
|
});
|
|
91
93
|
|
|
92
94
|
it("should skip symlinks and large files", async () => {
|
|
@@ -19,20 +19,20 @@ describe("assistantUIExamples", () => {
|
|
|
19
19
|
expect(result.examples).toBeDefined();
|
|
20
20
|
expect(Array.isArray(result.examples)).toBe(true);
|
|
21
21
|
expect(result.examples.length).toBeGreaterThan(0);
|
|
22
|
-
expect(result.examples).toContain("with-ai-sdk-
|
|
22
|
+
expect(result.examples).toContain("with-ai-sdk-v6");
|
|
23
23
|
expect(result.examples).toContain("with-langgraph");
|
|
24
24
|
expect(result.total).toBe(result.examples.length);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
it("should retrieve specific example code", async () => {
|
|
28
28
|
const result = await testContext.callTool("assistantUIExamples", {
|
|
29
|
-
example: "with-ai-sdk-
|
|
29
|
+
example: "with-ai-sdk-v6",
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
expect(result.type).toBe("example");
|
|
33
|
-
expect(result.name).toBe("with-ai-sdk-
|
|
33
|
+
expect(result.name).toBe("with-ai-sdk-v6");
|
|
34
34
|
expect(result.content).toBeDefined();
|
|
35
|
-
expect(result.content).toContain("# Example: with-ai-sdk-
|
|
35
|
+
expect(result.content).toContain("# Example: with-ai-sdk-v6");
|
|
36
36
|
expect(result.content).toContain("app/api/chat/route.ts");
|
|
37
37
|
expect(result.content).toContain("streamText");
|
|
38
38
|
});
|
|
@@ -50,7 +50,7 @@ describe("assistantUIExamples", () => {
|
|
|
50
50
|
|
|
51
51
|
it("should include all files in example", async () => {
|
|
52
52
|
const result = await testContext.callTool("assistantUIExamples", {
|
|
53
|
-
example: "with-ai-sdk-
|
|
53
|
+
example: "with-ai-sdk-v6",
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
expect(result.content).toContain("package.json");
|
|
@@ -26,7 +26,7 @@ describe("Path Traversal Security", () => {
|
|
|
26
26
|
|
|
27
27
|
it("should handle multiple paths with one malicious", async () => {
|
|
28
28
|
const result = await testContext.callTool("assistantUIDocs", {
|
|
29
|
-
paths: ["
|
|
29
|
+
paths: ["(docs)/index", "../../../../etc/passwd", "(docs)/guides"],
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
expect(result.results).toBeDefined();
|
|
@@ -63,12 +63,12 @@ describe("Path Traversal Security", () => {
|
|
|
63
63
|
describe("Valid paths should still work", () => {
|
|
64
64
|
it("should allow valid documentation paths", async () => {
|
|
65
65
|
const result = await testContext.callTool("assistantUIDocs", {
|
|
66
|
-
paths: ["
|
|
66
|
+
paths: ["(docs)/index", "(reference)/api-reference/primitives/thread"],
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
expect(result.results).toBeDefined();
|
|
70
70
|
expect(result.results).toHaveLength(2);
|
|
71
|
-
expect(result.results.every((r: any) => r.found
|
|
71
|
+
expect(result.results.every((r: any) => r.found)).toBe(true);
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
it("should allow valid example names", async () => {
|
|
@@ -80,12 +80,12 @@ describe("sanitizePath", () => {
|
|
|
80
80
|
const validPaths = [
|
|
81
81
|
{ input: "getting-started", expected: "getting-started" },
|
|
82
82
|
{
|
|
83
|
-
input: "api-reference/primitives/
|
|
84
|
-
expected: "api-reference/primitives/
|
|
83
|
+
input: "api-reference/primitives/thread",
|
|
84
|
+
expected: "api-reference/primitives/thread",
|
|
85
85
|
},
|
|
86
86
|
{ input: "guides/tools", expected: "guides/tools" },
|
|
87
87
|
{ input: "docs/index", expected: "docs/index" },
|
|
88
|
-
{ input: "examples/with-ai-sdk", expected: "examples/with-ai-sdk" },
|
|
88
|
+
{ input: "examples/with-ai-sdk-v6", expected: "examples/with-ai-sdk-v6" },
|
|
89
89
|
{ input: "./current-dir-file", expected: "current-dir-file" },
|
|
90
90
|
{
|
|
91
91
|
input: "deeply/nested/path/to/file",
|
package/.docs/raw/docs/index.mdx
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: AssistantModal
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
6
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
7
|
-
import { AssistantModalSample } from "@/components/samples/assistant-modal-sample";
|
|
8
|
-
|
|
9
|
-
## Overview
|
|
10
|
-
|
|
11
|
-
A chat bubble shown in the bottom right corner of the screen. Useful for support or Q&A use cases.
|
|
12
|
-
|
|
13
|
-
<AssistantModalSample />
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
## Getting Started
|
|
17
|
-
|
|
18
|
-
<Steps>
|
|
19
|
-
<Step>
|
|
20
|
-
|
|
21
|
-
### Add `assistant-modal`
|
|
22
|
-
|
|
23
|
-
<InstallCommand shadcn={["assistant-modal"]} />
|
|
24
|
-
|
|
25
|
-
This adds `/components/assistant-ui/assistant-modal.tsx` to your project, which you can adjust as needed.
|
|
26
|
-
|
|
27
|
-
</Step>
|
|
28
|
-
<Step>
|
|
29
|
-
|
|
30
|
-
### Use in your application
|
|
31
|
-
|
|
32
|
-
```tsx title="/app/page.tsx" {1,6}
|
|
33
|
-
import { AssistantModal } from "@/components/assistant-ui/assistant-modal";
|
|
34
|
-
|
|
35
|
-
export default function Home() {
|
|
36
|
-
return (
|
|
37
|
-
<div className="h-full">
|
|
38
|
-
<AssistantModal />
|
|
39
|
-
</div>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
</Step>
|
|
45
|
-
</Steps>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: AssistantSidebar
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
6
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
A chat sidebar show on the right side of the screen. Useful for co-pilot use cases.
|
|
11
|
-
|
|
12
|
-
## Getting Started
|
|
13
|
-
|
|
14
|
-
<Steps>
|
|
15
|
-
<Step>
|
|
16
|
-
|
|
17
|
-
### Add `assistant-sidebar`
|
|
18
|
-
|
|
19
|
-
<InstallCommand shadcn={["assistant-sidebar"]} />
|
|
20
|
-
|
|
21
|
-
This adds `/components/assistant-ui/assistant-sidebar.tsx` to your project, which you can adjust as needed.
|
|
22
|
-
|
|
23
|
-
</Step>
|
|
24
|
-
<Step>
|
|
25
|
-
|
|
26
|
-
### Use in your application
|
|
27
|
-
|
|
28
|
-
```tsx title="/app/page.tsx" {1,6}
|
|
29
|
-
import { AssistantSidebar } from "@/components/assistant-ui/assistant-sidebar";
|
|
30
|
-
|
|
31
|
-
export default function Home() {
|
|
32
|
-
return (
|
|
33
|
-
<div className="h-full">
|
|
34
|
-
<AssistantSidebar>{/* your app */}</AssistantSidebar>
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
</Step>
|
|
41
|
-
</Steps>
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Attachment
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
6
|
-
import { AttachmentSample } from "@/components/samples/attachment-sample";
|
|
7
|
-
import { Callout } from "fumadocs-ui/components/callout";
|
|
8
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
9
|
-
|
|
10
|
-
## Overview
|
|
11
|
-
|
|
12
|
-
The Attachment components let the user attach files and view the attachments.
|
|
13
|
-
|
|
14
|
-
<AttachmentSample />
|
|
15
|
-
|
|
16
|
-
<Callout type="info">
|
|
17
|
-
**Note:** These components provide the UI for attachments, but you also need
|
|
18
|
-
to configure attachment adapters in your runtime to handle file uploads and
|
|
19
|
-
processing. See the [Attachments Guide](/docs/guides/Attachments) for complete
|
|
20
|
-
setup instructions.
|
|
21
|
-
</Callout>
|
|
22
|
-
|
|
23
|
-
## Getting Started
|
|
24
|
-
|
|
25
|
-
<Steps>
|
|
26
|
-
<Step>
|
|
27
|
-
|
|
28
|
-
### Add `attachment`
|
|
29
|
-
|
|
30
|
-
<InstallCommand shadcn={["attachment"]} />
|
|
31
|
-
|
|
32
|
-
This adds a `/components/assistant-ui/attachment.tsx` file to your project, which you can adjust as needed.
|
|
33
|
-
|
|
34
|
-
</Step>
|
|
35
|
-
<Step>
|
|
36
|
-
|
|
37
|
-
### Use in your application
|
|
38
|
-
|
|
39
|
-
```tsx title="/components/assistant-ui/thread.tsx" {1-4,9-10}
|
|
40
|
-
import {
|
|
41
|
-
ComposerAttachments,
|
|
42
|
-
ComposerAddAttachment,
|
|
43
|
-
} from "@/components/assistant-ui/attachment";
|
|
44
|
-
|
|
45
|
-
const Composer: FC = () => {
|
|
46
|
-
return (
|
|
47
|
-
<ComposerPrimitive.Root className="...">
|
|
48
|
-
<ComposerAttachments />
|
|
49
|
-
<ComposerAddAttachment />
|
|
50
|
-
|
|
51
|
-
<ComposerPrimitive.Input
|
|
52
|
-
autoFocus
|
|
53
|
-
placeholder="Write a message..."
|
|
54
|
-
rows={1}
|
|
55
|
-
className="..."
|
|
56
|
-
/>
|
|
57
|
-
<ComposerAction />
|
|
58
|
-
</ComposerPrimitive.Root>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
```tsx title="/components/assistant-ui/thread.tsx" {1,8}
|
|
64
|
-
import { UserMessageAttachments } from "@/components/assistant-ui/attachment";
|
|
65
|
-
|
|
66
|
-
const UserMessage: FC = () => {
|
|
67
|
-
return (
|
|
68
|
-
<MessagePrimitive.Root className="...">
|
|
69
|
-
<UserActionBar />
|
|
70
|
-
|
|
71
|
-
<UserMessageAttachments />
|
|
72
|
-
|
|
73
|
-
<div className="...">
|
|
74
|
-
<MessagePrimitive.Parts />
|
|
75
|
-
</div>
|
|
76
|
-
|
|
77
|
-
<BranchPicker className="..." />
|
|
78
|
-
</MessagePrimitive.Root>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
</Step>
|
|
84
|
-
</Steps>
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Reasoning
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
6
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
The Reasoning component displays AI reasoning or thinking messages in a collapsible UI. Consecutive reasoning message parts are automatically grouped together with smooth animations and a shimmer effect while streaming.
|
|
11
|
-
|
|
12
|
-
## Getting Started
|
|
13
|
-
|
|
14
|
-
<Steps>
|
|
15
|
-
<Step>
|
|
16
|
-
|
|
17
|
-
### Add `reasoning`
|
|
18
|
-
|
|
19
|
-
<InstallCommand shadcn={["reasoning"]} />
|
|
20
|
-
|
|
21
|
-
This adds a `/components/assistant-ui/reasoning.tsx` file to your project, which you can adjust as needed.
|
|
22
|
-
|
|
23
|
-
</Step>
|
|
24
|
-
<Step>
|
|
25
|
-
|
|
26
|
-
### Use in your application
|
|
27
|
-
|
|
28
|
-
Pass the `Reasoning` and `ReasoningGroup` components to the `MessagePrimitive.Parts` component:
|
|
29
|
-
|
|
30
|
-
```tsx title="/app/components/assistant-ui/thread.tsx" {2,10-11}
|
|
31
|
-
import { MessagePrimitive } from "@assistant-ui/react";
|
|
32
|
-
import { Reasoning, ReasoningGroup } from "@/components/assistant-ui/reasoning";
|
|
33
|
-
|
|
34
|
-
const AssistantMessage: FC = () => {
|
|
35
|
-
return (
|
|
36
|
-
<MessagePrimitive.Root className="...">
|
|
37
|
-
<div className="...">
|
|
38
|
-
<MessagePrimitive.Parts
|
|
39
|
-
components={{
|
|
40
|
-
Reasoning: Reasoning,
|
|
41
|
-
ReasoningGroup: ReasoningGroup
|
|
42
|
-
}}
|
|
43
|
-
/>
|
|
44
|
-
</div>
|
|
45
|
-
<AssistantActionBar />
|
|
46
|
-
|
|
47
|
-
<BranchPicker className="..." />
|
|
48
|
-
</MessagePrimitive.Root>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
</Step>
|
|
54
|
-
</Steps>
|
|
55
|
-
|
|
56
|
-
## How It Works
|
|
57
|
-
|
|
58
|
-
The component consists of two parts:
|
|
59
|
-
|
|
60
|
-
1. **Reasoning**: Renders individual reasoning message part content
|
|
61
|
-
2. **ReasoningGroup**: Wraps consecutive reasoning parts in a collapsible container
|
|
62
|
-
|
|
63
|
-
Consecutive reasoning parts are automatically grouped together by the `ReasoningGroup` component, similar to how `ToolGroup` handles tool calls.
|
|
64
|
-
|
|
65
|
-
### Reasoning
|
|
66
|
-
|
|
67
|
-
The Reasoning component doesn't accept additional props—it renders the reasoning text content with markdown support.
|
|
68
|
-
|
|
69
|
-
## Examples
|
|
70
|
-
|
|
71
|
-
### Basic Usage
|
|
72
|
-
|
|
73
|
-
```tsx title="/app/components/assistant-ui/thread.tsx"
|
|
74
|
-
<MessagePrimitive.Parts
|
|
75
|
-
components={{
|
|
76
|
-
Reasoning,
|
|
77
|
-
ReasoningGroup
|
|
78
|
-
}}
|
|
79
|
-
/>
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Custom Styling
|
|
83
|
-
|
|
84
|
-
Since the component is copied to your project, you can customize it directly by modifying the `reasoning.tsx` file. The internal components (`ReasoningRoot`, `ReasoningTrigger`, `ReasoningContent`, `ReasoningText`) accept `className` props for styling:
|
|
85
|
-
|
|
86
|
-
```tsx title="/components/assistant-ui/reasoning.tsx"
|
|
87
|
-
const ReasoningGroupImpl: ReasoningGroupComponent = ({
|
|
88
|
-
// ... existing code ...
|
|
89
|
-
return (
|
|
90
|
-
<ReasoningRoot className="rounded-lg border bg-muted/50 p-4">
|
|
91
|
-
<ReasoningTrigger
|
|
92
|
-
active={isReasoningStreaming}
|
|
93
|
-
className="font-semibold text-foreground"
|
|
94
|
-
/>
|
|
95
|
-
<ReasoningContent
|
|
96
|
-
aria-busy={isReasoningStreaming}
|
|
97
|
-
className="mt-2"
|
|
98
|
-
>
|
|
99
|
-
<ReasoningText className="text-base">{children}</ReasoningText>
|
|
100
|
-
</ReasoningContent>
|
|
101
|
-
</ReasoningRoot>
|
|
102
|
-
);
|
|
103
|
-
};
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
You can also customize the individual internal components:
|
|
107
|
-
|
|
108
|
-
```tsx title="/components/assistant-ui/reasoning.tsx"
|
|
109
|
-
const ReasoningRoot: FC<PropsWithChildren<{ className?: string }>> = ({
|
|
110
|
-
// ... existing code ...
|
|
111
|
-
return (
|
|
112
|
-
<Collapsible
|
|
113
|
-
// ...
|
|
114
|
-
className={cn("aui-reasoning-root mb-4 w-full rounded-lg border bg-muted/50 p-4", className)}
|
|
115
|
-
// ...
|
|
116
|
-
>
|
|
117
|
-
{children}
|
|
118
|
-
</Collapsible>
|
|
119
|
-
);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const ReasoningTrigger: FC<{ active: boolean; className?: string }> = ({
|
|
123
|
-
// ... existing code ...
|
|
124
|
-
<CollapsibleTrigger
|
|
125
|
-
className={cn(
|
|
126
|
-
"aui-reasoning-trigger group/trigger -mb-2 flex max-w-[75%] items-center gap-2 py-2 text-sm font-semibold text-foreground transition-colors hover:text-foreground",
|
|
127
|
-
className,
|
|
128
|
-
)}
|
|
129
|
-
>
|
|
130
|
-
{/* ... existing content ... */}
|
|
131
|
-
</CollapsibleTrigger>
|
|
132
|
-
);
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## Technical Details
|
|
136
|
-
|
|
137
|
-
### Scroll Lock
|
|
138
|
-
|
|
139
|
-
The component uses the `useScrollLock` hook (exported from `@assistant-ui/react`) to prevent page jumps when collapsing the reasoning section. This maintains the scroll position during the collapse animation.
|
|
140
|
-
|
|
141
|
-
### Animation Timing
|
|
142
|
-
|
|
143
|
-
The component uses CSS custom properties for animation timing:
|
|
144
|
-
- `--animation-duration`: Controls expand/collapse animation (default: 200ms)
|
|
145
|
-
- `--shimmer-duration`: Controls the shimmer effect speed (default: 1000ms)
|
|
146
|
-
|
|
147
|
-
These can be customized by modifying the CSS variables in your component.
|
|
148
|
-
|
|
149
|
-
## Related Components
|
|
150
|
-
|
|
151
|
-
- [ToolGroup](/docs/ui/ToolGroup) - Similar grouping pattern for tool calls
|
|
152
|
-
- [PartGrouping](/docs/ui/PartGrouping) - Experimental API for grouping message parts
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: ThreadList
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
6
|
-
import { Callout } from "fumadocs-ui/components/callout";
|
|
7
|
-
import { Tabs, Tab } from "fumadocs-ui/components/tabs";
|
|
8
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
9
|
-
import { ThreadListSample } from "@/components/samples/threadlist-sample";
|
|
10
|
-
|
|
11
|
-
## Overview
|
|
12
|
-
|
|
13
|
-
The ThreadList component lets the user switch between threads.
|
|
14
|
-
|
|
15
|
-
<ThreadListSample />
|
|
16
|
-
|
|
17
|
-
<Callout>
|
|
18
|
-
This demo uses **ThreadListSidebar**, which includes `thread-list` as a dependency and provides a complete sidebar layout. For custom implementations, you can use `thread-list` directly.
|
|
19
|
-
</Callout>
|
|
20
|
-
|
|
21
|
-
## Getting Started
|
|
22
|
-
|
|
23
|
-
<Steps>
|
|
24
|
-
<Step>
|
|
25
|
-
|
|
26
|
-
### Add the component
|
|
27
|
-
|
|
28
|
-
Use `threadlist-sidebar` for a complete sidebar layout or `thread-list` for custom layouts.
|
|
29
|
-
|
|
30
|
-
#### ThreadListSidebar
|
|
31
|
-
|
|
32
|
-
<InstallCommand shadcn={["threadlist-sidebar"]} />
|
|
33
|
-
|
|
34
|
-
#### ThreadList
|
|
35
|
-
|
|
36
|
-
<InstallCommand shadcn={["thread-list"]} />
|
|
37
|
-
|
|
38
|
-
</Step>
|
|
39
|
-
<Step>
|
|
40
|
-
|
|
41
|
-
### Use in your application
|
|
42
|
-
|
|
43
|
-
<Tabs items={["With Sidebar", "Without Sidebar"]}>
|
|
44
|
-
<Tab value="With Sidebar">
|
|
45
|
-
```tsx title="/app/assistant.tsx"
|
|
46
|
-
import { Thread } from "@/components/assistant-ui/thread";
|
|
47
|
-
import { ThreadListSidebar } from "@/components/assistant-ui/threadlist-sidebar";
|
|
48
|
-
import {
|
|
49
|
-
SidebarProvider,
|
|
50
|
-
SidebarInset,
|
|
51
|
-
SidebarTrigger
|
|
52
|
-
} from "@/components/ui/sidebar";
|
|
53
|
-
|
|
54
|
-
export default function Assistant() {
|
|
55
|
-
return (
|
|
56
|
-
<SidebarProvider>
|
|
57
|
-
<div className="flex h-dvh w-full">
|
|
58
|
-
<ThreadListSidebar />
|
|
59
|
-
<SidebarInset>
|
|
60
|
-
{/* Add sidebar trigger, location can be customized */}
|
|
61
|
-
<SidebarTrigger className="absolute top-4 left-4" />
|
|
62
|
-
<Thread />
|
|
63
|
-
</SidebarInset>
|
|
64
|
-
</div>
|
|
65
|
-
</SidebarProvider>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
</Tab>
|
|
70
|
-
<Tab value="Without Sidebar">
|
|
71
|
-
```tsx title="/app/assistant.tsx"
|
|
72
|
-
import { Thread } from "@/components/assistant-ui/thread";
|
|
73
|
-
import { ThreadList } from "@/components/assistant-ui/thread-list";
|
|
74
|
-
|
|
75
|
-
export default function Assistant() {
|
|
76
|
-
return (
|
|
77
|
-
<div className="grid h-full grid-cols-[200px_1fr]">
|
|
78
|
-
<ThreadList />
|
|
79
|
-
<Thread />
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
</Tab>
|
|
85
|
-
</Tabs>
|
|
86
|
-
|
|
87
|
-
</Step>
|
|
88
|
-
</Steps>
|
|
89
|
-
|
|
90
|
-
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: ToolFallback
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
6
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
The ToolFallback component displays a default ToolUI for tools that do not have a dedicated ToolUI.
|
|
11
|
-
|
|
12
|
-
## Getting Started
|
|
13
|
-
|
|
14
|
-
<Steps>
|
|
15
|
-
<Step>
|
|
16
|
-
|
|
17
|
-
### Add `tool-fallback`
|
|
18
|
-
|
|
19
|
-
<InstallCommand shadcn={["tool-fallback"]} />
|
|
20
|
-
|
|
21
|
-
This adds a `/components/assistant-ui/tool-fallback.tsx` file to your project, which you can adjust as needed.
|
|
22
|
-
|
|
23
|
-
</Step>
|
|
24
|
-
<Step>
|
|
25
|
-
|
|
26
|
-
### Use it in your application
|
|
27
|
-
|
|
28
|
-
Pass the `ToolFallback` component to the `MessagePrimitive.Parts` component
|
|
29
|
-
|
|
30
|
-
```tsx twoslash title="/components/assistant-ui/thread.tsx" {1,11}
|
|
31
|
-
// @filename: /components/assistant-ui/tool-fallback.tsx
|
|
32
|
-
import { FC } from "react";
|
|
33
|
-
export const ToolFallback: FC = () => null;
|
|
34
|
-
|
|
35
|
-
// @filename: ./thread.tsx
|
|
36
|
-
import { FC } from "react";
|
|
37
|
-
import { MessagePrimitive } from "@assistant-ui/react";
|
|
38
|
-
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
|
|
39
|
-
|
|
40
|
-
const AssistantActionBar: FC = () => null;
|
|
41
|
-
const BranchPicker: FC<{ className?: string }> = () => null;
|
|
42
|
-
|
|
43
|
-
// ---cut---
|
|
44
|
-
import { ToolFallback } from "@/components/assistant-ui/tool-fallback";
|
|
45
|
-
|
|
46
|
-
const AssistantMessage: FC = () => {
|
|
47
|
-
return (
|
|
48
|
-
<MessagePrimitive.Root className="...">
|
|
49
|
-
<div className="...">
|
|
50
|
-
<MessagePrimitive.Parts
|
|
51
|
-
components={{ tools: { Fallback: ToolFallback } }}
|
|
52
|
-
/>
|
|
53
|
-
</div>
|
|
54
|
-
<AssistantActionBar />
|
|
55
|
-
|
|
56
|
-
<BranchPicker className="..." />
|
|
57
|
-
</MessagePrimitive.Root>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
</Step>
|
|
63
|
-
</Steps>
|