@assistant-ui/mcp-docs-server 0.1.7 → 0.1.8

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.
Files changed (34) hide show
  1. package/.docs/organized/code-examples/with-ai-sdk-v5.md +3 -1
  2. package/.docs/organized/code-examples/with-cloud.md +3 -1
  3. package/.docs/organized/code-examples/with-external-store.md +3 -1
  4. package/.docs/organized/code-examples/with-ffmpeg.md +3 -1
  5. package/.docs/organized/code-examples/with-langgraph.md +66 -38
  6. package/.docs/organized/code-examples/with-parent-id-grouping.md +3 -1
  7. package/.docs/organized/code-examples/with-react-hook-form.md +3 -1
  8. package/.docs/raw/docs/api-reference/integrations/react-data-stream.mdx +194 -0
  9. package/.docs/raw/docs/api-reference/overview.mdx +6 -0
  10. package/.docs/raw/docs/api-reference/primitives/Composer.mdx +31 -0
  11. package/.docs/raw/docs/api-reference/primitives/Message.mdx +108 -3
  12. package/.docs/raw/docs/api-reference/primitives/Thread.mdx +59 -0
  13. package/.docs/raw/docs/api-reference/primitives/ThreadList.mdx +128 -0
  14. package/.docs/raw/docs/api-reference/primitives/ThreadListItem.mdx +160 -0
  15. package/.docs/raw/docs/api-reference/runtimes/AssistantRuntime.mdx +0 -11
  16. package/.docs/raw/docs/api-reference/runtimes/ComposerRuntime.mdx +3 -3
  17. package/.docs/raw/docs/copilots/assistant-frame.mdx +397 -0
  18. package/.docs/raw/docs/getting-started.mdx +20 -19
  19. package/.docs/raw/docs/guides/Attachments.mdx +6 -13
  20. package/.docs/raw/docs/guides/Tools.mdx +56 -13
  21. package/.docs/raw/docs/guides/context-api.mdx +574 -0
  22. package/.docs/raw/docs/migrations/v0-12.mdx +125 -0
  23. package/.docs/raw/docs/runtimes/custom/local.mdx +16 -3
  24. package/.docs/raw/docs/runtimes/data-stream.mdx +287 -0
  25. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +5 -0
  26. package/.docs/raw/docs/ui/ThreadList.mdx +54 -16
  27. package/dist/{chunk-L4K23SWI.js → chunk-NVNFQ5ZO.js} +4 -1
  28. package/dist/index.js +1 -1
  29. package/dist/prepare-docs/prepare.js +1 -1
  30. package/dist/stdio.js +1 -1
  31. package/package.json +2 -2
  32. package/.docs/raw/docs/concepts/architecture.mdx +0 -19
  33. package/.docs/raw/docs/concepts/runtime-layer.mdx +0 -163
  34. package/.docs/raw/docs/concepts/why.mdx +0 -9
@@ -828,6 +828,7 @@ export const ToolFallback: ToolCallMessagePartComponent = ({
828
828
  "use client";
829
829
 
830
830
  import { ComponentPropsWithoutRef, forwardRef } from "react";
831
+ import { Slottable } from "@radix-ui/react-slot";
831
832
 
832
833
  import {
833
834
  Tooltip,
@@ -856,7 +857,7 @@ export const TooltipIconButton = forwardRef<
856
857
  className={cn("size-6 p-1", className)}
857
858
  ref={ref}
858
859
  >
859
- {children}
860
+ <Slottable>{children}</Slottable>
860
861
  <span className="sr-only">{tooltip}</span>
861
862
  </Button>
862
863
  </TooltipTrigger>
@@ -1175,6 +1176,7 @@ The API route at `/api/chat` uses the new `streamText` function from AI SDK v5 t
1175
1176
  "@/*": ["./*"],
1176
1177
  "@assistant-ui/*": ["../../packages/*/src"],
1177
1178
  "@assistant-ui/react/*": ["../../packages/react/src/*"],
1179
+ "@assistant-ui/tap/*": ["../../packages/tap/src/*"],
1178
1180
  "assistant-stream": ["../../packages/assistant-stream/src"],
1179
1181
  "assistant-stream/*": ["../../packages/assistant-stream/src/*"]
1180
1182
  }
@@ -870,6 +870,7 @@ const CircleStopIcon = () => {
870
870
  "use client";
871
871
 
872
872
  import { ComponentPropsWithoutRef, forwardRef } from "react";
873
+ import { Slottable } from "@radix-ui/react-slot";
873
874
 
874
875
  import {
875
876
  Tooltip,
@@ -898,7 +899,7 @@ export const TooltipIconButton = forwardRef<
898
899
  className={cn("size-6 p-1", className)}
899
900
  ref={ref}
900
901
  >
901
- {children}
902
+ <Slottable>{children}</Slottable>
902
903
  <span className="sr-only">{tooltip}</span>
903
904
  </Button>
904
905
  </TooltipTrigger>
@@ -1145,6 +1146,7 @@ export default nextConfig;
1145
1146
  "@/*": ["./*"],
1146
1147
  "@assistant-ui/*": ["../../packages/*/src"],
1147
1148
  "@assistant-ui/react/*": ["../../packages/react/src/*"],
1149
+ "@assistant-ui/tap/*": ["../../packages/tap/src/*"],
1148
1150
  "assistant-stream": ["../../packages/assistant-stream/src"],
1149
1151
  "assistant-stream/*": ["../../packages/assistant-stream/src/*"]
1150
1152
  }
@@ -782,6 +782,7 @@ const CircleStopIcon = () => {
782
782
  "use client";
783
783
 
784
784
  import { ComponentPropsWithoutRef, forwardRef } from "react";
785
+ import { Slottable } from "@radix-ui/react-slot";
785
786
 
786
787
  import {
787
788
  Tooltip,
@@ -810,7 +811,7 @@ export const TooltipIconButton = forwardRef<
810
811
  className={cn("size-6 p-1", className)}
811
812
  ref={ref}
812
813
  >
813
- {children}
814
+ <Slottable>{children}</Slottable>
814
815
  <span className="sr-only">{tooltip}</span>
815
816
  </Button>
816
817
  </TooltipTrigger>
@@ -1052,6 +1053,7 @@ export default nextConfig;
1052
1053
  "@/*": ["./*"],
1053
1054
  "@assistant-ui/*": ["../../packages/*/src"],
1054
1055
  "@assistant-ui/react/*": ["../../packages/react/src/*"],
1056
+ "@assistant-ui/tap/*": ["../../packages/tap/src/*"],
1055
1057
  "assistant-stream": ["../../packages/assistant-stream/src"],
1056
1058
  "assistant-stream/*": ["../../packages/assistant-stream/src/*"]
1057
1059
  }
@@ -991,6 +991,7 @@ const CircleStopIcon = () => {
991
991
  "use client";
992
992
 
993
993
  import { ComponentPropsWithoutRef, forwardRef } from "react";
994
+ import { Slottable } from "@radix-ui/react-slot";
994
995
 
995
996
  import {
996
997
  Tooltip,
@@ -1019,7 +1020,7 @@ export const TooltipIconButton = forwardRef<
1019
1020
  className={cn("size-6 p-1", className)}
1020
1021
  ref={ref}
1021
1022
  >
1022
- {children}
1023
+ <Slottable>{children}</Slottable>
1023
1024
  <span className="sr-only">{tooltip}</span>
1024
1025
  </Button>
1025
1026
  </TooltipTrigger>
@@ -1290,6 +1291,7 @@ export default nextConfig;
1290
1291
  "@/*": ["./*"],
1291
1292
  "@assistant-ui/*": ["../../packages/*/src"],
1292
1293
  "@assistant-ui/react/*": ["../../packages/react/src/*"],
1294
+ "@assistant-ui/tap/*": ["../../packages/tap/src/*"],
1293
1295
  "assistant-stream": ["../../packages/assistant-stream/src"],
1294
1296
  "assistant-stream/*": ["../../packages/assistant-stream/src/*"]
1295
1297
  }
@@ -1016,11 +1016,11 @@ const CircleStopIcon = () => {
1016
1016
  "use client";
1017
1017
 
1018
1018
  import { ComponentPropsWithoutRef, forwardRef } from "react";
1019
+ import { Slottable } from "@radix-ui/react-slot";
1019
1020
 
1020
1021
  import {
1021
1022
  Tooltip,
1022
1023
  TooltipContent,
1023
- TooltipProvider,
1024
1024
  TooltipTrigger,
1025
1025
  } from "@/components/ui/tooltip";
1026
1026
  import { Button } from "@/components/ui/button";
@@ -1036,23 +1036,21 @@ export const TooltipIconButton = forwardRef<
1036
1036
  TooltipIconButtonProps
1037
1037
  >(({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
1038
1038
  return (
1039
- <TooltipProvider>
1040
- <Tooltip>
1041
- <TooltipTrigger asChild>
1042
- <Button
1043
- variant="ghost"
1044
- size="icon"
1045
- {...rest}
1046
- className={cn("size-6 p-1", className)}
1047
- ref={ref}
1048
- >
1049
- {children}
1050
- <span className="sr-only">{tooltip}</span>
1051
- </Button>
1052
- </TooltipTrigger>
1053
- <TooltipContent side={side}>{tooltip}</TooltipContent>
1054
- </Tooltip>
1055
- </TooltipProvider>
1039
+ <Tooltip>
1040
+ <TooltipTrigger asChild>
1041
+ <Button
1042
+ variant="ghost"
1043
+ size="icon"
1044
+ {...rest}
1045
+ className={cn("size-6 p-1", className)}
1046
+ ref={ref}
1047
+ >
1048
+ <Slottable>{children}</Slottable>
1049
+ <span className="sr-only">{tooltip}</span>
1050
+ </Button>
1051
+ </TooltipTrigger>
1052
+ <TooltipContent side={side}>{tooltip}</TooltipContent>
1053
+ </Tooltip>
1056
1054
  );
1057
1055
  });
1058
1056
 
@@ -1560,29 +1558,58 @@ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
1560
1558
 
1561
1559
  import { cn } from "@/lib/utils";
1562
1560
 
1563
- const TooltipProvider = TooltipPrimitive.Provider;
1561
+ function TooltipProvider({
1562
+ delayDuration = 0,
1563
+ ...props
1564
+ }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
1565
+ return (
1566
+ <TooltipPrimitive.Provider
1567
+ data-slot="tooltip-provider"
1568
+ delayDuration={delayDuration}
1569
+ {...props}
1570
+ />
1571
+ );
1572
+ }
1564
1573
 
1565
- const Tooltip = TooltipPrimitive.Root;
1574
+ function Tooltip({
1575
+ ...props
1576
+ }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
1577
+ return (
1578
+ <TooltipProvider>
1579
+ <TooltipPrimitive.Root data-slot="tooltip" {...props} />
1580
+ </TooltipProvider>
1581
+ );
1582
+ }
1566
1583
 
1567
- const TooltipTrigger = TooltipPrimitive.Trigger;
1584
+ function TooltipTrigger({
1585
+ ...props
1586
+ }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
1587
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
1588
+ }
1568
1589
 
1569
- const TooltipContent = React.forwardRef<
1570
- React.ElementRef<typeof TooltipPrimitive.Content>,
1571
- React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
1572
- >(({ className, sideOffset = 4, ...props }, ref) => (
1573
- <TooltipPrimitive.Portal>
1574
- <TooltipPrimitive.Content
1575
- ref={ref}
1576
- sideOffset={sideOffset}
1577
- className={cn(
1578
- "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 origin-[--radix-tooltip-content-transform-origin] overflow-hidden rounded-md px-3 py-1.5 text-xs",
1579
- className,
1580
- )}
1581
- {...props}
1582
- />
1583
- </TooltipPrimitive.Portal>
1584
- ));
1585
- TooltipContent.displayName = TooltipPrimitive.Content.displayName;
1590
+ function TooltipContent({
1591
+ className,
1592
+ sideOffset = 0,
1593
+ children,
1594
+ ...props
1595
+ }: React.ComponentProps<typeof TooltipPrimitive.Content>) {
1596
+ return (
1597
+ <TooltipPrimitive.Portal>
1598
+ <TooltipPrimitive.Content
1599
+ data-slot="tooltip-content"
1600
+ sideOffset={sideOffset}
1601
+ className={cn(
1602
+ "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-tooltip-content-transform-origin) z-50 w-fit text-balance rounded-md px-3 py-1.5 text-xs",
1603
+ className,
1604
+ )}
1605
+ {...props}
1606
+ >
1607
+ {children}
1608
+ <TooltipPrimitive.Arrow className="bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
1609
+ </TooltipPrimitive.Content>
1610
+ </TooltipPrimitive.Portal>
1611
+ );
1612
+ }
1586
1613
 
1587
1614
  export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
1588
1615
 
@@ -1806,6 +1833,7 @@ npm run dev
1806
1833
  "@/*": ["./*"],
1807
1834
  "@assistant-ui/*": ["../../packages/*/src"],
1808
1835
  "@assistant-ui/react/*": ["../../packages/react/src/*"],
1836
+ "@assistant-ui/tap/*": ["../../packages/tap/src/*"],
1809
1837
  "assistant-stream": ["../../packages/assistant-stream/src"],
1810
1838
  "assistant-stream/*": ["../../packages/assistant-stream/src/*"]
1811
1839
  }
@@ -1028,6 +1028,7 @@ const CircleStopIcon = () => {
1028
1028
  "use client";
1029
1029
 
1030
1030
  import { ComponentPropsWithoutRef, forwardRef } from "react";
1031
+ import { Slottable } from "@radix-ui/react-slot";
1031
1032
 
1032
1033
  import {
1033
1034
  Tooltip,
@@ -1056,7 +1057,7 @@ export const TooltipIconButton = forwardRef<
1056
1057
  className={cn("size-6 p-1", className)}
1057
1058
  ref={ref}
1058
1059
  >
1059
- {children}
1060
+ <Slottable>{children}</Slottable>
1060
1061
  <span className="sr-only">{tooltip}</span>
1061
1062
  </Button>
1062
1063
  </TooltipTrigger>
@@ -1365,6 +1366,7 @@ This pattern is useful for:
1365
1366
  "@/*": ["./*"],
1366
1367
  "@assistant-ui/*": ["../../packages/*/src"],
1367
1368
  "@assistant-ui/react/*": ["../../packages/react/src/*"],
1369
+ "@assistant-ui/tap/*": ["../../packages/tap/src/*"],
1368
1370
  "assistant-stream": ["../../packages/assistant-stream/src"],
1369
1371
  "assistant-stream/*": ["../../packages/assistant-stream/src/*"]
1370
1372
  }
@@ -883,6 +883,7 @@ const CircleStopIcon = () => {
883
883
  "use client";
884
884
 
885
885
  import { ComponentPropsWithoutRef, forwardRef } from "react";
886
+ import { Slottable } from "@radix-ui/react-slot";
886
887
 
887
888
  import {
888
889
  Tooltip,
@@ -911,7 +912,7 @@ export const TooltipIconButton = forwardRef<
911
912
  className={cn("size-6 p-1", className)}
912
913
  ref={ref}
913
914
  >
914
- {children}
915
+ <Slottable>{children}</Slottable>
915
916
  <span className="sr-only">{tooltip}</span>
916
917
  </Button>
917
918
  </TooltipTrigger>
@@ -1710,6 +1711,7 @@ export default nextConfig;
1710
1711
  "@/*": ["./*"],
1711
1712
  "@assistant-ui/*": ["../../packages/*/src"],
1712
1713
  "@assistant-ui/react/*": ["../../packages/react/src/*"],
1714
+ "@assistant-ui/tap/*": ["../../packages/tap/src/*"],
1713
1715
  "assistant-stream": ["../../packages/assistant-stream/src"],
1714
1716
  "assistant-stream/*": ["../../packages/assistant-stream/src/*"]
1715
1717
  }
@@ -0,0 +1,194 @@
1
+ ---
2
+ title: "@assistant-ui/react-data-stream"
3
+ ---
4
+
5
+ Data Stream protocol integration for assistant-ui.
6
+
7
+ import { ParametersTable } from "@/components/docs";
8
+
9
+ ## API Reference
10
+
11
+ ### `useDataStreamRuntime`
12
+
13
+ Create a runtime that connects to a data stream protocol endpoint.
14
+
15
+ ```tsx
16
+ import { useDataStreamRuntime } from "@assistant-ui/react-data-stream";
17
+
18
+ const MyRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
19
+ const runtime = useDataStreamRuntime({
20
+ api: "/api/chat",
21
+ });
22
+
23
+ return (
24
+ <AssistantRuntimeProvider runtime={runtime}>
25
+ {children}
26
+ </AssistantRuntimeProvider>
27
+ );
28
+ };
29
+ ```
30
+
31
+ <ParametersTable
32
+ parameters={[
33
+ {
34
+ name: "api",
35
+ type: "string",
36
+ description: "The API endpoint URL for the data stream protocol.",
37
+ },
38
+ {
39
+ name: "onResponse",
40
+ type: "(response: Response) => void | Promise<void>",
41
+ description: "Optional callback called when a response is received.",
42
+ },
43
+ {
44
+ name: "onFinish",
45
+ type: "(message: ThreadMessage) => void",
46
+ description: "Optional callback called when a message is finished.",
47
+ },
48
+ {
49
+ name: "onError",
50
+ type: "(error: Error) => void",
51
+ description: "Optional callback called when an error occurs.",
52
+ },
53
+ {
54
+ name: "onCancel",
55
+ type: "() => void",
56
+ description: "Optional callback called when a request is cancelled.",
57
+ },
58
+ {
59
+ name: "credentials",
60
+ type: "RequestCredentials",
61
+ description: "Optional credentials mode for the fetch request.",
62
+ },
63
+ {
64
+ name: "headers",
65
+ type: "Record<string, string> | Headers | (() => Promise<Record<string, string> | Headers>)",
66
+ description: "Optional headers to include in the request.",
67
+ },
68
+ {
69
+ name: "body",
70
+ type: "object",
71
+ description: "Optional additional body parameters to include in the request.",
72
+ },
73
+ {
74
+ name: "sendExtraMessageFields",
75
+ type: "boolean",
76
+ description: "Whether to include extra message fields like IDs in the request.",
77
+ },
78
+ ]}
79
+ />
80
+
81
+ ### `useCloudRuntime`
82
+
83
+ Create a runtime that connects to Assistant Cloud using the data stream protocol.
84
+
85
+ ```tsx
86
+ import { useCloudRuntime } from "@assistant-ui/react-data-stream";
87
+
88
+ const MyRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
89
+ const runtime = useCloudRuntime({
90
+ cloud: assistantCloud,
91
+ assistantId: "my-assistant-id",
92
+ });
93
+
94
+ return (
95
+ <AssistantRuntimeProvider runtime={runtime}>
96
+ {children}
97
+ </AssistantRuntimeProvider>
98
+ );
99
+ };
100
+ ```
101
+
102
+ <ParametersTable
103
+ parameters={[
104
+ {
105
+ name: "cloud",
106
+ type: "AssistantCloud",
107
+ description: "The Assistant Cloud instance.",
108
+ },
109
+ {
110
+ name: "assistantId",
111
+ type: "string",
112
+ description: "The ID of the assistant to connect to.",
113
+ },
114
+ {
115
+ name: "onResponse",
116
+ type: "(response: Response) => void | Promise<void>",
117
+ description: "Optional callback called when a response is received.",
118
+ },
119
+ {
120
+ name: "onFinish",
121
+ type: "(message: ThreadMessage) => void",
122
+ description: "Optional callback called when a message is finished.",
123
+ },
124
+ {
125
+ name: "onError",
126
+ type: "(error: Error) => void",
127
+ description: "Optional callback called when an error occurs.",
128
+ },
129
+ {
130
+ name: "onCancel",
131
+ type: "() => void",
132
+ description: "Optional callback called when a request is cancelled.",
133
+ },
134
+ {
135
+ name: "credentials",
136
+ type: "RequestCredentials",
137
+ description: "Optional credentials mode for the fetch request.",
138
+ },
139
+ {
140
+ name: "headers",
141
+ type: "Record<string, string> | Headers | (() => Promise<Record<string, string> | Headers>)",
142
+ description: "Optional headers to include in the request.",
143
+ },
144
+ {
145
+ name: "body",
146
+ type: "object",
147
+ description: "Optional additional body parameters to include in the request.",
148
+ },
149
+ {
150
+ name: "sendExtraMessageFields",
151
+ type: "boolean",
152
+ description: "Whether to include extra message fields like IDs in the request.",
153
+ },
154
+ ]}
155
+ />
156
+
157
+ ### `toLanguageModelMessages`
158
+
159
+ Convert assistant-ui messages to language model format.
160
+
161
+ ```tsx
162
+ import { toLanguageModelMessages } from "@assistant-ui/react-data-stream";
163
+
164
+ const languageModelMessages = toLanguageModelMessages(messages, {
165
+ unstable_includeId: true,
166
+ });
167
+ ```
168
+
169
+ <ParametersTable
170
+ parameters={[
171
+ {
172
+ name: "messages",
173
+ type: "readonly ThreadMessage[]",
174
+ description: "The messages to convert.",
175
+ },
176
+ {
177
+ name: "options",
178
+ type: "{ unstable_includeId?: boolean }",
179
+ description: "Optional conversion options.",
180
+ children: [
181
+ {
182
+ type: "{ unstable_includeId?: boolean }",
183
+ parameters: [
184
+ {
185
+ name: "unstable_includeId",
186
+ type: "boolean",
187
+ description: "Whether to include message IDs in the converted messages.",
188
+ },
189
+ ],
190
+ },
191
+ ],
192
+ },
193
+ ]}
194
+ />
@@ -31,6 +31,12 @@ export const contextColors = {
31
31
  - [`useChatRuntime`](#use-chat-runtime)
32
32
  - [`useAISDKRuntime`](#use-aisdk-runtime)
33
33
 
34
+ ### Data Stream
35
+
36
+ - [`useDataStreamRuntime`](#use-data-stream-runtime)
37
+ - [`useCloudRuntime`](#use-cloud-runtime)
38
+ - [`toLanguageModelMessages`](#to-language-model-messages)
39
+
34
40
  ### LangGraph
35
41
 
36
42
  - [`useLangGraphRuntime`](#use-lang-graph-runtime)
@@ -168,6 +168,37 @@ Renders attachments. This primitive renders a separate component for each attach
168
168
  ]}
169
169
  />
170
170
 
171
+ ### AttachmentByIndex
172
+
173
+ Renders a single attachment at the specified index within the composer.
174
+
175
+ ```tsx
176
+ <ComposerPrimitive.AttachmentByIndex
177
+ index={0}
178
+ components={{
179
+ Image: MyImageAttachment,
180
+ Document: MyDocumentAttachment
181
+ }}
182
+ />
183
+ ```
184
+
185
+ <ParametersTable
186
+ type="ComposerPrimitive.AttachmentByIndex.Props"
187
+ parameters={[
188
+ {
189
+ name: "index",
190
+ type: "number",
191
+ required: true,
192
+ description: "The index of the attachment to render.",
193
+ },
194
+ {
195
+ name: "components",
196
+ type: "ComposerAttachmentsComponents",
197
+ description: "The components to render for the attachment.",
198
+ },
199
+ ]}
200
+ />
201
+
171
202
  ### AddAttachment
172
203
 
173
204
  Renders a button to add an attachment.
@@ -13,7 +13,7 @@ import { MessagePrimitive } from "@assistant-ui/react";
13
13
 
14
14
  const UserMessage = () => (
15
15
  <MessagePrimitive.Root>
16
- User: <MessagePrimitive.Content />
16
+ User: <MessagePrimitive.Parts />
17
17
  <BranchPicker />
18
18
  <ActionBar />
19
19
  </MessagePrimitive.Root>
@@ -21,7 +21,7 @@ const UserMessage = () => (
21
21
 
22
22
  const AssistantMessage = () => (
23
23
  <MessagePrimitive.Root>
24
- Assistant: <MessagePrimitive.Content />
24
+ Assistant: <MessagePrimitive.Parts />
25
25
  <BranchPicker />
26
26
  <ActionBar />
27
27
  </MessagePrimitive.Root>
@@ -45,7 +45,7 @@ This primitive renders a `<div>` element unless `asChild` is set.
45
45
  ]}
46
46
  />
47
47
 
48
- ### Content
48
+ ### Parts
49
49
 
50
50
  The content of the message. This renders a separate component for each content part of the message.
51
51
 
@@ -154,6 +154,111 @@ The content of the message. This renders a separate component for each content p
154
154
  ]}
155
155
  />
156
156
 
157
+ ### PartByIndex
158
+
159
+ Renders a single message part at the specified index.
160
+
161
+ ```tsx
162
+ <MessagePrimitive.PartByIndex
163
+ index={0}
164
+ components={{
165
+ Text: MyTextComponent,
166
+ Image: MyImageComponent
167
+ }}
168
+ />
169
+ ```
170
+
171
+ <ParametersTable
172
+ type="MessagePrimitive.PartByIndex.Props"
173
+ parameters={[
174
+ {
175
+ name: "index",
176
+ type: "number",
177
+ required: true,
178
+ description: "The index of the message part to render.",
179
+ },
180
+ {
181
+ name: "components",
182
+ required: false,
183
+ type: "ContentPartComponents",
184
+ description: "The components to render for the message part.",
185
+ },
186
+ ]}
187
+ />
188
+
189
+ ### Attachments
190
+
191
+ Renders all attachments of the message.
192
+
193
+ <ParametersTable
194
+ type="MessagePrimitive.Attachments.Props"
195
+ parameters={[
196
+ {
197
+ name: "components",
198
+ type: "AttachmentComponents",
199
+ description: "The components to render for each attachment.",
200
+ children: [
201
+ {
202
+ type: "AttachmentComponents",
203
+ parameters: [
204
+ {
205
+ name: "Image",
206
+ type: "ComponentType",
207
+ description: "The component to render for image attachments.",
208
+ },
209
+ {
210
+ name: "Document",
211
+ type: "ComponentType",
212
+ description: "The component to render for document attachments.",
213
+ },
214
+ {
215
+ name: "File",
216
+ type: "ComponentType",
217
+ description: "The component to render for file attachments.",
218
+ },
219
+ {
220
+ name: "Attachment",
221
+ type: "ComponentType",
222
+ description: "The fallback component to render for any attachment type.",
223
+ },
224
+ ],
225
+ },
226
+ ],
227
+ },
228
+ ]}
229
+ />
230
+
231
+ ### AttachmentByIndex
232
+
233
+ Renders a single attachment at the specified index within the message.
234
+
235
+ ```tsx
236
+ <MessagePrimitive.AttachmentByIndex
237
+ index={0}
238
+ components={{
239
+ Image: MyImageAttachment,
240
+ Document: MyDocumentAttachment
241
+ }}
242
+ />
243
+ ```
244
+
245
+ <ParametersTable
246
+ type="MessagePrimitive.AttachmentByIndex.Props"
247
+ parameters={[
248
+ {
249
+ name: "index",
250
+ type: "number",
251
+ required: true,
252
+ description: "The index of the attachment to render.",
253
+ },
254
+ {
255
+ name: "components",
256
+ type: "AttachmentComponents",
257
+ description: "The components to render for the attachment.",
258
+ },
259
+ ]}
260
+ />
261
+
157
262
  ### If
158
263
 
159
264
  Renders children if a condition is met.