@assistant-ui/mcp-docs-server 0.2.1 → 0.2.3
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/waterfall.md +3 -3
- package/.docs/organized/code-examples/with-a2a.md +5 -4
- package/.docs/organized/code-examples/with-ag-ui.md +7 -6
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +14 -13
- package/.docs/organized/code-examples/with-artifacts.md +12 -11
- package/.docs/organized/code-examples/with-assistant-transport.md +6 -5
- package/.docs/organized/code-examples/with-browser-extension.md +6 -6
- package/.docs/organized/code-examples/with-chain-of-thought.md +16 -14
- package/.docs/organized/code-examples/with-cloud-standalone.md +7 -7
- package/.docs/organized/code-examples/with-cloud.md +11 -10
- package/.docs/organized/code-examples/with-custom-thread-list.md +11 -10
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +14 -13
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +15 -14
- package/.docs/organized/code-examples/with-eve.md +6 -5
- package/.docs/organized/code-examples/with-expo.md +213 -36
- package/.docs/organized/code-examples/with-external-store.md +6 -5
- package/.docs/organized/code-examples/with-ffmpeg.md +11 -10
- package/.docs/organized/code-examples/with-generative-ui.md +263 -29
- package/.docs/organized/code-examples/with-google-adk.md +5 -4
- package/.docs/organized/code-examples/with-heat-graph.md +3 -3
- package/.docs/organized/code-examples/with-image-generation.md +8 -7
- package/.docs/organized/code-examples/with-interactables.md +11 -10
- package/.docs/organized/code-examples/with-langchain.md +10 -9
- package/.docs/organized/code-examples/with-langgraph.md +7 -6
- package/.docs/organized/code-examples/with-livekit.md +15 -14
- package/.docs/organized/code-examples/with-mcp.md +14 -12
- package/.docs/organized/code-examples/with-nuxt.md +511 -575
- package/.docs/organized/code-examples/with-opencode.md +4 -4
- package/.docs/organized/code-examples/with-openui.md +450 -0
- package/.docs/organized/code-examples/with-pi.md +6 -5
- package/.docs/organized/code-examples/with-react-hook-form.md +16 -13
- package/.docs/organized/code-examples/with-react-ink-web.md +65 -15
- package/.docs/organized/code-examples/with-react-ink.md +5 -4
- package/.docs/organized/code-examples/with-react-router.md +8 -7
- package/.docs/organized/code-examples/with-resumable-stream.md +13 -12
- package/.docs/organized/code-examples/with-store.md +3 -3
- package/.docs/organized/code-examples/with-svelte.md +415 -0
- package/.docs/organized/code-examples/with-sveltekit.md +1061 -0
- package/.docs/organized/code-examples/with-tanstack.md +10 -9
- package/.docs/organized/code-examples/with-tap-runtime.md +5 -4
- package/.docs/organized/code-examples/with-virtualized-thread.md +6 -5
- package/.docs/organized/code-examples/with-vue.md +2 -2
- package/.docs/raw/docs/{(docs) → (getting-started)}/cli.mdx +6 -1
- package/.docs/raw/docs/{(docs) → (getting-started)}/devtools.mdx +1 -1
- package/.docs/raw/docs/{(docs) → (getting-started)}/index.mdx +4 -2
- package/.docs/raw/docs/{(docs) → (getting-started)}/installation.mdx +26 -26
- package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +6 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +6 -1
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/slack.mdx +5 -1
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/teams.mdx +9 -2
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/integrations/{react-ai-sdk.mdx → ai-sdk.mdx} +43 -18
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +61 -2
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +3 -3
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +20 -2
- package/.docs/raw/docs/(reference)/api-reference/tools/interactables.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +32 -1
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +1 -1
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +10 -10
- package/.docs/raw/docs/cloud/ai-sdk.mdx +4 -2
- package/.docs/raw/docs/cloud/index.mdx +1 -1
- package/.docs/raw/docs/copilots/assistant-frame.mdx +19 -8
- package/.docs/raw/docs/guides/attachments.mdx +4 -4
- package/.docs/raw/docs/guides/branching.mdx +1 -1
- package/.docs/raw/docs/guides/chatgpt-subscription.mdx +1 -1
- package/.docs/raw/docs/guides/context-api.mdx +15 -17
- package/.docs/raw/docs/guides/dictation.mdx +2 -2
- package/.docs/raw/docs/guides/electron.mdx +1 -1
- package/.docs/raw/docs/guides/latex.mdx +1 -1
- package/.docs/raw/docs/guides/mentions.mdx +2 -0
- package/.docs/raw/docs/guides/message-timing.mdx +11 -5
- package/.docs/raw/docs/guides/quoting.mdx +1 -1
- package/.docs/raw/docs/guides/resumable-streams.mdx +3 -3
- package/.docs/raw/docs/guides/speech.mdx +1 -1
- package/.docs/raw/docs/guides/suggestions.mdx +8 -5
- package/.docs/raw/docs/guides/voice.mdx +1 -1
- package/.docs/raw/docs/ink/hooks.mdx +1 -1
- package/.docs/raw/docs/ink/index.mdx +3 -2
- package/.docs/raw/docs/ink/migration.mdx +1 -1
- package/.docs/raw/docs/ink/primitives.mdx +1 -1
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/{cloudflare-agents/overview.mdx → cloudflare-agents.mdx} +4 -3
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +1 -1
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +1 -1
- package/.docs/raw/docs/integrations/index.mdx +2 -2
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +149 -131
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +2 -2
- package/.docs/raw/docs/migrations/v0-15.mdx +34 -0
- package/.docs/raw/docs/primitives/action-bar.mdx +1 -1
- package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -1
- package/.docs/raw/docs/primitives/attachment.mdx +1 -1
- package/.docs/raw/docs/primitives/branch-picker.mdx +1 -1
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +3 -3
- package/.docs/raw/docs/primitives/composer.mdx +1 -1
- package/.docs/raw/docs/primitives/error.mdx +1 -1
- package/.docs/raw/docs/primitives/message.mdx +1 -1
- package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -1
- package/.docs/raw/docs/primitives/suggestion.mdx +4 -2
- package/.docs/raw/docs/primitives/thread-list.mdx +1 -1
- package/.docs/raw/docs/primitives/thread.mdx +2 -2
- package/.docs/raw/docs/react-native/adapters.mdx +1 -1
- package/.docs/raw/docs/react-native/index.mdx +2 -2
- package/.docs/raw/docs/react-native/migration.mdx +2 -2
- package/.docs/raw/docs/react-native/primitives.mdx +142 -5
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +48 -6
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +3 -3
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +4 -4
- package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +31 -16
- package/.docs/raw/docs/runtimes/claude-managed-agents.mdx +118 -0
- package/.docs/raw/docs/runtimes/concepts/adapters.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +3 -3
- package/.docs/raw/docs/runtimes/concepts/stability.mdx +2 -1
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +73 -33
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +1 -1
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +6 -2
- package/.docs/raw/docs/runtimes/langchain.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +4 -0
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +1 -1
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +9 -2
- package/.docs/raw/docs/tools/backend.mdx +4 -4
- package/.docs/raw/docs/tools/defining-tools.mdx +21 -2
- package/.docs/raw/docs/tools/generative-ui-primitive.mdx +180 -0
- package/.docs/raw/docs/tools/generative-ui-slack.mdx +167 -0
- package/.docs/raw/docs/tools/generative-ui-teams.mdx +160 -0
- package/.docs/raw/docs/tools/generative-ui.mdx +224 -211
- package/.docs/raw/docs/tools/index.mdx +2 -1
- package/.docs/raw/docs/tools/interactables.mdx +8 -7
- package/.docs/raw/docs/tools/mcp-apps.mdx +18 -1
- package/.docs/raw/docs/tools/mcp.mdx +2 -2
- package/.docs/raw/docs/tools/openui.mdx +175 -0
- package/.docs/raw/docs/tools/tool-ui.mdx +18 -7
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +7 -3
- package/.docs/raw/docs/ui/assistant-modal.mdx +3 -3
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -1
- package/.docs/raw/docs/ui/attachment.mdx +50 -3
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +36 -1
- package/.docs/raw/docs/ui/context-display.mdx +1 -1
- package/.docs/raw/docs/ui/directive-text.mdx +1 -1
- package/.docs/raw/docs/ui/file.mdx +2 -2
- package/.docs/raw/docs/ui/follow-up-suggestions.mdx +1 -1
- package/.docs/raw/docs/ui/image.mdx +2 -2
- package/.docs/raw/docs/ui/markdown.mdx +40 -1
- package/.docs/raw/docs/ui/mermaid.mdx +1 -1
- package/.docs/raw/docs/ui/message-timing.mdx +1 -1
- package/.docs/raw/docs/ui/model-selector.mdx +4 -4
- package/.docs/raw/docs/ui/part-grouping.mdx +1 -1
- package/.docs/raw/docs/ui/quote.mdx +3 -3
- package/.docs/raw/docs/ui/reasoning.mdx +31 -3
- package/.docs/raw/docs/ui/scrollbar.mdx +1 -1
- package/.docs/raw/docs/ui/sources.mdx +10 -1
- package/.docs/raw/docs/ui/streamdown.mdx +2 -2
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -1
- package/.docs/raw/docs/ui/thread-list.mdx +40 -1
- package/.docs/raw/docs/ui/thread.mdx +49 -2
- package/.docs/raw/docs/ui/tool-fallback.mdx +23 -9
- package/.docs/raw/docs/ui/tool-group.mdx +1 -1
- package/.docs/raw/docs/ui/voice.mdx +1 -1
- package/.docs/raw/docs/utilities/react-o11y.mdx +2 -2
- package/dist/xulux/catalog-client.d.ts.map +1 -1
- package/dist/xulux/catalog-client.js +51 -6
- package/dist/xulux/catalog-client.js.map +1 -1
- package/dist/xulux/types.d.ts +7 -7
- package/dist/xulux/types.d.ts.map +1 -1
- package/dist/xulux/types.js.map +1 -1
- package/package.json +5 -5
- package/src/tools/tests/docs.test.ts +10 -7
- package/src/tools/tests/path-traversal.test.ts +5 -2
- package/src/tools/tests/xulux-templates.test.ts +63 -0
- package/src/xulux/catalog-client.ts +68 -23
- package/src/xulux/types.ts +17 -13
- package/.docs/raw/docs/tools/interactables-legacy.mdx +0 -423
- package/.docs/raw/docs/ui/accordion.mdx +0 -266
- package/.docs/raw/docs/ui/badge.mdx +0 -150
- package/.docs/raw/docs/ui/diff-viewer.mdx +0 -280
- package/.docs/raw/docs/ui/dot-matrix.mdx +0 -133
- package/.docs/raw/docs/ui/number-roll.mdx +0 -154
- package/.docs/raw/docs/ui/select.mdx +0 -254
- package/.docs/raw/docs/ui/tabs.mdx +0 -271
- /package/.docs/raw/docs/{(docs) → (getting-started)}/architecture.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/base-ui.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/llm.mdx +0 -0
- /package/.docs/raw/docs/{(docs) → (getting-started)}/rtl.mdx +0 -0
|
@@ -164,7 +164,7 @@ the server-side MCP readiness flow (`createMCPClient()` plus `tools()`) before
|
|
|
164
164
|
a bad URL or hanging local process can stall the route.
|
|
165
165
|
|
|
166
166
|
```ts title="app/api/chat/route.ts"
|
|
167
|
-
import { AISDKToolkit } from "@assistant-ui/
|
|
167
|
+
import { AISDKToolkit } from "@assistant-ui/ai-sdk";
|
|
168
168
|
import { openai } from "@ai-sdk/openai";
|
|
169
169
|
import { streamText, convertToModelMessages } from "ai";
|
|
170
170
|
import type { UIMessage } from "ai";
|
|
@@ -370,7 +370,7 @@ Register the toolkit once with `Tools({ toolkit })`. Renderer keys such as
|
|
|
370
370
|
"use client";
|
|
371
371
|
|
|
372
372
|
import { AssistantRuntimeProvider, AuiConfig, Tools } from "@assistant-ui/react";
|
|
373
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
373
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
374
374
|
import type { ReactNode } from "react";
|
|
375
375
|
|
|
376
376
|
import { toolkit } from "./GitHubIssueToolUI";
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: OpenUI
|
|
3
|
+
description: Render streaming OpenUI Lang interfaces in an assistant-ui conversation with @openuidev/assistant-ui, the integration package published by OpenUI.
|
|
4
|
+
platforms: ["react"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[OpenUI](https://www.openui.com) is a generative UI system in which the model writes **OpenUI Lang**, a streaming markup language, and an OpenUI renderer turns it into interactive React components. [`@openuidev/assistant-ui`](https://www.npmjs.com/package/@openuidev/assistant-ui) connects that renderer to assistant-ui: it ships a ready-made toolkit, model instructions generated from the OpenUI component library, and Tool UI renderers that stream, handle interactions, and replay.
|
|
8
|
+
|
|
9
|
+
<Callout type="info">
|
|
10
|
+
`@openuidev/assistant-ui` is a third-party package. OpenUI owns the package, its [documentation](https://www.openui.com/docs/api-reference/assistant-ui), and its releases; assistant-ui does not ship or version any OpenUI code. Use OpenUI's reference for the package API and OpenUI Lang itself; this page covers the assistant-ui side of the wiring.
|
|
11
|
+
</Callout>
|
|
12
|
+
|
|
13
|
+
The integration rides entirely on the [Tool UI](/docs/tools/tool-ui) lifecycle, so assistant-ui stays in charge of the conversation, streaming, and tool calls. The toolkit registers two standalone tools:
|
|
14
|
+
|
|
15
|
+
- `present_openui` is a **frontend tool** for display-only interfaces (cards, tables, charts). It completes as soon as the streamed `ui` argument is available, and the turn ends there.
|
|
16
|
+
- `prompt_openui` is a **human tool** for forms and choices. It completes only when the user submits an OpenUI `@ToAssistant(...)` action, and the submitted values continue the conversation.
|
|
17
|
+
|
|
18
|
+
## How it relates to the `present` tool
|
|
19
|
+
|
|
20
|
+
assistant-ui's first-party [Generative UI](/docs/tools/generative-ui) follows the same shape: one tool, a component vocabulary, and a model that composes an interface at runtime. The difference is the representation and who owns it. `present` takes a JSON tree validated against a schema generated from a vocabulary you ship and restyle; `present_openui` takes an OpenUI Lang program rendered by OpenUI's component kit, taught to the model through instructions. Pick `present` when you want the interface built from your own components on assistant-ui's append-only surface, and OpenUI when you are already invested in the OpenUI ecosystem or want its renderer and component library.
|
|
21
|
+
|
|
22
|
+
## Quick start
|
|
23
|
+
|
|
24
|
+
The complete setup below runs in [`examples/with-openui`](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-openui). To scaffold a standalone copy, run `npx assistant-ui create my-app --example with-openui`.
|
|
25
|
+
|
|
26
|
+
<Steps>
|
|
27
|
+
|
|
28
|
+
<Step>
|
|
29
|
+
|
|
30
|
+
### Install the packages
|
|
31
|
+
|
|
32
|
+
Alongside an existing `@assistant-ui/react` setup, add the integration and its OpenUI peer dependencies:
|
|
33
|
+
|
|
34
|
+
<InstallCommand npm={["@openuidev/assistant-ui", "@openuidev/react-ui", "@openuidev/react-lang", "@openuidev/react-headless", "zustand@^4.5.5"]} />
|
|
35
|
+
|
|
36
|
+
The package also expects `zod` and React 18 or 19, which an assistant-ui app already has. The current OpenUI peers support AI SDK 6 and 7 and require Zustand 4.
|
|
37
|
+
|
|
38
|
+
</Step>
|
|
39
|
+
|
|
40
|
+
<Step>
|
|
41
|
+
|
|
42
|
+
### Load the OpenUI stylesheet
|
|
43
|
+
|
|
44
|
+
Import the layered stylesheet once, for example in `app/globals.css`:
|
|
45
|
+
|
|
46
|
+
```css
|
|
47
|
+
@import "@openuidev/react-ui/layered/styles/index.css";
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
</Step>
|
|
51
|
+
|
|
52
|
+
<Step>
|
|
53
|
+
|
|
54
|
+
### Register the toolkit and instructions
|
|
55
|
+
|
|
56
|
+
`openuiIntegration` bundles a toolkit and an instruction string created from the same OpenUI component library, so the model and the renderer share one vocabulary. Register the toolkit with [`Tools`](/docs/api-reference/tools) and mount `OpenUIInstructions` so the vocabulary reaches the model as assistant instructions:
|
|
57
|
+
|
|
58
|
+
```tsx title="app/page.tsx"
|
|
59
|
+
"use client";
|
|
60
|
+
|
|
61
|
+
import {
|
|
62
|
+
AssistantRuntimeProvider,
|
|
63
|
+
AuiConfig,
|
|
64
|
+
Tools,
|
|
65
|
+
} from "@assistant-ui/react";
|
|
66
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
67
|
+
import { OpenUIInstructions, openuiIntegration } from "@openuidev/assistant-ui";
|
|
68
|
+
import { shouldContinueAfterOpenUIPrompt } from "@openuidev/assistant-ui/ai-sdk";
|
|
69
|
+
import { Thread } from "@/components/assistant-ui/thread";
|
|
70
|
+
|
|
71
|
+
export default function Home() {
|
|
72
|
+
const runtime = useChatRuntime({
|
|
73
|
+
sendAutomaticallyWhen: shouldContinueAfterOpenUIPrompt,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const config = AuiConfig({
|
|
77
|
+
tools: Tools({ toolkit: openuiIntegration.toolkit }),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<AssistantRuntimeProvider config={config} runtime={runtime}>
|
|
82
|
+
<OpenUIInstructions />
|
|
83
|
+
<Thread />
|
|
84
|
+
</AssistantRuntimeProvider>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`sendAutomaticallyWhen` is the continuation gate. OpenUI's predicate continues the run only after `prompt_openui` has received a submitted result, so a display-only `present_openui` call ends the turn instead of triggering an empty follow-up request.
|
|
90
|
+
|
|
91
|
+
<Callout type="info">
|
|
92
|
+
`sendAutomaticallyWhen` is a single slot. OpenUI's predicate is a strict refinement of `lastAssistantMessageIsCompleteWithToolCalls` (the predicate the other guides in this section use), so it replaces it cleanly when OpenUI's tools are the only ones that resume the run. If your app mixes in other tools whose flows must also resume, write one predicate that decides by tool name; a naive `||` with the generic predicate collapses to the generic predicate alone and re-enables the empty follow-up after display-only calls.
|
|
93
|
+
</Callout>
|
|
94
|
+
|
|
95
|
+
</Step>
|
|
96
|
+
|
|
97
|
+
<Step>
|
|
98
|
+
|
|
99
|
+
### Forward the tools in your API route
|
|
100
|
+
|
|
101
|
+
The default `AssistantChatTransport` forwards the registered instructions and both frontend tool schemas to the backend, so the route stays generic:
|
|
102
|
+
|
|
103
|
+
```ts title="app/api/chat/route.ts"
|
|
104
|
+
import { openai } from "@ai-sdk/openai";
|
|
105
|
+
import { frontendTools } from "@assistant-ui/ai-sdk";
|
|
106
|
+
import {
|
|
107
|
+
type JSONSchema7,
|
|
108
|
+
streamText,
|
|
109
|
+
convertToModelMessages,
|
|
110
|
+
type UIMessage,
|
|
111
|
+
createUIMessageStreamResponse,
|
|
112
|
+
toUIMessageStream,
|
|
113
|
+
} from "ai";
|
|
114
|
+
|
|
115
|
+
export const maxDuration = 30;
|
|
116
|
+
|
|
117
|
+
export async function POST(req: Request) {
|
|
118
|
+
const {
|
|
119
|
+
messages,
|
|
120
|
+
system,
|
|
121
|
+
tools,
|
|
122
|
+
}: {
|
|
123
|
+
messages: UIMessage[];
|
|
124
|
+
system?: string;
|
|
125
|
+
tools?: Record<string, { description?: string; parameters: JSONSchema7 }>;
|
|
126
|
+
} = await req.json();
|
|
127
|
+
|
|
128
|
+
const result = streamText({
|
|
129
|
+
model: openai("gpt-5.6-luna"),
|
|
130
|
+
messages: await convertToModelMessages(messages),
|
|
131
|
+
...(system ? { system } : {}),
|
|
132
|
+
tools: frontendTools(tools ?? {}),
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
return createUIMessageStreamResponse({
|
|
136
|
+
stream: toUIMessageStream({ stream: result.stream }),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
</Step>
|
|
142
|
+
|
|
143
|
+
</Steps>
|
|
144
|
+
|
|
145
|
+
## Interaction and replay
|
|
146
|
+
|
|
147
|
+
When the user submits a `prompt_openui` form or choice, the integration reports the action, message, parameters, and form state through the standard human-tool `addResult`, and `sendAutomaticallyWhen` resumes the run with that result. On replay of a persisted thread, the stored result hydrates the submitted form state back into the renderer, so completed forms render as submitted instead of resetting.
|
|
148
|
+
|
|
149
|
+
<Callout type="tip">
|
|
150
|
+
The core integration is runtime-agnostic: the toolkit, renderers, and instructions work with any assistant-ui runtime that forwards tool schemas and results. Only the `shouldContinueAfterOpenUIPrompt` helper on the `/ai-sdk` subpath is AI SDK-specific.
|
|
151
|
+
</Callout>
|
|
152
|
+
|
|
153
|
+
## Customization
|
|
154
|
+
|
|
155
|
+
`createOpenUIIntegration` keeps a custom component library, tool names, and renderer options aligned across the toolkit and the instructions:
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
import { createOpenUIIntegration } from "@openuidev/assistant-ui";
|
|
159
|
+
import { library } from "./library";
|
|
160
|
+
|
|
161
|
+
const openui = createOpenUIIntegration({
|
|
162
|
+
library,
|
|
163
|
+
presentToolName: "show_panel",
|
|
164
|
+
promptToolName: "ask_panel",
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The result exposes `toolkit`, `instructions`, and the resolved `toolNames`. See [OpenUI's integration reference](https://www.openui.com/docs/api-reference/assistant-ui) for the full option surface, including custom descriptions, prompt options, renderer props, and error handling.
|
|
169
|
+
|
|
170
|
+
## Related
|
|
171
|
+
|
|
172
|
+
- [`examples/with-openui`](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-openui): the runnable setup from this page
|
|
173
|
+
- [OpenUI assistant-ui integration reference](https://www.openui.com/docs/api-reference/assistant-ui): the canonical package documentation
|
|
174
|
+
- [Generative UI](/docs/tools/generative-ui): the first-party `present` tool this integration sits alongside
|
|
175
|
+
- [Tool UI](/docs/tools/tool-ui): the lifecycle both OpenUI tools build on
|
|
@@ -4,7 +4,9 @@ description: Render AI tool calls as custom React components — show loading, r
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { ToolUISample } from "@/components/docs/samples/tool-ui";
|
|
7
|
+
import { ToolUISample } from "@/components/pages/docs/samples/tool-ui";
|
|
8
|
+
import { PreviewCode } from "@/components/pages/docs/preview-code.server";
|
|
9
|
+
import { ToolUIRendererSample } from "@/components/pages/docs/samples/tool-ui/custom-renderer";
|
|
8
10
|
|
|
9
11
|
Create custom UI components for AI tool calls, providing visual feedback and interactive experiences when tools are executed.
|
|
10
12
|
|
|
@@ -21,8 +23,7 @@ Tool UIs in assistant-ui allow you to create custom interfaces that appear when
|
|
|
21
23
|
|
|
22
24
|
This guide demonstrates building tool UIs with the **Vercel AI SDK**.
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
see the [Generative UI primitive guide](/docs/tools/generative-ui).
|
|
26
|
+
To let the model compose UI from a vocabulary instead of binding one component per tool, see [Generative UI](/docs/tools/generative-ui).
|
|
26
27
|
|
|
27
28
|
## Creating Tool UIs
|
|
28
29
|
|
|
@@ -70,7 +71,7 @@ export default defineToolkit({
|
|
|
70
71
|
|
|
71
72
|
```tsx title="app/MyRuntimeProvider.tsx"
|
|
72
73
|
import { AssistantRuntimeProvider, AuiConfig, Tools } from "@assistant-ui/react";
|
|
73
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
74
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
74
75
|
import toolkit from "./toolkit";
|
|
75
76
|
|
|
76
77
|
function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
|
|
@@ -110,7 +111,14 @@ const toolkit = defineToolkit({
|
|
|
110
111
|
|
|
111
112
|
## Quick Start Example
|
|
112
113
|
|
|
113
|
-
This example
|
|
114
|
+
This example uses a backend toolkit entry for a tool that the server defines. The preview uses a shorter renderer than the steps below.
|
|
115
|
+
|
|
116
|
+
<PreviewCode
|
|
117
|
+
file="components/pages/docs/samples/tool-ui/custom-renderer"
|
|
118
|
+
name="WeatherToolUI"
|
|
119
|
+
>
|
|
120
|
+
<ToolUIRendererSample />
|
|
121
|
+
</PreviewCode>
|
|
114
122
|
|
|
115
123
|
<Steps>
|
|
116
124
|
<Step>
|
|
@@ -179,12 +187,15 @@ const WeatherToolUI: ToolCallMessagePartComponent<
|
|
|
179
187
|
|
|
180
188
|
### Register the Tool UI
|
|
181
189
|
|
|
182
|
-
Put the renderer on the
|
|
190
|
+
Put the renderer on the related backend toolkit entry.
|
|
191
|
+
|
|
192
|
+
Set `display` to `"standalone"` to keep the tool UI outside the collapsed tool group. A backend tool uses the inline display by default.
|
|
183
193
|
|
|
184
194
|
```tsx
|
|
185
195
|
const toolkit = defineToolkit({
|
|
186
196
|
getWeather: {
|
|
187
197
|
type: "backend",
|
|
198
|
+
display: "standalone",
|
|
188
199
|
render: WeatherToolUI,
|
|
189
200
|
},
|
|
190
201
|
});
|
|
@@ -614,7 +625,7 @@ Renderers respond with the chosen option instead of a boolean; the option's kind
|
|
|
614
625
|
respondToApproval({ optionId: "session" });
|
|
615
626
|
```
|
|
616
627
|
|
|
617
|
-
The runtime receives `{ approvalId, approved, optionId, reason? }`, so a host that persists "always allow" decisions can key its store off `optionId`. Persistence is entirely host-owned: assistant-ui never stores a decision and never auto-answers future approvals. `grants` lists the patterns an option would persist (shown to the user before they commit), and `confirm` opts the option into a confirmation step. Options with custom `_`-prefixed kinds
|
|
628
|
+
The runtime receives `{ approvalId, approved, optionId, reason? }`, so a host that persists "always allow" decisions can key its store off `optionId`. Persistence is entirely host-owned: assistant-ui never stores a decision and never auto-answers future approvals. `grants` lists the patterns an option would persist (shown to the user before they commit), and `confirm` opts the option into a confirmation step. Options with custom `_`-prefixed kinds must be answered with an explicit `approved` value, optionally alongside the `optionId` so the chosen option is still recorded. The default `ToolFallback` bar renders them next to the known kinds and sends `{ optionId, approved: true }` when one is chosen, since picking a declared option is an answer rather than a refusal; it also keeps a Deny control available whenever the request declares no reject-kind option.
|
|
618
629
|
|
|
619
630
|
Approvals that end without a decision (a cancelled run or an expired request) are recorded by the host as `approval.resolution: "cancelled" | "expired"`, which closes the gate without recording a deny.
|
|
620
631
|
|
|
@@ -24,6 +24,10 @@ AuiConfig({ mcp: McpManagerResource({ connectors }) })
|
|
|
24
24
|
|
|
25
25
|
The manager is a single resource. Mount it with `AuiProvider` like any other scope. OAuth (PKCE + RFC 7591 dynamic client registration), bearer, and "no auth" are first-class. Token refresh runs inside the MCP SDK on 401; this package mediates persistence and the redirect step.
|
|
26
26
|
|
|
27
|
+
<Callout type="info">
|
|
28
|
+
The [2026-07-28 spec revision](https://modelcontextprotocol.io/specification/2026-07-28/changelog) deprecates RFC 7591 dynamic client registration in favor of [Client ID Metadata Documents](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/client-registration#client-id-metadata-documents), which clients should prefer over DCR when the authorization server advertises `client_id_metadata_document_supported`. Dynamic client registration remains available for backwards compatibility with authorization servers that do not support CIMD, and the spec's deprecation policy sets a minimum twelve-month window before removal, so the flow described here keeps working. Against a CIMD-only authorization server that exposes no `registration_endpoint`, supply a pre-registered [`clientId`](#auth) instead.
|
|
29
|
+
</Callout>
|
|
30
|
+
|
|
27
31
|
## Setup
|
|
28
32
|
|
|
29
33
|
<Steps>
|
|
@@ -217,12 +221,12 @@ The callback reads `?state=...&code=...` from the URL, derives the target server
|
|
|
217
221
|
|
|
218
222
|
### That's it — the chat sees your tools
|
|
219
223
|
|
|
220
|
-
`McpManagerResource` registers connected tools as **frontend tools** with the `modelContext` scope. Any chat runtime mounted in the same store (e.g. `@assistant-ui/
|
|
224
|
+
`McpManagerResource` registers connected tools as **frontend tools** with the `modelContext` scope. Any chat runtime mounted in the same store (e.g. `@assistant-ui/ai-sdk`'s `useChatRuntime`) sees them and exposes them to the model — no `useMcpTools` hook, no adapter call.
|
|
221
225
|
|
|
222
226
|
```tsx
|
|
223
227
|
"use client";
|
|
224
228
|
import { lastAssistantMessageIsCompleteWithToolCalls } from "ai";
|
|
225
|
-
import { useChatRuntime } from "@assistant-ui/
|
|
229
|
+
import { useChatRuntime } from "@assistant-ui/ai-sdk";
|
|
226
230
|
|
|
227
231
|
export function Chat() {
|
|
228
232
|
const runtime = useChatRuntime({
|
|
@@ -341,7 +345,7 @@ Three modes, declared per-connector or per-custom-record:
|
|
|
341
345
|
}
|
|
342
346
|
```
|
|
343
347
|
|
|
344
|
-
The OAuth provider implements the MCP SDK's `OAuthClientProvider`. The SDK handles discovery (RFC 8414), DCR (RFC 7591), PKCE, token exchange, and refresh; this package mediates `MCPStorage` reads/writes and the redirect step. The server id is embedded in the OAuth `state` parameter so a single `/mcp/callback` route knows which server to complete.
|
|
348
|
+
The OAuth provider implements the MCP SDK's `OAuthClientProvider`. The SDK handles discovery (RFC 8414), DCR (RFC 7591 — [deprecated in favor of CIMD](#how-it-works) but still supported), PKCE, token exchange, and refresh; this package mediates `MCPStorage` reads/writes and the redirect step. The server id is embedded in the OAuth `state` parameter so a single `/mcp/callback` route knows which server to complete.
|
|
345
349
|
|
|
346
350
|
## State & methods
|
|
347
351
|
|
|
@@ -4,9 +4,9 @@ description: Floating chat bubble for support widgets and help desks.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { AssistantModalSample } from "@/components/docs/samples/assistant-modal";
|
|
8
|
-
import * as AssistantModalRadixSamples from "@/components/docs/samples/assistant-modal.radix";
|
|
9
|
-
import { Flavored, FlavorSwitcher } from "@/components/docs/contexts/flavor.server";
|
|
7
|
+
import { AssistantModalSample } from "@/components/pages/docs/samples/assistant-modal";
|
|
8
|
+
import * as AssistantModalRadixSamples from "@/components/pages/docs/samples/assistant-modal.radix";
|
|
9
|
+
import { Flavored, FlavorSwitcher } from "@/components/pages/docs/contexts/flavor.server";
|
|
10
10
|
|
|
11
11
|
A floating chat modal built on the popover primitive of your configured style (Radix UI Popover on Radix styles, Base UI Popover on `base-*` styles). Ideal for support widgets, help desks, and embedded assistants.
|
|
12
12
|
|
|
@@ -4,7 +4,7 @@ description: Side panel chat for co-pilot experiences and inline assistance.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { AssistantSidebarSample } from "@/components/docs/samples/assistant-sidebar";
|
|
7
|
+
import { AssistantSidebarSample } from "@/components/pages/docs/samples/assistant-sidebar";
|
|
8
8
|
|
|
9
9
|
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.
|
|
10
10
|
|
|
@@ -4,9 +4,18 @@ description: UI components for attaching and viewing files in messages.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { AttachmentSample } from "@/components/docs/samples/attachment";
|
|
8
|
-
import * as AttachmentRadixSamples from "@/components/docs/samples/attachment.radix";
|
|
9
|
-
import { Flavored, FlavorSwitcher } from "@/components/docs/contexts/flavor.server";
|
|
7
|
+
import { AttachmentSample } from "@/components/pages/docs/samples/attachment";
|
|
8
|
+
import * as AttachmentRadixSamples from "@/components/pages/docs/samples/attachment.radix";
|
|
9
|
+
import { Flavored, FlavorSwitcher } from "@/components/pages/docs/contexts/flavor.server";
|
|
10
|
+
import { PreviewCode } from "@/components/pages/docs/preview-code.server";
|
|
11
|
+
import { AttachmentComposerSample } from "@/components/pages/docs/samples/attachment/composer-attachments";
|
|
12
|
+
import * as AttachmentComposerRadixSample from "@/components/pages/docs/samples/attachment/composer-attachments.radix";
|
|
13
|
+
import { AttachmentMessageContextSample } from "@/components/pages/docs/samples/attachment/message-attachments";
|
|
14
|
+
import * as AttachmentMessageRadixSample from "@/components/pages/docs/samples/attachment/message-attachments.radix";
|
|
15
|
+
import { AttachmentTypesSample } from "@/components/pages/docs/samples/attachment/types";
|
|
16
|
+
import * as AttachmentTypesRadixSample from "@/components/pages/docs/samples/attachment/types.radix";
|
|
17
|
+
import { AttachmentPreviewSample } from "@/components/pages/docs/samples/attachment/image-preview";
|
|
18
|
+
import * as AttachmentPreviewRadixSample from "@/components/pages/docs/samples/attachment/image-preview.radix";
|
|
10
19
|
|
|
11
20
|
<FlavorSwitcher />
|
|
12
21
|
|
|
@@ -35,6 +44,8 @@ This adds a `/components/assistant-ui/attachment.tsx` file to your project, whic
|
|
|
35
44
|
|
|
36
45
|
### Use in your application
|
|
37
46
|
|
|
47
|
+
Add `ComposerAttachments` and `ComposerAddAttachment` to your composer:
|
|
48
|
+
|
|
38
49
|
```tsx title="/components/assistant-ui/thread.tsx" {1-4,9-10}
|
|
39
50
|
import {
|
|
40
51
|
ComposerAttachments,
|
|
@@ -59,6 +70,8 @@ const Composer: FC = () => {
|
|
|
59
70
|
};
|
|
60
71
|
```
|
|
61
72
|
|
|
73
|
+
Add `UserMessageAttachments` to your user message:
|
|
74
|
+
|
|
62
75
|
```tsx title="/components/assistant-ui/thread.tsx" {1,8}
|
|
63
76
|
import { UserMessageAttachments } from "@/components/assistant-ui/attachment";
|
|
64
77
|
|
|
@@ -82,6 +95,40 @@ const UserMessage: FC = () => {
|
|
|
82
95
|
</Step>
|
|
83
96
|
</Steps>
|
|
84
97
|
|
|
98
|
+
## Examples
|
|
99
|
+
|
|
100
|
+
### Composer
|
|
101
|
+
|
|
102
|
+
In the composer, each attachment tile shows a remove button that deletes the attachment from the composer. Use the plus button to add your own files.
|
|
103
|
+
|
|
104
|
+
<PreviewCode file="components/pages/docs/samples/attachment/composer-attachments" name="ComposerWithAttachments" base={<AttachmentComposerSample />}>
|
|
105
|
+
<AttachmentComposerRadixSample.AttachmentComposerSample />
|
|
106
|
+
</PreviewCode>
|
|
107
|
+
|
|
108
|
+
### User Message
|
|
109
|
+
|
|
110
|
+
Message attachments are read-only. The same tile in a sent user message does not show a remove button.
|
|
111
|
+
|
|
112
|
+
<PreviewCode file="components/pages/docs/samples/attachment/message-attachments" name="UserMessageWithAttachments" base={<AttachmentMessageContextSample />}>
|
|
113
|
+
<AttachmentMessageRadixSample.AttachmentMessageContextSample />
|
|
114
|
+
</PreviewCode>
|
|
115
|
+
|
|
116
|
+
### Custom Types
|
|
117
|
+
|
|
118
|
+
This example shows the image tile and the generic fallback tile used for the built-in document type and the custom attachment type. The two fallback tiles use the same icon, but their accessible labels distinguish them.
|
|
119
|
+
|
|
120
|
+
<PreviewCode file="components/pages/docs/samples/attachment/types" name="AttachmentTypesSample" base={<AttachmentTypesSample />}>
|
|
121
|
+
<AttachmentTypesRadixSample.AttachmentTypesSample />
|
|
122
|
+
</PreviewCode>
|
|
123
|
+
|
|
124
|
+
### Image Preview
|
|
125
|
+
|
|
126
|
+
When you click an image tile or activate it with the keyboard, a full-size preview dialog opens.
|
|
127
|
+
|
|
128
|
+
<PreviewCode file="components/pages/docs/samples/attachment/image-preview" name="AttachmentPreviewSample" base={<AttachmentPreviewSample />}>
|
|
129
|
+
<AttachmentPreviewRadixSample.AttachmentPreviewSample />
|
|
130
|
+
</PreviewCode>
|
|
131
|
+
|
|
85
132
|
## API Reference
|
|
86
133
|
|
|
87
134
|
### Composer Attachments
|
|
@@ -4,7 +4,7 @@ description: Reusable picker UI for @ mentions, / slash commands, and any other
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { ComposerTriggerPopoverSample } from "@/components/docs/samples/composer-trigger-popover";
|
|
7
|
+
import { ComposerTriggerPopoverSample } from "@/components/pages/docs/samples/composer-trigger-popover";
|
|
8
8
|
|
|
9
9
|
<ComposerTriggerPopoverSample />
|
|
10
10
|
|
|
@@ -118,6 +118,40 @@ function SlashComposer() {
|
|
|
118
118
|
}
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
## Custom Query Matching
|
|
122
|
+
|
|
123
|
+
By default, whitespace closes a trigger query. Pass a stable `matcher` when a picker needs different syntax, such as multi-word business names. The same matcher controls the textarea popover and Lexical directive insertion.
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import type { Unstable_TriggerMatcher } from "@assistant-ui/react";
|
|
127
|
+
|
|
128
|
+
const matchMultiWord: Unstable_TriggerMatcher = (
|
|
129
|
+
text,
|
|
130
|
+
triggerChar,
|
|
131
|
+
cursorPosition,
|
|
132
|
+
) => {
|
|
133
|
+
const textUpToCursor = text.slice(0, cursorPosition);
|
|
134
|
+
const offset = textUpToCursor.lastIndexOf(triggerChar);
|
|
135
|
+
if (offset === -1) return null;
|
|
136
|
+
|
|
137
|
+
const preceding = textUpToCursor[offset - 1];
|
|
138
|
+
if (preceding && !/\s/u.test(preceding)) return null;
|
|
139
|
+
|
|
140
|
+
const query = textUpToCursor.slice(offset + triggerChar.length);
|
|
141
|
+
if (/[\n\t]/u.test(query) || query.endsWith(" ")) return null;
|
|
142
|
+
|
|
143
|
+
return { query, offset, endOffset: cursorPosition };
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
<ComposerTriggerPopover
|
|
147
|
+
char="@"
|
|
148
|
+
matcher={matchMultiWord}
|
|
149
|
+
{...mention}
|
|
150
|
+
/>;
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The matcher receives the serialized composer text for a textarea and the current text node for Lexical. `offset` is the trigger index in that string. `endOffset` is the exclusive end of the span both inputs replace. `query` is the search string and may differ from that span.
|
|
154
|
+
|
|
121
155
|
## Combining Triggers
|
|
122
156
|
|
|
123
157
|
Multiple popovers coexist under one `TriggerPopoverRoot`. Each reads state from its own declaration, so `@` and `/` never collide.
|
|
@@ -177,6 +211,7 @@ The popover implements the WAI-ARIA editable combobox pattern.
|
|
|
177
211
|
| Prop | Type | Default | Description |
|
|
178
212
|
| --- | --- | --- | --- |
|
|
179
213
|
| `char` | `string` | — | Trigger character, e.g. `"@"` or `"/"` (required; unique within the root) |
|
|
214
|
+
| `matcher` | `Unstable_TriggerMatcher` | whitespace-terminated | Overrides trigger detection and the replace span for both textarea and Lexical inputs |
|
|
180
215
|
| `adapter` | `Unstable_TriggerAdapter` | — | Provides categories, items, and search (required) |
|
|
181
216
|
| `directive` | `{ formatter, onInserted?, chip? }` | — | Enables directive-insert behavior. Mutually exclusive with `action`. |
|
|
182
217
|
| `action` | `{ formatter, onExecute, removeOnExecute?, chip? }` | — | Enables action behavior. Mutually exclusive with `directive`. |
|
|
@@ -4,7 +4,7 @@ description: Visualize token usage relative to a model's context window — ring
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { ContextDisplaySample } from "@/components/docs/samples/context-display";
|
|
7
|
+
import { ContextDisplaySample } from "@/components/pages/docs/samples/context-display";
|
|
8
8
|
|
|
9
9
|
<ContextDisplaySample />
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: Render mention directives as inline chips in user messages.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { DirectiveTextSample } from "@/components/docs/samples/directive-text";
|
|
7
|
+
import { DirectiveTextSample } from "@/components/pages/docs/samples/directive-text";
|
|
8
8
|
|
|
9
9
|
<DirectiveTextSample />
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: Display file message parts with icon, name, size, and download butt
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { FileSample } from "@/components/docs/samples/file";
|
|
7
|
+
import { FileSample } from "@/components/pages/docs/samples/file";
|
|
8
8
|
|
|
9
9
|
<FileSample />
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ import { FileSample } from "@/components/docs/samples/file";
|
|
|
22
22
|
|
|
23
23
|
### Use in your application
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
The shipped `Thread` component renders `file` parts through `File` by default, in both assistant and user messages. In a custom thread, pass `File` to `MessagePrimitive.Parts`:
|
|
26
26
|
|
|
27
27
|
```tsx title="/components/assistant-ui/thread.tsx" {1,8}
|
|
28
28
|
import { File } from "@/components/assistant-ui/file";
|
|
@@ -4,7 +4,7 @@ description: Render runtime-generated follow-up prompt chips after an assistant
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { FollowUpSuggestionsSample } from "@/components/docs/samples/follow-up-suggestions";
|
|
7
|
+
import { FollowUpSuggestionsSample } from "@/components/pages/docs/samples/follow-up-suggestions";
|
|
8
8
|
|
|
9
9
|
<FollowUpSuggestionsSample />
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: Display image message parts with preview, loading states, and fulls
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { ImageSample } from "@/components/docs/samples/image";
|
|
7
|
+
import { ImageSample } from "@/components/pages/docs/samples/image";
|
|
8
8
|
|
|
9
9
|
<ImageSample />
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ import { ImageSample } from "@/components/docs/samples/image";
|
|
|
22
22
|
|
|
23
23
|
### Use in your application
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
The shipped `Thread` component renders `image` parts through `Image` by default, in both assistant and user messages. In a custom thread, pass `Image` to `MessagePrimitive.Parts`:
|
|
26
26
|
|
|
27
27
|
```tsx title="/components/assistant-ui/thread.tsx" {1,8}
|
|
28
28
|
import { Image } from "@/components/assistant-ui/image";
|
|
@@ -4,7 +4,12 @@ description: Display rich text with headings, lists, links, and code blocks.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { MarkdownSample } from "@/components/docs/samples/markdown";
|
|
7
|
+
import { MarkdownSample } from "@/components/pages/docs/samples/markdown";
|
|
8
|
+
import { PreviewCode } from "@/components/pages/docs/preview-code.server";
|
|
9
|
+
import { MarkdownCodeBlockSample } from "@/components/pages/docs/samples/markdown/code-block-and-copy";
|
|
10
|
+
import { MarkdownRichDocumentSample } from "@/components/pages/docs/samples/markdown/rich-document";
|
|
11
|
+
import { MarkdownStreamingSample } from "@/components/pages/docs/samples/markdown/streaming-markdown";
|
|
12
|
+
import { MarkdownGfmSample } from "@/components/pages/docs/samples/markdown/gfm-extras";
|
|
8
13
|
|
|
9
14
|
<MarkdownSample />
|
|
10
15
|
|
|
@@ -54,6 +59,40 @@ const AssistantMessage: FC = () => {
|
|
|
54
59
|
|
|
55
60
|
</Steps>
|
|
56
61
|
|
|
62
|
+
## Examples
|
|
63
|
+
|
|
64
|
+
### Code Block and Copy
|
|
65
|
+
|
|
66
|
+
Fenced code blocks get a language header and a copy button, and inline code keeps compact styling. The preview also uses [syntax highlighting](/docs/ui/syntax-highlighting), which the copied component does not include by default.
|
|
67
|
+
|
|
68
|
+
<PreviewCode file="components/pages/docs/samples/markdown/code-block-and-copy" name="MarkdownWithCode">
|
|
69
|
+
<MarkdownCodeBlockSample />
|
|
70
|
+
</PreviewCode>
|
|
71
|
+
|
|
72
|
+
### Rich Document
|
|
73
|
+
|
|
74
|
+
The renderer shows headings, emphasis, links, nested lists, a blockquote, a divider, and a table from one completed response.
|
|
75
|
+
|
|
76
|
+
<PreviewCode file="components/pages/docs/samples/markdown/rich-document" name="MarkdownDocument">
|
|
77
|
+
<MarkdownRichDocumentSample />
|
|
78
|
+
</PreviewCode>
|
|
79
|
+
|
|
80
|
+
### Streaming Markdown
|
|
81
|
+
|
|
82
|
+
Select Replay. The markdown increases in steps, and the text part shows a running status until the last chunk.
|
|
83
|
+
|
|
84
|
+
<PreviewCode file="components/pages/docs/samples/markdown/streaming-markdown" name="StreamingMarkdown">
|
|
85
|
+
<MarkdownStreamingSample />
|
|
86
|
+
</PreviewCode>
|
|
87
|
+
|
|
88
|
+
### GitHub Flavored Markdown
|
|
89
|
+
|
|
90
|
+
Task-list checkboxes, strikethrough text, a bare autolink, and an aligned table show through the built-in GFM support.
|
|
91
|
+
|
|
92
|
+
<PreviewCode file="components/pages/docs/samples/markdown/gfm-extras" name="GfmMarkdown">
|
|
93
|
+
<MarkdownGfmSample />
|
|
94
|
+
</PreviewCode>
|
|
95
|
+
|
|
57
96
|
## Syntax highlighting
|
|
58
97
|
|
|
59
98
|
Syntax Highlighting is not included by default, see [Syntax Highlighting](/docs/ui/syntax-highlighting) to learn how to add it.
|
|
@@ -4,7 +4,7 @@ description: Render Mermaid diagrams in chat messages with streaming support.
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { MermaidSample } from "@/components/docs/samples/mermaid";
|
|
7
|
+
import { MermaidSample } from "@/components/pages/docs/samples/mermaid";
|
|
8
8
|
|
|
9
9
|
<MermaidSample />
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: Display streaming performance stats — TTFT, total time, tok/s, an
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { MessageTimingSample } from "@/components/docs/samples/message-timing";
|
|
7
|
+
import { MessageTimingSample } from "@/components/pages/docs/samples/message-timing";
|
|
8
8
|
|
|
9
9
|
<MessageTimingSample />
|
|
10
10
|
|
|
@@ -4,9 +4,9 @@ description: Composable model picker with reasoning effort levels, search, and r
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { ModelSelectorSample } from "@/components/docs/samples/model-selector";
|
|
8
|
-
import * as ModelSelectorRadixSamples from "@/components/docs/samples/model-selector.radix";
|
|
9
|
-
import { Flavored, FlavorSwitcher } from "@/components/docs/contexts/flavor.server";
|
|
7
|
+
import { ModelSelectorSample } from "@/components/pages/docs/samples/model-selector";
|
|
8
|
+
import * as ModelSelectorRadixSamples from "@/components/pages/docs/samples/model-selector.radix";
|
|
9
|
+
import { Flavored, FlavorSwitcher } from "@/components/pages/docs/contexts/flavor.server";
|
|
10
10
|
|
|
11
11
|
A picker that lets users switch between AI models and choose a reasoning effort (thinking) level. It is built on Popover + Command, so search, provider grouping, and filtering compose in without being built in. The default export integrates with assistant-ui's `ModelContext` system, so the selection reaches your backend on every request with no extra wiring.
|
|
12
12
|
|
|
@@ -312,7 +312,7 @@ The default `ModelSelector` export registers the selection with assistant-ui's `
|
|
|
312
312
|
2. The `AssistantChatTransport` includes `config` in the request body of every chat request
|
|
313
313
|
3. Your API route reads `config.modelName` and `config.reasoningEffort`
|
|
314
314
|
|
|
315
|
-
This works out of the box with `@assistant-ui/
|
|
315
|
+
This works out of the box with `@assistant-ui/ai-sdk`. `ModelSelector.Root` performs no registration; it is purely presentational, with controlled and uncontrolled props for the value, effort, and open state.
|
|
316
316
|
|
|
317
317
|
## API Reference
|
|
318
318
|
|
|
@@ -4,7 +4,7 @@ description: Organize message parts into custom groups with flexible grouping fu
|
|
|
4
4
|
platforms: ["react"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { PartGroupingSample } from "@/components/docs/samples/part-grouping";
|
|
7
|
+
import { PartGroupingSample } from "@/components/pages/docs/samples/part-grouping";
|
|
8
8
|
|
|
9
9
|
<PartGroupingSample />
|
|
10
10
|
|