@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
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Suggestions
|
|
3
|
+
description: Display suggested prompts to help users get started with your assistant.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Suggestions are pre-defined prompts that help users discover what your assistant can do. They appear in the welcome screen and provide a quick way to start conversations.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
The Suggestions API allows you to configure a list of suggested prompts that are displayed when the thread is empty. Users can click on a suggestion to either populate the composer or immediately send the message.
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
Configure suggestions using the `Suggestions()` API in your runtime provider:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { useAui, Tools, Suggestions } from "@assistant-ui/react";
|
|
18
|
+
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
|
|
19
|
+
|
|
20
|
+
function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
21
|
+
const runtime = useChatRuntime();
|
|
22
|
+
|
|
23
|
+
const aui = useAui({
|
|
24
|
+
tools: Tools({ toolkit: myToolkit }),
|
|
25
|
+
suggestions: Suggestions([
|
|
26
|
+
"What can you help me with?",
|
|
27
|
+
"Tell me a joke",
|
|
28
|
+
"Explain quantum computing",
|
|
29
|
+
]),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<AssistantRuntimeProvider aui={aui} runtime={runtime}>
|
|
34
|
+
{children}
|
|
35
|
+
</AssistantRuntimeProvider>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Suggestion Format
|
|
41
|
+
|
|
42
|
+
Suggestions can be provided as either strings or objects with title, label, and prompt:
|
|
43
|
+
|
|
44
|
+
### Simple Strings
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
const aui = useAui({
|
|
48
|
+
suggestions: Suggestions([
|
|
49
|
+
"What's the weather today?",
|
|
50
|
+
"Help me write an email",
|
|
51
|
+
"Explain React hooks",
|
|
52
|
+
]),
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Objects with Title and Description
|
|
57
|
+
|
|
58
|
+
For more detailed suggestions with separate display text and prompts:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
const aui = useAui({
|
|
62
|
+
suggestions: Suggestions([
|
|
63
|
+
{
|
|
64
|
+
title: "Weather",
|
|
65
|
+
label: "in San Francisco",
|
|
66
|
+
prompt: "What's the weather in San Francisco?",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
title: "React Hooks",
|
|
70
|
+
label: "useState and useEffect",
|
|
71
|
+
prompt: "Explain React hooks like useState and useEffect",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
title: "Travel Tips",
|
|
75
|
+
label: "for Tokyo",
|
|
76
|
+
prompt: "Give me travel tips for visiting Tokyo",
|
|
77
|
+
},
|
|
78
|
+
]),
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Displaying Suggestions
|
|
83
|
+
|
|
84
|
+
The default Thread component from the shadcn registry already includes suggestion rendering. The suggestions are displayed in the welcome screen when the thread is empty.
|
|
85
|
+
|
|
86
|
+
### Customizing Suggestion Display
|
|
87
|
+
|
|
88
|
+
If you want to customize how suggestions are displayed, you can modify your Thread component:
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import {
|
|
92
|
+
ThreadPrimitive,
|
|
93
|
+
SuggestionPrimitive,
|
|
94
|
+
AuiIf,
|
|
95
|
+
} from "@assistant-ui/react";
|
|
96
|
+
|
|
97
|
+
const ThreadWelcome = () => {
|
|
98
|
+
return (
|
|
99
|
+
<div className="flex flex-col items-center justify-center">
|
|
100
|
+
<h1>Welcome!</h1>
|
|
101
|
+
<p>How can I help you today?</p>
|
|
102
|
+
|
|
103
|
+
{/* Display suggestions */}
|
|
104
|
+
<div className="grid grid-cols-2 gap-2">
|
|
105
|
+
<ThreadPrimitive.Suggestions
|
|
106
|
+
components={{
|
|
107
|
+
Suggestion: SuggestionItem,
|
|
108
|
+
}}
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const SuggestionItem = () => {
|
|
116
|
+
return (
|
|
117
|
+
<SuggestionPrimitive.Trigger send asChild>
|
|
118
|
+
<button className="rounded-lg border p-3 hover:bg-muted">
|
|
119
|
+
<div className="font-medium">
|
|
120
|
+
<SuggestionPrimitive.Title />
|
|
121
|
+
</div>
|
|
122
|
+
<div className="text-muted-foreground text-sm">
|
|
123
|
+
<SuggestionPrimitive.Description />
|
|
124
|
+
</div>
|
|
125
|
+
</button>
|
|
126
|
+
</SuggestionPrimitive.Trigger>
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Suggestion Primitives
|
|
132
|
+
|
|
133
|
+
### ThreadPrimitive.Suggestions
|
|
134
|
+
|
|
135
|
+
Renders all suggestions from the suggestions scope.
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
<ThreadPrimitive.Suggestions
|
|
139
|
+
components={{
|
|
140
|
+
Suggestion: CustomSuggestionComponent,
|
|
141
|
+
}}
|
|
142
|
+
/>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### SuggestionPrimitive.Title
|
|
146
|
+
|
|
147
|
+
Displays the suggestion's title (the first part when using object format, or the full text when using strings).
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
<SuggestionPrimitive.Title />
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### SuggestionPrimitive.Description
|
|
154
|
+
|
|
155
|
+
Displays the suggestion's description/label (only shown when using object format).
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
<SuggestionPrimitive.Description />
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### SuggestionPrimitive.Trigger
|
|
162
|
+
|
|
163
|
+
A button that triggers the suggestion action when clicked.
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
<SuggestionPrimitive.Trigger
|
|
167
|
+
send={true}
|
|
168
|
+
clearComposer={true}
|
|
169
|
+
asChild
|
|
170
|
+
>
|
|
171
|
+
<button>Click me</button>
|
|
172
|
+
</SuggestionPrimitive.Trigger>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Props:**
|
|
176
|
+
|
|
177
|
+
- `send` (boolean): When true, automatically sends the message. When false, only populates the composer.
|
|
178
|
+
- `clearComposer` (boolean, default: true): When `send` is false, determines if the composer is cleared before adding the suggestion (true) or if the suggestion is appended (false).
|
|
179
|
+
- `asChild` (boolean): Merge props with child element instead of rendering a button.
|
|
180
|
+
|
|
181
|
+
## Dynamic Suggestions
|
|
182
|
+
|
|
183
|
+
You can dynamically change suggestions based on your application state:
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
import { useMemo } from "react";
|
|
187
|
+
|
|
188
|
+
function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
189
|
+
const runtime = useChatRuntime();
|
|
190
|
+
const user = useUser(); // Your user hook
|
|
191
|
+
|
|
192
|
+
const suggestions = useMemo(() => {
|
|
193
|
+
if (user.isPremium) {
|
|
194
|
+
return [
|
|
195
|
+
"Analyze my business data",
|
|
196
|
+
"Generate a detailed report",
|
|
197
|
+
"Create a custom workflow",
|
|
198
|
+
];
|
|
199
|
+
}
|
|
200
|
+
return [
|
|
201
|
+
"What can you do?",
|
|
202
|
+
"Tell me a joke",
|
|
203
|
+
"Help me get started",
|
|
204
|
+
];
|
|
205
|
+
}, [user.isPremium]);
|
|
206
|
+
|
|
207
|
+
const aui = useAui({
|
|
208
|
+
tools: Tools({ toolkit: myToolkit }),
|
|
209
|
+
suggestions: Suggestions(suggestions),
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<AssistantRuntimeProvider aui={aui} runtime={runtime}>
|
|
214
|
+
{children}
|
|
215
|
+
</AssistantRuntimeProvider>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Context-Aware Suggestions
|
|
221
|
+
|
|
222
|
+
Suggestions can be tailored to different contexts or user intents:
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
const suggestions = [
|
|
226
|
+
{
|
|
227
|
+
title: "Code Review",
|
|
228
|
+
label: "Get feedback on your code",
|
|
229
|
+
prompt: "Can you review this code for me?",
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
title: "Debug Help",
|
|
233
|
+
label: "Find and fix issues",
|
|
234
|
+
prompt: "Help me debug this error",
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
title: "Best Practices",
|
|
238
|
+
label: "Learn recommended patterns",
|
|
239
|
+
prompt: "What are the best practices for this?",
|
|
240
|
+
},
|
|
241
|
+
];
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Best Practices
|
|
245
|
+
|
|
246
|
+
1. **Keep suggestions concise**: Use clear, actionable prompts that users can understand at a glance
|
|
247
|
+
2. **Show capabilities**: Use suggestions to highlight your assistant's key features
|
|
248
|
+
3. **Provide variety**: Offer suggestions across different use cases
|
|
249
|
+
4. **Use the object format for complex suggestions**: When you need separate title/description, use the object format
|
|
250
|
+
5. **Limit the number**: 3-6 suggestions work best to avoid overwhelming users
|
|
251
|
+
6. **Make them actionable**: Each suggestion should lead to a meaningful interaction
|
|
252
|
+
|
|
253
|
+
## Migration from Legacy API
|
|
254
|
+
|
|
255
|
+
If you're using the deprecated `ThreadPrimitive.Suggestion` component, migrate to the new API:
|
|
256
|
+
|
|
257
|
+
### Before (Deprecated)
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
<ThreadPrimitive.Suggestion
|
|
261
|
+
prompt="What's the weather?"
|
|
262
|
+
send
|
|
263
|
+
/>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### After (Recommended)
|
|
267
|
+
|
|
268
|
+
1. Configure suggestions in your runtime provider:
|
|
269
|
+
|
|
270
|
+
```tsx
|
|
271
|
+
const aui = useAui({
|
|
272
|
+
suggestions: Suggestions(["What's the weather?"]),
|
|
273
|
+
});
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
2. Display suggestions using the primitives:
|
|
277
|
+
|
|
278
|
+
```tsx
|
|
279
|
+
<ThreadPrimitive.Suggestions
|
|
280
|
+
components={{
|
|
281
|
+
Suggestion: SuggestionItem,
|
|
282
|
+
}}
|
|
283
|
+
/>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
The new API provides:
|
|
287
|
+
- **Centralized configuration**: Define suggestions once in your runtime provider
|
|
288
|
+
- **Better separation of concerns**: Configuration separate from presentation
|
|
289
|
+
- **Type safety**: Full TypeScript support
|
|
290
|
+
- **Consistency**: Follows the same pattern as the Tools API
|
|
291
|
+
|
|
292
|
+
## Related
|
|
293
|
+
|
|
294
|
+
- [Thread Component](/docs/ui/thread) - Main chat interface
|
|
295
|
+
- [Tools Guide](/docs/guides/tools) - Configure assistant actions
|
|
296
|
+
- [Context API](/docs/guides/context-api) - Access assistant state
|