@assistant-ui/mcp-docs-server 0.1.3 → 0.1.4
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/local-ollama.md +7 -7
- package/.docs/organized/code-examples/search-agent-for-e-commerce.md +9 -9
- package/.docs/organized/code-examples/with-ai-sdk.md +7 -7
- package/.docs/organized/code-examples/with-cloud.md +7 -7
- package/.docs/organized/code-examples/with-external-store.md +6 -6
- package/.docs/organized/code-examples/with-ffmpeg.md +10 -10
- package/.docs/organized/code-examples/with-langgraph.md +10 -10
- package/.docs/organized/code-examples/with-openai-assistants.md +7 -7
- package/.docs/organized/code-examples/with-react-hook-form.md +10 -10
- package/.docs/organized/code-examples/with-vercel-ai-rsc.md +7 -7
- package/.docs/raw/docs/api-reference/context-providers/{TextContentPartProvider.mdx → TextMessagePartProvider.mdx} +3 -3
- package/.docs/raw/docs/api-reference/integrations/react-hook-form.mdx +2 -2
- package/.docs/raw/docs/api-reference/overview.mdx +23 -23
- package/.docs/raw/docs/api-reference/primitives/Error.mdx +5 -3
- package/.docs/raw/docs/api-reference/primitives/Message.mdx +32 -0
- package/.docs/raw/docs/api-reference/primitives/{ContentPart.mdx → MessagePart.mdx} +41 -41
- package/.docs/raw/docs/api-reference/runtimes/MessagePartRuntime.mdx +22 -0
- package/.docs/raw/docs/api-reference/runtimes/ThreadListRuntime.mdx +1 -0
- package/.docs/raw/docs/api-reference/runtimes/ThreadRuntime.mdx +1 -0
- package/.docs/raw/docs/concepts/runtime-layer.mdx +7 -7
- package/.docs/raw/docs/copilots/make-assistant-tool-ui.mdx +22 -13
- package/.docs/raw/docs/copilots/make-assistant-tool.mdx +20 -14
- package/.docs/raw/docs/getting-started.mdx +11 -10
- package/.docs/raw/docs/guides/Attachments.mdx +24 -21
- package/.docs/raw/docs/guides/ToolUI.mdx +45 -8
- package/.docs/raw/docs/migrations/v0-11.mdx +169 -0
- package/.docs/raw/docs/migrations/v0-7.mdx +8 -8
- package/.docs/raw/docs/migrations/v0-8.mdx +14 -14
- package/.docs/raw/docs/migrations/v0-9.mdx +3 -3
- package/.docs/raw/docs/runtimes/ai-sdk/rsc.mdx +2 -2
- package/.docs/raw/docs/runtimes/ai-sdk/use-assistant-hook.mdx +1 -1
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat-hook.mdx +2 -2
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +2 -2
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +5 -5
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +2 -2
- package/.docs/raw/docs/ui/Attachment.mdx +5 -2
- package/.docs/raw/docs/ui/Markdown.mdx +2 -3
- package/.docs/raw/docs/ui/ToolFallback.mdx +2 -2
- package/package.json +5 -5
- package/.docs/raw/docs/api-reference/runtimes/ContentPartRuntime.mdx +0 -22
|
@@ -30,7 +30,8 @@ Contains all parts of the error display. Renders a `<div>` element with `role="a
|
|
|
30
30
|
{
|
|
31
31
|
name: "asChild",
|
|
32
32
|
type: "boolean",
|
|
33
|
-
description:
|
|
33
|
+
description:
|
|
34
|
+
"Change the component to the HTML tag or custom component of the only child.",
|
|
34
35
|
},
|
|
35
36
|
]}
|
|
36
37
|
/>
|
|
@@ -45,7 +46,8 @@ Displays the error message. By default, it shows the error from the message cont
|
|
|
45
46
|
{
|
|
46
47
|
name: "children",
|
|
47
48
|
type: "ReactNode",
|
|
48
|
-
description:
|
|
49
|
+
description:
|
|
50
|
+
"Optional custom content to display instead of the default error message.",
|
|
49
51
|
},
|
|
50
52
|
]}
|
|
51
53
|
/>
|
|
@@ -59,7 +61,7 @@ import { MessagePrimitive, ErrorPrimitive } from "@assistant-ui/react";
|
|
|
59
61
|
|
|
60
62
|
const MessageWithError = () => (
|
|
61
63
|
<MessagePrimitive.Root>
|
|
62
|
-
<MessagePrimitive.
|
|
64
|
+
<MessagePrimitive.Parts />
|
|
63
65
|
<MessagePrimitive.Error>
|
|
64
66
|
<ErrorPrimitive.Root>
|
|
65
67
|
<ErrorPrimitive.Message />
|
|
@@ -115,6 +115,38 @@ The content of the message. This renders a separate component for each content p
|
|
|
115
115
|
},
|
|
116
116
|
],
|
|
117
117
|
},
|
|
118
|
+
{
|
|
119
|
+
name: "ToolGroup",
|
|
120
|
+
type: "ComponentType<PropsWithChildren<{ startIndex: number; endIndex: number }>>",
|
|
121
|
+
description:
|
|
122
|
+
"Component for rendering grouped consecutive tool calls. When provided, consecutive tool-call content parts will be automatically grouped and wrapped with this component.",
|
|
123
|
+
children: [
|
|
124
|
+
{
|
|
125
|
+
type: "ToolGroupProps",
|
|
126
|
+
parameters: [
|
|
127
|
+
{
|
|
128
|
+
name: "startIndex",
|
|
129
|
+
type: "number",
|
|
130
|
+
description: "Index of the first tool call in the group.",
|
|
131
|
+
required: true,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: "endIndex",
|
|
135
|
+
type: "number",
|
|
136
|
+
description: "Index of the last tool call in the group.",
|
|
137
|
+
required: true,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "children",
|
|
141
|
+
type: "ReactNode",
|
|
142
|
+
description:
|
|
143
|
+
"The rendered tool call components within the group.",
|
|
144
|
+
required: true,
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
},
|
|
118
150
|
],
|
|
119
151
|
},
|
|
120
152
|
],
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description: A part of a message's content.
|
|
2
|
+
title: MessagePartPrimitive
|
|
3
|
+
description: A part of a message's content. Message parts may be text, image, tool call or UI elements.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
import { ParametersTable } from "@/components/docs";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
MessagePartRuntime,
|
|
9
|
+
TextMessagePartState,
|
|
10
|
+
AudioMessagePartState,
|
|
11
|
+
ToolCallMessagePartState,
|
|
12
12
|
} from "@/generated/typeDocs";
|
|
13
13
|
|
|
14
|
-
Each message can have any number of
|
|
15
|
-
|
|
14
|
+
Each message can have any number of message parts.
|
|
15
|
+
Message parts are usually one of text, reasoning, audio or tool-call.
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Message part Types
|
|
18
18
|
|
|
19
19
|
### Text
|
|
20
20
|
|
|
@@ -35,10 +35,10 @@ Interactive elements that represent tool operations.
|
|
|
35
35
|
## Anatomy
|
|
36
36
|
|
|
37
37
|
```tsx
|
|
38
|
-
import {
|
|
38
|
+
import { MessagePartPrimitive } from "@assistant-ui/react";
|
|
39
39
|
|
|
40
|
-
const
|
|
41
|
-
return <
|
|
40
|
+
const TextMessagePart = () => {
|
|
41
|
+
return <MessagePartPrimitive.Text />;
|
|
42
42
|
};
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -47,9 +47,9 @@ const TextContentPart = () => {
|
|
|
47
47
|
### Plain Text
|
|
48
48
|
|
|
49
49
|
```tsx
|
|
50
|
-
import {
|
|
50
|
+
import { MessagePartPrimitive } from "@assistant/react";
|
|
51
51
|
|
|
52
|
-
<
|
|
52
|
+
<MessagePartPrimitive.Text />;
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
### Markdown Text
|
|
@@ -68,14 +68,14 @@ Coming soon.
|
|
|
68
68
|
|
|
69
69
|
### InProgress
|
|
70
70
|
|
|
71
|
-
Renders children only if the
|
|
71
|
+
Renders children only if the message part is in progress.
|
|
72
72
|
|
|
73
73
|
```tsx
|
|
74
|
-
import {
|
|
74
|
+
import { MessagePartPrimitive } from "@assistant/react";
|
|
75
75
|
|
|
76
|
-
<
|
|
76
|
+
<MessagePartPrimitive.InProgress>
|
|
77
77
|
<LoadingIndicator />
|
|
78
|
-
</
|
|
78
|
+
</MessagePartPrimitive.InProgress>;
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
### Tool UI
|
|
@@ -104,14 +104,14 @@ const MyWeatherToolUI = makeAssistantToolUI({
|
|
|
104
104
|
|
|
105
105
|
## Context Provider
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
Message part context is provided by `MessagePrimitive.Parts` or `TextMessagePartProvider`
|
|
108
108
|
|
|
109
|
-
### MessagePrimitive.
|
|
109
|
+
### MessagePrimitive.Parts
|
|
110
110
|
|
|
111
111
|
```tsx
|
|
112
112
|
import { MessagePrimitive } from "@assistant/react";
|
|
113
113
|
|
|
114
|
-
<MessagePrimitive.
|
|
114
|
+
<MessagePrimitive.Parts
|
|
115
115
|
components={{
|
|
116
116
|
Text: MyText,
|
|
117
117
|
Reasoning: MyReasoning,
|
|
@@ -126,48 +126,48 @@ import { MessagePrimitive } from "@assistant/react";
|
|
|
126
126
|
/>;
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
###
|
|
129
|
+
### TextMessagePartProvider
|
|
130
130
|
|
|
131
|
-
This is a helper context provider to allow you to reuse the
|
|
131
|
+
This is a helper context provider to allow you to reuse the message part components outside a message message part.
|
|
132
132
|
|
|
133
133
|
```tsx
|
|
134
|
-
import {
|
|
134
|
+
import { TextMessagePartProvider } from "@assistant-ui/react";
|
|
135
135
|
|
|
136
|
-
<
|
|
137
|
-
<
|
|
138
|
-
</
|
|
136
|
+
<TextMessagePartProvider text="Hello world" isRunning={false}>
|
|
137
|
+
<MessagePart.Text />
|
|
138
|
+
</TextMessagePartProvider>;
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
## Runtime API
|
|
142
142
|
|
|
143
|
-
### `
|
|
143
|
+
### `useMessagePartRuntime`
|
|
144
144
|
|
|
145
145
|
```tsx
|
|
146
|
-
import {
|
|
146
|
+
import { useMessagePartRuntime } from "@assistant-ui/react";
|
|
147
147
|
|
|
148
|
-
const
|
|
148
|
+
const MessagePartRuntime = useMessagePartRuntime();
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
<ParametersTable {...
|
|
151
|
+
<ParametersTable {...MessagePartRuntime} />
|
|
152
152
|
|
|
153
|
-
### `
|
|
153
|
+
### `useMessagePart`
|
|
154
154
|
|
|
155
155
|
```tsx
|
|
156
|
-
import {
|
|
156
|
+
import { useMessagePart } from "@assistant-ui/react";
|
|
157
157
|
|
|
158
|
-
const
|
|
158
|
+
const MessagePart = useMessagePart();
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
<ParametersTable {...
|
|
162
|
-
<ParametersTable {...
|
|
163
|
-
<ParametersTable {...
|
|
161
|
+
<ParametersTable {...TextMessagePartState} />
|
|
162
|
+
<ParametersTable {...AudioMessagePartState} />
|
|
163
|
+
<ParametersTable {...ToolCallMessagePartState} />
|
|
164
164
|
|
|
165
|
-
### `
|
|
165
|
+
### `useMessagePartText`
|
|
166
166
|
|
|
167
167
|
```tsx
|
|
168
|
-
import {
|
|
168
|
+
import { useMessagePartText } from "@assistant-ui/react";
|
|
169
169
|
|
|
170
|
-
const
|
|
170
|
+
const MessagePartText = useMessagePartText();
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
-
<ParametersTable {...
|
|
173
|
+
<ParametersTable {...TextMessagePartState} />
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MessagePartRuntime
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
import { ParametersTable } from "@/components/docs";
|
|
6
|
+
import { MessagePartState } from "@/components/docs/parameters/context";
|
|
7
|
+
|
|
8
|
+
### `useMessagePart`
|
|
9
|
+
|
|
10
|
+
Access the message part state:
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import { useMessagePart } from "@assistant-ui/react";
|
|
14
|
+
|
|
15
|
+
const part = useMessagePart();
|
|
16
|
+
const partState = useMessagePart.getState();
|
|
17
|
+
|
|
18
|
+
const status = useMessagePart((m) => m.status);
|
|
19
|
+
const statusAgain = useMessagePart.getState().status;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
<ParametersTable {...MessagePartState} />
|
|
@@ -66,7 +66,7 @@ import { File, Folder, Files } from "fumadocs-ui/components/files";
|
|
|
66
66
|
<Folder name="ThreadRuntime" defaultOpen>
|
|
67
67
|
<Folder name="MessageRuntime" defaultOpen>
|
|
68
68
|
<Folder
|
|
69
|
-
name="
|
|
69
|
+
name="MessagePartRuntime (Text / Reasoning / Image / Audio / Tool-Call / UI)"
|
|
70
70
|
defaultOpen
|
|
71
71
|
></Folder>
|
|
72
72
|
<Folder name="MessageAttachmentRuntime" defaultOpen></Folder>
|
|
@@ -95,8 +95,8 @@ The following components provide the runtime APIs:
|
|
|
95
95
|
// renders every message, provides MessageRuntime, ComposerRuntime (EditComposer)
|
|
96
96
|
<ThreadPrimitive.Messages components={{ Message, ... }} />
|
|
97
97
|
|
|
98
|
-
// renders every
|
|
99
|
-
<MessagePrimitive.
|
|
98
|
+
// renders every message part, provides MessagePartRuntime
|
|
99
|
+
<MessagePrimitive.Parts components={{ Text, Reasoning, Image, Audio, UI, tools }} />
|
|
100
100
|
|
|
101
101
|
// renders every attachment, provides AttachmentRuntime (Thread or EditComposer)
|
|
102
102
|
<ComposerPrimitive.Attachments components={{ Attachment, ... }} />
|
|
@@ -104,8 +104,8 @@ The following components provide the runtime APIs:
|
|
|
104
104
|
// renders every attachment, provides AtatchmentRuntime (Message)
|
|
105
105
|
<MessagePrimitive.Attachments components={{ Attachment, ... }} />
|
|
106
106
|
|
|
107
|
-
// provides a custom
|
|
108
|
-
<
|
|
107
|
+
// provides a custom TextMessagePartRuntime
|
|
108
|
+
<TextMessagePartProvider text="Hello!" />
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
### Accessing runtime APIs
|
|
@@ -116,7 +116,7 @@ You can access the runtime APIs with react hooks:
|
|
|
116
116
|
const runtime = useAssistantRuntime();
|
|
117
117
|
const threadRuntime = useThreadRuntime();
|
|
118
118
|
const messageRuntime = useMessageRuntime();
|
|
119
|
-
const
|
|
119
|
+
const MessagePartRuntime = useMessagePartRuntime();
|
|
120
120
|
|
|
121
121
|
// thread manager has no separate hook (1:1 relationship with assistant runtime)
|
|
122
122
|
const ThreadListRuntime = useAssistantRuntime().threads;
|
|
@@ -145,7 +145,7 @@ Most runtimes also expose a state through two methods `getState` and `subscribe`
|
|
|
145
145
|
useThreadList(); // get thread manager state
|
|
146
146
|
useThread(); // get thread state
|
|
147
147
|
useMessage(); // get message state
|
|
148
|
-
|
|
148
|
+
useMessagePart(); // get message part state
|
|
149
149
|
useComposer(); // get composer state
|
|
150
150
|
useThreadComposer(); // get thread composer state
|
|
151
151
|
useEditComposer(); // get edit composer state
|
|
@@ -29,21 +29,23 @@ const MyToolUI = makeAssistantToolUI({
|
|
|
29
29
|
{
|
|
30
30
|
name: "toolName",
|
|
31
31
|
type: "string",
|
|
32
|
-
description:
|
|
32
|
+
description:
|
|
33
|
+
"The name of the tool. This must match the name of the tool defined in the assistant.",
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
36
|
name: "render",
|
|
36
|
-
type: "ComponentType<
|
|
37
|
-
description:
|
|
37
|
+
type: "ComponentType<ToolCallMessagePartProps<TArgs, TResult>>",
|
|
38
|
+
description:
|
|
39
|
+
"A React component that renders the tool UI. Receives the following props:",
|
|
38
40
|
required: true,
|
|
39
41
|
children: [
|
|
40
42
|
{
|
|
41
|
-
type: "
|
|
43
|
+
type: "ToolCallMessagePartProps<TArgs, TResult>",
|
|
42
44
|
parameters: [
|
|
43
45
|
{
|
|
44
46
|
name: "type",
|
|
45
|
-
type: "
|
|
46
|
-
description: "The
|
|
47
|
+
type: '"tool-call"',
|
|
48
|
+
description: "The message part type",
|
|
47
49
|
},
|
|
48
50
|
{
|
|
49
51
|
name: "toolCallId",
|
|
@@ -77,18 +79,21 @@ const MyToolUI = makeAssistantToolUI({
|
|
|
77
79
|
},
|
|
78
80
|
{
|
|
79
81
|
name: "status",
|
|
80
|
-
type: "
|
|
81
|
-
description:
|
|
82
|
+
type: "ToolCallMessagePartStatus",
|
|
83
|
+
description:
|
|
84
|
+
'The execution status object with a type property: "running", "complete", "incomplete", or "requires_action"',
|
|
82
85
|
},
|
|
83
86
|
{
|
|
84
87
|
name: "addResult",
|
|
85
88
|
type: "(result: TResult | ToolResponse<TResult>) => void",
|
|
86
|
-
description:
|
|
89
|
+
description:
|
|
90
|
+
"Function to add a result (useful for human-in-the-loop tools)",
|
|
87
91
|
},
|
|
88
92
|
{
|
|
89
93
|
name: "artifact",
|
|
90
94
|
type: "unknown",
|
|
91
|
-
description:
|
|
95
|
+
description:
|
|
96
|
+
"Optional artifact data associated with the tool call",
|
|
92
97
|
},
|
|
93
98
|
],
|
|
94
99
|
},
|
|
@@ -110,10 +115,13 @@ import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
|
110
115
|
const GetWeatherUI = makeAssistantToolUI({
|
|
111
116
|
toolName: "get_weather",
|
|
112
117
|
render: ({ args, result, status }) => {
|
|
113
|
-
if (status.type === "requires_action")
|
|
118
|
+
if (status.type === "requires_action")
|
|
119
|
+
return <p>Getting weather for {args.location}...</p>;
|
|
114
120
|
if (status.type === "running") return <p>Loading...</p>;
|
|
115
|
-
if (status.type === "incomplete" && status.reason === "error")
|
|
116
|
-
|
|
121
|
+
if (status.type === "incomplete" && status.reason === "error")
|
|
122
|
+
return <p>Error getting weather.</p>;
|
|
123
|
+
if (status.type === "complete")
|
|
124
|
+
return <p>The weather is {result.weather}.</p>;
|
|
117
125
|
return null;
|
|
118
126
|
},
|
|
119
127
|
});
|
|
@@ -127,4 +135,5 @@ function App() {
|
|
|
127
135
|
);
|
|
128
136
|
}
|
|
129
137
|
```
|
|
138
|
+
|
|
130
139
|
This example shows how to create a simple UI for a `get_weather` tool. The UI will display different messages depending on the status of the tool execution.
|
|
@@ -27,7 +27,7 @@ const submitForm = tool({
|
|
|
27
27
|
// Create a tool component
|
|
28
28
|
const SubmitFormTool = makeAssistantTool({
|
|
29
29
|
...submitForm,
|
|
30
|
-
toolName: "submitForm"
|
|
30
|
+
toolName: "submitForm",
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
// Use in your component
|
|
@@ -57,13 +57,15 @@ function Form() {
|
|
|
57
57
|
{
|
|
58
58
|
name: "parameters",
|
|
59
59
|
type: "StandardSchemaV1<TArgs> | JSONSchema7",
|
|
60
|
-
description:
|
|
60
|
+
description:
|
|
61
|
+
"Schema defining the tool's parameters (typically a Zod schema)",
|
|
61
62
|
required: true,
|
|
62
63
|
},
|
|
63
64
|
{
|
|
64
65
|
name: "execute",
|
|
65
66
|
type: "(args: TArgs, context: ToolExecutionContext) => TResult | Promise<TResult>",
|
|
66
|
-
description:
|
|
67
|
+
description:
|
|
68
|
+
"Function that implements the tool's behavior (required for frontend tools)",
|
|
67
69
|
required: true,
|
|
68
70
|
},
|
|
69
71
|
{
|
|
@@ -73,16 +75,17 @@ function Form() {
|
|
|
73
75
|
},
|
|
74
76
|
{
|
|
75
77
|
name: "render",
|
|
76
|
-
type: "ComponentType<
|
|
77
|
-
description:
|
|
78
|
+
type: "ComponentType<ToolCallMessagePartProps<TArgs, TResult>>",
|
|
79
|
+
description:
|
|
80
|
+
"Optional custom UI component for rendering the tool execution. Receives the following props:",
|
|
78
81
|
children: [
|
|
79
82
|
{
|
|
80
|
-
type: "
|
|
83
|
+
type: "ToolCallMessagePartProps<TArgs, TResult>",
|
|
81
84
|
parameters: [
|
|
82
85
|
{
|
|
83
86
|
name: "type",
|
|
84
|
-
type: "
|
|
85
|
-
description: "The
|
|
87
|
+
type: '"tool-call"',
|
|
88
|
+
description: "The message part type",
|
|
86
89
|
},
|
|
87
90
|
{
|
|
88
91
|
name: "toolCallId",
|
|
@@ -116,18 +119,21 @@ function Form() {
|
|
|
116
119
|
},
|
|
117
120
|
{
|
|
118
121
|
name: "status",
|
|
119
|
-
type: "
|
|
120
|
-
description:
|
|
122
|
+
type: "ToolCallMessagePartStatus",
|
|
123
|
+
description:
|
|
124
|
+
'The execution status object with a type property: "running", "complete", "incomplete", or "requires_action"',
|
|
121
125
|
},
|
|
122
126
|
{
|
|
123
127
|
name: "addResult",
|
|
124
128
|
type: "(result: TResult | ToolResponse<TResult>) => void",
|
|
125
|
-
description:
|
|
129
|
+
description:
|
|
130
|
+
"Function to add a result (useful for human-in-the-loop tools)",
|
|
126
131
|
},
|
|
127
132
|
{
|
|
128
133
|
name: "artifact",
|
|
129
134
|
type: "unknown",
|
|
130
|
-
description:
|
|
135
|
+
description:
|
|
136
|
+
"Optional artifact data associated with the tool call",
|
|
131
137
|
},
|
|
132
138
|
],
|
|
133
139
|
},
|
|
@@ -176,11 +182,11 @@ const sendEmail = tool({
|
|
|
176
182
|
// Create tool components
|
|
177
183
|
const EmailValidator = makeAssistantTool({
|
|
178
184
|
...validateEmail,
|
|
179
|
-
toolName: "validateEmail"
|
|
185
|
+
toolName: "validateEmail",
|
|
180
186
|
});
|
|
181
187
|
const EmailSender = makeAssistantTool({
|
|
182
188
|
...sendEmail,
|
|
183
|
-
toolName: "sendEmail"
|
|
189
|
+
toolName: "sendEmail",
|
|
184
190
|
});
|
|
185
191
|
|
|
186
192
|
// Use together
|
|
@@ -15,6 +15,7 @@ import { Card, Cards } from "fumadocs-ui/components/card";
|
|
|
15
15
|
<Step>
|
|
16
16
|
|
|
17
17
|
### Initialize assistant-ui
|
|
18
|
+
|
|
18
19
|
**Create a new project:**
|
|
19
20
|
|
|
20
21
|
```sh
|
|
@@ -349,7 +350,7 @@ const UserMessage: FC = () => {
|
|
|
349
350
|
<UserActionBar />
|
|
350
351
|
|
|
351
352
|
<div className="aui-user-message-content">
|
|
352
|
-
<MessagePrimitive.
|
|
353
|
+
<MessagePrimitive.Parts />
|
|
353
354
|
</div>
|
|
354
355
|
|
|
355
356
|
<BranchPicker className="aui-user-branch-picker" />
|
|
@@ -394,7 +395,7 @@ const AssistantMessage: FC = () => {
|
|
|
394
395
|
return (
|
|
395
396
|
<MessagePrimitive.Root className="aui-assistant-message-root">
|
|
396
397
|
<div className="aui-assistant-message-content">
|
|
397
|
-
<MessagePrimitive.
|
|
398
|
+
<MessagePrimitive.Parts components={{ Text: MarkdownText }} />
|
|
398
399
|
</div>
|
|
399
400
|
|
|
400
401
|
<AssistantActionBar />
|
|
@@ -1110,23 +1111,23 @@ const MyApp = () => {
|
|
|
1110
1111
|
## What's Next?
|
|
1111
1112
|
|
|
1112
1113
|
<Cards>
|
|
1113
|
-
<Card
|
|
1114
|
-
title="Pick a Runtime"
|
|
1114
|
+
<Card
|
|
1115
|
+
title="Pick a Runtime"
|
|
1115
1116
|
description="Choose the right runtime for your needs"
|
|
1116
1117
|
href="/docs/runtimes/pick-a-runtime"
|
|
1117
1118
|
/>
|
|
1118
|
-
<Card
|
|
1119
|
-
title="Generative UI"
|
|
1119
|
+
<Card
|
|
1120
|
+
title="Generative UI"
|
|
1120
1121
|
description="Create rich UI components for tool executions"
|
|
1121
1122
|
href="/docs/guides/ToolUI"
|
|
1122
1123
|
/>
|
|
1123
|
-
<Card
|
|
1124
|
-
title="Add Persistence"
|
|
1124
|
+
<Card
|
|
1125
|
+
title="Add Persistence"
|
|
1125
1126
|
description="Save and restore chat conversations"
|
|
1126
1127
|
href="/docs/cloud/overview"
|
|
1127
1128
|
/>
|
|
1128
|
-
<Card
|
|
1129
|
-
title="Examples"
|
|
1129
|
+
<Card
|
|
1130
|
+
title="Examples"
|
|
1130
1131
|
description="Explore full implementations and demos"
|
|
1131
1132
|
href="https://github.com/assistant-ui/assistant-ui/tree/main/examples"
|
|
1132
1133
|
/>
|