@assistant-ui/mcp-docs-server 0.1.3 → 0.1.5

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 (48) hide show
  1. package/.docs/organized/code-examples/local-ollama.md +13 -13
  2. package/.docs/organized/code-examples/search-agent-for-e-commerce.md +18 -18
  3. package/.docs/organized/code-examples/{with-vercel-ai-rsc.md → with-ai-sdk-v5.md} +225 -230
  4. package/.docs/organized/code-examples/with-ai-sdk.md +13 -13
  5. package/.docs/organized/code-examples/with-cloud.md +12 -12
  6. package/.docs/organized/code-examples/with-external-store.md +9 -9
  7. package/.docs/organized/code-examples/with-ffmpeg.md +19 -19
  8. package/.docs/organized/code-examples/with-langgraph.md +14 -14
  9. package/.docs/organized/code-examples/with-openai-assistants.md +12 -12
  10. package/.docs/organized/code-examples/with-parent-id-grouping.md +1374 -0
  11. package/.docs/organized/code-examples/with-react-hook-form.md +18 -18
  12. package/.docs/raw/docs/about-assistantui.mdx +9 -0
  13. package/.docs/raw/docs/api-reference/context-providers/{TextContentPartProvider.mdx → TextMessagePartProvider.mdx} +3 -3
  14. package/.docs/raw/docs/api-reference/integrations/react-hook-form.mdx +2 -2
  15. package/.docs/raw/docs/api-reference/overview.mdx +23 -23
  16. package/.docs/raw/docs/api-reference/primitives/Error.mdx +5 -3
  17. package/.docs/raw/docs/api-reference/primitives/Message.mdx +32 -0
  18. package/.docs/raw/docs/api-reference/primitives/{ContentPart.mdx → MessagePart.mdx} +41 -41
  19. package/.docs/raw/docs/api-reference/runtimes/MessagePartRuntime.mdx +22 -0
  20. package/.docs/raw/docs/api-reference/runtimes/ThreadListRuntime.mdx +1 -0
  21. package/.docs/raw/docs/api-reference/runtimes/ThreadRuntime.mdx +1 -0
  22. package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +89 -32
  23. package/.docs/raw/docs/cloud/persistence/langgraph.mdx +187 -32
  24. package/.docs/raw/docs/concepts/runtime-layer.mdx +7 -7
  25. package/.docs/raw/docs/copilots/make-assistant-tool-ui.mdx +22 -13
  26. package/.docs/raw/docs/copilots/make-assistant-tool.mdx +20 -14
  27. package/.docs/raw/docs/getting-started.mdx +11 -10
  28. package/.docs/raw/docs/guides/Attachments.mdx +24 -21
  29. package/.docs/raw/docs/guides/Latex.mdx +81 -0
  30. package/.docs/raw/docs/guides/ToolUI.mdx +13 -8
  31. package/.docs/raw/docs/migrations/v0-11.mdx +169 -0
  32. package/.docs/raw/docs/migrations/v0-7.mdx +8 -8
  33. package/.docs/raw/docs/migrations/v0-8.mdx +14 -14
  34. package/.docs/raw/docs/migrations/v0-9.mdx +3 -3
  35. package/.docs/raw/docs/runtimes/ai-sdk/rsc.mdx +2 -2
  36. package/.docs/raw/docs/runtimes/ai-sdk/use-assistant-hook.mdx +1 -1
  37. package/.docs/raw/docs/runtimes/ai-sdk/use-chat-hook.mdx +2 -2
  38. package/.docs/raw/docs/runtimes/ai-sdk/use-chat-v5.mdx +129 -0
  39. package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +3 -3
  40. package/.docs/raw/docs/runtimes/custom/external-store.mdx +5 -5
  41. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +2 -2
  42. package/.docs/raw/docs/ui/Attachment.mdx +5 -2
  43. package/.docs/raw/docs/ui/Markdown.mdx +2 -3
  44. package/.docs/raw/docs/ui/PartGrouping.mdx +540 -0
  45. package/.docs/raw/docs/ui/ToolFallback.mdx +2 -2
  46. package/.docs/raw/docs/ui/ToolGroup.mdx +96 -0
  47. package/package.json +8 -8
  48. package/.docs/raw/docs/api-reference/runtimes/ContentPartRuntime.mdx +0 -22
@@ -4,7 +4,7 @@
4
4
 
5
5
  ```typescript
6
6
  import { openai } from "@ai-sdk/openai";
7
- import { frontendTools } from "@assistant-ui/react-ai-sdk";
7
+ import { frontendTools } from "@assistant-ui/react-ai-sdk-v4";
8
8
  import { streamText } from "ai";
9
9
 
10
10
  export const runtime = "edge";
@@ -189,7 +189,7 @@ export default function RootLayout({
189
189
  "use client";
190
190
 
191
191
  import { AssistantRuntimeProvider } from "@assistant-ui/react";
192
- import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
192
+ import { useChatRuntime } from "@assistant-ui/react-ai-sdk-v4";
193
193
 
194
194
  export function MyRuntimeProvider({
195
195
  children,
@@ -753,7 +753,7 @@ const UserMessage: FC = () => {
753
753
  <UserActionBar />
754
754
 
755
755
  <div className="bg-muted text-foreground col-start-2 row-start-2 max-w-[calc(var(--thread-max-width)*0.8)] break-words rounded-3xl px-5 py-2.5">
756
- <MessagePrimitive.Content />
756
+ <MessagePrimitive.Parts />
757
757
  </div>
758
758
 
759
759
  <BranchPicker className="col-span-full col-start-1 row-start-3 -mr-1 justify-end" />
@@ -798,7 +798,7 @@ const AssistantMessage: FC = () => {
798
798
  return (
799
799
  <MessagePrimitive.Root className="relative grid w-full max-w-[var(--thread-max-width)] grid-cols-[auto_auto_1fr] grid-rows-[auto_1fr] py-4">
800
800
  <div className="text-foreground col-span-2 col-start-2 row-start-1 my-1.5 max-w-[calc(var(--thread-max-width)*0.8)] break-words leading-7">
801
- <MessagePrimitive.Content components={{ Text: MarkdownText }} />
801
+ <MessagePrimitive.Parts components={{ Text: MarkdownText }} />
802
802
  </div>
803
803
 
804
804
  <AssistantActionBar />
@@ -1654,7 +1654,7 @@ export default nextConfig;
1654
1654
  "@assistant-ui/react-ai-sdk": "workspace:*",
1655
1655
  "@assistant-ui/react-hook-form": "workspace:*",
1656
1656
  "@assistant-ui/react-markdown": "workspace:*",
1657
- "@hookform/resolvers": "^5.1.1",
1657
+ "@hookform/resolvers": "^5.2.1",
1658
1658
  "@radix-ui/react-avatar": "^1.1.10",
1659
1659
  "@radix-ui/react-icons": "^1.3.2",
1660
1660
  "@radix-ui/react-label": "^2.1.7",
@@ -1666,18 +1666,18 @@ export default nextConfig;
1666
1666
  "class-variance-authority": "^0.7.1",
1667
1667
  "clsx": "^2.1.1",
1668
1668
  "json-schema-to-zod": "^2.6.1",
1669
- "lucide-react": "^0.515.0",
1670
- "next": "15.3.3",
1671
- "react": "19.1.0",
1672
- "react-dom": "19.1.0",
1673
- "react-hook-form": "^7.58.0",
1674
- "react-resizable-panels": "^3.0.3",
1669
+ "lucide-react": "^0.535.0",
1670
+ "next": "15.4.5",
1671
+ "react": "19.1.1",
1672
+ "react-dom": "19.1.1",
1673
+ "react-hook-form": "^7.61.1",
1674
+ "react-resizable-panels": "^3.0.4",
1675
1675
  "remark-gfm": "^4.0.1",
1676
1676
  "tailwind-merge": "^3.3.1",
1677
- "tw-animate-css": "^1.3.4",
1678
- "zod": "^3.25.64",
1679
- "zod-to-json-schema": "^3.24.5",
1680
- "zustand": "^5.0.5"
1677
+ "tw-animate-css": "^1.3.6",
1678
+ "zod": "^4.0.14",
1679
+ "zod-to-json-schema": "^3.24.6",
1680
+ "zustand": "^5.0.7"
1681
1681
  },
1682
1682
  "devDependencies": {
1683
1683
  "@assistant-ui/x-buildutils": "workspace:*",
@@ -1685,10 +1685,10 @@ export default nextConfig;
1685
1685
  "@types/react": "^19",
1686
1686
  "@types/react-dom": "^19",
1687
1687
  "eslint": "^9",
1688
- "eslint-config-next": "15.3.3",
1688
+ "eslint-config-next": "15.4.5",
1689
1689
  "postcss": "^8",
1690
- "tailwindcss": "^4.1.10",
1691
- "typescript": "^5.8.3"
1690
+ "tailwindcss": "^4.1.11",
1691
+ "typescript": "^5.9.2"
1692
1692
  }
1693
1693
  }
1694
1694
 
@@ -41,4 +41,13 @@ assistant-ui helps you create beautiful, enterprise-grade AI chat interfaces in
41
41
  [Get Started in 30 Seconds](/docs/getting-started).
42
42
  </Callout>
43
43
 
44
+ ## AI Accessible Documentation
45
+
46
+ Our docs are easily accessible to AI assistants through several methods:
47
+
48
+ - **[MCP Docs Server](/docs/mcp-docs-server)** - Direct MCP integration for IDEs and agents
49
+ - **`/llms.txt`** - Structured index of all documentation pages
50
+ - **`/llms-full.txt`** - Complete documentation in a single file
51
+ - **`.mdx` suffix** - Add `.mdx` to any page's URL for raw markdown content
52
+
44
53
 
@@ -1,11 +1,11 @@
1
1
  ---
2
- title: <TextContentPartProvider />
2
+ title: <TextMessagePartProvider />
3
3
  ---
4
4
 
5
5
  import { ParametersTable } from "@/components/docs";
6
6
  import { AssistantRuntimeProvider } from "@/generated/typeDocs";
7
7
 
8
- The `TextContentPartProvider` provides data and APIs for `TextContentPart` components.
8
+ The `TextMessagePartProvider` provides data and APIs for `TextMessagePart` components.
9
9
 
10
10
  This is useful if you want to reuse the same `Text` component outside of a message text, e.g. with the `@assistant-ui/react-markdown` package.
11
11
 
@@ -14,7 +14,7 @@ import { AssistantRuntimeProvider } from "@assistant-ui/react";
14
14
 
15
15
  const MyApp = () => {
16
16
  return (
17
- <TextContentPartProvider text={"Hello!"}>
17
+ <TextMessagePartProvider text={"Hello!"}>
18
18
  <MyMarkdownText />
19
19
  </AssistantRuntimeProvider>
20
20
  );
@@ -51,7 +51,7 @@ Drop-in replacement hook for `useForm` that adds support for `@assistant-ui/reac
51
51
  parameters: [
52
52
  {
53
53
  name: "render",
54
- type: "ToolCallContentPartComponent<{ name: string; value: string; }, {}>",
54
+ type: "ToolCallMessagePartComponent<{ name: string; value: string; }, {}>",
55
55
  description:
56
56
  "The component to render when set_form_field is called.",
57
57
  },
@@ -68,7 +68,7 @@ Drop-in replacement hook for `useForm` that adds support for `@assistant-ui/reac
68
68
  parameters: [
69
69
  {
70
70
  name: "render",
71
- type: "ToolCallContentPartComponent<{}, {}>",
71
+ type: "ToolCallMessagePartComponent<{}, {}>",
72
72
  description:
73
73
  "The component to render when submit_form is called.",
74
74
  },
@@ -11,7 +11,7 @@ export const contextColors = {
11
11
  "Thread Context": "#45a049",
12
12
  "Composer Context": "#ff9933",
13
13
  "Message Context": "#bb2244",
14
- "ContentPart Context": "#268bd2",
14
+ "MessagePart Context": "#268bd2",
15
15
  "Attachment Context": "#FFB6C1",
16
16
  "ThreadListItem Context": "#c678dd",
17
17
  };
@@ -93,20 +93,20 @@ export const contextColors = {
93
93
  </Component>
94
94
 
95
95
  <Component
96
- name="TextContentPartProvider"
96
+ name="TextMessagePartProvider"
97
97
  isContextProvider={true}
98
98
  providedContexts={[
99
99
  {
100
- name: "Text ContentPart Context",
101
- color: contextColors["ContentPart Context"],
102
- link: "#contentpart-context",
100
+ name: "Text MessagePart Context",
101
+ color: contextColors["MessagePart Context"],
102
+ link: "#MessagePart-context",
103
103
  },
104
104
  ]}
105
- docsLink="./context-providers/TextContentPartProvider"
106
- tooltip="Provides context for text content parts"
105
+ docsLink="./context-providers/TextMessagePartProvider"
106
+ tooltip="Provides context for text message parts"
107
107
  props="text={text}"
108
108
  >
109
- <Component name="ContentPart" isLink={true} />
109
+ <Component name="MessagePart" isLink={true} />
110
110
  </Component>
111
111
 
112
112
  <ContextLevel color={contextColors["Assistant Context"]}>
@@ -356,16 +356,16 @@ Manages the state and actions for individual messages
356
356
  tooltip="Root component for a message"
357
357
  >
358
358
  <Component
359
- name="MessagePrimitive.Content"
359
+ name="MessagePrimitive.Parts"
360
360
  isContextProvider={true}
361
361
  providedContexts={[
362
362
  {
363
- name: "ContentPart Context",
364
- color: contextColors["ContentPart Context"],
363
+ name: "MessagePart Context",
364
+ color: contextColors["MessagePart Context"],
365
365
  },
366
366
  ]}
367
- docsLink="#message-primitive-content"
368
- tooltip="Displays the content of the message"
367
+ docsLink="#message-primitive-parts"
368
+ tooltip="Displays the parts of the message"
369
369
  />
370
370
  <Component
371
371
  name="MessagePrimitive.Attachments"
@@ -456,23 +456,23 @@ Manages the state and actions for individual messages
456
456
 
457
457
  </ContextLevel>
458
458
 
459
- <ContextLevel color={contextColors["ContentPart Context"]}>
459
+ <ContextLevel color={contextColors["MessagePart Context"]}>
460
460
 
461
- ## ContentPart Context
461
+ ## MessagePart Context
462
462
 
463
- Manages the state and actions for content parts within messages
463
+ Manages the state and actions for message parts within messages
464
464
 
465
- ### ContentPartRuntime
465
+ ### MessagePartRuntime
466
466
 
467
- - [`useContentPart`](#use-content-part)
468
- - [`useContentPartText`](#use-content-part-text)
469
- - [`useContentPartReasoning`](#use-content-part-reasoning)
470
- - [`useContentPartRuntime`](#use-content-part-runtime)
467
+ - [`useMessagePart`](#use-content-part)
468
+ - [`useMessagePartText`](#use-content-part-text)
469
+ - [`useMessagePartReasoning`](#use-content-part-reasoning)
470
+ - [`useMessagePartRuntime`](#use-content-part-runtime)
471
471
 
472
- ### ContentPartPrimitive
472
+ ### MessagePartPrimitive
473
473
 
474
474
  <Component
475
- name="ContentPartPrimitive.Text"
475
+ name="MessagePartPrimitive.Text"
476
476
  docsLink="#content-part-text"
477
477
  tooltip="Represents a text part of the message content"
478
478
  />
@@ -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: "Change the component to the HTML tag or custom component of the only child.",
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: "Optional custom content to display instead of the default error message.",
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.Content />
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: ContentPartPrimitive
3
- description: A part of a message's content. Content parts may be text, image, tool call or UI elements.
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
- ContentPartRuntime,
9
- TextContentPartState,
10
- AudioContentPartState,
11
- ToolCallContentPartState,
8
+ MessagePartRuntime,
9
+ TextMessagePartState,
10
+ AudioMessagePartState,
11
+ ToolCallMessagePartState,
12
12
  } from "@/generated/typeDocs";
13
13
 
14
- Each message can have any number of content parts.
15
- Content parts are usually one of text, reasoning, audio or tool-call.
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
- ## Content Part Types
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 { ContentPartPrimitive } from "@assistant-ui/react";
38
+ import { MessagePartPrimitive } from "@assistant-ui/react";
39
39
 
40
- const TextContentPart = () => {
41
- return <ContentPartPrimitive.Text />;
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 { ContentPartPrimitive } from "@assistant/react";
50
+ import { MessagePartPrimitive } from "@assistant/react";
51
51
 
52
- <ContentPartPrimitive.Text />;
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 content part is in progress.
71
+ Renders children only if the message part is in progress.
72
72
 
73
73
  ```tsx
74
- import { ContentPartPrimitive } from "@assistant/react";
74
+ import { MessagePartPrimitive } from "@assistant/react";
75
75
 
76
- <ContentPartPrimitive.InProgress>
76
+ <MessagePartPrimitive.InProgress>
77
77
  <LoadingIndicator />
78
- </ContentPartPrimitive.InProgress>;
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
- Content part context is provided by `MessagePrimitive.Content` or `TextContentPartProvider`
107
+ Message part context is provided by `MessagePrimitive.Parts` or `TextMessagePartProvider`
108
108
 
109
- ### MessagePrimitive.Content
109
+ ### MessagePrimitive.Parts
110
110
 
111
111
  ```tsx
112
112
  import { MessagePrimitive } from "@assistant/react";
113
113
 
114
- <MessagePrimitive.Content
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
- ### TextContentPartProvider
129
+ ### TextMessagePartProvider
130
130
 
131
- This is a helper context provider to allow you to reuse the content part components outside a message content part.
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 { TextContentPartProvider } from "@assistant-ui/react";
134
+ import { TextMessagePartProvider } from "@assistant-ui/react";
135
135
 
136
- <TextContentPartProvider text="Hello world" isRunning={false}>
137
- <ContentPart.Text />
138
- </TextContentPartProvider>;
136
+ <TextMessagePartProvider text="Hello world" isRunning={false}>
137
+ <MessagePart.Text />
138
+ </TextMessagePartProvider>;
139
139
  ```
140
140
 
141
141
  ## Runtime API
142
142
 
143
- ### `useContentPartRuntime`
143
+ ### `useMessagePartRuntime`
144
144
 
145
145
  ```tsx
146
- import { useContentPartRuntime } from "@assistant-ui/react";
146
+ import { useMessagePartRuntime } from "@assistant-ui/react";
147
147
 
148
- const contentPartRuntime = useContentPartRuntime();
148
+ const MessagePartRuntime = useMessagePartRuntime();
149
149
  ```
150
150
 
151
- <ParametersTable {...ContentPartRuntime} />
151
+ <ParametersTable {...MessagePartRuntime} />
152
152
 
153
- ### `useContentPart`
153
+ ### `useMessagePart`
154
154
 
155
155
  ```tsx
156
- import { useContentPart } from "@assistant-ui/react";
156
+ import { useMessagePart } from "@assistant-ui/react";
157
157
 
158
- const contentPart = useContentPart();
158
+ const MessagePart = useMessagePart();
159
159
  ```
160
160
 
161
- <ParametersTable {...TextContentPartState} />
162
- <ParametersTable {...AudioContentPartState} />
163
- <ParametersTable {...ToolCallContentPartState} />
161
+ <ParametersTable {...TextMessagePartState} />
162
+ <ParametersTable {...AudioMessagePartState} />
163
+ <ParametersTable {...ToolCallMessagePartState} />
164
164
 
165
- ### `useContentPartText`
165
+ ### `useMessagePartText`
166
166
 
167
167
  ```tsx
168
- import { useContentPartText } from "@assistant-ui/react";
168
+ import { useMessagePartText } from "@assistant-ui/react";
169
169
 
170
- const contentPartText = useContentPartText();
170
+ const MessagePartText = useMessagePartText();
171
171
  ```
172
172
 
173
- <ParametersTable {...TextContentPartState} />
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} />
@@ -26,6 +26,7 @@ import { useThreadList } from "@assistant-ui/react";
26
26
 
27
27
  const threadList = useThreadList();
28
28
  const threads = useThreadList((m) => m.threads);
29
+ const isLoading = useThreadList((m) => m.isLoading);
29
30
  ```
30
31
 
31
32
  <ParametersTable {...ThreadListState} />
@@ -30,6 +30,7 @@ import { useThread } from "@assistant-ui/react";
30
30
 
31
31
  const thread = useThread();
32
32
  const isRunning = useThread((m) => m.isRunning);
33
+ const isLoading = useThread((m) => m.isLoading);
33
34
  ```
34
35
 
35
36
  <ParametersTable {...ThreadState} />
@@ -2,53 +2,110 @@
2
2
  title: Chat History for AI SDK
3
3
  ---
4
4
 
5
+ import { Steps, Step } from 'fumadocs-ui/components/steps';
6
+ import { Callout } from 'fumadocs-ui/components/callout';
7
+
5
8
  ## Overview
6
9
 
7
- With the help of assistant-cloud, you can add thread management and thread history capabilities to assistant-ui. This guide will walk you through the process of integrating assistant-cloud with the AI SDK by Vercel.
10
+ assistant-cloud provides thread management and persistent chat history for applications built with the [AI SDK by Vercel](https://sdk.vercel.ai/). This guide shows you how to integrate cloud persistence into your AI SDK application.
11
+
12
+ ## Prerequisites
13
+
14
+ <Callout type="info">
15
+ You need an assistant-cloud account to follow this guide. [Sign up here](https://cloud.assistant-ui.com/) to get started.
16
+ </Callout>
17
+
18
+ ## Setup Guide
19
+
20
+ <Steps>
21
+
22
+ <Step>
23
+
24
+ ### Create a Cloud Project
25
+
26
+ Create a new project in the [assistant-cloud dashboard](https://cloud.assistant-ui.com/) and from the settings page, copy:
27
+
28
+ - **Frontend API URL**: `https://proj-[ID].assistant-api.com`
29
+ - **Assistant Cloud API Key**: `sk_aui_proj_*`
30
+
31
+ </Step>
32
+
33
+ <Step>
34
+
35
+ ### Configure Environment Variables
36
+
37
+ Add the following environment variables to your project:
8
38
 
9
- ### Prerequisites
39
+ ```bash title=".env.local"
40
+ # Frontend API URL from your cloud project settings
41
+ NEXT_PUBLIC_ASSISTANT_BASE_URL=https://proj-[YOUR-ID].assistant-api.com
10
42
 
11
- You need an assistant-cloud account to follow this guide. You can sign up here: [https://cloud.assistant-ui.com/](https://cloud.assistant-ui.com/)
43
+ # API key for server-side operations
44
+ ASSISTANT_API_KEY=your-api-key-here
45
+ ```
46
+
47
+ </Step>
12
48
 
13
- ### Setting up assistant-cloud project in your react project:
49
+ <Step>
14
50
 
15
- 1. Create a new project on the assistant-cloud dashboard and copy the Frontend API URL (`https://proj-[ID].assistant-api.com`) from the settings page.
16
- 2. Add the url as an environment variable `NEXT_PUBLIC_ASSISTANT_BASE_URL`
51
+ ### Install Dependencies
52
+
53
+ Install the required packages:
17
54
 
18
55
  ```bash
19
- NEXT_PUBLIC_ASSISTANT_BASE_URL=[YOUR_FRONTEND_API_URL]
56
+ npm install @assistant-ui/react @assistant-ui/react-ai-sdk
20
57
  ```
21
- 3. Create a client side AssistantCloud instance. Note: this will create an anonymous user id that is tied to the user's browser session. For connecting to an auth provider to persist threads for a user based on a workspace and/or user id, look at [Cloud Authorization Docs](/docs/cloud/authorization).
22
58
 
23
- ```typescript
59
+ </Step>
60
+
61
+ <Step>
62
+
63
+ ### Set Up the Cloud Runtime
64
+
65
+ Create a client-side AssistantCloud instance and integrate it with your AI SDK runtime:
66
+
67
+ ```tsx title="app/chat/page.tsx"
24
68
  "use client";
25
- import {
26
- AssistantCloud,
27
- AssistantRuntimeProvider,
28
- ThreadList,
29
- Thread
30
- } from "@assistant-ui/react";
69
+
70
+ import { AssistantCloud, AssistantRuntimeProvider } from "@assistant-ui/react";
31
71
  import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
72
+ import { ThreadList } from "@/components/assistant-ui/thread-list";
73
+ import { Thread } from "@/components/assistant-ui/thread";
74
+
75
+ export default function ChatPage() {
76
+ const cloud = new AssistantCloud({
77
+ baseUrl: process.env.NEXT_PUBLIC_ASSISTANT_BASE_URL!,
78
+ anonymous: true, // Creates browser-session based user ID
79
+ });
80
+
81
+ const runtime = useChatRuntime({
82
+ api: "/api/chat", // Your AI SDK endpoint
83
+ cloud,
84
+ });
85
+
86
+ return (
87
+ <AssistantRuntimeProvider runtime={runtime}>
88
+ <div className="grid h-dvh grid-cols-[200px_1fr] gap-x-2 px-4 py-4">
89
+ <ThreadList />
90
+ <Thread />
91
+ </div>
92
+ </AssistantRuntimeProvider>
93
+ );
94
+ }
95
+ ```
96
+
97
+ </Step>
32
98
 
99
+ </Steps>
33
100
 
34
- const cloud = new AssistantCloud({
35
- baseUrl: process.env["NEXT_PUBLIC_ASSISTANT_BASE_URL"]!,
36
- anonymous: true,
37
- });
101
+ ## Authentication
38
102
 
103
+ The example above uses `anonymous: true` which creates a browser session-based user ID. This is suitable for public demos or prototypes.
39
104
 
40
- const runtime = useChatRuntime({
41
- api: "/api/chat",
42
- cloud,
43
- });
105
+ For production apps with user accounts, see the [Cloud Authorization](/docs/cloud/authorization) guide to persist threads per user or workspace.
44
106
 
45
- return (
46
- <AssistantRuntimeProvider runtime={runtime}>
47
- <div className="grid h-dvh grid-cols-[200px_1fr] gap-x-2 px-4 py-4">
48
- <ThreadList />
49
- <Thread />
50
- </div>
51
- </AssistantRuntimeProvider>
52
- );
107
+ ## Next Steps
53
108
 
54
- ```
109
+ - Learn about [user authentication](/docs/cloud/authorization) for multi-user applications
110
+ - Explore [runtime hooks](/docs/api-reference/integrations/vercel-ai-sdk) and integration options
111
+ - Check out the [complete example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-cloud) on GitHub